summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authoraldyh <aldyh@138bc75d-0d04-0410-961f-82ee72b054a4>2011-11-08 03:20:30 +0000
committeraldyh <aldyh@138bc75d-0d04-0410-961f-82ee72b054a4>2011-11-08 03:20:30 +0000
commit643df0593c630691fa6877cddeefdd4c3023d444 (patch)
tree1eb48ad31d05a9ce117bedc17115de96dffa2f0b /gcc
parent54f3f029d816c6d1626310649adfda740e203f7b (diff)
parentd5d8f1ccc6d3972dc5cfc0949e85e0b1c9e24ee0 (diff)
downloadgcc-643df0593c630691fa6877cddeefdd4c3023d444.tar.gz
* Merge from mainline rev 181122.transactional-memory
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/transactional-memory@181148 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog1883
-rw-r--r--gcc/DATESTAMP2
-rw-r--r--gcc/Makefile.in180
-rw-r--r--gcc/ada/ChangeLog400
-rw-r--r--gcc/ada/Makefile.rtl10
-rw-r--r--gcc/ada/a-cbdlli.adb16
-rw-r--r--gcc/ada/a-cdlili.adb48
-rw-r--r--gcc/ada/a-cdlili.ads4
-rw-r--r--gcc/ada/a-cgaaso.adb104
-rw-r--r--gcc/ada/a-cidlli.adb48
-rw-r--r--gcc/ada/a-cidlli.ads4
-rw-r--r--gcc/ada/a-cihama.adb65
-rw-r--r--gcc/ada/a-cihama.ads4
-rw-r--r--gcc/ada/a-cihase.adb38
-rw-r--r--gcc/ada/a-cihase.ads4
-rw-r--r--gcc/ada/a-ciorma.adb44
-rw-r--r--gcc/ada/a-ciorma.ads4
-rw-r--r--gcc/ada/a-ciormu.adb29
-rw-r--r--gcc/ada/a-ciormu.ads6
-rw-r--r--gcc/ada/a-ciorse.adb27
-rw-r--r--gcc/ada/a-ciorse.ads4
-rw-r--r--gcc/ada/a-cobove.adb18
-rw-r--r--gcc/ada/a-cogeso.adb127
-rw-r--r--gcc/ada/a-cogeso.ads40
-rw-r--r--gcc/ada/a-cohama.adb97
-rw-r--r--gcc/ada/a-cohama.ads25
-rw-r--r--gcc/ada/a-cohase.adb40
-rw-r--r--gcc/ada/a-cohase.ads6
-rw-r--r--gcc/ada/a-coinve.adb60
-rw-r--r--gcc/ada/a-coinve.ads4
-rw-r--r--gcc/ada/a-convec.adb60
-rw-r--r--gcc/ada/a-convec.ads5
-rw-r--r--gcc/ada/a-coorma.adb44
-rw-r--r--gcc/ada/a-coorma.ads4
-rw-r--r--gcc/ada/a-coormu.adb29
-rw-r--r--gcc/ada/a-coormu.ads6
-rw-r--r--gcc/ada/a-coorse.adb27
-rw-r--r--gcc/ada/a-coorse.ads4
-rw-r--r--gcc/ada/a-sbecin.adb (renamed from gcc/ada/i-forbla-darwin.adb)28
-rw-r--r--gcc/ada/a-sbecin.ads (renamed from gcc/ada/i-forbla.adb)34
-rw-r--r--gcc/ada/a-sbhcin.adb38
-rw-r--r--gcc/ada/a-sbhcin.ads (renamed from gcc/ada/i-forbla-unimplemented.ads)33
-rw-r--r--gcc/ada/a-sblcin.adb40
-rw-r--r--gcc/ada/a-sblcin.ads42
-rw-r--r--gcc/ada/a-sfecin.ads40
-rw-r--r--gcc/ada/a-sfhcin.ads41
-rw-r--r--gcc/ada/a-sflcin.ads40
-rw-r--r--gcc/ada/a-suecin.adb47
-rw-r--r--gcc/ada/a-suecin.ads38
-rw-r--r--gcc/ada/a-suhcin.adb43
-rw-r--r--gcc/ada/a-suhcin.ads40
-rw-r--r--gcc/ada/a-sulcin.adb47
-rw-r--r--gcc/ada/a-sulcin.ads38
-rwxr-xr-xgcc/ada/aspects.adb14
-rwxr-xr-xgcc/ada/aspects.ads12
-rw-r--r--gcc/ada/atree.adb9
-rw-r--r--gcc/ada/atree.ads22
-rw-r--r--gcc/ada/bindgen.adb76
-rw-r--r--gcc/ada/checks.adb19
-rw-r--r--gcc/ada/errout.adb2
-rw-r--r--gcc/ada/exp_alfa.adb63
-rw-r--r--gcc/ada/exp_attr.adb6
-rw-r--r--gcc/ada/exp_ch11.adb12
-rw-r--r--gcc/ada/exp_ch2.adb43
-rw-r--r--gcc/ada/exp_ch4.adb77
-rw-r--r--gcc/ada/exp_ch5.adb39
-rw-r--r--gcc/ada/exp_ch6.adb15
-rw-r--r--gcc/ada/exp_ch8.adb116
-rw-r--r--gcc/ada/exp_ch8.ads2
-rw-r--r--gcc/ada/exp_util.adb253
-rw-r--r--gcc/ada/exp_util.ads13
-rw-r--r--gcc/ada/freeze.adb10
-rw-r--r--gcc/ada/g-excact.adb4
-rw-r--r--gcc/ada/g-socket.adb38
-rw-r--r--gcc/ada/g-socket.ads13
-rw-r--r--gcc/ada/gcc-interface/Make-lang.in138
-rw-r--r--gcc/ada/gcc-interface/Makefile.in8
-rw-r--r--gcc/ada/gcc-interface/decl.c3
-rw-r--r--gcc/ada/gnat_rm.texi34
-rw-r--r--gcc/ada/gnat_ugn.texi454
-rw-r--r--gcc/ada/i-forbla.ads261
-rw-r--r--gcc/ada/i-forlap.ads414
-rw-r--r--gcc/ada/impunit.adb16
-rw-r--r--gcc/ada/par-labl.adb5
-rw-r--r--gcc/ada/prj-env.adb154
-rw-r--r--gcc/ada/prj-env.ads11
-rw-r--r--gcc/ada/projects.texi6
-rw-r--r--gcc/ada/s-atocou.ads1
-rw-r--r--gcc/ada/s-gecobl.adb350
-rw-r--r--gcc/ada/s-gecobl.ads102
-rw-r--r--gcc/ada/s-gecola.adb493
-rw-r--r--gcc/ada/s-gecola.ads131
-rw-r--r--gcc/ada/s-gerebl.adb311
-rw-r--r--gcc/ada/s-gerebl.ads96
-rw-r--r--gcc/ada/s-gerela.adb564
-rw-r--r--gcc/ada/s-gerela.ads128
-rw-r--r--gcc/ada/s-tassta.adb2
-rw-r--r--gcc/ada/sem_ch10.adb8
-rw-r--r--gcc/ada/sem_ch12.adb10
-rw-r--r--gcc/ada/sem_ch13.adb27
-rw-r--r--gcc/ada/sem_ch4.adb51
-rw-r--r--gcc/ada/sem_ch5.adb26
-rw-r--r--gcc/ada/sem_ch6.adb16
-rw-r--r--gcc/ada/sem_prag.adb214
-rw-r--r--gcc/ada/sem_res.adb12
-rw-r--r--gcc/ada/sem_util.adb9
-rw-r--r--gcc/ada/sem_warn.adb70
-rw-r--r--gcc/ada/sigtramp-ppcvxw.c47
-rw-r--r--gcc/ada/sinfo.adb10
-rw-r--r--gcc/ada/sinfo.ads9
-rw-r--r--gcc/ada/sinput.adb3
-rw-r--r--gcc/ada/sprint.adb10
-rw-r--r--gcc/builtin-types.def53
-rw-r--r--gcc/builtins.c837
-rw-r--r--gcc/c-decl.c83
-rw-r--r--gcc/c-family/ChangeLog69
-rw-r--r--gcc/c-family/c-common.c623
-rw-r--r--gcc/c-family/c-common.h7
-rw-r--r--gcc/c-family/c-cppbuiltin.c50
-rw-r--r--gcc/c-family/c-opts.c18
-rw-r--r--gcc/c-family/c.opt8
-rw-r--r--gcc/c-parser.c70
-rw-r--r--gcc/c-tree.h8
-rw-r--r--gcc/c-typeck.c9
-rw-r--r--gcc/cfglayout.c6
-rw-r--r--gcc/collect2.c54
-rw-r--r--gcc/common.opt8
-rw-r--r--gcc/common/config/alpha/alpha-common.c14
-rw-r--r--gcc/common/config/epiphany/epiphany-common.c46
-rw-r--r--gcc/config.gcc316
-rw-r--r--gcc/config/alpha/alpha-protos.h3
-rw-r--r--gcc/config/alpha/alpha.c246
-rw-r--r--gcc/config/alpha/alpha.md20
-rw-r--r--gcc/config/alpha/libgcc-alpha-ldbl.ver50
-rw-r--r--gcc/config/alpha/qrnnd.asm163
-rw-r--r--gcc/config/alpha/t-alpha2
-rw-r--r--gcc/config/alpha/t-ieee2
-rw-r--r--gcc/config/alpha/t-linux1
-rw-r--r--gcc/config/alpha/t-vms45
-rw-r--r--gcc/config/alpha/vms-dwarf2.asm77
-rw-r--r--gcc/config/alpha/vms-dwarf2eh.asm30
-rw-r--r--gcc/config/alpha/vms-gcc_shell_handler.c124
-rw-r--r--gcc/config/alpha/vms.h61
-rw-r--r--gcc/config/alpha/vms64.h51
-rw-r--r--gcc/config/arm/arm.c4
-rw-r--r--gcc/config/arm/bpabi-v6m.S318
-rw-r--r--gcc/config/arm/bpabi.S163
-rw-r--r--gcc/config/arm/bpabi.c56
-rw-r--r--gcc/config/arm/bpabi.h1
-rw-r--r--gcc/config/arm/crti.asm86
-rw-r--r--gcc/config/arm/crtn.asm82
-rw-r--r--gcc/config/arm/fp16.c145
-rw-r--r--gcc/config/arm/ieee754-df.S1447
-rw-r--r--gcc/config/arm/ieee754-sf.S1060
-rw-r--r--gcc/config/arm/lib1funcs.asm1829
-rw-r--r--gcc/config/arm/libgcc-bpabi.ver108
-rw-r--r--gcc/config/arm/linux-atomic-64bit.c166
-rw-r--r--gcc/config/arm/linux-atomic.c279
-rw-r--r--gcc/config/arm/linux-eabi.h2
-rw-r--r--gcc/config/arm/rtems-eabi.h29
-rw-r--r--gcc/config/arm/rtems-elf.h2
-rw-r--r--gcc/config/arm/t-arm3
-rw-r--r--gcc/config/arm/t-arm-elf37
-rw-r--r--gcc/config/arm/t-bpabi30
-rw-r--r--gcc/config/arm/t-linux34
-rw-r--r--gcc/config/arm/t-linux-eabi15
-rw-r--r--gcc/config/arm/t-netbsd47
-rw-r--r--gcc/config/arm/t-rtems41
-rw-r--r--gcc/config/arm/t-rtems-eabi8
-rw-r--r--gcc/config/arm/t-strongarm-elf20
-rw-r--r--gcc/config/arm/t-symbian23
-rw-r--r--gcc/config/arm/t-vxworks2
-rw-r--r--gcc/config/arm/t-wince-pe6
-rw-r--r--gcc/config/arm/unaligned-funcs.c57
-rw-r--r--gcc/config/avr/avr-c.c4
-rw-r--r--gcc/config/avr/avr-modes.def1
-rw-r--r--gcc/config/avr/avr-protos.h8
-rw-r--r--gcc/config/avr/avr.c859
-rw-r--r--gcc/config/avr/avr.md599
-rw-r--r--gcc/config/avr/constraints.md20
-rw-r--r--gcc/config/avr/libgcc.S1533
-rw-r--r--gcc/config/avr/t-avr59
-rw-r--r--gcc/config/bfin/crti.s59
-rw-r--r--gcc/config/bfin/crtn.s50
-rw-r--r--gcc/config/bfin/lib1funcs.asm211
-rw-r--r--gcc/config/bfin/libgcc-bfin.ver1914
-rw-r--r--gcc/config/bfin/t-bfin34
-rw-r--r--gcc/config/bfin/t-bfin-elf23
-rw-r--r--gcc/config/bfin/t-bfin-linux11
-rw-r--r--gcc/config/bfin/t-bfin-uclinux15
-rw-r--r--gcc/config/c6x/crti.s39
-rw-r--r--gcc/config/c6x/eqd.c47
-rw-r--r--gcc/config/c6x/eqf.c47
-rw-r--r--gcc/config/c6x/ged.c47
-rw-r--r--gcc/config/c6x/gef.c47
-rw-r--r--gcc/config/c6x/gtd.c47
-rw-r--r--gcc/config/c6x/gtf.c47
-rw-r--r--gcc/config/c6x/led.c47
-rw-r--r--gcc/config/c6x/lef.c47
-rw-r--r--gcc/config/c6x/lib1funcs.asm438
-rw-r--r--gcc/config/c6x/libgcc-c6xeabi.ver103
-rw-r--r--gcc/config/c6x/ltd.c47
-rw-r--r--gcc/config/c6x/ltf.c47
-rw-r--r--gcc/config/c6x/t-c6x-elf37
-rw-r--r--gcc/config/c6x/t-c6x-uclinux4
-rw-r--r--gcc/config/cris/arit.c304
-rw-r--r--gcc/config/cris/constraints.md164
-rw-r--r--gcc/config/cris/cris.c13
-rw-r--r--gcc/config/cris/cris.h137
-rw-r--r--gcc/config/cris/cris.md69
-rw-r--r--gcc/config/cris/cris_abi_symbol.c45
-rw-r--r--gcc/config/cris/libgcc.ver7
-rw-r--r--gcc/config/cris/mulsi3.asm255
-rw-r--r--gcc/config/cris/t-cris12
-rw-r--r--gcc/config/cris/t-elfmulti4
-rw-r--r--gcc/config/cris/t-linux4
-rw-r--r--gcc/config/darwin-64.c72
-rw-r--r--gcc/config/divmod.c73
-rw-r--r--gcc/config/epiphany/constraints.md125
-rw-r--r--gcc/config/epiphany/epiphany-modes.def40
-rw-r--r--gcc/config/epiphany/epiphany-protos.h55
-rw-r--r--gcc/config/epiphany/epiphany-sched.md135
-rw-r--r--gcc/config/epiphany/epiphany.c2751
-rw-r--r--gcc/config/epiphany/epiphany.h881
-rw-r--r--gcc/config/epiphany/epiphany.md2447
-rw-r--r--gcc/config/epiphany/epiphany.opt140
-rw-r--r--gcc/config/epiphany/epiphany_intrinsics.h (renamed from gcc/config/c6x/crtn.s)28
-rw-r--r--gcc/config/epiphany/mode-switch-use.c91
-rw-r--r--gcc/config/epiphany/predicates.md352
-rw-r--r--gcc/config/epiphany/resolve-sw-modes.c182
-rw-r--r--gcc/config/epiphany/t-epiphany32
-rw-r--r--gcc/config/floatunsidf.c15
-rw-r--r--gcc/config/floatunsisf.c18
-rw-r--r--gcc/config/floatunsitf.c15
-rw-r--r--gcc/config/floatunsixf.c15
-rw-r--r--gcc/config/fr30/crti.asm61
-rw-r--r--gcc/config/fr30/crtn.asm44
-rw-r--r--gcc/config/fr30/lib1funcs.asm115
-rw-r--r--gcc/config/fr30/t-fr3044
-rw-r--r--gcc/config/frv/cmovd.c51
-rw-r--r--gcc/config/frv/cmovh.c47
-rw-r--r--gcc/config/frv/cmovw.c51
-rw-r--r--gcc/config/frv/frvbegin.c157
-rw-r--r--gcc/config/frv/frvend.c70
-rw-r--r--gcc/config/frv/lib1funcs.asm269
-rw-r--r--gcc/config/frv/libgcc-frv.ver73
-rw-r--r--gcc/config/frv/modi.c4
-rw-r--r--gcc/config/frv/t-frv63
-rw-r--r--gcc/config/frv/t-linux11
-rw-r--r--gcc/config/frv/uitod.c4
-rw-r--r--gcc/config/frv/uitof.c4
-rw-r--r--gcc/config/frv/ulltod.c4
-rw-r--r--gcc/config/frv/ulltof.c4
-rw-r--r--gcc/config/frv/umodi.c4
-rw-r--r--gcc/config/h8300/clzhi2.c35
-rw-r--r--gcc/config/h8300/crti.asm63
-rw-r--r--gcc/config/h8300/crtn.asm53
-rw-r--r--gcc/config/h8300/ctzhi2.c35
-rw-r--r--gcc/config/h8300/fixunssfsi.c41
-rw-r--r--gcc/config/h8300/lib1funcs.asm838
-rw-r--r--gcc/config/h8300/parityhi2.c36
-rw-r--r--gcc/config/h8300/popcounthi2.c36
-rw-r--r--gcc/config/h8300/t-elf6
-rw-r--r--gcc/config/h8300/t-h830017
-rw-r--r--gcc/config/i386/avx2intrin.h6
-rw-r--r--gcc/config/i386/cygming-crtbegin.c135
-rw-r--r--gcc/config/i386/cygming-crtend.c88
-rw-r--r--gcc/config/i386/cygwin.asm188
-rw-r--r--gcc/config/i386/cygwin.h2
-rw-r--r--gcc/config/i386/darwin-libgcc.10.4.ver98
-rw-r--r--gcc/config/i386/darwin-libgcc.10.5.ver102
-rw-r--r--gcc/config/i386/f16cintrin.h92
-rw-r--r--gcc/config/i386/gthr-win32.c260
-rw-r--r--gcc/config/i386/i386-builtin-types.def5
-rw-r--r--gcc/config/i386/i386-protos.h4
-rw-r--r--gcc/config/i386/i386.c367
-rw-r--r--gcc/config/i386/i386.md201
-rw-r--r--gcc/config/i386/immintrin.h63
-rw-r--r--gcc/config/i386/libgcc-glibc.ver186
-rw-r--r--gcc/config/i386/mingw32.h2
-rw-r--r--gcc/config/i386/predicates.md2
-rw-r--r--gcc/config/i386/sse.md181
-rw-r--r--gcc/config/i386/sync.md455
-rw-r--r--gcc/config/i386/t-crtstuff7
-rw-r--r--gcc/config/i386/t-cygming71
-rw-r--r--gcc/config/i386/t-cygwin39
-rw-r--r--gcc/config/i386/t-darwin3
-rw-r--r--gcc/config/i386/t-darwin646
-rw-r--r--gcc/config/i386/t-dlldir6
-rw-r--r--gcc/config/i386/t-dlldir-x9
-rw-r--r--gcc/config/i386/t-dw2-eh3
-rw-r--r--gcc/config/i386/t-gthr-win322
-rw-r--r--gcc/config/i386/t-i386elf4
-rw-r--r--gcc/config/i386/t-interix3
-rw-r--r--gcc/config/i386/t-linux5
-rw-r--r--gcc/config/i386/t-linux647
-rw-r--r--gcc/config/i386/t-mingw-pthread2
-rw-r--r--gcc/config/i386/t-mingw-w326
-rw-r--r--gcc/config/i386/t-mingw-w646
-rw-r--r--gcc/config/i386/t-mingw322
-rw-r--r--gcc/config/i386/t-nto4
-rw-r--r--gcc/config/i386/t-openbsd2
-rw-r--r--gcc/config/i386/t-sjlj-eh3
-rw-r--r--gcc/config/ia64/crtbegin.asm254
-rw-r--r--gcc/config/ia64/crtend.asm121
-rw-r--r--gcc/config/ia64/crti.asm53
-rw-r--r--gcc/config/ia64/crtn.asm43
-rw-r--r--gcc/config/ia64/lib1funcs.asm795
-rw-r--r--gcc/config/ia64/libgcc-glibc.ver97
-rw-r--r--gcc/config/ia64/libgcc-ia64.ver30
-rw-r--r--gcc/config/ia64/quadlib.c78
-rw-r--r--gcc/config/ia64/t-glibc1
-rw-r--r--gcc/config/ia64/t-hpux44
-rw-r--r--gcc/config/ia64/t-ia6425
-rw-r--r--gcc/config/ia64/t-vms47
-rw-r--r--gcc/config/ia64/vms-crtinit.asm24
-rw-r--r--gcc/config/ia64/vms.h28
-rw-r--r--gcc/config/ia64/vms_symvec_libgcc_s.opt89
-rw-r--r--gcc/config/iq2000/lib2extra-funcs.c40
-rw-r--r--gcc/config/iq2000/t-iq200038
-rw-r--r--gcc/config/libgcc-glibc.ver55
-rw-r--r--gcc/config/lm32/t-rtems21
-rw-r--r--gcc/config/m32c/m32c-lib1.S231
-rw-r--r--gcc/config/m32c/m32c-lib2-trapv.c43
-rw-r--r--gcc/config/m32c/m32c-lib2.c134
-rw-r--r--gcc/config/m32c/m32c.c2
-rw-r--r--gcc/config/m32c/t-m32c14
-rw-r--r--gcc/config/m32r/initfini.c168
-rw-r--r--gcc/config/m32r/libgcc-glibc.ver48
-rw-r--r--gcc/config/m32r/t-linux25
-rw-r--r--gcc/config/m32r/t-m32r39
-rw-r--r--gcc/config/m68k/crti.s44
-rw-r--r--gcc/config/m68k/crtn.s40
-rw-r--r--gcc/config/m68k/fpgnulib.c595
-rw-r--r--gcc/config/m68k/lb1sf68.asm4116
-rw-r--r--gcc/config/m68k/t-crtstuff10
-rw-r--r--gcc/config/m68k/t-floatlib31
-rw-r--r--gcc/config/m68k/t-linux4
-rw-r--r--gcc/config/m68k/t-m68kelf4
-rw-r--r--gcc/config/m68k/t-mlibs3
-rw-r--r--gcc/config/m68k/t-slibgcc-elf-ver3
-rw-r--r--gcc/config/m68k/t-uclinux5
-rw-r--r--gcc/config/mcore/crti.asm62
-rw-r--r--gcc/config/mcore/crtn.asm44
-rw-r--r--gcc/config/mcore/lib1.asm303
-rw-r--r--gcc/config/mcore/t-mcore27
-rw-r--r--gcc/config/memcmp.c16
-rw-r--r--gcc/config/memcpy.c12
-rw-r--r--gcc/config/memmove.c20
-rw-r--r--gcc/config/memset.c11
-rw-r--r--gcc/config/mep/mep-lib1.asm125
-rw-r--r--gcc/config/mep/mep-lib2.c139
-rw-r--r--gcc/config/mep/mep-tramp.c103
-rw-r--r--gcc/config/mep/t-mep24
-rw-r--r--gcc/config/microblaze/crti.s39
-rw-r--r--gcc/config/microblaze/crtn.s35
-rw-r--r--gcc/config/microblaze/t-microblaze12
-rw-r--r--gcc/config/mips/crti.asm49
-rw-r--r--gcc/config/mips/crtn.asm52
-rw-r--r--gcc/config/mips/libgcc-mips16.ver86
-rw-r--r--gcc/config/mips/mips16.S712
-rw-r--r--gcc/config/mips/t-elf22
-rw-r--r--gcc/config/mips/t-isa326422
-rw-r--r--gcc/config/mips/t-libgcc-mips1642
-rw-r--r--gcc/config/mips/t-linux642
-rw-r--r--gcc/config/mips/t-mips2
-rw-r--r--gcc/config/mips/t-r390013
-rw-r--r--gcc/config/mips/t-sde20
-rw-r--r--gcc/config/mips/t-sr71k26
-rw-r--r--gcc/config/mips/t-st4
-rw-r--r--gcc/config/mips/t-vr26
-rw-r--r--gcc/config/mips/vr4120-div.S74
-rw-r--r--gcc/config/mmix/crti.asm116
-rw-r--r--gcc/config/mmix/crtn.asm87
-rw-r--r--gcc/config/mmix/t-mmix13
-rw-r--r--gcc/config/mn10300/t-mn103003
-rw-r--r--gcc/config/moxie/crti.asm40
-rw-r--r--gcc/config/moxie/crtn.asm34
-rw-r--r--gcc/config/pa/fptr.c131
-rw-r--r--gcc/config/pa/lib2funcs.asm74
-rw-r--r--gcc/config/pa/linux-atomic.c305
-rw-r--r--gcc/config/pa/milli64.S2134
-rw-r--r--gcc/config/pa/pa.c95
-rw-r--r--gcc/config/pa/quadlib.c245
-rw-r--r--gcc/config/pa/stublib.c97
-rw-r--r--gcc/config/pa/t-dce-thr3
-rw-r--r--gcc/config/pa/t-hpux-shlib46
-rw-r--r--gcc/config/pa/t-linux37
-rw-r--r--gcc/config/pa/t-linux6432
-rw-r--r--gcc/config/pa/t-pa-hpux7
-rw-r--r--gcc/config/pa/t-pa-hpux102
-rw-r--r--gcc/config/pa/t-pa-hpux1131
-rw-r--r--gcc/config/pa/t-pa6467
-rw-r--r--gcc/config/pa/t-slibgcc-dwarf-ver3
-rw-r--r--gcc/config/pa/t-slibgcc-sjlj-ver3
-rw-r--r--gcc/config/pdp11/t-pdp115
-rw-r--r--gcc/config/picochip/libgccExtras/adddi3.asm194
-rw-r--r--gcc/config/picochip/libgccExtras/ashlsi3.asm193
-rw-r--r--gcc/config/picochip/libgccExtras/ashlsi3.c82
-rw-r--r--gcc/config/picochip/libgccExtras/ashrsi3.asm202
-rw-r--r--gcc/config/picochip/libgccExtras/ashrsi3.c113
-rw-r--r--gcc/config/picochip/libgccExtras/clzsi2.asm189
-rw-r--r--gcc/config/picochip/libgccExtras/cmpsi2.asm212
-rw-r--r--gcc/config/picochip/libgccExtras/divmod15.asm261
-rw-r--r--gcc/config/picochip/libgccExtras/divmodhi4.asm246
-rw-r--r--gcc/config/picochip/libgccExtras/divmodsi4.asm233
-rw-r--r--gcc/config/picochip/libgccExtras/fake_libgcc.asm6
-rw-r--r--gcc/config/picochip/libgccExtras/longjmp.asm182
-rw-r--r--gcc/config/picochip/libgccExtras/lshrsi3.asm190
-rw-r--r--gcc/config/picochip/libgccExtras/lshrsi3.c76
-rw-r--r--gcc/config/picochip/libgccExtras/parityhi2.asm179
-rw-r--r--gcc/config/picochip/libgccExtras/popcounthi2.asm201
-rw-r--r--gcc/config/picochip/libgccExtras/setjmp.asm182
-rw-r--r--gcc/config/picochip/libgccExtras/subdi3.asm191
-rw-r--r--gcc/config/picochip/libgccExtras/ucmpsi2.asm209
-rw-r--r--gcc/config/picochip/libgccExtras/udivmodhi4.asm238
-rw-r--r--gcc/config/picochip/libgccExtras/udivmodsi4.asm318
-rw-r--r--gcc/config/picochip/t-picochip39
-rw-r--r--gcc/config/rs6000/crtresfpr.asm81
-rw-r--r--gcc/config/rs6000/crtresgpr.asm81
-rw-r--r--gcc/config/rs6000/crtresxfpr.asm126
-rw-r--r--gcc/config/rs6000/crtresxgpr.asm124
-rw-r--r--gcc/config/rs6000/crtsavfpr.asm81
-rw-r--r--gcc/config/rs6000/crtsavgpr.asm81
-rw-r--r--gcc/config/rs6000/darwin-asm.h51
-rw-r--r--gcc/config/rs6000/darwin-fpsave.asm92
-rw-r--r--gcc/config/rs6000/darwin-gpsave.asm118
-rw-r--r--gcc/config/rs6000/darwin-libgcc.10.4.ver93
-rw-r--r--gcc/config/rs6000/darwin-libgcc.10.5.ver106
-rw-r--r--gcc/config/rs6000/darwin-tramp.asm125
-rw-r--r--gcc/config/rs6000/darwin-vecsave.asm155
-rw-r--r--gcc/config/rs6000/darwin-world.asm259
-rw-r--r--gcc/config/rs6000/e500crtres32gpr.asm73
-rw-r--r--gcc/config/rs6000/e500crtres64gpr.asm73
-rw-r--r--gcc/config/rs6000/e500crtres64gprctr.asm90
-rw-r--r--gcc/config/rs6000/e500crtrest32gpr.asm75
-rw-r--r--gcc/config/rs6000/e500crtrest64gpr.asm74
-rw-r--r--gcc/config/rs6000/e500crtresx32gpr.asm75
-rw-r--r--gcc/config/rs6000/e500crtresx64gpr.asm75
-rw-r--r--gcc/config/rs6000/e500crtsav32gpr.asm73
-rw-r--r--gcc/config/rs6000/e500crtsav64gpr.asm72
-rw-r--r--gcc/config/rs6000/e500crtsav64gprctr.asm91
-rw-r--r--gcc/config/rs6000/e500crtsavg32gpr.asm73
-rw-r--r--gcc/config/rs6000/e500crtsavg64gpr.asm73
-rw-r--r--gcc/config/rs6000/e500crtsavg64gprctr.asm90
-rw-r--r--gcc/config/rs6000/eabi-ci.asm113
-rw-r--r--gcc/config/rs6000/eabi-cn.asm104
-rw-r--r--gcc/config/rs6000/eabi.asm289
-rw-r--r--gcc/config/rs6000/rs6000.c30
-rw-r--r--gcc/config/rs6000/rtems.h17
-rw-r--r--gcc/config/rs6000/sol-ci.asm94
-rw-r--r--gcc/config/rs6000/sol-cn.asm72
-rw-r--r--gcc/config/rs6000/t-aix4332
-rw-r--r--gcc/config/rs6000/t-aix5231
-rw-r--r--gcc/config/rs6000/t-darwin39
-rw-r--r--gcc/config/rs6000/t-darwin649
-rw-r--r--gcc/config/rs6000/t-fprules5
-rw-r--r--gcc/config/rs6000/t-linux642
-rw-r--r--gcc/config/rs6000/t-lynx17
-rw-r--r--gcc/config/rs6000/t-netbsd56
-rw-r--r--gcc/config/rs6000/t-ppccomm51
-rw-r--r--gcc/config/rs6000/t-rtems40
-rw-r--r--gcc/config/rs6000/t-spe3
-rw-r--r--gcc/config/rs6000/t-vxworks11
-rw-r--r--gcc/config/rs6000/tramp.asm107
-rw-r--r--gcc/config/rx/t-rx5
-rw-r--r--gcc/config/score/crti.asm131
-rw-r--r--gcc/config/score/crtn.asm50
-rw-r--r--gcc/config/score/t-score-elf26
-rw-r--r--gcc/config/sh/crt1.asm1369
-rw-r--r--gcc/config/sh/crti.asm125
-rw-r--r--gcc/config/sh/crtn.asm77
-rw-r--r--gcc/config/sh/lib1funcs-4-300.asm936
-rw-r--r--gcc/config/sh/lib1funcs-Os-4-200.asm322
-rw-r--r--gcc/config/sh/lib1funcs.asm3933
-rw-r--r--gcc/config/sh/lib1funcs.h76
-rw-r--r--gcc/config/sh/libgcc-excl.ver8
-rw-r--r--gcc/config/sh/libgcc-glibc.ver48
-rw-r--r--gcc/config/sh/linux-atomic.asm223
-rw-r--r--gcc/config/sh/sh.h2
-rw-r--r--gcc/config/sh/t-elf10
-rw-r--r--gcc/config/sh/t-linux6
-rw-r--r--gcc/config/sh/t-linux641
-rw-r--r--gcc/config/sh/t-netbsd24
-rw-r--r--gcc/config/sh/t-sh58
-rw-r--r--gcc/config/sh/t-sh649
-rw-r--r--gcc/config/sh/t-superh33
-rw-r--r--gcc/config/sh/t-vxworks3
-rw-r--r--gcc/config/sparc/lb1spc.asm784
-rw-r--r--gcc/config/sparc/lb1spl.asm246
-rw-r--r--gcc/config/sparc/libgcc-sparc-glibc.ver93
-rw-r--r--gcc/config/sparc/sparc.c430
-rw-r--r--gcc/config/sparc/sparc.h1
-rw-r--r--gcc/config/sparc/sparc.md120
-rw-r--r--gcc/config/sparc/t-elf6
-rw-r--r--gcc/config/sparc/t-leon6
-rw-r--r--gcc/config/sparc/t-leon33
-rw-r--r--gcc/config/sparc/t-linux5
-rw-r--r--gcc/config/sparc/t-linux649
-rw-r--r--gcc/config/sparc/t-netbsd645
-rw-r--r--gcc/config/spu/cache.S43
-rw-r--r--gcc/config/spu/cachemgr.c438
-rw-r--r--gcc/config/spu/divmodti4.c188
-rw-r--r--gcc/config/spu/divv2df3.c195
-rw-r--r--gcc/config/spu/float_disf.c31
-rw-r--r--gcc/config/spu/float_unsdidf.c54
-rw-r--r--gcc/config/spu/float_unsdisf.c31
-rw-r--r--gcc/config/spu/float_unssidf.c45
-rw-r--r--gcc/config/spu/mfc_multi_tag_release.c72
-rw-r--r--gcc/config/spu/mfc_multi_tag_reserve.c84
-rw-r--r--gcc/config/spu/mfc_tag_release.c59
-rw-r--r--gcc/config/spu/mfc_tag_reserve.c51
-rw-r--r--gcc/config/spu/mfc_tag_table.c39
-rw-r--r--gcc/config/spu/multi3.c119
-rw-r--r--gcc/config/spu/t-spu-elf65
-rw-r--r--gcc/config/stormy16/stormy16-lib2-ashlsi3.c2
-rw-r--r--gcc/config/stormy16/stormy16-lib2-ashrsi3.c2
-rw-r--r--gcc/config/stormy16/stormy16-lib2-clzhi2.c2
-rw-r--r--gcc/config/stormy16/stormy16-lib2-cmpsi2.c2
-rw-r--r--gcc/config/stormy16/stormy16-lib2-ctzhi2.c2
-rw-r--r--gcc/config/stormy16/stormy16-lib2-divsi3.c2
-rw-r--r--gcc/config/stormy16/stormy16-lib2-ffshi2.c2
-rw-r--r--gcc/config/stormy16/stormy16-lib2-lshrsi3.c2
-rw-r--r--gcc/config/stormy16/stormy16-lib2-modsi3.c2
-rw-r--r--gcc/config/stormy16/stormy16-lib2-parityhi2.c2
-rw-r--r--gcc/config/stormy16/stormy16-lib2-popcounthi2.c2
-rw-r--r--gcc/config/stormy16/stormy16-lib2-ucmpsi2.c2
-rw-r--r--gcc/config/stormy16/stormy16-lib2-udivmodsi4.c2
-rw-r--r--gcc/config/stormy16/stormy16-lib2-udivsi3.c2
-rw-r--r--gcc/config/stormy16/stormy16-lib2-umodsi3.c2
-rw-r--r--gcc/config/stormy16/stormy16-lib2.c357
-rw-r--r--gcc/config/stormy16/t-stormy1639
-rw-r--r--gcc/config/t-darwin6
-rw-r--r--gcc/config/t-freebsd5
-rw-r--r--gcc/config/t-freebsd-thread2
-rw-r--r--gcc/config/t-libc-ok1
-rw-r--r--gcc/config/t-libgcc-pic2
-rw-r--r--gcc/config/t-libunwind6
-rw-r--r--gcc/config/t-linux27
-rw-r--r--gcc/config/t-lynx11
-rw-r--r--gcc/config/t-netbsd2
-rw-r--r--gcc/config/t-openbsd-thread3
-rw-r--r--gcc/config/t-rtems5
-rw-r--r--gcc/config/t-slibgcc2
-rw-r--r--gcc/config/t-slibgcc-dummy3
-rw-r--r--gcc/config/t-slibgcc-elf-ver56
-rw-r--r--gcc/config/t-slibgcc-libgcc32
-rw-r--r--gcc/config/t-slibgcc-nolc-override1
-rw-r--r--gcc/config/t-sol23
-rw-r--r--gcc/config/t-svr48
-rw-r--r--gcc/config/t-vxworks30
-rw-r--r--gcc/config/udivmod.c37
-rw-r--r--gcc/config/udivmodsi4.c47
-rw-r--r--gcc/config/v850/lib1funcs.asm2330
-rw-r--r--gcc/config/v850/t-v85062
-rw-r--r--gcc/config/vax/lib1funcs.asm92
-rw-r--r--gcc/config/vax/t-linux2
-rw-r--r--gcc/config/vms/t-vms19
-rw-r--r--gcc/config/vms/vms-c.c248
-rw-r--r--gcc/config/vms/vms-protos.h3
-rw-r--r--gcc/config/vms/vms-ucrt0.c127
-rw-r--r--gcc/config/vms/vms.c8
-rw-r--r--gcc/config/vms/vms.h60
-rw-r--r--gcc/config/vms/vms64.h (renamed from gcc/config/ia64/vms64.h)22
-rw-r--r--gcc/config/vxlib-tls.c362
-rw-r--r--gcc/config/vxlib.c95
-rw-r--r--gcc/config/xtensa/crti.asm51
-rw-r--r--gcc/config/xtensa/crtn.asm46
-rw-r--r--gcc/config/xtensa/ieee754-df.S2388
-rw-r--r--gcc/config/xtensa/ieee754-sf.S1757
-rw-r--r--gcc/config/xtensa/lib1funcs.asm845
-rw-r--r--gcc/config/xtensa/lib2funcs.S186
-rw-r--r--gcc/config/xtensa/libgcc-xtensa.ver3
-rw-r--r--gcc/config/xtensa/t-elf6
-rw-r--r--gcc/config/xtensa/t-linux3
-rw-r--r--gcc/config/xtensa/t-xtensa21
-rwxr-xr-xgcc/configure97
-rw-r--r--gcc/configure.ac43
-rw-r--r--gcc/coretypes.h13
-rw-r--r--gcc/coverage.c649
-rw-r--r--gcc/cp/ChangeLog219
-rw-r--r--gcc/cp/Make-lang.in2
-rw-r--r--gcc/cp/call.c219
-rw-r--r--gcc/cp/class.c6
-rw-r--r--gcc/cp/cp-tree.h59
-rw-r--r--gcc/cp/cvt.c5
-rw-r--r--gcc/cp/decl.c131
-rw-r--r--gcc/cp/decl2.c64
-rw-r--r--gcc/cp/error.c55
-rw-r--r--gcc/cp/init.c85
-rw-r--r--gcc/cp/mangle.c7
-rw-r--r--gcc/cp/parser.c161
-rw-r--r--gcc/cp/pt.c212
-rw-r--r--gcc/cp/search.c6
-rw-r--r--gcc/cp/semantics.c23
-rw-r--r--gcc/cp/tree.c4
-rw-r--r--gcc/cp/typeck.c82
-rw-r--r--gcc/cp/typeck2.c29
-rw-r--r--gcc/cppbuiltin.c6
-rw-r--r--gcc/cprop.c16
-rw-r--r--gcc/doc/contrib.texi2
-rw-r--r--gcc/doc/extend.texi240
-rw-r--r--gcc/doc/install.texi12
-rw-r--r--gcc/doc/invoke.texi208
-rw-r--r--gcc/doc/md.texi222
-rw-r--r--gcc/doc/tm.texi8
-rw-r--r--gcc/doc/tm.texi.in8
-rw-r--r--gcc/dse.c141
-rw-r--r--gcc/dwarf2cfi.c3
-rw-r--r--gcc/dwarf2out.c8
-rw-r--r--gcc/expr.h13
-rw-r--r--gcc/final.c9
-rw-r--r--gcc/fortran/ChangeLog561
-rw-r--r--gcc/fortran/Make-lang.in2
-rw-r--r--gcc/fortran/array.c1
-rw-r--r--gcc/fortran/class.c4
-rw-r--r--gcc/fortran/dependency.c11
-rw-r--r--gcc/fortran/frontend-passes.c7
-rw-r--r--gcc/fortran/gfortran.h5
-rw-r--r--gcc/fortran/interface.c28
-rw-r--r--gcc/fortran/intrinsic.texi12
-rw-r--r--gcc/fortran/matchexp.c1
-rw-r--r--gcc/fortran/resolve.c71
-rw-r--r--gcc/fortran/trans-array.c1441
-rw-r--r--gcc/fortran/trans-array.h9
-rw-r--r--gcc/fortran/trans-const.c18
-rw-r--r--gcc/fortran/trans-decl.c4
-rw-r--r--gcc/fortran/trans-expr.c137
-rw-r--r--gcc/fortran/trans-intrinsic.c388
-rw-r--r--gcc/fortran/trans-io.c24
-rw-r--r--gcc/fortran/trans-stmt.c129
-rw-r--r--gcc/fortran/trans.h93
-rw-r--r--gcc/fortran/types.def56
-rw-r--r--gcc/gbl-ctors.h87
-rw-r--r--gcc/gcc.c11
-rw-r--r--gcc/gcov-dump.c29
-rw-r--r--gcc/gcov-io.h65
-rw-r--r--gcc/gcov.c126
-rw-r--r--gcc/gcse.c261
-rw-r--r--gcc/gengtype.c1
-rw-r--r--gcc/genopinit.c22
-rw-r--r--gcc/gimple-fold.c100
-rw-r--r--gcc/gimple.h1
-rw-r--r--gcc/ginclude/stdalign.h (renamed from gcc/config/bfin/crtlibid.s)22
-rw-r--r--gcc/ginclude/stddef.h16
-rw-r--r--gcc/go/ChangeLog4
-rw-r--r--gcc/go/Make-lang.in2
-rw-r--r--gcc/go/gofrontend/statements.cc24
-rw-r--r--gcc/godump.c155
-rw-r--r--gcc/gthr-aix.h35
-rw-r--r--gcc/gthr-dce.h563
-rw-r--r--gcc/gthr-lynx.h61
-rw-r--r--gcc/gthr-mipssde.h230
-rw-r--r--gcc/gthr-posix.c264
-rw-r--r--gcc/gthr-posix.h879
-rw-r--r--gcc/gthr-rtems.h157
-rw-r--r--gcc/gthr-single.h292
-rw-r--r--gcc/gthr-tpf.h229
-rw-r--r--gcc/gthr-vxworks.h169
-rw-r--r--gcc/gthr-win32.h772
-rw-r--r--gcc/gthr.h168
-rw-r--r--gcc/ifcvt.c6
-rw-r--r--gcc/insn-notes.def4
-rw-r--r--gcc/ipa-inline.c2
-rw-r--r--gcc/ipa-prop.c123
-rw-r--r--gcc/java/ChangeLog4
-rw-r--r--gcc/java/Make-lang.in2
-rw-r--r--gcc/libgcc-libsystem.ver1
-rw-r--r--gcc/libgcc2.c2252
-rw-r--r--gcc/libgcc2.h530
-rw-r--r--gcc/longlong.h1660
-rw-r--r--gcc/lto-opts.c437
-rw-r--r--gcc/lto-streamer.h5
-rw-r--r--gcc/lto-wrapper.c247
-rw-r--r--gcc/lto/ChangeLog7
-rw-r--r--gcc/lto/lto-lang.c2
-rw-r--r--gcc/lto/lto.c55
-rw-r--r--gcc/mkconfig.sh8
-rw-r--r--gcc/mkmap-flat.awk109
-rw-r--r--gcc/mkmap-symver.awk136
-rw-r--r--gcc/omp-low.c89
-rw-r--r--gcc/optabs.c858
-rw-r--r--gcc/optabs.h89
-rw-r--r--gcc/opts-common.c3
-rw-r--r--gcc/opts-global.c19
-rw-r--r--gcc/opts.h4
-rw-r--r--gcc/params.def15
-rw-r--r--gcc/params.h7
-rw-r--r--gcc/po/ChangeLog15
-rw-r--r--gcc/po/EXCLUDES16
-rw-r--r--gcc/postreload.c8
-rw-r--r--gcc/print-rtl.c11
-rw-r--r--gcc/reginfo.c14
-rw-r--r--gcc/regset.h5
-rw-r--r--gcc/reload1.c4
-rw-r--r--gcc/rtl.h2
-rw-r--r--gcc/sched-vis.c6
-rw-r--r--gcc/sync-builtins.def338
-rw-r--r--gcc/target.def8
-rw-r--r--gcc/testsuite/ChangeLog391
-rw-r--r--gcc/testsuite/c-c++-common/gomp/atomic-1.c (renamed from gcc/testsuite/gcc.dg/gomp/atomic-1.c)0
-rw-r--r--gcc/testsuite/c-c++-common/gomp/atomic-10.c (renamed from gcc/testsuite/gcc.dg/gomp/atomic-10.c)3
-rw-r--r--gcc/testsuite/c-c++-common/gomp/atomic-12.c (renamed from gcc/testsuite/gcc.dg/gomp/atomic-12.c)0
-rw-r--r--gcc/testsuite/c-c++-common/gomp/atomic-13.c (renamed from gcc/testsuite/gcc.dg/gomp/atomic-13.c)0
-rw-r--r--gcc/testsuite/c-c++-common/gomp/atomic-14.c (renamed from gcc/testsuite/gcc.dg/gomp/atomic-14.c)0
-rw-r--r--gcc/testsuite/c-c++-common/gomp/atomic-15.c (renamed from gcc/testsuite/gcc.dg/gomp/atomic-15.c)0
-rw-r--r--gcc/testsuite/c-c++-common/gomp/atomic-2.c (renamed from gcc/testsuite/gcc.dg/gomp/atomic-2.c)0
-rw-r--r--gcc/testsuite/c-c++-common/gomp/atomic-3.c (renamed from gcc/testsuite/gcc.dg/gomp/atomic-3.c)3
-rw-r--r--gcc/testsuite/c-c++-common/gomp/atomic-4.c (renamed from gcc/testsuite/gcc.dg/gomp/atomic-4.c)0
-rw-r--r--gcc/testsuite/c-c++-common/gomp/atomic-7.c (renamed from gcc/testsuite/gcc.dg/gomp/atomic-7.c)0
-rw-r--r--gcc/testsuite/c-c++-common/gomp/atomic-8.c (renamed from gcc/testsuite/gcc.dg/gomp/atomic-8.c)0
-rw-r--r--gcc/testsuite/c-c++-common/gomp/atomic-9.c (renamed from gcc/testsuite/gcc.dg/gomp/atomic-9.c)3
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/Wzero-as-null-pointer-constant-1.C161
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/alias-decl-0.C37
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/alias-decl-1.C15
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/alias-decl-10.C18
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/alias-decl-2.C33
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/alias-decl-3.C42
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/alias-decl-4.C14
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/alias-decl-5.C34
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/alias-decl-6.C12
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/alias-decl-7.C23
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/alias-decl-8.C32
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/alias-decl-9.C9
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/alignof3.C6
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/auto1.C6
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/bracket3.C6
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/enum21a.C4
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/enum21b.C4
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/initlist-lifetime1.C34
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/initlist-lifetime2.C64
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/nsdmi-list2.C32
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/nsdmi1.C6
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/udlit-string-length.C46
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/warn_cxx0x.C6
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/warn_cxx0x2.C4
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/warn_cxx0x3.C4
-rw-r--r--gcc/testsuite/g++.dg/dg.exp1
-rw-r--r--gcc/testsuite/g++.dg/eh/array1.C15
-rw-r--r--gcc/testsuite/g++.dg/ext/alias-decl-attr1.C19
-rw-r--r--gcc/testsuite/g++.dg/ext/alias-decl-attr2.C42
-rw-r--r--gcc/testsuite/g++.dg/ext/alias-decl-attr3.C21
-rw-r--r--gcc/testsuite/g++.dg/ext/alias-decl-attr4.C34
-rw-r--r--gcc/testsuite/g++.dg/ext/visibility/template7.C29
-rw-r--r--gcc/testsuite/g++.dg/ext/visibility/template8.C26
-rw-r--r--gcc/testsuite/g++.dg/gomp/atomic-1.C99
-rw-r--r--gcc/testsuite/g++.dg/gomp/atomic-10.C24
-rw-r--r--gcc/testsuite/g++.dg/gomp/atomic-11.C306
-rw-r--r--gcc/testsuite/g++.dg/gomp/atomic-12.C9
-rw-r--r--gcc/testsuite/g++.dg/gomp/atomic-13.C43
-rw-r--r--gcc/testsuite/g++.dg/gomp/atomic-15.C46
-rw-r--r--gcc/testsuite/g++.dg/gomp/atomic-2.C23
-rw-r--r--gcc/testsuite/g++.dg/gomp/atomic-3.C13
-rw-r--r--gcc/testsuite/g++.dg/gomp/atomic-4.C24
-rw-r--r--gcc/testsuite/g++.dg/gomp/atomic-7.C23
-rw-r--r--gcc/testsuite/g++.dg/gomp/atomic-8.C21
-rw-r--r--gcc/testsuite/g++.dg/gomp/atomic-9.C13
-rw-r--r--gcc/testsuite/g++.dg/gomp/gomp.exp2
-rw-r--r--gcc/testsuite/g++.dg/init/copy7.C39
-rw-r--r--gcc/testsuite/g++.dg/init/lifetime1.C29
-rw-r--r--gcc/testsuite/g++.dg/init/lifetime2.C23
-rw-r--r--gcc/testsuite/g++.dg/init/ref21.C7
-rw-r--r--gcc/testsuite/g++.dg/ipa/devirt-c-1.C7
-rw-r--r--gcc/testsuite/g++.dg/ipa/devirt-c-2.C7
-rw-r--r--gcc/testsuite/g++.dg/ipa/devirt-c-7.C87
-rw-r--r--gcc/testsuite/g++.dg/ipa/devirt-c-8.C82
-rw-r--r--gcc/testsuite/g++.dg/opt/devirt2.C3
-rw-r--r--gcc/testsuite/g++.dg/other/offsetof7.C17
-rw-r--r--gcc/testsuite/g++.dg/parse/pragma3.C3
-rw-r--r--gcc/testsuite/g++.dg/pr50672.C101
-rw-r--r--gcc/testsuite/g++.dg/pr50763-3.C57
-rw-r--r--gcc/testsuite/g++.dg/pr50763-4.C34
-rw-r--r--gcc/testsuite/g++.dg/simulate-thread/atomics-1.C73
-rw-r--r--gcc/testsuite/g++.dg/simulate-thread/atomics-2.C58
-rw-r--r--gcc/testsuite/g++.dg/simulate-thread/bitfields-2.C77
-rw-r--r--gcc/testsuite/g++.dg/simulate-thread/bitfields.C80
-rw-r--r--gcc/testsuite/g++.dg/warn/Wcast-qual2.C4
-rw-r--r--gcc/testsuite/g++.dg/warn/Wconversion-null-3.C8
-rw-r--r--gcc/testsuite/g++.dg/warn/Wzero-as-null-pointer-constant-1.C100
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/20101011-1.c4
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/ieee/mul-subnormal-single-1.x5
-rw-r--r--gcc/testsuite/gcc.dg/20020312-2.c2
-rw-r--r--gcc/testsuite/gcc.dg/atomic-compare-exchange-1.c85
-rw-r--r--gcc/testsuite/gcc.dg/atomic-compare-exchange-2.c85
-rw-r--r--gcc/testsuite/gcc.dg/atomic-compare-exchange-3.c85
-rw-r--r--gcc/testsuite/gcc.dg/atomic-compare-exchange-4.c86
-rw-r--r--gcc/testsuite/gcc.dg/atomic-compare-exchange-5.c86
-rw-r--r--gcc/testsuite/gcc.dg/atomic-exchange-1.c62
-rw-r--r--gcc/testsuite/gcc.dg/atomic-exchange-2.c62
-rw-r--r--gcc/testsuite/gcc.dg/atomic-exchange-3.c62
-rw-r--r--gcc/testsuite/gcc.dg/atomic-exchange-4.c63
-rw-r--r--gcc/testsuite/gcc.dg/atomic-exchange-5.c63
-rw-r--r--gcc/testsuite/gcc.dg/atomic-fence.c27
-rw-r--r--gcc/testsuite/gcc.dg/atomic-generic-aux.c45
-rw-r--r--gcc/testsuite/gcc.dg/atomic-generic.c56
-rw-r--r--gcc/testsuite/gcc.dg/atomic-invalid.c29
-rw-r--r--gcc/testsuite/gcc.dg/atomic-load-1.c66
-rw-r--r--gcc/testsuite/gcc.dg/atomic-load-2.c68
-rw-r--r--gcc/testsuite/gcc.dg/atomic-load-3.c65
-rw-r--r--gcc/testsuite/gcc.dg/atomic-load-4.c65
-rw-r--r--gcc/testsuite/gcc.dg/atomic-load-5.c65
-rw-r--r--gcc/testsuite/gcc.dg/atomic-lockfree-aux.c17
-rw-r--r--gcc/testsuite/gcc.dg/atomic-lockfree.c120
-rw-r--r--gcc/testsuite/gcc.dg/atomic-noinline-aux.c51
-rw-r--r--gcc/testsuite/gcc.dg/atomic-noinline.c56
-rw-r--r--gcc/testsuite/gcc.dg/atomic-op-1.c554
-rw-r--r--gcc/testsuite/gcc.dg/atomic-op-2.c555
-rw-r--r--gcc/testsuite/gcc.dg/atomic-op-3.c554
-rw-r--r--gcc/testsuite/gcc.dg/atomic-op-4.c555
-rw-r--r--gcc/testsuite/gcc.dg/atomic-op-5.c555
-rw-r--r--gcc/testsuite/gcc.dg/atomic-param.c13
-rw-r--r--gcc/testsuite/gcc.dg/atomic-store-1.c47
-rw-r--r--gcc/testsuite/gcc.dg/atomic-store-2.c46
-rw-r--r--gcc/testsuite/gcc.dg/atomic-store-3.c47
-rw-r--r--gcc/testsuite/gcc.dg/atomic-store-4.c48
-rw-r--r--gcc/testsuite/gcc.dg/atomic-store-5.c48
-rw-r--r--gcc/testsuite/gcc.dg/builtin-apply2.c2
-rw-r--r--gcc/testsuite/gcc.dg/c1x-align-1.c41
-rw-r--r--gcc/testsuite/gcc.dg/c1x-align-2.c92
-rw-r--r--gcc/testsuite/gcc.dg/c1x-align-3.c42
-rw-r--r--gcc/testsuite/gcc.dg/c1x-align-4.c8
-rw-r--r--gcc/testsuite/gcc.dg/c90-align-1.c6
-rw-r--r--gcc/testsuite/gcc.dg/c99-align-1.c6
-rw-r--r--gcc/testsuite/gcc.dg/gnu89-const-expr-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/gnu90-const-expr-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/gnu99-const-expr-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/gnu99-static-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/gomp/atomic-11.c17
-rw-r--r--gcc/testsuite/gcc.dg/gomp/gomp.exp3
-rw-r--r--gcc/testsuite/gcc.dg/pr50763-5.c23
-rw-r--r--gcc/testsuite/gcc.dg/pr50908-2.c80
-rw-r--r--gcc/testsuite/gcc.dg/pr50908-3.c12
-rw-r--r--gcc/testsuite/gcc.dg/pr50908.c175
-rw-r--r--gcc/testsuite/gcc.dg/pragma-align-2.c1
-rw-r--r--gcc/testsuite/gcc.dg/pragma-pack-3.c3
-rw-r--r--gcc/testsuite/gcc.dg/profile-dir-1.c6
-rw-r--r--gcc/testsuite/gcc.dg/profile-dir-2.c6
-rw-r--r--gcc/testsuite/gcc.dg/profile-dir-3.c6
-rw-r--r--gcc/testsuite/gcc.dg/simulate-thread/atomic-load-int.c116
-rw-r--r--gcc/testsuite/gcc.dg/simulate-thread/atomic-load-int128.c132
-rw-r--r--gcc/testsuite/gcc.dg/simulate-thread/atomic-load-longlong.c117
-rw-r--r--gcc/testsuite/gcc.dg/simulate-thread/atomic-load-short.c116
-rw-r--r--gcc/testsuite/gcc.dg/simulate-thread/atomic-other-int.c118
-rw-r--r--gcc/testsuite/gcc.dg/simulate-thread/atomic-other-int128.c116
-rw-r--r--gcc/testsuite/gcc.dg/simulate-thread/atomic-other-longlong.c117
-rw-r--r--gcc/testsuite/gcc.dg/simulate-thread/atomic-other-short.c117
-rw-r--r--gcc/testsuite/gcc.dg/simulate-thread/speculative-store.c57
-rw-r--r--gcc/testsuite/gcc.dg/simulate-thread/strict-align-global.c52
-rw-r--r--gcc/testsuite/gcc.dg/simulate-thread/subfields.c93
-rw-r--r--gcc/testsuite/gcc.dg/stack-usage-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/strlenopt-22.c7
-rw-r--r--gcc/testsuite/gcc.dg/strlenopt-22g.c14
-rw-r--r--gcc/testsuite/gcc.dg/tls/thr-cse-1.c3
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr50890.c17
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr50902.c9
-rw-r--r--gcc/testsuite/gcc.dg/torture/stackalign/builtin-apply-2.c11
-rw-r--r--gcc/testsuite/gcc.dg/torture/vec-cvt-1.c211
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-cond-1.c46
-rw-r--r--gcc/testsuite/gcc.dg/vect/slp-cond-1.c126
-rw-r--r--gcc/testsuite/gcc.dg/vect/slp-cond-2.c127
-rw-r--r--gcc/testsuite/gcc.dg/weak/typeof-2.c3
-rw-r--r--gcc/testsuite/gcc.misc-tests/gcov-12.c17
-rw-r--r--gcc/testsuite/gcc.misc-tests/gcov-13.c18
-rw-r--r--gcc/testsuite/gcc.misc-tests/gcov-14.c24
-rw-r--r--gcc/testsuite/gcc.misc-tests/gcov.exp2
-rw-r--r--gcc/testsuite/gcc.misc-tests/gcovpart-13b.c4
-rw-r--r--gcc/testsuite/gcc.target/arm/stack-red-zone.c12
-rw-r--r--gcc/testsuite/gcc.target/arm/wmul-1.c2
-rw-r--r--gcc/testsuite/gcc.target/arm/wmul-2.c2
-rw-r--r--gcc/testsuite/gcc.target/arm/wmul-3.c2
-rw-r--r--gcc/testsuite/gcc.target/arm/wmul-4.c2
-rw-r--r--gcc/testsuite/gcc.target/epiphany/epiphany.exp41
-rw-r--r--gcc/testsuite/gcc.target/epiphany/fmadd-1.c17
-rw-r--r--gcc/testsuite/gcc.target/epiphany/fmsub-1.c17
-rw-r--r--gcc/testsuite/gcc.target/epiphany/interrupt.c14
-rw-r--r--gcc/testsuite/gcc.target/i386/47698.c10
-rw-r--r--gcc/testsuite/gcc.target/i386/avx-cvt-2.c2
-rw-r--r--gcc/testsuite/gcc.target/i386/avx2-cvt-2.c2
-rw-r--r--gcc/testsuite/gcc.target/i386/avx2-gather-1.c215
-rw-r--r--gcc/testsuite/gcc.target/i386/avx2-gather-2.c7
-rw-r--r--gcc/testsuite/gcc.target/i386/avx2-gather-3.c167
-rw-r--r--gcc/testsuite/gcc.target/i386/avx2-gather-4.c38
-rw-r--r--gcc/testsuite/gcc.target/i386/pr49781-1.c2
-rw-r--r--gcc/testsuite/gcc.target/i386/sse2-cvt-2.c2
-rw-r--r--gcc/testsuite/gcc.target/i386/vectorize4-avx.c2
-rw-r--r--gcc/testsuite/gcc.target/sparc/20111102-1.c17
-rw-r--r--gcc/testsuite/gcc.target/sparc/vec-init-1-vis1.c5
-rw-r--r--gcc/testsuite/gcc.target/sparc/vec-init-1-vis2.c5
-rw-r--r--gcc/testsuite/gcc.target/sparc/vec-init-1-vis3.c5
-rw-r--r--gcc/testsuite/gcc.target/sparc/vec-init-1.inc85
-rw-r--r--gcc/testsuite/gcc.target/sparc/vec-init-2-vis1.c5
-rw-r--r--gcc/testsuite/gcc.target/sparc/vec-init-2-vis2.c5
-rw-r--r--gcc/testsuite/gcc.target/sparc/vec-init-2-vis3.c5
-rw-r--r--gcc/testsuite/gcc.target/sparc/vec-init-2.inc94
-rw-r--r--gcc/testsuite/gcc.target/sparc/vec-init-3-vis1.c5
-rw-r--r--gcc/testsuite/gcc.target/sparc/vec-init-3-vis2.c5
-rw-r--r--gcc/testsuite/gcc.target/sparc/vec-init-3-vis3.c5
-rw-r--r--gcc/testsuite/gcc.target/sparc/vec-init-3.inc105
-rw-r--r--gcc/testsuite/gfortran.dg/bind_c_dts_5.f9054
-rw-r--r--gcc/testsuite/gfortran.dg/function_optimize_7.f903
-rw-r--r--gcc/testsuite/gfortran.dg/inline_product_1.f9032
-rw-r--r--gcc/testsuite/gfortran.dg/inline_sum_1.f90194
-rw-r--r--gcc/testsuite/gfortran.dg/inline_sum_2.f9012
-rw-r--r--gcc/testsuite/gfortran.dg/inline_sum_bounds_check_1.f9022
-rw-r--r--gcc/testsuite/gfortran.dg/inline_sum_bounds_check_2.f9023
-rw-r--r--gcc/testsuite/gfortran.dg/module_parameter_array_refs_2.f9023
-rw-r--r--gcc/testsuite/gfortran.dg/open_dev_null.f909
-rw-r--r--gcc/testsuite/gfortran.dg/pr50769.f9030
-rw-r--r--gcc/testsuite/gfortran.dg/quad_2.f9063
-rw-r--r--gcc/testsuite/gfortran.dg/typebound_call_21.f0339
-rw-r--r--gcc/testsuite/gnat.dg/loop_optimization10.adb18
-rw-r--r--gcc/testsuite/gnat.dg/loop_optimization10.ads11
-rw-r--r--gcc/testsuite/gnat.dg/loop_optimization10_pkg.ads12
-rw-r--r--gcc/testsuite/gnat.dg/specs/private1-sub.ads13
-rw-r--r--gcc/testsuite/gnat.dg/specs/private1.ads5
-rw-r--r--gcc/testsuite/go.test/test/closedchan.go29
-rw-r--r--gcc/testsuite/lib/gcc-dg.exp21
-rw-r--r--gcc/testsuite/lib/scanasm.exp10
-rw-r--r--gcc/testsuite/lib/target-supports.exp62
-rw-r--r--gcc/tree-cfg.c19
-rw-r--r--gcc/tree-data-ref.c6
-rw-r--r--gcc/tree-data-ref.h5
-rw-r--r--gcc/tree-vect-data-refs.c346
-rw-r--r--gcc/tree-vect-loop.c15
-rw-r--r--gcc/tree-vect-slp.c766
-rw-r--r--gcc/tree-vect-stmts.c2167
-rw-r--r--gcc/tree-vectorizer.h49
-rw-r--r--gcc/tree.h5
-rw-r--r--gcc/var-tracking.c23
929 files changed, 36763 insertions, 74978 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 5f334336458..279d795a119 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,18 +1,1886 @@
+2011-11-07 Jakub Jelinek <jakub@redhat.com>
+
+ * config/i386/i386-bultin-types.def (V8SI_FTYPE_V4DF_V4DF): Add.
+ * config/i386/i386.c (enum ix86_builtins): Add
+ IX86_BUILTIN_VEC_PACK_SFIX256.
+ (bdesc_args): Add __builtin_ia32_vec_pack_sfix256.
+ (ix86_expand_args_builtin): Handle V8SI_FTYPE_V4DF_V4DF.
+ (ix86_builtin_vectorized_function): Also vectorize lrint using
+ 256-bit vectors for -mavx.
+
+2011-11-07 Anatoly Sokolov <aesok@post.ru>
+
+ * config/cris/constraints.md: New file.
+ * config/cris/cris.h (REG_CLASS_FROM_LETTER, CONSTRAINT_LEN,
+ CRIS_CONST_OK_FOR_LETTER_P, CONST_OK_FOR_CONSTRAINT_P,
+ CONST_DOUBLE_OK_FOR_LETTER_P, EXTRA_MEMORY_CONSTRAINT,
+ EXTRA_CONSTRAINT, EXTRA_CONSTRAINT_Q, EXTRA_CONSTRAINT_R,
+ EXTRA_CONSTRAINT_T, EXTRA_CONSTRAINT_S, EXTRA_CONSTRAINT_U): Remove.
+ * config/cris/cris.c: Incule "tm-constrs.h".
+ (cris_print_operand): Use satisfies_constraint_O.
+ (cris_normal_notice_update_cc, cris_rtx_costs): Use
+ satisfies_constraint_I.
+ (cris_address_cost): Use satisfies_constraint_L.
+ * config/cris/cris.md: Include "constraints.md".
+ (*mov_side<mode>, *mov_sidesisf, *mov_side<mode>_mem,
+ *mov_sidesisf_mem, *clear_side<mode>, *ext_sideqihi,
+ *ext_side<mode>si, *op_side<mode>, *op_swap_side<mode>,
+ *extopqihi_side, *extop<mode>si_side, *extopqihi_swap_side,
+ *extop<mode>si_swap_side): Use satisfies_constraint_N and
+ satisfies_constraint_J.
+ (moversideqi movemsideqi mover2side peephole2): Use
+ satisfies_constraint_N and satisfies_constraint_J.
+ (andu peephole2): Use satisfies_constraint_I and
+ satisfies_constraint_O.
+
+2011-11-07 Uros Bizjak <ubizjak@gmail.com>
+
+ * config/i386/i386.c (ix86_builtin_vectorized_function): Handle
+ BUILT_IN_IRINT, BUILT_IN_IRINTF, BUILT_IN_LLRINT and BUILT_IN_LLRINTF.
+
+2011-11-07 Andrew MacLeod <amacleod@redhat.com>
+
+ * optabs.c (get_atomic_op_for_code): Fill in optab table at runtime so
+ SWITCHABLE_TARGET can change the values during compilation.
+ (expand_atomic_fetch_op): Handle parameter change ripples for
+ get_atomic_op_for_code call.
+
+2011-11-07 Andrew MacLeod <amacleod@redhat.com>
+
+ * doc/extend.texi: Docuemnt behaviour change for __atomic_exchange and
+ __atomic_store.
+ * optabs.c (expand_atomic_exchange): Expand to __sync_lock_test_and_set
+ only when originated from that builtin.
+ (expand_atomic_store): Expand to __sync_lock_release when originated
+ from that builtin.
+ * builtins.c (expand_builtin_sync_lock_test_and_set): Add flag that
+ expand_atomic_exchange call originated from here.
+ (expand_builtin_sync_lock_release): Add flag that expand_atomic_store
+ call originated from here.
+ (expand_builtin_atomic_exchange): Add origination flag.
+ (expand_builtin_atomic_store): Add origination flag.
+ * expr.h (expand_atomic_exchange, expand_atomic_store): Add boolean
+ parameters to indicate implementation fall back options.
+
+2011-11-07 Georg-Johann Lay <avr@gjlay.de>
+
+ * config/avr/avr.c (output_reload_in_const): Can handle CONSTANT_P
+ now, not only CONST_INT and CONST_DOUBLE.
+ (output_movqi): Use output_reload_in_const.
+ (output_reload_inhi): Ditto.
+ (output_reload_insisf): Move assertion to output_reload_in_const.
+ (avr_out_reload_inpsi): Ditto.
+
+2011-11-07 Nathan Sidwell <nathan@acm.org>
+
+ * gcov.c (object_summary): Replace with ...
+ (object_runs): ... this.
+ (process_file): Remove functions with no data.
+ (generate_results): Ignore files with no lines.
+ (release_function): New helper, broken out of ...
+ (release_structures): ... here. Use it.
+ (read_count_file): Adjust for new data file format.
+ (output_lines): Use object_runs.
+ * gcov-io.h (GCOV_TAG_OBJECT_SUMMARY): Obsolete.
+ (struct gcov_ctr_info): Move definition.
+ (struct gcov_fn_info): Add key field, use gcov_ctr_info for
+ trailing array.
+ (struct gcov_info): Add merge function array, remove mask and
+ counts. Trailing array is array of pointers to function info.
+ * coverage.c (struct function_list): Replace counter numbers with
+ counter arrays. Add fndecl field. GTYify.
+ (counts_entry): Remove chain workspace.
+ (functions_head): GTYify.
+ (prg_n_ctrs): Remove.
+ (fn_v_ctrs): New.
+ (tree_ctr_tables): Remove.
+ (read_counts_file): Cope with blank entries and expect program
+ summaries before functions. Don't warn on missing entries.
+ (coverage_counter_alloc): Allocate individual function arrays.
+ (tree_coverage_counter_ref, tree_coverage_counter_addr): Adjust
+ for individual function arrays.
+ (coverage_end_function): GTYify function list object. Finalize
+ function's counter arrays.
+ (build_var): New. Create a counter-related variable with
+ appropriate linkage.
+ (build_fn_info_type): Adjust for new runtime structure.
+ (build_fn_info_value): Rename to ...
+ (build_fn_info): ... here. Build new format data.
+ (build_ctr_info_type, build_ctr_info_value): Remove.
+ (build_info_type): New. Build new format data structure.
+ (build_info): Adjust for new format data.
+ (create_coverage): Likewise.
+ * gcov-dump.c (tag_function): Recognize placeholders.
+
+2011-11-07 Georg-Johann Lay <avr@gjlay.de>
+
+ * config/avr/constraints.md (Cm2): New constraint for int -2.
+ * config/avr/avr.md (addqi3): Use it. New alternatives for +/-2.
+ (*negqihi2): New insn.
+
+2011-11-07 H.J. Lu <hongjiu.lu@intel.com>
+
+ * dwarf2cfi.c (dwarf2out_frame_debug_expr): Check
+ HARD_FRAME_POINTER_REGNUM instead of hard_frame_pointer_rtx
+ in Rule 18.
+
+2011-11-07 Jakub Jelinek <jakub@redhat.com>
+
+ * config/i386/i386.c (ix86_expand_builtin): If gather mask
+ argument is known to have all high bits set, pass pc_rtx as
+ second argument to the expander instead of op0.
+ * config/i386/sse.md (*avx2_gathersi<mode>_2,
+ *avx2_gatherdi<mode>_2): New patterns.
+ * config/i386/avx2intrin.h (_mm256_i32gather_pd,
+ _mm256_i64gather_pd, _mm256_i32gather_ps): Set mask using
+ _mm256_cmp_pd with zero vector arguments and _CMP_EQ_OQ instead of
+ _mm256_set1_pd.
+
+ PR tree-optimization/50789
+ * tree-vect-stmts.c (process_use): Add force argument, avoid
+ exist_non_indexing_operands_for_use_p check if true.
+ (vect_mark_stmts_to_be_vectorized): Adjust callers. Handle
+ STMT_VINFO_GATHER_P.
+ (gen_perm_mask): New function.
+ (perm_mask_for_reverse): Use it.
+ (reverse_vec_element): Rename to...
+ (permute_vec_elements): ... this. Add Y and MASK_VEC arguments,
+ generalize for any permutations.
+ (vectorizable_load): Adjust caller. Handle STMT_VINFO_GATHER_P.
+ * target.def (TARGET_VECTORIZE_BUILTIN_GATHER): New hook.
+ * doc/tm.texi.in (TARGET_VECTORIZE_BUILTIN_GATHER): Document it.
+ * doc/tm.texi: Regenerate.
+ * tree-data-ref.c (initialize_data_dependence_relation,
+ compute_self_dependence): No longer static.
+ * tree-data-ref.h (initialize_data_dependence_relation,
+ compute_self_dependence): New prototypes.
+ * tree-vect-data-refs.c (vect_check_gather): New function.
+ (vect_analyze_data_refs): Detect possible gather load data
+ refs.
+ * tree-vectorizer.h (struct _stmt_vec_info): Add gather_p field.
+ (STMT_VINFO_GATHER_P): Define.
+ (vect_check_gather): New prototype.
+ * config/i386/i386-builtin-types.def: Add types for alternate
+ gather builtins.
+ * config/i386/sse.md (AVXMODE48P_DI): Remove.
+ (VEC_GATHER_MODE): Rename mode_attr to...
+ (VEC_GATHER_IDXSI): ... this.
+ (VEC_GATHER_IDXDI, VEC_GATHER_SRCDI): New mode_attrs.
+ (avx2_gathersi<mode>, *avx2_gathersi<mode>): Use <VEC_GATHER_IDXSI>
+ instead of <VEC_GATHER_MODE>.
+ (avx2_gatherdi<mode>): Use <VEC_GATHER_IDXDI> instead of
+ <<AVXMODE48P_DI> and <VEC_GATHER_SRCDI> instead of VEC_GATHER_MODE
+ on src and mask operands.
+ (*avx2_gatherdi<mode>): Likewise. Use VEC_GATHER_MODE iterator
+ instead of AVXMODE48P_DI.
+ (avx2_gatherdi<mode>256, *avx2_gatherdi<mode>256): Removed.
+ * config/i386/i386.c (enum ix86_builtins): Add
+ IX86_BUILTIN_GATHERALTSIV4DF, IX86_BUILTIN_GATHERALTDIV8SF,
+ IX86_BUILTIN_GATHERALTSIV4DI and IX86_BUILTIN_GATHERALTDIV8SI.
+ (ix86_init_mmx_sse_builtins): Create those builtins.
+ (ix86_expand_builtin): Handle those builtins and adjust expansions
+ of other gather builtins.
+ (ix86_vectorize_builtin_gather): New function.
+ (TARGET_VECTORIZE_BUILTIN_GATHER): Define.
+
+2011-11-07 Uros Bizjak <ubizjak@gmail.com>
+
+ * config/i386/f16cintrin: Remove extra _X86INTRIN_H_INCLUDED check.
+
+2011-11-07 Tristan Gingold <gingold@adacore.com>
+
+ * config.gcc (*-*-*vms*): Set c_target_objs, cxx_target_objs.
+ * config/vms/t-vms: Add vms-c.o rule.
+ * config/vms/vms-c.c: New file.
+ * config/vms/vms-protos.h (vms_c_register_pragma): New prototype.
+ * config/vms/vms.h (REGISTER_TARGET_PRAGMAS): Define.
+
+2011-11-07 Tristan Gingold <gingold@adacore.com>
+
+ * config/alpha/vms.h (TARGET_OBJECT_SUFFIX,
+ TARGET_EXECUTABLE_SUFFIX, TARGET_OS_CPP_BUILTINS,
+ TARGET_ABI_OPEN_VMS, LONG_TYPE_SIZE, ADA_LONG_TYPE_SIZE,
+ POINTER_SIZE, POINTERS_EXTEND_UNSIGNED): Move to config/vms/vms.h
+ (SUBTARGET_OS_CPP_BUILTINS): Define.
+ (TARGET_DEFAULT): Tune according to POINTER_SIZE.
+ (MASK_RETURN_ADDR): Define in 64 bit mode.
+ * config/ia64/vms.h: Likewise.
+ * config/vms/vms.h: New file.
+ * config/vms/vms64.h: New file.
+ * config/alpha/vms64.h: Removed.
+ * config/ia64/vms64.h: Removed.
+ * config.gcc (alpha64-dec-*vms*, alpha*-dec-*vms*, ia64-hp-*vms*):
+ Adjust for above change.
+
+2011-11-07 Enkovich Ilya <ilya.enkovich@intel.com>
+
+ PR target/50962
+ * config/i386/i386-protos.h (ix86_use_lea_for_mov): New.
+ * config/i386/i386.c (ix86_use_lea_for_mov): Likewise.
+ * config/i386/i386.md (movsi_internal): Emit lea if profitable.
+ (movdi_internal_rex64): Likewise.
+
+2011-11-07 Sergey Ostanevich <sergos.gnu@gmail.com>
+
+ PR rtl-optimization/47698
+ * ifconv.c (noce_operand_ok): prevent CMOV generation for volatile mem.
+
+2011-11-07 Tristan Gingold <gingold@adacore.com>
+
+ * common/config/alpha/alpha-common.c (alpha_option_init_struct):
+ New function.
+ (TARGET_OPTION_INIT_STRUCT): Define.
+ * config/alpha/alpha.c (TARGET_MIN_ANCHOR_OFFSET)
+ (TARGET_MAX_ANCHOR_OFFSET)
+ (TARGET_USE_BLOCKS_FOR_CONSTANT_P): Redefine.
+
+2011-11-06 Quentin Neill <quentin.neill@amd.com>
+
+ Fix r180999, update ChangeLog
+ * config.gcc: Add f16cintrin.h.
+ * config/i386/f16cintrin.h: Add missing endif.
+
+2011-11-06 Sebastian Huber <sebastian.huber@embedded-brains.de>
+
+ * config.gcc (arm*-*-rtemseabi*): New target.
+ * config/arm/rtems-eabi.h: New.
+ * config/arm/t-rtems-eabi: New.
+
+2011-11-06 David S. Miller <davem@davemloft.net>
+
+ * config/sparc/sparc.md (UNSPEC_SHORT_LOAD): Delete.
+ (zero_extend_v8qi_vis, zero_extend_v4hi_vis,
+ *zero_extend_v8qi_<P:mode>_insn,
+ *zero_extend_v4hi_<P:mode>_insn): Express using vec_merge
+ and vec_duplicate instead of using an UNSPEC.
+
+2011-11-07 Alan Modra <amodra@gmail.com>
+
+ PR target/30282
+ * config/rs6000/rs6000.c (rs6000_emit_stack_reset): Always emit
+ blockage for ABI_V4.
+
+2011-11-06 Dave Korn <dave.korn.cygwin@gmail.com>
+
+ * config/i386/cygwin.h (LIBGCJ_SONAME): Updated to match recent
+ libgcj version bump.
+ * config/i386/mingw32.h (LIBGCJ_SONAME): Likewise.
+
+2011-11-06 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gcse.c: Adjust outdated comments throughout.
+ (struct mem_conflict_info): New structure.
+ (mems_conflict_for_gcse_p): Use it to communicate with caller.
+ (load_killed_in_block_p): Pass it to note_stores.
+ (hash_expr): Remove superfluous line break.
+ (hash_scan_set): Rename PAT parameter into SET.
+ (hash_scan_insn): Reorder cases.
+ (canon_list_insert): Fix long line.
+ (edge_list): Delete.
+ (prune_expressions): Rename E local variable into EXPR.
+ (compute_pre_data): Return struct edge_list * object.
+ (pre_expr_reaches_here_p_work): Fix formatting.
+ (process_insert_insn): Move around comment.
+ (pre_edge_insert): Fix long line.
+ (pre_insert_copies): Likewise.
+ (gcse_emit_move_after): Swap SRC and DEST parameters.
+ (pre_delete): Adjust call to gcse_emit_move_after.
+ (pre_gcse): Take struct edge_list * parameter. Fix long line.
+ (one_pre_gcse_pass): Use flag_gcse_lm condition for all routines.
+ Use a local list of edges.
+ (hoist_code): Fix long line. Adjust call to gcse_emit_move_after.
+ (pre_ldst_expr_hash): Fix long line.
+ (free_ldst_mems): Rename into...
+ (free_ld_motion_mems): ...this.
+ (first_ls_expr): Delete.
+ (next_ls_expr): Likewise.
+ (print_ldst_list): Do not use above two functions.
+ (simple_mem): Adjust interface.
+ (compute_ld_motion_mems): Fix formatting.
+ (update_ld_motion_stores): Reuse local variable.
+
+2011-11-06 Joseph Myers <joseph@codesourcery.com>
+
+ * c-decl.c (shadow_tag_warned, grokdeclarator): Handle _Alignas
+ specifiers.
+ (build_null_declspecs): Initialize align_log and alignas_p fields.
+ (declspecs_add_alignas): New.
+ * c-parser.c (c_token_starts_declspecs): Handle RID_ALIGNAS.
+ (c_parser_declspecs): Handle _Alignas specifiers.
+ (c_parser_alignas_specifier): New.
+ (c_parser_alignof_expression): Diagnose alignof use for non-C1X.
+ Diagnose _Alignof (expression).
+ * c-tree.h (struct c_declspecs): Add align_log and alignas_p fields.
+ (declspecs_add_alignas): Declare.
+ * ginclude/stddef.h (max_align_t): Define for C1X and C++11.
+ * ginclude/stdalign.h: New.
+ * Makefile.in (USER_H): Add stdalign.h.
+
+2011-11-06 Joern Rennecke <joern.rennecke@embecosm.com>
+ Eric Botcazou <ebotcazou@adacore.com>
+
+ * regset.h (fixed_reg_set_regset): Declare.
+ * dse.c: Include regset.h .
+ (struct insn_info): Add member fixed_regs_live.
+ (note_add_store_info): New typedef.
+ (note_add_store): New function.
+ (emit_inc_dec_insn_before): Expect arg to be of type insn_info_t.
+ Use gen_add3_insn / gen_move_insn.
+ Check new insn for unwanted clobbers before emitting it.
+ (check_for_inc_dec): Rename to...
+ (check_for_inc_dec_1:) ... this. Return bool. Take insn_info
+ parameter. Changed all callers in file.
+ (check_for_inc_dec, copy_fixed_regs): New functions.
+ (scan_insn): Set fixed_regs_live field of insn_info.
+ * rtl.h (check_for_inc_dec): Update prototype.
+ * postreload.c (reload_cse_simplify): Take new signature of
+ check_ind_dec into account.
+ * reginfo.c (fixed_reg_set_regset): New variable.
+ (init_reg_sets_1): Initialize it.
+
+2011-11-06 Jakub Jelinek <jakub@redhat.com>
+
+ * tree-cfg.c (gimple_can_merge_blocks_p): For -O0 don't remove
+ any user labels.
+
+2011-11-06 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
+
+ * config/pa/pa.c (pa_hpux_init_libfuncs): Rename to pa_init_libfuncs.
+ Remove dependence of declaration and target define on definition of
+ HPUX_LONG_DOUBLE_LIBRARY. Update implementation.
+
+2011-11-06 Andrew Macleod <amacleod@redhat.com>
+ Richard Henderson <rth@redhat.com>
+ Aldy Hernandez <aldyh@redhat.com>
+
+ Merged from cxx-mem-model.
+
+ * cppbuiltin.c (define__GNUC__): Define __ATOMIC memory models
+ * coretypes.h (enum memmodel): New. enumerated memory model type.
+ * Makefile.in (cppbuiltin.o) Add missing dependency on $(TREE_H)
+ * genopinit,c (optabs): Add atomic direct optab handlers.
+ * sync-builtins.def (BUILT_IN_ATOMIC_*): New builtins.
+ * builtin-types.def (BT_CONST_VOLATILE_PTR,
+ BT_FN_I{1,2,4,8,16}_CONST_VPTR_INT, BT_FN_VOID_VPTR_INT,
+ BT_FN_BOOL_VPTR_INT, BT_FN_BOOL_SIZE_CONST_VPTR,
+ BT_FN_I{1,2,4,8,16}_VPTR_I{1,2,4,8,16}_INT,
+ BT_FN_VOID_VPTR_I{1,2,4,8,16}_INT, BT_FN_VOID_SIZE_VPTR_PTR_INT,
+ BT_FN_VOID_SIZE_CONST_VPTR_PTR_INT, BT_FN_VOID_SIZE_VPTR_PTR_PTR_INT,
+ BT_FN_BOOL_VPTR_PTR_I{1,2,4,8,16}_BOOL_INT_INT): New builtin types.
+ * expr.h (expand_atomic_*): Add prototypes.
+ (expand_{bool,val}_compare_and_swap): Remove prototypes.
+ * c-typeck.c (build_function_call_vec): Don't reprocess __atomic
+ parameters.
+ * common.opt (Winvalid-memory-model): New warning flag.
+ (finline-atomics): New. Flag to disable atomic inlining.
+ * params.h (ALLOW_LOAD_DATA_RACES): New.
+ (ALLOW_PACKED_LOAD_DATA_RACES): New.
+ (ALLOW_PACKED_STORE_DATA_RACES): New.
+ * params.def (PARAM_ALLOW_LOAD_DATA_RACES): New.
+ (PARAM_ALLOW_PACKED_LOAD_DATA_RACES): New.
+ (PARAM_ALLOW_PACKED_STORE_DATA_RACES): New.
+ * builtins.c (is_builtin_name): Handle __atomic.
+ (get_memmodel): New. Extract memory model.
+ (expand_expr_force_mode): New. Factor out common code for ensuring an
+ integer argument is in the proper mode.
+ (expand_builtin_sync_operation): Remove ignore param. Always call
+ expand_atomic_fetch_op instead of the old expanders.
+ (expand_builtin_compare_and_swap,
+ expand_builtin_sync_lock_test_and_set): Use expand_expr_force_mode,
+ call atomic expanders instead of sync expanders.
+ (expand_builtin_sync_lock_release): Call atomic_store expander.
+ (expand_builtin_atomic_compare_exchange, expand_builtin_atomic_load,
+ expand_builtin_atomic_store, expand_builtin_atomic_fetch_op): New.
+ (expand_builtin_atomic_exchange): New.
+ (fold_builtin_atomic_always_lock_free,
+ expand_builtin_atomic_always_lock_free,
+ fold_builtin_atomic_is_lock_free, expand_builtin_atomic_is_lock_free):
+ New.
+ (expand_builtin_mem_thread_fence, expand_builtin_atomic_thread_fence,
+ expand_builtin_atomic_signal_fence): New.
+ (expand_builtin_mem_signal_fence): New.
+ (expand_builtin): Add cases for BUILT_IN_ATOMIC_*.
+ (fold_builtin_2): Add cases for BUILT_IN_ATOMIC_{IS,ALWAYS}_LOCK_FREE.
+ * optabs.h (DOI_atomic_*): Define new atomics.
+ (atomic_*_optab): Define.
+ (can_compare_and_swap_p, expand_atomic_compare_and_swap): New
+ prototypes.
+ * optabs.c (expand_sync_operation, expand_sync_fetch_operation): Remove.
+ (expand_sync_lock_test_and_set): Remove.
+ (expand_atomic_load, expand_atomic_store): New.
+ (expand_atomic_exchange): New.
+ (expand_atomic_compare_and_swap): New. Implements
+ atomic_compare_exchange via compare and swap.
+ (struct atomic_op_functions): Opcode table struct for fetch ops.
+ (get_atomic_op_for_code): New. Return an opcode table entry.
+ (maybe_emit_op): New. Try to emit a fetch op.
+ (expand_atomic_fetch_op): New.
+ (expand_val_compare_and_swap_1): Remove.
+ (expand_val_compare_and_swap, expand_bool_compare_and_swap): Remove.
+ (expand_atomic_compare_and_swap): Rename from
+ expand_atomic_compare_exchange. Rewrite to return both success and
+ oldval return values; expand via both atomic and sync optabs.
+ (can_compare_and_swap_p): New.
+ (expand_compare_and_swap_loop): Use expand_atomic_compare_and_swap.
+ (maybe_gen_insn): Handle 7 and 8 operands.
+ * omp-low.c (expand_omp_atomic_fetch_op): Don't test individual
+ fetch_op optabs, only test can_compare_and_swap_p. Use __atomic
+ builtins instead of __sync builtins.
+ (expand_omp_atomic_pipeline): Use can_compare_and_swap_p.
+ * doc/extend.texi: Document __atomic built-in functions.
+ * doc/invoke.texi: Document data race parameters.
+ * doc/md.texi: Document atomic patterns.
+ * config/i386/i386.md (UNSPEC_MOVA): New.
+ (UNSPECV_CMPXCHG): Split into ...
+ (UNSPECV_CMPXCHG_1, UNSPECV_CMPXCHG_2,
+ UNSPECV_CMPXCHG_3, UNSPECV_CMPXCHG_4): New.
+ * config/i386/sync.md (ATOMIC): New mode iterator.
+ (atomic_load<ATOMIC>, atomic_store<ATOMIC>): New.
+ (atomic_loaddi_fpu, atomic_storedi_fpu, movdi_via_fpu): New.
+ (mem_thread_fence): Rename from memory_barrier.
+ Handle the added memory model parameter.
+ (mfence_nosse): Rename from memory_barrier_nosse.
+ (sync_compare_and_swap<CASMODE>): Split into ...
+ (atomic_compare_and_swap<SWI124>): this and ...
+ (atomic_compare_and_swap<CASMODE>): this. Handle the new parameters.
+ (atomic_compare_and_swap_single<SWI>): Rename from
+ sync_compare_and_swap<SWI>; rewrite to use split unspecs.
+ (atomic_compare_and_swap_double<DCASMODE>): Rename from
+ sync_double_compare_and_swap<DCASMODE>; rewrite to use split unspecs.
+ (*atomic_compare_and_swap_doubledi_pic): Rename from
+ sync_double_compare_and_swapdi_pic; rewrite to use split unspecs.
+ (atomic_fetch_add<SWI>): Rename from sync_old_add<SWI>; add memory
+ model parameter.
+ (*atomic_fetch_add_cmp<SWI>): Similarly.
+ (atomic_add<SWI>, atomic<any_logic><SWI>): Similarly.
+ (atomic_sub<SWI>): Similarly. Use x86_maybe_negate_const_int.
+ (sync_lock_test_and_set<SWI>): Merge with ...
+ (atomic_exchange<SWI>): ... this.
+
+2011-11-6 Richard Guenther <rguenther@suse.de>
+
+ * ipa-prop.c (ipa_modify_call_arguments): Re-compute
+ inlinable flag.
+
+2011-11-06 Ira Rosen <ira.rosen@linaro.org>
+
+ * tree-vectorizer.h (vectorizable_condition): Add argument.
+ * tree-vect-loop.c (vectorizable_reduction): Fail for condition
+ in SLP. Update calls to vectorizable_condition.
+ * tree-vect-stmts.c (vect_is_simple_cond): Add basic block info to
+ the arguments. Pass it to vect_is_simple_use_1.
+ (vectorizable_condition): Add slp_node to the arguments. Support
+ vectorization of basic blocks. Fail for reduction in SLP. Update
+ calls to vect_is_simple_cond and vect_is_simple_use. Support SLP:
+ call vect_get_slp_defs to get vector operands.
+ (vect_analyze_stmt): Update calls to vectorizable_condition.
+ (vect_transform_stmt): Likewise.
+ * tree-vect-slp.c (vect_create_new_slp_node): Handle COND_EXPR.
+ (vect_get_and_check_slp_defs): Handle COND_EXPR. Allow pattern
+ def stmts.
+ (vect_build_slp_tree): Handle COND_EXPR.
+ (vect_analyze_slp_instance): Push pattern statements to root node.
+ (vect_get_constant_vectors): Fix comments. Handle COND_EXPR.
+
+2011-11-05 David S. Miller <davem@davemloft.net>
+
+ * config/sparc/sparc.md (UNSPEC_SHORT_LOAD): New unspec.
+ (zero-extend_v8qi_vis, zero_extend_v4hi_vis): New expanders.
+ (*zero_extend_v8qi_<P:mode>_insn,
+ *zero_extend_v4hi_<P:mode>_insn): New insns.
+ * config/sparc/sparc.c (vector_init_move_words,
+ vector_init_prepare_elts, sparc_expand_vector_init_vis2,
+ sparc_expand_vector_init_vis1): New functions.
+ (vector_init_bshuffle): Rewrite to handle more cases and make use
+ of locs[] array prepared by vector_init_prepare_elts.
+ (vector_init_fpmerge, vector_init_faligndata): Delete.
+ (sparc_expand_vector_init): Rewrite using new infrastructure.
+
+2011-11-05 Joern Rennecke <joern.rennecke@embecosm.com>
+
+ * config.gcc (epiphany-*-*): New architecture.
+ (epiphany-*-elf): New configuration.
+ * config/epiphany, common/config/epiphany : New directories.
+ * doc/extend.texi (disinterrupt attribute): Add Epiphany.
+ (interrupt attribute): Add Epiphany.
+ (long_call, short_call attribute): Add Epiphany.
+ * doc/invoke.texi (Options): Add Epiphany options.
+ * doc/md.texi (Machine Constraints): Add Epiphany constraints.
+ * doc/install.texi (Options specification):
+ Add --with-stack-offset=@var{num} description.
+ (host/target specific issues): Add epiphany-*-elf.
+ * doc/contrib.texi (Contributors): Mention Epiphany port.
+
+2011-11-05 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/50693
+ * tree-cfg.c (gimple_can_merge_blocks_p): Allow merging with
+ non-forced user labels.
+ (gimple_merge_blocks): Turn non-forced user labels into
+ debug bind stmt with the label as first operand and reset value.
+ (gimple_duplicate_bb): Don't duplicate label debug stmts.
+ * dwarf2out.c (gen_label_die): Handle NOTE_INSN_DELETED_DEBUG_LABEL.
+ * final.c (final_scan_insn): Likewise.
+ (rest_of_clean_state): Don't dump NOTE_INSN_DELETED_DEBUG_LABEL.
+ * var-tracking.c (debug_label_num): New variable.
+ (delete_debug_insns): Don't delete DEBUG_INSNs for LABEL_DECLs,
+ instead turn them into NOTE_INSN_DELETED_DEBUG_LABEL notes.
+ * cfglayout.c (skip_insns_after_block, duplicate_insn_chain): Handle
+ NOTE_INSN_DELETED_DEBUG_LABEL.
+ (duplicate_insn_chain): Don't duplicate LABEL_DECL DEBUG_INSNs.
+ * insn-notes.def (DELETED_DEBUG_LABEL): New note kind.
+ * print-rtl.c (print_rtx): Handle NOTE_INSN_DELETED_DEBUG_LABEL.
+ * gengtype.c (adjust_field_rtx_def): Likewise.
+ * config/i386/i386.c (ix86_output_function_epilogue): For MachO
+ clear CODE_LABEL_NUMBER of NOTE_INSN_DELETED_DEBUG_LABEL
+ if their are at the end of function and nop hasn't been emitted.
+ * config/rs6000/rs6000.c (rs6000_output_function_epilogue): Likewise.
+
+2011-11-05 Georg-Johann Lay <avr@gjlay.de>
+
+ PR rtl-optimization/50448
+ * cprop.c (try_replace_reg): Also try to replace uses of FROM that
+ appear in SET_DEST.
+
+2011-11-05 Peter Dufault <dufault@hda.com>,
+ Sebastian Huber <sebastian.huber@embedded-brains.de>
+
+ * config/rs6000/rtems.h (SUBSUBTARGET_OVERRIDE_OPTIONS):
+ Extend rs6000_spe handling.
+
+2011-11-05 Ralf Corsépius <ralf.corsepius@rtems.org>
+
+ * config/rs6000/t-rtems: Add -mcpu=8540/-mfloat-gprs=double multilib.
+ Remove -mcpu=601 multilib.
+ Remove -Dmpc8260 multilib.
+ * config/rs6000/rtems.h: Allow --float-gprs=... to override grps
+ on E500 targets.
+
+2011-11-05 Quentin Neill <quentin.neill@amd.com>
+
+ Piledriver f16cintrin.h fix.
+ * config/i386/f16cintrin.h: Contents moved from immintrin.h.
+ * config/i386/immintrin.h: Include f16cintrin.h.
+ * config.gcc (i[34567]86-*-*, x86_64-*-*): Add f16cintrin.h.
+
+
+2011-11-04 Eric Botcazou <ebotcazou@adacore.com>
+
+ PR c++/50608
+ * c-parser.c (c_parser_postfix_expression) <RID_OFFSETOF>: Adjust call
+ to fold_offsetof.
+ * c-typeck.c (build_unary_op) <ADDR_EXPR>: Call fold_offsetof_1.
+
+2011-11-04 Alan Modra <amodra@gmail.com>
+
+ * reload1.c (gen_reload): Don't use REGNO on SUBREGs.
+ * print-rtl.c (print_rtx): Don't segfault on negative regno.
+
+2011-11-04 David S. Miller <davem@davemloft.net>
+
+ PR target/49965
+ * config/sparc/sparc.c (sparc_expand_conditional_move): Handle the
+ fact that sparc_emit_float_lib_cmp modifies the comparison in
+ operands[1].
+
+2011-11-04 Ralf Corsépius <ralf.corsepius@rtems.org>
+
+ * config/lm32/t-rtems: New.
+ * config.gcc (lm32-*-rtems*): Add t-rtems.
+
+2011-11-04 Eric Botcazou <ebotcazou@adacore.com>
+
+ PR target/50979
+ * config/sparc/sparc.h (ASM_CPU_SPEC): Pass -Av8 if -mcpu=v8.
+
+2011-11-04 Jiangning Liu <jiangning.liu@arm.com>
+
+ PR rtl-optimization/38644
+ * config/arm/arm.c (thumb1_expand_epilogue): Add memory barrier
+ for epilogue having stack adjustment.
+
+2011-11-04 Georg-Johann Lay <avr@gjlay.de>
+
+ PR target/50931
+ * config/avr/avr-modes.def: New file defining PSImode.
+ * config/avr/avr-c.c (__INT24_MAX__, __INT24_MIN__,
+ __UINT24_MAX__): New built-in defines.
+ * config/avr/avr.md (adjust_len): Add tstpsi, mov24, reload_in24,
+ ashlpsi, ashrpsi, lshrpsi.
+ (QISI, QIDI, HISI, HIDI, MPUSH, rotx, rotsmode): Add PSI.
+ (MOVMODE): New mode iterator.
+ (movpsi): New expander.
+ (movqi, movhi, movsi, movsf, movpsi): Write as one using MOVMODE.
+ (*reload_inpsi, *movpsi): New insns.
+ (*reload_inpsi): New RTL peephole.
+ (addpsi3, *addpsi3_zero_extend.qi, *addpsi3_zero_extend.hi,
+ *addpsi3_sign_extend.hi): New insns.
+ (subpsi3, *subpsi3_zero_extend.qi, *subpsi3_zero_extend.hi,
+ *subpsi3_sign_extend.hi): New insns.
+ (divmodpsi4, udivmodpsi4): New define insn-and-split.
+ (*divmodpsi4_call, *udivmodpsi4_call): New insns.
+ (andpsi3, iorpsi3, xorpsi3): New insns.
+ (*rotlpsi2.1, *rotlpsi2.23): New insns.
+ (*rotw<mode>): Insn condition only allow even-sized modes.
+ (*rotb<mode>): Insn condition allows odd-sized modes.
+ (ashlpsi3, ashrpsi3, lshrpsi3, *addpsi3.lt0): New insns.
+ (negpsi2, one_cmplpsi2): New insns.
+ (extendqipsi2, extendhipsi2, extendpsisi2): New insns.
+ (zero_extendqipsi2, zero_extendhipsi2, zero_extendpsisi2): New
+ insn-and-splits.
+ (*cmppsi, *negated_tstpsi, *reversed_tstpsi): New insns.
+ (cbranchpsi4): New expander.
+ * config/avr/constraints.md (Ca3, Co3, Cx3): New constraints.
+ * config/avr/avr-protos.h (avr_out_tstpsi, avr_out_movpsi,
+ avr_out_ashlpsi3, avr_out_ashrpsi3, avr_out_lshrpsi3,
+ avr_out_reload_inpsi): New prototypes.
+
+ * config/avr/avr.c (TARGET_SCALAR_MODE_SUPPORTED_P): Define to...
+ (avr_scalar_mode_supported_p): ...this new static function.
+ (avr_asm_len): Always return "".
+ (avr_out_load_psi, avr_out_store_psi): New static functions.
+ (avr_out_movpsi, avr_out_reload_inpsi): New functions.
+ (avr_out_tstpsi): New function.
+ (avr_out_ashlpsi3, avr_out_ashrpsi3, avr_out_lshrpsi3): New functions.
+ (avr_out_plus_1, output_reload_in_const): Handle 3-byte types.
+ (avr_simplify_comparison_p): Ditto.
+ (adjust_insn_length): Handle ADJUST_LEN_RELOAD_IN24,
+ ADJUST_LEN_MOV24, ADJUST_LEN_TSTPSI, ADJUST_LEN_ASHLPSI,
+ ADJUST_LEN_ASHRPSI, ADJUST_LEN_LSHRPSI.
+ (avr_rtx_costs_1): Report PSI costs.
+ (avr_libcall_value): Handle odd-sized parameters.
+ (avr_init_builtin_int24): New static function to define built-in
+ 24-bit types __int24 and __uint24.
+ (avr_init_builtins): Use it.
+
+2011-11-04 Thomas Doerfler <thomas.doerfler@embedded-brains.de>
+
+ PR target/50989
+ * config/arm/rtems-elf.h, config/arm/t-rtems: Add optional
+ support for VFP floating point model.
+
+2011-11-04 Tristan Gingold <gingold@adacore.com>
+
+ * config/alpha/vms.h (ASM_OUTPUT_DEF): Do not switch section.
+
+2011-11-04 Ira Rosen <ira.rosen@linaro.org>
+
+ Unrevert:
+ 2011-10-24 Ira Rosen <ira.rosen@linaro.org>
+
+ PR tree-optimization/50730
+ * tree-vect-data-refs.c (vect_analyze_data_refs): Stop basic block
+ analysis if encountered unsupported data-ref.
+
+2011-11-04 Jakub Jelinek <jakub@redhat.com>
+
+ * config/i386/i386.c (ix86_expand_vector_convert_uns_vsivsf): New
+ function.
+ * config/i386/i386-protos.h (ix86_expand_vector_convert_uns_vsivsf):
+ New prototype.
+ * config/i386/sse.md (floatuns<sseintvecmodelower><mode>2): Use it.
+ For floatunsv8siv8sf2 require TARGET_AVX2.
+
+ * config/i386/i386.c (ix86_expand_adjust_ufix_to_sfix_si): Add
+ XORP argument. Subtract 0x1p31 instead of 0x1p32. Use normal
+ signalling comparison instead of non-signalling. Store into
+ *XORP pseudo holding 0x80000000 integers if 0x1p31 has been
+ subtracted and 0 otherwise.
+ * config/i386/i386-protos.h (ix86_expand_adjust_ufix_to_sfix_si):
+ Adjust prototype.
+ * config/i386/sse.md (fixuns_trunc<mode><sseintvecmodelower>2): Enable
+ already for TARGET_SSE2. Xor in vector initialized by
+ ix86_expand_adjust_ufix_to_sfix_si at the end.
+ (vec_pack_ufix_trunc_<mode>): Likewise.
+
+ * tree-vect-stmts.c (vectorizable_conversion): Rewritten to handle
+ not just FLOAT_EXPR and FIX_TRUNC_EXPR, but also CONVERT_EXPR_CODE_P,
+ WIDEN_MULT_EXPR and WIDEN_LSHIFT_EXPR to handle what
+ vectorizable_type_demotion and vectorizable_type_promotion did.
+ Additionally handle FLOAT_EXPR and FIX_TRUNC_EXPR where the integer
+ is {,un}signed {char,short}.
+ (vect_create_vectorized_demotion_stmts): Fix comment typo. For
+ recursive calls unconditionally use VEC_PACK_TRUNC_EXPR.
+ Push vec_dest back to the vec_dsts vector at the end.
+ (vect_create_vectorized_promotion_stmts): Don't recurse, do just
+ one step. Removed multi_step_cvt, vec_dsts, slp_node and
+ prev_stmt_info arguments, add vec_dest argument. Push always
+ into vec_tmp, not just when multi_step_cvt != 0, replace *vec_oprdn0
+ with vec_tmp at the end after freeing old *vec_oprnd0 vector.
+ (vectorizable_type_demotion, vectorizable_type_promotion): Removed.
+ (vect_analyze_stmt): Don't call vectorizable_type_demotion and
+ vectorizable_type_promotion. Call vectorizable_conversion even
+ for SLP bb vectorization.
+ (vect_transform_stmt): Call vectorizable_conversion instead of
+ vectorizable_type_demotion and vectorizable_type_promotion.
+ (supportable_widening_operation): Clear *multi_step_cvt first,
+ simplify c1/c2 computation, free *interm_types vector on failure.
+ (supportable_narrowing_operation): Clear *multi_step_cvt first,
+ free *interm_types vector on failure, handle multi-step
+ FIX_TRUNC_EXPR.
+
+2011-11-04 Tristan Gingold <gingold@adacore.com>
+
+ * config/alpha/alpha.c (alpha_write_linkage): Remove fundecl
+ argument. Conditionally generate crash debug info. Adjust
+ for alpha_funcs_tree removal.
+ (machine_function): Add links field.
+ (alpha_start_function): Conditionally generate crash debug info.
+ (alpha_end_function): Adjust call to alpha_write_linkage.
+ (alpha_funcs): Remove.
+ (links_kind): Remove.
+ (alpha_links): Remove num, target and lkind field. Add func field.
+ (alpha_links_tree): Remove.
+ (alpha_funcs_tree): Remove.
+ (alpha_need_linkage): Remove.
+ (alpha_use_linkage): Change prototype. Adjust.
+ (alpha_write_one_linkage): Use ASM_OUTPUT_INTERNAL_LABEL.
+ Use SYMBOL_REF_EXTERNAL_P and SYMBOL_REF_LOCAL_P macro.
+ * config/alpha/alpha-protos.h (alpha_use_linkage): Update.
+ (alpha_need_linkage): Remove.
+ * config/alpha/alpha.md: Update calls to alpha_use_linkage.
+ Adjust calls to alpha_need_linkage.
+
+2011-11-03 Uros Bizjak <ubizjak@gmail.com>
+
+ * sched-vis.c (print_value): Handle STRICT_LOW_PART.
+
+2011-11-03 Uros Bizjak <ubizjak@gmail.com>
+
+ * config/i386/i386.md (lround<X87MODEF:mode><SWI248x:mode>2,
+ rint<mode>2, floor<mode>2, lfloor<MODEF:mode><SWI48:mode>2,
+ btrunc<mode>2, lwp_lwpval<mode>3): Use operands[N] instead of operandN.
+
+2011-11-03 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
+
+ PR target/50978
+ * config/arm/t-bpabi: New file.
+ * config.gcc (arm*-*-linux*): Add arm/t-bpabi to tmake_file for
+ arm*-*-linux-*eabi.
+ (arm*-*-uclinux*): Add arm/t-bpabi to tmake_file for
+ arm*-*-uclinux*eabi.
+ (arm*-*-eabi*, arm*-*-symbianelf*): Add arm/t-bpabi to tmake_file
+ for arm*-*-eabi*.
+
+2011-11-03 Michael Matz <matz@suse.de>
+
+ PR bootstrap/50857
+ * configure.ac: Check for -fno-exceptions -fno-rtti.
+ * configure: Regenerate.
+ * Makefile.in (NOEXCEPTION_FLAGS): New flag.
+ (ALL_CXXFLAGS): Use it.
+
+2011-11-03 Uros Bizjak <ubizjak@gmail.com>
+
+ * config/i386/i386.md: Use {} for multi-line preparation statements.
+
+2011-11-03 Eric Botcazou <ebotcazou@adacore.com>
+
+ * config/sparc/sparc.md (movtf_insn_sp32_no_fpu): Consolidate into...
+ (movtf_insn_sp32): ...this.
+ (movtf_insn_sp64_no_fpu): Consolidate into...
+ (movtf_insn_sp64): ...this.
+ (movtf_insn_sp64_hq): Do not test TARGET_FPU.
+ * config/sparc/sparc.c (sparc_legitimate_address_p): Likewise.
+
+2011-11-03 Tristan Gingold <gingold@adacore.com>
+
+ * config/vms/vms.c (vms_patch_builtins): Fix typo.
+
+2011-11-03 Richard Guenther <rguenther@suse.de>
+
+ PR lto/44965
+ * lto-opts.c: Re-implement.
+ * lto-streamer.h (lto_register_user_option): Remove.
+ (lto_read_file_options): Likewise.
+ (lto_reissue_options): Likewise.
+ (lto_clear_user_options): Likewise.
+ (lto_clear_file_options): Likewise.
+ * opts-global.c (post_handling_callback): Remove.
+ (set_default_handlers): Do not set post_handling_callback.
+ (decode_options): Remove LTO specific code.
+ * lto-wrapper.c (merge_and_complain): New function.
+ (run_gcc): Read all input file options and
+ prepend a merged set before the linker driver options.
+ * gcc.c (driver_post_handling_callback): Remove.
+ (set_option_handlers): Do not set post_handling_callback.
+ * opts-common.c (handle_option): Do not call post_handling_callback.
+ * opts.h (struct cl_option_handlers): Remove post_handling_callback.
+
+2011-11-03 Richard Guenther <rguenther@suse.de>
+
+ * collect2.c (main): Guard object_nbr variable with TARGET_AIX_VERSION.
+
+2011-11-03 Martin Jambor <mjambor@suse.cz>
+
+ * ipa-prop.c (type_change_info): New fields offset, object,
+ known_current_type and multiple_types_encountered.
+ (extr_type_from_vtbl_ptr_store): New function.
+ (check_stmt_for_type_change): Use it, set multiple_types_encountered if
+ the result is different from the previous one.
+ (detect_type_change): Renamed to detect_type_change_1. New parameter
+ comp_type. Set up new fields in tci, build known type jump
+ functions if the new type can be identified.
+ (detect_type_change): New function.
+ * tree.h (DECL_CONTEXT): Comment new use.
+
+2011-11-03 Richard Guenther <rguenther@suse.de>
+
+ PR lto/48217
+ * lto-wrapper.c (get_options_from_collect_gcc_options): Properly
+ decode an encoded literal '.
+
+2011-11-03 Tristan Gingold <gingold@adacore.com>
+
+ * collect2.c (main): Add support of -f (response file) on AIX.
+
+2011-11-03 Ira Rosen <ira.rosen@linaro.org>
+
+ PR tree-optimization/50912
+ * tree-vectorizer.h (slp_void_p): New.
+ (struct _slp_tree): Replace left and right with children. Update
+ documentation.
+ (struct _slp_oprnd_info): New.
+ (vect_get_vec_defs): Declare.
+ (vect_get_slp_defs): Update arguments.
+ * tree-vect-loop.c (vect_create_epilog_for_reduction): Call
+ vect_get_vec_defs instead of vect_get_slp_defs.
+ (vectorizable_reduction): Likewise.
+ * tree-vect-stmts.c (vect_get_vec_defs): Remove static, add argument.
+ Update call to vect_get_slp_defs.
+ (vectorizable_conversion): Update call to vect_get_vec_defs.
+ (vectorizable_assignment, vectorizable_shift,
+ vectorizable_operation): Likewise.
+ (vectorizable_type_demotion): Call vect_get_vec_defs instead of
+ vect_get_slp_defs.
+ (vectorizable_type_promotion, vectorizable_store): Likewise.
+ (vect_analyze_stmt): Fix typo.
+ * tree-vect-slp.c (vect_free_slp_tree): Update SLP tree traversal.
+ (vect_print_slp_tree, vect_mark_slp_stmts,
+ vect_mark_slp_stmts_relevant, vect_slp_rearrange_stmts,
+ vect_detect_hybrid_slp_stmts, vect_slp_analyze_node_operations,
+ vect_schedule_slp_instance): Likewise.
+ (vect_create_new_slp_node): New.
+ (vect_create_oprnd_info, vect_free_oprnd_info): Likewise.
+ (vect_get_and_check_slp_defs): Pass information about defs using
+ oprnds_info, allow any number of operands.
+ (vect_build_slp_tree): Likewise. Update calls to
+ vect_get_and_check_slp_defs. Fix comments.
+ (vect_analyze_slp_instance): Move node creation to
+ vect_create_new_slp_node.
+ (vect_get_slp_defs): Allow any number of operands.
+
+2011-11-02 Peter Bergner <bergner@vnet.ibm.com>
+ Iain Sandoe <iains@gcc.gnu.org>
+
+ * config/rs6000/rs6000.c (USE_HIDDEN_LINKONCE): New define.
+ (get_ppc476_thunk_name): Use it.
+ (rs6000_code_end): Likewise.
+ (macho_branch_islands): Fix typo.
+
+2011-11-02 Paolo Carlini <paolo.carlini@oracle.com>
+ Jason Merrill <jason@redhat.com>
+
+ PR c++/50810
+ * configure.ac: Add -Wno-narrowing to warning options.
+ * doc/invoke.texi ([-Wnarrowing], [-Wc++0x-compat]): Update.
+
+2011-11-02 Eric Botcazou <ebotcazou@adacore.com>
+
+ PR target/50945
+ * config/sparc/sparc.md (movsf_insn): Reindent constraints.
+ (movdf_insn_sp32): Likewise. Remove redundant G constraint.
+ (movdf_insn_sp64): Likewise.
+ (DFmode splitter): Do not test TARGET_FPU.
+ (movtf_insn_sp32): Reindent constraints.
+ (movtf_insn_sp32_no_fpu): Likewise.
+ (movtf_insn_sp64): Likewise.
+ (movtf_insn_sp64_hq): Likewise.
+ (movtf_insn_sp64_no_fpu): Likewise.
+
+2011-11-02 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/50956
+ * builtins.c (fold_builtin_memchr): Fix cast.
+
+2011-11-02 Teresa Johnson <tejohnson@google.com>
+
+ * config/i386/predicates.md (promotable_binary_operator): Add minus
+ to the list of promotable operators.
+
+2011-11-02 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
+
+ * gthr-single.h, gthr.h: Move to ../libgcc.
+ * gthr-aix.h: Move to ../libgcc/config/rs6000.
+ * gthr-dce.h: Move to ../libgcc/config/pa.
+ * gthr-lynx.h: Move to ../libgcc/config.
+ * gthr-mipssde.h: Move to ../libgcc/config/mips.
+ * gthr-posix.h: Move to ../libgcc/config.
+ * gthr-rtems.h: Likewise.
+ * gthr-tpf.h: Move to ../libgcc/config/s390.
+ * gthr-vxworks.h: Move to ../libgcc/config.
+ * gthr-win32.h: Move to ../libgcc/config/i386.
+ * configure.ac (gthread_flags): Remove
+ (gthr-default.h): Don't create.
+ (thread_file): Don't substitute.
+ * configure: Regenerate.
+ * Makefile.in (GCC_THREAD_FILE): Remove.
+ (GTHREAD_FLAGS): Remove.
+ (libgcc.mvars): Remove GTHREAD_FLAGS.
+ * config/t-vxworks (EXTRA_HEADERS): Remove.
+
+2011-11-02 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
+ Paolo Bonzini <bonzini@gnu.org>
+
+ * configure.ac (libgcc_tm_file_list, libgcc_tm_include_list): Remove.
+ * configure: Regenerate.
+ * Makefile.in (libgcc_tm_file_list, libgcc_tm_include_list): Remove.
+ (TM_H): Remove libgcc_tm.h, $(libgcc_tm_file_list).
+ (libgcc_tm.h, cs-libgcc_tm.h): Remove.
+ (clean): Remove libgcc_tm.h
+ * mkconfig.sh: Don't include libgcc_tm.h in tm.h.
+ * config.gcc (libgcc_tm_file): Remove.
+ (arm*-*-linux*): Remove libgcc_tm_file for arm*-*-linux-*eabi.
+ (arm*-*-uclinux*): Remove libgcc_tm_file for arm*-*-uclinux*eabi.
+ (arm*-*-eabi*, arm*-*-symbianelf*): Remove libgcc_tm_file.
+ (avr-*-rtems*): Likewise.
+ (avr-*-*): Likewise.
+ (frv-*-elf): Likewise.
+ (frv-*-*linux*): Likewise.
+ (h8300-*-rtems*): Likewise.
+ (h8300-*-elf*): Likewise.
+ (i[34567]86-*-darwin*): Likewise.
+ (x86_64-*-darwin*): Likewise.
+ (rx-*-elf*): Likewise.
+ (tic6x-*-elf): Likewise.
+ (tic6x-*-uclinux): Likewise.
+ (i[34567]86-*-linux*, x86_64-*-linux*): Likewise.
+
+2011-11-02 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
+
+ * Makefile.in (LIBGCC2_DEBUG_CFLAGS LIBGCC2_CFLAGS)
+ (LIBGCC2_INCLUDES, TARGET_LIBGCC2_CFLAGS, LIB2FUNCS_EXTRA)
+ (LIB2FUNCS_STATIC_EXTRA, LIB2FUNCS_EXCLUDE, T, T_TARGET)
+ (INCLUDES_FOR_TARGET): Remove.
+ (LIBGCC2_CFLAGS): Don't export.
+ (LIB2FUNCS_ST, LIB2_DIVMOD_FUNCS, LIB2ADD, LIB2ADD_ST, srcdirify):
+ Remove.
+ (libgcc-support): Remove $(LIB2ADD), $(LIB2ADD_ST) dependencies.
+ (libgcc.mvars): Likewise.
+ Don't emit LIB2FUNCS_ST, LIB2FUNCS_EXCLUDE, LIB2ADD, LIB2ADD_ST,
+ LIB2_SIDITI_CONV_FUNCS, LIB2_DIVMOD_FUNCS, LIBGCC2_CFLAGS,
+ TARGET_LIBGCC2_CFLAGS.
+ Emit GTHREAD_FLAGS.
+ * libgcc2.c, libgcc2.h, gbl-ctors.h, longlong.h: Move to ../libgcc.
+ * config/darwin-64.c: Move to ../libgcc/config.
+ * config/divmod.c, config/floatunsidf.c, config/floatunsisf.c,
+ config/floatunsitf.c, config/floatunsixf.c, config/udivmod.c,
+ config/udivmodsi4.c: Move to ../libgcc/config.
+ * config/gthr-posix.c: Move to ../libgcc/config/alpha.
+ * config/memcmp.c, config/memcpy.c, config/memmove.c,
+ config/memset.c: Move to ../libgcc/config.
+ * config/t-darwin (TARGET_LIBGCC2_CFLAGS): Remove.
+ * config/t-freebsd: Remove.
+ * config/t-freebsd-thread: Move to ../libgcc/config.
+ * config/t-libgcc-pic: Move to ../libgcc/config.
+ * config/t-libunwind (TARGET_LIBGCC2_CFLAGS): Remove.
+ * config/t-linux: Remove.
+ * config/t-lynx (TARGET_LIBGCC2_CFLAGS, LIBGCC, INSTALL_LIBGCC):
+ Remove.
+ * config/t-openbsd-thread: Move to ../libgcc/config.
+ * config/t-rtems (LIBGCC2_INCLUDES): Remove.
+ * config/t-sol2 (TARGET_LIBGCC2_CFLAGS): Remove.
+ * config/t-svr4: Remove.
+ * config/t-vxworks (LIBGCC, INSTALL_LIBGCC, TARGET_LIBGCC2_CFLAGS)
+ (LIBGCC2_DEBUG_CFLAGS, LIB2FUNCS_EXTRA, LIBGCC2_INCLUDES): Remove.
+ * config/vxlib.c, config/vxlib-tls.c: Move to ../libgcc/config.
+ * config/alpha/qrnnd.asm: Move to ../libgcc/config/alpha/qrnnd.S.
+ * config/alpha/t-alpha, config/alpha/t-ieee: Remove.
+ * config/alpha/t-vms (LIB2FUNCS_EXTRA, LIBGCC, INSTALL_LIBGCC): Remove.
+ * config/alpha/vms-gcc_shell_handler.c: Move to ../libgcc/config/alpha.
+ * config/arm/bpabi.c, config/arm/unaligned-funcs.c,
+ config/arm/fp16.c, config/arm/linux-atomic.c,
+ config/arm/linux-atomic-64bit.c: Move to ../libgcc/config/arm.
+ * config/arm/t-arm-elf (LIBGCC, INSTALL_LIBGCC)
+ (TARGET_LIBGCC2_CFLAGS): Remove.
+ * config/arm/t-bpabi, config/arm/t-linux: Remove.
+ * config/arm/t-linux-eabi (TARGET_LIBGCC2_CFLAGS)
+ (LIB2FUNCS_STATIC_EXTRA): Remove.
+ * config/arm/t-netbsd: Remove.
+ * config/arm/t-strongarm-elf (LIBGCC, INSTALL_LIBGCC)
+ (TARGET_LIBGCC2_CFLAGS): Remove.
+ * config/arm/t-symbian (LIB2FUNCS_STATIC_EXTRA): Remove.
+ * config/arm/t-wince-pe (LIBGCC, INSTALL_LIBGCC)
+ (TARGET_LIBGCC2_CFLAGS): Remove.
+ * config/avr/t-avr (LIB2FUNCS_EXCLUDE, TARGET_LIBGCC2_CFLAGS)
+ (LIBGCC, INSTALL_LIBGCC): Remove.
+ * config/bfin/t-bfin-elf (TARGET_LIBGCC2_CFLAGS): Remove.
+ * config/bfin/t-bfin-linux: Likewise.
+ * config/bfin/t-bfin-uclinux: Likewise.
+ * config/c6x/eqd.c, config/c6x/eqf.c, config/c6x/ged.c,
+ config/c6x/gef.c, config/c6x/gtd.c, config/c6x/gtf.c,
+ config/c6x/led.c, config/c6x/lef.c, config/c6x/ltd.c,
+ config/c6x/ltf.c: Move to ../libgcc/config/c6x.
+ * config/c6x/t-c6x-elf (LIB2FUNCS_EXCLUDE, LIB2FUNCS_EXTRA): Remove.
+ * config/c6x/t-c6x-uclinux (TARGET_LIBGCC2_CFLAGS): Remove.
+ * config/cris/arit.c: Move to ../libgcc/config/cris.
+ * config/cris/cris_abi_symbol.c: Remove.
+ * config/cris/cris.h: Remove obsolete comment.
+ * config/cris/mulsi3.asm: Move to ../libgcc/config/cris/mulsi3.S.
+ * config/cris/t-cris (LIB2FUNCS_EXTRA, CRIS_LIB1CSRC)
+ ($(LIB2FUNCS_EXTRA)): Remove.
+ * config/cris/t-elfmulti (LIB2FUNCS_STATIC_EXTRA, INSTALL_LIBGCC)
+ (LIBGCC): Remove.
+ * config/cris/t-linux (TARGET_LIBGCC2_CFLAGS): Remove.
+ * config/fr30/t-fr30: Remove.
+ * config/frv/cmovd.c, config/frv/cmovh.c, config/frv/cmovw.c,
+ config/frv/modi.c, config/frv/uitod.c, config/frv/uitof.c,
+ config/frv/ulltod.c, config/frv/ulltof.c, config/frv/umodi.c: Move
+ to ../libgcc/config/frv.
+ * config/frv/t-frv (LIB2FUNCS_EXTRA, TARGET_LIBGCC2_CFLAGS)
+ (cmovh.c, cmovw.c, cmovd.c, modi.c, umodi.c, uitof.c, uitod.c)
+ (ulltof.c, LIBGCC, INSTALL_LIBGCC): Remove.
+ * config/frv/t-linux (TARGET_LIBGCC2_CFLAGS): Remove.
+ * config/h8300/clzhi2.c, config/h8300/ctzhi2.c,
+ config/h8300/fixunssfsi.c, config/h8300/parityhi2.c,
+ config/h8300/popcounthi2.c: Move to ../libgcc/config/h8300.
+ * config/h8300/t-h8300 (LIB2FUNCS_EXTRA, TARGET_LIBGCC2_CFLAGS)
+ (LIBGCC, INSTALL_LIBGCC): Remove.
+ * config/i386/gthr-win32.c: Move to ../libgcc/config/i386.
+ * config/i386/t-cygming (LIBGCC2_INCLUDES): Remove.
+ * config/i386/t-cygwin: Remove.
+ * config/i386/t-darwin (LIB2_SIDITI_CONV_FUNCS, LIB2FUNCS_EXTRA)
+ (LIB2FUNCS_EXCLUDE): Remove.
+ * config/i386/t-darwin64 (LIB2_SIDITI_CONV_FUNCS, LIB2FUNCS_EXTRA)
+ (LIBGCC, INSTALL_LIBGCC): Remove.
+ * config/i386/t-gthr-win32: Move to ../libgcc/config/i386.
+ * config/i386/t-linux64 (LIBGCC, INSTALL_LIBGCC): Remove.
+ * config/i386/t-mingw-w32: Likewise.
+ * config/i386/t-mingw-w64: Likewise.
+ * config/i386/t-openbsd: Likewise.
+ * config/i386/t-nto: Remove.
+ * config/ia64/quadlib.c: Move to ../libgcc/config/ia64.
+ * config/ia64/t-hpux (LIBGCC, INSTALL_LIBGCC, LIB2FUNCS_EXTRA)
+ (quadlib.c): Remove.
+ * config/ia64/t-ia64: Remove comment.
+ * config/iq2000/lib2extra-funcs.c: Move to
+ ../libgcc/config/iq2000/lib2funcs.c.
+ * config/iq2000/t-iq2000: Remove.
+ * config/m32c/m32c-lib2.c: Move to ../libgcc/config/m32c/lib2funcs.c.
+ * config/m32c/m32c-lib2-trapv.c: Move to ../libgcc/config/m32c/trapv.c.
+ * config/m32r/t-linux (TARGET_LIBGCC2_CFLAGS): Remove.
+ * config/m32c/t-m32c (LIB2FUNCS_EXTRA): Remove.
+ * config/m32r/t-m32r (TARGET_LIBGCC2_CFLAGS, LIBGCC)
+ (INSTALL_LIBGCC): Remove.
+ * config/m68k/fpgnulib.c: Move to ../libgcc/config/m68k.
+ * config/m68k/t-floatlib: Remove.
+ * config/m68k/t-mlibs (LIBGCC, INSTALL_LIBGCC): Remove.
+ * config/mcore/t-mcore (TARGET_LIBGCC2_CFLAGS): Remove.
+ Fix typo.
+ (LIBGCC, INSTALL_LIBGCC): Remove.
+ * config/mep/mep-lib2.c: Move to ../libgcc/config/mep/lib2funcs.c.
+ * config/mep/mep-tramp.c: Move to ../libgcc/config/mep/tramp.c.
+ * config/mep/t-mep (LIB2FUNCS_EXTRA): Remove.
+ * config/mips/t-elf (TARGET_LIBGCC2_CFLAGS, LIBGCC)
+ (INSTALL_LIBGCC): Remove.
+ * config/mips/t-isa3264: Likewise.
+ * config/mips/t-mips (LIB2_SIDITI_CONV_FUNCS): Remove.
+ * config/mips/t-r3900 (TARGET_LIBGCC2_CFLAGS, LIBGCC)
+ (INSTALL_LIBGCC): Remove.
+ * config/mips/t-sde (LIBGCC, INSTALL_LIBGCC): Remove.
+ * config/mips/t-sr71k (TARGET_LIBGCC2_CFLAGS, LIBGCC)
+ (INSTALL_LIBGCC): Remove.
+ * config/mips/t-vr (TARGET_LIBGCC2_CFLAGS)
+ (LIB2FUNCS_STATIC_EXTRA): Remove.
+ * config/mips/vr4120-div.S: Move to ../libgcc/config/mips.
+ * config/mmix/t-mmix (TARGET_LIBGCC2_CFLAGS): Remove.
+ * config/mn10300/t-mn10300 (LIBGCC, INSTALL_LIBGCC): Remove.
+ * config/pa/fptr.c, config/pa/linux-atomic.c: Move to
+ ../libgcc/config/pa.
+ * config/pa/lib2funcs.asm: Move to ../libgcc/config/pa/lib2funcs.S.
+ * config/pa/quadlib.c: Move to ../libgcc/config/pa.
+ * config/pa/t-dce-thr (LIBGCC, INSTALL_LIBGCC): Remove.
+ * config/pa/t-linux, config/pa/t-linux64: Remove.
+ * config/pa/t-pa-hpux, config/pa/t-pa-hpux10,
+ config/pa/t-pa-hpux11, config/pa/t-pa64: Remove.
+ * config/pdp11/t-pdp11 (TARGET_LIBGCC2_CFLAGS, LIB2FUNCS_EXTRA):
+ Remove.
+ * config/picochip/libgccExtras: Move to ../libgcc/config/picochip.
+ * config/picochip/t-picochip (LIB2FUNCS_EXTRA, RANLIB_FOR_TARGET)
+ (TARGET_LIBGCC2_CFLAGS, LIBGCC2_DEBUG_CFLAGS): Remove.
+ * config/rs6000/crtresfpr.asm: Move to
+ ../libgcc/config/rs6000/crtresfpr.S.
+ * config/rs6000/crtresgpr.asm: Move to
+ ../libgcc/config/rs6000/crtresgpr.S.
+ * config/rs6000/crtresxfpr.asm: Move to
+ ../libgcc/config/rs6000/crtresxfpr.S.
+ * config/rs6000/crtresxgpr.asm: Move to
+ ../libgcc/config/rs6000/crtresxgpr.S.
+ * config/rs6000/crtsavfpr.asm: Move to
+ ../libgcc/config/rs6000/crtsavfpr.S.
+ * config/rs6000/crtsavgpr.asm: Move to
+ ../libgcc/config/rs6000/crtsavgpr.S.
+ * config/rs6000/darwin-asm.h: Move to ../libgcc/config/rs6000.
+ * config/rs6000/darwin-fpsave.asm: Move to
+ ../libgcc/config/rs6000/darwin-fpsave.S.
+ * config/rs6000/darwin-gpsave.asm: Move to
+ ../libgcc/config/rs6000/darwin-gpsave.S.
+ * config/rs6000/darwin-tramp.asm: Move to
+ ../libgcc/config/rs6000/darwin-tramp.S.
+ * config/rs6000/darwin-vecsave.asm: Move to
+ ../libgcc/config/rs6000/darwin-vecsave.S.
+ * config/rs6000/darwin-world.asm: Move to
+ ../libgcc/config/rs6000/darwin-world.S.
+ * config/rs6000/e500crtres32gpr.asm: Move to
+ ../libgcc/config/rs6000/e500crtres32gpr.S.
+ * config/rs6000/e500crtres64gpr.asm: Move to
+ ../libgcc/config/rs6000/e500crtres64gpr.S.
+ * config/rs6000/e500crtres64gprctr.asm: Move to
+ ../libgcc/config/rs6000/e500crtres64gprctr.S.
+ * config/rs6000/e500crtrest32gpr.asm: Move to
+ ../libgcc/config/rs6000/e500crtrest32gpr.S.
+ * config/rs6000/e500crtrest64gpr.asm: Move to
+ ../libgcc/config/rs6000/e500crtrest64gpr.S.
+ * config/rs6000/e500crtresx32gpr.asm: Move to
+ ../libgcc/config/rs6000/e500crtresx32gpr.S.
+ * config/rs6000/e500crtresx64gpr.asm: Move to
+ ../libgcc/config/rs6000/e500crtresx64gpr.S.
+ * config/rs6000/e500crtsav32gpr.asm: Move to
+ ../libgcc/config/rs6000/e500crtsav32gpr.S.
+ * config/rs6000/e500crtsav64gpr.asm: Move to
+ ../libgcc/config/rs6000/e500crtsav64gpr.S.
+ * config/rs6000/e500crtsav64gprctr.asm: Move to
+ ../libgcc/config/rs6000/e500crtsav64gprctr.S.
+ * config/rs6000/e500crtsavg32gpr.asm: Move to
+ ../libgcc/config/rs6000/e500crtsavg32gpr.S.
+ * config/rs6000/e500crtsavg64gpr.asm: Move to
+ ../libgcc/config/rs6000/e500crtsavg64gpr.S.
+ * config/rs6000/e500crtsavg64gprctr.asm: Move to
+ ../libgcc/config/rs6000/e500crtsavg64gprctr.S.
+ * config/rs6000/eabi.asm: Move to ../libgcc/config/rs6000/eabi.S.
+ * config/rs6000/t-aix43 (LIBGCC, INSTALL_LIBGCC, LIB2FUNCS_EXTRA)
+ (TARGET_LIBGCC2_CFLAGS): Remove.
+ * config/rs6000/t-aix52: Likewise.
+ * config/rs6000/t-darwin: Remove.
+ * config/rs6000/t-darwin64 (LIB2_SIDITI_CONV_FUNCS)
+ (LIB2FUNCS_EXTRA): Remove.
+ * config/rs6000/t-fprules (LIBGCC, INSTALL_LIBGCC): Remove.
+ * config/rs6000/t-linux64 (TARGET_LIBGCC2_CFLAGS): Remove.
+ * config/rs6000/t-lynx (LIB2FUNCS_EXTRA, tramp.S, LIBGCC)
+ (INSTALL_LIBGCC): Remove.
+ * config/rs6000/t-netbsd (LIB2FUNCS_EXTRA)
+ (LIB2FUNCS_STATIC_EXTRA, tramp.S, crtsavfpr.S, crtresfpr.S)
+ (crtsavgpr.S, crtresgpr.S, crtresxfpr.S, crtresxgpr.S, LIBGCC)
+ (INSTALL_LIBGCC, $(T)crtsavfpr$(objext), $(T)crtresfpr$(objext))
+ ($(T)crtsavgpr$(objext), $(T)crtresgpr$(objext))
+ ($(T)crtresxfpr$(objext), $(T)crtresxgpr$(objext)): Remove.
+ * config/rs6000/t-ppccomm (LIB2FUNCS_EXTRA)
+ (LIB2FUNCS_STATIC_EXTRA, eabi.S, tramp.S): Remove.
+ * config/rs6000/t-spe (LIBGCC, INSTALL_LIBGCC): Remove.
+ * config/rs6000/t-vxworks: Remove comment.
+ * config/rs6000/tramp.asm: Move to ../libgcc/config/rs6000/tramp.S.
+ * config/rx/t-rx (LIBGCC, INSTALL_LIBGCC): Remove.
+ * config/sh/linux-atomic.asm: Move to
+ ../libgcc/config/sh/linux-atomic.S.
+ * config/sh/t-linux (LIB2FUNCS_EXTRA): Remove.
+ * config/sh/t-netbsd: Remove.
+ * config/sh/t-sh (TARGET_LIBGCC2_CFLAGS, LIBGCC, INSTALL_LIBGCC):
+ Remove.
+ * config/sparc/t-elf (LIBGCC, INSTALL_LIBGCC): Remove.
+ * config/sparc/t-leon: Likewise.
+ * config/sparc/t-leon3: Likewise.
+ * config/sparc/t-linux64: Likewise.
+ * config/sparc/t-netbsd64: Fix typo.
+ Remove comment.
+ * config/spu/divmodti4.c, config/spu/divv2df3.c,
+ config/spu/float_disf.c, config/spu/float_unsdidf.c,
+ config/spu/float_unsdisf.c, config/spu/float_unssidf.c,
+ config/spu/mfc_multi_tag_release.c,
+ config/spu/mfc_multi_tag_reserve.c, config/spu/mfc_tag_release.c,
+ config/spu/mfc_tag_reserve.c, config/spu/mfc_tag_table.c,
+ config/spu/multi3.c: Move to ../libgcc/config/spu.
+ * config/spu/t-spu-elf (TARGET_LIBGCC2_CFLAGS, LIB2FUNCS_EXCLUDE)
+ (LIB2FUNCS_STATIC_EXTRA, LIB2_SIDITI_CONV_FUNCS, LIBGCC)
+ (INSTALL_LIBGCC): Remove.
+ * config/stormy16/stormy16-lib2.c: Move to
+ ../libgcc/config/stormy16/lib2.c.
+ * config/stormy16/stormy16-lib2-ashlsi3.c: Move to
+ ../libgcc/config/stormy16/ashlsi3.c.
+ * config/stormy16/stormy16-lib2-ashrsi3.c: Move to
+ ../libgcc/config/stormy16/ashrsi3.c.
+ * config/stormy16/stormy16-lib2-clzhi2.c: Move to
+ ../libgcc/config/stormy16/clzhi2.c.
+ * config/stormy16/stormy16-lib2-cmpsi2.c: Move to
+ ../libgcc/config/stormy16/cmpsi2.c.
+ * config/stormy16/stormy16-lib2-ctzhi2.c: Move to
+ ../libgcc/config/stormy16/ctzhi2.c.
+ * config/stormy16/stormy16-lib2-divsi3.c: Move to
+ ../libgcc/config/stormy16/divsi3.c.
+ * config/stormy16/stormy16-lib2-ffshi2.c: Move to
+ ../libgcc/config/stormy16/ffshi2.c.
+ * config/stormy16/stormy16-lib2-lshrsi3.c: Move to
+ ../libgcc/config/stormy16/lshrsi3.c.
+ * config/stormy16/stormy16-lib2-modsi3.c: Move to
+ ../libgcc/config/stormy16/modsi3.c.
+ * config/stormy16/stormy16-lib2-parityhi2.c: Move to
+ ../libgcc/config/stormy16/parityhi2.c.
+ * config/stormy16/stormy16-lib2-popcounthi2.c: Move to
+ ../libgcc/config/stormy16/popcounthi2.c.
+ * config/stormy16/stormy16-lib2-ucmpsi2.c: Move to
+ ../libgcc/config/stormy16/ucmpsi2.c.
+ * config/stormy16/stormy16-lib2-udivmodsi4.c: Move to
+ ../libgcc/config/stormy16/udivmodsi4.c.
+ * config/stormy16/stormy16-lib2-udivsi3.c: Move to
+ ../libgcc/config/stormy16/udivsi3.c.
+ * config/stormy16/stormy16-lib2-umodsi3.c: Move to
+ ../libgcc/config/stormy16/umodsi3.c.
+ * config/stormy16/t-stormy16: Move to ../libgcc/config/t-stormy16.
+ * config/v850/t-v850 (INSTALL_LIBGCC): Remove.
+ * config/xtensa/lib2funcs.S: Move to ../libgcc/config/xtensa.
+ * config/xtensa/t-elf: Remove.
+ * config/xtensa/t-xtensa (LIB2FUNCS_EXTRA): Remove.
+ * config.gcc (*-*-freebsd*): Remove t-freebsd, t-freebsd-thread
+ from tmake_file.
+ (*-*-linux*, frv-*-*linux*, *-*-kfreebsd*-gnu, *-*-knetbsd*-gnu,
+ *-*-gnu*, *-*-kopensolaris*-gnu): Remove t-linux from tmake_file.
+ (*-*-netbsd*): Remove t-libgcc-pic from tmake_file.
+ (*-*-openbsd*): Likewise.
+ Remove t-openbsd-thread for posix threads.
+ (alpha*-*-linux*): Remove alpha/t-alpha, alpha/t-ieee from tmake_file.
+ (alpha*-*-freebsd*): Likewise.
+ (alpha*-*-netbsd*): Likewise.
+ (alpha*-*-openbsd*): Likewise.
+ (alpha64-dec-*vms*): Likewise.
+ (alpha*-dec-*vms*): Likewise.
+ (arm*-*-netbsdelf*): Remove arm/t-netbsd from tmake_file.
+ (arm*-*-linux*): Remove t-linux from tmake_file.
+ Remove arm/t-bpabi from tmake_file for arm*-*-linux-*eabi.
+ (arm*-*-uclinux*): Remove arm/t-bpabi from tmake_file for
+ arm*-*-uclinux*eabi.
+ (arm*-*-eabi*, arm*-*-symbianelf* ): Remove arm/t-bpabi from
+ tmake_file for arm*-*-eabi*.
+ (fr30-*-elf): Remove tmake_file.
+ (hppa*64*-*-linux*): Remove tmake_file.
+ (hppa*-*-linux*): Likewise.
+ (hppa[12]*-*-hpux10*): Remove pa/t-pa-hpux10, pa/t-pa-hpux from
+ tmake_file.
+ (hppa*64*-*-hpux11*): Remove pa/t-pa64, pa/t-pa-hpux from tmake_file.
+ (hppa[12]*-*-hpux11*): Remove pa/t-pa-hpux11, pa/t-pa-hpux from
+ tmake_file.
+ (i[34567]86-*-elf*): Remove tmake_file.
+ (x86_64-*-elf*): Likewise.
+ (i[34567]86-*-nto-qnx*): Likewise.
+ (i[34567]86-*-cygwin*): Remove i386/t-cygwin from tmake_file.
+ (i[34567]86-*-mingw*, x86_64-*-mingw*): Remove i386/t-gthr-win32
+ from tmake_file if using win32 threads.
+ (iq2000*-*-elf*): Remove tmake-file.
+ (microblaze*-linux*): Likewise.
+ (sh-*-elf*, sh[12346l]*-*-elf*, sh-*-linux*)
+ (sh[2346lbe]*-*-linux*, sh-*-netbsdelf*, shl*-*-netbsdelf*)
+ (sh5-*-netbsd*, sh5l*-*-netbsd*, sh64-*-netbsd*)
+ (sh64l*-*-netbsd*): Remove sh/t-netbsd from tmake_file for
+ sh5*-*-netbsd*, sh64*-netbsd*, *-*-netbsd.
+ (xtensa*-*-elf*): Remove tmake_file.
+
+2011-11-02 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
+
+ * Makefile.in (LIB1ASMSRC): Don't export.
+ (libgcc.mvars): Don't emit LIB1ASMFUNCS, LIB1ASMSRC.
+ * config/arm/arm.c: Update lib1funcs.asm filename.
+ * config/arm/linux-eabi.h: Likewise.
+ * config/arm/bpabi-v6m.S, config/arm/bpabi.S,
+ config/arm/ieee754-df.S, config/arm/ieee754-sf.S: Move to
+ ../libgcc/config/arm.
+ * config/arm/lib1funcs.asm: Move to ../libgcc/config/arm/lib1funcs.S.
+ * config/arm/t-arm (LIB1ASMSRC, LIB1ASMFUNCS): Remove.
+ * config/arm/t-arm-elf (LIB1ASMFUNCS): Remove.
+ * config/arm/t-bpabi: Likewise.
+ * config/arm/t-linux (LIB1ASMSRC, LIB1ASMFUNCS): Remove.
+ * config/arm/t-linux-eabi (LIB1ASMFUNCS): Remove.
+ * config/arm/t-strongarm-elf: Likewise.
+ * config/arm/t-symbian: Likewise.
+ * config/arm/t-vxworks: Likewise.
+ * config/arm/t-wince-pe: Likewise.
+ * config/avr/libgcc.S: Move to ../libgcc/config/avr.
+ * config/avr/t-avr (LIB1ASMSRC, LIB1ASMFUNCS): Remove.
+ * config/bfin/lib1funcs.asm: Move to ../libgcc/config/bfin/lib1funcs.S.
+ * config/bfin/t-bfin: Remove.
+ * config/bfin/t-bfin-elf (LIB1ASMSRC, LIB1ASMFUNCS): Remove.
+ * config/bfin/t-bfin-linux: Likewise.
+ * config/bfin/t-bfin-uclinux: Likewise.
+ * config/c6x/lib1funcs.asm: Move to ../libgcc/config/c6x/lib1funcs.S.
+ * config/c6x/t-c6x-elf (LIB1ASMSRC, LIB1ASMFUNCS): Remove.
+ * config/fr30/lib1funcs.asm: Move to ../libgcc/config/fr30/lib1funcs.S.
+ * config/fr30/t-fr30 (LIB1ASMSRC, LIB1ASMFUNCS): Remove.
+ * config/frv/lib1funcs.asm: Move to ../libgcc/config/frv/lib1funcs.S.
+ * config/frv/t-frv (CROSS_LIBGCC1, LIB1ASMSRC, LIB1ASMFUNCS): Remove.
+ * config/h8300/fixunssfsi.c: Update lib1funcs.asm filename.
+ * config/h8300/lib1funcs.asm: Move to
+ ../libgcc/config/h8300/lib1funcs.S.
+ * config/h8300/t-h8300 (LIB1ASMSRC, LIB1ASMFUNCS): Remove.
+ * config/i386/cygwin.asm: Move to ../libgcc/config/i386/cygwin.S.
+ * config/i386/t-cygming (LIB1ASMSRC, LIB1ASMFUNCS): Remove.
+ * config/i386/t-interix: Likewise.
+ * config/ia64/lib1funcs.asm: Move to ../libgcc/config/ia64/lib1funcs.S.
+ * config/ia64/t-hpux (LIB1ASMFUNCS, LIBGCC1_TEST): Remove.
+ * config/ia64/t-ia64 (LIB1ASMSRC, LIB1ASMFUNCS): Remove.
+ * config/iq2000/t-iq2000 (LIBGCC1, CROSS_LIBGCC1): Remove.
+ * config/m32c/m32c.c: Update m32c-lib1.S filename.
+ * config/m32c/m32c-lib1.S: Move to ../libgcc/config/m32c/lib1funcs.S.
+ * config/m32c/t-m32c (LIB1ASMSRC, LIB1ASMFUNCS): Remove.
+ * config/m32r/t-linux (CROSS_LIBGCC1, LIBGCC1, LIBGCC1_TEST): Remove.
+ * config/m68k/lb1sf68.asm: Move to ../libgcc/config/m68k/lb1sf68.S.
+ * config/m68k/t-floatlib (LIB1ASMSRC, LIB1ASMFUNCS): New file.
+ * config/mcore/lib1.asm: Move to ../libgcc/config/mcore/lib1funcs.S.
+ * config/mcore/t-mcore (LIB1ASMSRC, LIB1ASMFUNCS): Remove.
+ * config/mep/mep-lib1.asm: Move to ../libgcc/config/mep/lib1funcs.S.
+ * config/mep/t-mep (LIB1ASMSRC, LIB1ASMFUNCS): Remove.
+ * config/mips/mips16.S: Move to ../libgcc/config/mips.
+ * config/mips/t-libgcc-mips16: Remove.
+ * config/mips/t-sr71k (LIBGCC1, CROSS_LIBGCC1): Remove.
+ * config/pa/milli64.S: Move to ../libgcc/config/pa.
+ * config/pa/t-linux (LIB1ASMFUNCS, LIB1ASMSRC): Remove.
+ * config/pa/t-linux64: Likewise.
+ * config/picochip/libgccExtras/fake_libgcc.asm: Move to
+ ../libgcc/config/picochip/lib1funcs.S.
+ * config/picochip/t-picochip (LIB1ASMFUNCS, LIB1ASMSRC): Remove.
+ * config/sh/lib1funcs.asm: Move to ../libgcc/config/sh/lib1funcs.S.
+ * config/sh/lib1funcs.h: Move to ../libgcc/config/sh.
+ * config/sh/sh.h: Update lib1funcs.asm filename.
+ * config/sh/t-linux (LIB1ASMFUNCS_CACHE): Remove.
+ * config/sh/t-netbsd: Likewise.
+ * config/sh/t-sh (LIB1ASMSRC, LIB1ASMFUNCS, LIB1ASMFUNCS_CACHE):
+ Remove.
+ * config/sh/t-sh64 (LIB1ASMFUNCS): Remove.
+ * config/sparc/lb1spc.asm: Move to ../libgcc/config/sparc/lb1spc.S.
+ * config/sparc/lb1spl.asm: Remove.
+ * config/sparc/t-elf (LIB1ASMSRC, LIB1ASMFUNCS): Remove.
+ * config/sparc/t-leon: Likewise.
+ * config/spu/t-spu-elf (LIBGCC1, CROSS_LIBGCC1): Remove.
+ * config/v850/lib1funcs.asm: Move to ../libgcc/config/v850/lib1funcs.S.
+ * config/v850/t-v850 (LIB1ASMSRC, LIB1ASMFUNCS): Remove
+ * config/vax/lib1funcs.asm: Move to ../libgcc/config/vax/lib1funcs.S.
+ * config/vax/t-linux: Remove.
+ * config/xtensa/ieee754-df.S, config/xtensa/ieee754-sf.S: Move to
+ ../libgcc/config/xtensa.
+ * config/xtensa/lib1funcs.asm: Move to
+ ../libgcc/config/xtensa/lib1funcs.S.
+ * config/xtensa/t-xtensa (LIB1ASMSRC, LIB1ASMFUNCS): Remove.
+ * config.gcc (bfin*-rtems*): Remove bfin/t-bfin from tmake_file.
+ (bfin*-*): Likewise.
+ (mips64*-*-linux*, mipsisa64*-*-linux*): Remove
+ mips/t-libgcc-mips16 from tmake_file.
+ (mips*-*-linux*): Likewise.
+ (mips*-sde-elf*): Likewise.
+ (mipsisa32-*-elf*, mipsisa32el-*-elf*, mipsisa32r2-*-elf*)
+ (mipsisa32r2el-*-elf*, mipsisa64-*-elf*, mipsisa64el-*-elf*)
+ (mipsisa64r2-*-elf*, mipsisa64r2el-*-elf*): Likewise.
+ (mipsisa64sb1-*-elf*, mipsisa64sb1el-*-elf*): Likewise.
+ (mips-*-elf*, mipsel-*-elf*): Likewise.
+ (mips64-*-elf*, mips64el-*-elf*): Likewise.
+ (mips64orion-*-elf*, mips64orionel-*-elf*): Likewise.
+ (mips*-*-rtems*): Likewise.
+ (mipstx39-*-elf*, mipstx39el-*-elf*): Likewise.
+ (vax-*-linux*): Remove vax/t-linux from tmake_file.
+
+2011-11-02 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
+
+ * config.gcc (extra_parts): Remove.
+ (*-*-freebsd*): Remove extra_parts.
+ (*-*-linux*, frv-*-*linux*, *-*-kfreebsd*-gnu, *-*-knetbsd*-gnu,
+ *-*-gnu*, *-*-kopensolaris*-gnu): Likewise.
+ (*-*-netbsd*): Remove t-libc-ok, t-netbsd from tmake_file.
+ Remove extra_parts for *-*-netbsd*1.[7-9]*, *-*-netbsd[2-9]*,
+ *-*-netbsdelf[2-9]*.
+ (*-*-openbsd*): Remove t-libc-ok from tmake_file.
+ (alpha*-*-linux*): Remove extra_parts.
+ (alpha*-*-freebsd*): Likewise.
+ (bfin*-linux-uclibc*): Likewise.
+ (fr30-*-elf): Likewise.
+ (moxie-*-elf): Likewise.
+ (moxie-*-uclinux*): Likewise.
+ (h8300-*-rtems*): Remove h8300/t-elf from tmake_file.
+ (h8300-*-elf*): Likewise.
+ (hppa*64*-*-hpux11*): Remove extra_parts.
+ (i[34567]86-*-elf*): Remove i386/t-i386elf, i386/t-crtstuff from
+ tmake_file.
+ (x86_64-*-elf*): Likewise.
+ (i[34567]86-*-freebsd*): Remove tmake_file.
+ (x86_64-*-freebsd*): Likewise.
+ (x86_64-*-netbsd*): Likewise.
+ (i[34567]86-*-openbsd2.*, i[34567]86-*openbsd3.[0123]): Remove
+ t-libc-ok from tmake_file.
+ (i[34567]86-*-linux*, i[34567]86-*-kfreebsd*-gnu,
+ i[34567]86-*-knetbsd*-gnu, i[34567]86-*-gnu*,
+ i[34567]86-*-kopensolaris*-gnu): Remove i386/t-crtstuff from
+ tmake_file.
+ Remove extra_parts.
+ (x86_64-*-linux*, x86_64-*-kfreebsd*-gnu, x86_64-*-knetbsd*-gnu):
+ Remove i386/t-crtstuff from tmake_file.
+ (i[34567]86-*-lynxos*): Likewise.
+ Remove extra_parts.
+ (ia64*-*-elf*): Remove extra_parts.
+ (ia64*-*-freebsd*): Likewise.
+ (ia64*-*-linux*): Likewise.
+ (ia64-hp-*vms*): Remove ia64/t-vms from tmake_file.
+ (m32r-*-elf*): Remove extra_parts.
+ (m32rle-*-elf*): Likewise.
+ (m32r-*-rtems*): Likewise.
+ (m68k-*-elf*, fido-*-elf*): Likewise.
+ (m68k*-*-openbsd*): Remove t-libc-ok from tmake_file.
+ (m68k-*-rtems*): Remove extra_parts.
+ (mep-*-*): Likewise.
+ (microblaze*-linux*): Likewise.
+ (mips64*-*-linux*, mipsisa64*-*-linux*): Likewise.
+ (mips*-*-linux*): Likewise.
+ (powerpc-*-lynxos*): Likewise.
+ (s390x-ibm-tpf*): Likewise.
+ (score-*-elf): Likewise.
+ Remove tmake_file.
+ (sh-*-elf*, sh[12346l]*-*-elf*, sh-*-linux*, sh[2346lbe]*-*-linux*,
+ sh-*-netbsdelf*, shl*-*-netbsdelf*, sh5-*-netbsd*, sh5l*-*-netbsd*,
+ sh64-*-netbsd*, sh64l*-*-netbsd*): Remove sh/t-elf from tmake_file.
+ Remove sh/t-superh from tmake_file for sh*-superh-elf.
+ Remove sh/t-linux64 from tmake_file for sh64*-*-linux*.
+ (sh-*-rtems*): Remove sh/t-elf from tmake_file.
+ (sh-wrs-vxworks): Likewise.
+ (sparc-*-linux*): Remove extra_parts.
+ (sparc64-*-linux*): Likewise.
+ (sparc64-*-freebsd*, ultrasparc-*-freebsd*): Likewise.
+ (xstormy16-*-elf): Likewise.
+ (xtensa*-*-linux*): Remove xtensa/t-linux from tmake_file.
+ (am33_2.0-*-linux*): Remove extra_parts.
+ * configure.ac (extra_parts): Don't substitute.
+ * configure: Regenerate.
+ * crtstuff.c: Move to ../libgcc.
+ * Makefile.in (CRTSTUFF_CFLAGS): Remove.
+ (EXTRA_PARTS): Remove.
+ (CRTSTUFF_T_CFLAGS): Remove.
+ (MOSTLYCLEANFILES): Remove $(EXTRA_PARTS).
+ (GCC_EXTRA_PARTS): Remove.
+ (libgcc.mvars): Remove GCC_EXTRA_PARTS, CRTSTUFF_CFLAGS,
+ CRTSTUFF_T_CFLAGS, CRTSTUFF_T_CFLAGS_S.
+ Emit GCC_CFLAGS, INHIBIT_LIBC_CFLAGS.
+ ($(T)crtbegin.o, $(T)crtend.o, $(T)crtbeginS.o, $(T)crtendS.o)
+ ($(T)crtbeginT.o): Remove.
+ * config/alpha/t-vms (EXTRA_PARTS): Remove.
+ ($(T)vms-dwarf2.o, $(T)vms-dwarf2eh.o): Remove.
+ * config/alpha/vms-dwarf2.asm: Move to
+ ../libgcc/config/alpha/vms-dwarf2.S.
+ * config/alpha/vms-dwarf2eh.asm: Move to
+ ../libgcc/config/alpha/vms-dwarf2eh.S.
+ * config/arm/crti.asm: Move to ../libgcc/config/arm/crti.S.
+ * config/arm/crtn.asm: Move to ../libgcc/config/arm/crtn.S.
+ * config/arm/t-arm-elf (EXTRA_MULTILIB_PARTS): Remove.
+ ($(T)crti.o, $(T)crtn.o): Remove.
+ * config/arm/t-linux: Remove comment.
+ * config/arm/t-linux-eabi (EXTRA_MULTILIB_PARTS): Remove.
+ * config/arm/t-strongarm-elf (EXTRA_MULTILIB_PARTS): Remove.
+ ($(T)crti.o, $(T)crtn.o): Remove.
+ * config/arm/t-symbian (EXTRA_MULTILIB_PARTS): Remove.
+ * config/bfin/crti.s: Move to ../libgcc/config/bfin/crti.S.
+ * config/bfin/crtn.s: Move to ../libgcc/config/bfin/crtn.S.
+ * config/bfin/crtlibid.s: Move to ../libgcc/config/bfin/crtlibid.S.
+ * config/bfin/t-bfin (EXTRA_PARTS): Remove.
+ ($(T)crti.o, $(T)crtn.o): Remove.
+ * config/bfin/t-bfin-elf (CRTSTUFF_T_CFLAGS): Remove.
+ ($(T)crti.o, $(T)crtn.o, $(T)crtlibid.o): Remove
+ (EXTRA_MULTILIB_PARTS): Remove.
+ * config/bfin/t-bfin-linux (CRTSTUFF_T_CFLAGS,
+ EXTRA_MULTILIB_PARTS): Remove.
+ * config/bfin/t-bfin-uclinux (CRTSTUFF_T_CFLAGS): Remove.
+ ($(T)crtlibid.o): Remove.
+ (EXTRA_MULTILIB_PARTS): Remove.
+ * config/c6x/crti.s: Move to ../libgcc/config/c6x/crti.S.
+ * config/c6x/crtn.s: Move to ../libgcc/config/c6x/crtn.S.
+ * config/c6x/t-c6x-elf ($(T)crti.o, $(T)crtn.o): Remove.
+ (EXTRA_MULTILIB_PARTS): Remove.
+ (CRTSTUFF_T_CFLAGS, CRTSTUFF_T_CFLAGS_S): Remove.
+ * config/c6x/t-c6x-uclinux (CRTSTUFF_T_CFLAGS,
+ CRTSTUFF_T_CFLAGS_S): Remove.
+ * config/cris/t-elfmulti (CRTSTUFF_T_CFLAGS): Remove.
+ * config/cris/t-linux (CRTSTUFF_T_CFLAGS_S): Remove.
+ * config/fr30/crti.asm: Move to ../libgcc/config/fr30/crti.S.
+ * config/fr30/crtn.asm: Move to ../libgcc/config/fr30/crtn.S.
+ * config/fr30/t-fr30 ($(T)crti.o, $(T)crtn.o): Remove.
+ * config/frv/frvbegin.c, config/frv/frvend.c: Move to
+ ../libgcc/config/frv.
+ * config/frv/t-frv (EXTRA_MULTILIB_PARTS): Remove.
+ (FRVSTUFF_CFLAGS, $(T)frvbegin$(objext), $(T)frvend$(objext)): Remove.
+ * config/frv/t-linux (EXTRA_MULTILIB_PARTS): Remove.
+ (CRTSTUFF_T_CFLAGS): Remove.
+ * config/h8300/crti.asm: Move to ../libgcc/config/h8300/crti.S.
+ * config/h8300/crtn.asm: Move to ../libgcc/config/h8300/crtn.S.
+ * config/h8300/t-elf: Remove.
+ * config/i386/cygming-crtbegin.c, config/i386/cygming-crtend.c:
+ Move to ../libgcc/config/i386.
+ * config/i386/t-crtstuff: Remove.
+ * config/i386/t-i386elf: Remove.
+ * config/i386/t-linux64 (EXTRA_MULTILIB_PARTS): Remove.
+ * config/i386/t-nto (CRTSTUFF_T_CFLAGS, EXTRA_PARTS): Remove.
+ * config/ia64/crtbegin.asm: Move to ../libgcc/config/ia64/crtbegin.S.
+ * config/ia64/crtend.asm: Move to ../libgcc/config/ia64/crtend.S.
+ * config/ia64/crti.asm: Move to ../libgcc/config/ia64/crti.S.
+ * config/ia64/crtn.asm: Move to ../libgcc/config/ia64/crtn.S.
+ * config/ia64/t-vms: Remove.
+ * config/ia64/vms-crtinit.asm: Move to
+ ../libgcc/config/ia64/vms-crtinit.S.
+ * config/m32c/t-m32c (EXTRA_MULTILIB_PARTS): Remove.
+ * config/m32r/initfini.c: Move to ../libgcc/config/m32r.
+ * config/m32r/t-linux (CRTSTUFF_T_CFLAGS_S): Remove.
+ * config/m32r/t-m32r (CRTSTUFF_T_CFLAGS): Remove.
+ ($(T)crtinit.o, $(T)crtfini.o): Remove.
+ (m32rx, m32r2): Remove.
+ (EXTRA_MULTILIB_PARTS): Remove.
+ * config/m68k/crti.s: Move to ../libgcc/config/m68k/crti.S.
+ * config/m68k/crtn.s: Move to ../libgcc/config/m68k/crtn.S.
+ * config/m68k/t-crtstuff: Remove.
+ * config/m68k/t-linux (EXTRA_MULTILIB_PARTS): Remove.
+ * config/m68k/t-m68kelf: Remove.
+ * config/m68k/t-uclinux (EXTRA_MULTILIB_PARTS): Remove.
+ * config/mcore/crti.asm: Move to ../libgcc/config/mcore/crti.S.
+ * config/mcore/crtn.asm: Move to ../libgcc/config/mcore/crtn.S.
+ * config/mcore/t-mcore ($(T)crti.o, $(T)crtn.o): Remove.
+ (EXTRA_PARTS, EXTRA_MULTILIB_PARTS): Remove.
+ * config/mep/t-mep (CRTSTUFF_CFLAGS): Remove.
+ (EXTRA_MULTILIB_PARTS): Remove.
+ * config/microblaze/crti.s: Move to ../libgcc/config/microblaze/crti.S.
+ * config/microblaze/crtn.s: Move to ../libgcc/config/microblaze/crtn.S.
+ * config/microblaze/t-microblaze (EXTRA_MULTILIB_PARTS,
+ EXTRA_PARTS): Remove.
+ ($(T)crti$(objext), $(T)crtn$(objext)): Remove.
+ * config/mips/crti.asm: Move to ../libgcc/config/mips/crti.S.
+ * config/mips/crtn.asm: Move to ../libgcc/config/mips/crtn.S.
+ * config/mips/t-elf (CRTSTUFF_T_CFLAGS): Remove.
+ ($(T)crti.o, $(T)crtn.o): Remove.
+ (EXTRA_MULTILIB_PARTS): Remove.
+ * config/mips/t-isa3264: Likewise.
+ * config/mips/t-linux64 (EXTRA_MULTILIB_PARTS): Remove.
+ * config/mips/t-r3900 (EXTRA_MULTILIB_PARTS): Remove.
+ (CRTSTUFF_T_CFLAGS): Remove.
+ * config/mips/t-sde (CRTSTUFF_T_CFLAGS): Remove.
+ ($(T)crti.o, $(T)crtn.o): Remove.
+ (EXTRA_MULTILIB_PARTS): Remove.
+ * config/mips/t-sr71k (EXTRA_MULTILIB_PARTS, CRTSTUFF_T_CFLAGS):
+ Remove.
+ ($(T)crti.o, $(T)crtn.o): Remove.
+ * config/mips/t-st (EXTRA_MULTILIB_PARTS): Remove.
+ * config/mips/t-vr (CRTSTUFF_T_CFLAGS): Remove.
+ (EXTRA_MULTILIB_PARTS): Remove.
+ ($(T)crti.o, $(T)crtn.o): Remove.
+ * config/mmix/crti.asm: Move to ../libgcc/config/crti.S.
+ * config/mmix/crtn.asm: Move to ../libgcc/config/crtn.S.
+ * config/mmix/t-mmix (CRTSTUFF_T_CFLAGS): Remove.
+ * config/moxie/crti.asm, config/moxie/crtn.asm: Remove.
+ * config/pa/stublib.c: Move to libgcc/config/pa.
+ * config/pa/t-linux (CRTSTUFF_T_CFLAGS_S): Remove.
+ * config/pa/t-linux64 (CRTSTUFF_T_CFLAGS_S): Remove.
+ * config/pa/t-pa-hpux11 (LIBGCCSTUB_OBJS, stublib.c): Remove.
+ (pthread_default_stacksize_np-stub.o, pthread_mutex_lock-stub.o)
+ (pthread_mutex_unlock-stub.o, pthread_once-stub.o)
+ ($(T)libgcc_stub.a): Remove.
+ * config/pa/t-pa64 (LIBGCCSTUB_OBJS, stublib.c): Remove.
+ (rfi-stub.o, dfi-stub.o, cxaf-stub.o, jvrc-stub.o)
+ (pthread_default_stacksize_np-stub.o, pthread_mutex_lock-stub.o)
+ (pthread_mutex_unlock-stub.o, pthread_once-stub.o)
+ ($(T)libgcc_stub.a): Remove.
+ * config/rs6000/eabi-cn.asm: Move to
+ ../../../libgcc/config/rs6000/eabi-cn.S.
+ * config/rs6000/eabi-ci.asm: Move to
+ ../../../libgcc/config/rs6000/eabi-ci.S.
+ * config/rs6000/sol-ci.asm: Move to
+ ../../../libgcc/config/rs6000/sol-ci.S.
+ * config/rs6000/sol-cn.asm: Move to
+ ../../../libgcc/config/rs6000/sol-cn.S.
+ * config/rs6000/t-lynx (EXTRA_MULTILIB_PARTS): Remove.
+ (CRTSTUFF_T_CFLAGS, CRTSTUFF_T_CFLAGS_S): Remove.
+ * config/rs6000/t-netbsd (CRTSTUFF_T_CFLAGS, CRTSTUFF_T_CFLAGS_S):
+ Remove.
+ (EXTRA_MULTILIB_PARTS): Remove.
+ * config/rs6000/t-ppccomm (EXTRA_MULTILIB_PARTS): Remove.
+ (ecrti.S, ecrtn.S, ncrti.S, ncrtn.S): Remove.
+ ($(T)ecrti$(objext), $(T)ecrtn$(objext), $(T)ncrti$(objext),
+ ($(T)ncrtn$(objext)): Remove.
+ (CRTSTUFF_T_CFLAGS, CRTSTUFF_T_CFLAGS_S): Remove.
+ * config/rs6000/t-vxworks (EXTRA_MULTILIB_PARTS): Remove.
+ * config/rx/t-rx (EXTRA_MULTILIB_PARTS): Remove.
+ * config/score/crti.asm: Move to ../libgcc/config/score/crti.S.
+ * config/score/crtn.asm: Move to ../libgcc/config/score/crtn.S.
+ * config/score/t-score-elf: Remove.
+ * config/sh/crt1.asm: Move to ../libgcc/config/sh/crt1.S.
+ * config/sh/crti.asm: Move to ../libgcc/config/sh/crti.S.
+ * config/sh/crtn.asm: Move to ../libgcc/config/sh/crtn.S.
+ * config/sh/lib1funcs-4-300.asm: Move to
+ ../../../libgcc/config/sh/lib1funcs-4-300.S.
+ * config/sh/lib1funcs-Os-4-200.asm: Move to
+ ../libgcc/config/sh/lib1funcs-Os-4-200.S.
+ * config/sh/t-elf: Remove.
+ * config/sh/t-linux (EXTRA_MULTILIB_PARTS): Remove.
+ * config/sh/t-linux64: Remove.
+ * config/sh/t-netbsd (EXTRA_MULTILIB_PARTS): Remove.
+ * config/sh/t-sh ($(T)crt1.o, $(T)crti.o, $(T)crtn.o): Remove.
+ (IC_EXTRA_PARTS, OPT_EXTRA_PARTS, EXTRA_MULTILIB_PARTS): Remove.
+ ($(T)ic_invalidate_array_4-100.o)
+ ($(T)libic_invalidate_array_4-100.a)
+ ($(T)ic_invalidate_array_4-200.o)
+ ($(T)libic_invalidate_array_4-200.a, $(T)ic_invalidate_array_4a.o)
+ ($(T)libic_invalidate_array_4a.a, $(T)sdivsi3_i4i-Os-4-200.o)
+ ($(T)udivsi3_i4i-Os-4-200.o, $(T)unwind-dw2-Os-4-200.o)
+ ($(T)libgcc-Os-4-200.a, $(T)div_table-4-300.o)
+ ($(T)libgcc-4-300.a): Remove.
+ * config/sh/t-superh: Remove.
+ * config/sh/t-vxworks (EXTRA_MULTILIB_PARTS): Remove.
+ * config/sparc/t-linux64 (CRTSTUFF_T_CFLAGS): Remove.
+ * config/spu/cache.S: Move to ../libgcc/config/spu.
+ * config/spu/cachemgr.c: Move to ../libgcc/config/spu.
+ * config/spu/t-spu-elf (CRTSTUFF_T_CFLAGS): Remove.
+ (EXTRA_MULTILIB_PARTS): Remove.
+ ($(T)cachemgr.o, $(T)cachemgr_nonatomic.o, $(T)libgcc_%.a): Remove.
+ ($(T)cache8k.o, $(T)cache16k.o, $(T)cache32k.o, $(T)cache32k.o)
+ ($(T)cache64k.o, $(T)cache128k.o): Remove.
+ * config/t-freebsd (CRTSTUFF_T_CFLAGS_S): Remove.
+ * config/t-libc-ok: Remove.
+ * config/t-linux (CRTSTUFF_T_CFLAGS_S): Remove.
+ * config/t-lynx (CRTSTUFF_T_CFLAGS_S): Remove.
+ * config/t-netbsd: Remove.
+ * config/t-svr4 (CRTSTUFF_T_CFLAGS_S): Remove.
+ * config/t-vxworks (EXTRA_MULTILIB_PARTS): Remove.
+ * config/vms/t-vms (VMS_EXTRA_PARTS): Remove.
+ ($(T)vcrt0.o, $(T)pcrt0.o): Remove.
+ * config/vms/vms-ucrt0.c: Move to ../libgcc/config/vms.
+ * config/xtensa/crti.asm: Move to ../libgcc/config/xtensa/crti.S.
+ * config/xtensa/crtn.asm: Move to ../libgcc/config/xtensa/crtn.S.
+ * config/xtensa/t-elf (CRTSTUFF_T_CFLAGS, CRTSTUFF_T_CFLAGS_S): Remove.
+ (EXTRA_MULTILIB_PARTS): Remove.
+ * config/xtensa/t-linux: Remove.
+ * config/xtensa/t-xtensa ($(T)crti.o, $(T)crtn.o): Remove.
+
+2011-11-02 Uros Bizjak <ubizjak@gmail.com>
+
+ * config/i386/i386.c (bdesc_args) [IX86_BUILTIN_CVTTPD2DQ256]: Use
+ CODE_FOR_fix_truncv4dfv4si2, not CODE_FOR_fix_truncv4sfv4si2.
+
+2011-11-02 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
+
+ PR translation/45116
+ * Makefile.in (slibdir): Remove, don't export.
+ (SHLIB_NM_FLAGS): Remove.
+ (libgcc.mvars): Don't emit SHLIB_LINK, SHLIB_INSTALL,
+ SHLIB_DLLDIR, SHLIB_EXT, SHLIB_MKMAP, SHLIB_MKMAP_OPTS,
+ SHLIB_MAPFILES, SHLIB_NM_FLAGS.
+ (DRIVER_DEFINES): Test SHLIB instead of SHLIB_LINK.
+ (gcc.o): Pass SHLIB instead of SHLIB_LINK.
+ (gccspec.o): Likewise.
+ (installdirs): Don't create $(DESTDIR)$(slibdir).
+ * configure.ac (slibdir): Remove.
+ * configure: Regenerate.
+ * libgcc-libsystem.ver: Move to ../libgcc/config.
+ * mkmap-flat.awk, mkmap-symver.awk: Move to ../libgcc.
+ * config/libgcc-glibc.ver: Move to ../libgcc/config.
+ * config/t-libunwind (SHLIB_LC): Remove.
+ * config/t-linux (SHLIB_MAPFILES): Remove.
+ * config/t-slibgcc-dummy: Rename to config/t-slibgcc.
+ * config/t-slibgcc-elf-ver: Remove.
+ * config/t-slibgcc-libgcc, config/t-slibgcc-nolc-override: Move to
+ ../libgcc/config.
+ * config/alpha/libgcc-alpha-ldbl.ver, config/alpha/t-linux: Move
+ to ../libgcc/config/alpha.
+ * config/alpha/t-vms (shlib_version, SHLIB_EXT, SHLIB_OBJS,
+ SHLIB_NAME, SHLIB_MULTILIB, SHLIB_INSTALL, SHLIB_SYMVEC,
+ SHLIB_SYMVECX2, SHLIB_LINK): Remove.
+ * config/arm/libgcc-bpabi.ver: Move to ../libgcc/config/arm.
+ * config/arm/t-bpabi (SHLIB_MAPFILES): Remove.
+ * config/arm/t-netbsd (SHLIB_EXT, SHLIB_NAME, SHLIB_SONAME,
+ SHLIB_OBJS, SHLIB_LINK, SHLIB_INSTALL): Remove.
+ * config/arm/t-symbian (SHLIB_LC): Remove.
+ * config/bfin/libgcc-bfin.ver: Move to
+ ../libgcc/config/bfin/libgcc-glibc.ver.
+ * config/bfin/t-bfin-linux (SHLIB_MAPFILES): Remove.
+ * config/c6x/libgcc-c6xeabi.ver: Move to
+ ../libgcc/config/c6x/libgcc-eabi.ver.
+ * config/c6x/t-c6x-elf (SHLIB_MAPFILES): Remove.
+ * config/cris/libgcc.ver: Move to
+ ../libgcc/config/cris/libgcc-glibc.ver.
+ * config/cris/t-linux (SHLIB_MAPFILES): Remove.
+ * config/frv/libgcc-frv.ver: Move to ../libgcc/config/frv.
+ * config/frv/t-linux (SHLIB_MAPFILES): Remove.
+ * config/i386/darwin-libgcc.10.4.ver: Move to
+ ../libgcc/config/i386/libgcc-darwin.10.4.ver.
+ * config/i386/darwin-libgcc.10.5.ver: Move to
+ ../libgcc/config/i386/libgcc-darwin.10.5.ver.
+ * config/i386/libgcc-glibc.ver: Move to ../libgcc/config/i386.
+ * config/i386/t-cygming (SHLIB_EXT, SHLIB_IMPLIB, SHLIB_SOVERSION,
+ SHLIB_SONAME, SHLIB_MAP, SHLIB_OBJS, SHLIB_DIR, SHLIB_SLIBDIR_QUAL)
+ SHLIB_PTHREAD_CFLAG, SHLIB_PTHREAD_LDFLAG, SHLIB_LINK,
+ SHLIB_INSTALL, SHLIB_MKMAP, SHLIB_MKMAP_OPTS, SHLIB_MAPFILES): Remove.
+ * config/i386/t-cygwin (SHLIB_LC, SHLIB_EH_EXTENSION,
+ SHLIB_IMPLIB, SHLIB_SONAME, SHLIB_MKMAP_OPTS): Remove.
+ * config/i386/t-dlldir, config/i386/t-dlldir-x: Move to
+ ../libgcc/config/i386.
+ * config/i386/t-dw2-eh, config/i386/t-sjlj-eh: Move to
+ ../libgcc/config/i386.
+ * config/i386/t-linux: Move to ../libgcc/config/i386.
+ * config/i386/t-mingw-pthread: Move to ../libgcc/config/i386.
+ * config/i386/t-mingw-w32 (SHLIB_LC): Remove.
+ * config/i386/t-mingw-w64: Likewise.
+ * config/i386/t-mingw32: Remove.
+ * config/ia64/libgcc-glibc.ver, config/ia64/libgcc-ia64.ver: Move
+ to ../libgcc/config/ia64.
+ * config/ia64/t-glibc: Remove.
+ * config/ia64/t-hpux (SHLIB_EXT, SHLIB_LINK, SHLIB_INSTALL): Remove.
+ * config/ia64/t-ia64 (SHLIB_MAPFILES): Remove.
+ * config/ia64/t-vms (shlib_version, SHLIB_EXT, SHLIB_OBJS,
+ SHLIB_NAME, SHLIB_MULTILIB, SHLIB_INSTALL, SHLIB_LINK): Remove.
+ * config/ia64/vms_symvec_libgcc_s.opt: Remove.
+ * config/m32r/libgcc-glibc.ver: Move to ../libgcc/config/m32r.
+ * config/m32r/t-linux (SHLIB_MAPFILES): Remove.
+ * config/m68k/t-slibgcc-elf-ver: Move to ../libgcc/config/m68k.
+ * config/mips/t-libgcc-mips16 (SHLIB_MAPFILES): Remove.
+ * config/pa/t-hpux-shlib: Move to ../libgcc/config/pa/t-slibgcc-hpux.
+ * config/pa/t-slibgcc-dwarf-ver, config/pa/t-slibgcc-sjsj-ver:
+ Move to ../libgcc/config/pa.
+ * config/rs6000/darwin-libgcc.10.4.ver: Move to
+ ../libgcc/config/rs6000/libgcc-darwin.10.4.ver.
+ * config/rs6000/darwin-libgcc.10.5.ver: Move to
+ ../libgcc/config/rs6000/libgcc-darwin.10.5.ver.
+ * config/rs6000/t-aix43 (SHLIB_EXT, SHLIB_LINK, SHLIB_INSTALL,
+ SHLIB_LIBS, SHLIB_MKMAP, SHLIB_NM_FLAGS, AR_FLAGS_FOR_TARGET): Remove.
+ * config/rs6000/t-aix52: Likewise.
+ * config/sh/libgcc-excl.ver, config/sh/libgcc-glibc.ver: Move to
+ ../libgcc/config/sh.
+ * config/sparc/libgcc-sparc-glibc.ver: Move to
+ ../libgcc/config/sparc/libgcc-glibc.ver.
+ * config/sparc/t-linux: Move to ../libgcc/config/sparc.
+ * config/xtensa/t-linux (SHLIB_MAPFILES): Remove.
+ * config/xtensa/libgcc-xtensa.ver: Move to
+ ../libgcc/config/xtensa/libgcc-glibc.ver.
+ * config.gcc (*-*-freebsd*): Replace t-slibgcc-elf-ver with
+ t-slibgcc in tmake_file.
+ Remove t-slibgcc-nolc-override for *-*-freebsd[34],
+ *-*-freebsd[34].* with pthreads.
+ (*-*-linux*, frv-*-*linux*, *-*-kfreebsd*-gnu,
+ *-*-knetbsd*-gnu, *-*-gnu*, *-*-kopensolaris*-gnu): Replace
+ t-slibgcc-elf-ver with t-slibgcc in tmake_file.
+ (*-*-netbsd*): Likewise.
+ (*-*-solaris2*): Replace t-slibgcc-dummy with t-slibgcc in tmake_file.
+ (*-*-*vms*): Add t-slibgcc to tmake_file.
+ (alpha*-*-linux*): Remove alpha/t-linux from tmake_file.
+ (alpha*-dec-osf5.1*): Replace t-slibgcc-dummy with t-slibgcc in
+ tmake_file.
+ (arm*-*-linux*): Remove t-slibgcc-libgcc from tmake_file for
+ arm*-*-linux-*eabi.
+ (bfin*-linux-uclibc*): Replace t-slibgcc-dummy with t-slibgcc in
+ tmake_file.
+ (crisv32-*-linux*, cris-*-linux*): Likewise.
+ (hppa*-*-linux*): Remove t-slibgcc-libgcc, pa/t-slibgcc-sjlj-ver,
+ pa/t-slibgcc-dwarf-ver from tmake_file.
+ (hppa[12]*-*-hpux10*): Replace pa/t-hpux-shlib with t-slibgcc in
+ tmake_file.
+ Remove pa/t-slibgcc-sjlj-ver, pa/t-slibgcc-dwarf-ver from tmake_file.
+ (hppa*64*-*-hpux11*): Likewise.
+ (hppa[12]*-*-hpux11*): Likewise.
+ (i[34567]86-*-darwin*): Replace t-slibgcc-dummy in t-slibgcc in
+ tmake_file.
+ (x86_64-*-darwin*): Likewise.
+ (i[34567]86-*-cygwin*): Remove tmake_eh_file, tmake_dlldir_file.
+ Add t-slibgcc to tmake_file.
+ (i[34567]86-*-mingw*, x86_64-*-mingw*): Likewise.
+ Remove i386/t-mingw32 from tmake_file unless x86_64-w64-*,
+ i[34567]86-w64-*.
+ Remove i386/t-mingw-pthread from tmake_file.
+ (ia64*-*-linux*): Remove ia64/t-glibc from tmake_file.
+ (ia64*-*-hpux*): Add t-slibgcc to tmake_file.
+ (ia64-hp-*vms*): Likewise.
+ (m32r-*-linux*): Replace t-slibgcc-elf-ver with t-slibgcc in
+ tmake_file.
+ (m32rle-*-linux*): Likewise.
+ (m68k-*-linux*): Remove m68k/t-slibgcc-elf-ver from tmake_file.
+ (microblaze*-linux*): Remove t-slibgcc-elf-ver,
+ t-slibgcc-nolc-override from tmake_file.
+ (mips-sgi-irix6.5*): Replace t-slibgcc-dummy with t-slibgcc in
+ tmake_file.
+ (powerpc-*-darwin*): Likewise.
+ (powerpc64-*-darwin*): Likewise.
+ (powerpc-*-freebsd*): Remove t-slibgcc-libgcc from tmake_file.
+ (powerpc-*-linux*, powerpc64-*-linux*): Likewise.
+ (rs6000-ibm-aix4.[3456789]*, powerpc-ibm-aix4.[3456789]*): Add
+ t-slibgcc to tmake_file.
+ (rs6000-ibm-aix5.1.*, powerpc-ibm-aix5.1.*): Likewise.
+ (rs6000-ibm-aix5.2.*, powerpc-ibm-aix5.2.*): Likewise.
+ (rs6000-ibm-aix5.3.*, powerpc-ibm-aix5.3.*): Likewise.
+ (rs6000-ibm-aix[6789].*, powerpc-ibm-aix[6789].*): Likewise.
+ (sparc-*-linux*): Remove sparc/t-linux from tmake_file.
+ (sparc64-*-linux*): Likewise.
+ (tic6x-*-uclinux): Replace t-slibgcc-elf-ver with t-slibgcc in
+ tmake_file.
+ (i[34567]86-*-linux*, x86_64-*-linux*, i[34567]86-*-kfreebsd*-gnu,
+ x86_64-*-kfreebsd*-gnu, i[34567]86-*-gnu*): Remove i386/t-linux
+ from tmake_file.
+
+2011-11-02 Richard Guenther <rguenther@suse.de>
+
+ PR tree-optimization/50902
+ * tree-vect-stmts.c (vectorizable_load): Properly convert
+ an invariant initializer element.
+
+2010-11-02 Richard Guenther <rguenther@suse.de>
+
+ PR tree-optimization/50890
+ * gimple.h (gimple_fold_call): Remove.
+ * gimple-fold.c (fold_stmt_1): Move all call related code to ...
+ (gimple_fold_call): ... here. Make static. Update the
+ cannot-inline flag on direct calls.
+ * ipa-inline.c (early_inliner): Copy the cannot-inline flag
+ from the statements to the edges.
+
+2011-11-01 Ian Lance Taylor <iant@google.com>
+
+ * godump.c (struct macro_hash_value): Define.
+ (macro_hash_hashval): New static function.
+ (macro_hash_eq, macro_hash_del): New static functions.
+ (go_define): Use macro_hash_value to store values in macro_hash.
+ Replace an old value on a redefinition. Don't print anything to
+ go_dump_file.
+ (go_undef): Delete the entry from the hash table.
+ (go_output_typedef): For an enum, use macro_hash_value, and don't
+ print anything to go_dump_file.
+ (go_print_macro): New static function.
+ (go_finish): Traverse macro_hash with go_print_macro.
+ (dump_go_spec_init): Update macro_hash creation for macro_hash_value.
+
+2011-11-02 Alan Modra <amodra@gmail.com>
+
+ * config/rs6000/rs6000.c (rs6000_code_end): Declare ATTRIBUTE_UNUSED.
+
+2011-11-01 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/44277
+ * doc/invoke.texi: Document -Wzero-as-null-pointer-constant.
+
+2011-11-01 Andrew Stubbs <ams@codesourcery.com>
+
+ * config/arm/bpabi.h (BE8_LINK_SPEC): Recognize generic-armv7 tuning.
+
+2011-11-01 Uros Bizjak <ubizjak@gmail.com>
+
+ * config/i386/i386.md (splitters for int-float conversion): Use
+ SUBREG_REG on SUBREGs in splitter constraints.
+
2011-11-01 Jakub Jelinek <jakub@redhat.com>
* config/i386/i386-protos.h (ix86_expand_adjust_ufix_to_sfix_si): New
prototype.
* config/i386/i386.c (ix86_expand_adjust_ufix_to_sfix_si): New
function.
- * config/i386/sse.md (fixuns_trunc<mode><sseintvecmodelower>2): Use
- it.
+ * config/i386/sse.md (fixuns_trunc<mode><sseintvecmodelower>2): Use it.
(ssepackfltmode): New mode attr.
(vec_pack_ufix_trunc_<mode>): New expander.
-2011-10-30 Uros Bizjak <ubizjak@gmail.com>
+2011-11-01 Uros Bizjak <ubizjak@gmail.com>
+ PR target/50940
* config/i386/i386.md (floatsi<mode>2_vector_sse_with_temp splitter):
- Compare <ssevecmode>mode with V4SFmode, not V4SImode.
+ Compare <ssevecmode>mode to V4SFmode, not V4SImode.
2011-11-01 Peter Bergner <bergner@vnet.ibm.com>
@@ -46,7 +1914,7 @@
* config/avr/avr.h (BRANCH_COST): Define to avr_branch_cost.
* config/avr/avr.c (avr_rtx_costs_1): Adjust [U]DIV/[U]MOD costs.
* config/avr/avr.md (*addqi3.lt0, *addhi3.lt0, *addsi3.lt0): New insns.
- (*addhi3_zero_extend1): Remov % in constraint of operand 1.
+ (*addhi3_zero_extend1): Remove % in constraint of operand 1.
(*addhi3.sign_extend1, *subhi3.sign_extend2): New insns.
2011-11-01 Tom de Vries <tom@codesourcery.com>
@@ -62,6 +1930,9 @@
2011-11-01 David S. Miller <davem@davemloft.net>
+ * config/sparc/sparc.c (vector_init_faligndata): New function.
+ (sparc_expand_vector_init): Use it for V4HImode on VIS1.
+
* config/sparc/sparc.c (sparc_expand_vcond): New function.
* config/sparc/sparc-protos.h (sparc_expand_vcond): Declare it.
* config/sparc/sparc.md (vcond<mode><mode>): New VIS3 expander.
@@ -4198,7 +6069,7 @@
* hwint.h (HOST_WIDE_INT_PRINT_HEX_PURE): Add.
* lto-streamer.c (lto_get_section_name): Remove crc32_string.
- Handle numerical random seed.
+ Handle numerical random seed.
* lto-streamer.h (lto_file_decl_data): Change id to
unsigned HOST_WIDE_INT.
* toplev.c (random_seed): Add.
diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index 7fff5588466..95d26156ac4 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20111101
+20111107
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index 625ccbc7959..9ec2df1485b 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -164,6 +164,8 @@ C_STRICT_WARN = @c_strict_warn@
# "extern" tags in header files.
NOCOMMON_FLAG = @nocommon_flag@
+NOEXCEPTION_FLAGS = @noexception_flags@
+
# This is set by --disable-maintainer-mode (default) to "#"
# FIXME: 'MAINT' will always be set to an empty string, no matter if
# --disable-maintainer-mode is used or not. This is because the
@@ -374,6 +376,7 @@ USER_H = $(srcdir)/ginclude/float.h \
$(srcdir)/ginclude/varargs.h \
$(srcdir)/ginclude/stdfix.h \
$(srcdir)/ginclude/stdnoreturn.h \
+ $(srcdir)/ginclude/stdalign.h \
$(EXTRA_HEADERS)
USER_H_INC_NEXT_PRE = @user_headers_inc_next_pre@
@@ -490,8 +493,6 @@ md_file=$(srcdir)/config/@md_file@
tm_file_list=@tm_file_list@
tm_include_list=@tm_include_list@
tm_defines=@tm_defines@
-libgcc_tm_file_list=@libgcc_tm_file_list@
-libgcc_tm_include_list=@libgcc_tm_include_list@
tm_p_file_list=@tm_p_file_list@
tm_p_include_list=@tm_p_include_list@
build_xm_file_list=@build_xm_file_list@
@@ -534,9 +535,7 @@ lang_opt_files=@lang_opt_files@ $(srcdir)/c-family/c.opt $(srcdir)/common.opt
lang_specs_files=@lang_specs_files@
lang_tree_files=@lang_tree_files@
target_cpu_default=@target_cpu_default@
-GCC_THREAD_FILE=@thread_file@
OBJC_BOEHM_GC=@objc_boehm_gc@
-GTHREAD_FLAGS=@gthread_flags@
extra_modes_file=@extra_modes_file@
extra_opt_files=@extra_opt_files@
host_hook_obj=@out_host_hook_obj@
@@ -612,8 +611,6 @@ prefix_to_exec_prefix := \
dollar = @dollar@
# Used in install-cross.
gcc_tooldir = @gcc_tooldir@
-# Used to install the shared libgcc.
-slibdir = @slibdir@
# Since gcc_tooldir does not exist at build-time, use -B$(build_tooldir)/bin/
build_tooldir = $(exec_prefix)/$(target_noncanonical)
# Directory in which the compiler finds target-independent g++ includes.
@@ -673,32 +670,6 @@ ifeq ($(inhibit_libc),true)
INHIBIT_LIBC_CFLAGS = -Dinhibit_libc
endif
-# Options to use when compiling libgcc2.a.
-#
-LIBGCC2_DEBUG_CFLAGS = -g
-LIBGCC2_CFLAGS = -O2 $(LIBGCC2_INCLUDES) $(INCLUDES_FOR_TARGET) $(GCC_CFLAGS) \
- $(TARGET_LIBGCC2_CFLAGS) $(LIBGCC2_DEBUG_CFLAGS) \
- $(GTHREAD_FLAGS) -DIN_LIBGCC2 \
- -fbuilding-libgcc -fno-stack-protector \
- $(INHIBIT_LIBC_CFLAGS)
-
-# Additional options to use when compiling libgcc2.a.
-# Some targets override this to -isystem include
-LIBGCC2_INCLUDES =
-
-# Additional target-dependent options for compiling libgcc2.a.
-TARGET_LIBGCC2_CFLAGS =
-
-# Options to use when compiling crtbegin/end.
-CRTSTUFF_CFLAGS = -O2 $(GCC_CFLAGS) $(INCLUDES_FOR_TARGET) $(MULTILIB_CFLAGS) \
- -g0 -finhibit-size-directive -fno-inline -fno-exceptions \
- -fno-zero-initialized-in-bss -fno-toplevel-reorder -fno-tree-vectorize \
- -fno-stack-protector \
- $(INHIBIT_LIBC_CFLAGS)
-
-# nm flags to list global symbols in libgcc object files.
-SHLIB_NM_FLAGS = -pg
-
# List of extra executables that should be compiled for this target machine
# that are used for compiling from source code to object code.
# The rules for compiling them should be in the t-* file for the machine.
@@ -707,10 +678,6 @@ EXTRA_PASSES =@extra_passes@
# Like EXTRA_PASSES, but these are used when linking.
EXTRA_PROGRAMS = @extra_programs@
-# List of extra object files that should be compiled for this target machine.
-# The rules for compiling them should be in the t-* file for the machine.
-EXTRA_PARTS = @extra_parts@
-
# List of extra object files that should be compiled and linked with
# compiler proper (cc1, cc1obj, cc1plus).
EXTRA_OBJS = @extra_objs@
@@ -733,17 +700,6 @@ USE_GCC_STDINT = @use_gcc_stdint@
# set to empty.
COLLECT2 = @collect2@
-# List of extra C and assembler files to add to static and shared libgcc2.
-# Assembler files should have names ending in `.asm'.
-LIB2FUNCS_EXTRA =
-
-# List of extra C and assembler files to add to static libgcc2.
-# Assembler files should have names ending in `.asm'.
-LIB2FUNCS_STATIC_EXTRA =
-
-# List of functions not to build from libgcc2.c.
-LIB2FUNCS_EXCLUDE =
-
# Program to convert libraries.
LIBCONVERT =
@@ -806,17 +762,6 @@ RUNTEST = `if [ -f $${srcdir}/../dejagnu/runtest ] ; then \
else echo runtest; fi`
RUNTESTFLAGS =
-# Extra flags to use when compiling crt{begin,end}.o.
-CRTSTUFF_T_CFLAGS =
-
-# "t" or nothing, for building multilibbed versions of, say, crtbegin.o.
-T =
-
-# Should T contain a `=', libgcc/Makefile will make T_TARGET, setting
-# $(T_TARGET) to the name of the actual target filename.
-T_TARGET =
-T_TARGET : $(T_TARGET)
-
# This should name the specs file that we're going to install. Target
# Makefiles may override it and name another file to be generated from
# the built-in specs and installed as the default spec, as long as
@@ -844,8 +789,7 @@ CONFIG_H = config.h $(host_xm_file_list)
TCONFIG_H = tconfig.h $(xm_file_list)
TM_P_H = tm_p.h $(tm_p_file_list)
GTM_H = tm.h $(tm_file_list) insn-constants.h
-TM_H = $(GTM_H) libgcc_tm.h $(libgcc_tm_file_list) insn-flags.h \
- $(OPTIONS_H)
+TM_H = $(GTM_H) insn-flags.h $(OPTIONS_H)
# Variables for version information.
BASEVER := $(srcdir)/BASE-VER # 4.x.y
@@ -1035,7 +979,7 @@ ALL_CFLAGS = $(T_CFLAGS) $(CFLAGS-$@) \
# The C++ version.
ALL_CXXFLAGS = $(T_CFLAGS) $(CFLAGS-$@) $(CXXFLAGS) $(INTERNAL_CFLAGS) \
- $(COVERAGE_FLAGS) $(WARN_CXXFLAGS) @DEFS@
+ $(COVERAGE_FLAGS) $(NOEXCEPTION_FLAGS) $(WARN_CXXFLAGS) @DEFS@
# Likewise. Put INCLUDES at the beginning: this way, if some autoconf macro
# puts -I options in CPPFLAGS, our include files in the srcdir will always
@@ -1106,9 +1050,6 @@ INCLUDES = -I. -I$(@D) -I$(srcdir) -I$(srcdir)/$(@D) \
$(CPPINC) $(GMPINC) $(DECNUMINC) \
$(PPLINC) $(CLOOGINC)
-INCLUDES_FOR_TARGET = -I. -I$(@D) -I$(srcdir) -I$(srcdir)/$(@D) \
- -I$(srcdir)/../include $(DECNUMINC) -I$(srcdir)/../libgcc
-
.c.o:
$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $< $(OUTPUT_OPTION)
@@ -1131,15 +1072,12 @@ export DESTDIR
export GCC_FOR_TARGET
export INCLUDES
export INSTALL_DATA
-export LIB1ASMSRC
-export LIBGCC2_CFLAGS
export LIPO_FOR_TARGET
export MACHMODE_H
export NM_FOR_TARGET
export STRIP_FOR_TARGET
export RANLIB_FOR_TARGET
export libsubdir
-export slibdir
FLAGS_TO_PASS = \
"ADA_CFLAGS=$(ADA_CFLAGS)" \
@@ -1547,20 +1485,13 @@ MOSTLYCLEANFILES = insn-flags.h insn-config.h insn-codes.h \
tree-check.h min-insn-modes.c insn-modes.c insn-modes.h \
genrtl.h gt-*.h gtype-*.h gtype-desc.c gtyp-input.list \
xgcc$(exeext) cpp$(exeext) cc1$(exeext) $(EXTRA_PASSES) \
- $(EXTRA_PARTS) $(EXTRA_PROGRAMS) gcc-cross$(exeext) \
+ $(EXTRA_PROGRAMS) gcc-cross$(exeext) \
$(SPECS) collect2$(exeext) gcc-ar$(exeext) gcc-nm$(exeext) \
gcc-ranlib$(exeext) \
gcov-iov$(build_exeext) gcov$(exeext) gcov-dump$(exeext) \
gengtype$(exeext) *.[0-9][0-9].* *.[si] *-checksum.c libbackend.a \
libcommon-target.a libcommon.a libgcc.mk
-# Defined in libgcc2.c, included only in the static library.
-LIB2FUNCS_ST = _eprintf __gcc_bcmp
-
-# These might cause a divide overflow trap and so are compiled with
-# unwinder info.
-LIB2_DIVMOD_FUNCS = _divdi3 _moddi3 _udivdi3 _umoddi3 _udiv_w_sdiv _udivmoddi4
-
#
# Language makefile fragments.
@@ -1669,7 +1600,6 @@ config.h: cs-config.h ; @true
bconfig.h: cs-bconfig.h ; @true
tconfig.h: cs-tconfig.h ; @true
tm.h: cs-tm.h ; @true
-libgcc_tm.h: cs-libgcc_tm.h ; @true
tm_p.h: cs-tm_p.h ; @true
cs-config.h: Makefile
@@ -1692,11 +1622,6 @@ cs-tm.h: Makefile
HEADERS="$(tm_include_list)" DEFINES="$(tm_defines)" \
$(SHELL) $(srcdir)/mkconfig.sh tm.h
-cs-libgcc_tm.h: Makefile
- TARGET_CPU_DEFAULT="" \
- HEADERS="$(libgcc_tm_include_list)" DEFINES="" \
- $(SHELL) $(srcdir)/mkconfig.sh libgcc_tm.h
-
cs-tm_p.h: Makefile
TARGET_CPU_DEFAULT="" \
HEADERS="$(tm_p_include_list)" DEFINES="" \
@@ -1881,52 +1806,13 @@ cc1$(exeext): $(C_OBJS) cc1-checksum.o $(BACKEND) $(LIBDEPS)
#
# Build libgcc.a.
-LIB2ADD = $(LIB2FUNCS_EXTRA)
-LIB2ADD_ST = $(LIB2FUNCS_STATIC_EXTRA)
-
-# All source files for libgcc are either generated in the libgcc build
-# directory which will be substituted for $$(libgcc_objdir), in the
-# source directory (in which case they will start with $(srcdir)), or
-# generated into the build directory (in which case they will be
-# relative paths).
-srcdirify = $(patsubst $$(libgcc_objdir)/%,%, \
- $(filter $$(libgcc_objdir)%,$(1))) \
- $(patsubst $(srcdir)%,$$(gcc_srcdir)%,$(filter $(srcdir)%,$(1))) \
- $(patsubst %,$$(gcc_objdir)/%, \
- $(filter-out $(srcdir)% $$(libgcc_objdir)%,$(1)))
-
-# The distinction between these two variables is no longer relevant,
-# so we combine them. Sort removes duplicates.
-GCC_EXTRA_PARTS := $(sort $(EXTRA_MULTILIB_PARTS) $(EXTRA_PARTS))
-
libgcc-support: libgcc.mvars stmp-int-hdrs $(TCONFIG_H) \
- $(MACHMODE_H) $(LIB2ADD) $(LIB2ADD_ST) gcov-iov.h
+ $(MACHMODE_H) gcov-iov.h
-libgcc.mvars: config.status Makefile $(LIB2ADD) $(LIB2ADD_ST) specs \
- xgcc$(exeext)
+libgcc.mvars: config.status Makefile specs xgcc$(exeext)
: > tmp-libgcc.mvars
- echo LIB1ASMFUNCS = '$(LIB1ASMFUNCS)' >> tmp-libgcc.mvars
- echo LIB1ASMSRC = '$(LIB1ASMSRC)' >> tmp-libgcc.mvars
- echo LIB2FUNCS_ST = '$(LIB2FUNCS_ST)' >> tmp-libgcc.mvars
- echo LIB2FUNCS_EXCLUDE = '$(LIB2FUNCS_EXCLUDE)' >> tmp-libgcc.mvars
- echo LIB2ADD = '$(call srcdirify,$(LIB2ADD))' >> tmp-libgcc.mvars
- echo LIB2ADD_ST = '$(call srcdirify,$(LIB2ADD_ST))' >> tmp-libgcc.mvars
- echo LIB2_SIDITI_CONV_FUNCS = '$(LIB2_SIDITI_CONV_FUNCS)' >> tmp-libgcc.mvars
- echo LIB2_DIVMOD_FUNCS = '$(LIB2_DIVMOD_FUNCS)' >> tmp-libgcc.mvars
- echo GCC_EXTRA_PARTS = '$(GCC_EXTRA_PARTS)' >> tmp-libgcc.mvars
- echo SHLIB_LINK = '$(subst $(GCC_FOR_TARGET),$$(GCC_FOR_TARGET),$(SHLIB_LINK))' >> tmp-libgcc.mvars
- echo SHLIB_INSTALL = '$(SHLIB_INSTALL)' >> tmp-libgcc.mvars
- echo SHLIB_DLLDIR = '$(SHLIB_DLLDIR)' >> tmp-libgcc.mvars
- echo SHLIB_EXT = '$(SHLIB_EXT)' >> tmp-libgcc.mvars
- echo SHLIB_MKMAP = '$(call srcdirify,$(SHLIB_MKMAP))' >> tmp-libgcc.mvars
- echo SHLIB_MKMAP_OPTS = '$(SHLIB_MKMAP_OPTS)' >> tmp-libgcc.mvars
- echo SHLIB_MAPFILES = '$(call srcdirify,$(SHLIB_MAPFILES))' >> tmp-libgcc.mvars
- echo SHLIB_NM_FLAGS = '$(SHLIB_NM_FLAGS)' >> tmp-libgcc.mvars
- echo LIBGCC2_CFLAGS = '$(LIBGCC2_CFLAGS)' >> tmp-libgcc.mvars
- echo TARGET_LIBGCC2_CFLAGS = '$(TARGET_LIBGCC2_CFLAGS)' >> tmp-libgcc.mvars
- echo CRTSTUFF_CFLAGS = '$(CRTSTUFF_CFLAGS)' >> tmp-libgcc.mvars
- echo CRTSTUFF_T_CFLAGS = '$(CRTSTUFF_T_CFLAGS)' >> tmp-libgcc.mvars
- echo CRTSTUFF_T_CFLAGS_S = '$(CRTSTUFF_T_CFLAGS_S)' >> tmp-libgcc.mvars
+ echo GCC_CFLAGS = '$(GCC_CFLAGS)' >> tmp-libgcc.mvars
+ echo INHIBIT_LIBC_CFLAGS = '$(INHIBIT_LIBC_CFLAGS)' >> tmp-libgcc.mvars
echo TARGET_SYSTEM_ROOT = '$(TARGET_SYSTEM_ROOT)' >> tmp-libgcc.mvars
mv tmp-libgcc.mvars libgcc.mvars
@@ -1954,41 +1840,6 @@ s-mlib: $(srcdir)/genmultilib Makefile
fi
$(SHELL) $(srcdir)/../move-if-change tmp-mlib.h multilib.h
$(STAMP) s-mlib
-
-# Compile two additional files that are linked with every program
-# linked using GCC on systems using COFF or ELF, for the sake of C++
-# constructors.
-$(T)crtbegin.o: crtstuff.c $(GCC_PASSES) $(TCONFIG_H) auto-host.h \
- gbl-ctors.h stmp-int-hdrs tsystem.h coretypes.h $(TM_H)
- $(GCC_FOR_TARGET) $(CRTSTUFF_CFLAGS) $(CRTSTUFF_T_CFLAGS) \
- -c $(srcdir)/crtstuff.c -DCRT_BEGIN \
- -o $(T)crtbegin$(objext)
-
-$(T)crtend.o: crtstuff.c $(GCC_PASSES) $(TCONFIG_H) auto-host.h \
- gbl-ctors.h stmp-int-hdrs tsystem.h coretypes.h $(TM_H)
- $(GCC_FOR_TARGET) $(CRTSTUFF_CFLAGS) $(CRTSTUFF_T_CFLAGS) \
- -c $(srcdir)/crtstuff.c -DCRT_END \
- -o $(T)crtend$(objext)
-
-# These are versions of crtbegin and crtend for shared libraries.
-$(T)crtbeginS.o: crtstuff.c $(GCC_PASSES) $(TCONFIG_H) auto-host.h \
- gbl-ctors.h stmp-int-hdrs tsystem.h coretypes.h $(TM_H)
- $(GCC_FOR_TARGET) $(CRTSTUFF_CFLAGS) $(CRTSTUFF_T_CFLAGS_S) \
- -c $(srcdir)/crtstuff.c -DCRT_BEGIN -DCRTSTUFFS_O \
- -o $(T)crtbeginS$(objext)
-
-$(T)crtendS.o: crtstuff.c $(GCC_PASSES) $(TCONFIG_H) auto-host.h \
- gbl-ctors.h stmp-int-hdrs tsystem.h coretypes.h $(TM_H)
- $(GCC_FOR_TARGET) $(CRTSTUFF_CFLAGS) $(CRTSTUFF_T_CFLAGS_S) \
- -c $(srcdir)/crtstuff.c -DCRT_END -DCRTSTUFFS_O \
- -o $(T)crtendS$(objext)
-
-# This is a version of crtbegin for -static links.
-$(T)crtbeginT.o: crtstuff.c $(GCC_PASSES) $(TCONFIG_H) auto-host.h \
- gbl-ctors.h stmp-int-hdrs tsystem.h coretypes.h $(TM_H)
- $(GCC_FOR_TARGET) $(CRTSTUFF_CFLAGS) $(CRTSTUFF_T_CFLAGS) \
- -c $(srcdir)/crtstuff.c -DCRT_BEGIN -DCRTSTUFFT_O \
- -o $(T)crtbeginT$(objext)
#
# Compiling object files from source files.
@@ -2231,20 +2082,20 @@ DRIVER_DEFINES = \
-DTOOLDIR_BASE_PREFIX=\"$(libsubdir_to_prefix)$(prefix_to_exec_prefix)\" \
@TARGET_SYSTEM_ROOT_DEFINE@ \
$(VALGRIND_DRIVER_DEFINES) \
- `test "X$${SHLIB_LINK}" = "X" || test "@enable_shared@" != "yes" || echo "-DENABLE_SHARED_LIBGCC"` \
+ `test "X$${SHLIB}" = "X" || test "@enable_shared@" != "yes" || echo "-DENABLE_SHARED_LIBGCC"` \
-DCONFIGURE_SPECS="\"@CONFIGURE_SPECS@\""
gcc.o: gcc.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) intl.h multilib.h \
Makefile $(lang_specs_files) specs.h prefix.h $(GCC_H) $(FLAGS_H) \
configargs.h $(OBSTACK_H) $(OPTS_H) $(DIAGNOSTIC_H) $(VEC_H) $(PARAMS_H)
- (SHLIB_LINK='$(SHLIB_LINK)'; \
+ (SHLIB='$(SHLIB)'; \
$(COMPILER) $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) \
$(DRIVER_DEFINES) \
-c $(srcdir)/gcc.c $(OUTPUT_OPTION))
gccspec.o: gccspec.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(GCC_H) \
$(OPTS_H)
- (SHLIB_LINK='$(SHLIB_LINK)'; \
+ (SHLIB='$(SHLIB)'; \
$(COMPILER) $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) \
$(DRIVER_DEFINES) \
-c $(srcdir)/gccspec.c $(OUTPUT_OPTION))
@@ -4139,7 +3990,7 @@ PREPROCESSOR_DEFINES = \
CFLAGS-cppbuiltin.o += $(PREPROCESSOR_DEFINES) -DBASEVER=$(BASEVER_s)
cppbuiltin.o: cppbuiltin.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
- cppbuiltin.h Makefile
+ $(TREE_H) cppbuiltin.h Makefile
CFLAGS-cppdefault.o += $(PREPROCESSOR_DEFINES)
cppdefault.o: cppdefault.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
@@ -4576,7 +4427,7 @@ clean: mostlyclean lang.clean
-rm -f libgcc.a libgcc_eh.a libgcov.a
-rm -f libgcc_s*
-rm -f libunwind*
- -rm -f config.h tconfig.h bconfig.h tm_p.h tm.h libgcc_tm.h
+ -rm -f config.h tconfig.h bconfig.h tm_p.h tm.h
-rm -f options.c options.h optionlist
-rm -f cs-*
-rm -f doc/*.dvi
@@ -4662,7 +4513,6 @@ installdirs:
$(mkinstalldirs) $(DESTDIR)$(bindir)
$(mkinstalldirs) $(DESTDIR)$(includedir)
$(mkinstalldirs) $(DESTDIR)$(infodir)
- $(mkinstalldirs) $(DESTDIR)$(slibdir)
$(mkinstalldirs) $(DESTDIR)$(man1dir)
$(mkinstalldirs) $(DESTDIR)$(man7dir)
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 350f8e9c47f..51b2719a387 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,403 @@
+2011-11-07 Olivier Hainque <hainque@adacore.com>
+
+ * sigtramp-ppcvxw.c: Add general comments.
+ (CFI_COMMON_REGS): Remove rule for r1, as in other unwinders. Add
+ rules for r2 to r13, plus CTR and XER.
+ (CFA_REG): New, register number used to hold the local CFA.
+ (CFI_DEF_CFA, SIGTRAMP_BODY): Use it.
+ Make that 15, not 14, with documentation.
+ (TCR): Undef before definition, preventing conflict with reg number in
+ VxWorks headers.
+
+2011-11-07 Robert Dewar <dewar@adacore.com>
+
+ * exp_util.ads, exp_alfa.adb, a-cohama.adb, a-cohama.ads, sem_ch4.adb,
+ aspects.ads, exp_ch8.adb, exp_ch8.ads, atree.ads: Minor reformatting.
+ * gcc-interface/Make-lang.in: Update dependencies.
+
+2011-11-07 Ed Schonberg <schonberg@adacore.com>
+
+ * exp_ch6.adb: A tagged type is a legal actual for an aliased
+ formal.
+
+2011-11-07 Pascal Obry <obry@adacore.com>
+
+ * g-socket.adb, g-socket.ads: Minor reformatting.
+
+2011-11-07 Robert Dewar <dewar@adacore.com>
+
+ * sem_res.adb (Resolve_Actuals): Minor error message improvement.
+
+2011-11-07 Robert Dewar <dewar@adacore.com>
+
+ * gnat_ugn.texi: Add discussion of default mode handling of
+ source representation with no -gnatW option given, in particular
+ noting that NEL (next line) is not recognized in this context.
+
+2011-11-07 Yannick Moy <moy@adacore.com>
+
+ * sem_util.adb (Note_Possible_Modification): In Alfa mode,
+ generate a reference for a modification even when the modification
+ does not come from source.
+
+2011-11-07 Ed Schonberg <schonberg@adacore.com>
+
+ * exp_ch5.adb (Expand_Iterator_Loop): For the "of" iterator form,
+ use the indexing attributes rather than the Element function,
+ to obtain variable references.
+ * sem_ch4.adb (Try_Container_Indexing): Code cleanup. Use
+ Find_Aspect rather than iterating over representation
+ items. Improve error message.
+ * a-cohama.adb, a-cohama.ads Update to latest RM, with two versions
+ of Reference functions.
+
+2011-11-07 Yannick Moy <moy@adacore.com>
+
+ * sem_util.adb (Unique_Entity): For a parameter on a subprogram
+ body that has a corresponding parameter on the subprogram
+ declaration, define the unique entity as being the declaration
+ one.
+
+2011-11-07 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_ch6.adb (Analyze_Return_Type): In Ada 2012 mode, if the
+ return type of a function is the class-wide type of an incomplete
+ type T, T can be a Taft-amendment type and does not have to be
+ completed in the current private part.
+
+2011-11-07 Ed Schonberg <schonberg@adacore.com>
+
+ * aspects.ads (Inherited_Aspect): Map that indicates type aspects
+ that are inherited by default, and apply to the class-wide type
+ as well.
+ * aspects.adb (Find_Aspect): If the entity is class-wide and the
+ aspect is inherited, use the aspect of the specific type.
+
+2011-11-07 Hristian Kirtchev <kirtchev@adacore.com>
+
+ * exp_alfa.adb: Remove with and use clause for
+ Exp_Ch8. Add with and use clause for Exp_Util.
+ Remove local constant Disable_Processing_Of_Renamings.
+ (Expand_Alfa_N_Object_Renaming_Declaration): The expansion of
+ object renamings has been reenabled.
+ (Expand_Possible_Renaming):
+ The expansion of identifier and expanded names has been
+ reenabled. Perform the substitutions only for entities that
+ denote an object.
+ * exp_ch8.ads, exp_ch8.adb (Evaluate_Name): Moved to Exp_Util.
+ * exp_util.adb (Evaluate_Name): Moved from Exp_Ch8.
+ (Remove_Side_Effects): Alphabetize local variables. Add a guard
+ to avoid the infinite expansion of an expression in Alfa mode. Add
+ processing for function calls in Alfa mode.
+ * exp_util.ads (Evaliate_Name): Moved from Exp_Ch8.
+
+2011-11-07 Ed Schonberg <schonberg@adacore.com>
+
+ * freeze.adb (Freeze_Entity): If the entity is an access to
+ subprogram whose designated type is itself a subprogram type,
+ its own return type must be decorated with size information.
+
+2011-11-04 Arnaud Charlet <charlet@adacore.com>
+
+ * gcc-interface/Make-lang.in: Update dependencies.
+
+2011-11-04 Robert Dewar <dewar@adacore.com>
+
+ * sprint.adb (Sprint_Node_Actual, case Qualified_Expression):
+ Avoid junk semicolon after argument of machine code Asm operand.
+
+2011-11-04 Robert Dewar <dewar@adacore.com>
+
+ * exp_ch11.adb (Generate_Push_Pop): Inhibit push/pop nodes in
+ CodePeer mode or if restriction No_Exception_Handlers is present.
+ * exp_ch6.adb (Expand_N_Subprogram_Body): (Inhibit push/pop
+ nodes in CodePeer mode or if restriction No_Exception_Handlers
+ is present.
+
+2011-11-04 Robert Dewar <dewar@adacore.com>
+
+ * s-tassta.adb, atree.ads, errout.adb, sinput.adb: Minor reformatting.
+
+2011-11-04 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_ch6.adb (Analyze_Subprogram_Specification): The
+ specification is legal if it is a function that returns an
+ abstract type, if it comes from an attribute renaming of a stream
+ attribute of an abstract type.
+
+2011-11-04 Gary Dismukes <dismukes@adacore.com>
+
+ * exp_util.adb (Is_Possibly_Unaligned_Object): In case of indexed
+ components, check whether recursively check whether the prefix
+ denotes an unaligned object.
+
+2011-11-04 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_prag.adb (Analyze_Pragma, case Debug): The argument of
+ the pragma is legal if it is an expanded name that denotes a
+ procedure that be can called without parameters.
+
+2011-11-04 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gnat_ugn.texi (Performance Considerations) <Vectorization
+ of loops>: New sub-section. <Other Optimization Switches>:
+ Minor tweak.
+
+2011-11-04 Robert Dewar <dewar@adacore.com>
+
+ * gnat_rm.texi: Minor reformatting.
+
+2011-11-04 Matthew Heaney <heaney@adacore.com>
+
+ * a-convec.adb, a-coinve.adb, a-cobove.adb (Merge): Raise PE
+ when Target and Source denote same non-empty object
+ * a-cdlili.adb, a-cidlli.adb, a-cbdlli.adb (Merge): Ditto
+
+2011-11-04 Robert Dewar <dewar@adacore.com>
+
+ * exp_attr.adb: Minor reformatting.
+
+2011-11-04 Ed Schonberg <schonberg@adacore.com>
+
+ * exp_ch5.adb (Expand_Assign_Record): Do not generate a
+ discriminant assignment within an initialization proc if the
+ record is an unchecked union, as it can only come from the
+ initialization of an unchecked union component.
+
+2011-11-04 Robert Dewar <dewar@adacore.com>
+
+ * gnat_ugn.texi: Minor reformatting.
+
+2011-11-04 Robert Dewar <dewar@adacore.com>
+
+ * par-labl.adb (Rewrite_As_Loop): Generate info msg rather than
+ warning message.
+
+2011-11-04 Robert Dewar <dewar@adacore.com>
+
+ * exp_ch4.adb: Minor code reorganization (remove junk obsolete
+ var Save_Space).
+
+2011-11-04 Hristian Kirtchev <kirtchev@adacore.com>
+
+ * exp_alfa.adb: Add local constant
+ Disable_Processing_Of_Renamings;
+ (Expand_Alfa_N_Object_Renaming_Declaration): Disable
+ the name evaluation of object renamings for now.
+ (Expand_Potential_Renaming): Do not perform the substitution
+ for now.
+ * exp_util.adb (Remove_Side_Effects): Remove processing for
+ functions with side effects in Alfa mode.
+
+2011-11-04 Gary Dismukes <dismukes@adacore.com>
+
+ * bindgen.adb (Gen_Elab_Calls): In the case
+ of the AAMP target, set elaboration entities to 1 rather than
+ incrementing.
+
+2011-11-04 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_ch10.adb (Install_Limited_With_Unit): To establish the
+ proper entities on the ancestors of a child unit that appear
+ in a limited_with clause, follow the unit links because the
+ units are not analyzed and scope information is incomplete.
+
+2011-11-04 Eric Botcazou <ebotcazou@adacore.com>
+
+ * exp_ch4.adb (Expand_N_Selected_Component): Refine code
+ setting the Atomic_Sync_Required flag to detect one more case.
+ * exp_util.adb (Activate_Atomic_Synchronization): Refine code
+ setting the Atomic_Sync_Required flag to exclude more cases,
+ depending on the parent of the node to be examined.
+
+2011-11-04 Bob Duff <duff@adacore.com>
+
+ * g-excact.adb: Minor: use named notation.
+
+2011-11-04 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_ch5.adb: Improve error messages for illegal iterators.
+
+2011-11-04 Hristian Kirtchev <kirtchev@adacore.com>
+
+ * exp_alfa.adb: Add with and use clauses for Exp_Ch8 and
+ Sem_Util.
+ (Expand_Alfa): Alphabetize cases on first choice. Add
+ processing for object renaming declarations, identifiers and
+ expanded names.
+ (Expand_Alfa_N_In): Remove useless return.
+ (Expand_Alfa_N_Object_Renaming_Declaration): New routine.
+ (Expand_Potential_Renaming): New routine.
+ * exp_ch8.adb (Evaluate_Name): Moved to the top level.
+ (Expand_N_Object_Declaration): Alphabetize local variables. Move
+ Evaluate_Name out to the top level.
+ * exp_ch8.ads (Evaluate_Name): Moved from body to package spec.
+ * exp_util.adb (Remove_Side_Effects): Add processing for
+ functions with side effects in Alfa mode.
+
+2011-11-04 Hristian Kirtchev <kirtchev@adacore.com>
+
+ * gnat_rm.texi: Add entries for
+ restrictions No_Relative_Delay, No_Requeue_Statements and
+ No_Stream_Optimizations.
+
+2011-11-04 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_ch4.adb: Set type of entity in prefixed call, for
+ completeness in a generic context.
+
+2011-11-04 Yannick Moy <moy@adacore.com>
+
+ * sem_prag.adb: Minor refactoring (renaming of a parameter).
+
+2011-11-04 Robert Dewar <dewar@adacore.com>
+
+ * atree.ads: Minor reformatting.
+
+2011-11-04 Robert Dewar <dewar@adacore.com>
+
+ * checks.adb (Atomic_Synchronization_Disabled): Check -gnatd.d
+ and -gnatd.e here
+ * exp_ch2.adb (Expand_Entity_Reference): Use
+ Activate_Atomic_Synchronization
+ * exp_ch4.adb (Expand_N_Explicit_Dereference): Use
+ Activate_Atomic_Synchronization (Expand_N_Indexed_Compoonent):
+ Activate_Atomic_Synchronization (Expand_N_Selected_Component):
+ Use Activate_Atomic_Synchronization
+ * exp_util.ads, exp_util.adb (Activate_Atomic_Synchronization): New
+ procedure.
+ * sinfo.ads, sinfo.adb (Atomic_Sync_Required): Can now apply to
+ N_Selected_Component node
+
+2011-11-04 Robert Dewar <dewar@adacore.com>
+
+ * sem_prag.adb, atree.ads, prj-env.adb, prj-env.ads: Minor reformatting.
+
+2011-11-04 Yannick Moy <moy@adacore.com>
+
+ * atree.adb, atree.ads (Set_Original_Node): New set procedure.
+ * sem_ch13.adb (Analyze_Aspect_Specifications/Pre_Post_Aspects):
+ In ASIS mode, no splitting of aspects between conjuncts.
+ (Analyze_Aspect_Specifications/Aspect_Test_Case): Make pragma
+ expressions refer to the original aspect expressions through
+ the Original_Node link. This is used in semantic analysis for
+ ASIS mode, so that the original expression also gets analyzed.
+ * sem_prag.adb (Preanalyze_TC_Args,
+ Check_Precondition_Postcondition,
+ Analyze_Pragma/Pragma_Test_Case): In ASIS mode, for a pragma
+ generated from a source aspect, also analyze the original aspect
+ expression.
+ (Check_Expr_Is_Static_Expression): New procedure
+ similar to existing procedure Check_Arg_Is_Static_Expression,
+ except called on expression inside pragma.
+
+2011-11-04 Tristan Gingold <gingold@adacore.com>
+
+ * prj-env.adb, prj-env.ads (Find_Name_In_Path): New function, from
+ Find_Project.Try_Path_Name.
+ (Find_Project): Use Find_Name_In_Path to implement Try_Path_Name.
+
+2011-11-04 Eric Botcazou <ebotcazou@adacore.com>
+
+ * s-atocou.ads (Atomic_Counter): Remove redundant pragma Volatile.
+
+2011-11-04 Pascal Obry <obry@adacore.com>
+
+ * projects.texi: Add short description for qualifiers aggregate
+ and aggregate library.
+
+2011-11-04 Matthew Heaney <heaney@adacore.com>
+
+ * Makefile.rtl, impunit.adb: Added a-cogeso.ad[sb]
+ * a-cgaaso.adb: Replaced implementation with instantiation
+ of Generic_Sort.
+ * a-cogeso.ad[sb] This is the new Ada 2012 unit
+ Ada.Containers.Generic_Sort
+
+2011-11-04 Robert Dewar <dewar@adacore.com>
+
+ * exp_ch2.adb (Expand_Entity_Reference): Do not set
+ Atomic_Sync_Required for the case of a prefix of an attribute.
+ * exp_ch4.adb (Expand_N_Explicit_Dereference): May require
+ atomic synchronization
+ (Expand_N_Indexed_Component): Ditto.
+ (Expand_B_Selected_Component): Ditto.
+ * sem_prag.adb (Process_Suppress_Unsuppress):
+ Disable/Enable_Atomic_Synchronization can now occur for array
+ types with pragma Atomic_Components.
+ * sinfo.ads, sinfo.adb (Atomic_Sync_Required): Can now occur on
+ N_Explicit_Dereference nodes and on N_Indexed_Component nodes.
+
+2011-11-04 Gary Dismukes <dismukes@adacore.com>
+
+ * gnat_ugn.texi: Editorial corrections for gnattest section.
+
+2011-11-04 Robert Dewar <dewar@adacore.com>
+
+ * sem_prag.adb: Minor reformatting.
+ * gnat_rm.texi: Update documentation for pragma Warnings (Off,
+ "***") usage.
+ * exp_ch2.adb (Expand_Entity_Reference): Only set
+ Atomic_Sync_Required on entities that are variables. Doesn't
+ make any sense on anything else.
+
+2011-11-04 Robert Dewar <dewar@adacore.com>
+
+ * exp_ch2.adb (Expand_Entity_Reference): Extend handling of
+ atomic sync to type case.
+ * sem_prag.adb (Process_Suppress_Unsuppress): Atomic Sync can
+ apply to types.
+
+2011-11-04 Robert Dewar <dewar@adacore.com>
+
+ * sem_warn.adb (Warn_On_Useless_Assignment): More accurate test
+ for call vs assign.
+ * gcc-interface/Make-lang.in: Update dependencies.
+
+2011-11-04 Robert Dewar <dewar@adacore.com>
+
+ * sem_prag.adb: Detect more cases of Long_Float inconsistencies at
+ compile time.
+
+2011-11-04 Matthew Heaney <heaney@adacore.com>
+
+ * Makefile.rtl, impunit.adb: Added a-sfecin.ads,
+ * a-sfhcin.ads, a-sflcin.ads, a-sbecin.ad[sb], a-sbhcin.ad[sb],
+ a-sblcin.ad[sb], a-suecin.ad[sb], a-suhcin.ad[sb], a-sulcin.ad[sb]
+ * a-sfecin.ads, a-sfhcin.ads, a-sflcin.ads, a-sbecin.ad[sb],
+ a-sbhcin.ad[sb], a-sblcin.ad[sb], a-suecin.ad[sb], a-suhcin.ad[sb],
+ a-sulcin.ad[sb]: New files.
+
+2011-11-04 Geert Bosch <bosch@adacore.com>
+
+ * i-forbla-unimplemented.ads, s-gecola.adb, s-gecola.ads,
+ s-gerebl.adb, s-gerebl.ads, i-forbla.adb, i-forbla.ads,
+ i-forlap.ads, i-forbla-darwin.adb, s-gecobl.adb, s-gecobl.ads,
+ s-gerela.adb, s-gerela.ads: Remove partial interface to BLAS/LAPACK.
+ * gcc-interface/Makefile.in: Remove libgnala and related objects.
+
+2011-11-04 Matthew Heaney <heaney@adacore.com>
+
+ * a-cdlili.ad[sb], a-cidlli.ad[sb], a-coorse.ad[sb], a-ciorse.ad[sb],
+ a-coorma.ad[sb], a-ciorma.ad[sb], a-coormu.ad[sb], a-ciormu.ad[sb],
+ a-cohama.ad[sb], a-cihama.ad[sb], a-cohase.ad[sb], a-cihase.ad[sb],
+ a-convec.ad[sb], a-coinve.ad[sb] (Assign, Copy): New operations
+ added to package.
+
+2011-11-04 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gcc-interface/decl.c (gnat_to_gnu_entity) <E_Function>: Do not assert
+ that the type of the parameters isn't dummy in type_annotate_only mode.
+
+2011-11-04 Robert Dewar <dewar@adacore.com>
+
+ * sem_ch12.adb: Minor reformatting
+
+2011-11-04 Gary Dismukes <dismukes@adacore.com>
+
+ * bindgen.adb (Gen_Elab_Calls): In the case of the AAMP target,
+ initialize elaboration entities to zero when specs are processed.
+
2011-10-28 Iain Sandoe <iains@gcc.gnu.org>
Eric Botcazou <ebotcazou@adacore.com>
diff --git a/gcc/ada/Makefile.rtl b/gcc/ada/Makefile.rtl
index 4e03c9e178e..50e8a96a3d3 100644
--- a/gcc/ada/Makefile.rtl
+++ b/gcc/ada/Makefile.rtl
@@ -122,6 +122,7 @@ GNATRTL_NONTASKING_OBJS= \
a-ciormu$(objext) \
a-ciorse$(objext) \
a-clrefi$(objext) \
+ a-cogeso$(objext) \
a-cohama$(objext) \
a-cohase$(objext) \
a-cohata$(objext) \
@@ -214,9 +215,15 @@ GNATRTL_NONTASKING_OBJS= \
a-rbtgbo$(objext) \
a-rbtgbk$(objext) \
a-rbtgso$(objext) \
+ a-sbecin$(objext) \
+ a-sbhcin$(objext) \
+ a-sblcin$(objext) \
a-scteio$(objext) \
a-secain$(objext) \
a-sequio$(objext) \
+ a-sfecin$(objext) \
+ a-sfhcin$(objext) \
+ a-sflcin$(objext) \
a-sfteio$(objext) \
a-sfwtio$(objext) \
a-sfztio$(objext) \
@@ -261,10 +268,13 @@ GNATRTL_NONTASKING_OBJS= \
a-stzsea$(objext) \
a-stzsup$(objext) \
a-stzunb$(objext) \
+ a-suecin$(objext) \
a-suenco$(objext) \
a-suenst$(objext) \
a-suewst$(objext) \
a-suezst$(objext) \
+ a-suhcin$(objext) \
+ a-sulcin$(objext) \
a-suteio$(objext) \
a-swbwha$(objext) \
a-swfwha$(objext) \
diff --git a/gcc/ada/a-cbdlli.adb b/gcc/ada/a-cbdlli.adb
index 1b10d42b4a3..e1f7725d5cd 100644
--- a/gcc/ada/a-cbdlli.adb
+++ b/gcc/ada/a-cbdlli.adb
@@ -713,10 +713,24 @@ package body Ada.Containers.Bounded_Doubly_Linked_Lists is
LI, RI : Cursor;
begin
- if Target'Address = Source'Address then
+
+ -- The semantics of Merge changed slightly per AI05-0021. It was
+ -- originally the case that if Target and Source denoted the same
+ -- container object, then the GNAT implementation of Merge did
+ -- nothing. However, it was argued that RM05 did not precisely
+ -- specify the semantics for this corner case. The decision of the
+ -- ARG was that if Target and Source denote the same non-empty
+ -- container object, then Program_Error is raised.
+
+ if Source.Is_Empty then
return;
end if;
+ if Target'Address = Source'Address then
+ raise Program_Error with
+ "Target and Source denote same non-empty container";
+ end if;
+
if Target.Busy > 0 then
raise Program_Error with
"attempt to tamper with cursors of Target (list is busy)";
diff --git a/gcc/ada/a-cdlili.adb b/gcc/ada/a-cdlili.adb
index 497a1112d43..8b513222ef8 100644
--- a/gcc/ada/a-cdlili.adb
+++ b/gcc/ada/a-cdlili.adb
@@ -146,6 +146,27 @@ package body Ada.Containers.Doubly_Linked_Lists is
Insert (Container, No_Element, New_Item, Count);
end Append;
+ ------------
+ -- Assign --
+ ------------
+
+ procedure Assign (Target : in out List; Source : List) is
+ Node : Node_Access;
+
+ begin
+ if Target'Address = Source'Address then
+ return;
+ end if;
+
+ Target.Clear;
+
+ Node := Source.First;
+ while Node /= null loop
+ Target.Append (Node.Element);
+ Node := Node.Next;
+ end loop;
+ end Assign;
+
-----------
-- Clear --
-----------
@@ -206,6 +227,17 @@ package body Ada.Containers.Doubly_Linked_Lists is
return Find (Container, Item) /= No_Element;
end Contains;
+ ----------
+ -- Copy --
+ ----------
+
+ function Copy (Source : List) return List is
+ begin
+ return Target : List do
+ Target.Assign (Source);
+ end return;
+ end Copy;
+
------------
-- Delete --
------------
@@ -483,10 +515,24 @@ package body Ada.Containers.Doubly_Linked_Lists is
LI, RI : Cursor;
begin
- if Target'Address = Source'Address then
+
+ -- The semantics of Merge changed slightly per AI05-0021. It was
+ -- originally the case that if Target and Source denoted the same
+ -- container object, then the GNAT implementation of Merge did
+ -- nothing. However, it was argued that RM05 did not precisely
+ -- specify the semantics for this corner case. The decision of the
+ -- ARG was that if Target and Source denote the same non-empty
+ -- container object, then Program_Error is raised.
+
+ if Source.Is_Empty then
return;
end if;
+ if Target'Address = Source'Address then
+ raise Program_Error with
+ "Target and Source denote same non-empty container";
+ end if;
+
if Target.Busy > 0 then
raise Program_Error with
"attempt to tamper with cursors of Target (list is busy)";
diff --git a/gcc/ada/a-cdlili.ads b/gcc/ada/a-cdlili.ads
index d38b0d08ba3..2de03e520aa 100644
--- a/gcc/ada/a-cdlili.ads
+++ b/gcc/ada/a-cdlili.ads
@@ -90,6 +90,10 @@ package Ada.Containers.Doubly_Linked_Lists is
Position : Cursor;
Process : not null access procedure (Element : in out Element_Type));
+ procedure Assign (Target : in out List; Source : List);
+
+ function Copy (Source : List) return List;
+
procedure Move
(Target : in out List;
Source : in out List);
diff --git a/gcc/ada/a-cgaaso.adb b/gcc/ada/a-cgaaso.adb
index abb8631d55c..12763f12a67 100644
--- a/gcc/ada/a-cgaaso.adb
+++ b/gcc/ada/a-cgaaso.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2004-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 2004-2011, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -27,103 +27,21 @@
-- This unit was originally developed by Matthew J Heaney. --
------------------------------------------------------------------------------
--- This algorithm was adapted from GNAT.Heap_Sort (see g-heasor.ad[sb])
+-- This unit was originally a GNAT-specific addition to Ada 2005. A unit
+-- providing the same feature, Ada.Containers.Generic_Sort, was defined for
+-- Ada 2012. We retain Generic_Anonymous_Array_Sort for compatibility, but
+-- implement it in terms of the official unit, Generic_Sort.
-with System;
+with Ada.Containers.Generic_Sort;
procedure Ada.Containers.Generic_Anonymous_Array_Sort
(First, Last : Index_Type'Base)
is
- type T is range System.Min_Int .. System.Max_Int;
-
- function To_Index (J : T) return Index_Type;
- pragma Inline (To_Index);
-
- function Lt (J, K : T) return Boolean;
- pragma Inline (Lt);
-
- procedure Xchg (J, K : T);
- pragma Inline (Xchg);
-
- procedure Sift (S : T);
-
- --------------
- -- To_Index --
- --------------
-
- function To_Index (J : T) return Index_Type is
- K : constant T'Base := Index_Type'Pos (First) + J - T'(1);
- begin
- return Index_Type'Val (K);
- end To_Index;
-
- --------
- -- Lt --
- --------
-
- function Lt (J, K : T) return Boolean is
- begin
- return Less (To_Index (J), To_Index (K));
- end Lt;
-
- ----------
- -- Xchg --
- ----------
-
- procedure Xchg (J, K : T) is
- begin
- Swap (To_Index (J), To_Index (K));
- end Xchg;
-
- Max : T := Index_Type'Pos (Last) - Index_Type'Pos (First) + T'(1);
-
- ----------
- -- Sift --
- ----------
-
- procedure Sift (S : T) is
- C : T := S;
- Son : T;
- Father : T;
-
- begin
- loop
- Son := C + C;
-
- if Son < Max then
- if Lt (Son, Son + 1) then
- Son := Son + 1;
- end if;
- elsif Son > Max then
- exit;
- end if;
-
- Xchg (Son, C);
- C := Son;
- end loop;
-
- while C /= S loop
- Father := C / 2;
-
- if Lt (Father, C) then
- Xchg (Father, C);
- C := Father;
- else
- exit;
- end if;
- end loop;
- end Sift;
-
--- Start of processing for Generic_Anonymous_Array_Sort
+ procedure Sort is new Ada.Containers.Generic_Sort
+ (Index_Type => Index_Type,
+ Before => Less,
+ Swap => Swap);
begin
- for J in reverse 1 .. Max / 2 loop
- Sift (J);
- end loop;
-
- while Max > 1 loop
- Xchg (1, Max);
- Max := Max - 1;
- Sift (1);
- end loop;
+ Sort (First, Last);
end Ada.Containers.Generic_Anonymous_Array_Sort;
diff --git a/gcc/ada/a-cidlli.adb b/gcc/ada/a-cidlli.adb
index 849cb53c64a..dbdc6de47d4 100644
--- a/gcc/ada/a-cidlli.adb
+++ b/gcc/ada/a-cidlli.adb
@@ -171,6 +171,27 @@ package body Ada.Containers.Indefinite_Doubly_Linked_Lists is
Insert (Container, No_Element, New_Item, Count);
end Append;
+ ------------
+ -- Assign --
+ ------------
+
+ procedure Assign (Target : in out List; Source : List) is
+ Node : Node_Access;
+
+ begin
+ if Target'Address = Source'Address then
+ return;
+ end if;
+
+ Target.Clear;
+
+ Node := Source.First;
+ while Node /= null loop
+ Target.Append (Node.Element.all);
+ Node := Node.Next;
+ end loop;
+ end Assign;
+
-----------
-- Clear --
-----------
@@ -230,6 +251,17 @@ package body Ada.Containers.Indefinite_Doubly_Linked_Lists is
return Find (Container, Item) /= No_Element;
end Contains;
+ ----------
+ -- Copy --
+ ----------
+
+ function Copy (Source : List) return List is
+ begin
+ return Target : List do
+ Target.Assign (Source);
+ end return;
+ end Copy;
+
------------
-- Delete --
------------
@@ -531,10 +563,24 @@ package body Ada.Containers.Indefinite_Doubly_Linked_Lists is
LI, RI : Cursor;
begin
- if Target'Address = Source'Address then
+
+ -- The semantics of Merge changed slightly per AI05-0021. It was
+ -- originally the case that if Target and Source denoted the same
+ -- container object, then the GNAT implementation of Merge did
+ -- nothing. However, it was argued that RM05 did not precisely
+ -- specify the semantics for this corner case. The decision of the
+ -- ARG was that if Target and Source denote the same non-empty
+ -- container object, then Program_Error is raised.
+
+ if Source.Is_Empty then
return;
end if;
+ if Target'Address = Source'Address then
+ raise Program_Error with
+ "Target and Source denote same non-empty container";
+ end if;
+
if Target.Busy > 0 then
raise Program_Error with
"attempt to tamper with cursors of Target (list is busy)";
diff --git a/gcc/ada/a-cidlli.ads b/gcc/ada/a-cidlli.ads
index 8a23fc75442..c40ad30b155 100644
--- a/gcc/ada/a-cidlli.ads
+++ b/gcc/ada/a-cidlli.ads
@@ -90,6 +90,10 @@ package Ada.Containers.Indefinite_Doubly_Linked_Lists is
Position : Cursor;
Process : not null access procedure (Element : in out Element_Type));
+ procedure Assign (Target : in out List; Source : List);
+
+ function Copy (Source : List) return List;
+
procedure Move
(Target : in out List;
Source : in out List);
diff --git a/gcc/ada/a-cihama.adb b/gcc/ada/a-cihama.adb
index d4f2c1d92dc..b90c5426481 100644
--- a/gcc/ada/a-cihama.adb
+++ b/gcc/ada/a-cihama.adb
@@ -35,6 +35,8 @@ pragma Elaborate_All (Ada.Containers.Hash_Tables.Generic_Keys);
with Ada.Unchecked_Deallocation;
+with System; use type System.Address;
+
package body Ada.Containers.Indefinite_Hashed_Maps is
procedure Free_Key is
@@ -132,6 +134,41 @@ package body Ada.Containers.Indefinite_Hashed_Maps is
HT_Ops.Adjust (Container.HT);
end Adjust;
+ ------------
+ -- Assign --
+ ------------
+
+ procedure Assign (Target : in out Map; Source : Map) is
+ procedure Insert_Item (Node : Node_Access);
+ pragma Inline (Insert_Item);
+
+ procedure Insert_Items is new HT_Ops.Generic_Iteration (Insert_Item);
+
+ -----------------
+ -- Insert_Item --
+ -----------------
+
+ procedure Insert_Item (Node : Node_Access) is
+ begin
+ Target.Insert (Key => Node.Key.all, New_Item => Node.Element.all);
+ end Insert_Item;
+
+ -- Start of processing for Assign
+
+ begin
+ if Target'Address = Source'Address then
+ return;
+ end if;
+
+ Target.Clear;
+
+ if Target.Capacity < Source.Length then
+ Target.Reserve_Capacity (Source.Length);
+ end if;
+
+ Insert_Items (Target.HT);
+ end Assign;
+
--------------
-- Capacity --
--------------
@@ -159,6 +196,34 @@ package body Ada.Containers.Indefinite_Hashed_Maps is
return Find (Container, Key) /= No_Element;
end Contains;
+ ----------
+ -- Copy --
+ ----------
+
+ function Copy
+ (Source : Map;
+ Capacity : Count_Type := 0) return Map
+ is
+ C : Count_Type;
+
+ begin
+ if Capacity = 0 then
+ C := Source.Length;
+
+ elsif Capacity >= Source.Length then
+ C := Capacity;
+
+ else
+ raise Capacity_Error
+ with "Requested capacity is less than Source length";
+ end if;
+
+ return Target : Map do
+ Target.Reserve_Capacity (C);
+ Target.Assign (Source);
+ end return;
+ end Copy;
+
---------------
-- Copy_Node --
---------------
diff --git a/gcc/ada/a-cihama.ads b/gcc/ada/a-cihama.ads
index 1b16d8f4589..7c67c315583 100644
--- a/gcc/ada/a-cihama.ads
+++ b/gcc/ada/a-cihama.ads
@@ -134,6 +134,10 @@ package Ada.Containers.Indefinite_Hashed_Maps is
-- Calls Process with the key (with only a constant view) and element (with
-- a variable view) of the node designed by the cursor.
+ procedure Assign (Target : in out Map; Source : Map);
+
+ function Copy (Source : Map; Capacity : Count_Type := 0) return Map;
+
procedure Move (Target : in out Map; Source : in out Map);
-- Clears Target (if it's not empty), and then moves (not copies) the
-- buckets array and nodes from Source to Target.
diff --git a/gcc/ada/a-cihase.adb b/gcc/ada/a-cihase.adb
index e52f38bba9f..e29a204570e 100644
--- a/gcc/ada/a-cihase.adb
+++ b/gcc/ada/a-cihase.adb
@@ -173,6 +173,16 @@ package body Ada.Containers.Indefinite_Hashed_Sets is
Free_Element (X);
end Assign;
+ procedure Assign (Target : in out Set; Source : Set) is
+ begin
+ if Target'Address = Source'Address then
+ return;
+ end if;
+
+ Target.Clear;
+ Target.Union (Source);
+ end Assign;
+
--------------
-- Capacity --
--------------
@@ -200,6 +210,34 @@ package body Ada.Containers.Indefinite_Hashed_Sets is
return Find (Container, Item) /= No_Element;
end Contains;
+ ----------
+ -- Copy --
+ ----------
+
+ function Copy
+ (Source : Set;
+ Capacity : Count_Type := 0) return Set
+ is
+ C : Count_Type;
+
+ begin
+ if Capacity = 0 then
+ C := Source.Length;
+
+ elsif Capacity >= Source.Length then
+ C := Capacity;
+
+ else
+ raise Capacity_Error
+ with "Requested capacity is less than Source length";
+ end if;
+
+ return Target : Set do
+ Target.Reserve_Capacity (C);
+ Target.Assign (Source);
+ end return;
+ end Copy;
+
---------------
-- Copy_Node --
---------------
diff --git a/gcc/ada/a-cihase.ads b/gcc/ada/a-cihase.ads
index 860034469ea..33994cdeffa 100644
--- a/gcc/ada/a-cihase.ads
+++ b/gcc/ada/a-cihase.ads
@@ -153,6 +153,10 @@ package Ada.Containers.Indefinite_Hashed_Sets is
Position : Cursor)
return Constant_Reference_Type;
+ procedure Assign (Target : in out Set; Source : Set);
+
+ function Copy (Source : Set; Capacity : Count_Type := 0) return Set;
+
procedure Move (Target : in out Set; Source : in out Set);
-- Clears Target (if it's not empty), and then moves (not copies) the
-- buckets array and nodes from Source to Target.
diff --git a/gcc/ada/a-ciorma.adb b/gcc/ada/a-ciorma.adb
index 3de57c76aa4..cd95b9fd5ab 100644
--- a/gcc/ada/a-ciorma.adb
+++ b/gcc/ada/a-ciorma.adb
@@ -35,6 +35,8 @@ pragma Elaborate_All (Ada.Containers.Red_Black_Trees.Generic_Operations);
with Ada.Containers.Red_Black_Trees.Generic_Keys;
pragma Elaborate_All (Ada.Containers.Red_Black_Trees.Generic_Keys);
+with System; use type System.Address;
+
package body Ada.Containers.Indefinite_Ordered_Maps is
pragma Suppress (All_Checks);
@@ -287,6 +289,37 @@ package body Ada.Containers.Indefinite_Ordered_Maps is
Adjust (Container.Tree);
end Adjust;
+ ------------
+ -- Assign --
+ ------------
+
+ procedure Assign (Target : in out Map; Source : Map) is
+ procedure Insert_Item (Node : Node_Access);
+ pragma Inline (Insert_Item);
+
+ procedure Insert_Items is
+ new Tree_Operations.Generic_Iteration (Insert_Item);
+
+ -----------------
+ -- Insert_Item --
+ -----------------
+
+ procedure Insert_Item (Node : Node_Access) is
+ begin
+ Target.Insert (Key => Node.Key.all, New_Item => Node.Element.all);
+ end Insert_Item;
+
+ -- Start of processing for Assign
+
+ begin
+ if Target'Address = Source'Address then
+ return;
+ end if;
+
+ Target.Clear;
+ Insert_Items (Target.Tree);
+ end Assign;
+
-------------
-- Ceiling --
-------------
@@ -340,6 +373,17 @@ package body Ada.Containers.Indefinite_Ordered_Maps is
return Find (Container, Key) /= No_Element;
end Contains;
+ ----------
+ -- Copy --
+ ----------
+
+ function Copy (Source : Map) return Map is
+ begin
+ return Target : Map do
+ Target.Assign (Source);
+ end return;
+ end Copy;
+
---------------
-- Copy_Node --
---------------
diff --git a/gcc/ada/a-ciorma.ads b/gcc/ada/a-ciorma.ads
index b31dc0d2e25..1c19b81161f 100644
--- a/gcc/ada/a-ciorma.ads
+++ b/gcc/ada/a-ciorma.ads
@@ -96,6 +96,10 @@ package Ada.Containers.Indefinite_Ordered_Maps is
Process : not null access procedure (Key : Key_Type;
Element : in out Element_Type));
+ procedure Assign (Target : in out Map; Source : Map);
+
+ function Copy (Source : Map) return Map;
+
procedure Move (Target : in out Map; Source : in out Map);
procedure Insert
diff --git a/gcc/ada/a-ciormu.adb b/gcc/ada/a-ciormu.adb
index 8c7055b2fef..e11d5045135 100644
--- a/gcc/ada/a-ciormu.adb
+++ b/gcc/ada/a-ciormu.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2004-2010, Free Software Foundation, Inc. --
+-- Copyright (C) 2004-2011, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -38,6 +38,8 @@ pragma Elaborate_All (Ada.Containers.Red_Black_Trees.Generic_Keys);
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;
+
package body Ada.Containers.Indefinite_Ordered_Multisets is
-----------------------------
@@ -298,6 +300,20 @@ package body Ada.Containers.Indefinite_Ordered_Multisets is
Adjust (Container.Tree);
end Adjust;
+ ------------
+ -- Assign --
+ ------------
+
+ procedure Assign (Target : in out Set; Source : Set) is
+ begin
+ if Target'Address = Source'Address then
+ return;
+ end if;
+
+ Target.Clear;
+ Target.Union (Source);
+ end Assign;
+
-------------
-- Ceiling --
-------------
@@ -344,6 +360,17 @@ package body Ada.Containers.Indefinite_Ordered_Multisets is
return Find (Container, Item) /= No_Element;
end Contains;
+ ----------
+ -- Copy --
+ ----------
+
+ function Copy (Source : Set) return Set is
+ begin
+ return Target : Set do
+ Target.Assign (Source);
+ end return;
+ end Copy;
+
---------------
-- Copy_Node --
---------------
diff --git a/gcc/ada/a-ciormu.ads b/gcc/ada/a-ciormu.ads
index 80e21662b29..c1d81d5b753 100644
--- a/gcc/ada/a-ciormu.ads
+++ b/gcc/ada/a-ciormu.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2004-2010, Free Software Foundation, Inc. --
+-- Copyright (C) 2004-2011, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -118,6 +118,10 @@ package Ada.Containers.Indefinite_Ordered_Multisets is
-- change the value of the element while Process is executing (to "tamper
-- with elements") will raise Program_Error.
+ procedure Assign (Target : in out Set; Source : Set);
+
+ function Copy (Source : Set) return Set;
+
procedure Move (Target : in out Set; Source : in out Set);
-- If Target denotes the same object as Source, the operation does
-- nothing. If either Target or Source is busy (cursor tampering is
diff --git a/gcc/ada/a-ciorse.adb b/gcc/ada/a-ciorse.adb
index 4257f0974e6..56c33cfe670 100644
--- a/gcc/ada/a-ciorse.adb
+++ b/gcc/ada/a-ciorse.adb
@@ -38,6 +38,8 @@ pragma Elaborate_All (Ada.Containers.Red_Black_Trees.Generic_Set_Operations);
with Ada.Unchecked_Deallocation;
+with System; use type System.Address;
+
package body Ada.Containers.Indefinite_Ordered_Sets is
type Iterator is new
@@ -321,6 +323,20 @@ package body Ada.Containers.Indefinite_Ordered_Sets is
Adjust (Container.Tree);
end Adjust;
+ ------------
+ -- Assign --
+ ------------
+
+ procedure Assign (Target : in out Set; Source : Set) is
+ begin
+ if Target'Address = Source'Address then
+ return;
+ end if;
+
+ Target.Clear;
+ Target.Union (Source);
+ end Assign;
+
-------------
-- Ceiling --
-------------
@@ -363,6 +379,17 @@ package body Ada.Containers.Indefinite_Ordered_Sets is
return Find (Container, Item) /= No_Element;
end Contains;
+ ----------
+ -- Copy --
+ ----------
+
+ function Copy (Source : Set) return Set is
+ begin
+ return Target : Set do
+ Target.Assign (Source);
+ end return;
+ end Copy;
+
---------------
-- Copy_Node --
---------------
diff --git a/gcc/ada/a-ciorse.ads b/gcc/ada/a-ciorse.ads
index f397f1d464e..c0ead018bb2 100644
--- a/gcc/ada/a-ciorse.ads
+++ b/gcc/ada/a-ciorse.ads
@@ -111,6 +111,10 @@ package Ada.Containers.Indefinite_Ordered_Sets is
(Position : Cursor;
Process : not null access procedure (Element : Element_Type));
+ procedure Assign (Target : in out Set; Source : Set);
+
+ function Copy (Source : Set) return Set;
+
procedure Move (Target : in out Set; Source : in out Set);
procedure Insert
diff --git a/gcc/ada/a-cobove.adb b/gcc/ada/a-cobove.adb
index 16d465d5f0e..e78e3ce12d3 100644
--- a/gcc/ada/a-cobove.adb
+++ b/gcc/ada/a-cobove.adb
@@ -788,16 +788,26 @@ package body Ada.Containers.Bounded_Vectors is
I, J : Count_Type;
begin
- if Target.Is_Empty then
- Move (Target => Target, Source => Source);
+
+ -- The semantics of Merge changed slightly per AI05-0021. It was
+ -- originally the case that if Target and Source denoted the same
+ -- container object, then the GNAT implementation of Merge did
+ -- nothing. However, it was argued that RM05 did not precisely
+ -- specify the semantics for this corner case. The decision of the
+ -- ARG was that if Target and Source denote the same non-empty
+ -- container object, then Program_Error is raised.
+
+ if Source.Is_Empty then
return;
end if;
if Target'Address = Source'Address then
- return;
+ raise Program_Error with
+ "Target and Source denote same non-empty container";
end if;
- if Source.Is_Empty then
+ if Target.Is_Empty then
+ Move (Target => Target, Source => Source);
return;
end if;
diff --git a/gcc/ada/a-cogeso.adb b/gcc/ada/a-cogeso.adb
new file mode 100644
index 00000000000..fc2198cb4b1
--- /dev/null
+++ b/gcc/ada/a-cogeso.adb
@@ -0,0 +1,127 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT LIBRARY COMPONENTS --
+-- --
+-- ADA.CONTAINERS.GENERIC_SORT --
+-- --
+-- B o d y --
+-- --
+-- Copyright (C) 2011, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception under Section 7 of GPL version 3, you are granted --
+-- additional permissions described in the GCC Runtime Library Exception, --
+-- version 3.1, as published by the Free Software Foundation. --
+-- --
+-- You should have received a copy of the GNU General Public License and --
+-- a copy of the GCC Runtime Library Exception along with this program; --
+-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
+-- <http://www.gnu.org/licenses/>. --
+-- --
+-- This unit was originally developed by Matthew J Heaney. --
+------------------------------------------------------------------------------
+
+-- 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;
+
+ function To_Index (J : T) return Index_Type;
+ pragma Inline (To_Index);
+
+ function Lt (J, K : T) return Boolean;
+ pragma Inline (Lt);
+
+ procedure Xchg (J, K : T);
+ pragma Inline (Xchg);
+
+ procedure Sift (S : T);
+
+ --------------
+ -- To_Index --
+ --------------
+
+ function To_Index (J : T) return Index_Type is
+ K : constant T'Base := Index_Type'Pos (First) + J - T'(1);
+ begin
+ return Index_Type'Val (K);
+ end To_Index;
+
+ --------
+ -- Lt --
+ --------
+
+ function Lt (J, K : T) return Boolean is
+ begin
+ return Before (To_Index (J), To_Index (K));
+ end Lt;
+
+ ----------
+ -- Xchg --
+ ----------
+
+ procedure Xchg (J, K : T) is
+ begin
+ Swap (To_Index (J), To_Index (K));
+ end Xchg;
+
+ Max : T := Index_Type'Pos (Last) - Index_Type'Pos (First) + T'(1);
+
+ ----------
+ -- Sift --
+ ----------
+
+ procedure Sift (S : T) is
+ C : T := S;
+ Son : T;
+ Father : T;
+
+ begin
+ loop
+ Son := C + C;
+
+ if Son < Max then
+ if Lt (Son, Son + 1) then
+ Son := Son + 1;
+ end if;
+ elsif Son > Max then
+ exit;
+ end if;
+
+ Xchg (Son, C);
+ C := Son;
+ end loop;
+
+ while C /= S loop
+ Father := C / 2;
+
+ if Lt (Father, C) then
+ Xchg (Father, C);
+ C := Father;
+ else
+ exit;
+ end if;
+ end loop;
+ end Sift;
+
+-- Start of processing for Generic_Sort
+
+begin
+ for J in reverse 1 .. Max / 2 loop
+ Sift (J);
+ end loop;
+
+ while Max > 1 loop
+ Xchg (1, Max);
+ Max := Max - 1;
+ Sift (1);
+ end loop;
+end Ada.Containers.Generic_Sort;
diff --git a/gcc/ada/a-cogeso.ads b/gcc/ada/a-cogeso.ads
new file mode 100644
index 00000000000..ebf805ab79f
--- /dev/null
+++ b/gcc/ada/a-cogeso.ads
@@ -0,0 +1,40 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT LIBRARY COMPONENTS --
+-- --
+-- ADA.CONTAINERS.GENERIC_SORT --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 2011, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception under Section 7 of GPL version 3, you are granted --
+-- additional permissions described in the GCC Runtime Library Exception, --
+-- version 3.1, as published by the Free Software Foundation. --
+-- --
+-- You should have received a copy of the GNU General Public License and --
+-- a copy of the GCC Runtime Library Exception along with this program; --
+-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
+-- <http://www.gnu.org/licenses/>. --
+-- --
+-- This unit was originally developed by Matthew J Heaney. --
+------------------------------------------------------------------------------
+
+-- Allows an anonymous array (or array-like container) to be sorted. Generic
+-- formal Before returns the result of comparing the elements designated by
+-- the indexes, and generic formal Swap exchanges the designated elements.
+
+generic
+ type Index_Type is (<>);
+ with function Before (Left, Right : Index_Type) return Boolean;
+ with procedure Swap (Left, Right : Index_Type);
+
+procedure Ada.Containers.Generic_Sort (First, Last : Index_Type'Base);
+pragma Pure (Ada.Containers.Generic_Sort);
diff --git a/gcc/ada/a-cohama.adb b/gcc/ada/a-cohama.adb
index c06ba9e35e4..351030d3a7b 100644
--- a/gcc/ada/a-cohama.adb
+++ b/gcc/ada/a-cohama.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2004-2010, Free Software Foundation, Inc. --
+-- Copyright (C) 2004-2011, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -35,6 +35,8 @@ pragma Elaborate_All (Ada.Containers.Hash_Tables.Generic_Operations);
with Ada.Containers.Hash_Tables.Generic_Keys;
pragma Elaborate_All (Ada.Containers.Hash_Tables.Generic_Keys);
+with System; use type System.Address;
+
package body Ada.Containers.Hashed_Maps is
type Iterator is new
@@ -131,6 +133,41 @@ package body Ada.Containers.Hashed_Maps is
HT_Ops.Adjust (Container.HT);
end Adjust;
+ ------------
+ -- Assign --
+ ------------
+
+ procedure Assign (Target : in out Map; Source : Map) is
+ procedure Insert_Item (Node : Node_Access);
+ pragma Inline (Insert_Item);
+
+ procedure Insert_Items is new HT_Ops.Generic_Iteration (Insert_Item);
+
+ -----------------
+ -- Insert_Item --
+ -----------------
+
+ procedure Insert_Item (Node : Node_Access) is
+ begin
+ Target.Insert (Key => Node.Key, New_Item => Node.Element);
+ end Insert_Item;
+
+ -- Start of processing for Assign
+
+ begin
+ if Target'Address = Source'Address then
+ return;
+ end if;
+
+ Target.Clear;
+
+ if Target.Capacity < Source.Length then
+ Target.Reserve_Capacity (Source.Length);
+ end if;
+
+ Insert_Items (Target.HT);
+ end Assign;
+
--------------
-- Capacity --
--------------
@@ -158,6 +195,34 @@ package body Ada.Containers.Hashed_Maps is
return Find (Container, Key) /= No_Element;
end Contains;
+ ----------
+ -- Copy --
+ ----------
+
+ function Copy
+ (Source : Map;
+ Capacity : Count_Type := 0) return Map
+ is
+ C : Count_Type;
+
+ begin
+ if Capacity = 0 then
+ C := Source.Length;
+
+ elsif Capacity >= Source.Length then
+ C := Capacity;
+
+ else
+ raise Capacity_Error
+ with "Requested capacity is less than Source length";
+ end if;
+
+ return Target : Map do
+ Target.Reserve_Capacity (C);
+ Target.Assign (Source);
+ end return;
+ end Copy;
+
---------------
-- Copy_Node --
---------------
@@ -780,14 +845,36 @@ package body Ada.Containers.Hashed_Maps is
-- Reference --
---------------
- function Constant_Reference (Container : Map; Key : Key_Type)
- return Constant_Reference_Type is
+ function Constant_Reference
+ (Container : aliased Map;
+ Position : Cursor) return Constant_Reference_Type
+ is
+ pragma Unreferenced (Container);
+ begin
+ return (Element => Element (Position)'Unrestricted_Access);
+ end Constant_Reference;
+
+ function Reference
+ (Container : aliased in out Map;
+ Position : Cursor) return Reference_Type
+ is
+ pragma Unreferenced (Container);
+ begin
+ return (Element => Element (Position)'Unrestricted_Access);
+ end Reference;
+
+ function Constant_Reference
+ (Container : aliased Map;
+ Key : Key_Type) return Constant_Reference_Type
+ is
begin
return (Element => Container.Element (Key)'Unrestricted_Access);
end Constant_Reference;
- function Reference (Container : Map; Key : Key_Type)
- return Reference_Type is
+ function Reference
+ (Container : aliased in out Map;
+ Key : Key_Type) return Reference_Type
+ is
begin
return (Element => Container.Element (Key)'Unrestricted_Access);
end Reference;
diff --git a/gcc/ada/a-cohama.ads b/gcc/ada/a-cohama.ads
index 0d614bd4f8f..5f01994e8ad 100644
--- a/gcc/ada/a-cohama.ads
+++ b/gcc/ada/a-cohama.ads
@@ -148,6 +148,10 @@ package Ada.Containers.Hashed_Maps is
-- Calls Process with the key (with only a constant view) and element (with
-- a variable view) of the node designed by the cursor.
+ procedure Assign (Target : in out Map; Source : Map);
+
+ function Copy (Source : Map; Capacity : Count_Type := 0) return Map;
+
procedure Move (Target : in out Map; Source : in out Map);
-- Clears Target (if it's not empty), and then moves (not copies) the
-- buckets array and nodes from Source to Target.
@@ -307,19 +311,28 @@ package Ada.Containers.Hashed_Maps is
for Reference_Type'Read use Read;
function Constant_Reference
- (Container : Map; Key : Key_Type) -- SHOULD BE ALIASED
- return Constant_Reference_Type;
+ (Container : aliased Map;
+ Position : Cursor) return Constant_Reference_Type;
+
+ function Reference
+ (Container : aliased in out Map;
+ Position : Cursor) return Reference_Type;
+
+ function Constant_Reference
+ (Container : aliased Map;
+ Key : Key_Type) return Constant_Reference_Type;
- function Reference (Container : Map; Key : Key_Type)
- return Reference_Type;
+ function Reference
+ (Container : aliased in out Map;
+ Key : Key_Type) return Reference_Type;
procedure Iterate
(Container : Map;
Process : not null access procedure (Position : Cursor));
-- Calls Process for each node in the map
- function Iterate (Container : Map)
- return Map_Iterator_Interfaces.Forward_Iterator'class;
+ function Iterate
+ (Container : Map) return Map_Iterator_Interfaces.Forward_Iterator'class;
private
pragma Inline ("=");
diff --git a/gcc/ada/a-cohase.adb b/gcc/ada/a-cohase.adb
index 643dde5d964..e0b2345234b 100644
--- a/gcc/ada/a-cohase.adb
+++ b/gcc/ada/a-cohase.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2004-2010, Free Software Foundation, Inc. --
+-- Copyright (C) 2004-2011, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -159,6 +159,16 @@ package body Ada.Containers.Hashed_Sets is
Node.Element := Item;
end Assign;
+ procedure Assign (Target : in out Set; Source : Set) is
+ begin
+ if Target'Address = Source'Address then
+ return;
+ end if;
+
+ Target.Clear;
+ Target.Union (Source);
+ end Assign;
+
--------------
-- Capacity --
--------------
@@ -186,6 +196,34 @@ package body Ada.Containers.Hashed_Sets is
return Find (Container, Item) /= No_Element;
end Contains;
+ ----------
+ -- Copy --
+ ----------
+
+ function Copy
+ (Source : Set;
+ Capacity : Count_Type := 0) return Set
+ is
+ C : Count_Type;
+
+ begin
+ if Capacity = 0 then
+ C := Source.Length;
+
+ elsif Capacity >= Source.Length then
+ C := Capacity;
+
+ else
+ raise Capacity_Error
+ with "Requested capacity is less than Source length";
+ end if;
+
+ return Target : Set do
+ Target.Reserve_Capacity (C);
+ Target.Assign (Source);
+ end return;
+ end Copy;
+
---------------
-- Copy_Node --
---------------
diff --git a/gcc/ada/a-cohase.ads b/gcc/ada/a-cohase.ads
index a262dded097..0bb370bfe83 100644
--- a/gcc/ada/a-cohase.ads
+++ b/gcc/ada/a-cohase.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2004-2010, Free Software Foundation, Inc. --
+-- Copyright (C) 2004-2011, 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 --
@@ -133,6 +133,10 @@ package Ada.Containers.Hashed_Sets is
-- Calls Process with the element (having only a constant view) of the node
-- designed by the cursor.
+ procedure Assign (Target : in out Set; Source : Set);
+
+ function Copy (Source : Set; Capacity : Count_Type := 0) return Set;
+
procedure Move (Target : in out Set; Source : in out Set);
-- Clears Target (if it's not empty), and then moves (not copies) the
-- buckets array and nodes from Source to Target.
diff --git a/gcc/ada/a-coinve.adb b/gcc/ada/a-coinve.adb
index 3172bd2c7b5..e35f2f781de 100644
--- a/gcc/ada/a-coinve.adb
+++ b/gcc/ada/a-coinve.adb
@@ -616,6 +616,20 @@ package body Ada.Containers.Indefinite_Vectors is
Count);
end Append;
+ ------------
+ -- Assign --
+ ------------
+
+ procedure Assign (Target : in out Vector; Source : Vector) is
+ begin
+ if Target'Address = Source'Address then
+ return;
+ end if;
+
+ Target.Clear;
+ Target.Append (Source);
+ end Assign;
+
--------------
-- Capacity --
--------------
@@ -698,6 +712,34 @@ package body Ada.Containers.Indefinite_Vectors is
return Find_Index (Container, Item) /= No_Index;
end Contains;
+ ----------
+ -- Copy --
+ ----------
+
+ function Copy
+ (Source : Vector;
+ Capacity : Count_Type := 0) return Vector
+ is
+ C : Count_Type;
+
+ begin
+ if Capacity = 0 then
+ C := Source.Length;
+
+ elsif Capacity >= Source.Length then
+ C := Capacity;
+
+ else
+ raise Capacity_Error
+ with "Requested capacity is less than Source length";
+ end if;
+
+ return Target : Vector do
+ Target.Reserve_Capacity (C);
+ Target.Assign (Source);
+ end return;
+ end Copy;
+
------------
-- Delete --
------------
@@ -1226,16 +1268,26 @@ package body Ada.Containers.Indefinite_Vectors is
I, J : Index_Type'Base;
begin
- if Target.Last < Index_Type'First then
- Move (Target => Target, Source => Source);
+
+ -- The semantics of Merge changed slightly per AI05-0021. It was
+ -- originally the case that if Target and Source denoted the same
+ -- container object, then the GNAT implementation of Merge did
+ -- nothing. However, it was argued that RM05 did not precisely
+ -- specify the semantics for this corner case. The decision of the
+ -- ARG was that if Target and Source denote the same non-empty
+ -- container object, then Program_Error is raised.
+
+ if Source.Last < Index_Type'First then -- Source is empty
return;
end if;
if Target'Address = Source'Address then
- return;
+ raise Program_Error with
+ "Target and Source denote same non-empty container";
end if;
- if Source.Last < Index_Type'First then
+ if Target.Last < Index_Type'First then -- Target is empty
+ Move (Target => Target, Source => Source);
return;
end if;
diff --git a/gcc/ada/a-coinve.ads b/gcc/ada/a-coinve.ads
index a13003819b0..06568278997 100644
--- a/gcc/ada/a-coinve.ads
+++ b/gcc/ada/a-coinve.ads
@@ -204,6 +204,10 @@ package Ada.Containers.Indefinite_Vectors is
Position : Cursor;
Process : not null access procedure (Element : in out Element_Type));
+ procedure Assign (Target : in out Vector; Source : Vector);
+
+ function Copy (Source : Vector; Capacity : Count_Type := 0) return Vector;
+
procedure Move (Target : in out Vector; Source : in out Vector);
procedure Insert
diff --git a/gcc/ada/a-convec.adb b/gcc/ada/a-convec.adb
index a57f7fbd9a8..79071810182 100644
--- a/gcc/ada/a-convec.adb
+++ b/gcc/ada/a-convec.adb
@@ -432,6 +432,20 @@ package body Ada.Containers.Vectors is
Count);
end Append;
+ ------------
+ -- Assign --
+ ------------
+
+ procedure Assign (Target : in out Vector; Source : Vector) is
+ begin
+ if Target'Address = Source'Address then
+ return;
+ end if;
+
+ Target.Clear;
+ Target.Append (Source);
+ end Assign;
+
--------------
-- Capacity --
--------------
@@ -471,6 +485,34 @@ package body Ada.Containers.Vectors is
return Find_Index (Container, Item) /= No_Index;
end Contains;
+ ----------
+ -- Copy --
+ ----------
+
+ function Copy
+ (Source : Vector;
+ Capacity : Count_Type := 0) return Vector
+ is
+ C : Count_Type;
+
+ begin
+ if Capacity = 0 then
+ C := Source.Length;
+
+ elsif Capacity >= Source.Length then
+ C := Capacity;
+
+ else
+ raise Capacity_Error
+ with "Requested capacity is less than Source length";
+ end if;
+
+ return Target : Vector do
+ Target.Reserve_Capacity (C);
+ Target.Assign (Source);
+ end return;
+ end Copy;
+
------------
-- Delete --
------------
@@ -867,16 +909,26 @@ package body Ada.Containers.Vectors is
J : Index_Type'Base;
begin
- if Target.Last < Index_Type'First then
- Move (Target => Target, Source => Source);
+
+ -- The semantics of Merge changed slightly per AI05-0021. It was
+ -- originally the case that if Target and Source denoted the same
+ -- container object, then the GNAT implementation of Merge did
+ -- nothing. However, it was argued that RM05 did not precisely
+ -- specify the semantics for this corner case. The decision of the
+ -- ARG was that if Target and Source denote the same non-empty
+ -- container object, then Program_Error is raised.
+
+ if Source.Last < Index_Type'First then -- Source is empty
return;
end if;
if Target'Address = Source'Address then
- return;
+ raise Program_Error with
+ "Target and Source denote same non-empty container";
end if;
- if Source.Last < Index_Type'First then
+ if Target.Last < Index_Type'First then -- Target is empty
+ Move (Target => Target, Source => Source);
return;
end if;
diff --git a/gcc/ada/a-convec.ads b/gcc/ada/a-convec.ads
index c90cf01bde9..9eb82c791fe 100644
--- a/gcc/ada/a-convec.ads
+++ b/gcc/ada/a-convec.ads
@@ -202,7 +202,12 @@ package Ada.Containers.Vectors is
function Reference (Container : Vector; Position : Index_Type)
return Reference_Type;
+ procedure Assign (Target : in out Vector; Source : Vector);
+
+ function Copy (Source : Vector; Capacity : Count_Type := 0) return Vector;
+
procedure Move (Target : in out Vector; Source : in out Vector);
+
procedure Insert
(Container : in out Vector;
Before : Extended_Index;
diff --git a/gcc/ada/a-coorma.adb b/gcc/ada/a-coorma.adb
index c1ae68297b3..e8099c3c297 100644
--- a/gcc/ada/a-coorma.adb
+++ b/gcc/ada/a-coorma.adb
@@ -35,6 +35,8 @@ pragma Elaborate_All (Ada.Containers.Red_Black_Trees.Generic_Operations);
with Ada.Containers.Red_Black_Trees.Generic_Keys;
pragma Elaborate_All (Ada.Containers.Red_Black_Trees.Generic_Keys);
+with System; use type System.Address;
+
package body Ada.Containers.Ordered_Maps is
type Iterator is new
@@ -248,6 +250,37 @@ package body Ada.Containers.Ordered_Maps is
Adjust (Container.Tree);
end Adjust;
+ ------------
+ -- Assign --
+ ------------
+
+ procedure Assign (Target : in out Map; Source : Map) is
+ procedure Insert_Item (Node : Node_Access);
+ pragma Inline (Insert_Item);
+
+ procedure Insert_Items is
+ new Tree_Operations.Generic_Iteration (Insert_Item);
+
+ -----------------
+ -- Insert_Item --
+ -----------------
+
+ procedure Insert_Item (Node : Node_Access) is
+ begin
+ Target.Insert (Key => Node.Key, New_Item => Node.Element);
+ end Insert_Item;
+
+ -- Start of processing for Assign
+
+ begin
+ if Target'Address = Source'Address then
+ return;
+ end if;
+
+ Target.Clear;
+ Insert_Items (Target.Tree);
+ end Assign;
+
-------------
-- Ceiling --
-------------
@@ -304,6 +337,17 @@ package body Ada.Containers.Ordered_Maps is
return Find (Container, Key) /= No_Element;
end Contains;
+ ----------
+ -- Copy --
+ ----------
+
+ function Copy (Source : Map) return Map is
+ begin
+ return Target : Map do
+ Target.Assign (Source);
+ end return;
+ end Copy;
+
---------------
-- Copy_Node --
---------------
diff --git a/gcc/ada/a-coorma.ads b/gcc/ada/a-coorma.ads
index 6fd45b78253..53942b71fa2 100644
--- a/gcc/ada/a-coorma.ads
+++ b/gcc/ada/a-coorma.ads
@@ -96,6 +96,10 @@ package Ada.Containers.Ordered_Maps is
Process : not null access
procedure (Key : Key_Type; Element : in out Element_Type));
+ procedure Assign (Target : in out Map; Source : Map);
+
+ function Copy (Source : Map) return Map;
+
procedure Move (Target : in out Map; Source : in out Map);
procedure Insert
diff --git a/gcc/ada/a-coormu.adb b/gcc/ada/a-coormu.adb
index b59f6f554ef..2ed14819243 100644
--- a/gcc/ada/a-coormu.adb
+++ b/gcc/ada/a-coormu.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2004-2010, Free Software Foundation, Inc. --
+-- Copyright (C) 2004-2011, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -38,6 +38,8 @@ pragma Elaborate_All (Ada.Containers.Red_Black_Trees.Generic_Keys);
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;
+
package body Ada.Containers.Ordered_Multisets is
-----------------------------
@@ -266,6 +268,20 @@ package body Ada.Containers.Ordered_Multisets is
Adjust (Container.Tree);
end Adjust;
+ ------------
+ -- Assign --
+ ------------
+
+ procedure Assign (Target : in out Set; Source : Set) is
+ begin
+ if Target'Address = Source'Address then
+ return;
+ end if;
+
+ Target.Clear;
+ Target.Union (Source);
+ end Assign;
+
-------------
-- Ceiling --
-------------
@@ -312,6 +328,17 @@ package body Ada.Containers.Ordered_Multisets is
return Find (Container, Item) /= No_Element;
end Contains;
+ ----------
+ -- Copy --
+ ----------
+
+ function Copy (Source : Set) return Set is
+ begin
+ return Target : Set do
+ Target.Assign (Source);
+ end return;
+ end Copy;
+
---------------
-- Copy_Node --
---------------
diff --git a/gcc/ada/a-coormu.ads b/gcc/ada/a-coormu.ads
index bcc6eb5e9b8..6f9e3d0b2d8 100644
--- a/gcc/ada/a-coormu.ads
+++ b/gcc/ada/a-coormu.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2004-2010, Free Software Foundation, Inc. --
+-- Copyright (C) 2004-2011, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -117,6 +117,10 @@ package Ada.Containers.Ordered_Multisets is
-- change the value of the element while Process is executing (to "tamper
-- with elements") will raise Program_Error.
+ procedure Assign (Target : in out Set; Source : Set);
+
+ function Copy (Source : Set) return Set;
+
procedure Move (Target : in out Set; Source : in out Set);
-- If Target denotes the same object as Source, the operation does
-- nothing. If either Target or Source is busy (cursor tampering is
diff --git a/gcc/ada/a-coorse.adb b/gcc/ada/a-coorse.adb
index 915eed62117..4c6476864b8 100644
--- a/gcc/ada/a-coorse.adb
+++ b/gcc/ada/a-coorse.adb
@@ -38,6 +38,8 @@ pragma Elaborate_All (Ada.Containers.Red_Black_Trees.Generic_Keys);
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;
+
package body Ada.Containers.Ordered_Sets is
type Iterator is new
@@ -281,6 +283,20 @@ package body Ada.Containers.Ordered_Sets is
Adjust (Container.Tree);
end Adjust;
+ ------------
+ -- Assign --
+ ------------
+
+ procedure Assign (Target : in out Set; Source : Set) is
+ begin
+ if Target'Address = Source'Address then
+ return;
+ end if;
+
+ Target.Clear;
+ Target.Union (Source);
+ end Assign;
+
-------------
-- Ceiling --
-------------
@@ -325,6 +341,17 @@ package body Ada.Containers.Ordered_Sets is
return Find (Container, Item) /= No_Element;
end Contains;
+ ----------
+ -- Copy --
+ ----------
+
+ function Copy (Source : Set) return Set is
+ begin
+ return Target : Set do
+ Target.Assign (Source);
+ end return;
+ end Copy;
+
---------------
-- Copy_Node --
---------------
diff --git a/gcc/ada/a-coorse.ads b/gcc/ada/a-coorse.ads
index 8349ef85fb4..45e6ab90a73 100644
--- a/gcc/ada/a-coorse.ads
+++ b/gcc/ada/a-coorse.ads
@@ -113,6 +113,10 @@ package Ada.Containers.Ordered_Sets is
(Position : Cursor;
Process : not null access procedure (Element : Element_Type));
+ procedure Assign (Target : in out Set; Source : Set);
+
+ function Copy (Source : Set) return Set;
+
procedure Move (Target : in out Set; Source : in out Set);
procedure Insert
diff --git a/gcc/ada/i-forbla-darwin.adb b/gcc/ada/a-sbecin.adb
index 825a8840414..78000176844 100644
--- a/gcc/ada/i-forbla-darwin.adb
+++ b/gcc/ada/a-sbecin.adb
@@ -1,12 +1,12 @@
------------------------------------------------------------------------------
-- --
--- GNAT RUN-TIME COMPONENTS --
+-- GNAT LIBRARY COMPONENTS --
-- --
--- I N T E R F A C E S . F O R T R A N . B L A S --
+-- ADA.STRINGS.BOUNDED.EQUAL_CASE_INSENSITIVE --
-- --
--- B o d y --
+-- B o d y --
-- --
--- Copyright (C) 2006-2010, Free Software Foundation, Inc. --
+-- Copyright (C) 2011, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -24,15 +24,17 @@
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.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 was originally developed by Matthew J Heaney. --
------------------------------------------------------------------------------
--- Version for Mac OS X
+with Ada.Strings.Equal_Case_Insensitive;
-package body Interfaces.Fortran.BLAS is
- pragma Linker_Options ("-lgnala");
- pragma Linker_Options ("-lm");
- pragma Linker_Options ("-Wl,-framework,vecLib");
-end Interfaces.Fortran.BLAS;
+function Ada.Strings.Bounded.Equal_Case_Insensitive
+ (Left, Right : Bounded.Bounded_String)
+ return Boolean
+is
+begin
+ return Ada.Strings.Equal_Case_Insensitive
+ (Left => Bounded.To_String (Left),
+ Right => Bounded.To_String (Right));
+end Ada.Strings.Bounded.Equal_Case_Insensitive;
diff --git a/gcc/ada/i-forbla.adb b/gcc/ada/a-sbecin.ads
index 4445c5124cb..115c7220606 100644
--- a/gcc/ada/i-forbla.adb
+++ b/gcc/ada/a-sbecin.ads
@@ -1,12 +1,16 @@
------------------------------------------------------------------------------
-- --
--- GNAT RUN-TIME COMPONENTS --
+-- GNAT LIBRARY COMPONENTS --
-- --
--- I N T E R F A C E S . F O R T R A N . B L A S --
+-- ADA.STRINGS.BOUNDED.EQUAL_CASE_INSENSITIVE --
-- --
--- B o d y --
+-- S p e c --
-- --
--- Copyright (C) 2006-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 2011, 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 contents of the part following the private keyword. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -24,19 +28,15 @@
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.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 was originally developed by Matthew J Heaney. --
------------------------------------------------------------------------------
--- This Interfaces.Fortran.Blas package body contains the required linker
--- pragmas for automatically linking with the LAPACK linear algebra support
--- library, and the systems math library. Alternative bodies can be supplied
--- if different sets of libraries are needed.
+generic
+ with package Bounded is
+ new Ada.Strings.Bounded.Generic_Bounded_Length (<>);
+
+function Ada.Strings.Bounded.Equal_Case_Insensitive
+ (Left, Right : Bounded.Bounded_String)
+ return Boolean;
-package body Interfaces.Fortran.BLAS is
- pragma Linker_Options ("-lgnala");
- pragma Linker_Options ("-llapack");
- pragma Linker_Options ("-lblas");
- pragma Linker_Options ("-lm");
-end Interfaces.Fortran.BLAS;
+pragma Preelaborate (Ada.Strings.Bounded.Equal_Case_Insensitive);
diff --git a/gcc/ada/a-sbhcin.adb b/gcc/ada/a-sbhcin.adb
new file mode 100644
index 00000000000..8c69290e0d0
--- /dev/null
+++ b/gcc/ada/a-sbhcin.adb
@@ -0,0 +1,38 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT LIBRARY COMPONENTS --
+-- --
+-- ADA.STRINGS.BOUNDED.HASH_CASE_INSENSITIVE --
+-- --
+-- B o d y --
+-- --
+-- Copyright (C) 2011, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception under Section 7 of GPL version 3, you are granted --
+-- additional permissions described in the GCC Runtime Library Exception, --
+-- version 3.1, as published by the Free Software Foundation. --
+-- --
+-- You should have received a copy of the GNU General Public License and --
+-- a copy of the GCC Runtime Library Exception along with this program; --
+-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
+-- <http://www.gnu.org/licenses/>. --
+-- --
+-- This unit was originally developed by Matthew J Heaney. --
+------------------------------------------------------------------------------
+
+with Ada.Strings.Hash_Case_Insensitive;
+
+function Ada.Strings.Bounded.Hash_Case_Insensitive
+ (Key : Bounded.Bounded_String)
+ return Containers.Hash_Type
+is
+begin
+ return Ada.Strings.Hash_Case_Insensitive (Bounded.To_String (Key));
+end Ada.Strings.Bounded.Hash_Case_Insensitive;
diff --git a/gcc/ada/i-forbla-unimplemented.ads b/gcc/ada/a-sbhcin.ads
index deea344bbf2..c291f53db9a 100644
--- a/gcc/ada/i-forbla-unimplemented.ads
+++ b/gcc/ada/a-sbhcin.ads
@@ -1,12 +1,16 @@
------------------------------------------------------------------------------
-- --
--- GNAT RUN-TIME COMPONENTS --
+-- GNAT LIBRARY COMPONENTS --
-- --
--- I N T E R F A C E S . F O R T R A N . B L A S --
+-- ADA.STRINGS.BOUNDED.HASH_CASE_INSENSITIVE --
-- --
-- S p e c --
-- --
--- Copyright (C) 2006-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 2011, 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 contents of the part following the private keyword. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -24,22 +28,17 @@
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.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 was originally developed by Matthew J Heaney. --
------------------------------------------------------------------------------
--- This package provides a thin binding to the standard Fortran BLAS library.
--- Documentation and a reference BLAS implementation is available from
--- ftp://ftp.netlib.org. The main purpose of this package is to facilitate
--- implementation of the Ada 2005 Ada.Numerics.Generic_Real_Arrays and
--- Ada.Numerics.Generic_Complex_Arrays packages. Bindings to other BLAS
--- routines may be added over time.
-
--- This unit is not implemented in this GNAT configuration
+with Ada.Containers;
-package Interfaces.Fortran.BLAS is
+generic
+ with package Bounded is
+ new Ada.Strings.Bounded.Generic_Bounded_Length (<>);
- pragma Unimplemented_Unit;
+function Ada.Strings.Bounded.Hash_Case_Insensitive
+ (Key : Bounded.Bounded_String)
+ return Containers.Hash_Type;
-end Interfaces.Fortran.BLAS;
+pragma Preelaborate (Ada.Strings.Bounded.Hash_Case_Insensitive);
diff --git a/gcc/ada/a-sblcin.adb b/gcc/ada/a-sblcin.adb
new file mode 100644
index 00000000000..e2ce4d3f384
--- /dev/null
+++ b/gcc/ada/a-sblcin.adb
@@ -0,0 +1,40 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT LIBRARY COMPONENTS --
+-- --
+-- ADA.STRINGS.BOUNDED.LESS_CASE_INSENSITIVE --
+-- --
+-- B o d y --
+-- --
+-- Copyright (C) 2011, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception under Section 7 of GPL version 3, you are granted --
+-- additional permissions described in the GCC Runtime Library Exception, --
+-- version 3.1, as published by the Free Software Foundation. --
+-- --
+-- You should have received a copy of the GNU General Public License and --
+-- a copy of the GCC Runtime Library Exception along with this program; --
+-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
+-- <http://www.gnu.org/licenses/>. --
+-- --
+-- This unit was originally developed by Matthew J Heaney. --
+------------------------------------------------------------------------------
+
+with Ada.Strings.Less_Case_Insensitive;
+
+function Ada.Strings.Bounded.Less_Case_Insensitive
+ (Left, Right : Bounded.Bounded_String)
+ return Boolean
+is
+begin
+ return Ada.Strings.Less_Case_Insensitive
+ (Left => Bounded.To_String (Left),
+ Right => Bounded.To_String (Right));
+end Ada.Strings.Bounded.Less_Case_Insensitive;
diff --git a/gcc/ada/a-sblcin.ads b/gcc/ada/a-sblcin.ads
new file mode 100644
index 00000000000..d7284110aef
--- /dev/null
+++ b/gcc/ada/a-sblcin.ads
@@ -0,0 +1,42 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT LIBRARY COMPONENTS --
+-- --
+-- ADA.STRINGS.BOUNDED.LESS_CASE_INSENSITIVE --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 2011, 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 contents of the part following the private keyword. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception under Section 7 of GPL version 3, you are granted --
+-- additional permissions described in the GCC Runtime Library Exception, --
+-- version 3.1, as published by the Free Software Foundation. --
+-- --
+-- You should have received a copy of the GNU General Public License and --
+-- a copy of the GCC Runtime Library Exception along with this program; --
+-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
+-- <http://www.gnu.org/licenses/>. --
+-- --
+-- This unit was originally developed by Matthew J Heaney. --
+------------------------------------------------------------------------------
+
+generic
+ with package Bounded is
+ new Ada.Strings.Bounded.Generic_Bounded_Length (<>);
+
+function Ada.Strings.Bounded.Less_Case_Insensitive
+ (Left, Right : Bounded.Bounded_String)
+ return Boolean;
+
+pragma Preelaborate (Ada.Strings.Bounded.Less_Case_Insensitive);
diff --git a/gcc/ada/a-sfecin.ads b/gcc/ada/a-sfecin.ads
new file mode 100644
index 00000000000..592b69166c9
--- /dev/null
+++ b/gcc/ada/a-sfecin.ads
@@ -0,0 +1,40 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT LIBRARY COMPONENTS --
+-- --
+-- ADA.STRINGS.FIXED.EQUAL_CASE_INSENSITIVE --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 2011, 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 contents of the part following the private keyword. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception under Section 7 of GPL version 3, you are granted --
+-- additional permissions described in the GCC Runtime Library Exception, --
+-- version 3.1, as published by the Free Software Foundation. --
+-- --
+-- You should have received a copy of the GNU General Public License and --
+-- a copy of the GCC Runtime Library Exception along with this program; --
+-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
+-- <http://www.gnu.org/licenses/>. --
+-- --
+-- This unit was originally developed by Matthew J Heaney. --
+------------------------------------------------------------------------------
+
+with Ada.Strings.Equal_Case_Insensitive;
+
+function Ada.Strings.Fixed.Equal_Case_Insensitive
+ (Left, Right : String)
+ return Boolean renames Ada.Strings.Equal_Case_Insensitive;
+
+pragma Pure (Ada.Strings.Fixed.Equal_Case_Insensitive);
diff --git a/gcc/ada/a-sfhcin.ads b/gcc/ada/a-sfhcin.ads
new file mode 100644
index 00000000000..86f60f68944
--- /dev/null
+++ b/gcc/ada/a-sfhcin.ads
@@ -0,0 +1,41 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT LIBRARY COMPONENTS --
+-- --
+-- ADA.STRINGS.FIXED.HASH_CASE_INSENSITIVE --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 2011, 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 contents of the part following the private keyword. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception under Section 7 of GPL version 3, you are granted --
+-- additional permissions described in the GCC Runtime Library Exception, --
+-- version 3.1, as published by the Free Software Foundation. --
+-- --
+-- You should have received a copy of the GNU General Public License and --
+-- a copy of the GCC Runtime Library Exception along with this program; --
+-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
+-- <http://www.gnu.org/licenses/>. --
+-- --
+-- This unit was originally developed by Matthew J Heaney. --
+------------------------------------------------------------------------------
+
+with Ada.Containers;
+with Ada.Strings.Hash_Case_Insensitive;
+
+function Ada.Strings.Fixed.Hash_Case_Insensitive
+ (Key : String)
+ return Containers.Hash_Type renames Ada.Strings.Hash_Case_Insensitive;
+
+pragma Pure (Ada.Strings.Fixed.Hash_Case_Insensitive);
diff --git a/gcc/ada/a-sflcin.ads b/gcc/ada/a-sflcin.ads
new file mode 100644
index 00000000000..8af21fe9e55
--- /dev/null
+++ b/gcc/ada/a-sflcin.ads
@@ -0,0 +1,40 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT LIBRARY COMPONENTS --
+-- --
+-- ADA.STRINGS.FIXED.LESS_CASE_INSENSITIVE --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 2011, 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 contents of the part following the private keyword. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception under Section 7 of GPL version 3, you are granted --
+-- additional permissions described in the GCC Runtime Library Exception, --
+-- version 3.1, as published by the Free Software Foundation. --
+-- --
+-- You should have received a copy of the GNU General Public License and --
+-- a copy of the GCC Runtime Library Exception along with this program; --
+-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
+-- <http://www.gnu.org/licenses/>. --
+-- --
+-- This unit was originally developed by Matthew J Heaney. --
+------------------------------------------------------------------------------
+
+with Ada.Strings.Less_Case_Insensitive;
+
+function Ada.Strings.Fixed.Less_Case_Insensitive
+ (Left, Right : String)
+ return Boolean renames Ada.Strings.Less_Case_Insensitive;
+
+pragma Pure (Ada.Strings.Fixed.Less_Case_Insensitive);
diff --git a/gcc/ada/a-suecin.adb b/gcc/ada/a-suecin.adb
new file mode 100644
index 00000000000..73ebae57156
--- /dev/null
+++ b/gcc/ada/a-suecin.adb
@@ -0,0 +1,47 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT LIBRARY COMPONENTS --
+-- --
+-- ADA.STRINGS.UNBOUNDED.EQUAL_CASE_INSENSITIVE --
+-- --
+-- B o d y --
+-- --
+-- Copyright (C) 2011, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception under Section 7 of GPL version 3, you are granted --
+-- additional permissions described in the GCC Runtime Library Exception, --
+-- version 3.1, as published by the Free Software Foundation. --
+-- --
+-- You should have received a copy of the GNU General Public License and --
+-- a copy of the GCC Runtime Library Exception along with this program; --
+-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
+-- <http://www.gnu.org/licenses/>. --
+-- --
+-- This unit was originally developed by Matthew J Heaney. --
+------------------------------------------------------------------------------
+
+with Ada.Strings.Unbounded.Aux;
+with Ada.Strings.Equal_Case_Insensitive;
+
+function Ada.Strings.Unbounded.Equal_Case_Insensitive
+ (Left, Right : Unbounded.Unbounded_String)
+ return Boolean
+is
+ SL, SR : Aux.Big_String_Access;
+ LL, LR : Natural;
+
+begin
+ Aux.Get_String (Left, SL, LL);
+ Aux.Get_String (Right, SR, LR);
+
+ return Ada.Strings.Equal_Case_Insensitive
+ (Left => SL (1 .. LL),
+ Right => SR (1 .. LR));
+end Ada.Strings.Unbounded.Equal_Case_Insensitive;
diff --git a/gcc/ada/a-suecin.ads b/gcc/ada/a-suecin.ads
new file mode 100644
index 00000000000..08960241c8e
--- /dev/null
+++ b/gcc/ada/a-suecin.ads
@@ -0,0 +1,38 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT LIBRARY COMPONENTS --
+-- --
+-- ADA.STRINGS.UNBOUNDED.EQUAL_CASE_INSENSITIVE --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 2011, 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 contents of the part following the private keyword. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception under Section 7 of GPL version 3, you are granted --
+-- additional permissions described in the GCC Runtime Library Exception, --
+-- version 3.1, as published by the Free Software Foundation. --
+-- --
+-- You should have received a copy of the GNU General Public License and --
+-- a copy of the GCC Runtime Library Exception along with this program; --
+-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
+-- <http://www.gnu.org/licenses/>. --
+-- --
+-- This unit was originally developed by Matthew J Heaney. --
+------------------------------------------------------------------------------
+
+function Ada.Strings.Unbounded.Equal_Case_Insensitive
+ (Left, Right : Unbounded.Unbounded_String)
+ return Boolean;
+
+pragma Preelaborate (Ada.Strings.Unbounded.Equal_Case_Insensitive);
diff --git a/gcc/ada/a-suhcin.adb b/gcc/ada/a-suhcin.adb
new file mode 100644
index 00000000000..0417c15db24
--- /dev/null
+++ b/gcc/ada/a-suhcin.adb
@@ -0,0 +1,43 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT LIBRARY COMPONENTS --
+-- --
+-- ADA.STRINGS.UNBOUNDED.HASH_CASE_INSENSITIVE --
+-- --
+-- B o d y --
+-- --
+-- Copyright (C) 2011, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception under Section 7 of GPL version 3, you are granted --
+-- additional permissions described in the GCC Runtime Library Exception, --
+-- version 3.1, as published by the Free Software Foundation. --
+-- --
+-- You should have received a copy of the GNU General Public License and --
+-- a copy of the GCC Runtime Library Exception along with this program; --
+-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
+-- <http://www.gnu.org/licenses/>. --
+-- --
+-- This unit was originally developed by Matthew J Heaney. --
+------------------------------------------------------------------------------
+
+with Ada.Strings.Unbounded.Aux;
+with Ada.Strings.Hash_Case_Insensitive;
+
+function Ada.Strings.Unbounded.Hash_Case_Insensitive
+ (Key : Unbounded.Unbounded_String)
+ return Containers.Hash_Type
+is
+ S : Aux.Big_String_Access;
+ L : Natural;
+
+begin
+ Aux.Get_String (Key, S, L);
+ return Ada.Strings.Hash_Case_Insensitive (S (1 .. L));
+end Ada.Strings.Unbounded.Hash_Case_Insensitive;
diff --git a/gcc/ada/a-suhcin.ads b/gcc/ada/a-suhcin.ads
new file mode 100644
index 00000000000..180d4a4391a
--- /dev/null
+++ b/gcc/ada/a-suhcin.ads
@@ -0,0 +1,40 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT LIBRARY COMPONENTS --
+-- --
+-- ADA.STRINGS.UNBOUNDED.HASH_CASE_INSENSITIVE --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 2011, 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 contents of the part following the private keyword. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception under Section 7 of GPL version 3, you are granted --
+-- additional permissions described in the GCC Runtime Library Exception, --
+-- version 3.1, as published by the Free Software Foundation. --
+-- --
+-- You should have received a copy of the GNU General Public License and --
+-- a copy of the GCC Runtime Library Exception along with this program; --
+-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
+-- <http://www.gnu.org/licenses/>. --
+-- --
+-- This unit was originally developed by Matthew J Heaney. --
+------------------------------------------------------------------------------
+
+with Ada.Containers;
+
+function Ada.Strings.Unbounded.Hash_Case_Insensitive
+ (Key : Unbounded.Unbounded_String)
+ return Containers.Hash_Type;
+
+pragma Preelaborate (Ada.Strings.Unbounded.Hash_Case_Insensitive);
diff --git a/gcc/ada/a-sulcin.adb b/gcc/ada/a-sulcin.adb
new file mode 100644
index 00000000000..9f1f3c4aca9
--- /dev/null
+++ b/gcc/ada/a-sulcin.adb
@@ -0,0 +1,47 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT LIBRARY COMPONENTS --
+-- --
+-- ADA.STRINGS.UNBOUNDED.LESS_CASE_INSENSITIVE --
+-- --
+-- B o d y --
+-- --
+-- Copyright (C) 2011, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception under Section 7 of GPL version 3, you are granted --
+-- additional permissions described in the GCC Runtime Library Exception, --
+-- version 3.1, as published by the Free Software Foundation. --
+-- --
+-- You should have received a copy of the GNU General Public License and --
+-- a copy of the GCC Runtime Library Exception along with this program; --
+-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
+-- <http://www.gnu.org/licenses/>. --
+-- --
+-- This unit was originally developed by Matthew J Heaney. --
+------------------------------------------------------------------------------
+
+with Ada.Strings.Unbounded.Aux;
+with Ada.Strings.Less_Case_Insensitive;
+
+function Ada.Strings.Unbounded.Less_Case_Insensitive
+ (Left, Right : Unbounded.Unbounded_String)
+ return Boolean
+is
+ SL, SR : Aux.Big_String_Access;
+ LL, LR : Natural;
+
+begin
+ Aux.Get_String (Left, SL, LL);
+ Aux.Get_String (Right, SR, LR);
+
+ return Ada.Strings.Less_Case_Insensitive
+ (Left => SL (1 .. LL),
+ Right => SR (1 .. LR));
+end Ada.Strings.Unbounded.Less_Case_Insensitive;
diff --git a/gcc/ada/a-sulcin.ads b/gcc/ada/a-sulcin.ads
new file mode 100644
index 00000000000..fafb546ca77
--- /dev/null
+++ b/gcc/ada/a-sulcin.ads
@@ -0,0 +1,38 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT LIBRARY COMPONENTS --
+-- --
+-- ADA.STRINGS.UNBOUNDED.LESS_CASE_INSENSITIVE --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 2011, 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 contents of the part following the private keyword. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception under Section 7 of GPL version 3, you are granted --
+-- additional permissions described in the GCC Runtime Library Exception, --
+-- version 3.1, as published by the Free Software Foundation. --
+-- --
+-- You should have received a copy of the GNU General Public License and --
+-- a copy of the GCC Runtime Library Exception along with this program; --
+-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
+-- <http://www.gnu.org/licenses/>. --
+-- --
+-- This unit was originally developed by Matthew J Heaney. --
+------------------------------------------------------------------------------
+
+function Ada.Strings.Unbounded.Less_Case_Insensitive
+ (Left, Right : Unbounded.Unbounded_String)
+ return Boolean;
+
+pragma Preelaborate (Ada.Strings.Unbounded.Less_Case_Insensitive);
diff --git a/gcc/ada/aspects.adb b/gcc/ada/aspects.adb
index 48a1c89e700..9b707734b76 100755
--- a/gcc/ada/aspects.adb
+++ b/gcc/ada/aspects.adb
@@ -127,7 +127,19 @@ package body Aspects is
Ritem : Node_Id;
begin
- Ritem := First_Rep_Item (Ent);
+
+ -- If the aspect is an inherited one and the entity is a class-wide
+ -- type, use the aspect of the specific type.
+
+ if Is_Type (Ent)
+ and then Is_Class_Wide_Type (Ent)
+ and then Inherited_Aspect (A)
+ then
+ Ritem := First_Rep_Item (Etype (Ent));
+ else
+ Ritem := First_Rep_Item (Ent);
+ end if;
+
while Present (Ritem) loop
if Nkind (Ritem) = N_Aspect_Specification
and then Get_Aspect_Id (Chars (Identifier (Ritem))) = A
diff --git a/gcc/ada/aspects.ads b/gcc/ada/aspects.ads
index dfca9b12af1..582a71e7a55 100755
--- a/gcc/ada/aspects.ads
+++ b/gcc/ada/aspects.ads
@@ -176,6 +176,18 @@ package Aspects is
(Aspect_Test_Case => False,
others => True);
+ -- The following array indicates type aspects that are inherited and apply
+ -- to the class-wide type as well.
+
+ Inherited_Aspect : constant array (Aspect_Id) of Boolean :=
+ (Aspect_Constant_Indexing => True,
+ Aspect_Default_Iterator => True,
+ Aspect_Implicit_Dereference => True,
+ Aspect_Iterator_Element => True,
+ Aspect_Remote_Types => True,
+ Aspect_Variable_Indexing => True,
+ others => False);
+
-- The following subtype defines aspects corresponding to library unit
-- pragmas, these can only validly appear as aspects for library units,
-- and result in a corresponding pragma being inserted immediately after
diff --git a/gcc/ada/atree.adb b/gcc/ada/atree.adb
index 17c6814fb90..793da138861 100644
--- a/gcc/ada/atree.adb
+++ b/gcc/ada/atree.adb
@@ -1797,6 +1797,15 @@ package body Atree is
Nodes.Table (N).Has_Aspects := Val;
end Set_Has_Aspects;
+ -----------------------
+ -- Set_Original_Node --
+ -----------------------
+
+ procedure Set_Original_Node (N : Node_Id; Val : Node_Id) is
+ begin
+ Orig_Nodes.Table (N) := Val;
+ end Set_Original_Node;
+
---------------------
-- Set_Paren_Count --
---------------------
diff --git a/gcc/ada/atree.ads b/gcc/ada/atree.ads
index 4e20b0b0f00..305e914f97c 100644
--- a/gcc/ada/atree.ads
+++ b/gcc/ada/atree.ads
@@ -151,14 +151,14 @@ package Atree is
-- it is useful to be able to do untyped traversals, and an internal
-- package in Atree allows for direct untyped accesses in such cases.
- -- Flag4 Sixteen Boolean flags (use depends on Nkind and
+ -- Flag4 Fifteen Boolean flags (use depends on Nkind and
-- Flag5 Ekind, as described for FieldN). Again the access
-- Flag6 is usually via subprograms in Sinfo and Einfo which
-- Flag7 provide high-level synonyms for these flags, and
-- Flag8 contain debugging code that checks that the values
-- Flag9 in Nkind and Ekind are appropriate for the access.
-- Flag10
- -- Flag11 Note that Flag1-2 are missing from this list. For
+ -- Flag11 Note that Flag1-3 are missing from this list. For
-- Flag12 historical reasons, these flag names are unused.
-- Flag13
-- Flag14
@@ -761,6 +761,14 @@ package Atree is
procedure Set_Has_Aspects (N : Node_Id; Val : Boolean := True);
pragma Inline (Set_Has_Aspects);
+ procedure Set_Original_Node (N : Node_Id; Val : Node_Id);
+ pragma Inline (Set_Original_Node);
+ -- Note that this routine is used only in very peculiar cases. In normal
+ -- cases, the Original_Node link is set by calls to Rewrite. We currently
+ -- use it in ASIS mode to manually set the link from pragma expressions
+ -- to their aspect original source expressions, so that the original source
+ -- expressions accessed by ASIS are also semantically analyzed.
+
------------------------------
-- Entity Update Procedures --
------------------------------
@@ -887,9 +895,13 @@ package Atree is
-----------------------------------
-- This subpackage provides the functions for accessing and procedures for
- -- setting fields that are normally referenced by their logical synonyms
- -- defined in packages Sinfo and Einfo. The implementations of these
- -- packages use the package Atree.Unchecked_Access.
+ -- setting fields that are normally referenced by wrapper subprograms (e.g.
+ -- logical synonyms defined in packages Sinfo and Einfo, or specialized
+ -- routines such as Rewrite (for Original_Node), or the node creation
+ -- routines (for Set_Nkind). The implementations of these wrapper
+ -- subprograms use the package Atree.Unchecked_Access as do various
+ -- special case accesses where no wrapper applies. Documentation is always
+ -- required for such a special case access explaining why it is needed.
package Unchecked_Access is
diff --git a/gcc/ada/bindgen.adb b/gcc/ada/bindgen.adb
index d75fe06c51b..a4b7d394deb 100644
--- a/gcc/ada/bindgen.adb
+++ b/gcc/ada/bindgen.adb
@@ -1050,9 +1050,8 @@ package body Bindgen is
or else U.Unit_Kind /= 's')
then
- -- The only case in which we have to do something is if this
- -- is a body, with a separate spec, where the separate spec
- -- has an elaboration entity defined. In that case, this is
+ -- In the case of a body with a separate spec, where the
+ -- separate spec has an elaboration entity defined, this is
-- where we increment the elaboration entity.
if U.Utype = Is_Body
@@ -1061,9 +1060,39 @@ package body Bindgen is
then
Set_String (" E");
Set_Unit_Number (Unum_Spec);
- Set_String (" := E");
+
+ -- The AAMP target has no notion of shared libraries, and
+ -- there's no possibility of reelaboration, so we treat the
+ -- the elaboration var as a flag instead of a counter and
+ -- simply set it.
+
+ if AAMP_On_Target then
+ Set_String (" := 1;");
+
+ -- Otherwise (normal case), increment elaboration counter
+
+ else
+ Set_String (" := E");
+ Set_Unit_Number (Unum_Spec);
+ Set_String (" + 1;");
+ end if;
+
+ Write_Statement_Buffer;
+
+ -- In the special case where the target is AAMP and the unit is
+ -- a spec with a body, the elaboration entity is initialized
+ -- here. This is done because it's the only way to accomplish
+ -- initialization of such entities, as there is no mechanism
+ -- provided for initializing global variables at load time on
+ -- AAMP.
+
+ elsif AAMP_On_Target
+ and then U.Utype = Is_Spec
+ and then Units.Table (Unum_Spec).Set_Elab_Entity
+ then
+ Set_String (" E");
Set_Unit_Number (Unum_Spec);
- Set_String (" + 1;");
+ Set_String (" := 0;");
Write_Statement_Buffer;
end if;
@@ -1087,6 +1116,23 @@ package body Bindgen is
-- variables, only calls to 'Elab* subprograms.
else
+ -- In the special case where the target is AAMP and the unit is
+ -- a spec with a body, the elaboration entity is initialized
+ -- here. This is done because it's the only way to accomplish
+ -- initialization of such entities, as there is no mechanism
+ -- provided for initializing global variables at load time on
+ -- AAMP.
+
+ if AAMP_On_Target
+ and then U.Utype = Is_Spec
+ and then Units.Table (Unum_Spec).Set_Elab_Entity
+ then
+ Set_String (" E");
+ Set_Unit_Number (Unum_Spec);
+ Set_String (" := 0;");
+ Write_Statement_Buffer;
+ end if;
+
Check_Elab_Flag :=
not CodePeer_Mode
and then (Force_Checking_Of_Elaboration_Flags
@@ -1151,9 +1197,23 @@ package body Bindgen is
then
Set_String (" E");
Set_Unit_Number (Unum_Spec);
- Set_String (" := E");
- Set_Unit_Number (Unum_Spec);
- Set_String (" + 1;");
+
+ -- The AAMP target has no notion of shared libraries, and
+ -- there's no possibility of reelaboration, so we treat the
+ -- the elaboration var as a flag instead of a counter and
+ -- simply set it.
+
+ if AAMP_On_Target then
+ Set_String (" := 1;");
+
+ -- Otherwise (normal case), increment elaboration counter
+
+ else
+ Set_String (" := E");
+ Set_Unit_Number (Unum_Spec);
+ Set_String (" + 1;");
+ end if;
+
Write_Statement_Buffer;
end if;
end if;
diff --git a/gcc/ada/checks.adb b/gcc/ada/checks.adb
index f3234865dbd..67febfe1919 100644
--- a/gcc/ada/checks.adb
+++ b/gcc/ada/checks.adb
@@ -2565,8 +2565,25 @@ package body Checks is
function Atomic_Synchronization_Disabled (E : Entity_Id) return Boolean is
begin
- if Present (E) and then Checks_May_Be_Suppressed (E) then
+ -- If debug flag d.e is set, always return False, i.e. all atomic sync
+ -- looks enabled, since it is never disabled.
+
+ if Debug_Flag_Dot_E then
+ return False;
+
+ -- If debug flag d.d is set then always return True, i.e. all atomic
+ -- sync looks disabled, since it always tests True.
+
+ elsif Debug_Flag_Dot_D then
+ return True;
+
+ -- If entity present, then check result for that entity
+
+ elsif Present (E) and then Checks_May_Be_Suppressed (E) then
return Is_Check_Suppressed (E, Atomic_Synchronization);
+
+ -- Otherwise result depends on current scope setting
+
else
return Scope_Suppress (Atomic_Synchronization);
end if;
diff --git a/gcc/ada/errout.adb b/gcc/ada/errout.adb
index 88482898a92..5993132cf81 100644
--- a/gcc/ada/errout.adb
+++ b/gcc/ada/errout.adb
@@ -439,7 +439,6 @@ package body Errout is
Error_Msg_Internal
("?in inlined body #",
Actual_Error_Loc, Flag_Location, Msg_Cont_Status);
-
else
Error_Msg_Internal
("error in inlined body #",
@@ -453,7 +452,6 @@ package body Errout is
Error_Msg_Internal
("?in instantiation #",
Actual_Error_Loc, Flag_Location, Msg_Cont_Status);
-
else
Error_Msg_Internal
("instantiation error #",
diff --git a/gcc/ada/exp_alfa.adb b/gcc/ada/exp_alfa.adb
index 988d16fba1f..ab0e40fae5b 100644
--- a/gcc/ada/exp_alfa.adb
+++ b/gcc/ada/exp_alfa.adb
@@ -29,10 +29,12 @@ with Exp_Attr; use Exp_Attr;
with Exp_Ch4; use Exp_Ch4;
with Exp_Ch6; use Exp_Ch6;
with Exp_Dbug; use Exp_Dbug;
+with Exp_Util; use Exp_Util;
with Nlists; use Nlists;
with Rtsfind; use Rtsfind;
with Sem_Aux; use Sem_Aux;
with Sem_Res; use Sem_Res;
+with Sem_Util; use Sem_Util;
with Sinfo; use Sinfo;
with Snames; use Snames;
with Stand; use Stand;
@@ -56,12 +58,19 @@ package body Exp_Alfa is
procedure Expand_Alfa_N_In (N : Node_Id);
-- Expand set membership into individual ones
+ procedure Expand_Alfa_N_Object_Renaming_Declaration (N : Node_Id);
+ -- Perform name evaluation for a renamed object
+
procedure Expand_Alfa_N_Simple_Return_Statement (N : Node_Id);
-- Insert conversion on function return if necessary
procedure Expand_Alfa_Simple_Function_Return (N : Node_Id);
-- Expand simple return from function
+ procedure Expand_Potential_Renaming (N : Node_Id);
+ -- N denotes a N_Identifier or N_Expanded_Name. If N references a renaming,
+ -- replace N with the renamed object.
+
-----------------
-- Expand_Alfa --
-----------------
@@ -69,22 +78,22 @@ package body Exp_Alfa is
procedure Expand_Alfa (N : Node_Id) is
begin
case Nkind (N) is
+ when N_Attribute_Reference =>
+ Expand_Alfa_N_Attribute_Reference (N);
- when N_Package_Body |
+ when N_Block_Statement |
+ N_Package_Body |
N_Package_Declaration |
- N_Subprogram_Body |
- N_Block_Statement =>
+ N_Subprogram_Body =>
Qualify_Entity_Names (N);
- when N_Simple_Return_Statement =>
- Expand_Alfa_N_Simple_Return_Statement (N);
-
when N_Function_Call |
N_Procedure_Call_Statement =>
Expand_Alfa_Call (N);
- when N_Attribute_Reference =>
- Expand_Alfa_N_Attribute_Reference (N);
+ when N_Expanded_Name |
+ N_Identifier =>
+ Expand_Potential_Renaming (N);
when N_In =>
Expand_Alfa_N_In (N);
@@ -92,6 +101,12 @@ package body Exp_Alfa is
when N_Not_In =>
Expand_N_Not_In (N);
+ when N_Object_Renaming_Declaration =>
+ Expand_Alfa_N_Object_Renaming_Declaration (N);
+
+ when N_Simple_Return_Statement =>
+ Expand_Alfa_N_Simple_Return_Statement (N);
+
when others =>
null;
end case;
@@ -157,7 +172,6 @@ package body Exp_Alfa is
Set_Entity (Name (Call_Node), Parent_Subp);
end if;
-
end Expand_Alfa_Call;
---------------------------------------
@@ -186,10 +200,20 @@ package body Exp_Alfa is
begin
if Present (Alternatives (N)) then
Expand_Set_Membership (N);
- return;
end if;
end Expand_Alfa_N_In;
+ -----------------------------------------------
+ -- Expand_Alfa_N_Object_Renaming_Declaration --
+ -----------------------------------------------
+
+ procedure Expand_Alfa_N_Object_Renaming_Declaration (N : Node_Id) is
+ begin
+ -- Unconditionally remove all side effects from the name
+
+ Evaluate_Name (Name (N));
+ end Expand_Alfa_N_Object_Renaming_Declaration;
+
-------------------------------------------
-- Expand_Alfa_N_Simple_Return_Statement --
-------------------------------------------
@@ -218,7 +242,6 @@ package body Exp_Alfa is
E_Entry |
E_Entry_Family |
E_Return_Statement =>
- -- Expand_Non_Function_Return (N);
null;
when others =>
@@ -265,4 +288,22 @@ package body Exp_Alfa is
end if;
end Expand_Alfa_Simple_Function_Return;
+ -------------------------------
+ -- Expand_Potential_Renaming --
+ -------------------------------
+
+ procedure Expand_Potential_Renaming (N : Node_Id) is
+ E : constant Entity_Id := Entity (N);
+ T : constant Entity_Id := Etype (N);
+
+ begin
+ -- Replace a reference to a renaming with the actual renamed object
+
+ if Ekind (E) in Object_Kind and then Present (Renamed_Object (E)) then
+ Rewrite (N, New_Copy_Tree (Renamed_Object (E)));
+ Reset_Analyzed_Flags (N);
+ Analyze_And_Resolve (N, T);
+ end if;
+ end Expand_Potential_Renaming;
+
end Exp_Alfa;
diff --git a/gcc/ada/exp_attr.adb b/gcc/ada/exp_attr.adb
index db8f6a30d5d..57e94d29840 100644
--- a/gcc/ada/exp_attr.adb
+++ b/gcc/ada/exp_attr.adb
@@ -4046,13 +4046,13 @@ package body Exp_Attr is
X : constant Node_Id := Prefix (N);
Y : constant Node_Id := First (Expressions (N));
- -- The argumens
+ -- The arguments
X_Addr, Y_Addr : Node_Id;
- -- the expressions for their addresses
+ -- Rhe expressions for their addresses
X_Size, Y_Size : Node_Id;
- -- the expressions for their sizes
+ -- Rhe expressions for their sizes
begin
-- The attribute is expanded as:
diff --git a/gcc/ada/exp_ch11.adb b/gcc/ada/exp_ch11.adb
index dca021f9237..b2bf98cd1db 100644
--- a/gcc/ada/exp_ch11.adb
+++ b/gcc/ada/exp_ch11.adb
@@ -334,7 +334,7 @@ package body Exp_Ch11 is
-- raise statements into gotos, e.g. all N_Raise_xxx_Error nodes are
-- left unchanged and passed to the back end.
- -- Instead, the front end generates two nodes
+ -- Instead, the front end generates three nodes
-- N_Push_Constraint_Error_Label
-- N_Push_Program_Error_Label
@@ -356,6 +356,10 @@ package body Exp_Ch11 is
-- field in the Push node will be empty signifying that for this region
-- of code, no optimization is possible.
+ -- These Push/Pop nodes are inhibited if No_Exception_Handlers is set
+ -- since they are useless in this case, and in CodePeer mode, where
+ -- they serve no purpose and can intefere with the analysis.
+
-- The back end must maintain three stacks, one for each exception case,
-- the Push node pushes an entry onto the corresponding stack, and Pop
-- node pops off the entry. Then instead of calling Rcheck_nn, if the
@@ -503,6 +507,12 @@ package body Exp_Ch11 is
procedure Generate_Push_Pop (H : Node_Id) is
begin
+ if Restriction_Active (No_Exception_Handlers)
+ or else CodePeer_Mode
+ then
+ return;
+ end if;
+
if Exc_Locally_Handled then
return;
else
diff --git a/gcc/ada/exp_ch2.adb b/gcc/ada/exp_ch2.adb
index a71ce69602e..80f381b82a1 100644
--- a/gcc/ada/exp_ch2.adb
+++ b/gcc/ada/exp_ch2.adb
@@ -401,46 +401,39 @@ package body Exp_Ch2 is
-- Set Atomic_Sync_Required if necessary for atomic variable
- if Is_Atomic (E) then
+ if Nkind_In (N, N_Identifier, N_Expanded_Name)
+ and then Ekind (E) = E_Variable
+ and then (Is_Atomic (E) or else Is_Atomic (Etype (E)))
+ then
declare
Set : Boolean;
- MLoc : Node_Id;
begin
- -- Always set if debug flag d.e is set
+ -- If variable is atomic, but type is not, setting depends on
+ -- disable/enable state for the variable.
- if Debug_Flag_Dot_E then
- Set := True;
+ if Is_Atomic (E) and then not Is_Atomic (Etype (E)) then
+ Set := not Atomic_Synchronization_Disabled (E);
- -- Never set if debug flag d.d is set
+ -- If variable is not atomic, but its type is atomic, setting
+ -- depends on disable/enable state for the type.
- elsif Debug_Flag_Dot_D then
- Set := False;
+ elsif not Is_Atomic (E) and then Is_Atomic (Etype (E)) then
+ Set := not Atomic_Synchronization_Disabled (Etype (E));
- -- Otherwise setting comes from Atomic_Synchronization state
+ -- Else both variable and type are atomic (see outer if), and we
+ -- disable if either variable or its type have sync disabled.
else
- Set := not Atomic_Synchronization_Disabled (E);
+ Set := (not Atomic_Synchronization_Disabled (E))
+ and then
+ (not Atomic_Synchronization_Disabled (Etype (E)));
end if;
-- Set flag if required
if Set then
-
- -- Generate info message if requested
-
- if Warn_On_Atomic_Synchronization then
- if Nkind (N) = N_Identifier then
- MLoc := N;
- else
- MLoc := Selector_Name (N);
- end if;
-
- Error_Msg_N
- ("?info: atomic synchronization set for &", MLoc);
- end if;
-
- Set_Atomic_Sync_Required (N);
+ Activate_Atomic_Synchronization (N);
end if;
end;
end if;
diff --git a/gcc/ada/exp_ch4.adb b/gcc/ada/exp_ch4.adb
index 87e02d0e1ee..d2f0668873e 100644
--- a/gcc/ada/exp_ch4.adb
+++ b/gcc/ada/exp_ch4.adb
@@ -591,8 +591,7 @@ package body Exp_Ch4 is
-- 1) Get access to the allocated object
Rewrite (N,
- Make_Explicit_Dereference (Loc,
- Relocate_Node (N)));
+ Make_Explicit_Dereference (Loc, Relocate_Node (N)));
Set_Etype (N, Etyp);
Set_Analyzed (N);
@@ -2615,12 +2614,7 @@ package body Exp_Ch4 is
-- Result of the concatenation (of type Ityp)
Actions : constant List_Id := New_List;
- -- Collect actions to be inserted if Save_Space is False
-
- Save_Space : Boolean;
- pragma Warnings (Off, Save_Space);
- -- Set to True if we are saving generated code space by calling routines
- -- in packages System.Concat_n.
+ -- Collect actions to be inserted
Known_Non_Null_Operand_Seen : Boolean;
-- Set True during generation of the assignments of operands into
@@ -4472,6 +4466,15 @@ package body Exp_Ch4 is
-- Insert explicit dereference call for the checked storage pool case
Insert_Dereference_Action (Prefix (N));
+
+ -- If the type is an Atomic type for which Atomic_Sync is enabled, then
+ -- we set the atomic sync flag.
+
+ if Is_Atomic (Etype (N))
+ and then not Atomic_Synchronization_Disabled (Etype (N))
+ then
+ Activate_Atomic_Synchronization (N);
+ end if;
end Expand_N_Explicit_Dereference;
--------------------------------------
@@ -5245,6 +5248,7 @@ package body Exp_Ch4 is
Typ : constant Entity_Id := Etype (N);
P : constant Node_Id := Prefix (N);
T : constant Entity_Id := Etype (P);
+ Atp : Entity_Id;
begin
-- A special optimization, if we have an indexed component that is
@@ -5290,6 +5294,9 @@ package body Exp_Ch4 is
if Is_Access_Type (T) then
Insert_Explicit_Dereference (P);
Analyze_And_Resolve (P, Designated_Type (T));
+ Atp := Designated_Type (T);
+ else
+ Atp := T;
end if;
-- Generate index and validity checks
@@ -5300,6 +5307,17 @@ package body Exp_Ch4 is
Apply_Subscript_Validity_Checks (N);
end if;
+ -- If selecting from an array with atomic components, and atomic sync
+ -- is not suppressed for this array type, set atomic sync flag.
+
+ if (Has_Atomic_Components (Atp)
+ and then not Atomic_Synchronization_Disabled (Atp))
+ or else (Is_Atomic (Typ)
+ and then not Atomic_Synchronization_Disabled (Typ))
+ then
+ Activate_Atomic_Synchronization (N);
+ end if;
+
-- All done for the non-packed case
if not Is_Packed (Etype (Prefix (N))) then
@@ -7869,9 +7887,6 @@ package body Exp_Ch4 is
-- Expand_N_Selected_Component --
---------------------------------
- -- If the selector is a discriminant of a concurrent object, rewrite the
- -- prefix to denote the corresponding record type.
-
procedure Expand_N_Selected_Component (N : Node_Id) is
Loc : constant Source_Ptr := Sloc (N);
Par : constant Node_Id := Parent (N);
@@ -8175,6 +8190,46 @@ package body Exp_Ch4 is
Rewrite (N, New_N);
Analyze (N);
end if;
+
+ -- Set Atomic_Sync_Required if necessary for atomic component
+
+ if Nkind (N) = N_Selected_Component then
+ declare
+ E : constant Entity_Id := Entity (Selector_Name (N));
+ Set : Boolean;
+
+ begin
+ -- If component is atomic, but type is not, setting depends on
+ -- disable/enable state for the component.
+
+ if Is_Atomic (E) and then not Is_Atomic (Etype (E)) then
+ Set := not Atomic_Synchronization_Disabled (E);
+
+ -- If component is not atomic, but its type is atomic, setting
+ -- depends on disable/enable state for the type.
+
+ elsif not Is_Atomic (E) and then Is_Atomic (Etype (E)) then
+ Set := not Atomic_Synchronization_Disabled (Etype (E));
+
+ -- If both component and type are atomic, we disable if either
+ -- component or its type have sync disabled.
+
+ elsif Is_Atomic (E) and then Is_Atomic (Etype (E)) then
+ Set := (not Atomic_Synchronization_Disabled (E))
+ and then
+ (not Atomic_Synchronization_Disabled (Etype (E)));
+
+ else
+ Set := False;
+ end if;
+
+ -- Set flag if required
+
+ if Set then
+ Activate_Atomic_Synchronization (N);
+ end if;
+ end;
+ end if;
end Expand_N_Selected_Component;
--------------------
diff --git a/gcc/ada/exp_ch5.adb b/gcc/ada/exp_ch5.adb
index 971d0ad65d2..fd75b158449 100644
--- a/gcc/ada/exp_ch5.adb
+++ b/gcc/ada/exp_ch5.adb
@@ -1461,7 +1461,22 @@ package body Exp_Ch5 is
end if;
if Is_Unchecked_Union (Base_Type (R_Typ)) then
- Insert_Action (N, Make_Field_Assign (CF, True));
+
+ -- Within an initialization procedure this is the
+ -- assignment to an unchecked union component, in which
+ -- case there is no discriminant to initialize.
+
+ if Inside_Init_Proc then
+ null;
+
+ else
+ -- The assignment is part of a conversion from a
+ -- derived unchecked union type with an inferable
+ -- discriminant, to a parent type.
+
+ Insert_Action (N, Make_Field_Assign (CF, True));
+ end if;
+
else
Insert_Action (N, Make_Field_Assign (CF));
end if;
@@ -3105,32 +3120,32 @@ package body Exp_Ch5 is
end loop;
-- Generate:
- -- Id : Element_Type renames Pack.Element (Cursor);
+ -- Id : Element_Type renames Container (Cursor);
+ -- This assumes that the container type has an indexing
+ -- operation with Cursor. The check that this operation
+ -- exists is performed in Check_Container_Indexing.
Decl :=
Make_Object_Renaming_Declaration (Loc,
Defining_Identifier => Id,
- Subtype_Mark =>
+ Subtype_Mark =>
New_Reference_To (Element_Type, Loc),
- Name =>
+ Name =>
Make_Indexed_Component (Loc,
- Prefix => Make_Selected_Component (Loc,
- Prefix => New_Reference_To (Pack, Loc),
- Selector_Name =>
- Make_Identifier (Loc, Chars => Name_Element)),
+ Prefix => Relocate_Node (Container_Arg),
Expressions =>
New_List (New_Occurrence_Of (Cursor, Loc))));
-- If the container holds controlled objects, wrap the loop
-- statements and element renaming declaration with a block.
- -- This ensures that the result of Element (Iterator) is
+ -- This ensures that the result of Element (Cusor) is
-- cleaned up after each iteration of the loop.
if Needs_Finalization (Element_Type) then
-- Generate:
-- declare
- -- Id : Element_Type := Pack.Element (Iterator);
+ -- Id : Element_Type := Pack.Element (curosr);
-- begin
-- <original loop statements>
-- end;
@@ -3264,9 +3279,11 @@ package body Exp_Ch5 is
-- The Iterator is not modified in the source, but of course will
-- be updated in the generated code. Indicate that it is actually
- -- set to prevent spurious warnings.
+ -- set to prevent spurious warnings. Ditto for the Cursor, which
+ -- is modified indirectly in generated code.
Set_Never_Set_In_Source (Iterator, False);
+ Set_Never_Set_In_Source (Cursor, False);
-- If the range of iteration is given by a function call that
-- returns a container, the finalization actions have been saved
diff --git a/gcc/ada/exp_ch6.adb b/gcc/ada/exp_ch6.adb
index 993fa40c3fa..6049c452cb8 100644
--- a/gcc/ada/exp_ch6.adb
+++ b/gcc/ada/exp_ch6.adb
@@ -2652,10 +2652,13 @@ package body Exp_Ch6 is
end if;
end if;
- -- For Ada 2012, if a parameter is aliased, the actual must be an
- -- aliased object.
+ -- For Ada 2012, if a parameter is aliased, the actual must be a
+ -- tagged type or an aliased view of an object.
- if Is_Aliased (Formal) and then not Is_Aliased_View (Actual) then
+ if Is_Aliased (Formal)
+ and then not Is_Aliased_View (Actual)
+ and then not Is_Tagged_Type (Etype (Formal))
+ then
Error_Msg_NE
("actual for aliased formal& must be aliased object",
Actual, Formal);
@@ -5679,10 +5682,14 @@ package body Exp_Ch6 is
end if;
-- If local-exception-to-goto optimization active, insert dummy push
- -- statements at start, and dummy pop statements at end.
+ -- statements at start, and dummy pop statements at end, but inhibit
+ -- this if we have No_Exception_Handlers, since they are useless and
+ -- intefere with analysis, e.g. by codepeer.
if (Debug_Flag_Dot_G
or else Restriction_Active (No_Exception_Propagation))
+ and then not Restriction_Active (No_Exception_Handlers)
+ and then not CodePeer_Mode
and then Is_Non_Empty_List (L)
then
declare
diff --git a/gcc/ada/exp_ch8.adb b/gcc/ada/exp_ch8.adb
index af33868b799..a0e9d4cf1be 100644
--- a/gcc/ada/exp_ch8.adb
+++ b/gcc/ada/exp_ch8.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2010, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2011, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -50,7 +50,6 @@ package body Exp_Ch8 is
procedure Expand_N_Exception_Renaming_Declaration (N : Node_Id) is
Decl : constant Node_Id := Debug_Renaming_Declaration (N);
-
begin
if Present (Decl) then
Insert_Action (N, Decl);
@@ -91,114 +90,17 @@ package body Exp_Ch8 is
procedure Expand_N_Object_Renaming_Declaration (N : Node_Id) is
Nam : constant Node_Id := Name (N);
- T : Entity_Id;
Decl : Node_Id;
-
- procedure Evaluate_Name (Fname : Node_Id);
- -- A recursive procedure used to freeze a name in the sense described
- -- above, i.e. any variable references or function calls are removed.
- -- Of course the outer level variable reference must not be removed.
- -- For example in A(J,F(K)), A is left as is, but J and F(K) are
- -- evaluated and removed.
+ T : Entity_Id;
function Evaluation_Required (Nam : Node_Id) return Boolean;
- -- Determines whether it is necessary to do static name evaluation
- -- for renaming of Nam. It is considered necessary if evaluating the
- -- name involves indexing a packed array, or extracting a component
- -- of a record to which a component clause applies. Note that we are
- -- only interested in these operations if they occur as part of the
- -- name itself, subscripts are just values that are computed as part
- -- of the evaluation, so their form is unimportant.
-
- -------------------
- -- Evaluate_Name --
- -------------------
-
- procedure Evaluate_Name (Fname : Node_Id) is
- K : constant Node_Kind := Nkind (Fname);
- E : Node_Id;
-
- begin
- -- For an explicit dereference, we simply force the evaluation
- -- of the name expression. The dereference provides a value that
- -- is the address for the renamed object, and it is precisely
- -- this value that we want to preserve.
-
- if K = N_Explicit_Dereference then
- Force_Evaluation (Prefix (Fname));
-
- -- For a selected component, we simply evaluate the prefix
-
- elsif K = N_Selected_Component then
- Evaluate_Name (Prefix (Fname));
-
- -- For an indexed component, or an attribute reference, we evaluate
- -- the prefix, which is itself a name, recursively, and then force
- -- the evaluation of all the subscripts (or attribute expressions).
-
- elsif Nkind_In (K, N_Indexed_Component, N_Attribute_Reference) then
- Evaluate_Name (Prefix (Fname));
-
- E := First (Expressions (Fname));
- while Present (E) loop
- Force_Evaluation (E);
-
- if Original_Node (E) /= E then
- Set_Do_Range_Check (E, Do_Range_Check (Original_Node (E)));
- end if;
-
- Next (E);
- end loop;
-
- -- For a slice, we evaluate the prefix, as for the indexed component
- -- case and then, if there is a range present, either directly or
- -- as the constraint of a discrete subtype indication, we evaluate
- -- the two bounds of this range.
-
- elsif K = N_Slice then
- Evaluate_Name (Prefix (Fname));
-
- declare
- DR : constant Node_Id := Discrete_Range (Fname);
- Constr : Node_Id;
- Rexpr : Node_Id;
-
- begin
- if Nkind (DR) = N_Range then
- Force_Evaluation (Low_Bound (DR));
- Force_Evaluation (High_Bound (DR));
-
- elsif Nkind (DR) = N_Subtype_Indication then
- Constr := Constraint (DR);
-
- if Nkind (Constr) = N_Range_Constraint then
- Rexpr := Range_Expression (Constr);
-
- Force_Evaluation (Low_Bound (Rexpr));
- Force_Evaluation (High_Bound (Rexpr));
- end if;
- end if;
- end;
-
- -- For a type conversion, the expression of the conversion must be
- -- the name of an object, and we simply need to evaluate this name.
-
- elsif K = N_Type_Conversion then
- Evaluate_Name (Expression (Fname));
-
- -- For a function call, we evaluate the call
-
- elsif K = N_Function_Call then
- Force_Evaluation (Fname);
-
- -- The remaining cases are direct name, operator symbol and
- -- character literal. In all these cases, we do nothing, since
- -- we want to reevaluate each time the renamed object is used.
-
- else
- return;
- end if;
- end Evaluate_Name;
+ -- Determines whether it is necessary to do static name evaluation for
+ -- renaming of Nam. It is considered necessary if evaluating the name
+ -- involves indexing a packed array, or extracting a component of a
+ -- record to which a component clause applies. Note that we are only
+ -- interested in these operations if they occur as part of the name
+ -- itself, subscripts are just values that are computed as part of the
+ -- evaluation, so their form is unimportant.
-------------------------
-- Evaluation_Required --
diff --git a/gcc/ada/exp_ch8.ads b/gcc/ada/exp_ch8.ads
index 7df54f3069a..1dc066c0f4b 100644
--- a/gcc/ada/exp_ch8.ads
+++ b/gcc/ada/exp_ch8.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2007, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2011, Free Software Foundation, Inc. --
-- --
-- GNAT is 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/exp_util.adb b/gcc/ada/exp_util.adb
index dd58b017d24..e675da82889 100644
--- a/gcc/ada/exp_util.adb
+++ b/gcc/ada/exp_util.adb
@@ -160,6 +160,76 @@ package body Exp_Util is
-- or body. Flag Nested_Constructs should be set when any nested packages
-- declared in L must be processed.
+ -------------------------------------
+ -- Activate_Atomic_Synchronization --
+ -------------------------------------
+
+ procedure Activate_Atomic_Synchronization (N : Node_Id) is
+ Msg_Node : Node_Id;
+
+ begin
+ case Nkind (Parent (N)) is
+
+ -- Check for cases of appearing in the prefix of a construct where
+ -- we don't need atomic synchronization for this kind of usage.
+
+ when
+ -- Nothing to do if we are the prefix of an attribute, since we
+ -- do not want an atomic sync operation for things like 'Size.
+
+ N_Attribute_Reference |
+
+ -- The N_Reference node is like an attribute
+
+ N_Reference |
+
+ -- Nothing to do for a reference to a component (or components)
+ -- of a composite object. Only reads and updates of the object
+ -- as a whole require atomic synchronization (RM C.6 (15)).
+
+ N_Indexed_Component |
+ N_Selected_Component |
+ N_Slice =>
+
+ -- For all the above cases, nothing to do if we are the prefix
+
+ if Prefix (Parent (N)) = N then
+ return;
+ end if;
+
+ when others => null;
+ end case;
+
+ -- Go ahead and set the flag
+
+ Set_Atomic_Sync_Required (N);
+
+ -- Generate info message if requested
+
+ if Warn_On_Atomic_Synchronization then
+ case Nkind (N) is
+ when N_Identifier =>
+ Msg_Node := N;
+
+ when N_Selected_Component | N_Expanded_Name =>
+ Msg_Node := Selector_Name (N);
+
+ when N_Explicit_Dereference | N_Indexed_Component =>
+ Msg_Node := Empty;
+
+ when others =>
+ pragma Assert (False);
+ return;
+ end case;
+
+ if Present (Msg_Node) then
+ Error_Msg_N ("?info: atomic synchronization set for &", Msg_Node);
+ else
+ Error_Msg_N ("?info: atomic synchronization set", N);
+ end if;
+ end if;
+ end Activate_Atomic_Synchronization;
+
----------------------
-- Adjust_Condition --
----------------------
@@ -1689,6 +1759,100 @@ package body Exp_Util is
and then not Restriction_Active (No_Local_Allocators);
end Entry_Names_OK;
+ -------------------
+ -- Evaluate_Name --
+ -------------------
+
+ procedure Evaluate_Name (Nam : Node_Id) is
+ K : constant Node_Kind := Nkind (Nam);
+
+ begin
+ -- For an explicit dereference, we simply force the evaluation of the
+ -- name expression. The dereference provides a value that is the address
+ -- for the renamed object, and it is precisely this value that we want
+ -- to preserve.
+
+ if K = N_Explicit_Dereference then
+ Force_Evaluation (Prefix (Nam));
+
+ -- For a selected component, we simply evaluate the prefix
+
+ elsif K = N_Selected_Component then
+ Evaluate_Name (Prefix (Nam));
+
+ -- For an indexed component, or an attribute reference, we evaluate the
+ -- prefix, which is itself a name, recursively, and then force the
+ -- evaluation of all the subscripts (or attribute expressions).
+
+ elsif Nkind_In (K, N_Indexed_Component, N_Attribute_Reference) then
+ Evaluate_Name (Prefix (Nam));
+
+ declare
+ E : Node_Id;
+
+ begin
+ E := First (Expressions (Nam));
+ while Present (E) loop
+ Force_Evaluation (E);
+
+ if Original_Node (E) /= E then
+ Set_Do_Range_Check (E, Do_Range_Check (Original_Node (E)));
+ end if;
+
+ Next (E);
+ end loop;
+ end;
+
+ -- For a slice, we evaluate the prefix, as for the indexed component
+ -- case and then, if there is a range present, either directly or as the
+ -- constraint of a discrete subtype indication, we evaluate the two
+ -- bounds of this range.
+
+ elsif K = N_Slice then
+ Evaluate_Name (Prefix (Nam));
+
+ declare
+ DR : constant Node_Id := Discrete_Range (Nam);
+ Constr : Node_Id;
+ Rexpr : Node_Id;
+
+ begin
+ if Nkind (DR) = N_Range then
+ Force_Evaluation (Low_Bound (DR));
+ Force_Evaluation (High_Bound (DR));
+
+ elsif Nkind (DR) = N_Subtype_Indication then
+ Constr := Constraint (DR);
+
+ if Nkind (Constr) = N_Range_Constraint then
+ Rexpr := Range_Expression (Constr);
+
+ Force_Evaluation (Low_Bound (Rexpr));
+ Force_Evaluation (High_Bound (Rexpr));
+ end if;
+ end if;
+ end;
+
+ -- For a type conversion, the expression of the conversion must be the
+ -- name of an object, and we simply need to evaluate this name.
+
+ elsif K = N_Type_Conversion then
+ Evaluate_Name (Expression (Nam));
+
+ -- For a function call, we evaluate the call
+
+ elsif K = N_Function_Call then
+ Force_Evaluation (Nam);
+
+ -- The remaining cases are direct name, operator symbol and character
+ -- literal. In all these cases, we do nothing, since we want to
+ -- reevaluate each time the renamed object is used.
+
+ else
+ return;
+ end if;
+ end Evaluate_Name;
+
---------------------
-- Evolve_And_Then --
---------------------
@@ -4203,9 +4367,14 @@ package body Exp_Util is
return True;
end if;
- -- Case of component reference
+ -- Case of indexed component reference: test whether prefix is unaligned
- if Nkind (N) = N_Selected_Component then
+ if Nkind (N) = N_Indexed_Component then
+ return Is_Possibly_Unaligned_Object (Prefix (N));
+
+ -- Case of selected component reference
+
+ elsif Nkind (N) = N_Selected_Component then
declare
P : constant Node_Id := Prefix (N);
C : constant Entity_Id := Entity (Selector_Name (N));
@@ -5846,11 +6015,11 @@ package body Exp_Util is
Exp_Type : constant Entity_Id := Etype (Exp);
Svg_Suppress : constant Suppress_Array := Scope_Suppress;
Def_Id : Entity_Id;
+ E : Node_Id;
+ New_Exp : Node_Id;
+ Ptr_Typ_Decl : Node_Id;
Ref_Type : Entity_Id;
Res : Node_Id;
- Ptr_Typ_Decl : Node_Id;
- New_Exp : Node_Id;
- E : Node_Id;
function Side_Effect_Free (N : Node_Id) return Boolean;
-- Determines if the tree N represents an expression that is known not
@@ -6085,7 +6254,7 @@ package body Exp_Util is
-- A binary operator is side effect free if and both operands are
-- side effect free. For this purpose binary operators include
- -- membership tests and short circuit forms
+ -- membership tests and short circuit forms.
when N_Binary_Op | N_Membership_Test | N_Short_Circuit =>
return Side_Effect_Free (Left_Opnd (N))
@@ -6453,6 +6622,15 @@ package body Exp_Util is
-- Otherwise we generate a reference to the value
else
+ -- An expression which is in Alfa mode is considered side effect free
+ -- if the resulting value is captured by a variable or a constant.
+
+ if Alfa_Mode
+ and then Nkind (Parent (Exp)) = N_Object_Declaration
+ then
+ return;
+ end if;
+
-- Special processing for function calls that return a limited type.
-- We need to build a declaration that will enable build-in-place
-- expansion of the call. This is not done if the context is already
@@ -6461,10 +6639,10 @@ package body Exp_Util is
-- This is relevant only in Ada 2005 mode. In Ada 95 programs we have
-- to accommodate functions returning limited objects by reference.
- if Nkind (Exp) = N_Function_Call
+ if Ada_Version >= Ada_2005
+ and then Nkind (Exp) = N_Function_Call
and then Is_Immutably_Limited_Type (Etype (Exp))
and then Nkind (Parent (Exp)) /= N_Object_Declaration
- and then Ada_Version >= Ada_2005
then
declare
Obj : constant Entity_Id := Make_Temporary (Loc, 'F', Exp);
@@ -6484,32 +6662,57 @@ package body Exp_Util is
end;
end if;
- Ref_Type := Make_Temporary (Loc, 'A');
+ Def_Id := Make_Temporary (Loc, 'R', Exp);
+ Set_Etype (Def_Id, Exp_Type);
- Ptr_Typ_Decl :=
- Make_Full_Type_Declaration (Loc,
- Defining_Identifier => Ref_Type,
- Type_Definition =>
- Make_Access_To_Object_Definition (Loc,
- All_Present => True,
- Subtype_Indication =>
- New_Reference_To (Exp_Type, Loc)));
+ -- The regular expansion of functions with side effects involves the
+ -- generation of an access type to capture the return value found on
+ -- the secondary stack. Since Alfa (and why) cannot process access
+ -- types, use a different approach which ignores the secondary stack
+ -- and "copies" the returned object.
- E := Exp;
- Insert_Action (Exp, Ptr_Typ_Decl);
+ if Alfa_Mode then
+ Res := New_Reference_To (Def_Id, Loc);
+ Ref_Type := Exp_Type;
- Def_Id := Make_Temporary (Loc, 'R', Exp);
- Set_Etype (Def_Id, Exp_Type);
+ -- Regular expansion utilizing an access type and 'reference
- Res :=
- Make_Explicit_Dereference (Loc,
- Prefix => New_Reference_To (Def_Id, Loc));
+ else
+ Res :=
+ Make_Explicit_Dereference (Loc,
+ Prefix => New_Reference_To (Def_Id, Loc));
+
+ -- Generate:
+ -- type Ann is access all <Exp_Type>;
+ Ref_Type := Make_Temporary (Loc, 'A');
+
+ Ptr_Typ_Decl :=
+ Make_Full_Type_Declaration (Loc,
+ Defining_Identifier => Ref_Type,
+ Type_Definition =>
+ Make_Access_To_Object_Definition (Loc,
+ All_Present => True,
+ Subtype_Indication =>
+ New_Reference_To (Exp_Type, Loc)));
+
+ Insert_Action (Exp, Ptr_Typ_Decl);
+ end if;
+
+ E := Exp;
if Nkind (E) = N_Explicit_Dereference then
New_Exp := Relocate_Node (Prefix (E));
else
E := Relocate_Node (E);
- New_Exp := Make_Reference (Loc, E);
+
+ -- Do not generate a 'reference in Alfa mode since the access type
+ -- is not created in the first place.
+
+ if Alfa_Mode then
+ New_Exp := E;
+ else
+ New_Exp := Make_Reference (Loc, E);
+ end if;
end if;
if Is_Delayed_Aggregate (E) then
diff --git a/gcc/ada/exp_util.ads b/gcc/ada/exp_util.ads
index 1f0ee42fc5d..c0e0082185d 100644
--- a/gcc/ada/exp_util.ads
+++ b/gcc/ada/exp_util.ads
@@ -149,6 +149,14 @@ package Exp_Util is
-- Other Subprograms --
-----------------------
+ procedure Activate_Atomic_Synchronization (N : Node_Id);
+ -- N is a node for which atomic synchronization may be required (it is
+ -- either an identifier, expanded name, or selected/indexed component or
+ -- an explicit dereference). The caller has checked the basic conditions
+ -- (atomic variable appearing and Atomic_Sync not disabled). This function
+ -- checks if atomic synchronization is required and if so sets the flag
+ -- and if appropriate generates a warning (in -gnatw.n mode).
+
procedure Adjust_Condition (N : Node_Id);
-- The node N is an expression whose root-type is Boolean, and which
-- represents a boolean value used as a condition (i.e. a True/False
@@ -343,6 +351,11 @@ package Exp_Util is
-- which represent entry [family member] names. These strings are created
-- by the compiler and used by GDB.
+ procedure Evaluate_Name (Nam : Node_Id);
+ -- Remove the all side effects from a name which appears as part of an
+ -- object renaming declaration. More comments are needed here that explain
+ -- how this differs from Force_Evaluation and Remove_Side_Effects ???
+
procedure Evolve_And_Then (Cond : in out Node_Id; Cond1 : Node_Id);
-- Rewrites Cond with the expression: Cond and then Cond1. If Cond is
-- Empty, then simply returns Cond1 (this allows the use of Empty to
diff --git a/gcc/ada/freeze.adb b/gcc/ada/freeze.adb
index 8c42fed255b..b1a33d58da1 100644
--- a/gcc/ada/freeze.adb
+++ b/gcc/ada/freeze.adb
@@ -4063,6 +4063,16 @@ package body Freeze is
Layout_Type (E);
end if;
+ -- If this is an access to subprogram whose designated type is itself
+ -- a subprogram type, the return type of this anonymous subprogram
+ -- type must be decorated as well.
+
+ if Ekind (E) = E_Anonymous_Access_Subprogram_Type
+ and then Ekind (Designated_Type (E)) = E_Subprogram_Type
+ then
+ Layout_Type (Etype (Designated_Type (E)));
+ 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,
-- since in the case of Default_Value, we are analyzing with the
diff --git a/gcc/ada/g-excact.adb b/gcc/ada/g-excact.adb
index 1ba4cf8d64e..ed454cefcde 100644
--- a/gcc/ada/g-excact.adb
+++ b/gcc/ada/g-excact.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2002-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 2002-2011, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -97,7 +97,7 @@ package body GNAT.Exception_Actions is
function Name_To_Id (Name : String) return Exception_Id is
begin
- return To_Id (Internal_Exception (Name, False));
+ return To_Id (Internal_Exception (Name, Create_If_Not_Exist => False));
end Name_To_Id;
---------------------------------
diff --git a/gcc/ada/g-socket.adb b/gcc/ada/g-socket.adb
index bf1fe9fdde0..d48065a23f5 100644
--- a/gcc/ada/g-socket.adb
+++ b/gcc/ada/g-socket.adb
@@ -36,8 +36,8 @@ with Ada.Unchecked_Conversion;
with Interfaces.C.Strings;
-with GNAT.Sockets.Thin_Common; use GNAT.Sockets.Thin_Common;
-with GNAT.Sockets.Thin; use GNAT.Sockets.Thin;
+with GNAT.Sockets.Thin_Common; use GNAT.Sockets.Thin_Common;
+with GNAT.Sockets.Thin; use GNAT.Sockets.Thin;
with GNAT.Sockets.Linker_Options;
pragma Warnings (Off, GNAT.Sockets.Linker_Options);
@@ -246,11 +246,11 @@ package body GNAT.Sockets is
-- Type and Stream_Socket_Stream_Type.
procedure Wait_On_Socket
- (Socket : Socket_Type;
- For_Read : Boolean;
- Timeout : Selector_Duration;
- Selector : access Selector_Type := null;
- Status : out Selector_Status);
+ (Socket : Socket_Type;
+ For_Read : Boolean;
+ 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
@@ -490,8 +490,8 @@ package body GNAT.Sockets is
-- that Fd is within range (otherwise behaviour is undefined).
elsif Fd < 0 or else Fd >= SOSC.FD_SETSIZE then
- raise Constraint_Error with "invalid value for socket set: "
- & Image (Fd);
+ raise Constraint_Error
+ with "invalid value for socket set: " & Image (Fd);
end if;
end Check_For_Fd_Set;
@@ -731,11 +731,11 @@ package body GNAT.Sockets is
-- Wait for socket to become available for writing
Wait_On_Socket
- (Socket => Socket,
- For_Read => False,
- Timeout => Timeout,
- Selector => Selector,
- Status => Status);
+ (Socket => Socket,
+ For_Read => False,
+ Timeout => Timeout,
+ Selector => Selector,
+ Status => Status);
-- Reset the socket to blocking I/O
@@ -1580,11 +1580,11 @@ package body GNAT.Sockets is
--------------------
procedure Wait_On_Socket
- (Socket : Socket_Type;
- For_Read : Boolean;
- Timeout : Selector_Duration;
- Selector : access Selector_Type := null;
- Status : out Selector_Status)
+ (Socket : Socket_Type;
+ For_Read : Boolean;
+ 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;
diff --git a/gcc/ada/g-socket.ads b/gcc/ada/g-socket.ads
index 01983282ac7..462556265a6 100644
--- a/gcc/ada/g-socket.ads
+++ b/gcc/ada/g-socket.ads
@@ -432,8 +432,8 @@ package GNAT.Sockets is
Immediate : constant Duration := 0.0;
- Forever : constant Duration :=
- Duration'Min (Duration'Last, 1.0 * SOSC.MAX_tv_sec);
+ Forever : constant Duration :=
+ Duration'Min (Duration'Last, 1.0 * SOSC.MAX_tv_sec);
-- Largest possible Duration that is also a valid value for struct timeval
subtype Timeval_Duration is Duration range Immediate .. Forever;
@@ -1146,7 +1146,6 @@ private
R_Sig_Socket : Socket_Type := No_Socket;
W_Sig_Socket : Socket_Type := No_Socket;
-- Signalling sockets used to abort a select operation
-
end case;
end record;
@@ -1234,10 +1233,10 @@ private
end record;
type Service_Entry_Type (Aliases_Length : Natural) is record
- Official : Name_Type;
- Aliases : Name_Array (1 .. Aliases_Length);
- Port : Port_Type;
- Protocol : Name_Type;
+ Official : Name_Type;
+ Aliases : Name_Array (1 .. Aliases_Length);
+ Port : Port_Type;
+ Protocol : Name_Type;
end record;
type Request_Flag_Type is mod 2 ** 8;
diff --git a/gcc/ada/gcc-interface/Make-lang.in b/gcc/ada/gcc-interface/Make-lang.in
index 43d42f658b5..221d326c6aa 100644
--- a/gcc/ada/gcc-interface/Make-lang.in
+++ b/gcc/ada/gcc-interface/Make-lang.in
@@ -1773,11 +1773,12 @@ ada/exp_alfa.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \
ada/atree.adb ada/casing.ads ada/debug.ads ada/einfo.ads ada/einfo.adb \
ada/exp_alfa.ads ada/exp_alfa.adb ada/exp_attr.ads ada/exp_ch4.ads \
- ada/exp_ch6.ads ada/exp_dbug.ads ada/gnat.ads ada/g-htable.ads \
- ada/hostparm.ads ada/interfac.ads ada/namet.ads ada/namet.adb \
- ada/nlists.ads ada/nlists.adb ada/opt.ads ada/output.ads \
- ada/rtsfind.ads ada/sem_aux.ads ada/sem_aux.adb ada/sem_res.ads \
- ada/sinfo.ads ada/sinfo.adb ada/sinput.ads ada/snames.ads ada/stand.ads \
+ ada/exp_ch6.ads ada/exp_dbug.ads ada/exp_tss.ads ada/exp_util.ads \
+ ada/gnat.ads ada/g-htable.ads ada/hostparm.ads ada/interfac.ads \
+ ada/namet.ads ada/namet.adb ada/nlists.ads ada/nlists.adb ada/nmake.ads \
+ ada/opt.ads ada/output.ads ada/rtsfind.ads ada/sem_aux.ads \
+ ada/sem_aux.adb ada/sem_res.ads ada/sem_util.ads ada/sinfo.ads \
+ ada/sinfo.adb ada/sinput.ads ada/snames.ads ada/stand.ads \
ada/system.ads ada/s-exctab.ads ada/s-htable.ads ada/s-imenne.ads \
ada/s-memory.ads ada/s-os_lib.ads ada/s-parame.ads ada/s-secsta.ads \
ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads \
@@ -1953,32 +1954,35 @@ ada/exp_ch13.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/exp_ch2.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \
- ada/atree.adb ada/casing.ads ada/csets.ads ada/debug.ads \
- ada/debug_a.ads ada/einfo.ads ada/einfo.adb ada/elists.ads \
- ada/elists.adb ada/err_vars.ads ada/errout.ads ada/errout.adb \
- ada/erroutc.ads ada/erroutc.adb ada/exp_ch2.ads ada/exp_ch2.adb \
- ada/exp_code.ads ada/exp_smem.ads ada/exp_tss.ads ada/exp_util.ads \
- ada/exp_vfpt.ads ada/expander.ads ada/fname.ads ada/gnat.ads \
- ada/g-htable.ads ada/gnatvsn.ads ada/hlo.ads ada/hostparm.ads \
- ada/inline.ads ada/interfac.ads ada/lib.ads ada/lib-load.ads \
- ada/namet.ads ada/namet.adb ada/nlists.ads ada/nlists.adb ada/nmake.ads \
- ada/nmake.adb ada/opt.ads ada/output.ads ada/par_sco.ads ada/rident.ads \
- ada/rtsfind.ads ada/scans.ads ada/sem.ads ada/sem.adb ada/sem_attr.ads \
- ada/sem_aux.ads ada/sem_ch10.ads ada/sem_ch11.ads ada/sem_ch12.ads \
- ada/sem_ch13.ads ada/sem_ch2.ads ada/sem_ch3.ads ada/sem_ch4.ads \
- ada/sem_ch5.ads ada/sem_ch6.ads ada/sem_ch7.ads ada/sem_ch8.ads \
- ada/sem_ch9.ads ada/sem_eval.ads ada/sem_prag.ads ada/sem_res.ads \
- ada/sem_util.ads ada/sem_warn.ads ada/sem_warn.adb ada/sinfo.ads \
- ada/sinfo.adb ada/sinput.ads ada/sinput.adb ada/snames.ads \
- ada/stand.ads ada/stringt.ads ada/stylesw.ads ada/system.ads \
- ada/s-exctab.ads ada/s-htable.ads ada/s-imenne.ads ada/s-memory.ads \
- ada/s-os_lib.ads ada/s-parame.ads ada/s-rident.ads ada/s-secsta.ads \
- ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads \
- ada/s-stoele.adb ada/s-string.ads ada/s-traent.ads ada/s-unstyp.ads \
- ada/s-wchcon.ads ada/table.ads ada/table.adb ada/targparm.ads \
- ada/tbuild.ads ada/tree_io.ads ada/types.ads ada/uintp.ads \
- ada/uintp.adb ada/uname.ads ada/unchconv.ads ada/unchdeal.ads \
- ada/urealp.ads ada/widechar.ads
+ ada/atree.adb ada/casing.ads ada/checks.ads ada/checks.adb \
+ ada/csets.ads ada/debug.ads ada/debug_a.ads ada/einfo.ads ada/einfo.adb \
+ ada/elists.ads ada/elists.adb ada/err_vars.ads ada/errout.ads \
+ ada/errout.adb ada/erroutc.ads ada/erroutc.adb ada/eval_fat.ads \
+ ada/exp_ch11.ads ada/exp_ch2.ads ada/exp_ch2.adb ada/exp_ch4.ads \
+ ada/exp_code.ads ada/exp_pakd.ads ada/exp_smem.ads ada/exp_tss.ads \
+ ada/exp_util.ads ada/exp_vfpt.ads ada/expander.ads ada/fname.ads \
+ ada/freeze.ads ada/get_targ.ads ada/gnat.ads ada/g-htable.ads \
+ ada/gnatvsn.ads ada/hlo.ads ada/hostparm.ads ada/inline.ads \
+ ada/interfac.ads ada/lib.ads ada/lib-load.ads ada/namet.ads \
+ ada/namet.adb ada/nlists.ads ada/nlists.adb ada/nmake.ads ada/nmake.adb \
+ ada/opt.ads ada/output.ads ada/par_sco.ads ada/restrict.ads \
+ ada/rident.ads ada/rtsfind.ads ada/scans.ads ada/sem.ads ada/sem.adb \
+ ada/sem_attr.ads ada/sem_aux.ads ada/sem_ch10.ads ada/sem_ch11.ads \
+ ada/sem_ch12.ads ada/sem_ch13.ads ada/sem_ch2.ads ada/sem_ch3.ads \
+ ada/sem_ch4.ads ada/sem_ch5.ads ada/sem_ch6.ads ada/sem_ch7.ads \
+ ada/sem_ch8.ads ada/sem_ch9.ads ada/sem_eval.ads ada/sem_prag.ads \
+ ada/sem_res.ads ada/sem_util.ads ada/sem_warn.ads ada/sem_warn.adb \
+ ada/sinfo.ads ada/sinfo.adb ada/sinput.ads ada/sinput.adb \
+ ada/snames.ads ada/sprint.ads ada/stand.ads ada/stringt.ads \
+ ada/stylesw.ads ada/system.ads ada/s-exctab.ads ada/s-htable.ads \
+ ada/s-imenne.ads ada/s-memory.ads ada/s-os_lib.ads ada/s-parame.ads \
+ ada/s-rident.ads ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads \
+ ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb ada/s-string.ads \
+ ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads \
+ ada/table.adb ada/targparm.ads ada/tbuild.ads ada/tree_io.ads \
+ ada/ttypes.ads ada/types.ads ada/uintp.ads ada/uintp.adb ada/uname.ads \
+ ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/validsw.ads \
+ ada/widechar.ads
ada/exp_ch3.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \
@@ -4066,42 +4070,42 @@ ada/sem_ch3.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/validsw.ads ada/warnsw.ads ada/widechar.ads
ada/sem_ch4.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
- ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/aspects.adb \
- ada/atree.ads ada/atree.adb ada/casing.ads ada/checks.ads ada/csets.ads \
- ada/debug.ads ada/debug_a.ads ada/einfo.ads ada/einfo.adb \
- ada/elists.ads ada/elists.adb ada/err_vars.ads ada/errout.ads \
- ada/errout.adb ada/erroutc.ads ada/erroutc.adb ada/eval_fat.ads \
- ada/exp_ch11.ads ada/exp_ch6.ads ada/exp_ch7.ads ada/exp_code.ads \
- ada/exp_disp.ads ada/exp_tss.ads ada/exp_util.ads ada/expander.ads \
- ada/fname.ads ada/fname-uf.ads ada/freeze.ads ada/get_targ.ads \
- ada/gnat.ads ada/g-hesorg.ads ada/g-htable.ads ada/gnatvsn.ads \
- ada/hlo.ads ada/hostparm.ads ada/inline.ads ada/interfac.ads \
- ada/itypes.ads ada/lib.ads ada/lib.adb ada/lib-list.adb \
- ada/lib-load.ads ada/lib-sort.adb ada/lib-util.ads ada/lib-xref.ads \
- ada/namet.ads ada/namet.adb ada/namet-sp.ads ada/nlists.ads \
- ada/nlists.adb ada/nmake.ads ada/nmake.adb ada/opt.ads ada/output.ads \
- ada/par_sco.ads ada/put_alfa.ads ada/restrict.ads ada/restrict.adb \
- ada/rident.ads ada/rtsfind.ads ada/scans.ads ada/sem.ads ada/sem.adb \
- ada/sem_aggr.ads ada/sem_attr.ads ada/sem_aux.ads ada/sem_aux.adb \
- ada/sem_case.ads ada/sem_case.adb ada/sem_cat.ads ada/sem_ch10.ads \
- ada/sem_ch11.ads ada/sem_ch12.ads ada/sem_ch13.ads ada/sem_ch2.ads \
- ada/sem_ch3.ads ada/sem_ch4.ads ada/sem_ch4.adb ada/sem_ch5.ads \
- ada/sem_ch6.ads ada/sem_ch7.ads ada/sem_ch8.ads ada/sem_ch9.ads \
- ada/sem_disp.ads ada/sem_dist.ads ada/sem_elab.ads ada/sem_elim.ads \
- ada/sem_eval.ads ada/sem_eval.adb ada/sem_intr.ads ada/sem_prag.ads \
- ada/sem_res.ads ada/sem_res.adb ada/sem_type.ads ada/sem_util.ads \
- ada/sem_util.adb ada/sem_warn.ads ada/sem_warn.adb ada/sinfo.ads \
- ada/sinfo.adb ada/sinfo-cn.ads ada/sinput.ads ada/snames.ads \
- ada/stand.ads ada/stringt.ads ada/stringt.adb ada/style.ads \
- ada/styleg.ads ada/styleg.adb ada/stylesw.ads ada/system.ads \
- ada/s-exctab.ads ada/s-htable.ads ada/s-imenne.ads ada/s-memory.ads \
- ada/s-os_lib.ads ada/s-parame.ads ada/s-rident.ads ada/s-secsta.ads \
- ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads \
- ada/s-stoele.adb ada/s-string.ads ada/s-traent.ads ada/s-unstyp.ads \
- ada/s-wchcon.ads ada/table.ads ada/table.adb ada/targparm.ads \
- ada/tbuild.ads ada/tbuild.adb ada/tree_io.ads ada/ttypes.ads \
- ada/types.ads ada/uintp.ads ada/uintp.adb ada/uname.ads \
- ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/widechar.ads
+ ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \
+ ada/atree.adb ada/casing.ads ada/checks.ads ada/csets.ads ada/debug.ads \
+ ada/debug_a.ads ada/einfo.ads ada/einfo.adb ada/elists.ads \
+ ada/elists.adb ada/err_vars.ads ada/errout.ads ada/errout.adb \
+ ada/erroutc.ads ada/erroutc.adb ada/eval_fat.ads ada/exp_ch11.ads \
+ ada/exp_ch6.ads ada/exp_ch7.ads ada/exp_code.ads ada/exp_disp.ads \
+ ada/exp_tss.ads ada/exp_util.ads ada/expander.ads ada/fname.ads \
+ ada/fname-uf.ads ada/freeze.ads ada/get_targ.ads ada/gnat.ads \
+ ada/g-hesorg.ads ada/g-htable.ads ada/gnatvsn.ads ada/hlo.ads \
+ ada/hostparm.ads ada/inline.ads ada/interfac.ads ada/itypes.ads \
+ ada/lib.ads ada/lib.adb ada/lib-list.adb ada/lib-load.ads \
+ ada/lib-sort.adb ada/lib-util.ads ada/lib-xref.ads ada/namet.ads \
+ ada/namet.adb ada/namet-sp.ads ada/nlists.ads ada/nlists.adb \
+ ada/nmake.ads ada/nmake.adb ada/opt.ads ada/output.ads ada/par_sco.ads \
+ ada/put_alfa.ads ada/restrict.ads ada/restrict.adb ada/rident.ads \
+ ada/rtsfind.ads ada/scans.ads ada/sem.ads ada/sem.adb ada/sem_aggr.ads \
+ ada/sem_attr.ads ada/sem_aux.ads ada/sem_aux.adb ada/sem_case.ads \
+ ada/sem_case.adb ada/sem_cat.ads ada/sem_ch10.ads ada/sem_ch11.ads \
+ ada/sem_ch12.ads ada/sem_ch13.ads ada/sem_ch2.ads ada/sem_ch3.ads \
+ ada/sem_ch4.ads ada/sem_ch4.adb ada/sem_ch5.ads ada/sem_ch6.ads \
+ ada/sem_ch7.ads ada/sem_ch8.ads ada/sem_ch9.ads ada/sem_disp.ads \
+ ada/sem_dist.ads ada/sem_elab.ads ada/sem_elim.ads ada/sem_eval.ads \
+ ada/sem_eval.adb ada/sem_intr.ads ada/sem_prag.ads ada/sem_res.ads \
+ ada/sem_res.adb ada/sem_type.ads ada/sem_util.ads ada/sem_util.adb \
+ ada/sem_warn.ads ada/sem_warn.adb ada/sinfo.ads ada/sinfo.adb \
+ ada/sinfo-cn.ads ada/sinput.ads ada/snames.ads ada/stand.ads \
+ ada/stringt.ads ada/stringt.adb ada/style.ads ada/styleg.ads \
+ ada/styleg.adb ada/stylesw.ads ada/system.ads ada/s-exctab.ads \
+ ada/s-htable.ads ada/s-imenne.ads ada/s-memory.ads ada/s-os_lib.ads \
+ ada/s-parame.ads ada/s-rident.ads ada/s-secsta.ads ada/s-soflin.ads \
+ ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb \
+ ada/s-string.ads ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads \
+ ada/table.ads ada/table.adb ada/targparm.ads ada/tbuild.ads \
+ ada/tbuild.adb ada/tree_io.ads ada/ttypes.ads ada/types.ads \
+ ada/uintp.ads ada/uintp.adb ada/uname.ads ada/unchconv.ads \
+ ada/unchdeal.ads ada/urealp.ads ada/widechar.ads
ada/sem_ch5.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \
diff --git a/gcc/ada/gcc-interface/Makefile.in b/gcc/ada/gcc-interface/Makefile.in
index 990a6987736..d9215dfb092 100644
--- a/gcc/ada/gcc-interface/Makefile.in
+++ b/gcc/ada/gcc-interface/Makefile.in
@@ -2116,7 +2116,6 @@ ifeq ($(strip $(filter-out darwin%,$(osys))),)
SO_OPTS = -shared-libgcc
LIBGNAT_TARGET_PAIRS = \
a-intnam.ads<a-intnam-darwin.ads \
- i-forbla.adb<i-forbla-darwin.adb \
s-inmaop.adb<s-inmaop-posix.adb \
s-osinte.adb<s-osinte-darwin.adb \
s-osinte.ads<s-osinte-darwin.ads \
@@ -2238,10 +2237,8 @@ LIBGNAT_OBJS = adadecode.o adaint.o argv.o cio.o cstreams.o ctrl_c.o \
include $(fsrcdir)/ada/Makefile.rtl
-GNATRTL_LINEARALGEBRA_OBJS = i-forbla.o i-forlap.o
-
GNATRTL_OBJS = $(GNATRTL_NONTASKING_OBJS) $(GNATRTL_TASKING_OBJS) \
- $(GNATRTL_LINEARALGEBRA_OBJS) memtrack.o
+ memtrack.o
# Default run time files
@@ -2538,9 +2535,6 @@ gnatlib: ../stamp-gnatlib1-$(RTSDIR) ../stamp-gnatlib2-$(RTSDIR)
$(AR_FOR_TARGET) $(AR_FLAGS) $(RTSDIR)/libgnarl$(arext) \
$(addprefix $(RTSDIR)/,$(GNATRTL_TASKING_OBJS))
$(RANLIB_FOR_TARGET) $(RTSDIR)/libgnarl$(arext)
- $(AR_FOR_TARGET) $(AR_FLAGS) $(RTSDIR)/libgnala$(arext) \
- $(addprefix $(RTSDIR)/,$(GNATRTL_LINEARALGEBRA_OBJS))
- $(RANLIB_FOR_TARGET) $(RTSDIR)/libgnala$(arext)
ifeq ($(GMEM_LIB),gmemlib)
$(AR_FOR_TARGET) $(AR_FLAGS) $(RTSDIR)/libgmem$(arext) \
$(RTSDIR)/memtrack.o
diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c
index 49434430ecd..d7ca5dbbe6e 100644
--- a/gcc/ada/gcc-interface/decl.c
+++ b/gcc/ada/gcc-interface/decl.c
@@ -4185,7 +4185,8 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
/* The failure of this assertion will very likely come from an
order of elaboration issue for the type of the parameter. */
gcc_assert (kind == E_Subprogram_Type
- || !TYPE_IS_DUMMY_P (gnu_param_type));
+ || !TYPE_IS_DUMMY_P (gnu_param_type)
+ || type_annotate_only);
if (gnu_param)
{
diff --git a/gcc/ada/gnat_rm.texi b/gcc/ada/gnat_rm.texi
index 513bca20642..2d342c347bc 100644
--- a/gcc/ada/gnat_rm.texi
+++ b/gcc/ada/gnat_rm.texi
@@ -5318,7 +5318,7 @@ This pragma signals that the entities whose names are listed are
deliberately not referenced in the current source unit. This
suppresses warnings about the
entities being unreferenced, and in addition a warning will be
-generated if one of these entities is in fact referenced in the
+generated if one of these entities is in fact subsequently referenced in the
same unit as the pragma (or in the corresponding body, or one
of its subunits).
@@ -5575,7 +5575,7 @@ as possibly modified by compiler switches. Then each pragma Warning
modifies this set of warnings as specified. This form of the pragma may
also be used as a configuration pragma.
-The fourth form, with an On|Off parameter and a string, is used to
+The fourth form, with an @code{On|Off} parameter and a string, is used to
control individual messages, based on their text. The string argument
is a pattern that is used to match against the text of individual
warning messages (not including the initial "warning: " tag).
@@ -5587,7 +5587,7 @@ message @code{warning: 960 bits of "a" unused}. No other regular
expression notations are permitted. All characters other than asterisk in
these three specific cases are treated as literal characters in the match.
-There are two ways to use this pragma. The OFF form can be used as a
+There are two ways to use the pragma in this form. The OFF form can be used as a
configuration pragma. The effect is to suppress all warnings (if any)
that match the pattern string throughout the compilation.
@@ -5604,6 +5604,13 @@ pragma Warnings (On, Pattern);
In this usage, the pattern string must match in the Off and On pragmas,
and at least one matching warning must be suppressed.
+Note: to write a string that will match any warning, use the string
+@code{"***"}. It will not work to use a single asterisk or two asterisks
+since this looks like an operator name. This form with three asterisks
+is similar in effect to specifying @code{pragma Warnings (Off)} except that a
+matching @code{pragma Warnings (On, "***")} will be required. This can be
+helpful in avoiding forgetting to turn warnings back on.
+
Note: the debug flag -gnatd.i (@code{/NOWARNINGS_PRAGMAS} in VMS) can be
used to cause the compiler to entirely ignore all WARNINGS pragmas. This can
be useful in checking whether obsolete pragmas in existing programs are hiding
@@ -9117,6 +9124,17 @@ only declared at the library level.
This restriction ensures at compile time that there are no allocator
expressions that attempt to allocate protected objects.
+@item No_Relative_Delay
+@findex No_Relative_Delay
+This restriction ensures at compile time that there are no delay relative
+statements and prevents expressions such as @code{delay 1.23;} from appearing
+in source code.
+
+@item No_Requeue_Statements
+@findex No_Requeue_Statements
+This restriction ensures at compile time that no requeue statements are
+permitted and prevents keyword @code{requeue} from being used in source code.
+
@item No_Secondary_Stack
@findex No_Secondary_Stack
This restriction ensures at compile time that the generated code does not
@@ -9138,6 +9156,14 @@ use the standard default storage pool. Any access type declared must
have an explicit Storage_Pool attribute defined specifying a
user-defined storage pool.
+@item No_Stream_Optimizations
+@findex No_Stream_Optimizations
+This restriction affects the performance of stream operations on types
+@code{String}, @code{Wide_String} and @code{Wide_Wide_String}. By default, the
+compiler uses block reads and writes when manipulating @code{String} objects
+due to their supperior performance. When this restriction is in effect, the
+compiler performs all IO operations on a per-character basis.
+
@item No_Streams
@findex No_Streams
This restriction ensures at compile/bind time that there are no
@@ -10196,7 +10222,7 @@ floating-point standard.
Note that on machines that are not fully compliant with the IEEE
floating-point standard, such as Alpha, the @option{-mieee} compiler flag
-must be used for achieving IEEE confirming behavior (although at the cost
+must be used for achieving IEEE conforming behavior (although at the cost
of a significant performance penalty), so infinite and NaN values are
properly generated.
diff --git a/gcc/ada/gnat_ugn.texi b/gcc/ada/gnat_ugn.texi
index abf8093a8ed..253cfff172b 100644
--- a/gcc/ada/gnat_ugn.texi
+++ b/gcc/ada/gnat_ugn.texi
@@ -337,6 +337,7 @@ Performance Considerations
* Optimization Levels::
* Debugging Optimized Code::
* Inlining of Subprograms::
+* Vectorization of loops::
* Other Optimization Switches::
* Optimization and Strict Aliasing::
@ifset vms
@@ -475,11 +476,11 @@ Creating Unit Tests Using gnattest
* Switches for gnattest::
* Project Attributes for gnattest::
* Simple Example::
-* Setting Up and Tearing Down Testing Environment::
+* Setting Up and Tearing Down the Testing Environment::
* Regenerating Tests::
* Default Test Behavior::
* Testing Primitive Operations of Tagged Types::
-* Test Inheritance::
+* Testing Inheritance::
* Tagged Types Substitutability Testing::
* Testing with Contracts::
* Additional Tests::
@@ -5658,8 +5659,8 @@ This switch activates warnings to be generated for entities that
are declared but not referenced, and for units that are @code{with}'ed
and not
referenced. In the case of packages, a warning is also generated if
-no entities in the package are referenced. This means that if the package
-is referenced but the only references are in @code{use}
+no entities in the package are referenced. This means that if a with'ed
+package is referenced but the only references are in @code{use}
clauses or @code{renames}
declarations, a warning is still generated. A warning is also generated
for a generic package that is @code{with}'ed but never instantiated.
@@ -7154,7 +7155,10 @@ used, it must be used consistently throughout the program. However,
since brackets encoding is always recognized, it may be conveniently
used in standard libraries, allowing these libraries to be used with
any of the available coding schemes.
-scheme.
+
+Note that brackets encoding only applies to program text. Within comments,
+brackets are considered to be normal graphic characters, and bracket sequences
+are never recognized as wide characters.
If no @option{-gnatW?} parameter is present, then the default
representation is normally Brackets encoding only. However, if the
@@ -7168,6 +7172,27 @@ for Wide_Text_IO files if not specifically overridden by a WCEM form
parameter.
@end table
+
+When no @option{-gnatW?} is specified, then characters (other than wide
+characters represented using brackets notation) are treated as 8-bit
+Latin-1 codes. The codes recognized are the Latin-1 graphic characters,
+and ASCII format effectors (CR, LF, HT, VT). Other lower half control
+characters in the range 16#00#..16#1F# are not accepted in program text
+or in comments. Upper half control characters (16#80#..16#9F#) are rejected
+in program text, but allowed and ignored in comments. Note in particular
+that the Next Line (NEL) character whose encoding is 16#85# is not recognized
+as an end of line in this default mode. If your source program contains
+instances of the NEL character used as a line terminator,
+you must use UTF-8 encoding for the whole
+source program. In default mode, all lines must be ended by a standard
+end of line sequence (CR, CR/LF, or LF).
+
+Note that the convention of simply accepting all upper half characters in
+comments means that programs that use standard ASCII for program text, but
+UTF-8 encoding for comments are accepted in default mode, providing that the
+comments are ended by an appropriate (CR, or CR/LF, or LF) line terminator.
+This is a common mode for many programs with foreign language comments.
+
@node File Naming Control
@subsection File Naming Control
@@ -10150,6 +10175,7 @@ some guidelines on debugging optimized code.
* Optimization Levels::
* Debugging Optimized Code::
* Inlining of Subprograms::
+* Vectorization of loops::
* Other Optimization Switches::
* Optimization and Strict Aliasing::
@@ -10595,6 +10621,103 @@ that you should not automatically assume that @option{-O3} is better than
@option{-O2}, and indeed you should use @option{-O3} only if tests show that
it actually improves performance.
+@node Vectorization of loops
+@subsection Vectorization of loops
+@cindex Optimization Switches
+
+You can take advantage of the auto-vectorizer present in the @command{gcc}
+back end to vectorize loops with GNAT. The corresponding command line switch
+is @option{-ftree-vectorize} but, as it is enabled by default at @option{-O3}
+and other aggressive optimizations helpful for vectorization also are enabled
+by default at this level, using @option{-O3} directly is recommended.
+
+You also need to make sure that the target architecture features a supported
+SIMD instruction set. For example, for the x86 architecture, you should at
+least specify @option{-msse2} to get significant vectorization (but you don't
+need to specify it for x86-64 as it is part of the base 64-bit architecture).
+Similarly, for the PowerPC architecture, you should specify @option{-maltivec}.
+
+The preferred loop form for vectorization is the @code{for} iteration scheme.
+Loops with a @code{while} iteration scheme can also be vectorized if they are
+very simple, but the vectorizer will quickly give up otherwise. With either
+iteration scheme, the flow of control must be straight, in particular no
+@code{exit} statement may appear in the loop body. The loop may however
+contain a single nested loop, if it can be vectorized when considered alone:
+
+@smallexample @c ada
+@cartouche
+ A : array (1..4, 1..4) of Long_Float;
+ S : array (1..4) of Long_Float;
+
+ procedure Sum is
+ begin
+ for I in A'Range(1) loop
+ for J in A'Range(2) loop
+ S (I) := S (I) + A (I, J);
+ end loop;
+ end loop;
+ end Sum;
+@end cartouche
+@end smallexample
+
+The vectorizable operations depend on the targeted SIMD instruction set, but
+the adding and some of the multiplying operators are generally supported, as
+well as the logical operators for modular types. Note that, in the former
+case, enabling overflow checks, for example with @option{-gnato}, totally
+disables vectorization. The other checks are not supposed to have the same
+definitive effect, although compiling with @option{-gnatp} might well reveal
+cases where some checks do thwart vectorization.
+
+Type conversions may also prevent vectorization if they involve semantics that
+are not directly supported by the code generator or the SIMD instruction set.
+A typical example is direct conversion from floating-point to integer types.
+The solution in this case is to use the following idiom:
+
+@smallexample @c ada
+ Integer (S'Truncation (F))
+@end smallexample
+
+@noindent
+if @code{S} is the subtype of floating-point object @code{F}.
+
+In most cases, the vectorizable loops are loops that iterate over arrays.
+All kinds of array types are supported, i.e. constrained array types with
+static bounds:
+
+@smallexample @c ada
+ type Array_Type is array (1 .. 4) of Long_Float;
+@end smallexample
+
+@noindent
+constrained array types with dynamic bounds:
+
+@smallexample @c ada
+ type Array_Type is array (1 .. Q.N) of Long_Float;
+
+ type Array_Type is array (Q.K .. 4) of Long_Float;
+
+ type Array_Type is array (Q.K .. Q.N) of Long_Float;
+@end smallexample
+
+@noindent
+or unconstrained array types:
+
+@smallexample @c ada
+ type Array_Type is array (Positive range <>) of Long_Float;
+@end smallexample
+
+@noindent
+The quality of the generated code decreases when the dynamic aspect of the
+array type increases, the worst code being generated for unconstrained array
+types. This is so because, the less information the compiler has about the
+bounds of the array, the more fallback code it needs to generate in order to
+fix things up at run time.
+
+You can obtain information about the vectorization performed by the compiler
+by specifying @option{-ftree-vectorizer-verbose=N}. For more details of
+this switch, see @ref{Debugging Options,,Options for Debugging Your Program
+or GCC, gcc, Using the GNU Compiler Collection (GCC)}.
+
@node Other Optimization Switches
@subsection Other Optimization Switches
@cindex Optimization Switches
@@ -10602,10 +10725,9 @@ it actually improves performance.
Since @code{GNAT} uses the @command{gcc} back end, all the specialized
@command{gcc} optimization switches are potentially usable. These switches
have not been extensively tested with GNAT but can generally be expected
-to work. Examples of switches in this category are
-@option{-funroll-loops} and
-the various target-specific @option{-m} options (in particular, it has been
-observed that @option{-march=pentium4} can significantly improve performance
+to work. Examples of switches in this category are @option{-funroll-loops}
+and the various target-specific @option{-m} options (in particular, it has
+been observed that @option{-march=xxx} can significantly improve performance
on appropriate machines). For full details of these switches, see
@ref{Submodel Options,, Hardware Models and Configurations, gcc, Using
the GNU Compiler Collection (GCC)}.
@@ -17491,7 +17613,7 @@ option @option{^--no-exception^/NO_EXCEPTION^} (see below).
@section Running @command{gnatstub}
@noindent
-@command{gnatstub} has the command-line interface of the form
+@command{gnatstub} has a command-line interface of the form:
@smallexample
@c $ gnatstub @ovar{switches} @var{filename} @ovar{directory}
@@ -17673,34 +17795,34 @@ Verbose mode: generate version information.
@findex gnattest
@noindent
-@command{gnattest} is an ASIS-based utility that creates unit tests stubs
+@command{gnattest} is an ASIS-based utility that creates unit-test stubs
as well as a test driver infrastructure (harness). @command{gnattest} creates
a stub for each visible subprogram in the packages under consideration when
they do not exist already.
-In order to process source files from the project, @command{gnattest} has to
-semantically analyze these Ada sources. Therefore, test stubs can only be
-generated for legal Ada units. If a unit is dependent on some other units,
-those units should be among source files of the project or of other projects
+In order to process source files from a project, @command{gnattest} has to
+semantically analyze the sources. Therefore, test stubs can only be
+generated for legal Ada units. If a unit is dependent on other units,
+those units should be among the source files of the project or of other projects
imported by this one.
-Generated stubs and harness are based on the AUnit testing framework. AUnit is
-an Ada adaptation of the xxxUnit testing frameworks similar to JUnit for Java or
-CppUnit for C++. While it is advised that gnattest users read AUnit manual, deep
-knowledge of AUnit is not necessary for using gnattest. For correct operation of
-@command{gnattest} AUnit should be installed and aunit.gpr must be on the
-project path. This happens automatically when Aunit is installed at its default
-location.
+Generated stubs and harnesses are based on the AUnit testing framework. AUnit is
+an Ada adaptation of the xxxUnit testing frameworks, similar to JUnit for Java
+or CppUnit for C++. While it is advised that gnattest users read the AUnit
+manual, deep knowledge of AUnit is not necessary for using gnattest. For correct
+operation of @command{gnattest}, AUnit should be installed and aunit.gpr must be
+on the project path. This happens automatically when Aunit is installed at its
+default location.
@menu
* Running gnattest::
* Switches for gnattest::
* Project Attributes for gnattest::
* Simple Example::
-* Setting Up and Tearing Down Testing Environment::
+* Setting Up and Tearing Down the Testing Environment::
* Regenerating Tests::
* Default Test Behavior::
* Testing Primitive Operations of Tagged Types::
-* Test Inheritance::
+* Testing Inheritance::
* Tagged Types Substitutability Testing::
* Testing with Contracts::
* Additional Tests::
@@ -17711,7 +17833,7 @@ location.
@section Running @command{gnattest}
@noindent
-@command{gnattest} has the command-line interface of the form
+@command{gnattest} has a command-line interface of the form
@smallexample
@c $ gnattest @var{-Pprojname} @ovar{switches} @ovar{filename} @ovar{directory}
@@ -17724,30 +17846,29 @@ where
@table @var
@item -Pprojname
-specifies the project that allow locating the source files. When no [filenames]
-are provided on the command line, all project sources are used as input. This
-switch is mandatory.
+specifies the project defining the location of source files. When no
+file names are provided on the command line, all sources in the project
+are used as input. This switch is required.
@item --harness-dir=dirname
-specifies directory to put harness packages and project file for the test
-driver. The harness dir should be either specified by that switch or by
-corresponding attribute in the argument project file.
+specifies the directory that will hold the harness packages and project file
+for the test driver. The harness directory should be specified either by that
+switch or by the corresponding attribute in the project file.
@item filename
-is the name of the source file that contains a library unit package declaration
-for which a test package must be created. The file name may contain the path
-information.
+is the name of the source file containing the library unit package declaration
+for which a test package will be created. The file name may given with a path.
@item @samp{@var{gcc_switches}} is a list of switches for
-@command{gcc}. They will be passed on to all compiler invocations made by
-@command{gnatstub} to generate the ASIS trees. Here you can provide
+@command{gcc}. These switches will be passed on to all compiler invocations
+made by @command{gnatstub} to generate a set of ASIS trees. Here you can provide
@option{^-I^/INCLUDE_DIRS=^} switches to form the source search path,
use the @option{-gnatec} switch to set the configuration file,
use the @option{-gnat05} switch if sources should be compiled in
-Ada 2005 mode etc.
+Ada 2005 mode, etc.
@item switches
-is an optional sequence of switches as described in the next section
+is an optional sequence of switches as described in the next section.
@end table
@@ -17755,11 +17876,11 @@ is an optional sequence of switches as described in the next section
@itemize @bullet
@item automatic harness
-the harnessing code which is located in the harness-dir as specified on the
-comand line or in the project file. All this code is generated completely
-automatically and can be destroyed and regenerated at will. It is not
-recommended to modify manually this code since it might be overridden
-easily. The entry point in this harnessing code is the project file called
+the harness code, which is located either in the harness-dir as specified on
+the command line or in the project file. All of this code is generated
+completely automatically and can be destroyed and regenerated at will. It is not
+recommended to modify this code manually, since it could easily be overridden
+by mistake. The entry point in the harness code is the project file named
@command{test_driver.gpr}. Tests can be compiled and run using a command
such as:
@@ -17772,12 +17893,12 @@ test_runner
a test stub for each visible subprogram is created in a separate file, if it
doesn't exist already. By default, those separate test files are located in a
"tests" directory that is created in the directory containing the source file
-itself. if it is not appropriate to create the tests in subdirs of the source,
-option @option{--separate-root} can be used. So let say for instance that
-a source file my_unit.ads in directory src contains a visible subprogram Proc.
-Then, the corresponding unit test will be found in file
-src/tests/my_unit-tests-proc_<code>.adb. <code> is an signature encoding used to
-differentiate test names in case of overloading.
+itself. If it is not appropriate to create the tests in subdirectories of the
+source, option @option{--separate-root} can be used. For example, if a source
+file my_unit.ads in directory src contains a visible subprogram Proc, then
+the corresponding unit test will be found in file
+src/tests/my_unit-tests-proc_<code>.adb. <code> is a signature encoding used to
+differentiate test names in cases of overloading.
@end itemize
@node Switches for gnattest
@@ -17789,7 +17910,7 @@ differentiate test names in case of overloading.
@item --harness-only
@cindex @option{--harness-only} (@command{gnattest})
When this option is given, @command{gnattest} creates a harness for all
-sources treating them as test packages.
+sources, treating them as test packages.
@item --additional-tests=@var{projname}
@cindex @option{--additional-tests} (@command{gnattest})
@@ -17798,15 +17919,15 @@ manual tests to be added to the test suite.
@item -r
@cindex @option{-r} (@command{gnattest})
-Consider recursively all sources from all projects.
+Recursively consider all sources from all projects.
@item -q
@cindex @option{-q} (@command{gnattest})
-Supresses non-critical output messages.
+Suppresses noncritical output messages.
@item -v
@cindex @option{-v} (@command{gnattest})
-Verbose mode: generate version information.
+Verbose mode: generates version information.
@item --liskov
@cindex @option{--liskov} (@command{gnattest})
@@ -17820,14 +17941,14 @@ Specifies the default behavior of generated stubs. @var{val} can be either
@item --separate-root=@var{dirname}
@cindex @option{--separate-root} (@command{gnattest})
-Directory hierarchy of tested sources is recreated in the @var{dirname} directory,
-test packages are placed in corresponding dirs.
+The directory hierarchy of tested sources is recreated in the @var{dirname}
+directory, and test packages are placed in corresponding directories.
@item --subdir=@var{dirname}
@cindex @option{--subdir} (@command{gnattest})
-Test packages are placed in subdirectories. That's the default output mode since
-it does not require any additional input from the user. Subdirs called "tests"
-will be created by default.
+Test packages are placed in subdirectories. This is the default output mode
+since it does not require any additional input from the user. Subdirectories
+named "tests" will be created by default.
@end table
@@ -17838,36 +17959,36 @@ will be created by default.
@noindent
-Most of the command line options can be also given to the tool by adding
+Most of the command-line options can also be passed to the tool by adding
special attributes to the project file. Those attributes should be put in
-package gnattest. Here is the list of the attributes.
+package gnattest. Here is the list of attributes:
@itemize @bullet
@item Separate_Stub_Root
is used to select the same output mode as with the --separate-root option.
-This attribute cannot be used togather with Stub_Subdir.
+This attribute cannot be used together with Stub_Subdir.
@item Stub_Subdir
-is used to select the same output mode as with the --sudbir option.
-This attribute cannot be used togather with Separate_Stub_Root.
+is used to select the same output mode as with the --subdir option.
+This attribute cannot be used together with Separate_Stub_Root.
@item Harness_Dir
-is used to specify the directory to place harness packages and project
+is used to specify the directory in which to place harness packages and project
file for the test driver, otherwise specified by --harness-dir.
@item Additional_Tests
-is used to specify the project file otherwise given by
+is used to specify the project file, otherwise given by
--additional-tests switch.
@item Stubs_Default
is used to specify the default behaviour of test stubs, otherwise
-specified by --stub-default option. The value for this attribute
-shoul be either "pass" or "fail"
+specified by --stub-default option. The value of this attribute
+should be either "pass" or "fail".
@end itemize
-All those attributes can be overridden from command line if needed.
+Each of those attributes can be overridden from the command line if needed.
Other @command{gnattest} switches can also be passed via the project
file as an attribute list called GNATtest_Switches.
@@ -17877,19 +17998,19 @@ file as an attribute list called GNATtest_Switches.
@noindent
Let's take a very simple example using the first @command{gnattest} example
-located at
+located in:
@smallexample
<install_prefix>/share/examples/gnattest/simple
@end smallexample
-This project contains a simple package containing one subprogram. By running gnattest
+This project contains a simple package containing one subprogram. By running gnattest:
@smallexample
$ gnattest --harness-dir=driver -Psimple.gpr
@end smallexample
-a test driver is created in dir "driver". It can be compiled and run:
+a test driver is created in directory "driver". It can be compiled and run:
@smallexample
$ cd driver
@@ -17898,8 +18019,8 @@ $ test_runner
@end smallexample
One failed test with diagnosis "test not implemented" is reported.
-Since no special output option was specified the test package Simple.Tests
-is located in
+Since no special output option was specified, the test package Simple.Tests
+is located in:
@smallexample
<install_prefix>/share/examples/gnattest/simple/src/tests
@@ -17907,25 +18028,25 @@ is located in
For each package containing visible subprograms, a child test package is
generated. It contains one test routine per tested subprogram. Each
-declaration of test subprogram has a comment specifying to which tested
-subprogram it corresponds. All the test routines have separated bodies.
-The test routine locates at simple-tests-test_inc_5eaee3.adb has a single
-statement - procedure Assert. It has two arguments: the boolean expression
-which we want to check and the diagnosis message to display if the condition
-is false.
+declaration of a test subprogram has a comment specifying which tested
+subprogram it corresponds to. All of the test routines have separate bodies.
+The test routine located at simple-tests-test_inc_5eaee3.adb contains a single
+statement: a call to procedure Assert. It has two arguments: the Boolean
+expression we want to check and the diagnosis message to display if
+the condition is false.
That is where actual testing code should be written after a proper setup.
-An actual check can be performed by replacing the assert statement with
+An actual check can be performed by replacing the Assert call with:
@smallexample @c ada
Assert (Inc (1) = 2, "wrong incrementation");
@end smallexample
-After recompiling and running the test driver one successfully passed test
+After recompiling and running the test driver, one successfully passed test
is reported.
-@node Setting Up and Tearing Down Testing Environment
-@section Setting Up and Tearing Down Testing Environment
+@node Setting Up and Tearing Down the Testing Environment
+@section Setting Up and Tearing Down the Testing Environment
@noindent
@@ -17934,7 +18055,7 @@ Env_Mgmt that has two procedures: User_Set_Up and User_Tear_Down.
User_Set_Up is called before each test routine of the package and
User_Tear_Down is called after each test routine. Those two procedures can
be used to perform necessary initialization and finalization,
-memory allocation etc.
+memory allocation, etc.
@node Regenerating Tests
@section Regenerating Tests
@@ -17943,12 +18064,12 @@ memory allocation etc.
Bodies of test routines and env_mgmt packages are never overridden after they
have been created once. As long as the name of the subprogram, full expanded Ada
-names and order of its parameters are the same, the old test routine will
-fit in it's place and no test stub will be generated for this subprogram.
+names, and the order of its parameters is the same, the old test routine will
+fit in its place and no test stub will be generated for the subprogram.
This can be demonstrated with the previous example. By uncommenting declaration
and body of function Dec in simple.ads and simple.adb, running
-@command{gnattest} on the project and then running the test driver:
+@command{gnattest} on the project, and then running the test driver:
@smallexample
gnattest --harness-dir=driver -Psimple.gpr
@@ -17957,10 +18078,10 @@ gprbuild -Ptest_driver
test_runner
@end smallexample
-the old test is not replaced with a stub neither lost but a new test stub is
+the old test is not replaced with a stub, nor is it lost, but a new test stub is
created for function Dec.
-The only way for regenerating tests stubs is t oremove the previously created
+The only way of regenerating tests stubs is to remove the previously created
tests.
@node Default Test Behavior
@@ -17968,18 +18089,18 @@ tests.
@noindent
-Generated test driver can treat all unimplemented tests in two ways:
-either count them all as failed (this is usefull to see which tests are still
-left to implement) or as passed (to sort out unimplemented ones from those
-actually failing for a reason).
+The generated test driver can treat unimplemented tests in two ways:
+either count them all as failed (this is useful to see which tests are still
+left to implement) or as passed (to sort out unimplemented ones from those
+actually failing).
-Test driver accepts a switch to specify this behavior: --stub-default=val,
+The test driver accepts a switch to specify this behavior: --stub-default=val,
where val is either "pass" or "fail" (exactly as for @command{gnattest}).
The default behavior of the test driver is set with the same switch
-passed to gnattest when generating the test driver.
+as passed to gnattest when generating the test driver.
-Passing it to the driver generated on the first example
+Passing it to the driver generated on the first example:
@smallexample
test_runner --stub-default=pass
@@ -17992,15 +18113,15 @@ makes both tests pass, even the unimplemented one.
@noindent
-Creating test stubs for primitive operations of tagged types have a number
+Creation of test stubs for primitive operations of tagged types entails a number
of features. Test routines for all primitives of a given tagged type are
-placed in a separate child package named after the tagged type (so if you
-have tagged type T in package P all tests for primitives of T will be in
-P.T_Tests).
+placed in a separate child package named according to the tagged type. For
+example, if you have tagged type T in package P, all tests for primitives
+of T will be in P.T_Tests.
-By running gnattest on the second example (actual tests for this example
-are already written so no need to worry if the tool reports that 0 new stubs
-were generated).
+Consider running gnattest on the second example (note: actual tests for this
+example already exist, so there's no need to worry if the tool reports that
+no new stubs were generated):
@smallexample
cd <install_prefix>/share/examples/gnattest/tagged_rec
@@ -18008,42 +18129,42 @@ gnattest --harness-dir=driver -Ptagged_rec.gpr
@end smallexample
Taking a closer look at the test type declared in the test package
-Speed1.Controller_Tests is necessary. It is declared in
+Speed1.Controller_Tests is necessary. It is declared in:
@smallexample
<install_prefix>/share/examples/gnattest/tagged_rec/src/tests
@end smallexample
Test types are direct or indirect descendants of
-AUnit.Test_Fixtures.Test_Fixture type. For non-primitive tested subprograms
-there is no need for the user to care about them. However when generating
-test packages for primitive operations, there are some things the user
-should know.
+AUnit.Test_Fixtures.Test_Fixture type. In the case of nonprimitive tested
+subprograms, the user doesn't need to be concerned with them. However,
+when generating test packages for primitive operations, there are some things
+the user needs to know.
-Type Test_Controller has component that allows to assign it all kinds of
+Type Test_Controller has components that allow assignment of various
derivations of type Controller. And if you look at the specification of
-package Speed2.Auto_Controller, you can see, that Test_Auto_Controller
-actually derives from Test_Controller rather that AUnit type Test_Fixture.
-Thus test types repeat the hierarchy of tested types.
+package Speed2.Auto_Controller, you will see that Test_Auto_Controller
+actually derives from Test_Controller rather than AUnit type Test_Fixture.
+Thus, test types mirror the hierarchy of tested types.
The User_Set_Up procedure of Env_Mgmt package corresponding to a test package
-of primitive operations of type T assigns Fixture with a reference to an
-object of that exact type T. Notice however, that if the tagged type has
-discriminants, the User_Set_Up only has a commented template of setting
-up the fixture since filling the discriminant with actual value is up
+of primitive operations of type T assigns to Fixture a reference to an
+object of that exact type T. Notice, however, that if the tagged type has
+discriminants, the User_Set_Up only has a commented template for setting
+up the fixture, since filling the discriminant with actual value is up
to the user.
-The knowledge of the structure if test types allows to have additional testing
+The knowledge of the structure of test types allows additional testing
without additional effort. Those possibilities are described below.
-@node Test Inheritance
-@section Test Inheritance
+@node Testing Inheritance
+@section Testing Inheritance
@noindent
-Since test type hierarchy mimics the hierarchy of tested types, the
-inheritance of tests take place. An example of such inheritance can be
-shown by running the test driver generated for second example. As previously
+Since the test type hierarchy mimics the hierarchy of tested types, the
+inheritance of tests takes place. An example of such inheritance can be
+seen by running the test driver generated for the second example. As previously
mentioned, actual tests are already written for this example.
@smallexample
@@ -18052,8 +18173,8 @@ gprbuild -Ptest_driver
test_runner
@end smallexample
-There are 6 passed tests while there are only 5 testable subprograms. Test
-routine for function Speed has been inherited and ran against objects of the
+There are 6 passed tests while there are only 5 testable subprograms. The test
+routine for function Speed has been inherited and run against objects of the
derived type.
@node Tagged Types Substitutability Testing
@@ -18061,29 +18182,28 @@ derived type.
@noindent
-Tagged Types Substitutability Testing is a way of verifying by testing
-the Liskov substitution principle (LSP). LSP is a principle stating that if
+Tagged Types Substitutability Testing is a way of verifying the Liskov
+substitution principle (LSP) by testing. LSP is a principle stating that if
S is a subtype of T (in Ada, S is a derived type of tagged type T),
-then objects of type T may be replaced with objects of type S (i.e., objects
-of type S may be substituted for objects of type T), without altering any of
-the desirable properties of the program. When the properties of the program are
-expressed in the form of subprogram pre & postconditions, LSP is formulated
-as relations between the pre & post of primitive operations and the pre & post
-of theirs derived operations. The pre of a derived operation should not be
-stronger that the original pre, and the post of the derived operation should not
-be weaker than the original post. Those relations insure that verifying if a
-dyspatching call is safe can be done just with the pre & post of the root
-operation.
-
-Verifying LSP by testing consists in running all the unit tests associated with
+then objects of type T may be replaced with objects of type S (that is,
+objects of type S may be substituted for objects of type T), without
+altering any of the desirable properties of the program. When the properties
+of the program are expressed in the form of subprogram preconditions and
+postconditions (let's call them pre and post), LSP is formulated as relations
+between the pre and post of primitive operations and the pre and post of their
+derived operations. The pre of a derived operation should not be stronger than
+the original pre, and the post of the derived operation should not be weaker
+than the original post. Those relations ensure that verifying if a dispatching
+call is safe can be done just by using the pre and post of the root operation.
+
+Verifying LSP by testing consists of running all the unit tests associated with
the primitives of a given tagged type with objects of its derived types.
-In the example used by the previous section there clearly have a violation of LSP.
-The overriding primitive Adjust_Speed in package Speed2 removes the
+In the example used in the previous section, there was clearly a violation of
+LSP. The overriding primitive Adjust_Speed in package Speed2 removes the
functionality of the overridden primitive and thus doesn't respect LSP.
-Gnattest has a special option to run
-overridden parent tests against objects of the type which have overriding
-primitives.
+Gnattest has a special option to run overridden parent tests against objects
+of the type which have overriding primitives:
@smallexample
gnattest --harness-dir=driver --liskov -Ptagged_rec.gpr
@@ -18093,21 +18213,21 @@ test_runner
@end smallexample
While all the tests pass by themselves, the parent test for Adjust_Speed fails
-against object of derived type.
+against objects of the derived type.
@node Testing with Contracts
@section Testing with Contracts
@noindent
-@command{gnattest} supports pragmas Precondition, Postcondition and Test_Case.
-Test routines are generated one per each Test_Case associated with a tested
+@command{gnattest} supports pragmas Precondition, Postcondition, and Test_Case.
+Test routines are generated, one per each Test_Case associated with a tested
subprogram. Those test routines have special wrappers for tested functions
-that have composition of pre- and postcondition of the subprogram an
-"requires" and "ensures" of the Test_Case (depending on the mode pre- and post
-either count for Nominal mode or do not for Robustness mode).
+that have composition of pre- and postcondition of the subprogram with
+"requires" and "ensures" of the Test_Case (depending on the mode, pre and post
+either count for Nominal mode or do not count for Robustness mode).
-The third example demonstrates how it works:
+The third example demonstrates how this works:
@smallexample
cd <install_prefix>/share/examples/gnattest/contracts
@@ -18116,13 +18236,13 @@ gnattest --harness-dir=driver -Pcontracts.gpr
Putting actual checks within the range of the contract does not cause any
error reports. For example, for the test routine which corresponds to
-test case 1
+test case 1:
@smallexample @c ada
Assert (Sqrt (9.0) = 3.0, "wrong sqrt");
@end smallexample
-and for the test routine corresponding to test case 2
+and for the test routine corresponding to test case 2:
@smallexample @c ada
Assert (Sqrt (-5.0) = -1.0, "wrong error indication");
@@ -18136,9 +18256,9 @@ gprbuild -Ptest_driver
test_runner
@end smallexample
-However, by by changing 9.0 to 25.0 and 3.0 to 5.0 for example you can get
-a precondition violation for test case one. Also by putting any otherwise
-correct but positive pair of numbers to the second test routine you can also
+However, by changing 9.0 to 25.0 and 3.0 to 5.0, for example, you can get
+a precondition violation for test case one. Also, by using any otherwise
+correct but positive pair of numbers in the second test routine, you can also
get a precondition violation. Postconditions are checked and reported
the same way.
@@ -18146,21 +18266,23 @@ the same way.
@section Additional Tests
@noindent
-@command{gnattest} can add user written tests to the main suite of the test
-driver. @command{gnattest} traverses given packages and searches for test
+@command{gnattest} can add user-written tests to the main suite of the test
+driver. @command{gnattest} traverses the given packages and searches for test
routines. All procedures with a single in out parameter of a type which is
-a derivation of AUnit.Test_Fixtures.Test_Fixture declared in package
-specifications are added to the suites and then are executed by test driver.
-(Set_Up and Tear_Down are filtered out).
+derived from AUnit.Test_Fixtures.Test_Fixture and that are declared in package
+specifications are added to the suites and are then executed by the test driver.
+(Set_Up and Tear_Down are filtered out.)
-An example illustrates two ways of crating test harness for user written tests.
-Directory additional contains a AUnit based test driver written by hand.
+An example illustrates two ways of creating test harnesses for user-written
+tests. Directory additional_tests contains an AUnit-based test driver written
+by hand.
@smallexample
<install_prefix>/share/examples/gnattest/additional_tests/
@end smallexample
-To create a test driver for already written tests use --harness-only option:
+To create a test driver for already-written tests, use the --harness-only
+option:
@smallexample
gnattest -Padditional/harness/harness.gpr --harness-dir=harness_only \
@@ -18169,7 +18291,7 @@ gnatmake -Pharness_only/test_driver.gpr
harness_only/test_runner
@end smallexample
-Additional tests can also be executed together withgenerated tests:
+Additional tests can also be executed together with generated tests:
@smallexample
gnattest -Psimple.gpr --additional-tests=additional/harness/harness.gpr \
@@ -18187,8 +18309,8 @@ The tool currently does not support following features:
@itemize @bullet
@item generic tests for generic packages and package instantiations
-@item tests for protected operations and entries
-@item acpects Pre-, Postcondition and Test_Case
+@item tests for protected subprograms and entries
+@item aspects Precondition, Postcondition, and Test_Case
@end itemize
@c *********************************
diff --git a/gcc/ada/i-forbla.ads b/gcc/ada/i-forbla.ads
deleted file mode 100644
index 3910349a652..00000000000
--- a/gcc/ada/i-forbla.ads
+++ /dev/null
@@ -1,261 +0,0 @@
-------------------------------------------------------------------------------
--- --
--- GNAT RUN-TIME COMPONENTS --
--- --
--- I N T E R F A C E S . F O R T R A N . B L A S --
--- --
--- S p e c --
--- --
--- Copyright (C) 2006-2009, Free Software Foundation, Inc. --
--- --
--- GNAT is free software; you can redistribute it and/or modify it under --
--- terms of the GNU General Public License as published by the Free Soft- --
--- ware Foundation; either version 3, or (at your option) any later ver- --
--- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
--- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
--- or FITNESS FOR A PARTICULAR PURPOSE. --
--- --
--- As a special exception under Section 7 of GPL version 3, you are granted --
--- additional permissions described in the GCC Runtime Library Exception, --
--- version 3.1, as published by the Free Software Foundation. --
--- --
--- You should have received a copy of the GNU General Public License and --
--- a copy of the GCC Runtime Library Exception along with this program; --
--- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
--- <http://www.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 a thin binding to the standard Fortran BLAS library.
--- Documentation and a reference BLAS implementation is available from
--- ftp://ftp.netlib.org. The main purpose of this package is to facilitate
--- implementation of the Ada 2005 Ada.Numerics.Generic_Real_Arrays and
--- Ada.Numerics.Generic_Complex_Arrays packages. Bindings to other BLAS
--- routines may be added over time.
-
--- As actual linker arguments to link with the BLAS implementation differs
--- according to platform and chosen BLAS implementation, the linker arguments
--- are given in the body of this package. The body may need to be modified in
--- order to link with different BLAS implementations tuned to the specific
--- target.
-
-package Interfaces.Fortran.BLAS is
- pragma Pure;
- pragma Elaborate_Body;
-
- No_Trans : aliased constant Character := 'N';
- Trans : aliased constant Character := 'T';
- Conj_Trans : aliased constant Character := 'C';
-
- -- Vector types
-
- type Real_Vector is array (Integer range <>) of Real;
-
- type Complex_Vector is array (Integer range <>) of Complex;
-
- type Double_Precision_Vector is array (Integer range <>)
- of Double_Precision;
-
- type Double_Complex_Vector is array (Integer range <>) of Double_Complex;
-
- -- Matrix types
-
- type Real_Matrix is array (Integer range <>, Integer range <>)
- of Real;
-
- type Double_Precision_Matrix is array (Integer range <>, Integer range <>)
- of Double_Precision;
-
- type Complex_Matrix is array (Integer range <>, Integer range <>)
- of Complex;
-
- type Double_Complex_Matrix is array (Integer range <>, Integer range <>)
- of Double_Complex;
-
- -- BLAS Level 1
-
- function sdot
- (N : Positive;
- X : Real_Vector;
- Inc_X : Integer := 1;
- Y : Real_Vector;
- Inc_Y : Integer := 1) return Real;
-
- function ddot
- (N : Positive;
- X : Double_Precision_Vector;
- Inc_X : Integer := 1;
- Y : Double_Precision_Vector;
- Inc_Y : Integer := 1) return Double_Precision;
-
- function cdotu
- (N : Positive;
- X : Complex_Vector;
- Inc_X : Integer := 1;
- Y : Complex_Vector;
- Inc_Y : Integer := 1) return Complex;
-
- function zdotu
- (N : Positive;
- X : Double_Complex_Vector;
- Inc_X : Integer := 1;
- Y : Double_Complex_Vector;
- Inc_Y : Integer := 1) return Double_Complex;
-
- function snrm2
- (N : Natural;
- X : Real_Vector;
- Inc_X : Integer := 1) return Real;
-
- function dnrm2
- (N : Natural;
- X : Double_Precision_Vector;
- Inc_X : Integer := 1) return Double_Precision;
-
- function scnrm2
- (N : Natural;
- X : Complex_Vector;
- Inc_X : Integer := 1) return Real;
-
- function dznrm2
- (N : Natural;
- X : Double_Complex_Vector;
- Inc_X : Integer := 1) return Double_Precision;
-
- -- BLAS Level 2
-
- procedure sgemv
- (Trans : access constant Character;
- M : Natural := 0;
- N : Natural := 0;
- Alpha : Real := 1.0;
- A : Real_Matrix;
- Ld_A : Positive;
- X : Real_Vector;
- Inc_X : Integer := 1; -- must be non-zero
- Beta : Real := 0.0;
- Y : in out Real_Vector;
- Inc_Y : Integer := 1); -- must be non-zero
-
- procedure dgemv
- (Trans : access constant Character;
- M : Natural := 0;
- N : Natural := 0;
- Alpha : Double_Precision := 1.0;
- A : Double_Precision_Matrix;
- Ld_A : Positive;
- X : Double_Precision_Vector;
- Inc_X : Integer := 1; -- must be non-zero
- Beta : Double_Precision := 0.0;
- Y : in out Double_Precision_Vector;
- Inc_Y : Integer := 1); -- must be non-zero
-
- procedure cgemv
- (Trans : access constant Character;
- M : Natural := 0;
- N : Natural := 0;
- Alpha : Complex := (1.0, 1.0);
- A : Complex_Matrix;
- Ld_A : Positive;
- X : Complex_Vector;
- Inc_X : Integer := 1; -- must be non-zero
- Beta : Complex := (0.0, 0.0);
- Y : in out Complex_Vector;
- Inc_Y : Integer := 1); -- must be non-zero
-
- procedure zgemv
- (Trans : access constant Character;
- M : Natural := 0;
- N : Natural := 0;
- Alpha : Double_Complex := (1.0, 1.0);
- A : Double_Complex_Matrix;
- Ld_A : Positive;
- X : Double_Complex_Vector;
- Inc_X : Integer := 1; -- must be non-zero
- Beta : Double_Complex := (0.0, 0.0);
- Y : in out Double_Complex_Vector;
- Inc_Y : Integer := 1); -- must be non-zero
-
- -- BLAS Level 3
-
- procedure sgemm
- (Trans_A : access constant Character;
- Trans_B : access constant Character;
- M : Positive;
- N : Positive;
- K : Positive;
- Alpha : Real := 1.0;
- A : Real_Matrix;
- Ld_A : Integer;
- B : Real_Matrix;
- Ld_B : Integer;
- Beta : Real := 0.0;
- C : in out Real_Matrix;
- Ld_C : Integer);
-
- procedure dgemm
- (Trans_A : access constant Character;
- Trans_B : access constant Character;
- M : Positive;
- N : Positive;
- K : Positive;
- Alpha : Double_Precision := 1.0;
- A : Double_Precision_Matrix;
- Ld_A : Integer;
- B : Double_Precision_Matrix;
- Ld_B : Integer;
- Beta : Double_Precision := 0.0;
- C : in out Double_Precision_Matrix;
- Ld_C : Integer);
-
- procedure cgemm
- (Trans_A : access constant Character;
- Trans_B : access constant Character;
- M : Positive;
- N : Positive;
- K : Positive;
- Alpha : Complex := (1.0, 1.0);
- A : Complex_Matrix;
- Ld_A : Integer;
- B : Complex_Matrix;
- Ld_B : Integer;
- Beta : Complex := (0.0, 0.0);
- C : in out Complex_Matrix;
- Ld_C : Integer);
-
- procedure zgemm
- (Trans_A : access constant Character;
- Trans_B : access constant Character;
- M : Positive;
- N : Positive;
- K : Positive;
- Alpha : Double_Complex := (1.0, 1.0);
- A : Double_Complex_Matrix;
- Ld_A : Integer;
- B : Double_Complex_Matrix;
- Ld_B : Integer;
- Beta : Double_Complex := (0.0, 0.0);
- C : in out Double_Complex_Matrix;
- Ld_C : Integer);
-
-private
- pragma Import (Fortran, cdotu, "cdotu_");
- pragma Import (Fortran, cgemm, "cgemm_");
- pragma Import (Fortran, cgemv, "cgemv_");
- pragma Import (Fortran, ddot, "ddot_");
- pragma Import (Fortran, dgemm, "dgemm_");
- pragma Import (Fortran, dgemv, "dgemv_");
- pragma Import (Fortran, dnrm2, "dnrm2_");
- pragma Import (Fortran, dznrm2, "dznrm2_");
- pragma Import (Fortran, scnrm2, "scnrm2_");
- pragma Import (Fortran, sdot, "sdot_");
- pragma Import (Fortran, sgemm, "sgemm_");
- pragma Import (Fortran, sgemv, "sgemv_");
- pragma Import (Fortran, snrm2, "snrm2_");
- pragma Import (Fortran, zdotu, "zdotu_");
- pragma Import (Fortran, zgemm, "zgemm_");
- pragma Import (Fortran, zgemv, "zgemv_");
-end Interfaces.Fortran.BLAS;
diff --git a/gcc/ada/i-forlap.ads b/gcc/ada/i-forlap.ads
deleted file mode 100644
index ebb08abe654..00000000000
--- a/gcc/ada/i-forlap.ads
+++ /dev/null
@@ -1,414 +0,0 @@
-------------------------------------------------------------------------------
--- --
--- GNAT RUN-TIME COMPONENTS --
--- --
--- I N T E R F A C E S . F O R T R A N . L A P A C K --
--- --
--- S p e c --
--- --
--- Copyright (C) 2006-2009, Free Software Foundation, Inc. --
--- --
--- GNAT is free software; you can redistribute it and/or modify it under --
--- terms of the GNU General Public License as published by the Free Soft- --
--- ware Foundation; either version 3, or (at your option) any later ver- --
--- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
--- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
--- or FITNESS FOR A PARTICULAR PURPOSE. --
--- --
--- As a special exception under Section 7 of GPL version 3, you are granted --
--- additional permissions described in the GCC Runtime Library Exception, --
--- version 3.1, as published by the Free Software Foundation. --
--- --
--- You should have received a copy of the GNU General Public License and --
--- a copy of the GCC Runtime Library Exception along with this program; --
--- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
--- <http://www.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 comment required if non-RM package ???
-
-with Interfaces.Fortran.BLAS;
-package Interfaces.Fortran.LAPACK is
- pragma Pure;
-
- type Integer_Vector is array (Integer range <>) of Integer;
-
- Upper : aliased constant Character := 'U';
- Lower : aliased constant Character := 'L';
-
- subtype Real_Vector is BLAS.Real_Vector;
- subtype Real_Matrix is BLAS.Real_Matrix;
- subtype Double_Precision_Vector is BLAS.Double_Precision_Vector;
- subtype Double_Precision_Matrix is BLAS.Double_Precision_Matrix;
- subtype Complex_Vector is BLAS.Complex_Vector;
- subtype Complex_Matrix is BLAS.Complex_Matrix;
- subtype Double_Complex_Vector is BLAS.Double_Complex_Vector;
- subtype Double_Complex_Matrix is BLAS.Double_Complex_Matrix;
-
- -- LAPACK Computational Routines
-
- -- gerfs Refines the solution of a system of linear equations with
- -- a general matrix and estimates its error
- -- getrf Computes LU factorization of a general m-by-n matrix
- -- getri Computes inverse of an LU-factored general matrix
- -- square matrix, with multiple right-hand sides
- -- getrs Solves a system of linear equations with an LU-factored
- -- square matrix, with multiple right-hand sides
- -- hetrd Reduces a complex Hermitian matrix to tridiagonal form
- -- heevr Computes selected eigenvalues and, optionally, eigenvectors of
- -- a Hermitian matrix using the Relatively Robust Representations
- -- orgtr Generates the real orthogonal matrix Q determined by sytrd
- -- steqr Computes all eigenvalues and eigenvectors of a symmetric or
- -- Hermitian matrix reduced to tridiagonal form (QR algorithm)
- -- sterf Computes all eigenvalues of a real symmetric
- -- tridiagonal matrix using QR algorithm
- -- sytrd Reduces a real symmetric matrix to tridiagonal form
-
- procedure sgetrf
- (M : Natural;
- N : Natural;
- A : in out Real_Matrix;
- Ld_A : Positive;
- I_Piv : out Integer_Vector;
- Info : access Integer);
-
- procedure dgetrf
- (M : Natural;
- N : Natural;
- A : in out Double_Precision_Matrix;
- Ld_A : Positive;
- I_Piv : out Integer_Vector;
- Info : access Integer);
-
- procedure cgetrf
- (M : Natural;
- N : Natural;
- A : in out Complex_Matrix;
- Ld_A : Positive;
- I_Piv : out Integer_Vector;
- Info : access Integer);
-
- procedure zgetrf
- (M : Natural;
- N : Natural;
- A : in out Double_Complex_Matrix;
- Ld_A : Positive;
- I_Piv : out Integer_Vector;
- Info : access Integer);
-
- procedure sgetri
- (N : Natural;
- A : in out Real_Matrix;
- Ld_A : Positive;
- I_Piv : Integer_Vector;
- Work : in out Real_Vector;
- L_Work : Integer;
- Info : access Integer);
-
- procedure dgetri
- (N : Natural;
- A : in out Double_Precision_Matrix;
- Ld_A : Positive;
- I_Piv : Integer_Vector;
- Work : in out Double_Precision_Vector;
- L_Work : Integer;
- Info : access Integer);
-
- procedure cgetri
- (N : Natural;
- A : in out Complex_Matrix;
- Ld_A : Positive;
- I_Piv : Integer_Vector;
- Work : in out Complex_Vector;
- L_Work : Integer;
- Info : access Integer);
-
- procedure zgetri
- (N : Natural;
- A : in out Double_Complex_Matrix;
- Ld_A : Positive;
- I_Piv : Integer_Vector;
- Work : in out Double_Complex_Vector;
- L_Work : Integer;
- Info : access Integer);
-
- procedure sgetrs
- (Trans : access constant Character;
- N : Natural;
- N_Rhs : Natural;
- A : Real_Matrix;
- Ld_A : Positive;
- I_Piv : Integer_Vector;
- B : in out Real_Matrix;
- Ld_B : Positive;
- Info : access Integer);
-
- procedure dgetrs
- (Trans : access constant Character;
- N : Natural;
- N_Rhs : Natural;
- A : Double_Precision_Matrix;
- Ld_A : Positive;
- I_Piv : Integer_Vector;
- B : in out Double_Precision_Matrix;
- Ld_B : Positive;
- Info : access Integer);
-
- procedure cgetrs
- (Trans : access constant Character;
- N : Natural;
- N_Rhs : Natural;
- A : Complex_Matrix;
- Ld_A : Positive;
- I_Piv : Integer_Vector;
- B : in out Complex_Matrix;
- Ld_B : Positive;
- Info : access Integer);
-
- procedure zgetrs
- (Trans : access constant Character;
- N : Natural;
- N_Rhs : Natural;
- A : Double_Complex_Matrix;
- Ld_A : Positive;
- I_Piv : Integer_Vector;
- B : in out Double_Complex_Matrix;
- Ld_B : Positive;
- Info : access Integer);
-
- procedure cheevr
- (Job_Z : access constant Character;
- Rng : access constant Character;
- Uplo : access constant Character;
- N : Natural;
- A : in out Complex_Matrix;
- Ld_A : Positive;
- Vl, Vu : Real := 0.0;
- Il, Iu : Integer := 1;
- Abs_Tol : Real := 0.0;
- M : out Integer;
- W : out Real_Vector;
- Z : out Complex_Matrix;
- Ld_Z : Positive;
- I_Supp_Z : out Integer_Vector;
- Work : out Complex_Vector;
- L_Work : Integer;
- R_Work : out Real_Vector;
- LR_Work : Integer;
- I_Work : out Integer_Vector;
- LI_Work : Integer;
- Info : access Integer);
-
- procedure zheevr
- (Job_Z : access constant Character;
- Rng : access constant Character;
- Uplo : access constant Character;
- N : Natural;
- A : in out Double_Complex_Matrix;
- Ld_A : Positive;
- Vl, Vu : Double_Precision := 0.0;
- Il, Iu : Integer := 1;
- Abs_Tol : Double_Precision := 0.0;
- M : out Integer;
- W : out Double_Precision_Vector;
- Z : out Double_Complex_Matrix;
- Ld_Z : Positive;
- I_Supp_Z : out Integer_Vector;
- Work : out Double_Complex_Vector;
- L_Work : Integer;
- R_Work : out Double_Precision_Vector;
- LR_Work : Integer;
- I_Work : out Integer_Vector;
- LI_Work : Integer;
- Info : access Integer);
-
- procedure chetrd
- (Uplo : access constant Character;
- N : Natural;
- A : in out Complex_Matrix;
- Ld_A : Positive;
- D : out Real_Vector;
- E : out Real_Vector;
- Tau : out Complex_Vector;
- Work : out Complex_Vector;
- L_Work : Integer;
- Info : access Integer);
-
- procedure zhetrd
- (Uplo : access constant Character;
- N : Natural;
- A : in out Double_Complex_Matrix;
- Ld_A : Positive;
- D : out Double_Precision_Vector;
- E : out Double_Precision_Vector;
- Tau : out Double_Complex_Vector;
- Work : out Double_Complex_Vector;
- L_Work : Integer;
- Info : access Integer);
-
- procedure ssytrd
- (Uplo : access constant Character;
- N : Natural;
- A : in out Real_Matrix;
- Ld_A : Positive;
- D : out Real_Vector;
- E : out Real_Vector;
- Tau : out Real_Vector;
- Work : out Real_Vector;
- L_Work : Integer;
- Info : access Integer);
-
- procedure dsytrd
- (Uplo : access constant Character;
- N : Natural;
- A : in out Double_Precision_Matrix;
- Ld_A : Positive;
- D : out Double_Precision_Vector;
- E : out Double_Precision_Vector;
- Tau : out Double_Precision_Vector;
- Work : out Double_Precision_Vector;
- L_Work : Integer;
- Info : access Integer);
-
- procedure ssterf
- (N : Natural;
- D : in out Real_Vector;
- E : in out Real_Vector;
- Info : access Integer);
-
- procedure dsterf
- (N : Natural;
- D : in out Double_Precision_Vector;
- E : in out Double_Precision_Vector;
- Info : access Integer);
-
- procedure sorgtr
- (Uplo : access constant Character;
- N : Natural;
- A : in out Real_Matrix;
- Ld_A : Positive;
- Tau : Real_Vector;
- Work : out Real_Vector;
- L_Work : Integer;
- Info : access Integer);
-
- procedure dorgtr
- (Uplo : access constant Character;
- N : Natural;
- A : in out Double_Precision_Matrix;
- Ld_A : Positive;
- Tau : Double_Precision_Vector;
- Work : out Double_Precision_Vector;
- L_Work : Integer;
- Info : access Integer);
-
- procedure sstebz
- (Rng : access constant Character;
- Order : access constant Character;
- N : Natural;
- Vl, Vu : Real := 0.0;
- Il, Iu : Integer := 1;
- Abs_Tol : Real := 0.0;
- D : Real_Vector;
- E : Real_Vector;
- M : out Natural;
- N_Split : out Natural;
- W : out Real_Vector;
- I_Block : out Integer_Vector;
- I_Split : out Integer_Vector;
- Work : out Real_Vector;
- I_Work : out Integer_Vector;
- Info : access Integer);
-
- procedure dstebz
- (Rng : access constant Character;
- Order : access constant Character;
- N : Natural;
- Vl, Vu : Double_Precision := 0.0;
- Il, Iu : Integer := 1;
- Abs_Tol : Double_Precision := 0.0;
- D : Double_Precision_Vector;
- E : Double_Precision_Vector;
- M : out Natural;
- N_Split : out Natural;
- W : out Double_Precision_Vector;
- I_Block : out Integer_Vector;
- I_Split : out Integer_Vector;
- Work : out Double_Precision_Vector;
- I_Work : out Integer_Vector;
- Info : access Integer);
-
- procedure ssteqr
- (Comp_Z : access constant Character;
- N : Natural;
- D : in out Real_Vector;
- E : in out Real_Vector;
- Z : in out Real_Matrix;
- Ld_Z : Positive;
- Work : out Real_Vector;
- Info : access Integer);
-
- procedure dsteqr
- (Comp_Z : access constant Character;
- N : Natural;
- D : in out Double_Precision_Vector;
- E : in out Double_Precision_Vector;
- Z : in out Double_Precision_Matrix;
- Ld_Z : Positive;
- Work : out Double_Precision_Vector;
- Info : access Integer);
-
- procedure csteqr
- (Comp_Z : access constant Character;
- N : Natural;
- D : in out Real_Vector;
- E : in out Real_Vector;
- Z : in out Complex_Matrix;
- Ld_Z : Positive;
- Work : out Real_Vector;
- Info : access Integer);
-
- procedure zsteqr
- (Comp_Z : access constant Character;
- N : Natural;
- D : in out Double_Precision_Vector;
- E : in out Double_Precision_Vector;
- Z : in out Double_Complex_Matrix;
- Ld_Z : Positive;
- Work : out Double_Precision_Vector;
- Info : access Integer);
-
-private
- pragma Import (Fortran, csteqr, "csteqr_");
- pragma Import (Fortran, cgetrf, "cgetrf_");
- pragma Import (Fortran, cgetri, "cgetri_");
- pragma Import (Fortran, cgetrs, "cgetrs_");
- pragma Import (Fortran, cheevr, "cheevr_");
- pragma Import (Fortran, chetrd, "chetrd_");
- pragma Import (Fortran, dgetrf, "dgetrf_");
- pragma Import (Fortran, dgetri, "dgetri_");
- pragma Import (Fortran, dgetrs, "dgetrs_");
- pragma Import (Fortran, dsytrd, "dsytrd_");
- pragma Import (Fortran, dstebz, "dstebz_");
- pragma Import (Fortran, dsterf, "dsterf_");
- pragma Import (Fortran, dorgtr, "dorgtr_");
- pragma Import (Fortran, dsteqr, "dsteqr_");
- pragma Import (Fortran, sgetrf, "sgetrf_");
- pragma Import (Fortran, sgetri, "sgetri_");
- pragma Import (Fortran, sgetrs, "sgetrs_");
- pragma Import (Fortran, sorgtr, "sorgtr_");
- pragma Import (Fortran, sstebz, "sstebz_");
- pragma Import (Fortran, ssterf, "ssterf_");
- pragma Import (Fortran, ssteqr, "ssteqr_");
- pragma Import (Fortran, ssytrd, "ssytrd_");
- pragma Import (Fortran, zgetrf, "zgetrf_");
- pragma Import (Fortran, zgetri, "zgetri_");
- pragma Import (Fortran, zgetrs, "zgetrs_");
- pragma Import (Fortran, zheevr, "zheevr_");
- pragma Import (Fortran, zhetrd, "zhetrd_");
- pragma Import (Fortran, zsteqr, "zsteqr_");
-end Interfaces.Fortran.LAPACK;
diff --git a/gcc/ada/impunit.adb b/gcc/ada/impunit.adb
index dfe176bf38d..63ab9256953 100644
--- a/gcc/ada/impunit.adb
+++ b/gcc/ada/impunit.adb
@@ -487,9 +487,6 @@ package body Impunit is
("a-ciormu", F), -- Ada.Containers.Indefinite_Ordered_Multisets
("a-coormu", F), -- Ada.Containers.Ordered_Multisets
("a-crdlli", F), -- Ada.Containers.Restricted_Doubly_Linked_Lists
- ("a-secain", F), -- Ada.Strings.Equal_Case_Insensitive
- ("a-shcain", F), -- Ada.Strings.Hash_Case_Insensitive
- ("a-slcain", F), -- Ada.Strings.Less_Case_Insensitive
("a-szuzti", F), -- Ada.Strings.Wide_Wide_Unbounded.Wide_Wide_Text_IO
("a-zchuni", F), -- Ada.Wide_Wide_Characters.Unicode
("a-ztcstr", F), -- Ada.Wide_Wide_Text_IO.C_Streams
@@ -497,6 +494,19 @@ package body Impunit is
-- Note: strictly the following should be Ada 2012 units, but it seems
-- harmless (and useful) to make then available in Ada 2005 mode.
+ ("a-cogeso", T), -- Ada.Containers.Generic_Sort
+ ("a-secain", T), -- Ada.Strings.Equal_Case_Insensitive
+ ("a-shcain", T), -- Ada.Strings.Hash_Case_Insensitive
+ ("a-slcain", T), -- Ada.Strings.Less_Case_Insensitive
+ ("a-sfecin", T), -- Ada.Strings.Fixed.Equal_Case_Insensitive
+ ("a-sfhcin", T), -- Ada.Strings.Fixed.Hash_Case_Insensitive
+ ("a-sflcin", T), -- Ada.Strings.Fixed.Less_Case_Insensitive
+ ("a-sbecin", T), -- Ada.Strings.Bounded.Equal_Case_Insensitive
+ ("a-sbhcin", T), -- Ada.Strings.Bounded.Hash_Case_Insensitive
+ ("a-sblcin", T), -- Ada.Strings.Bounded.Less_Case_Insensitive
+ ("a-suecin", T), -- Ada.Strings.Unbounded.Equal_Case_Insensitive
+ ("a-suhcin", T), -- Ada.Strings.Unbounded.Hash_Case_Insensitive
+ ("a-sulcin", T), -- Ada.Strings.Unbounded.Less_Case_Insensitive
("a-suezst", T), -- Ada.Strings.UTF_Encoding.Wide_Wide_Strings
---------------------------
diff --git a/gcc/ada/par-labl.adb b/gcc/ada/par-labl.adb
index 8520292ecd2..9bafb07b7d1 100644
--- a/gcc/ada/par-labl.adb
+++ b/gcc/ada/par-labl.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2010, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2011, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -340,6 +340,7 @@ procedure Labl is
New_Node (N_Loop_Statement, Sloc (Loop_Header));
Stat : Node_Id;
Next_Stat : Node_Id;
+
begin
Stat := Next (Loop_Header);
while Stat /= Loop_End loop
@@ -355,7 +356,7 @@ procedure Labl is
Remove (Loop_Header);
Rewrite (Loop_End, Loop_Stmt);
Error_Msg_N
- ("code between label and backwards goto rewritten as loop?",
+ ("info: code between label and backwards goto rewritten as loop?",
Loop_End);
end Rewrite_As_Loop;
diff --git a/gcc/ada/prj-env.adb b/gcc/ada/prj-env.adb
index 9f29313a0b6..898ba8dfa35 100644
--- a/gcc/ada/prj-env.adb
+++ b/gcc/ada/prj-env.adb
@@ -2058,91 +2058,93 @@ package body Prj.Env is
Projects_Paths.Reset (Self.Cache);
end Set_Path;
- ------------------
- -- Find_Project --
- ------------------
+ -----------------------
+ -- Find_Name_In_Path --
+ -----------------------
- procedure Find_Project
- (Self : in out Project_Search_Path;
- Project_File_Name : String;
- Directory : String;
- Path : out Namet.Path_Name_Type)
+ function Find_Name_In_Path
+ (Self : Project_Search_Path;
+ Path : String) return String_Access
is
- File : constant String := Project_File_Name;
- -- Have to do a copy, in case the parameter is Name_Buffer, which we
- -- modify below
+ First : Natural;
+ Last : Natural;
- function Try_Path_Name (Path : String) return String_Access;
- pragma Inline (Try_Path_Name);
- -- Try the specified Path
+ begin
+ if Current_Verbosity = High then
+ Debug_Output ("Trying " & Path);
+ end if;
- -------------------
- -- Try_Path_Name --
- -------------------
+ if Is_Absolute_Path (Path) then
+ if Check_Filename (Path) then
+ return new String'(Path);
+ else
+ return null;
+ end if;
- function Try_Path_Name (Path : String) return String_Access is
- First : Natural;
- Last : Natural;
- Result : String_Access := null;
+ else
+ -- Because we don't want to resolve symbolic links, we cannot use
+ -- Locate_Regular_File. So, we try each possible path successively.
- begin
- if Current_Verbosity = High then
- Debug_Output ("Trying " & Path);
- end if;
+ First := Self.Path'First;
+ while First <= Self.Path'Last loop
+ while First <= Self.Path'Last
+ and then Self.Path (First) = Path_Separator
+ loop
+ First := First + 1;
+ end loop;
- if Is_Absolute_Path (Path) then
- if Is_Regular_File (Path) then
- Result := new String'(Path);
- end if;
+ exit when First > Self.Path'Last;
- else
- -- Because we don't want to resolve symbolic links, we cannot use
- -- Locate_Regular_File. So, we try each possible path
- -- successively.
-
- First := Self.Path'First;
- while First <= Self.Path'Last loop
- while First <= Self.Path'Last
- and then Self.Path (First) = Path_Separator
- loop
- First := First + 1;
- end loop;
-
- exit when First > Self.Path'Last;
-
- Last := First;
- while Last < Self.Path'Last
- and then Self.Path (Last + 1) /= Path_Separator
- loop
- Last := Last + 1;
- end loop;
-
- Name_Len := 0;
-
- if not Is_Absolute_Path (Self.Path (First .. Last)) then
- Add_Str_To_Name_Buffer (Get_Current_Dir); -- ??? System call
- Add_Char_To_Name_Buffer (Directory_Separator);
- end if;
+ Last := First;
+ while Last < Self.Path'Last
+ and then Self.Path (Last + 1) /= Path_Separator
+ loop
+ Last := Last + 1;
+ end loop;
- Add_Str_To_Name_Buffer (Self.Path (First .. Last));
+ Name_Len := 0;
+
+ if not Is_Absolute_Path (Self.Path (First .. Last)) then
+ Add_Str_To_Name_Buffer (Get_Current_Dir); -- ??? System call
Add_Char_To_Name_Buffer (Directory_Separator);
- Add_Str_To_Name_Buffer (Path);
+ end if;
- if Current_Verbosity = High then
- Debug_Output ("Testing file " & Name_Buffer (1 .. Name_Len));
- end if;
+ Add_Str_To_Name_Buffer (Self.Path (First .. Last));
+ Add_Char_To_Name_Buffer (Directory_Separator);
+ Add_Str_To_Name_Buffer (Path);
- if Is_Regular_File (Name_Buffer (1 .. Name_Len)) then
- Result := new String'(Name_Buffer (1 .. Name_Len));
- exit;
- end if;
+ if Current_Verbosity = High then
+ Debug_Output ("Testing file " & Name_Buffer (1 .. Name_Len));
+ end if;
- First := Last + 1;
- end loop;
- end if;
+ if Check_Filename (Name_Buffer (1 .. Name_Len)) then
+ return new String'(Name_Buffer (1 .. Name_Len));
+ end if;
+
+ First := Last + 1;
+ end loop;
+ end if;
+
+ return null;
+ end Find_Name_In_Path;
- return Result;
- end Try_Path_Name;
+ ------------------
+ -- Find_Project --
+ ------------------
+
+ procedure Find_Project
+ (Self : in out Project_Search_Path;
+ Project_File_Name : String;
+ Directory : String;
+ Path : out Namet.Path_Name_Type)
+ is
+ File : constant String := Project_File_Name;
+ -- Have to do a copy, in case the parameter is Name_Buffer, which we
+ -- modify below
+
+ function Try_Path_Name is new Find_Name_In_Path
+ (Check_Filename => Is_Regular_File);
+ -- Find a file in the project search path.
-- Local Declarations
@@ -2194,27 +2196,29 @@ package body Prj.Env is
if not Has_Dot then
Result := Try_Path_Name
- (Directory & Directory_Separator &
+ (Self,
+ Directory & Directory_Separator &
File & Project_File_Extension);
end if;
-- Then we try <directory>/<file_name>
if Result = null then
- Result := Try_Path_Name (Directory & Directory_Separator & File);
+ Result := Try_Path_Name
+ (Self, Directory & Directory_Separator & File);
end if;
end if;
-- Then we try <file_name>.<extension>
if Result = null and then not Has_Dot then
- Result := Try_Path_Name (File & Project_File_Extension);
+ Result := Try_Path_Name (Self, File & Project_File_Extension);
end if;
-- Then we try <file_name>
if Result = null then
- Result := Try_Path_Name (File);
+ Result := Try_Path_Name (Self, File);
end if;
-- If we cannot find the project file, we return an empty string
diff --git a/gcc/ada/prj-env.ads b/gcc/ada/prj-env.ads
index fd14a4a3c3d..79de6464a0a 100644
--- a/gcc/ada/prj-env.ads
+++ b/gcc/ada/prj-env.ads
@@ -210,6 +210,17 @@ package Prj.Env is
-- Override the value of the project path. This also removes the implicit
-- default search directories.
+ generic
+ with function Check_Filename (Name : String) return Boolean;
+ function Find_Name_In_Path
+ (Self : Project_Search_Path;
+ Path : String) return String_Access;
+ -- Find a name in the project search path of Self. Check_Filename is
+ -- the predicate to valid the search. If Path is an absolute filename,
+ -- simply calls the predicate with Path. Otherwise, calls the predicate
+ -- for each component of the path. Stops as soon as the predicate
+ -- returns True and returns the name, or returns null in case of failure.
+
procedure Find_Project
(Self : in out Project_Search_Path;
Project_File_Name : String;
diff --git a/gcc/ada/projects.texi b/gcc/ada/projects.texi
index 356104f07c0..6970733bdaf 100644
--- a/gcc/ada/projects.texi
+++ b/gcc/ada/projects.texi
@@ -2915,8 +2915,10 @@ The current list of qualifiers is:
qualified abstract project.
@item @b{standard}: a standard project is a non library project with sources.
This is the default (implicit) qualifier.
-@item @b{aggregate}: for future extension
-@item @b{aggregate library}: for future extension
+@item @b{aggregate}: a project whose sources are aggregated from other
+project files.
+@item @b{aggregate library}: a library whose sources are aggregated
+from other project or library project files.
@item @b{library}: a library project must declare both attributes
@code{Library_Name} and @code{Library_Dir}.
@item @b{configuration}: a configuration project cannot be in a project tree.
diff --git a/gcc/ada/s-atocou.ads b/gcc/ada/s-atocou.ads
index a78c4fd26cd..cad18d29896 100644
--- a/gcc/ada/s-atocou.ads
+++ b/gcc/ada/s-atocou.ads
@@ -72,7 +72,6 @@ private
type Atomic_Counter is limited record
Value : aliased Unsigned_32 := 1;
pragma Atomic (Value);
- pragma Volatile (Value);
end record;
end System.Atomic_Counters;
diff --git a/gcc/ada/s-gecobl.adb b/gcc/ada/s-gecobl.adb
deleted file mode 100644
index d20b53f31b4..00000000000
--- a/gcc/ada/s-gecobl.adb
+++ /dev/null
@@ -1,350 +0,0 @@
-------------------------------------------------------------------------------
--- --
--- GNAT RUN-TIME COMPONENTS --
--- --
--- S Y S T E M . G E N E R I C _ C O M P L E X _ B L A S --
--- --
--- B o d y --
--- --
--- Copyright (C) 2006-2009, Free Software Foundation, Inc. --
--- --
--- GNAT is free software; you can redistribute it and/or modify it under --
--- terms of the GNU General Public License as published by the Free Soft- --
--- ware Foundation; either version 3, or (at your option) any later ver- --
--- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
--- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
--- or FITNESS FOR A PARTICULAR PURPOSE. --
--- --
--- As a special exception under Section 7 of GPL version 3, you are granted --
--- additional permissions described in the GCC Runtime Library Exception, --
--- version 3.1, as published by the Free Software Foundation. --
--- --
--- You should have received a copy of the GNU General Public License and --
--- a copy of the GCC Runtime Library Exception along with this program; --
--- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
--- <http://www.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; use Ada;
-with Interfaces; use Interfaces;
-with Interfaces.Fortran; use Interfaces.Fortran;
-with Interfaces.Fortran.BLAS; use Interfaces.Fortran.BLAS;
-with System.Generic_Array_Operations; use System.Generic_Array_Operations;
-
-package body System.Generic_Complex_BLAS is
-
- Is_Single : constant Boolean :=
- Real'Machine_Mantissa = Fortran.Real'Machine_Mantissa
- and then Fortran.Real (Real'First) = Fortran.Real'First
- and then Fortran.Real (Real'Last) = Fortran.Real'Last;
-
- Is_Double : constant Boolean :=
- Real'Machine_Mantissa = Double_Precision'Machine_Mantissa
- and then
- Double_Precision (Real'First) = Double_Precision'First
- and then
- Double_Precision (Real'Last) = Double_Precision'Last;
-
- subtype Complex is Complex_Types.Complex;
-
- -- Local subprograms
-
- function To_Double_Precision (X : Real) return Double_Precision;
- pragma Inline (To_Double_Precision);
-
- function To_Double_Complex (X : Complex) return Double_Complex;
- pragma Inline (To_Double_Complex);
-
- function To_Complex (X : Double_Complex) return Complex;
- function To_Complex (X : Fortran.Complex) return Complex;
- pragma Inline (To_Complex);
-
- function To_Fortran (X : Complex) return Fortran.Complex;
- pragma Inline (To_Fortran);
-
- -- Instantiations
-
- function To_Double_Complex is new
- Vector_Elementwise_Operation
- (X_Scalar => Complex_Types.Complex,
- Result_Scalar => Fortran.Double_Complex,
- X_Vector => Complex_Vector,
- Result_Vector => BLAS.Double_Complex_Vector,
- Operation => To_Double_Complex);
-
- function To_Complex is new
- Vector_Elementwise_Operation
- (X_Scalar => Fortran.Double_Complex,
- Result_Scalar => Complex,
- X_Vector => BLAS.Double_Complex_Vector,
- Result_Vector => Complex_Vector,
- Operation => To_Complex);
-
- function To_Double_Complex is new
- Matrix_Elementwise_Operation
- (X_Scalar => Complex,
- Result_Scalar => Double_Complex,
- X_Matrix => Complex_Matrix,
- Result_Matrix => BLAS.Double_Complex_Matrix,
- Operation => To_Double_Complex);
-
- function To_Complex is new
- Matrix_Elementwise_Operation
- (X_Scalar => Double_Complex,
- Result_Scalar => Complex,
- X_Matrix => BLAS.Double_Complex_Matrix,
- Result_Matrix => Complex_Matrix,
- Operation => To_Complex);
-
- function To_Double_Precision (X : Real) return Double_Precision is
- begin
- return Double_Precision (X);
- end To_Double_Precision;
-
- function To_Double_Complex (X : Complex) return Double_Complex is
- begin
- return (To_Double_Precision (X.Re), To_Double_Precision (X.Im));
- end To_Double_Complex;
-
- function To_Complex (X : Double_Complex) return Complex is
- begin
- return (Real (X.Re), Real (X.Im));
- end To_Complex;
-
- function To_Complex (X : Fortran.Complex) return Complex is
- begin
- return (Real (X.Re), Real (X.Im));
- end To_Complex;
-
- function To_Fortran (X : Complex) return Fortran.Complex is
- begin
- return (Fortran.Real (X.Re), Fortran.Real (X.Im));
- end To_Fortran;
-
- ---------
- -- dot --
- ---------
-
- function dot
- (N : Positive;
- X : Complex_Vector;
- Inc_X : Integer := 1;
- Y : Complex_Vector;
- Inc_Y : Integer := 1) return Complex
- is
- begin
- if Is_Single then
- declare
- type X_Ptr is access all BLAS.Complex_Vector (X'Range);
- type Y_Ptr is access all BLAS.Complex_Vector (Y'Range);
- function Conv_X is new Unchecked_Conversion (Address, X_Ptr);
- function Conv_Y is new Unchecked_Conversion (Address, Y_Ptr);
- begin
- return To_Complex (BLAS.cdotu (N, Conv_X (X'Address).all, Inc_X,
- Conv_Y (Y'Address).all, Inc_Y));
- end;
-
- elsif Is_Double then
- declare
- type X_Ptr is access all BLAS.Double_Complex_Vector (X'Range);
- type Y_Ptr is access all BLAS.Double_Complex_Vector (Y'Range);
- function Conv_X is new Unchecked_Conversion (Address, X_Ptr);
- function Conv_Y is new Unchecked_Conversion (Address, Y_Ptr);
- begin
- return To_Complex (BLAS.zdotu (N, Conv_X (X'Address).all, Inc_X,
- Conv_Y (Y'Address).all, Inc_Y));
- end;
-
- else
- return To_Complex (BLAS.zdotu (N, To_Double_Complex (X), Inc_X,
- To_Double_Complex (Y), Inc_Y));
- end if;
- end dot;
-
- ----------
- -- gemm --
- ----------
-
- procedure gemm
- (Trans_A : access constant Character;
- Trans_B : access constant Character;
- M : Positive;
- N : Positive;
- K : Positive;
- Alpha : Complex := (1.0, 0.0);
- A : Complex_Matrix;
- Ld_A : Integer;
- B : Complex_Matrix;
- Ld_B : Integer;
- Beta : Complex := (0.0, 0.0);
- C : in out Complex_Matrix;
- Ld_C : Integer)
- is
- begin
- if Is_Single then
- declare
- subtype A_Type is BLAS.Complex_Matrix (A'Range (1), A'Range (2));
- subtype B_Type is BLAS.Complex_Matrix (B'Range (1), B'Range (2));
- type C_Ptr is
- access all BLAS.Complex_Matrix (C'Range (1), C'Range (2));
- function Conv_A is
- new Unchecked_Conversion (Complex_Matrix, A_Type);
- function Conv_B is
- new Unchecked_Conversion (Complex_Matrix, B_Type);
- function Conv_C is
- new Unchecked_Conversion (Address, C_Ptr);
- begin
- BLAS.cgemm (Trans_A, Trans_B, M, N, K, To_Fortran (Alpha),
- Conv_A (A), Ld_A, Conv_B (B), Ld_B, To_Fortran (Beta),
- Conv_C (C'Address).all, Ld_C);
- end;
-
- elsif Is_Double then
- declare
- subtype A_Type is
- BLAS.Double_Complex_Matrix (A'Range (1), A'Range (2));
- subtype B_Type is
- BLAS.Double_Complex_Matrix (B'Range (1), B'Range (2));
- type C_Ptr is access all
- BLAS.Double_Complex_Matrix (C'Range (1), C'Range (2));
- function Conv_A is
- new Unchecked_Conversion (Complex_Matrix, A_Type);
- function Conv_B is
- new Unchecked_Conversion (Complex_Matrix, B_Type);
- function Conv_C is new Unchecked_Conversion (Address, C_Ptr);
- begin
- BLAS.zgemm (Trans_A, Trans_B, M, N, K, To_Double_Complex (Alpha),
- Conv_A (A), Ld_A, Conv_B (B), Ld_B,
- To_Double_Complex (Beta),
- Conv_C (C'Address).all, Ld_C);
- end;
-
- else
- declare
- DP_C : BLAS.Double_Complex_Matrix (C'Range (1), C'Range (2));
- begin
- if Beta.Re /= 0.0 or else Beta.Im /= 0.0 then
- DP_C := To_Double_Complex (C);
- end if;
-
- BLAS.zgemm (Trans_A, Trans_B, M, N, K, To_Double_Complex (Alpha),
- To_Double_Complex (A), Ld_A,
- To_Double_Complex (B), Ld_B, To_Double_Complex (Beta),
- DP_C, Ld_C);
-
- C := To_Complex (DP_C);
- end;
- end if;
- end gemm;
-
- ----------
- -- gemv --
- ----------
-
- procedure gemv
- (Trans : access constant Character;
- M : Natural := 0;
- N : Natural := 0;
- Alpha : Complex := (1.0, 0.0);
- A : Complex_Matrix;
- Ld_A : Positive;
- X : Complex_Vector;
- Inc_X : Integer := 1;
- Beta : Complex := (0.0, 0.0);
- Y : in out Complex_Vector;
- Inc_Y : Integer := 1)
- is
- begin
- if Is_Single then
- declare
- subtype A_Type is BLAS.Complex_Matrix (A'Range (1), A'Range (2));
- subtype X_Type is BLAS.Complex_Vector (X'Range);
- type Y_Ptr is access all BLAS.Complex_Vector (Y'Range);
- function Conv_A is
- new Unchecked_Conversion (Complex_Matrix, A_Type);
- function Conv_X is
- new Unchecked_Conversion (Complex_Vector, X_Type);
- function Conv_Y is
- new Unchecked_Conversion (Address, Y_Ptr);
- begin
- BLAS.cgemv (Trans, M, N, To_Fortran (Alpha),
- Conv_A (A), Ld_A, Conv_X (X), Inc_X, To_Fortran (Beta),
- Conv_Y (Y'Address).all, Inc_Y);
- end;
-
- elsif Is_Double then
- declare
- subtype A_Type is
- BLAS.Double_Complex_Matrix (A'Range (1), A'Range (2));
- subtype X_Type is
- BLAS.Double_Complex_Vector (X'Range);
- type Y_Ptr is access all BLAS.Double_Complex_Vector (Y'Range);
- function Conv_A is
- new Unchecked_Conversion (Complex_Matrix, A_Type);
- function Conv_X is
- new Unchecked_Conversion (Complex_Vector, X_Type);
- function Conv_Y is
- new Unchecked_Conversion (Address, Y_Ptr);
- begin
- BLAS.zgemv (Trans, M, N, To_Double_Complex (Alpha),
- Conv_A (A), Ld_A, Conv_X (X), Inc_X,
- To_Double_Complex (Beta),
- Conv_Y (Y'Address).all, Inc_Y);
- end;
-
- else
- declare
- DP_Y : BLAS.Double_Complex_Vector (Y'Range);
- begin
- if Beta.Re /= 0.0 or else Beta.Im /= 0.0 then
- DP_Y := To_Double_Complex (Y);
- end if;
-
- BLAS.zgemv (Trans, M, N, To_Double_Complex (Alpha),
- To_Double_Complex (A), Ld_A,
- To_Double_Complex (X), Inc_X, To_Double_Complex (Beta),
- DP_Y, Inc_Y);
-
- Y := To_Complex (DP_Y);
- end;
- end if;
- end gemv;
-
- ----------
- -- nrm2 --
- ----------
-
- function nrm2
- (N : Natural;
- X : Complex_Vector;
- Inc_X : Integer := 1) return Real
- is
- begin
- if Is_Single then
- declare
- subtype X_Type is BLAS.Complex_Vector (X'Range);
- function Conv_X is
- new Unchecked_Conversion (Complex_Vector, X_Type);
- begin
- return Real (BLAS.scnrm2 (N, Conv_X (X), Inc_X));
- end;
-
- elsif Is_Double then
- declare
- subtype X_Type is BLAS.Double_Complex_Vector (X'Range);
- function Conv_X is
- new Unchecked_Conversion (Complex_Vector, X_Type);
- begin
- return Real (BLAS.dznrm2 (N, Conv_X (X), Inc_X));
- end;
-
- else
- return Real (BLAS.dznrm2 (N, To_Double_Complex (X), Inc_X));
- end if;
- end nrm2;
-
-end System.Generic_Complex_BLAS;
diff --git a/gcc/ada/s-gecobl.ads b/gcc/ada/s-gecobl.ads
deleted file mode 100644
index 85bd3b50bf0..00000000000
--- a/gcc/ada/s-gecobl.ads
+++ /dev/null
@@ -1,102 +0,0 @@
-------------------------------------------------------------------------------
--- --
--- GNAT RUN-TIME COMPONENTS --
--- --
--- S Y S T E M . G E N E R I C _ C O M P L E X _ B L A S --
--- --
--- S p e c --
--- --
--- Copyright (C) 2006-2009, Free Software Foundation, Inc. --
--- --
--- GNAT is free software; you can redistribute it and/or modify it under --
--- terms of the GNU General Public License as published by the Free Soft- --
--- ware Foundation; either version 3, or (at your option) any later ver- --
--- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
--- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
--- or FITNESS FOR A PARTICULAR PURPOSE. --
--- --
--- As a special exception under Section 7 of GPL version 3, you are granted --
--- additional permissions described in the GCC Runtime Library Exception, --
--- version 3.1, as published by the Free Software Foundation. --
--- --
--- You should have received a copy of the GNU General Public License and --
--- a copy of the GCC Runtime Library Exception along with this program; --
--- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
--- <http://www.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 comment required ???
-
-with Ada.Numerics.Generic_Complex_Types;
-
-generic
- type Real is digits <>;
- with package Complex_Types is new Ada.Numerics.Generic_Complex_Types (Real);
- use Complex_Types;
-
- type Complex_Vector is array (Integer range <>) of Complex;
- type Complex_Matrix is array (Integer range <>, Integer range <>)
- of Complex;
-package System.Generic_Complex_BLAS is
- pragma Pure;
-
- -- Although BLAS support is only available for IEEE single and double
- -- compatible floating-point types, this unit will accept any type
- -- and apply conversions as necessary, with possible loss of
- -- precision and range.
-
- No_Trans : aliased constant Character := 'N';
- Trans : aliased constant Character := 'T';
- Conj_Trans : aliased constant Character := 'C';
-
- -- BLAS Level 1 Subprograms and Types
-
- function dot
- (N : Positive;
- X : Complex_Vector;
- Inc_X : Integer := 1;
- Y : Complex_Vector;
- Inc_Y : Integer := 1) return Complex;
-
- function nrm2
- (N : Natural;
- X : Complex_Vector;
- Inc_X : Integer := 1) return Real;
-
- procedure gemv
- (Trans : access constant Character;
- M : Natural := 0;
- N : Natural := 0;
- Alpha : Complex := (1.0, 0.0);
- A : Complex_Matrix;
- Ld_A : Positive;
- X : Complex_Vector;
- Inc_X : Integer := 1; -- must be non-zero
- Beta : Complex := (0.0, 0.0);
- Y : in out Complex_Vector;
- Inc_Y : Integer := 1); -- must be non-zero
-
- -- BLAS Level 3
-
- -- gemm s, d, c, z Matrix-matrix product of general matrices
-
- procedure gemm
- (Trans_A : access constant Character;
- Trans_B : access constant Character;
- M : Positive;
- N : Positive;
- K : Positive;
- Alpha : Complex := (1.0, 0.0);
- A : Complex_Matrix;
- Ld_A : Integer;
- B : Complex_Matrix;
- Ld_B : Integer;
- Beta : Complex := (0.0, 0.0);
- C : in out Complex_Matrix;
- Ld_C : Integer);
-
-end System.Generic_Complex_BLAS;
diff --git a/gcc/ada/s-gecola.adb b/gcc/ada/s-gecola.adb
deleted file mode 100644
index ad69fee9bc5..00000000000
--- a/gcc/ada/s-gecola.adb
+++ /dev/null
@@ -1,493 +0,0 @@
-------------------------------------------------------------------------------
--- --
--- GNAT RUN-TIME COMPONENTS --
--- --
--- S Y S T E M . G E N E R I C _ C O M P L E X _ L A P A C K --
--- --
--- B o d y --
--- --
--- Copyright (C) 2006-2009, Free Software Foundation, Inc. --
--- --
--- GNAT is free software; you can redistribute it and/or modify it under --
--- terms of the GNU General Public License as published by the Free Soft- --
--- ware Foundation; either version 3, or (at your option) any later ver- --
--- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
--- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
--- or FITNESS FOR A PARTICULAR PURPOSE. --
--- --
--- As a special exception under Section 7 of GPL version 3, you are granted --
--- additional permissions described in the GCC Runtime Library Exception, --
--- version 3.1, as published by the Free Software Foundation. --
--- --
--- You should have received a copy of the GNU General Public License and --
--- a copy of the GCC Runtime Library Exception along with this program; --
--- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
--- <http://www.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; use Ada;
-with Interfaces; use Interfaces;
-with Interfaces.Fortran; use Interfaces.Fortran;
-with Interfaces.Fortran.BLAS; use Interfaces.Fortran.BLAS;
-with Interfaces.Fortran.LAPACK; use Interfaces.Fortran.LAPACK;
-with System.Generic_Array_Operations; use System.Generic_Array_Operations;
-
-package body System.Generic_Complex_LAPACK is
-
- Is_Single : constant Boolean :=
- Real'Machine_Mantissa = Fortran.Real'Machine_Mantissa
- and then Fortran.Real (Real'First) = Fortran.Real'First
- and then Fortran.Real (Real'Last) = Fortran.Real'Last;
-
- Is_Double : constant Boolean :=
- Real'Machine_Mantissa = Double_Precision'Machine_Mantissa
- and then
- Double_Precision (Real'First) = Double_Precision'First
- and then
- Double_Precision (Real'Last) = Double_Precision'Last;
-
- subtype Complex is Complex_Types.Complex;
-
- -- Local subprograms
-
- function To_Double_Precision (X : Real) return Double_Precision;
- pragma Inline (To_Double_Precision);
-
- function To_Real (X : Double_Precision) return Real;
- pragma Inline (To_Real);
-
- function To_Double_Complex (X : Complex) return Double_Complex;
- pragma Inline (To_Double_Complex);
-
- function To_Complex (X : Double_Complex) return Complex;
- pragma Inline (To_Complex);
-
- -- Instantiations
-
- function To_Double_Precision is new
- Vector_Elementwise_Operation
- (X_Scalar => Real,
- Result_Scalar => Double_Precision,
- X_Vector => Real_Vector,
- Result_Vector => Double_Precision_Vector,
- Operation => To_Double_Precision);
-
- function To_Real is new
- Vector_Elementwise_Operation
- (X_Scalar => Double_Precision,
- Result_Scalar => Real,
- X_Vector => Double_Precision_Vector,
- Result_Vector => Real_Vector,
- Operation => To_Real);
-
- function To_Double_Complex is new
- Matrix_Elementwise_Operation
- (X_Scalar => Complex,
- Result_Scalar => Double_Complex,
- X_Matrix => Complex_Matrix,
- Result_Matrix => Double_Complex_Matrix,
- Operation => To_Double_Complex);
-
- function To_Complex is new
- Matrix_Elementwise_Operation
- (X_Scalar => Double_Complex,
- Result_Scalar => Complex,
- X_Matrix => Double_Complex_Matrix,
- Result_Matrix => Complex_Matrix,
- Operation => To_Complex);
-
- function To_Double_Precision (X : Real) return Double_Precision is
- begin
- return Double_Precision (X);
- end To_Double_Precision;
-
- function To_Real (X : Double_Precision) return Real is
- begin
- return Real (X);
- end To_Real;
-
- function To_Double_Complex (X : Complex) return Double_Complex is
- begin
- return (To_Double_Precision (X.Re), To_Double_Precision (X.Im));
- end To_Double_Complex;
-
- function To_Complex (X : Double_Complex) return Complex is
- begin
- return (Real (X.Re), Real (X.Im));
- end To_Complex;
-
- -----------
- -- getrf --
- -----------
-
- procedure getrf
- (M : Natural;
- N : Natural;
- A : in out Complex_Matrix;
- Ld_A : Positive;
- I_Piv : out Integer_Vector;
- Info : access Integer)
- is
- begin
- if Is_Single then
- declare
- type A_Ptr is
- access all BLAS.Complex_Matrix (A'Range (1), A'Range (2));
- function Conv_A is new Unchecked_Conversion (Address, A_Ptr);
- begin
- cgetrf (M, N, Conv_A (A'Address).all, Ld_A,
- LAPACK.Integer_Vector (I_Piv), Info);
- end;
-
- elsif Is_Double then
- declare
- type A_Ptr is
- access all Double_Complex_Matrix (A'Range (1), A'Range (2));
- function Conv_A is new Unchecked_Conversion (Address, A_Ptr);
- begin
- zgetrf (M, N, Conv_A (A'Address).all, Ld_A,
- LAPACK.Integer_Vector (I_Piv), Info);
- end;
-
- else
- declare
- DP_A : Double_Complex_Matrix (A'Range (1), A'Range (2));
- begin
- DP_A := To_Double_Complex (A);
- zgetrf (M, N, DP_A, Ld_A, LAPACK.Integer_Vector (I_Piv), Info);
- A := To_Complex (DP_A);
- end;
- end if;
- end getrf;
-
- -----------
- -- getri --
- -----------
-
- procedure getri
- (N : Natural;
- A : in out Complex_Matrix;
- Ld_A : Positive;
- I_Piv : Integer_Vector;
- Work : in out Complex_Vector;
- L_Work : Integer;
- Info : access Integer)
- is
- begin
- if Is_Single then
- declare
- type A_Ptr is
- access all BLAS.Complex_Matrix (A'Range (1), A'Range (2));
- type Work_Ptr is
- access all BLAS.Complex_Vector (Work'Range);
- function Conv_A is new Unchecked_Conversion (Address, A_Ptr);
- function Conv_Work is new Unchecked_Conversion (Address, Work_Ptr);
- begin
- cgetri (N, Conv_A (A'Address).all, Ld_A,
- LAPACK.Integer_Vector (I_Piv),
- Conv_Work (Work'Address).all, L_Work,
- Info);
- end;
-
- elsif Is_Double then
- declare
- type A_Ptr is
- access all Double_Complex_Matrix (A'Range (1), A'Range (2));
- type Work_Ptr is
- access all Double_Complex_Vector (Work'Range);
- function Conv_A is new Unchecked_Conversion (Address, A_Ptr);
- function Conv_Work is new Unchecked_Conversion (Address, Work_Ptr);
- begin
- zgetri (N, Conv_A (A'Address).all, Ld_A,
- LAPACK.Integer_Vector (I_Piv),
- Conv_Work (Work'Address).all, L_Work,
- Info);
- end;
-
- else
- declare
- DP_A : Double_Complex_Matrix (A'Range (1), A'Range (2));
- DP_Work : Double_Complex_Vector (Work'Range);
- begin
- DP_A := To_Double_Complex (A);
- zgetri (N, DP_A, Ld_A, LAPACK.Integer_Vector (I_Piv),
- DP_Work, L_Work, Info);
- A := To_Complex (DP_A);
- Work (1) := To_Complex (DP_Work (1));
- end;
- end if;
- end getri;
-
- -----------
- -- getrs --
- -----------
-
- procedure getrs
- (Trans : access constant Character;
- N : Natural;
- N_Rhs : Natural;
- A : Complex_Matrix;
- Ld_A : Positive;
- I_Piv : Integer_Vector;
- B : in out Complex_Matrix;
- Ld_B : Positive;
- Info : access Integer)
- is
- begin
- if Is_Single then
- declare
- subtype A_Type is BLAS.Complex_Matrix (A'Range (1), A'Range (2));
- type B_Ptr is
- access all BLAS.Complex_Matrix (B'Range (1), B'Range (2));
- function Conv_A is
- new Unchecked_Conversion (Complex_Matrix, A_Type);
- function Conv_B is new Unchecked_Conversion (Address, B_Ptr);
- begin
- cgetrs (Trans, N, N_Rhs,
- Conv_A (A), Ld_A,
- LAPACK.Integer_Vector (I_Piv),
- Conv_B (B'Address).all, Ld_B,
- Info);
- end;
-
- elsif Is_Double then
- declare
- subtype A_Type is
- Double_Complex_Matrix (A'Range (1), A'Range (2));
- type B_Ptr is
- access all Double_Complex_Matrix (B'Range (1), B'Range (2));
- function Conv_A is
- new Unchecked_Conversion (Complex_Matrix, A_Type);
- function Conv_B is new Unchecked_Conversion (Address, B_Ptr);
- begin
- zgetrs (Trans, N, N_Rhs,
- Conv_A (A), Ld_A,
- LAPACK.Integer_Vector (I_Piv),
- Conv_B (B'Address).all, Ld_B,
- Info);
- end;
-
- else
- declare
- DP_A : Double_Complex_Matrix (A'Range (1), A'Range (2));
- DP_B : Double_Complex_Matrix (B'Range (1), B'Range (2));
- begin
- DP_A := To_Double_Complex (A);
- DP_B := To_Double_Complex (B);
- zgetrs (Trans, N, N_Rhs,
- DP_A, Ld_A,
- LAPACK.Integer_Vector (I_Piv),
- DP_B, Ld_B,
- Info);
- B := To_Complex (DP_B);
- end;
- end if;
- end getrs;
-
- procedure heevr
- (Job_Z : access constant Character;
- Rng : access constant Character;
- Uplo : access constant Character;
- N : Natural;
- A : in out Complex_Matrix;
- Ld_A : Positive;
- Vl, Vu : Real := 0.0;
- Il, Iu : Integer := 1;
- Abs_Tol : Real := 0.0;
- M : out Integer;
- W : out Real_Vector;
- Z : out Complex_Matrix;
- Ld_Z : Positive;
- I_Supp_Z : out Integer_Vector;
- Work : out Complex_Vector;
- L_Work : Integer;
- R_Work : out Real_Vector;
- LR_Work : Integer;
- I_Work : out Integer_Vector;
- LI_Work : Integer;
- Info : access Integer)
- is
- begin
- if Is_Single then
- declare
- type A_Ptr is
- access all BLAS.Complex_Matrix (A'Range (1), A'Range (2));
- type W_Ptr is
- access all BLAS.Real_Vector (W'Range);
- type Z_Ptr is
- access all BLAS.Complex_Matrix (Z'Range (1), Z'Range (2));
- type Work_Ptr is access all BLAS.Complex_Vector (Work'Range);
- type R_Work_Ptr is access all BLAS.Real_Vector (R_Work'Range);
-
- function Conv_A is new Unchecked_Conversion (Address, A_Ptr);
- function Conv_W is new Unchecked_Conversion (Address, W_Ptr);
- function Conv_Z is new Unchecked_Conversion (Address, Z_Ptr);
- function Conv_Work is new Unchecked_Conversion (Address, Work_Ptr);
- function Conv_R_Work is
- new Unchecked_Conversion (Address, R_Work_Ptr);
- begin
- cheevr (Job_Z, Rng, Uplo, N,
- Conv_A (A'Address).all, Ld_A,
- Fortran.Real (Vl), Fortran.Real (Vu),
- Il, Iu, Fortran.Real (Abs_Tol), M,
- Conv_W (W'Address).all,
- Conv_Z (Z'Address).all, Ld_Z,
- LAPACK.Integer_Vector (I_Supp_Z),
- Conv_Work (Work'Address).all, L_Work,
- Conv_R_Work (R_Work'Address).all, LR_Work,
- LAPACK.Integer_Vector (I_Work), LI_Work, Info);
- end;
-
- elsif Is_Double then
- declare
- type A_Ptr is
- access all BLAS.Double_Complex_Matrix (A'Range (1), A'Range (2));
- type W_Ptr is
- access all BLAS.Double_Precision_Vector (W'Range);
- type Z_Ptr is
- access all BLAS.Double_Complex_Matrix (Z'Range (1), Z'Range (2));
- type Work_Ptr is
- access all BLAS.Double_Complex_Vector (Work'Range);
- type R_Work_Ptr is
- access all BLAS.Double_Precision_Vector (R_Work'Range);
-
- function Conv_A is new Unchecked_Conversion (Address, A_Ptr);
- function Conv_W is new Unchecked_Conversion (Address, W_Ptr);
- function Conv_Z is new Unchecked_Conversion (Address, Z_Ptr);
- function Conv_Work is new Unchecked_Conversion (Address, Work_Ptr);
- function Conv_R_Work is
- new Unchecked_Conversion (Address, R_Work_Ptr);
- begin
- zheevr (Job_Z, Rng, Uplo, N,
- Conv_A (A'Address).all, Ld_A,
- Double_Precision (Vl), Double_Precision (Vu),
- Il, Iu, Double_Precision (Abs_Tol), M,
- Conv_W (W'Address).all,
- Conv_Z (Z'Address).all, Ld_Z,
- LAPACK.Integer_Vector (I_Supp_Z),
- Conv_Work (Work'Address).all, L_Work,
- Conv_R_Work (R_Work'Address).all, LR_Work,
- LAPACK.Integer_Vector (I_Work), LI_Work, Info);
- end;
-
- else
- declare
- DP_A : Double_Complex_Matrix (A'Range (1), A'Range (2));
- DP_W : Double_Precision_Vector (W'Range);
- DP_Z : Double_Complex_Matrix (Z'Range (1), Z'Range (2));
- DP_Work : Double_Complex_Vector (Work'Range);
- DP_R_Work : Double_Precision_Vector (R_Work'Range);
-
- begin
- DP_A := To_Double_Complex (A);
-
- zheevr (Job_Z, Rng, Uplo, N,
- DP_A, Ld_A,
- Double_Precision (Vl), Double_Precision (Vu),
- Il, Iu, Double_Precision (Abs_Tol), M,
- DP_W, DP_Z, Ld_Z,
- LAPACK.Integer_Vector (I_Supp_Z),
- DP_Work, L_Work,
- DP_R_Work, LR_Work,
- LAPACK.Integer_Vector (I_Work), LI_Work, Info);
-
- A := To_Complex (DP_A);
- W := To_Real (DP_W);
- Z := To_Complex (DP_Z);
-
- Work (1) := To_Complex (DP_Work (1));
- R_Work (1) := To_Real (DP_R_Work (1));
- end;
- end if;
- end heevr;
-
- -----------
- -- steqr --
- -----------
-
- procedure steqr
- (Comp_Z : access constant Character;
- N : Natural;
- D : in out Real_Vector;
- E : in out Real_Vector;
- Z : in out Complex_Matrix;
- Ld_Z : Positive;
- Work : out Real_Vector;
- Info : access Integer)
- is
- begin
- if Is_Single then
- declare
- type D_Ptr is access all BLAS.Real_Vector (D'Range);
- type E_Ptr is access all BLAS.Real_Vector (E'Range);
- type Z_Ptr is
- access all BLAS.Complex_Matrix (Z'Range (1), Z'Range (2));
- type Work_Ptr is
- access all BLAS.Real_Vector (Work'Range);
- function Conv_D is new Unchecked_Conversion (Address, D_Ptr);
- function Conv_E is new Unchecked_Conversion (Address, E_Ptr);
- function Conv_Z is new Unchecked_Conversion (Address, Z_Ptr);
- function Conv_Work is new Unchecked_Conversion (Address, Work_Ptr);
- begin
- csteqr (Comp_Z, N,
- Conv_D (D'Address).all,
- Conv_E (E'Address).all,
- Conv_Z (Z'Address).all,
- Ld_Z,
- Conv_Work (Work'Address).all,
- Info);
- end;
-
- elsif Is_Double then
- declare
- type D_Ptr is access all Double_Precision_Vector (D'Range);
- type E_Ptr is access all Double_Precision_Vector (E'Range);
- type Z_Ptr is
- access all Double_Complex_Matrix (Z'Range (1), Z'Range (2));
- type Work_Ptr is
- access all Double_Precision_Vector (Work'Range);
- function Conv_D is new Unchecked_Conversion (Address, D_Ptr);
- function Conv_E is new Unchecked_Conversion (Address, E_Ptr);
- function Conv_Z is new Unchecked_Conversion (Address, Z_Ptr);
- function Conv_Work is new Unchecked_Conversion (Address, Work_Ptr);
- begin
- zsteqr (Comp_Z, N,
- Conv_D (D'Address).all,
- Conv_E (E'Address).all,
- Conv_Z (Z'Address).all,
- Ld_Z,
- Conv_Work (Work'Address).all,
- Info);
- end;
-
- else
- declare
- DP_D : Double_Precision_Vector (D'Range);
- DP_E : Double_Precision_Vector (E'Range);
- DP_Z : Double_Complex_Matrix (Z'Range (1), Z'Range (2));
- DP_Work : Double_Precision_Vector (Work'Range);
- begin
- DP_D := To_Double_Precision (D);
- DP_E := To_Double_Precision (E);
-
- if Comp_Z.all = 'V' then
- DP_Z := To_Double_Complex (Z);
- end if;
-
- zsteqr (Comp_Z, N, DP_D, DP_E, DP_Z, Ld_Z, DP_Work, Info);
-
- D := To_Real (DP_D);
- E := To_Real (DP_E);
-
- if Comp_Z.all /= 'N' then
- Z := To_Complex (DP_Z);
- end if;
- end;
- end if;
- end steqr;
-
-end System.Generic_Complex_LAPACK;
diff --git a/gcc/ada/s-gecola.ads b/gcc/ada/s-gecola.ads
deleted file mode 100644
index eb8741ac046..00000000000
--- a/gcc/ada/s-gecola.ads
+++ /dev/null
@@ -1,131 +0,0 @@
-------------------------------------------------------------------------------
--- --
--- GNAT RUN-TIME COMPONENTS --
--- --
--- S Y S T E M . G E N E R I C _ C O M P L E X _ L A P A C K --
--- --
--- S p e c --
--- --
--- Copyright (C) 2006-2009, Free Software Foundation, Inc. --
--- --
--- GNAT is free software; you can redistribute it and/or modify it under --
--- terms of the GNU General Public License as published by the Free Soft- --
--- ware Foundation; either version 3, or (at your option) any later ver- --
--- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
--- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
--- or FITNESS FOR A PARTICULAR PURPOSE. --
--- --
--- As a special exception under Section 7 of GPL version 3, you are granted --
--- additional permissions described in the GCC Runtime Library Exception, --
--- version 3.1, as published by the Free Software Foundation. --
--- --
--- You should have received a copy of the GNU General Public License and --
--- a copy of the GCC Runtime Library Exception along with this program; --
--- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
--- <http://www.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 comment required ???
-
-with Ada.Numerics.Generic_Complex_Types;
-generic
- type Real is digits <>;
- type Real_Vector is array (Integer range <>) of Real;
-
- with package Complex_Types is new Ada.Numerics.Generic_Complex_Types (Real);
- use Complex_Types;
-
- type Complex_Vector is array (Integer range <>) of Complex;
- type Complex_Matrix is array (Integer range <>, Integer range <>)
- of Complex;
-package System.Generic_Complex_LAPACK is
- pragma Pure;
-
- type Integer_Vector is array (Integer range <>) of Integer;
-
- Upper : aliased constant Character := 'U';
- Lower : aliased constant Character := 'L';
-
- -- LAPACK Computational Routines
-
- -- getrf computes LU factorization of a general m-by-n matrix
-
- procedure getrf
- (M : Natural;
- N : Natural;
- A : in out Complex_Matrix;
- Ld_A : Positive;
- I_Piv : out Integer_Vector;
- Info : access Integer);
-
- -- getri computes inverse of an LU-factored square matrix,
- -- with multiple right-hand sides
-
- procedure getri
- (N : Natural;
- A : in out Complex_Matrix;
- Ld_A : Positive;
- I_Piv : Integer_Vector;
- Work : in out Complex_Vector;
- L_Work : Integer;
- Info : access Integer);
-
- -- getrs solves a system of linear equations with an LU-factored
- -- square matrix, with multiple right-hand sides
-
- procedure getrs
- (Trans : access constant Character;
- N : Natural;
- N_Rhs : Natural;
- A : Complex_Matrix;
- Ld_A : Positive;
- I_Piv : Integer_Vector;
- B : in out Complex_Matrix;
- Ld_B : Positive;
- Info : access Integer);
-
- -- heevr computes selected eigenvalues and, optionally,
- -- eigenvectors of a Hermitian matrix using the Relatively
- -- Robust Representations
-
- procedure heevr
- (Job_Z : access constant Character;
- Rng : access constant Character;
- Uplo : access constant Character;
- N : Natural;
- A : in out Complex_Matrix;
- Ld_A : Positive;
- Vl, Vu : Real := 0.0;
- Il, Iu : Integer := 1;
- Abs_Tol : Real := 0.0;
- M : out Integer;
- W : out Real_Vector;
- Z : out Complex_Matrix;
- Ld_Z : Positive;
- I_Supp_Z : out Integer_Vector;
- Work : out Complex_Vector;
- L_Work : Integer;
- R_Work : out Real_Vector;
- LR_Work : Integer;
- I_Work : out Integer_Vector;
- LI_Work : Integer;
- Info : access Integer);
-
- -- steqr computes all eigenvalues and eigenvectors of a symmetric or
- -- Hermitian matrix reduced to tridiagonal form (QR algorithm)
-
- procedure steqr
- (Comp_Z : access constant Character;
- N : Natural;
- D : in out Real_Vector;
- E : in out Real_Vector;
- Z : in out Complex_Matrix;
- Ld_Z : Positive;
- Work : out Real_Vector;
- Info : access Integer);
-
-end System.Generic_Complex_LAPACK;
diff --git a/gcc/ada/s-gerebl.adb b/gcc/ada/s-gerebl.adb
deleted file mode 100644
index fc2f5d7d604..00000000000
--- a/gcc/ada/s-gerebl.adb
+++ /dev/null
@@ -1,311 +0,0 @@
-------------------------------------------------------------------------------
--- --
--- GNAT RUN-TIME COMPONENTS --
--- --
--- S Y S T E M . G E N E R I C _ R E A L _ B L A S --
--- --
--- B o d y --
--- --
--- Copyright (C) 2006-2009, Free Software Foundation, Inc. --
--- --
--- GNAT is free software; you can redistribute it and/or modify it under --
--- terms of the GNU General Public License as published by the Free Soft- --
--- ware Foundation; either version 3, or (at your option) any later ver- --
--- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
--- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
--- or FITNESS FOR A PARTICULAR PURPOSE. --
--- --
--- As a special exception under Section 7 of GPL version 3, you are granted --
--- additional permissions described in the GCC Runtime Library Exception, --
--- version 3.1, as published by the Free Software Foundation. --
--- --
--- You should have received a copy of the GNU General Public License and --
--- a copy of the GCC Runtime Library Exception along with this program; --
--- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
--- <http://www.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; use Ada;
-with Interfaces; use Interfaces;
-with Interfaces.Fortran; use Interfaces.Fortran;
-with Interfaces.Fortran.BLAS; use Interfaces.Fortran.BLAS;
-with System.Generic_Array_Operations; use System.Generic_Array_Operations;
-
-package body System.Generic_Real_BLAS is
-
- Is_Single : constant Boolean :=
- Real'Machine_Mantissa = Fortran.Real'Machine_Mantissa
- and then Fortran.Real (Real'First) = Fortran.Real'First
- and then Fortran.Real (Real'Last) = Fortran.Real'Last;
-
- Is_Double : constant Boolean :=
- Real'Machine_Mantissa = Double_Precision'Machine_Mantissa
- and then
- Double_Precision (Real'First) = Double_Precision'First
- and then
- Double_Precision (Real'Last) = Double_Precision'Last;
-
- -- Local subprograms
-
- function To_Double_Precision (X : Real) return Double_Precision;
- pragma Inline_Always (To_Double_Precision);
-
- function To_Real (X : Double_Precision) return Real;
- pragma Inline_Always (To_Real);
-
- -- Instantiations
-
- function To_Double_Precision is new
- Vector_Elementwise_Operation
- (X_Scalar => Real,
- Result_Scalar => Double_Precision,
- X_Vector => Real_Vector,
- Result_Vector => Double_Precision_Vector,
- Operation => To_Double_Precision);
-
- function To_Real is new
- Vector_Elementwise_Operation
- (X_Scalar => Double_Precision,
- Result_Scalar => Real,
- X_Vector => Double_Precision_Vector,
- Result_Vector => Real_Vector,
- Operation => To_Real);
-
- function To_Double_Precision is new
- Matrix_Elementwise_Operation
- (X_Scalar => Real,
- Result_Scalar => Double_Precision,
- X_Matrix => Real_Matrix,
- Result_Matrix => Double_Precision_Matrix,
- Operation => To_Double_Precision);
-
- function To_Real is new
- Matrix_Elementwise_Operation
- (X_Scalar => Double_Precision,
- Result_Scalar => Real,
- X_Matrix => Double_Precision_Matrix,
- Result_Matrix => Real_Matrix,
- Operation => To_Real);
-
- function To_Double_Precision (X : Real) return Double_Precision is
- begin
- return Double_Precision (X);
- end To_Double_Precision;
-
- function To_Real (X : Double_Precision) return Real is
- begin
- return Real (X);
- end To_Real;
-
- ---------
- -- dot --
- ---------
-
- function dot
- (N : Positive;
- X : Real_Vector;
- Inc_X : Integer := 1;
- Y : Real_Vector;
- Inc_Y : Integer := 1) return Real
- is
- begin
- if Is_Single then
- declare
- type X_Ptr is access all BLAS.Real_Vector (X'Range);
- type Y_Ptr is access all BLAS.Real_Vector (Y'Range);
- function Conv_X is new Unchecked_Conversion (Address, X_Ptr);
- function Conv_Y is new Unchecked_Conversion (Address, Y_Ptr);
- begin
- return Real (sdot (N, Conv_X (X'Address).all, Inc_X,
- Conv_Y (Y'Address).all, Inc_Y));
- end;
-
- elsif Is_Double then
- declare
- type X_Ptr is access all BLAS.Double_Precision_Vector (X'Range);
- type Y_Ptr is access all BLAS.Double_Precision_Vector (Y'Range);
- function Conv_X is new Unchecked_Conversion (Address, X_Ptr);
- function Conv_Y is new Unchecked_Conversion (Address, Y_Ptr);
- begin
- return Real (ddot (N, Conv_X (X'Address).all, Inc_X,
- Conv_Y (Y'Address).all, Inc_Y));
- end;
-
- else
- return Real (ddot (N, To_Double_Precision (X), Inc_X,
- To_Double_Precision (Y), Inc_Y));
- end if;
- end dot;
-
- ----------
- -- gemm --
- ----------
-
- procedure gemm
- (Trans_A : access constant Character;
- Trans_B : access constant Character;
- M : Positive;
- N : Positive;
- K : Positive;
- Alpha : Real := 1.0;
- A : Real_Matrix;
- Ld_A : Integer;
- B : Real_Matrix;
- Ld_B : Integer;
- Beta : Real := 0.0;
- C : in out Real_Matrix;
- Ld_C : Integer)
- is
- begin
- if Is_Single then
- declare
- subtype A_Type is BLAS.Real_Matrix (A'Range (1), A'Range (2));
- subtype B_Type is BLAS.Real_Matrix (B'Range (1), B'Range (2));
- type C_Ptr is
- access all BLAS.Real_Matrix (C'Range (1), C'Range (2));
- function Conv_A is new Unchecked_Conversion (Real_Matrix, A_Type);
- function Conv_B is new Unchecked_Conversion (Real_Matrix, B_Type);
- function Conv_C is new Unchecked_Conversion (Address, C_Ptr);
- begin
- sgemm (Trans_A, Trans_B, M, N, K, Fortran.Real (Alpha),
- Conv_A (A), Ld_A, Conv_B (B), Ld_B, Fortran.Real (Beta),
- Conv_C (C'Address).all, Ld_C);
- end;
-
- elsif Is_Double then
- declare
- subtype A_Type is
- Double_Precision_Matrix (A'Range (1), A'Range (2));
- subtype B_Type is
- Double_Precision_Matrix (B'Range (1), B'Range (2));
- type C_Ptr is
- access all Double_Precision_Matrix (C'Range (1), C'Range (2));
- function Conv_A is new Unchecked_Conversion (Real_Matrix, A_Type);
- function Conv_B is new Unchecked_Conversion (Real_Matrix, B_Type);
- function Conv_C is new Unchecked_Conversion (Address, C_Ptr);
- begin
- dgemm (Trans_A, Trans_B, M, N, K, Double_Precision (Alpha),
- Conv_A (A), Ld_A, Conv_B (B), Ld_B, Double_Precision (Beta),
- Conv_C (C'Address).all, Ld_C);
- end;
-
- else
- declare
- DP_C : Double_Precision_Matrix (C'Range (1), C'Range (2));
- begin
- if Beta /= 0.0 then
- DP_C := To_Double_Precision (C);
- end if;
-
- dgemm (Trans_A, Trans_B, M, N, K, Double_Precision (Alpha),
- To_Double_Precision (A), Ld_A,
- To_Double_Precision (B), Ld_B, Double_Precision (Beta),
- DP_C, Ld_C);
-
- C := To_Real (DP_C);
- end;
- end if;
- end gemm;
-
- ----------
- -- gemv --
- ----------
-
- procedure gemv
- (Trans : access constant Character;
- M : Natural := 0;
- N : Natural := 0;
- Alpha : Real := 1.0;
- A : Real_Matrix;
- Ld_A : Positive;
- X : Real_Vector;
- Inc_X : Integer := 1;
- Beta : Real := 0.0;
- Y : in out Real_Vector;
- Inc_Y : Integer := 1)
- is
- begin
- if Is_Single then
- declare
- subtype A_Type is BLAS.Real_Matrix (A'Range (1), A'Range (2));
- subtype X_Type is BLAS.Real_Vector (X'Range);
- type Y_Ptr is access all BLAS.Real_Vector (Y'Range);
- function Conv_A is new Unchecked_Conversion (Real_Matrix, A_Type);
- function Conv_X is new Unchecked_Conversion (Real_Vector, X_Type);
- function Conv_Y is new Unchecked_Conversion (Address, Y_Ptr);
- begin
- sgemv (Trans, M, N, Fortran.Real (Alpha),
- Conv_A (A), Ld_A, Conv_X (X), Inc_X, Fortran.Real (Beta),
- Conv_Y (Y'Address).all, Inc_Y);
- end;
-
- elsif Is_Double then
- declare
- subtype A_Type is
- Double_Precision_Matrix (A'Range (1), A'Range (2));
- subtype X_Type is Double_Precision_Vector (X'Range);
- type Y_Ptr is access all Double_Precision_Vector (Y'Range);
- function Conv_A is new Unchecked_Conversion (Real_Matrix, A_Type);
- function Conv_X is new Unchecked_Conversion (Real_Vector, X_Type);
- function Conv_Y is new Unchecked_Conversion (Address, Y_Ptr);
- begin
- dgemv (Trans, M, N, Double_Precision (Alpha),
- Conv_A (A), Ld_A, Conv_X (X), Inc_X,
- Double_Precision (Beta),
- Conv_Y (Y'Address).all, Inc_Y);
- end;
-
- else
- declare
- DP_Y : Double_Precision_Vector (Y'Range);
- begin
- if Beta /= 0.0 then
- DP_Y := To_Double_Precision (Y);
- end if;
-
- dgemv (Trans, M, N, Double_Precision (Alpha),
- To_Double_Precision (A), Ld_A,
- To_Double_Precision (X), Inc_X, Double_Precision (Beta),
- DP_Y, Inc_Y);
-
- Y := To_Real (DP_Y);
- end;
- end if;
- end gemv;
-
- ----------
- -- nrm2 --
- ----------
-
- function nrm2
- (N : Natural;
- X : Real_Vector;
- Inc_X : Integer := 1) return Real
- is
- begin
- if Is_Single then
- declare
- subtype X_Type is BLAS.Real_Vector (X'Range);
- function Conv_X is new Unchecked_Conversion (Real_Vector, X_Type);
- begin
- return Real (snrm2 (N, Conv_X (X), Inc_X));
- end;
-
- elsif Is_Double then
- declare
- subtype X_Type is Double_Precision_Vector (X'Range);
- function Conv_X is new Unchecked_Conversion (Real_Vector, X_Type);
- begin
- return Real (dnrm2 (N, Conv_X (X), Inc_X));
- end;
-
- else
- return Real (dnrm2 (N, To_Double_Precision (X), Inc_X));
- end if;
- end nrm2;
-
-end System.Generic_Real_BLAS;
diff --git a/gcc/ada/s-gerebl.ads b/gcc/ada/s-gerebl.ads
deleted file mode 100644
index dacbf7bdb13..00000000000
--- a/gcc/ada/s-gerebl.ads
+++ /dev/null
@@ -1,96 +0,0 @@
-------------------------------------------------------------------------------
--- --
--- GNAT RUN-TIME COMPONENTS --
--- --
--- SYSTEM.GENERIC_REAL_BLAS --
--- --
--- S p e c --
--- --
--- Copyright (C) 2009, Free Software Foundation, Inc. --
--- --
--- GNAT is free software; you can redistribute it and/or modify it under --
--- terms of the GNU General Public License as published by the Free Soft- --
--- ware Foundation; either version 3, or (at your option) any later ver- --
--- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
--- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
--- or FITNESS FOR A PARTICULAR PURPOSE. --
--- --
--- As a special exception under Section 7 of GPL version 3, you are granted --
--- additional permissions described in the GCC Runtime Library Exception, --
--- version 3.1, as published by the Free Software Foundation. --
--- --
--- You should have received a copy of the GNU General Public License and --
--- a copy of the GCC Runtime Library Exception along with this program; --
--- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
--- <http://www.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 comment required ???
-
-generic
- type Real is digits <>;
- type Real_Vector is array (Integer range <>) of Real;
- type Real_Matrix is array (Integer range <>, Integer range <>) of Real;
-package System.Generic_Real_BLAS is
- pragma Pure;
-
- -- Although BLAS support is only available for IEEE single and double
- -- compatible floating-point types, this unit will accept any type
- -- and apply conversions as necessary, with possible loss of
- -- precision and range.
-
- No_Trans : aliased constant Character := 'N';
- Trans : aliased constant Character := 'T';
- Conj_Trans : aliased constant Character := 'C';
-
- -- BLAS Level 1 Subprograms and Types
-
- function dot
- (N : Positive;
- X : Real_Vector;
- Inc_X : Integer := 1;
- Y : Real_Vector;
- Inc_Y : Integer := 1) return Real;
-
- function nrm2
- (N : Natural;
- X : Real_Vector;
- Inc_X : Integer := 1) return Real;
-
- procedure gemv
- (Trans : access constant Character;
- M : Natural := 0;
- N : Natural := 0;
- Alpha : Real := 1.0;
- A : Real_Matrix;
- Ld_A : Positive;
- X : Real_Vector;
- Inc_X : Integer := 1; -- must be non-zero
- Beta : Real := 0.0;
- Y : in out Real_Vector;
- Inc_Y : Integer := 1); -- must be non-zero
-
- -- BLAS Level 3
-
- -- gemm s, d, c, z Matrix-matrix product of general matrices
-
- procedure gemm
- (Trans_A : access constant Character;
- Trans_B : access constant Character;
- M : Positive;
- N : Positive;
- K : Positive;
- Alpha : Real := 1.0;
- A : Real_Matrix;
- Ld_A : Integer;
- B : Real_Matrix;
- Ld_B : Integer;
- Beta : Real := 0.0;
- C : in out Real_Matrix;
- Ld_C : Integer);
-
-end System.Generic_Real_BLAS;
diff --git a/gcc/ada/s-gerela.adb b/gcc/ada/s-gerela.adb
deleted file mode 100644
index 57d3640ad4d..00000000000
--- a/gcc/ada/s-gerela.adb
+++ /dev/null
@@ -1,564 +0,0 @@
-------------------------------------------------------------------------------
--- --
--- GNAT RUN-TIME COMPONENTS --
--- --
--- SYSTEM.GENERIC_REAL_LAPACK --
--- --
--- B o d y --
--- --
--- Copyright (C) 2009, Free Software Foundation, Inc. --
--- --
--- GNAT is free software; you can redistribute it and/or modify it under --
--- terms of the GNU General Public License as published by the Free Soft- --
--- ware Foundation; either version 3, or (at your option) any later ver- --
--- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
--- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
--- or FITNESS FOR A PARTICULAR PURPOSE. --
--- --
--- As a special exception under Section 7 of GPL version 3, you are granted --
--- additional permissions described in the GCC Runtime Library Exception, --
--- version 3.1, as published by the Free Software Foundation. --
--- --
--- You should have received a copy of the GNU General Public License and --
--- a copy of the GCC Runtime Library Exception along with this program; --
--- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
--- <http://www.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; use Ada;
-with Interfaces; use Interfaces;
-with Interfaces.Fortran; use Interfaces.Fortran;
-with Interfaces.Fortran.BLAS; use Interfaces.Fortran.BLAS;
-with Interfaces.Fortran.LAPACK; use Interfaces.Fortran.LAPACK;
-with System.Generic_Array_Operations; use System.Generic_Array_Operations;
-
-package body System.Generic_Real_LAPACK is
-
- Is_Real : constant Boolean :=
- Real'Machine_Mantissa = Fortran.Real'Machine_Mantissa
- and then Fortran.Real (Real'First) = Fortran.Real'First
- and then Fortran.Real (Real'Last) = Fortran.Real'Last;
-
- Is_Double_Precision : constant Boolean :=
- Real'Machine_Mantissa =
- Double_Precision'Machine_Mantissa
- and then
- Double_Precision (Real'First) =
- Double_Precision'First
- and then
- Double_Precision (Real'Last) =
- Double_Precision'Last;
-
- -- Local subprograms
-
- function To_Double_Precision (X : Real) return Double_Precision;
- pragma Inline_Always (To_Double_Precision);
-
- function To_Real (X : Double_Precision) return Real;
- pragma Inline_Always (To_Real);
-
- -- Instantiations
-
- function To_Double_Precision is new
- Vector_Elementwise_Operation
- (X_Scalar => Real,
- Result_Scalar => Double_Precision,
- X_Vector => Real_Vector,
- Result_Vector => Double_Precision_Vector,
- Operation => To_Double_Precision);
-
- function To_Real is new
- Vector_Elementwise_Operation
- (X_Scalar => Double_Precision,
- Result_Scalar => Real,
- X_Vector => Double_Precision_Vector,
- Result_Vector => Real_Vector,
- Operation => To_Real);
-
- function To_Double_Precision is new
- Matrix_Elementwise_Operation
- (X_Scalar => Real,
- Result_Scalar => Double_Precision,
- X_Matrix => Real_Matrix,
- Result_Matrix => Double_Precision_Matrix,
- Operation => To_Double_Precision);
-
- function To_Real is new
- Matrix_Elementwise_Operation
- (X_Scalar => Double_Precision,
- Result_Scalar => Real,
- X_Matrix => Double_Precision_Matrix,
- Result_Matrix => Real_Matrix,
- Operation => To_Real);
-
- function To_Double_Precision (X : Real) return Double_Precision is
- begin
- return Double_Precision (X);
- end To_Double_Precision;
-
- function To_Real (X : Double_Precision) return Real is
- begin
- return Real (X);
- end To_Real;
-
- -----------
- -- getrf --
- -----------
-
- procedure getrf
- (M : Natural;
- N : Natural;
- A : in out Real_Matrix;
- Ld_A : Positive;
- I_Piv : out Integer_Vector;
- Info : access Integer)
- is
- begin
- if Is_Real then
- declare
- type A_Ptr is
- access all BLAS.Real_Matrix (A'Range (1), A'Range (2));
- function Conv_A is new Unchecked_Conversion (Address, A_Ptr);
- begin
- sgetrf (M, N, Conv_A (A'Address).all, Ld_A,
- LAPACK.Integer_Vector (I_Piv), Info);
- end;
-
- elsif Is_Double_Precision then
- declare
- type A_Ptr is
- access all Double_Precision_Matrix (A'Range (1), A'Range (2));
- function Conv_A is new Unchecked_Conversion (Address, A_Ptr);
- begin
- dgetrf (M, N, Conv_A (A'Address).all, Ld_A,
- LAPACK.Integer_Vector (I_Piv), Info);
- end;
-
- else
- declare
- DP_A : Double_Precision_Matrix (A'Range (1), A'Range (2));
- begin
- DP_A := To_Double_Precision (A);
- dgetrf (M, N, DP_A, Ld_A, LAPACK.Integer_Vector (I_Piv), Info);
- A := To_Real (DP_A);
- end;
- end if;
- end getrf;
-
- -----------
- -- getri --
- -----------
-
- procedure getri
- (N : Natural;
- A : in out Real_Matrix;
- Ld_A : Positive;
- I_Piv : Integer_Vector;
- Work : in out Real_Vector;
- L_Work : Integer;
- Info : access Integer)
- is
- begin
- if Is_Real then
- declare
- type A_Ptr is
- access all BLAS.Real_Matrix (A'Range (1), A'Range (2));
- type Work_Ptr is
- access all BLAS.Real_Vector (Work'Range);
- function Conv_A is new Unchecked_Conversion (Address, A_Ptr);
- function Conv_Work is new Unchecked_Conversion (Address, Work_Ptr);
- begin
- sgetri (N, Conv_A (A'Address).all, Ld_A,
- LAPACK.Integer_Vector (I_Piv),
- Conv_Work (Work'Address).all, L_Work,
- Info);
- end;
-
- elsif Is_Double_Precision then
- declare
- type A_Ptr is
- access all Double_Precision_Matrix (A'Range (1), A'Range (2));
- type Work_Ptr is
- access all Double_Precision_Vector (Work'Range);
- function Conv_A is new Unchecked_Conversion (Address, A_Ptr);
- function Conv_Work is new Unchecked_Conversion (Address, Work_Ptr);
- begin
- dgetri (N, Conv_A (A'Address).all, Ld_A,
- LAPACK.Integer_Vector (I_Piv),
- Conv_Work (Work'Address).all, L_Work,
- Info);
- end;
-
- else
- declare
- DP_A : Double_Precision_Matrix (A'Range (1), A'Range (2));
- DP_Work : Double_Precision_Vector (Work'Range);
- begin
- DP_A := To_Double_Precision (A);
- dgetri (N, DP_A, Ld_A, LAPACK.Integer_Vector (I_Piv),
- DP_Work, L_Work, Info);
- A := To_Real (DP_A);
- Work (1) := To_Real (DP_Work (1));
- end;
- end if;
- end getri;
-
- -----------
- -- getrs --
- -----------
-
- procedure getrs
- (Trans : access constant Character;
- N : Natural;
- N_Rhs : Natural;
- A : Real_Matrix;
- Ld_A : Positive;
- I_Piv : Integer_Vector;
- B : in out Real_Matrix;
- Ld_B : Positive;
- Info : access Integer)
- is
- begin
- if Is_Real then
- declare
- subtype A_Type is BLAS.Real_Matrix (A'Range (1), A'Range (2));
- type B_Ptr is
- access all BLAS.Real_Matrix (B'Range (1), B'Range (2));
- function Conv_A is new Unchecked_Conversion (Real_Matrix, A_Type);
- function Conv_B is new Unchecked_Conversion (Address, B_Ptr);
- begin
- sgetrs (Trans, N, N_Rhs,
- Conv_A (A), Ld_A,
- LAPACK.Integer_Vector (I_Piv),
- Conv_B (B'Address).all, Ld_B,
- Info);
- end;
-
- elsif Is_Double_Precision then
- declare
- subtype A_Type is
- Double_Precision_Matrix (A'Range (1), A'Range (2));
- type B_Ptr is
- access all Double_Precision_Matrix (B'Range (1), B'Range (2));
- function Conv_A is new Unchecked_Conversion (Real_Matrix, A_Type);
- function Conv_B is new Unchecked_Conversion (Address, B_Ptr);
- begin
- dgetrs (Trans, N, N_Rhs,
- Conv_A (A), Ld_A,
- LAPACK.Integer_Vector (I_Piv),
- Conv_B (B'Address).all, Ld_B,
- Info);
- end;
-
- else
- declare
- DP_A : Double_Precision_Matrix (A'Range (1), A'Range (2));
- DP_B : Double_Precision_Matrix (B'Range (1), B'Range (2));
- begin
- DP_A := To_Double_Precision (A);
- DP_B := To_Double_Precision (B);
- dgetrs (Trans, N, N_Rhs,
- DP_A, Ld_A,
- LAPACK.Integer_Vector (I_Piv),
- DP_B, Ld_B,
- Info);
- B := To_Real (DP_B);
- end;
- end if;
- end getrs;
-
- -----------
- -- orgtr --
- -----------
-
- procedure orgtr
- (Uplo : access constant Character;
- N : Natural;
- A : in out Real_Matrix;
- Ld_A : Positive;
- Tau : Real_Vector;
- Work : out Real_Vector;
- L_Work : Integer;
- Info : access Integer)
- is
- begin
- if Is_Real then
- declare
- type A_Ptr is
- access all BLAS.Real_Matrix (A'Range (1), A'Range (2));
- subtype Tau_Type is BLAS.Real_Vector (Tau'Range);
- type Work_Ptr is
- access all BLAS.Real_Vector (Work'Range);
- function Conv_A is new Unchecked_Conversion (Address, A_Ptr);
- function Conv_Tau is
- new Unchecked_Conversion (Real_Vector, Tau_Type);
- function Conv_Work is new Unchecked_Conversion (Address, Work_Ptr);
- begin
- sorgtr (Uplo, N,
- Conv_A (A'Address).all, Ld_A,
- Conv_Tau (Tau),
- Conv_Work (Work'Address).all, L_Work,
- Info);
- end;
-
- elsif Is_Double_Precision then
- declare
- type A_Ptr is
- access all Double_Precision_Matrix (A'Range (1), A'Range (2));
- subtype Tau_Type is Double_Precision_Vector (Tau'Range);
- type Work_Ptr is
- access all Double_Precision_Vector (Work'Range);
- function Conv_A is new Unchecked_Conversion (Address, A_Ptr);
- function Conv_Tau is
- new Unchecked_Conversion (Real_Vector, Tau_Type);
- function Conv_Work is new Unchecked_Conversion (Address, Work_Ptr);
- begin
- dorgtr (Uplo, N,
- Conv_A (A'Address).all, Ld_A,
- Conv_Tau (Tau),
- Conv_Work (Work'Address).all, L_Work,
- Info);
- end;
-
- else
- declare
- DP_A : Double_Precision_Matrix (A'Range (1), A'Range (2));
- DP_Work : Double_Precision_Vector (Work'Range);
- DP_Tau : Double_Precision_Vector (Tau'Range);
- begin
- DP_A := To_Double_Precision (A);
- DP_Tau := To_Double_Precision (Tau);
- dorgtr (Uplo, N, DP_A, Ld_A, DP_Tau, DP_Work, L_Work, Info);
- A := To_Real (DP_A);
- Work (1) := To_Real (DP_Work (1));
- end;
- end if;
- end orgtr;
-
- -----------
- -- steqr --
- -----------
-
- procedure steqr
- (Comp_Z : access constant Character;
- N : Natural;
- D : in out Real_Vector;
- E : in out Real_Vector;
- Z : in out Real_Matrix;
- Ld_Z : Positive;
- Work : out Real_Vector;
- Info : access Integer)
- is
- begin
- if Is_Real then
- declare
- type D_Ptr is access all BLAS.Real_Vector (D'Range);
- type E_Ptr is access all BLAS.Real_Vector (E'Range);
- type Z_Ptr is
- access all BLAS.Real_Matrix (Z'Range (1), Z'Range (2));
- type Work_Ptr is
- access all BLAS.Real_Vector (Work'Range);
- function Conv_D is new Unchecked_Conversion (Address, D_Ptr);
- function Conv_E is new Unchecked_Conversion (Address, E_Ptr);
- function Conv_Z is new Unchecked_Conversion (Address, Z_Ptr);
- function Conv_Work is new Unchecked_Conversion (Address, Work_Ptr);
- begin
- ssteqr (Comp_Z, N,
- Conv_D (D'Address).all,
- Conv_E (E'Address).all,
- Conv_Z (Z'Address).all,
- Ld_Z,
- Conv_Work (Work'Address).all,
- Info);
- end;
-
- elsif Is_Double_Precision then
- declare
- type D_Ptr is access all Double_Precision_Vector (D'Range);
- type E_Ptr is access all Double_Precision_Vector (E'Range);
- type Z_Ptr is
- access all Double_Precision_Matrix (Z'Range (1), Z'Range (2));
- type Work_Ptr is
- access all Double_Precision_Vector (Work'Range);
- function Conv_D is new Unchecked_Conversion (Address, D_Ptr);
- function Conv_E is new Unchecked_Conversion (Address, E_Ptr);
- function Conv_Z is new Unchecked_Conversion (Address, Z_Ptr);
- function Conv_Work is new Unchecked_Conversion (Address, Work_Ptr);
- begin
- dsteqr (Comp_Z, N,
- Conv_D (D'Address).all,
- Conv_E (E'Address).all,
- Conv_Z (Z'Address).all,
- Ld_Z,
- Conv_Work (Work'Address).all,
- Info);
- end;
-
- else
- declare
- DP_D : Double_Precision_Vector (D'Range);
- DP_E : Double_Precision_Vector (E'Range);
- DP_Z : Double_Precision_Matrix (Z'Range (1), Z'Range (2));
- DP_Work : Double_Precision_Vector (Work'Range);
- begin
- DP_D := To_Double_Precision (D);
- DP_E := To_Double_Precision (E);
-
- if Comp_Z.all = 'V' then
- DP_Z := To_Double_Precision (Z);
- end if;
-
- dsteqr (Comp_Z, N, DP_D, DP_E, DP_Z, Ld_Z, DP_Work, Info);
-
- D := To_Real (DP_D);
- E := To_Real (DP_E);
- Z := To_Real (DP_Z);
- end;
- end if;
- end steqr;
-
- -----------
- -- sterf --
- -----------
-
- procedure sterf
- (N : Natural;
- D : in out Real_Vector;
- E : in out Real_Vector;
- Info : access Integer)
- is
- begin
- if Is_Real then
- declare
- type D_Ptr is access all BLAS.Real_Vector (D'Range);
- type E_Ptr is access all BLAS.Real_Vector (E'Range);
- function Conv_D is new Unchecked_Conversion (Address, D_Ptr);
- function Conv_E is new Unchecked_Conversion (Address, E_Ptr);
- begin
- ssterf (N, Conv_D (D'Address).all, Conv_E (E'Address).all, Info);
- end;
-
- elsif Is_Double_Precision then
- declare
- type D_Ptr is access all Double_Precision_Vector (D'Range);
- type E_Ptr is access all Double_Precision_Vector (E'Range);
- function Conv_D is new Unchecked_Conversion (Address, D_Ptr);
- function Conv_E is new Unchecked_Conversion (Address, E_Ptr);
- begin
- dsterf (N, Conv_D (D'Address).all, Conv_E (E'Address).all, Info);
- end;
-
- else
- declare
- DP_D : Double_Precision_Vector (D'Range);
- DP_E : Double_Precision_Vector (E'Range);
-
- begin
- DP_D := To_Double_Precision (D);
- DP_E := To_Double_Precision (E);
-
- dsterf (N, DP_D, DP_E, Info);
-
- D := To_Real (DP_D);
- E := To_Real (DP_E);
- end;
- end if;
- end sterf;
-
- -----------
- -- sytrd --
- -----------
-
- procedure sytrd
- (Uplo : access constant Character;
- N : Natural;
- A : in out Real_Matrix;
- Ld_A : Positive;
- D : out Real_Vector;
- E : out Real_Vector;
- Tau : out Real_Vector;
- Work : out Real_Vector;
- L_Work : Integer;
- Info : access Integer)
- is
- begin
- if Is_Real then
- declare
- type A_Ptr is
- access all BLAS.Real_Matrix (A'Range (1), A'Range (2));
- type D_Ptr is access all BLAS.Real_Vector (D'Range);
- type E_Ptr is access all BLAS.Real_Vector (E'Range);
- type Tau_Ptr is access all BLAS.Real_Vector (Tau'Range);
- type Work_Ptr is
- access all BLAS.Real_Vector (Work'Range);
- function Conv_A is new Unchecked_Conversion (Address, A_Ptr);
- function Conv_D is new Unchecked_Conversion (Address, D_Ptr);
- function Conv_E is new Unchecked_Conversion (Address, E_Ptr);
- function Conv_Tau is new Unchecked_Conversion (Address, Tau_Ptr);
- function Conv_Work is new Unchecked_Conversion (Address, Work_Ptr);
- begin
- ssytrd (Uplo, N,
- Conv_A (A'Address).all, Ld_A,
- Conv_D (D'Address).all,
- Conv_E (E'Address).all,
- Conv_Tau (Tau'Address).all,
- Conv_Work (Work'Address).all,
- L_Work,
- Info);
- end;
-
- elsif Is_Double_Precision then
- declare
- type A_Ptr is
- access all Double_Precision_Matrix (A'Range (1), A'Range (2));
- type D_Ptr is access all Double_Precision_Vector (D'Range);
- type E_Ptr is access all Double_Precision_Vector (E'Range);
- type Tau_Ptr is access all Double_Precision_Vector (Tau'Range);
- type Work_Ptr is
- access all Double_Precision_Vector (Work'Range);
- function Conv_A is new Unchecked_Conversion (Address, A_Ptr);
- function Conv_D is new Unchecked_Conversion (Address, D_Ptr);
- function Conv_E is new Unchecked_Conversion (Address, E_Ptr);
- function Conv_Tau is new Unchecked_Conversion (Address, Tau_Ptr);
- function Conv_Work is new Unchecked_Conversion (Address, Work_Ptr);
- begin
- dsytrd (Uplo, N,
- Conv_A (A'Address).all, Ld_A,
- Conv_D (D'Address).all,
- Conv_E (E'Address).all,
- Conv_Tau (Tau'Address).all,
- Conv_Work (Work'Address).all,
- L_Work,
- Info);
- end;
-
- else
- declare
- DP_A : Double_Precision_Matrix (A'Range (1), A'Range (2));
- DP_D : Double_Precision_Vector (D'Range);
- DP_E : Double_Precision_Vector (E'Range);
- DP_Tau : Double_Precision_Vector (Tau'Range);
- DP_Work : Double_Precision_Vector (Work'Range);
- begin
- DP_A := To_Double_Precision (A);
-
- dsytrd (Uplo, N, DP_A, Ld_A, DP_D, DP_E, DP_Tau,
- DP_Work, L_Work, Info);
-
- if L_Work /= -1 then
- A := To_Real (DP_A);
- D := To_Real (DP_D);
- E := To_Real (DP_E);
- Tau := To_Real (DP_Tau);
- end if;
-
- Work (1) := To_Real (DP_Work (1));
- end;
- end if;
- end sytrd;
-
-end System.Generic_Real_LAPACK;
diff --git a/gcc/ada/s-gerela.ads b/gcc/ada/s-gerela.ads
deleted file mode 100644
index c09ce81d027..00000000000
--- a/gcc/ada/s-gerela.ads
+++ /dev/null
@@ -1,128 +0,0 @@
-------------------------------------------------------------------------------
--- --
--- GNAT RUN-TIME COMPONENTS --
--- --
--- S Y S T E M . G E N E R I C _ R E A L _ L A P A C K --
--- --
--- S p e c --
--- --
--- Copyright (C) 2006-2009, Free Software Foundation, Inc. --
--- --
--- GNAT is free software; you can redistribute it and/or modify it under --
--- terms of the GNU General Public License as published by the Free Soft- --
--- ware Foundation; either version 3, or (at your option) any later ver- --
--- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
--- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
--- or FITNESS FOR A PARTICULAR PURPOSE. --
--- --
--- As a special exception under Section 7 of GPL version 3, you are granted --
--- additional permissions described in the GCC Runtime Library Exception, --
--- version 3.1, as published by the Free Software Foundation. --
--- --
--- You should have received a copy of the GNU General Public License and --
--- a copy of the GCC Runtime Library Exception along with this program; --
--- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
--- <http://www.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 comment required ???
-
-generic
- type Real is digits <>;
- type Real_Vector is array (Integer range <>) of Real;
- type Real_Matrix is array (Integer range <>, Integer range <>) of Real;
-package System.Generic_Real_LAPACK is
- pragma Pure;
-
- type Integer_Vector is array (Integer range <>) of Integer;
-
- Upper : aliased constant Character := 'U';
- Lower : aliased constant Character := 'L';
-
- -- LAPACK Computational Routines
-
- -- gerfs Refines the solution of a system of linear equations with
- -- a general matrix and estimates its error
- -- getrf Computes LU factorization of a general m-by-n matrix
- -- getri Computes inverse of an LU-factored general matrix
- -- square matrix, with multiple right-hand sides
- -- getrs Solves a system of linear equations with an LU-factored
- -- square matrix, with multiple right-hand sides
- -- orgtr Generates the Float orthogonal matrix Q determined by sytrd
- -- steqr Computes all eigenvalues and eigenvectors of a symmetric or
- -- Hermitian matrix reduced to tridiagonal form (QR algorithm)
- -- sterf Computes all eigenvalues of a Float symmetric
- -- tridiagonal matrix using QR algorithm
- -- sytrd Reduces a Float symmetric matrix to tridiagonal form
-
- procedure getrf
- (M : Natural;
- N : Natural;
- A : in out Real_Matrix;
- Ld_A : Positive;
- I_Piv : out Integer_Vector;
- Info : access Integer);
-
- procedure getri
- (N : Natural;
- A : in out Real_Matrix;
- Ld_A : Positive;
- I_Piv : Integer_Vector;
- Work : in out Real_Vector;
- L_Work : Integer;
- Info : access Integer);
-
- procedure getrs
- (Trans : access constant Character;
- N : Natural;
- N_Rhs : Natural;
- A : Real_Matrix;
- Ld_A : Positive;
- I_Piv : Integer_Vector;
- B : in out Real_Matrix;
- Ld_B : Positive;
- Info : access Integer);
-
- procedure orgtr
- (Uplo : access constant Character;
- N : Natural;
- A : in out Real_Matrix;
- Ld_A : Positive;
- Tau : Real_Vector;
- Work : out Real_Vector;
- L_Work : Integer;
- Info : access Integer);
-
- procedure sterf
- (N : Natural;
- D : in out Real_Vector;
- E : in out Real_Vector;
- Info : access Integer);
-
- procedure steqr
- (Comp_Z : access constant Character;
- N : Natural;
- D : in out Real_Vector;
- E : in out Real_Vector;
- Z : in out Real_Matrix;
- Ld_Z : Positive;
- Work : out Real_Vector;
- Info : access Integer);
-
- procedure sytrd
- (Uplo : access constant Character;
- N : Natural;
- A : in out Real_Matrix;
- Ld_A : Positive;
- D : out Real_Vector;
- E : out Real_Vector;
- Tau : out Real_Vector;
- Work : out Real_Vector;
- L_Work : Integer;
- Info : access Integer);
-
-end System.Generic_Real_LAPACK;
diff --git a/gcc/ada/s-tassta.adb b/gcc/ada/s-tassta.adb
index 27c847df6e9..410cc8c0f06 100644
--- a/gcc/ada/s-tassta.adb
+++ b/gcc/ada/s-tassta.adb
@@ -1156,7 +1156,7 @@ package body System.Tasking.Stages is
Stack_Guard (Self_ID, True);
-- Initialize low-level TCB components, that cannot be initialized by
- -- the creator. Enter_Task sets Self_ID.LL.Thread
+ -- the creator. Enter_Task sets Self_ID.LL.Thread.
Enter_Task (Self_ID);
diff --git a/gcc/ada/sem_ch10.adb b/gcc/ada/sem_ch10.adb
index 98a57e2556e..34346e39925 100644
--- a/gcc/ada/sem_ch10.adb
+++ b/gcc/ada/sem_ch10.adb
@@ -5013,12 +5013,16 @@ package body Sem_Ch10 is
-- Set entity of parent identifiers if the unit is a child
-- unit. This ensures that the tree is properly formed from
- -- semantic point of view (e.g. for ASIS queries).
+ -- semantic point of view (e.g. for ASIS queries). The unit
+ -- entities are not fully analyzed, so we need to follow unit
+ -- links in the tree.
Set_Entity (Nam, Ent);
Nam := Prefix (Nam);
- Ent := Scope (Ent);
+ Ent :=
+ Defining_Entity
+ (Unit (Parent_Spec (Unit_Declaration_Node (Ent))));
-- Set entity of last ancestor
diff --git a/gcc/ada/sem_ch12.adb b/gcc/ada/sem_ch12.adb
index e62629e2a22..e51b8029803 100644
--- a/gcc/ada/sem_ch12.adb
+++ b/gcc/ada/sem_ch12.adb
@@ -7549,16 +7549,14 @@ package body Sem_Ch12 is
Scop := Scope (Scop);
end loop;
- if Scop = Par_I then
-
- -- Previous instance encloses current instance
+ -- Previous instance encloses current instance
+ if Scop = Par_I then
null;
- elsif Is_Generic_Instance (Scop) then
-
- -- Current instance is within an unrelated instance
+ -- Current instance is within an unrelated instance
+ elsif Is_Generic_Instance (Scop) then
null;
else
diff --git a/gcc/ada/sem_ch13.adb b/gcc/ada/sem_ch13.adb
index d30ba09635d..acfb989dc3c 100644
--- a/gcc/ada/sem_ch13.adb
+++ b/gcc/ada/sem_ch13.adb
@@ -1231,8 +1231,13 @@ package body Sem_Ch13 is
-- We do not do this for Pre'Class, since we have to put
-- these conditions together in a complex OR expression
- if Pname = Name_Postcondition
- or else not Class_Present (Aspect)
+ -- We do not do this in ASIS mode, as ASIS relies on the
+ -- original node representing the complete expression, when
+ -- retrieving it through the source aspect table.
+
+ if not ASIS_Mode
+ and then (Pname = Name_Postcondition
+ or else not Class_Present (Aspect))
then
while Nkind (Expr) = N_And_Then loop
Insert_After (Aspect,
@@ -1385,6 +1390,7 @@ package body Sem_Ch13 is
Args : List_Id;
Comp_Expr : Node_Id;
Comp_Assn : Node_Id;
+ New_Expr : Node_Id;
begin
Args := New_List;
@@ -1401,11 +1407,18 @@ package body Sem_Ch13 is
goto Continue;
end if;
+ -- Make pragma expressions refer to the original aspect
+ -- expressions through the Original_Node link. This is used
+ -- in semantic analysis for ASIS mode, so that the original
+ -- expression also gets analyzed.
+
Comp_Expr := First (Expressions (Expr));
while Present (Comp_Expr) loop
+ New_Expr := Relocate_Node (Comp_Expr);
+ Set_Original_Node (New_Expr, Comp_Expr);
Append
(Make_Pragma_Argument_Association (Sloc (Comp_Expr),
- Expression => Relocate_Node (Comp_Expr)),
+ Expression => New_Expr),
Args);
Next (Comp_Expr);
end loop;
@@ -1421,10 +1434,12 @@ package body Sem_Ch13 is
goto Continue;
end if;
+ New_Expr := Relocate_Node (Expression (Comp_Assn));
+ Set_Original_Node (New_Expr, Expression (Comp_Assn));
Append (Make_Pragma_Argument_Association (
Sloc => Sloc (Comp_Assn),
Chars => Chars (First (Choices (Comp_Assn))),
- Expression => Relocate_Node (Expression (Comp_Assn))),
+ Expression => New_Expr),
Args);
Next (Comp_Assn);
end loop;
@@ -8732,8 +8747,8 @@ package body Sem_Ch13 is
Source : constant Entity_Id := T.Source;
Target : constant Entity_Id := T.Target;
- Source_Siz : Uint;
- Target_Siz : Uint;
+ Source_Siz : Uint;
+ Target_Siz : Uint;
begin
-- This validation check, which warns if we have unequal sizes for
diff --git a/gcc/ada/sem_ch4.adb b/gcc/ada/sem_ch4.adb
index efc76f11398..4b438e13f1c 100644
--- a/gcc/ada/sem_ch4.adb
+++ b/gcc/ada/sem_ch4.adb
@@ -6427,38 +6427,20 @@ package body Sem_Ch4 is
Func : Entity_Id;
Func_Name : Node_Id;
Indexing : Node_Id;
- Is_Var : Boolean;
- Ritem : Node_Id;
begin
-- Check whether type has a specified indexing aspect
Func_Name := Empty;
- Is_Var := False;
- Ritem := First_Rep_Item (Etype (Prefix));
- while Present (Ritem) loop
- if Nkind (Ritem) = N_Aspect_Specification then
-
- -- Prefer Variable_Indexing, but will settle for Constant
-
- if Get_Aspect_Id (Chars (Identifier (Ritem))) =
- Aspect_Constant_Indexing
- then
- Func_Name := Expression (Ritem);
-
- elsif Get_Aspect_Id (Chars (Identifier (Ritem))) =
- Aspect_Variable_Indexing
- then
- Func_Name := Expression (Ritem);
- Is_Var := True;
- exit;
- end if;
- end if;
+ if Is_Variable (Prefix) then
+ Func_Name := Find_Aspect (Etype (Prefix), Aspect_Variable_Indexing);
+ end if;
- Next_Rep_Item (Ritem);
- end loop;
+ if No (Func_Name) then
+ Func_Name := Find_Aspect (Etype (Prefix), Aspect_Constant_Indexing);
+ end if;
-- If aspect does not exist the expression is illegal. Error is
-- diagnosed in caller.
@@ -6478,12 +6460,6 @@ package body Sem_Ch4 is
end if;
end if;
- if Is_Var
- and then not Is_Variable (Prefix)
- then
- Error_Msg_N ("Variable indexing cannot be applied to a constant", N);
- end if;
-
if not Is_Overloaded (Func_Name) then
Func := Entity (Func_Name);
Indexing := Make_Function_Call (Loc,
@@ -6526,11 +6502,11 @@ package body Sem_Ch4 is
Analyze_One_Call (N, It.Nam, False, Success);
if Success then
Set_Etype (Name (N), It.Typ);
+ Set_Entity (Name (N), It.Nam);
-- Add implicit dereference interpretation
Disc := First_Discriminant (Etype (It.Nam));
-
while Present (Disc) loop
if Has_Implicit_Dereference (Disc) then
Add_One_Interp
@@ -6540,12 +6516,21 @@ package body Sem_Ch4 is
Next_Discriminant (Disc);
end loop;
+
+ exit;
end if;
Get_Next_Interp (I, It);
end loop;
end;
end if;
+ if Etype (N) = Any_Type then
+ Error_Msg_NE ("container cannot be indexed with&", N, Etype (Expr));
+ Rewrite (N, New_Occurrence_Of (Any_Id, Loc));
+ else
+ Analyze (N);
+ end if;
+
return True;
end Try_Container_Indexing;
@@ -6863,7 +6848,8 @@ package body Sem_Ch4 is
First_Actual := First (Parameter_Associations (Call_Node));
-- For cross-reference purposes, treat the new node as being in
- -- the source if the original one is.
+ -- the source if the original one is. Set entity and type, even
+ -- though they may be overwritten during resolution if overloaded.
Set_Comes_From_Source (Subprog, Comes_From_Source (N));
Set_Comes_From_Source (Call_Node, Comes_From_Source (N));
@@ -6872,6 +6858,7 @@ package body Sem_Ch4 is
and then not Inside_A_Generic
then
Set_Entity (Selector_Name (N), Entity (Subprog));
+ Set_Etype (Selector_Name (N), Etype (Entity (Subprog)));
end if;
-- If need be, rewrite first actual as an explicit dereference
diff --git a/gcc/ada/sem_ch5.adb b/gcc/ada/sem_ch5.adb
index 1b0f919d3ff..0e6c5cf98bd 100644
--- a/gcc/ada/sem_ch5.adb
+++ b/gcc/ada/sem_ch5.adb
@@ -2429,8 +2429,17 @@ package body Sem_Ch5 is
-- The type of the loop variable is the Iterator_Element aspect of
-- the container type.
- Set_Etype (Def_Id,
- Entity (Find_Aspect (Typ, Aspect_Iterator_Element)));
+ declare
+ Element : constant Entity_Id :=
+ Find_Aspect (Typ, Aspect_Iterator_Element);
+ begin
+ if No (Element) then
+ Error_Msg_NE ("cannot iterate over&", N, Typ);
+ return;
+ else
+ Set_Etype (Def_Id, Entity (Element));
+ end if;
+ end;
else
-- For an iteration of the form IN, the name must denote an
@@ -2440,12 +2449,17 @@ package body Sem_Ch5 is
if Is_Entity_Name (Original_Node (Name (N)))
and then not Is_Iterator (Typ)
then
- Error_Msg_N
- ("name must be an iterator, not a container", Name (N));
+ if No (Find_Aspect (Typ, Aspect_Iterator_Element)) then
+ Error_Msg_NE
+ ("cannot iterate over&", Name (N), Typ);
+ else
+ Error_Msg_N
+ ("name must be an iterator, not a container", Name (N));
+ end if;
Error_Msg_NE
- ("\to iterate directly over a container, write `of &`",
- Name (N), Original_Node (Name (N)));
+ ("\to iterate directly over the elements of a container, " &
+ "write `of &`", Name (N), Original_Node (Name (N)));
end if;
-- The result type of Iterate function is the classwide type of
diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb
index 3dbf782b60b..a9f84d34faa 100644
--- a/gcc/ada/sem_ch6.adb
+++ b/gcc/ada/sem_ch6.adb
@@ -1641,10 +1641,13 @@ package body Sem_Ch6 is
-- The type must be completed in the current package. This
-- is checked at the end of the package declaraton, when
- -- Taft amemdment types are identified.
+ -- Taft-amendment types are identified. If the return type
+ -- is class-wide, there is no required check, the type can
+ -- be a bona fide TAT.
if Ekind (Scope (Current_Scope)) = E_Package
and then In_Private_Part (Scope (Current_Scope))
+ and then not Is_Class_Wide_Type (Typ)
then
Append_Elmt (Designator, Private_Dependents (Typ));
end if;
@@ -3415,14 +3418,17 @@ package body Sem_Ch6 is
-- Ada 2005 (AI-251): If the return type is abstract, verify that
-- the subprogram is abstract also. This does not apply to renaming
- -- declarations, where abstractness is inherited.
+ -- declarations, where abstractness is inherited, and to subprogram
+ -- bodies generated for stream operations, which become renamings as
+ -- bodies.
-- In case of primitives associated with abstract interface types
-- the check is applied later (see Analyze_Subprogram_Declaration).
- if not Nkind_In (Parent (N), N_Subprogram_Renaming_Declaration,
- N_Abstract_Subprogram_Declaration,
- N_Formal_Abstract_Subprogram_Declaration)
+ if not Nkind_In (Original_Node (Parent (N)),
+ N_Subprogram_Renaming_Declaration,
+ N_Abstract_Subprogram_Declaration,
+ N_Formal_Abstract_Subprogram_Declaration)
then
if Is_Abstract_Type (Etype (Designator))
and then not Is_Interface (Etype (Designator))
diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb
index 9de2f1f0320..397c73380a2 100644
--- a/gcc/ada/sem_prag.adb
+++ b/gcc/ada/sem_prag.adb
@@ -181,7 +181,7 @@ package body Sem_Prag is
-- original one, following the renaming chain) is returned. Otherwise the
-- entity is returned unchanged. Should be in Einfo???
- procedure Preanalyze_TC_Args (Arg_Req, Arg_Ens : Node_Id);
+ procedure Preanalyze_TC_Args (N, Arg_Req, Arg_Ens : Node_Id);
-- Preanalyze the boolean expressions in the Requires and Ensures arguments
-- of a Test_Case pragma if present (possibly Empty). We treat these as
-- spec expressions (i.e. similar to a default expression).
@@ -260,8 +260,17 @@ package body Sem_Prag is
-- Preanalyze the boolean expression, we treat this as a spec expression
-- (i.e. similar to a default expression).
- Preanalyze_Spec_Expression
- (Get_Pragma_Arg (Arg1), Standard_Boolean);
+ Preanalyze_Spec_Expression (Get_Pragma_Arg (Arg1), Standard_Boolean);
+
+ -- In ASIS mode, for a pragma generated from a source aspect, also
+ -- analyze the original aspect expression.
+
+ if ASIS_Mode
+ and then Present (Corresponding_Aspect (N))
+ then
+ Preanalyze_Spec_Expression
+ (Expression (Corresponding_Aspect (N)), Standard_Boolean);
+ end if;
-- For a class-wide condition, a reference to a controlling formal must
-- be interpreted as having the class-wide type (or an access to such)
@@ -518,6 +527,15 @@ package body Sem_Prag is
-- This procedure checks for possible duplications if this is the export
-- case, and if found, issues an appropriate error message.
+ procedure Check_Expr_Is_Static_Expression
+ (Expr : Node_Id;
+ Typ : Entity_Id := Empty);
+ -- Check the specified expression Expr to make sure that it is a static
+ -- expression of the given type (i.e. it will be analyzed and resolved
+ -- using this type, which can be any valid argument to Resolve, e.g.
+ -- Any_Integer is OK). If not, given error and raise Pragma_Exit. If
+ -- Typ is left Empty, then any static expression is allowed.
+
procedure Check_First_Subtype (Arg : Node_Id);
-- Checks that Arg, whose expression is an entity name, references a
-- first subtype.
@@ -1199,53 +1217,8 @@ package body Sem_Prag is
(Arg : Node_Id;
Typ : Entity_Id := Empty)
is
- Argx : constant Node_Id := Get_Pragma_Arg (Arg);
-
begin
- if Present (Typ) then
- Analyze_And_Resolve (Argx, Typ);
- else
- Analyze_And_Resolve (Argx);
- end if;
-
- if Is_OK_Static_Expression (Argx) then
- return;
-
- elsif Etype (Argx) = Any_Type then
- raise Pragma_Exit;
-
- -- An interesting special case, if we have a string literal and we
- -- are in Ada 83 mode, then we allow it even though it will not be
- -- flagged as static. This allows the use of Ada 95 pragmas like
- -- Import in Ada 83 mode. They will of course be flagged with
- -- warnings as usual, but will not cause errors.
-
- elsif Ada_Version = Ada_83
- and then Nkind (Argx) = N_String_Literal
- then
- return;
-
- -- Static expression that raises Constraint_Error. This has already
- -- been flagged, so just exit from pragma processing.
-
- elsif Is_Static_Expression (Argx) then
- raise Pragma_Exit;
-
- -- Finally, we have a real error
-
- else
- Error_Msg_Name_1 := Pname;
-
- declare
- Msg : String :=
- "argument for pragma% must be a static expression!";
- begin
- Fix_Error (Msg);
- Flag_Non_Static_Expr (Msg, Argx);
- end;
-
- raise Pragma_Exit;
- end if;
+ Check_Expr_Is_Static_Expression (Get_Pragma_Arg (Arg), Typ);
end Check_Arg_Is_Static_Expression;
------------------------------------------
@@ -1478,6 +1451,61 @@ package body Sem_Prag is
end if;
end Check_Duplicated_Export_Name;
+ -------------------------------------
+ -- Check_Expr_Is_Static_Expression --
+ -------------------------------------
+
+ procedure Check_Expr_Is_Static_Expression
+ (Expr : Node_Id;
+ Typ : Entity_Id := Empty)
+ is
+ begin
+ if Present (Typ) then
+ Analyze_And_Resolve (Expr, Typ);
+ else
+ Analyze_And_Resolve (Expr);
+ end if;
+
+ if Is_OK_Static_Expression (Expr) then
+ return;
+
+ elsif Etype (Expr) = Any_Type then
+ raise Pragma_Exit;
+
+ -- An interesting special case, if we have a string literal and we
+ -- are in Ada 83 mode, then we allow it even though it will not be
+ -- flagged as static. This allows the use of Ada 95 pragmas like
+ -- Import in Ada 83 mode. They will of course be flagged with
+ -- warnings as usual, but will not cause errors.
+
+ elsif Ada_Version = Ada_83
+ and then Nkind (Expr) = N_String_Literal
+ then
+ return;
+
+ -- Static expression that raises Constraint_Error. This has already
+ -- been flagged, so just exit from pragma processing.
+
+ elsif Is_Static_Expression (Expr) then
+ raise Pragma_Exit;
+
+ -- Finally, we have a real error
+
+ else
+ Error_Msg_Name_1 := Pname;
+
+ declare
+ Msg : String :=
+ "argument for pragma% must be a static expression!";
+ begin
+ Fix_Error (Msg);
+ Flag_Non_Static_Expr (Msg, Expr);
+ end;
+
+ raise Pragma_Exit;
+ end if;
+ end Check_Expr_Is_Static_Expression;
+
-------------------------
-- Check_First_Subtype --
-------------------------
@@ -1980,6 +2008,16 @@ package body Sem_Prag is
Preanalyze_Spec_Expression
(Get_Pragma_Arg (Arg1), Standard_Boolean);
+
+ -- In ASIS mode, for a pragma generated from a source aspect,
+ -- also analyze the original aspect expression.
+
+ if ASIS_Mode
+ and then Present (Corresponding_Aspect (N))
+ then
+ Preanalyze_Spec_Expression
+ (Expression (Corresponding_Aspect (N)), Standard_Boolean);
+ end if;
end if;
In_Body := True;
@@ -5462,10 +5500,10 @@ package body Sem_Prag is
-- a non-atomic variable.
if C = Atomic_Synchronization
- and then not Is_Atomic (E)
+ and then not (Is_Atomic (E) or else Has_Atomic_Components (E))
then
Error_Msg_N
- ("pragma & requires atomic variable",
+ ("pragma & requires atomic type or variable",
Pragma_Identifier (Original_Node (N)));
end if;
@@ -7864,10 +7902,13 @@ package body Sem_Prag is
N_Indexed_Component,
N_Function_Call,
N_Identifier,
+ N_Expanded_Name,
N_Selected_Component)
then
-- If this pragma Debug comes from source, its argument was
-- parsed as a name form (which is syntactically identical).
+ -- In a generic context a parameterless call will be left as
+ -- an expanded name (if global) or selected_component if local.
-- Change it to a procedure call statement now.
Change_Name_To_Procedure_Call_Statement (Call);
@@ -10952,7 +10993,8 @@ package body Sem_Prag is
-- pragma Long_Float (D_Float | G_Float);
- when Pragma_Long_Float =>
+ when Pragma_Long_Float => Long_Float : declare
+ begin
GNAT_Pragma;
Check_Valid_Configuration_Pragma;
Check_Arg_Count (1);
@@ -10967,22 +11009,42 @@ package body Sem_Prag is
if Chars (Get_Pragma_Arg (Arg1)) = Name_D_Float then
if Opt.Float_Format_Long = 'G' then
- Error_Pragma ("G_Float previously specified");
- end if;
+ Error_Pragma_Arg
+ ("G_Float previously specified", Arg1);
+
+ elsif Current_Sem_Unit /= Main_Unit
+ and then Opt.Float_Format_Long /= 'D'
+ then
+ Error_Pragma_Arg
+ ("main unit not compiled with pragma Long_Float (D_Float)",
+ "\pragma% must be used consistently for whole partition",
+ Arg1);
- Opt.Float_Format_Long := 'D';
+ else
+ Opt.Float_Format_Long := 'D';
+ end if;
-- G_Float case (this is the default, does not need overriding)
else
if Opt.Float_Format_Long = 'D' then
Error_Pragma ("D_Float previously specified");
- end if;
- Opt.Float_Format_Long := 'G';
+ elsif Current_Sem_Unit /= Main_Unit
+ and then Opt.Float_Format_Long /= 'G'
+ then
+ Error_Pragma_Arg
+ ("main unit not compiled with pragma Long_Float (G_Float)",
+ "\pragma% must be used consistently for whole partition",
+ Arg1);
+
+ else
+ Opt.Float_Format_Long := 'G';
+ end if;
end if;
Set_Standard_Fpt_Formats;
+ end Long_Float;
-----------------------
-- Machine_Attribute --
@@ -13657,6 +13719,17 @@ package body Sem_Prag is
Check_Optional_Identifier (Arg1, Name_Name);
Check_Arg_Is_Static_Expression (Arg1, Standard_String);
+
+ -- In ASIS mode, for a pragma generated from a source aspect, also
+ -- analyze the original aspect expression.
+
+ if ASIS_Mode
+ and then Present (Corresponding_Aspect (N))
+ then
+ Check_Expr_Is_Static_Expression
+ (Original_Node (Get_Pragma_Arg (Arg1)), Standard_String);
+ end if;
+
Check_Optional_Identifier (Arg2, Name_Mode);
Check_Arg_Is_One_Of (Arg2, Name_Nominal, Name_Robustness);
@@ -14374,7 +14447,7 @@ package body Sem_Prag is
-- actual is a conversion. Retrieve the real entity name.
if (In_Instance_Body
- or else In_Inlined_Body)
+ or else In_Inlined_Body)
and then Nkind (E_Id) = N_Unchecked_Type_Conversion
then
E_Id := Expression (E_Id);
@@ -14545,7 +14618,8 @@ package body Sem_Prag is
-- Preanalyze the boolean expressions, we treat these as spec
-- expressions (i.e. similar to a default expression).
- Preanalyze_TC_Args (Get_Requires_From_Test_Case_Pragma (N),
+ Preanalyze_TC_Args (N,
+ Get_Requires_From_Test_Case_Pragma (N),
Get_Ensures_From_Test_Case_Pragma (N));
-- Remove the subprogram from the scope stack now that the pre-analysis
@@ -15065,7 +15139,7 @@ package body Sem_Prag is
-- Preanalyze_TC_Args --
------------------------
- procedure Preanalyze_TC_Args (Arg_Req, Arg_Ens : Node_Id) is
+ procedure Preanalyze_TC_Args (N, Arg_Req, Arg_Ens : Node_Id) is
begin
-- Preanalyze the boolean expressions, we treat these as spec
-- expressions (i.e. similar to a default expression).
@@ -15073,11 +15147,31 @@ package body Sem_Prag is
if Present (Arg_Req) then
Preanalyze_Spec_Expression
(Get_Pragma_Arg (Arg_Req), Standard_Boolean);
+
+ -- In ASIS mode, for a pragma generated from a source aspect, also
+ -- analyze the original aspect expression.
+
+ if ASIS_Mode
+ and then Present (Corresponding_Aspect (N))
+ then
+ Preanalyze_Spec_Expression
+ (Original_Node (Get_Pragma_Arg (Arg_Req)), Standard_Boolean);
+ end if;
end if;
if Present (Arg_Ens) then
Preanalyze_Spec_Expression
(Get_Pragma_Arg (Arg_Ens), Standard_Boolean);
+
+ -- In ASIS mode, for a pragma generated from a source aspect, also
+ -- analyze the original aspect expression.
+
+ if ASIS_Mode
+ and then Present (Corresponding_Aspect (N))
+ then
+ Preanalyze_Spec_Expression
+ (Original_Node (Get_Pragma_Arg (Arg_Ens)), Standard_Boolean);
+ end if;
end if;
end Preanalyze_TC_Args;
diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb
index d94a6bfa328..ad59f952252 100644
--- a/gcc/ada/sem_res.adb
+++ b/gcc/ada/sem_res.adb
@@ -3926,16 +3926,16 @@ package body Sem_Res is
if Is_Atomic_Object (A)
and then not Is_Atomic (Etype (F))
then
- Error_Msg_N
- ("cannot pass atomic argument to non-atomic formal",
- N);
+ Error_Msg_NE
+ ("cannot pass atomic argument to non-atomic formal&",
+ A, F);
elsif Is_Volatile_Object (A)
and then not Is_Volatile (Etype (F))
then
- Error_Msg_N
- ("cannot pass volatile argument to non-volatile formal",
- N);
+ Error_Msg_NE
+ ("cannot pass volatile argument to non-volatile formal&",
+ A, F);
end if;
end if;
diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb
index 9dfecd3d956..1764da9db02 100644
--- a/gcc/ada/sem_util.adb
+++ b/gcc/ada/sem_util.adb
@@ -10837,7 +10837,9 @@ package body Sem_Util is
-- source. This excludes, for example, calls to a dispatching
-- assignment operation when the left-hand side is tagged.
- if Modification_Comes_From_Source then
+ if Modification_Comes_From_Source
+ or else Alfa_Mode
+ then
Generate_Reference (Ent, Exp, 'm');
-- If the target of the assignment is the bound variable
@@ -12835,6 +12837,11 @@ package body Sem_Util is
U := Corresponding_Spec (P);
end if;
+ when Formal_Kind =>
+ if Present (Spec_Entity (E)) then
+ U := Spec_Entity (E);
+ end if;
+
when others =>
null;
end case;
diff --git a/gcc/ada/sem_warn.adb b/gcc/ada/sem_warn.adb
index 9f0b259311c..99b71c00fbf 100644
--- a/gcc/ada/sem_warn.adb
+++ b/gcc/ada/sem_warn.adb
@@ -3993,39 +3993,59 @@ package body Sem_Warn is
-- Case of assigned value never referenced
if No (N) then
+ declare
+ LA : constant Node_Id := Last_Assignment (Ent);
- -- Don't give this for OUT and IN OUT formals, since
- -- clearly caller may reference the assigned value. Also
- -- never give such warnings for internal variables.
+ begin
+ -- Don't give this for OUT and IN OUT formals, since
+ -- clearly caller may reference the assigned value. Also
+ -- never give such warnings for internal variables.
- if Ekind (Ent) = E_Variable
- and then not Is_Internal_Name (Chars (Ent))
- then
- if Referenced_As_Out_Parameter (Ent) then
- Error_Msg_NE
- ("?& modified by call, but value never referenced",
- Last_Assignment (Ent), Ent);
- else
- Error_Msg_NE -- CODEFIX
- ("?useless assignment to&, value never referenced!",
- Last_Assignment (Ent), Ent);
+ if Ekind (Ent) = E_Variable
+ and then not Is_Internal_Name (Chars (Ent))
+ then
+ -- Give appropriate message, distinguishing between
+ -- assignment statements and out parameters.
+
+ if Nkind_In (Parent (LA), N_Procedure_Call_Statement,
+ N_Parameter_Association)
+ then
+ Error_Msg_NE
+ ("?& modified by call, but value never "
+ & "referenced", LA, Ent);
+
+ else
+ Error_Msg_NE -- CODEFIX
+ ("?useless assignment to&, value never "
+ & "referenced!", LA, Ent);
+ end if;
end if;
- end if;
+ end;
-- Case of assigned value overwritten
else
- Error_Msg_Sloc := Sloc (N);
+ declare
+ LA : constant Node_Id := Last_Assignment (Ent);
- if Referenced_As_Out_Parameter (Ent) then
- Error_Msg_NE
- ("?& modified by call, but value overwritten #!",
- Last_Assignment (Ent), Ent);
- else
- Error_Msg_NE -- CODEFIX
- ("?useless assignment to&, value overwritten #!",
- Last_Assignment (Ent), Ent);
- end if;
+ begin
+ Error_Msg_Sloc := Sloc (N);
+
+ -- Give appropriate message, distinguishing between
+ -- assignment statements and out parameters.
+
+ if Nkind_In (Parent (LA), N_Procedure_Call_Statement,
+ N_Parameter_Association)
+ then
+ Error_Msg_NE
+ ("?& modified by call, but value overwritten #!",
+ LA, Ent);
+ else
+ Error_Msg_NE -- CODEFIX
+ ("?useless assignment to&, value overwritten #!",
+ LA, Ent);
+ end if;
+ end;
end if;
-- Clear last assignment indication and we are done
diff --git a/gcc/ada/sigtramp-ppcvxw.c b/gcc/ada/sigtramp-ppcvxw.c
index 57a02a7d162..bebe6572ee1 100644
--- a/gcc/ada/sigtramp-ppcvxw.c
+++ b/gcc/ada/sigtramp-ppcvxw.c
@@ -55,7 +55,11 @@
Checking which variant should apply and getting at sc_pregs is simpler
to express in C (we can't use offsetof in toplevel asms and hardcoding
constants is not workable with the flurry of VxWorks variants), so this
- is the choice for our toplevel interface. */
+ is the choice for our toplevel interface.
+
+ Note that the registers we "restore" here are those to which we have
+ direct access through the system sigcontext structure, which includes
+ only a partial set of the non-volatiles ABI-wise. */
/* -----------------------------------------
-- Protypes for our internal asm stubs --
@@ -120,8 +124,9 @@ void __gnat_sigtramp (int signo, void *si, void *sc,
/* REGNO constants, dwarf column numbers for registers of interest. */
#define REGNO_LR 65
-#define REGNO_XER 76
+#define REGNO_CTR 66
#define REGNO_CR 70
+#define REGNO_XER 76
#define REGNO_GR(N) (N)
#define REGNO_PC 67 /* ARG_POINTER_REGNUM */
@@ -139,6 +144,8 @@ void __gnat_sigtramp (int signo, void *si, void *sc,
multine contents: */
#define TAB(S) "\t" S
#define CR(S) S "\n"
+
+#undef TCR
#define TCR(S) TAB(CR(S))
/*------------------------------
@@ -147,11 +154,18 @@ void __gnat_sigtramp (int signo, void *si, void *sc,
/* CFA setup block
---------------
- Only non-volatile registers are suitable for a CFA base. We use r14
- here and set it to the value we need in stub body that follows. */
+ Only non-volatile registers are suitable for a CFA base. These are the
+ only ones we can expect to be able retrieve from the unwinding context
+ while walking up the chain, saved by at least the bottom-most exception
+ propagation services. We use r15 here and set it to the value we need
+ in stub body that follows. Note that r14 is inappropriate here, even
+ though it is non-volatile according to the ABI, because GCC uses it as
+ an extra SCRATCH on SPE targets. */
+
+#define CFA_REG 15
#define CFI_DEF_CFA \
-CR(".cfi_def_cfa 14, 0")
+CR(".cfi_def_cfa " S(CFA_REG) ", 0")
/* Register location blocks
------------------------
@@ -164,7 +178,18 @@ CR(".cfi_def_cfa 14, 0")
#define CFI_COMMON_REGS \
CR("# CFI for common registers\n") \
-TCR(COMMON_CFI(GR(1))) \
+TCR(COMMON_CFI(GR(2))) \
+TCR(COMMON_CFI(GR(3))) \
+TCR(COMMON_CFI(GR(4))) \
+TCR(COMMON_CFI(GR(5))) \
+TCR(COMMON_CFI(GR(6))) \
+TCR(COMMON_CFI(GR(7))) \
+TCR(COMMON_CFI(GR(8))) \
+TCR(COMMON_CFI(GR(9))) \
+TCR(COMMON_CFI(GR(10))) \
+TCR(COMMON_CFI(GR(11))) \
+TCR(COMMON_CFI(GR(12))) \
+TCR(COMMON_CFI(GR(13))) \
TCR(COMMON_CFI(GR(14))) \
TCR(COMMON_CFI(GR(15))) \
TCR(COMMON_CFI(GR(16))) \
@@ -185,6 +210,8 @@ TCR(COMMON_CFI(GR(30))) \
TCR(COMMON_CFI(GR(31))) \
TCR(COMMON_CFI(LR)) \
TCR(COMMON_CFI(CR)) \
+TCR(COMMON_CFI(CTR)) \
+TCR(COMMON_CFI(XER)) \
TCR(COMMON_CFI(PC)) \
TCR(".cfi_return_column " S(REGNO_PC))
@@ -198,10 +225,10 @@ TCR("# registers we're going to modify") \
TCR("stwu %r1,-16(%r1)") \
TCR("mflr %r0") \
TCR("stw %r0,20(%r1)") \
-TCR("stw %r14,8(%r1)") \
+TCR("stw %r" S(CFA_REG) ",8(%r1)") \
TCR("") \
-TCR("# Setup r14 = sc_pregs, that we'll retrieve as our CFA value") \
-TCR("mr %r14, %r7") \
+TCR("# Setup CFA_REG = sc_pregs, that we'll retrieve as our CFA value") \
+TCR("mr %r" S(CFA_REG) ", %r7") \
TCR("") \
TCR("# Call the real handler. The signo, siginfo and sigcontext") \
TCR("# arguments are the same as those we received in r3, r4 and r5") \
@@ -209,7 +236,7 @@ TCR("mtctr %r6") \
TCR("bctrl") \
TCR("") \
TCR("# Restore our callee-saved items, release our frame and return") \
-TCR("lwz %r14,8(%r1)") \
+TCR("lwz %r" S(CFA_REG) ",8(%r1)") \
TCR("lwz %r0,20(%r1)") \
TCR("mtlr %r0") \
TCR("") \
diff --git a/gcc/ada/sinfo.adb b/gcc/ada/sinfo.adb
index 916e0ae5843..b36b930b8c4 100644
--- a/gcc/ada/sinfo.adb
+++ b/gcc/ada/sinfo.adb
@@ -254,7 +254,10 @@ package body Sinfo is
begin
pragma Assert (False
or else NT (N).Nkind = N_Expanded_Name
- or else NT (N).Nkind = N_Identifier);
+ or else NT (N).Nkind = N_Explicit_Dereference
+ or else NT (N).Nkind = N_Identifier
+ or else NT (N).Nkind = N_Indexed_Component
+ or else NT (N).Nkind = N_Selected_Component);
return Flag14 (N);
end Atomic_Sync_Required;
@@ -3323,7 +3326,10 @@ package body Sinfo is
begin
pragma Assert (False
or else NT (N).Nkind = N_Expanded_Name
- or else NT (N).Nkind = N_Identifier);
+ or else NT (N).Nkind = N_Explicit_Dereference
+ or else NT (N).Nkind = N_Identifier
+ or else NT (N).Nkind = N_Indexed_Component
+ or else NT (N).Nkind = N_Selected_Component);
Set_Flag14 (N, Val);
end Set_Atomic_Sync_Required;
diff --git a/gcc/ada/sinfo.ads b/gcc/ada/sinfo.ads
index 0b5a52f5dc7..35a73f9ad94 100644
--- a/gcc/ada/sinfo.ads
+++ b/gcc/ada/sinfo.ads
@@ -606,10 +606,8 @@ package Sinfo is
-- harmless.
-- Atomic_Sync_Required (Flag14-Sem)
- -- This flag is set in an identifier or expanded name node if the
- -- corresponding reference (or assignment when on the left side of
- -- an assignment) requires atomic synchronization, as a result of
- -- Atomic_Synchronization being enabled for the corresponding entity.
+ -- This flag is set on a node for which atomic synchronization is
+ -- required for the corresponding reference or modification.
-- At_End_Proc (Node1)
-- This field is present in an N_Handled_Sequence_Of_Statements node.
@@ -3175,6 +3173,7 @@ package Sinfo is
-- Sloc points to ALL
-- Prefix (Node3)
-- Actual_Designated_Subtype (Node4-Sem)
+ -- Atomic_Sync_Required (Flag14-Sem)
-- plus fields for expression
-------------------------------
@@ -3197,6 +3196,7 @@ package Sinfo is
-- Sloc contains a copy of the Sloc value of the Prefix
-- Prefix (Node3)
-- Expressions (List1)
+ -- Atomic_Sync_Required (Flag14-Sem)
-- plus fields for expression
-- Note: if any of the subscripts requires a range check, then the
@@ -3240,6 +3240,7 @@ package Sinfo is
-- Associated_Node (Node4-Sem)
-- Do_Discriminant_Check (Flag13-Sem)
-- Is_In_Discriminant_Check (Flag11-Sem)
+ -- Atomic_Sync_Required (Flag14-Sem)
-- plus fields for expression
--------------------------
diff --git a/gcc/ada/sinput.adb b/gcc/ada/sinput.adb
index 6d0be93a571..175af07969b 100644
--- a/gcc/ada/sinput.adb
+++ b/gcc/ada/sinput.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2010, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2011, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -51,6 +51,7 @@ package body Sinput is
-- Make control characters visible
First_Time_Around : Boolean := True;
+ -- This needs a comment ???
-- Routines to support conversion between types Lines_Table_Ptr,
-- Logical_Lines_Table_Ptr and System.Address.
diff --git a/gcc/ada/sprint.adb b/gcc/ada/sprint.adb
index 3c45d789390..674c9db05ac 100644
--- a/gcc/ada/sprint.adb
+++ b/gcc/ada/sprint.adb
@@ -2694,9 +2694,19 @@ package body Sprint is
if Paren_Count (Expression (Node)) /= 0 then
Sprint_Node (Expression (Node));
+
else
Write_Char ('(');
Sprint_Node (Expression (Node));
+
+ -- Odd case, for the qualified expressions used in machine
+ -- code the argument may be a procedure call, resulting in
+ -- a junk semicolon before the right parent, get rid of it.
+
+ Write_Erase_Char (';');
+
+ -- Now we can add the terminating right paren
+
Write_Char (')');
end if;
diff --git a/gcc/builtin-types.def b/gcc/builtin-types.def
index d6d48c7c9fc..8edf744461e 100644
--- a/gcc/builtin-types.def
+++ b/gcc/builtin-types.def
@@ -95,6 +95,10 @@ DEF_PRIMITIVE_TYPE (BT_VOLATILE_PTR,
build_pointer_type
(build_qualified_type (void_type_node,
TYPE_QUAL_VOLATILE)))
+DEF_PRIMITIVE_TYPE (BT_CONST_VOLATILE_PTR,
+ build_pointer_type
+ (build_qualified_type (void_type_node,
+ TYPE_QUAL_VOLATILE|TYPE_QUAL_CONST)))
DEF_PRIMITIVE_TYPE (BT_PTRMODE, (*lang_hooks.types.type_for_mode)(ptr_mode, 0))
DEF_PRIMITIVE_TYPE (BT_INT_PTR, integer_ptr_type_node)
DEF_PRIMITIVE_TYPE (BT_FLOAT_PTR, float_ptr_type_node)
@@ -315,6 +319,20 @@ DEF_FUNCTION_TYPE_2 (BT_FN_BOOL_LONGPTR_LONGPTR,
BT_BOOL, BT_PTR_LONG, BT_PTR_LONG)
DEF_FUNCTION_TYPE_2 (BT_FN_BOOL_ULONGLONGPTR_ULONGLONGPTR,
BT_BOOL, BT_PTR_ULONGLONG, BT_PTR_ULONGLONG)
+DEF_FUNCTION_TYPE_2 (BT_FN_I1_CONST_VPTR_INT, BT_I1, BT_CONST_VOLATILE_PTR,
+ BT_INT)
+DEF_FUNCTION_TYPE_2 (BT_FN_I2_CONST_VPTR_INT, BT_I2, BT_CONST_VOLATILE_PTR,
+ BT_INT)
+DEF_FUNCTION_TYPE_2 (BT_FN_I4_CONST_VPTR_INT, BT_I4, BT_CONST_VOLATILE_PTR,
+ BT_INT)
+DEF_FUNCTION_TYPE_2 (BT_FN_I8_CONST_VPTR_INT, BT_I8, BT_CONST_VOLATILE_PTR,
+ BT_INT)
+DEF_FUNCTION_TYPE_2 (BT_FN_I16_CONST_VPTR_INT, BT_I16, BT_CONST_VOLATILE_PTR,
+ BT_INT)
+DEF_FUNCTION_TYPE_2 (BT_FN_VOID_VPTR_INT, BT_VOID, BT_VOLATILE_PTR, BT_INT)
+DEF_FUNCTION_TYPE_2 (BT_FN_BOOL_VPTR_INT, BT_BOOL, BT_VOLATILE_PTR, BT_INT)
+DEF_FUNCTION_TYPE_2 (BT_FN_BOOL_SIZE_CONST_VPTR, BT_BOOL, BT_SIZE,
+ BT_CONST_VOLATILE_PTR)
DEF_POINTER_TYPE (BT_PTR_FN_VOID_PTR_PTR, BT_FN_VOID_PTR_PTR)
@@ -383,6 +401,16 @@ DEF_FUNCTION_TYPE_3 (BT_FN_VOID_OMPFN_PTR_UINT, BT_VOID, BT_PTR_FN_VOID_PTR,
BT_PTR, BT_UINT)
DEF_FUNCTION_TYPE_3 (BT_FN_PTR_CONST_PTR_INT_SIZE, BT_PTR,
BT_CONST_PTR, BT_INT, BT_SIZE)
+DEF_FUNCTION_TYPE_3 (BT_FN_I1_VPTR_I1_INT, BT_I1, BT_VOLATILE_PTR, BT_I1, BT_INT)
+DEF_FUNCTION_TYPE_3 (BT_FN_I2_VPTR_I2_INT, BT_I2, BT_VOLATILE_PTR, BT_I2, BT_INT)
+DEF_FUNCTION_TYPE_3 (BT_FN_I4_VPTR_I4_INT, BT_I4, BT_VOLATILE_PTR, BT_I4, BT_INT)
+DEF_FUNCTION_TYPE_3 (BT_FN_I8_VPTR_I8_INT, BT_I8, BT_VOLATILE_PTR, BT_I8, BT_INT)
+DEF_FUNCTION_TYPE_3 (BT_FN_I16_VPTR_I16_INT, BT_I16, BT_VOLATILE_PTR, BT_I16, BT_INT)
+DEF_FUNCTION_TYPE_3 (BT_FN_VOID_VPTR_I1_INT, BT_VOID, BT_VOLATILE_PTR, BT_I1, BT_INT)
+DEF_FUNCTION_TYPE_3 (BT_FN_VOID_VPTR_I2_INT, BT_VOID, BT_VOLATILE_PTR, BT_I2, BT_INT)
+DEF_FUNCTION_TYPE_3 (BT_FN_VOID_VPTR_I4_INT, BT_VOID, BT_VOLATILE_PTR, BT_I4, BT_INT)
+DEF_FUNCTION_TYPE_3 (BT_FN_VOID_VPTR_I8_INT, BT_VOID, BT_VOLATILE_PTR, BT_I8, BT_INT)
+DEF_FUNCTION_TYPE_3 (BT_FN_VOID_VPTR_I16_INT, BT_VOID, BT_VOLATILE_PTR, BT_I16, BT_INT)
DEF_FUNCTION_TYPE_4 (BT_FN_SIZE_CONST_PTR_SIZE_SIZE_FILEPTR,
BT_SIZE, BT_CONST_PTR, BT_SIZE, BT_SIZE, BT_FILEPTR)
@@ -402,6 +430,10 @@ DEF_FUNCTION_TYPE_4 (BT_FN_VOID_OMPFN_PTR_UINT_UINT,
BT_VOID, BT_PTR_FN_VOID_PTR, BT_PTR, BT_UINT, BT_UINT)
DEF_FUNCTION_TYPE_4 (BT_FN_VOID_PTR_WORD_WORD_PTR,
BT_VOID, BT_PTR, BT_WORD, BT_WORD, BT_PTR)
+DEF_FUNCTION_TYPE_4 (BT_FN_VOID_SIZE_VPTR_PTR_INT, BT_VOID, BT_SIZE,
+ BT_VOLATILE_PTR, BT_PTR, BT_INT)
+DEF_FUNCTION_TYPE_4 (BT_FN_VOID_SIZE_CONST_VPTR_PTR_INT, BT_VOID, BT_SIZE,
+ BT_CONST_VOLATILE_PTR, BT_PTR, BT_INT)
DEF_FUNCTION_TYPE_5 (BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG,
BT_INT, BT_STRING, BT_INT, BT_SIZE, BT_CONST_STRING,
@@ -409,6 +441,9 @@ DEF_FUNCTION_TYPE_5 (BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG,
DEF_FUNCTION_TYPE_5 (BT_FN_BOOL_LONG_LONG_LONG_LONGPTR_LONGPTR,
BT_BOOL, BT_LONG, BT_LONG, BT_LONG,
BT_PTR_LONG, BT_PTR_LONG)
+DEF_FUNCTION_TYPE_5 (BT_FN_VOID_SIZE_VPTR_PTR_PTR_INT, BT_VOID, BT_SIZE,
+ BT_VOLATILE_PTR, BT_PTR, BT_PTR, BT_INT)
+
DEF_FUNCTION_TYPE_6 (BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG,
BT_INT, BT_STRING, BT_SIZE, BT_INT, BT_SIZE,
@@ -422,6 +457,24 @@ DEF_FUNCTION_TYPE_6 (BT_FN_VOID_OMPFN_PTR_UINT_LONG_LONG_LONG,
DEF_FUNCTION_TYPE_6 (BT_FN_BOOL_BOOL_ULL_ULL_ULL_ULLPTR_ULLPTR,
BT_BOOL, BT_BOOL, BT_ULONGLONG, BT_ULONGLONG,
BT_ULONGLONG, BT_PTR_ULONGLONG, BT_PTR_ULONGLONG)
+DEF_FUNCTION_TYPE_6 (BT_FN_BOOL_VPTR_PTR_I1_BOOL_INT_INT,
+ BT_BOOL, BT_VOLATILE_PTR, BT_PTR, BT_I1, BT_BOOL, BT_INT,
+ BT_INT)
+DEF_FUNCTION_TYPE_6 (BT_FN_BOOL_VPTR_PTR_I2_BOOL_INT_INT,
+ BT_BOOL, BT_VOLATILE_PTR, BT_PTR, BT_I2, BT_BOOL, BT_INT,
+ BT_INT)
+DEF_FUNCTION_TYPE_6 (BT_FN_BOOL_VPTR_PTR_I4_BOOL_INT_INT,
+ BT_BOOL, BT_VOLATILE_PTR, BT_PTR, BT_I4, BT_BOOL, BT_INT,
+ BT_INT)
+DEF_FUNCTION_TYPE_6 (BT_FN_BOOL_VPTR_PTR_I8_BOOL_INT_INT,
+ BT_BOOL, BT_VOLATILE_PTR, BT_PTR, BT_I8, BT_BOOL, BT_INT,
+ BT_INT)
+DEF_FUNCTION_TYPE_6 (BT_FN_BOOL_VPTR_PTR_I16_BOOL_INT_INT,
+ BT_BOOL, BT_VOLATILE_PTR, BT_PTR, BT_I16, BT_BOOL, BT_INT,
+ BT_INT)
+DEF_FUNCTION_TYPE_6 (BT_FN_BOOL_SIZE_VPTR_PTR_PTR_INT_INT, BT_BOOL, BT_SIZE,
+ BT_VOLATILE_PTR, BT_PTR, BT_PTR, BT_INT, BT_INT)
+
DEF_FUNCTION_TYPE_7 (BT_FN_VOID_OMPFN_PTR_UINT_LONG_LONG_LONG_LONG,
BT_VOID, BT_PTR_FN_VOID_PTR, BT_PTR, BT_UINT,
diff --git a/gcc/builtins.c b/gcc/builtins.c
index 51d7b12e687..205d586fc33 100644
--- a/gcc/builtins.c
+++ b/gcc/builtins.c
@@ -223,6 +223,7 @@ static tree do_mpfr_bessel_n (tree, tree, tree,
const REAL_VALUE_TYPE *, bool);
static tree do_mpfr_remquo (tree, tree, tree);
static tree do_mpfr_lgamma_r (tree, tree, tree);
+static void expand_builtin_sync_synchronize (void);
/* Return true if NAME starts with __builtin_ or __sync_. */
@@ -233,6 +234,8 @@ is_builtin_name (const char *name)
return true;
if (strncmp (name, "__sync_", 7) == 0)
return true;
+ if (strncmp (name, "__atomic_", 9) == 0)
+ return true;
return false;
}
@@ -5090,21 +5093,41 @@ get_builtin_sync_mem (tree loc, enum machine_mode mode)
return mem;
}
+/* Make sure an argument is in the right mode.
+ EXP is the tree argument.
+ MODE is the mode it should be in. */
+
+static rtx
+expand_expr_force_mode (tree exp, enum machine_mode mode)
+{
+ rtx val;
+ enum machine_mode old_mode;
+
+ val = expand_expr (exp, NULL_RTX, mode, EXPAND_NORMAL);
+ /* If VAL is promoted to a wider mode, convert it back to MODE. Take care
+ of CONST_INTs, where we know the old_mode only from the call argument. */
+
+ old_mode = GET_MODE (val);
+ if (old_mode == VOIDmode)
+ old_mode = TYPE_MODE (TREE_TYPE (exp));
+ val = convert_modes (mode, old_mode, val, 1);
+ return val;
+}
+
+
/* Expand the __sync_xxx_and_fetch and __sync_fetch_and_xxx intrinsics.
EXP is the CALL_EXPR. CODE is the rtx code
that corresponds to the arithmetic or logical operation from the name;
an exception here is that NOT actually means NAND. TARGET is an optional
place for us to store the results; AFTER is true if this is the
- fetch_and_xxx form. IGNORE is true if we don't actually care about
- the result of the operation at all. */
+ fetch_and_xxx form. */
static rtx
expand_builtin_sync_operation (enum machine_mode mode, tree exp,
enum rtx_code code, bool after,
- rtx target, bool ignore)
+ rtx target)
{
rtx val, mem;
- enum machine_mode old_mode;
location_t loc = EXPR_LOCATION (exp);
if (code == NOT && warn_sync_nand)
@@ -5151,19 +5174,10 @@ expand_builtin_sync_operation (enum machine_mode mode, tree exp,
/* Expand the operands. */
mem = get_builtin_sync_mem (CALL_EXPR_ARG (exp, 0), mode);
+ val = expand_expr_force_mode (CALL_EXPR_ARG (exp, 1), mode);
- val = expand_expr (CALL_EXPR_ARG (exp, 1), NULL_RTX, mode, EXPAND_NORMAL);
- /* If VAL is promoted to a wider mode, convert it back to MODE. Take care
- of CONST_INTs, where we know the old_mode only from the call argument. */
- old_mode = GET_MODE (val);
- if (old_mode == VOIDmode)
- old_mode = TYPE_MODE (TREE_TYPE (CALL_EXPR_ARG (exp, 1)));
- val = convert_modes (mode, old_mode, val, 1);
-
- if (ignore)
- return expand_sync_operation (mem, val, code);
- else
- return expand_sync_fetch_operation (mem, val, code, after, target);
+ return expand_atomic_fetch_op (target, mem, val, code, MEMMODEL_SEQ_CST,
+ after);
}
/* Expand the __sync_val_compare_and_swap and __sync_bool_compare_and_swap
@@ -5176,34 +5190,19 @@ expand_builtin_compare_and_swap (enum machine_mode mode, tree exp,
bool is_bool, rtx target)
{
rtx old_val, new_val, mem;
- enum machine_mode old_mode;
/* Expand the operands. */
mem = get_builtin_sync_mem (CALL_EXPR_ARG (exp, 0), mode);
+ old_val = expand_expr_force_mode (CALL_EXPR_ARG (exp, 1), mode);
+ new_val = expand_expr_force_mode (CALL_EXPR_ARG (exp, 2), mode);
+ if (!expand_atomic_compare_and_swap ((is_bool ? &target : NULL),
+ (is_bool ? NULL : &target),
+ mem, old_val, new_val, false,
+ MEMMODEL_SEQ_CST, MEMMODEL_SEQ_CST))
+ return NULL_RTX;
- old_val = expand_expr (CALL_EXPR_ARG (exp, 1), NULL_RTX,
- mode, EXPAND_NORMAL);
- /* If VAL is promoted to a wider mode, convert it back to MODE. Take care
- of CONST_INTs, where we know the old_mode only from the call argument. */
- old_mode = GET_MODE (old_val);
- if (old_mode == VOIDmode)
- old_mode = TYPE_MODE (TREE_TYPE (CALL_EXPR_ARG (exp, 1)));
- old_val = convert_modes (mode, old_mode, old_val, 1);
-
- new_val = expand_expr (CALL_EXPR_ARG (exp, 2), NULL_RTX,
- mode, EXPAND_NORMAL);
- /* If VAL is promoted to a wider mode, convert it back to MODE. Take care
- of CONST_INTs, where we know the old_mode only from the call argument. */
- old_mode = GET_MODE (new_val);
- if (old_mode == VOIDmode)
- old_mode = TYPE_MODE (TREE_TYPE (CALL_EXPR_ARG (exp, 2)));
- new_val = convert_modes (mode, old_mode, new_val, 1);
-
- if (is_bool)
- return expand_bool_compare_and_swap (mem, old_val, new_val, target);
- else
- return expand_val_compare_and_swap (mem, old_val, new_val, target);
+ return target;
}
/* Expand the __sync_lock_test_and_set intrinsic. Note that the most
@@ -5214,22 +5213,461 @@ expand_builtin_compare_and_swap (enum machine_mode mode, tree exp,
static rtx
expand_builtin_sync_lock_test_and_set (enum machine_mode mode, tree exp,
- rtx target)
+ rtx target)
{
rtx val, mem;
- enum machine_mode old_mode;
/* Expand the operands. */
mem = get_builtin_sync_mem (CALL_EXPR_ARG (exp, 0), mode);
- val = expand_expr (CALL_EXPR_ARG (exp, 1), NULL_RTX, mode, EXPAND_NORMAL);
- /* If VAL is promoted to a wider mode, convert it back to MODE. Take care
- of CONST_INTs, where we know the old_mode only from the call argument. */
- old_mode = GET_MODE (val);
- if (old_mode == VOIDmode)
- old_mode = TYPE_MODE (TREE_TYPE (CALL_EXPR_ARG (exp, 1)));
- val = convert_modes (mode, old_mode, val, 1);
+ val = expand_expr_force_mode (CALL_EXPR_ARG (exp, 1), mode);
+
+ return expand_atomic_exchange (target, mem, val, MEMMODEL_ACQUIRE, true);
+}
+
+/* Expand the __sync_lock_release intrinsic. EXP is the CALL_EXPR. */
+
+static void
+expand_builtin_sync_lock_release (enum machine_mode mode, tree exp)
+{
+ rtx mem;
+
+ /* Expand the operands. */
+ mem = get_builtin_sync_mem (CALL_EXPR_ARG (exp, 0), mode);
+
+ expand_atomic_store (mem, const0_rtx, MEMMODEL_RELEASE, true);
+}
+
+/* Given an integer representing an ``enum memmodel'', verify its
+ correctness and return the memory model enum. */
+
+static enum memmodel
+get_memmodel (tree exp)
+{
+ rtx op;
+
+ /* If the parameter is not a constant, it's a run time value so we'll just
+ convert it to MEMMODEL_SEQ_CST to avoid annoying runtime checking. */
+ if (TREE_CODE (exp) != INTEGER_CST)
+ return MEMMODEL_SEQ_CST;
+
+ op = expand_normal (exp);
+ if (INTVAL (op) < 0 || INTVAL (op) >= MEMMODEL_LAST)
+ {
+ warning (OPT_Winvalid_memory_model,
+ "invalid memory model argument to builtin");
+ return MEMMODEL_SEQ_CST;
+ }
+ return (enum memmodel) INTVAL (op);
+}
+
+/* Expand the __atomic_exchange intrinsic:
+ TYPE __atomic_exchange (TYPE *object, TYPE desired, enum memmodel)
+ EXP is the CALL_EXPR.
+ TARGET is an optional place for us to store the results. */
+
+static rtx
+expand_builtin_atomic_exchange (enum machine_mode mode, tree exp, rtx target)
+{
+ rtx val, mem;
+ enum memmodel model;
+
+ model = get_memmodel (CALL_EXPR_ARG (exp, 2));
+ if (model == MEMMODEL_CONSUME)
+ {
+ error ("invalid memory model for %<__atomic_exchange%>");
+ return NULL_RTX;
+ }
+
+ if (!flag_inline_atomics)
+ return NULL_RTX;
+
+ /* Expand the operands. */
+ mem = get_builtin_sync_mem (CALL_EXPR_ARG (exp, 0), mode);
+ val = expand_expr_force_mode (CALL_EXPR_ARG (exp, 1), mode);
+
+ return expand_atomic_exchange (target, mem, val, model, false);
+}
+
+/* Expand the __atomic_compare_exchange intrinsic:
+ bool __atomic_compare_exchange (TYPE *object, TYPE *expect,
+ TYPE desired, BOOL weak,
+ enum memmodel success,
+ enum memmodel failure)
+ EXP is the CALL_EXPR.
+ TARGET is an optional place for us to store the results. */
+
+static rtx
+expand_builtin_atomic_compare_exchange (enum machine_mode mode, tree exp,
+ rtx target)
+{
+ rtx expect, desired, mem, oldval;
+ enum memmodel success, failure;
+ tree weak;
+ bool is_weak;
+
+ success = get_memmodel (CALL_EXPR_ARG (exp, 4));
+ failure = get_memmodel (CALL_EXPR_ARG (exp, 5));
+
+ if (failure == MEMMODEL_RELEASE || failure == MEMMODEL_ACQ_REL)
+ {
+ error ("invalid failure memory model for %<__atomic_compare_exchange%>");
+ return NULL_RTX;
+ }
+
+ if (failure > success)
+ {
+ error ("failure memory model cannot be stronger than success "
+ "memory model for %<__atomic_compare_exchange%>");
+ return NULL_RTX;
+ }
+
+ if (!flag_inline_atomics)
+ return NULL_RTX;
+
+ /* Expand the operands. */
+ mem = get_builtin_sync_mem (CALL_EXPR_ARG (exp, 0), mode);
+
+ expect = expand_normal (CALL_EXPR_ARG (exp, 1));
+ expect = convert_memory_address (Pmode, expect);
+ desired = expand_expr_force_mode (CALL_EXPR_ARG (exp, 2), mode);
+
+ weak = CALL_EXPR_ARG (exp, 3);
+ is_weak = false;
+ if (host_integerp (weak, 0) && tree_low_cst (weak, 0) != 0)
+ is_weak = true;
+
+ oldval = copy_to_reg (gen_rtx_MEM (mode, expect));
+
+ if (!expand_atomic_compare_and_swap (&target, &oldval, mem, oldval,
+ desired, is_weak, success, failure))
+ return NULL_RTX;
+
+ emit_move_insn (gen_rtx_MEM (mode, expect), oldval);
+ return target;
+}
+
+/* Expand the __atomic_load intrinsic:
+ TYPE __atomic_load (TYPE *object, enum memmodel)
+ EXP is the CALL_EXPR.
+ TARGET is an optional place for us to store the results. */
+
+static rtx
+expand_builtin_atomic_load (enum machine_mode mode, tree exp, rtx target)
+{
+ rtx mem;
+ enum memmodel model;
+
+ model = get_memmodel (CALL_EXPR_ARG (exp, 1));
+ if (model == MEMMODEL_RELEASE
+ || model == MEMMODEL_ACQ_REL)
+ {
+ error ("invalid memory model for %<__atomic_load%>");
+ return NULL_RTX;
+ }
+
+ if (!flag_inline_atomics)
+ return NULL_RTX;
+
+ /* Expand the operand. */
+ mem = get_builtin_sync_mem (CALL_EXPR_ARG (exp, 0), mode);
+
+ return expand_atomic_load (target, mem, model);
+}
+
+
+/* Expand the __atomic_store intrinsic:
+ void __atomic_store (TYPE *object, TYPE desired, enum memmodel)
+ EXP is the CALL_EXPR.
+ TARGET is an optional place for us to store the results. */
+
+static rtx
+expand_builtin_atomic_store (enum machine_mode mode, tree exp)
+{
+ rtx mem, val;
+ enum memmodel model;
+
+ model = get_memmodel (CALL_EXPR_ARG (exp, 2));
+ if (model != MEMMODEL_RELAXED
+ && model != MEMMODEL_SEQ_CST
+ && model != MEMMODEL_RELEASE)
+ {
+ error ("invalid memory model for %<__atomic_store%>");
+ return NULL_RTX;
+ }
+
+ if (!flag_inline_atomics)
+ return NULL_RTX;
+
+ /* Expand the operands. */
+ mem = get_builtin_sync_mem (CALL_EXPR_ARG (exp, 0), mode);
+ val = expand_expr_force_mode (CALL_EXPR_ARG (exp, 1), mode);
+
+ return expand_atomic_store (mem, val, model, false);
+}
+
+/* Expand the __atomic_fetch_XXX intrinsic:
+ TYPE __atomic_fetch_XXX (TYPE *object, TYPE val, enum memmodel)
+ EXP is the CALL_EXPR.
+ TARGET is an optional place for us to store the results.
+ CODE is the operation, PLUS, MINUS, ADD, XOR, or IOR.
+ FETCH_AFTER is true if returning the result of the operation.
+ FETCH_AFTER is false if returning the value before the operation.
+ IGNORE is true if the result is not used.
+ EXT_CALL is the correct builtin for an external call if this cannot be
+ resolved to an instruction sequence. */
+
+static rtx
+expand_builtin_atomic_fetch_op (enum machine_mode mode, tree exp, rtx target,
+ enum rtx_code code, bool fetch_after,
+ bool ignore, enum built_in_function ext_call)
+{
+ rtx val, mem, ret;
+ enum memmodel model;
+ tree fndecl;
+ tree addr;
+
+ model = get_memmodel (CALL_EXPR_ARG (exp, 2));
+
+ /* Expand the operands. */
+ mem = get_builtin_sync_mem (CALL_EXPR_ARG (exp, 0), mode);
+ val = expand_expr_force_mode (CALL_EXPR_ARG (exp, 1), mode);
+
+ /* Only try generating instructions if inlining is turned on. */
+ if (flag_inline_atomics)
+ {
+ ret = expand_atomic_fetch_op (target, mem, val, code, model, fetch_after);
+ if (ret)
+ return ret;
+ }
+
+ /* Return if a different routine isn't needed for the library call. */
+ if (ext_call == BUILT_IN_NONE)
+ return NULL_RTX;
+
+ /* Change the call to the specified function. */
+ fndecl = get_callee_fndecl (exp);
+ addr = CALL_EXPR_FN (exp);
+ STRIP_NOPS (addr);
+
+ gcc_assert (TREE_OPERAND (addr, 0) == fndecl);
+ TREE_OPERAND (addr, 0) = builtin_decl_explicit(ext_call);
+
+ /* Expand the call here so we can emit trailing code. */
+ ret = expand_call (exp, target, ignore);
+
+ /* Replace the original function just in case it matters. */
+ TREE_OPERAND (addr, 0) = fndecl;
+
+ /* Then issue the arithmetic correction to return the right result. */
+ if (!ignore)
+ ret = expand_simple_binop (mode, code, ret, val, NULL_RTX, true,
+ OPTAB_LIB_WIDEN);
+ return ret;
+}
+
+/* Return true if (optional) argument ARG1 of size ARG0 is always lock free on
+ this architecture. If ARG1 is NULL, use typical alignment for size ARG0. */
+
+static tree
+fold_builtin_atomic_always_lock_free (tree arg0, tree arg1)
+{
+ int size;
+ enum machine_mode mode;
+ unsigned int mode_align, type_align;
+
+ if (TREE_CODE (arg0) != INTEGER_CST)
+ return NULL_TREE;
+
+ size = INTVAL (expand_normal (arg0)) * BITS_PER_UNIT;
+ mode = mode_for_size (size, MODE_INT, 0);
+ mode_align = GET_MODE_ALIGNMENT (mode);
+
+ if (TREE_CODE (arg1) == INTEGER_CST && INTVAL (expand_normal (arg1)) == 0)
+ type_align = mode_align;
+ else
+ {
+ tree ttype = TREE_TYPE (arg1);
+
+ /* This function is usually invoked and folded immediately by the front
+ end before anything else has a chance to look at it. The pointer
+ parameter at this point is usually cast to a void *, so check for that
+ and look past the cast. */
+ if (TREE_CODE (arg1) == NOP_EXPR && POINTER_TYPE_P (ttype)
+ && VOID_TYPE_P (TREE_TYPE (ttype)))
+ arg1 = TREE_OPERAND (arg1, 0);
+
+ ttype = TREE_TYPE (arg1);
+ gcc_assert (POINTER_TYPE_P (ttype));
+
+ /* Get the underlying type of the object. */
+ ttype = TREE_TYPE (ttype);
+ type_align = TYPE_ALIGN (ttype);
+ }
+
+ /* If the object has smaller alignment, the the lock free routines cannot
+ be used. */
+ if (type_align < mode_align)
+ return integer_zero_node;
+
+ /* Check if a compare_and_swap pattern exists for the mode which represents
+ the required size. The pattern is not allowed to fail, so the existence
+ of the pattern indicates support is present. */
+ if (can_compare_and_swap_p (mode))
+ return integer_one_node;
+ else
+ return integer_zero_node;
+}
+
+/* Return true if the parameters to call EXP represent an object which will
+ always generate lock free instructions. The first argument represents the
+ size of the object, and the second parameter is a pointer to the object
+ itself. If NULL is passed for the object, then the result is based on
+ typical alignment for an object of the specified size. Otherwise return
+ false. */
+
+static rtx
+expand_builtin_atomic_always_lock_free (tree exp)
+{
+ tree size;
+ tree arg0 = CALL_EXPR_ARG (exp, 0);
+ tree arg1 = CALL_EXPR_ARG (exp, 1);
- return expand_sync_lock_test_and_set (mem, val, target);
+ if (TREE_CODE (arg0) != INTEGER_CST)
+ {
+ error ("non-constant argument 1 to __atomic_always_lock_free");
+ return const0_rtx;
+ }
+
+ size = fold_builtin_atomic_always_lock_free (arg0, arg1);
+ if (size == integer_one_node)
+ return const1_rtx;
+ return const0_rtx;
+}
+
+/* Return a one or zero if it can be determined that object ARG1 of size ARG
+ is lock free on this architecture. */
+
+static tree
+fold_builtin_atomic_is_lock_free (tree arg0, tree arg1)
+{
+ if (!flag_inline_atomics)
+ return NULL_TREE;
+
+ /* If it isn't always lock free, don't generate a result. */
+ if (fold_builtin_atomic_always_lock_free (arg0, arg1) == integer_one_node)
+ return integer_one_node;
+
+ return NULL_TREE;
+}
+
+/* Return true if the parameters to call EXP represent an object which will
+ always generate lock free instructions. The first argument represents the
+ size of the object, and the second parameter is a pointer to the object
+ itself. If NULL is passed for the object, then the result is based on
+ typical alignment for an object of the specified size. Otherwise return
+ NULL*/
+
+static rtx
+expand_builtin_atomic_is_lock_free (tree exp)
+{
+ tree size;
+ tree arg0 = CALL_EXPR_ARG (exp, 0);
+ tree arg1 = CALL_EXPR_ARG (exp, 1);
+
+ if (!INTEGRAL_TYPE_P (TREE_TYPE (arg0)))
+ {
+ error ("non-integer argument 1 to __atomic_is_lock_free");
+ return NULL_RTX;
+ }
+
+ if (!flag_inline_atomics)
+ return NULL_RTX;
+
+ /* If the value is known at compile time, return the RTX for it. */
+ size = fold_builtin_atomic_is_lock_free (arg0, arg1);
+ if (size == integer_one_node)
+ return const1_rtx;
+
+ return NULL_RTX;
+}
+
+/* This routine will either emit the mem_thread_fence pattern or issue a
+ sync_synchronize to generate a fence for memory model MEMMODEL. */
+
+#ifndef HAVE_mem_thread_fence
+# define HAVE_mem_thread_fence 0
+# define gen_mem_thread_fence(x) (gcc_unreachable (), NULL_RTX)
+#endif
+
+void
+expand_builtin_mem_thread_fence (enum memmodel model)
+{
+ if (HAVE_mem_thread_fence)
+ emit_insn (gen_mem_thread_fence (GEN_INT (model)));
+ else if (model != MEMMODEL_RELAXED)
+ expand_builtin_sync_synchronize ();
+}
+
+/* Expand the __atomic_thread_fence intrinsic:
+ void __atomic_thread_fence (enum memmodel)
+ EXP is the CALL_EXPR. */
+
+static void
+expand_builtin_atomic_thread_fence (tree exp)
+{
+ enum memmodel model;
+
+ model = get_memmodel (CALL_EXPR_ARG (exp, 0));
+ expand_builtin_mem_thread_fence (model);
+}
+
+/* This routine will either emit the mem_signal_fence pattern or issue a
+ sync_synchronize to generate a fence for memory model MEMMODEL. */
+
+#ifndef HAVE_mem_signal_fence
+# define HAVE_mem_signal_fence 0
+# define gen_mem_signal_fence(x) (gcc_unreachable (), NULL_RTX)
+#endif
+
+static void
+expand_builtin_mem_signal_fence (enum memmodel model)
+{
+ if (HAVE_mem_signal_fence)
+ emit_insn (gen_mem_signal_fence (GEN_INT (model)));
+ else if (model != MEMMODEL_RELAXED)
+ {
+ rtx asm_op, clob;
+
+ /* By default targets are coherent between a thread and the signal
+ handler running on the same thread. Thus this really becomes a
+ compiler barrier, in that stores must not be sunk past
+ (or raised above) a given point. */
+
+ /* Generate asm volatile("" : : : "memory") as the memory barrier. */
+ asm_op = gen_rtx_ASM_OPERANDS (VOIDmode, empty_string, empty_string, 0,
+ rtvec_alloc (0), rtvec_alloc (0),
+ rtvec_alloc (0), UNKNOWN_LOCATION);
+ MEM_VOLATILE_P (asm_op) = 1;
+
+ clob = gen_rtx_SCRATCH (VOIDmode);
+ clob = gen_rtx_MEM (BLKmode, clob);
+ clob = gen_rtx_CLOBBER (VOIDmode, clob);
+
+ emit_insn (gen_rtx_PARALLEL (VOIDmode, gen_rtvec (2, asm_op, clob)));
+ }
+}
+
+/* Expand the __atomic_signal_fence intrinsic:
+ void __atomic_signal_fence (enum memmodel)
+ EXP is the CALL_EXPR. */
+
+static void
+expand_builtin_atomic_signal_fence (tree exp)
+{
+ enum memmodel model;
+
+ model = get_memmodel (CALL_EXPR_ARG (exp, 0));
+ expand_builtin_mem_signal_fence (model);
}
/* Expand the __sync_synchronize intrinsic. */
@@ -5264,33 +5702,6 @@ expand_builtin_sync_synchronize (void)
expand_asm_stmt (x);
}
-/* Expand the __sync_lock_release intrinsic. EXP is the CALL_EXPR. */
-
-static void
-expand_builtin_sync_lock_release (enum machine_mode mode, tree exp)
-{
- struct expand_operand ops[2];
- enum insn_code icode;
- rtx mem;
-
- /* Expand the operands. */
- mem = get_builtin_sync_mem (CALL_EXPR_ARG (exp, 0), mode);
-
- /* If there is an explicit operation in the md file, use it. */
- icode = direct_optab_handler (sync_lock_release_optab, mode);
- if (icode != CODE_FOR_nothing)
- {
- create_fixed_operand (&ops[0], mem);
- create_input_operand (&ops[1], const0_rtx, mode);
- if (maybe_expand_insn (icode, 2, ops))
- return;
- }
-
- /* Otherwise we can implement this operation by emitting a barrier
- followed by a store of zero. */
- expand_builtin_sync_synchronize ();
- emit_move_insn (mem, const0_rtx);
-}
/* Expand an expression EXP that calls a built-in function,
with result going to TARGET if that's convenient
@@ -5891,8 +6302,7 @@ expand_builtin (tree exp, rtx target, rtx subtarget, enum machine_mode mode,
case BUILT_IN_SYNC_FETCH_AND_ADD_8:
case BUILT_IN_SYNC_FETCH_AND_ADD_16:
mode = get_builtin_sync_mode (fcode - BUILT_IN_SYNC_FETCH_AND_ADD_1);
- target = expand_builtin_sync_operation (mode, exp, PLUS,
- false, target, ignore);
+ target = expand_builtin_sync_operation (mode, exp, PLUS, false, target);
if (target)
return target;
break;
@@ -5903,8 +6313,7 @@ expand_builtin (tree exp, rtx target, rtx subtarget, enum machine_mode mode,
case BUILT_IN_SYNC_FETCH_AND_SUB_8:
case BUILT_IN_SYNC_FETCH_AND_SUB_16:
mode = get_builtin_sync_mode (fcode - BUILT_IN_SYNC_FETCH_AND_SUB_1);
- target = expand_builtin_sync_operation (mode, exp, MINUS,
- false, target, ignore);
+ target = expand_builtin_sync_operation (mode, exp, MINUS, false, target);
if (target)
return target;
break;
@@ -5915,8 +6324,7 @@ expand_builtin (tree exp, rtx target, rtx subtarget, enum machine_mode mode,
case BUILT_IN_SYNC_FETCH_AND_OR_8:
case BUILT_IN_SYNC_FETCH_AND_OR_16:
mode = get_builtin_sync_mode (fcode - BUILT_IN_SYNC_FETCH_AND_OR_1);
- target = expand_builtin_sync_operation (mode, exp, IOR,
- false, target, ignore);
+ target = expand_builtin_sync_operation (mode, exp, IOR, false, target);
if (target)
return target;
break;
@@ -5927,8 +6335,7 @@ expand_builtin (tree exp, rtx target, rtx subtarget, enum machine_mode mode,
case BUILT_IN_SYNC_FETCH_AND_AND_8:
case BUILT_IN_SYNC_FETCH_AND_AND_16:
mode = get_builtin_sync_mode (fcode - BUILT_IN_SYNC_FETCH_AND_AND_1);
- target = expand_builtin_sync_operation (mode, exp, AND,
- false, target, ignore);
+ target = expand_builtin_sync_operation (mode, exp, AND, false, target);
if (target)
return target;
break;
@@ -5939,8 +6346,7 @@ expand_builtin (tree exp, rtx target, rtx subtarget, enum machine_mode mode,
case BUILT_IN_SYNC_FETCH_AND_XOR_8:
case BUILT_IN_SYNC_FETCH_AND_XOR_16:
mode = get_builtin_sync_mode (fcode - BUILT_IN_SYNC_FETCH_AND_XOR_1);
- target = expand_builtin_sync_operation (mode, exp, XOR,
- false, target, ignore);
+ target = expand_builtin_sync_operation (mode, exp, XOR, false, target);
if (target)
return target;
break;
@@ -5951,8 +6357,7 @@ expand_builtin (tree exp, rtx target, rtx subtarget, enum machine_mode mode,
case BUILT_IN_SYNC_FETCH_AND_NAND_8:
case BUILT_IN_SYNC_FETCH_AND_NAND_16:
mode = get_builtin_sync_mode (fcode - BUILT_IN_SYNC_FETCH_AND_NAND_1);
- target = expand_builtin_sync_operation (mode, exp, NOT,
- false, target, ignore);
+ target = expand_builtin_sync_operation (mode, exp, NOT, false, target);
if (target)
return target;
break;
@@ -5963,8 +6368,7 @@ expand_builtin (tree exp, rtx target, rtx subtarget, enum machine_mode mode,
case BUILT_IN_SYNC_ADD_AND_FETCH_8:
case BUILT_IN_SYNC_ADD_AND_FETCH_16:
mode = get_builtin_sync_mode (fcode - BUILT_IN_SYNC_ADD_AND_FETCH_1);
- target = expand_builtin_sync_operation (mode, exp, PLUS,
- true, target, ignore);
+ target = expand_builtin_sync_operation (mode, exp, PLUS, true, target);
if (target)
return target;
break;
@@ -5975,8 +6379,7 @@ expand_builtin (tree exp, rtx target, rtx subtarget, enum machine_mode mode,
case BUILT_IN_SYNC_SUB_AND_FETCH_8:
case BUILT_IN_SYNC_SUB_AND_FETCH_16:
mode = get_builtin_sync_mode (fcode - BUILT_IN_SYNC_SUB_AND_FETCH_1);
- target = expand_builtin_sync_operation (mode, exp, MINUS,
- true, target, ignore);
+ target = expand_builtin_sync_operation (mode, exp, MINUS, true, target);
if (target)
return target;
break;
@@ -5987,8 +6390,7 @@ expand_builtin (tree exp, rtx target, rtx subtarget, enum machine_mode mode,
case BUILT_IN_SYNC_OR_AND_FETCH_8:
case BUILT_IN_SYNC_OR_AND_FETCH_16:
mode = get_builtin_sync_mode (fcode - BUILT_IN_SYNC_OR_AND_FETCH_1);
- target = expand_builtin_sync_operation (mode, exp, IOR,
- true, target, ignore);
+ target = expand_builtin_sync_operation (mode, exp, IOR, true, target);
if (target)
return target;
break;
@@ -5999,8 +6401,7 @@ expand_builtin (tree exp, rtx target, rtx subtarget, enum machine_mode mode,
case BUILT_IN_SYNC_AND_AND_FETCH_8:
case BUILT_IN_SYNC_AND_AND_FETCH_16:
mode = get_builtin_sync_mode (fcode - BUILT_IN_SYNC_AND_AND_FETCH_1);
- target = expand_builtin_sync_operation (mode, exp, AND,
- true, target, ignore);
+ target = expand_builtin_sync_operation (mode, exp, AND, true, target);
if (target)
return target;
break;
@@ -6011,8 +6412,7 @@ expand_builtin (tree exp, rtx target, rtx subtarget, enum machine_mode mode,
case BUILT_IN_SYNC_XOR_AND_FETCH_8:
case BUILT_IN_SYNC_XOR_AND_FETCH_16:
mode = get_builtin_sync_mode (fcode - BUILT_IN_SYNC_XOR_AND_FETCH_1);
- target = expand_builtin_sync_operation (mode, exp, XOR,
- true, target, ignore);
+ target = expand_builtin_sync_operation (mode, exp, XOR, true, target);
if (target)
return target;
break;
@@ -6023,8 +6423,7 @@ expand_builtin (tree exp, rtx target, rtx subtarget, enum machine_mode mode,
case BUILT_IN_SYNC_NAND_AND_FETCH_8:
case BUILT_IN_SYNC_NAND_AND_FETCH_16:
mode = get_builtin_sync_mode (fcode - BUILT_IN_SYNC_NAND_AND_FETCH_1);
- target = expand_builtin_sync_operation (mode, exp, NOT,
- true, target, ignore);
+ target = expand_builtin_sync_operation (mode, exp, NOT, true, target);
if (target)
return target;
break;
@@ -6082,6 +6481,236 @@ expand_builtin (tree exp, rtx target, rtx subtarget, enum machine_mode mode,
expand_builtin_sync_synchronize ();
return const0_rtx;
+ case BUILT_IN_ATOMIC_EXCHANGE_1:
+ case BUILT_IN_ATOMIC_EXCHANGE_2:
+ case BUILT_IN_ATOMIC_EXCHANGE_4:
+ case BUILT_IN_ATOMIC_EXCHANGE_8:
+ case BUILT_IN_ATOMIC_EXCHANGE_16:
+ mode = get_builtin_sync_mode (fcode - BUILT_IN_ATOMIC_EXCHANGE_1);
+ target = expand_builtin_atomic_exchange (mode, exp, target);
+ if (target)
+ return target;
+ break;
+
+ case BUILT_IN_ATOMIC_COMPARE_EXCHANGE_1:
+ case BUILT_IN_ATOMIC_COMPARE_EXCHANGE_2:
+ case BUILT_IN_ATOMIC_COMPARE_EXCHANGE_4:
+ case BUILT_IN_ATOMIC_COMPARE_EXCHANGE_8:
+ case BUILT_IN_ATOMIC_COMPARE_EXCHANGE_16:
+ mode =
+ get_builtin_sync_mode (fcode - BUILT_IN_ATOMIC_COMPARE_EXCHANGE_1);
+ target = expand_builtin_atomic_compare_exchange (mode, exp, target);
+ if (target)
+ return target;
+ break;
+
+ case BUILT_IN_ATOMIC_LOAD_1:
+ case BUILT_IN_ATOMIC_LOAD_2:
+ case BUILT_IN_ATOMIC_LOAD_4:
+ case BUILT_IN_ATOMIC_LOAD_8:
+ case BUILT_IN_ATOMIC_LOAD_16:
+ mode = get_builtin_sync_mode (fcode - BUILT_IN_ATOMIC_LOAD_1);
+ target = expand_builtin_atomic_load (mode, exp, target);
+ if (target)
+ return target;
+ break;
+
+ case BUILT_IN_ATOMIC_STORE_1:
+ case BUILT_IN_ATOMIC_STORE_2:
+ case BUILT_IN_ATOMIC_STORE_4:
+ case BUILT_IN_ATOMIC_STORE_8:
+ case BUILT_IN_ATOMIC_STORE_16:
+ mode = get_builtin_sync_mode (fcode - BUILT_IN_ATOMIC_STORE_1);
+ target = expand_builtin_atomic_store (mode, exp);
+ if (target)
+ return const0_rtx;
+ break;
+
+ case BUILT_IN_ATOMIC_ADD_FETCH_1:
+ case BUILT_IN_ATOMIC_ADD_FETCH_2:
+ case BUILT_IN_ATOMIC_ADD_FETCH_4:
+ case BUILT_IN_ATOMIC_ADD_FETCH_8:
+ case BUILT_IN_ATOMIC_ADD_FETCH_16:
+ {
+ enum built_in_function lib;
+ mode = get_builtin_sync_mode (fcode - BUILT_IN_ATOMIC_ADD_FETCH_1);
+ lib = (enum built_in_function)((int)BUILT_IN_ATOMIC_FETCH_ADD_1 +
+ (fcode - BUILT_IN_ATOMIC_ADD_FETCH_1));
+ target = expand_builtin_atomic_fetch_op (mode, exp, target, PLUS, true,
+ ignore, lib);
+ if (target)
+ return target;
+ break;
+ }
+ case BUILT_IN_ATOMIC_SUB_FETCH_1:
+ case BUILT_IN_ATOMIC_SUB_FETCH_2:
+ case BUILT_IN_ATOMIC_SUB_FETCH_4:
+ case BUILT_IN_ATOMIC_SUB_FETCH_8:
+ case BUILT_IN_ATOMIC_SUB_FETCH_16:
+ {
+ enum built_in_function lib;
+ mode = get_builtin_sync_mode (fcode - BUILT_IN_ATOMIC_SUB_FETCH_1);
+ lib = (enum built_in_function)((int)BUILT_IN_ATOMIC_FETCH_SUB_1 +
+ (fcode - BUILT_IN_ATOMIC_SUB_FETCH_1));
+ target = expand_builtin_atomic_fetch_op (mode, exp, target, MINUS, true,
+ ignore, lib);
+ if (target)
+ return target;
+ break;
+ }
+ case BUILT_IN_ATOMIC_AND_FETCH_1:
+ case BUILT_IN_ATOMIC_AND_FETCH_2:
+ case BUILT_IN_ATOMIC_AND_FETCH_4:
+ case BUILT_IN_ATOMIC_AND_FETCH_8:
+ case BUILT_IN_ATOMIC_AND_FETCH_16:
+ {
+ enum built_in_function lib;
+ mode = get_builtin_sync_mode (fcode - BUILT_IN_ATOMIC_AND_FETCH_1);
+ lib = (enum built_in_function)((int)BUILT_IN_ATOMIC_FETCH_AND_1 +
+ (fcode - BUILT_IN_ATOMIC_AND_FETCH_1));
+ target = expand_builtin_atomic_fetch_op (mode, exp, target, AND, true,
+ ignore, lib);
+ if (target)
+ return target;
+ break;
+ }
+ case BUILT_IN_ATOMIC_NAND_FETCH_1:
+ case BUILT_IN_ATOMIC_NAND_FETCH_2:
+ case BUILT_IN_ATOMIC_NAND_FETCH_4:
+ case BUILT_IN_ATOMIC_NAND_FETCH_8:
+ case BUILT_IN_ATOMIC_NAND_FETCH_16:
+ {
+ enum built_in_function lib;
+ mode = get_builtin_sync_mode (fcode - BUILT_IN_ATOMIC_NAND_FETCH_1);
+ lib = (enum built_in_function)((int)BUILT_IN_ATOMIC_FETCH_NAND_1 +
+ (fcode - BUILT_IN_ATOMIC_NAND_FETCH_1));
+ target = expand_builtin_atomic_fetch_op (mode, exp, target, NOT, true,
+ ignore, lib);
+ if (target)
+ return target;
+ break;
+ }
+ case BUILT_IN_ATOMIC_XOR_FETCH_1:
+ case BUILT_IN_ATOMIC_XOR_FETCH_2:
+ case BUILT_IN_ATOMIC_XOR_FETCH_4:
+ case BUILT_IN_ATOMIC_XOR_FETCH_8:
+ case BUILT_IN_ATOMIC_XOR_FETCH_16:
+ {
+ enum built_in_function lib;
+ mode = get_builtin_sync_mode (fcode - BUILT_IN_ATOMIC_XOR_FETCH_1);
+ lib = (enum built_in_function)((int)BUILT_IN_ATOMIC_FETCH_XOR_1 +
+ (fcode - BUILT_IN_ATOMIC_XOR_FETCH_1));
+ target = expand_builtin_atomic_fetch_op (mode, exp, target, XOR, true,
+ ignore, lib);
+ if (target)
+ return target;
+ break;
+ }
+ case BUILT_IN_ATOMIC_OR_FETCH_1:
+ case BUILT_IN_ATOMIC_OR_FETCH_2:
+ case BUILT_IN_ATOMIC_OR_FETCH_4:
+ case BUILT_IN_ATOMIC_OR_FETCH_8:
+ case BUILT_IN_ATOMIC_OR_FETCH_16:
+ {
+ enum built_in_function lib;
+ mode = get_builtin_sync_mode (fcode - BUILT_IN_ATOMIC_OR_FETCH_1);
+ lib = (enum built_in_function)((int)BUILT_IN_ATOMIC_FETCH_OR_1 +
+ (fcode - BUILT_IN_ATOMIC_OR_FETCH_1));
+ target = expand_builtin_atomic_fetch_op (mode, exp, target, IOR, true,
+ ignore, lib);
+ if (target)
+ return target;
+ break;
+ }
+ case BUILT_IN_ATOMIC_FETCH_ADD_1:
+ case BUILT_IN_ATOMIC_FETCH_ADD_2:
+ case BUILT_IN_ATOMIC_FETCH_ADD_4:
+ case BUILT_IN_ATOMIC_FETCH_ADD_8:
+ case BUILT_IN_ATOMIC_FETCH_ADD_16:
+ mode = get_builtin_sync_mode (fcode - BUILT_IN_ATOMIC_FETCH_ADD_1);
+ target = expand_builtin_atomic_fetch_op (mode, exp, target, PLUS, false,
+ ignore, BUILT_IN_NONE);
+ if (target)
+ return target;
+ break;
+
+ case BUILT_IN_ATOMIC_FETCH_SUB_1:
+ case BUILT_IN_ATOMIC_FETCH_SUB_2:
+ case BUILT_IN_ATOMIC_FETCH_SUB_4:
+ case BUILT_IN_ATOMIC_FETCH_SUB_8:
+ case BUILT_IN_ATOMIC_FETCH_SUB_16:
+ mode = get_builtin_sync_mode (fcode - BUILT_IN_ATOMIC_FETCH_SUB_1);
+ target = expand_builtin_atomic_fetch_op (mode, exp, target, MINUS, false,
+ ignore, BUILT_IN_NONE);
+ if (target)
+ return target;
+ break;
+
+ case BUILT_IN_ATOMIC_FETCH_AND_1:
+ case BUILT_IN_ATOMIC_FETCH_AND_2:
+ case BUILT_IN_ATOMIC_FETCH_AND_4:
+ case BUILT_IN_ATOMIC_FETCH_AND_8:
+ case BUILT_IN_ATOMIC_FETCH_AND_16:
+ mode = get_builtin_sync_mode (fcode - BUILT_IN_ATOMIC_FETCH_AND_1);
+ target = expand_builtin_atomic_fetch_op (mode, exp, target, AND, false,
+ ignore, BUILT_IN_NONE);
+ if (target)
+ return target;
+ break;
+
+ case BUILT_IN_ATOMIC_FETCH_NAND_1:
+ case BUILT_IN_ATOMIC_FETCH_NAND_2:
+ case BUILT_IN_ATOMIC_FETCH_NAND_4:
+ case BUILT_IN_ATOMIC_FETCH_NAND_8:
+ case BUILT_IN_ATOMIC_FETCH_NAND_16:
+ mode = get_builtin_sync_mode (fcode - BUILT_IN_ATOMIC_FETCH_NAND_1);
+ target = expand_builtin_atomic_fetch_op (mode, exp, target, NOT, false,
+ ignore, BUILT_IN_NONE);
+ if (target)
+ return target;
+ break;
+
+ case BUILT_IN_ATOMIC_FETCH_XOR_1:
+ case BUILT_IN_ATOMIC_FETCH_XOR_2:
+ case BUILT_IN_ATOMIC_FETCH_XOR_4:
+ case BUILT_IN_ATOMIC_FETCH_XOR_8:
+ case BUILT_IN_ATOMIC_FETCH_XOR_16:
+ mode = get_builtin_sync_mode (fcode - BUILT_IN_ATOMIC_FETCH_XOR_1);
+ target = expand_builtin_atomic_fetch_op (mode, exp, target, XOR, false,
+ ignore, BUILT_IN_NONE);
+ if (target)
+ return target;
+ break;
+
+ case BUILT_IN_ATOMIC_FETCH_OR_1:
+ case BUILT_IN_ATOMIC_FETCH_OR_2:
+ case BUILT_IN_ATOMIC_FETCH_OR_4:
+ case BUILT_IN_ATOMIC_FETCH_OR_8:
+ case BUILT_IN_ATOMIC_FETCH_OR_16:
+ mode = get_builtin_sync_mode (fcode - BUILT_IN_ATOMIC_FETCH_OR_1);
+ target = expand_builtin_atomic_fetch_op (mode, exp, target, IOR, false,
+ ignore, BUILT_IN_NONE);
+ if (target)
+ return target;
+ break;
+
+ case BUILT_IN_ATOMIC_ALWAYS_LOCK_FREE:
+ return expand_builtin_atomic_always_lock_free (exp);
+
+ case BUILT_IN_ATOMIC_IS_LOCK_FREE:
+ target = expand_builtin_atomic_is_lock_free (exp);
+ if (target)
+ return target;
+ break;
+
+ case BUILT_IN_ATOMIC_THREAD_FENCE:
+ expand_builtin_atomic_thread_fence (exp);
+ return const0_rtx;
+
+ case BUILT_IN_ATOMIC_SIGNAL_FENCE:
+ expand_builtin_atomic_signal_fence (exp);
+ return const0_rtx;
+
case BUILT_IN_OBJECT_SIZE:
return expand_builtin_object_size (exp);
@@ -8427,7 +9056,7 @@ fold_builtin_memchr (location_t loc, tree arg1, tree arg2, tree len, tree type)
if (target_char_cast (arg2, &c))
return NULL_TREE;
- r = (char *) memchr (p1, c, tree_low_cst (len, 1));
+ r = (const char *) memchr (p1, c, tree_low_cst (len, 1));
if (r == NULL)
return build_int_cst (TREE_TYPE (arg1), 0);
@@ -10121,6 +10750,12 @@ fold_builtin_2 (location_t loc, tree fndecl, tree arg0, tree arg1, bool ignore)
return fold_builtin_fprintf (loc, fndecl, arg0, arg1, NULL_TREE,
ignore, fcode);
+ case BUILT_IN_ATOMIC_ALWAYS_LOCK_FREE:
+ return fold_builtin_atomic_always_lock_free (arg0, arg1);
+
+ case BUILT_IN_ATOMIC_IS_LOCK_FREE:
+ return fold_builtin_atomic_is_lock_free (arg0, arg1);
+
default:
break;
}
diff --git a/gcc/c-decl.c b/gcc/c-decl.c
index 7af70f00c0f..3cb29c0b3a2 100644
--- a/gcc/c-decl.c
+++ b/gcc/c-decl.c
@@ -3707,6 +3707,17 @@ shadow_tag_warned (const struct c_declspecs *declspecs, int warned)
warned = 1;
pending_xref_error ();
}
+ else if (declspecs->typespec_kind != ctsk_tagdef
+ && declspecs->typespec_kind != ctsk_tagfirstref
+ && declspecs->alignas_p)
+ {
+ if (warned != 1)
+ pedwarn (input_location, 0,
+ "empty declaration with %<_Alignas%> "
+ "does not redeclare tag");
+ warned = 1;
+ pending_xref_error ();
+ }
else
{
pending_invalid_xref = 0;
@@ -3782,6 +3793,12 @@ shadow_tag_warned (const struct c_declspecs *declspecs, int warned)
warned = 2;
}
+ if (!warned && !in_system_header && declspecs->alignas_p)
+ {
+ warning (0, "useless %<_Alignas%> in empty declaration");
+ warned = 2;
+ }
+
if (warned != 1)
{
if (!found_tag)
@@ -4894,6 +4911,7 @@ grokdeclarator (const struct c_declarator *declarator,
tree expr_dummy;
bool expr_const_operands_dummy;
enum c_declarator_kind first_non_attr_kind;
+ unsigned int alignas_align = 0;
if (TREE_CODE (type) == ERROR_MARK)
return error_mark_node;
@@ -5737,6 +5755,46 @@ grokdeclarator (const struct c_declarator *declarator,
if (bitfield)
check_bitfield_type_and_width (&type, width, name);
+ /* Reject invalid uses of _Alignas. */
+ if (declspecs->alignas_p)
+ {
+ if (storage_class == csc_typedef)
+ error_at (loc, "alignment specified for typedef %qE", name);
+ else if (storage_class == csc_register)
+ error_at (loc, "alignment specified for %<register%> object %qE",
+ name);
+ else if (decl_context == PARM)
+ {
+ if (name)
+ error_at (loc, "alignment specified for parameter %qE", name);
+ else
+ error_at (loc, "alignment specified for unnamed parameter");
+ }
+ else if (bitfield)
+ {
+ if (name)
+ error_at (loc, "alignment specified for bit-field %qE", name);
+ else
+ error_at (loc, "alignment specified for unnamed bit-field");
+ }
+ else if (TREE_CODE (type) == FUNCTION_TYPE)
+ error_at (loc, "alignment specified for function %qE", name);
+ else if (declspecs->align_log != -1)
+ {
+ alignas_align = 1U << declspecs->align_log;
+ if (alignas_align < TYPE_ALIGN_UNIT (type))
+ {
+ if (name)
+ error_at (loc, "%<_Alignas%> specifiers cannot reduce "
+ "alignment of %qE", name);
+ else
+ error_at (loc, "%<_Alignas%> specifiers cannot reduce "
+ "alignment of unnamed field");
+ alignas_align = 0;
+ }
+ }
+ }
+
/* Did array size calculations overflow? */
if (TREE_CODE (type) == ARRAY_TYPE
@@ -6117,6 +6175,13 @@ grokdeclarator (const struct c_declarator *declarator,
/* Record constancy and volatility. */
c_apply_type_quals_to_decl (type_quals, decl);
+ /* Apply _Alignas specifiers. */
+ if (alignas_align)
+ {
+ DECL_ALIGN (decl) = alignas_align * BITS_PER_UNIT;
+ DECL_USER_ALIGN (decl) = 1;
+ }
+
/* If a type has volatile components, it should be stored in memory.
Otherwise, the fact that those components are volatile
will be ignored, and would even crash the compiler.
@@ -8709,6 +8774,7 @@ build_null_declspecs (void)
ret->expr = 0;
ret->decl_attr = 0;
ret->attrs = 0;
+ ret->align_log = -1;
ret->typespec_word = cts_none;
ret->storage_class = csc_none;
ret->expr_const_operands = true;
@@ -8732,6 +8798,7 @@ build_null_declspecs (void)
ret->volatile_p = false;
ret->restrict_p = false;
ret->saturating_p = false;
+ ret->alignas_p = false;
ret->address_space = ADDR_SPACE_GENERIC;
return ret;
}
@@ -9522,6 +9589,22 @@ declspecs_add_attrs (struct c_declspecs *specs, tree attrs)
return specs;
}
+/* Add an _Alignas specifier (expression ALIGN, or type whose
+ alignment is ALIGN) to the declaration specifiers SPECS, returning
+ SPECS. */
+struct c_declspecs *
+declspecs_add_alignas (struct c_declspecs *specs, tree align)
+{
+ int align_log;
+ specs->alignas_p = true;
+ if (align == error_mark_node)
+ return specs;
+ align_log = check_user_alignment (align, true);
+ if (align_log > specs->align_log)
+ specs->align_log = align_log;
+ return specs;
+}
+
/* Combine "long", "short", "signed", "unsigned" and "_Complex" type
specifiers with any other type specifier to determine the resulting
type. This is where ISO C checks on complex types are made, since
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog
index 028163ccefb..04134ec444d 100644
--- a/gcc/c-family/ChangeLog
+++ b/gcc/c-family/ChangeLog
@@ -1,3 +1,72 @@
+2011-11-07 Jason Merrill <jason@redhat.com>
+
+ PR c++/35688
+ * c-common.c, c-common.h: Revert yesterday's changes.
+
+2011-11-06 Jason Merrill <jason@redhat.com>
+
+ PR c++/35688
+ * c-common.c (decl_has_visibility_attr): Split out from...
+ (c_determine_visibility): ...here.
+ * c-common.h: Declare it.
+
+2011-11-06 Joseph Myers <joseph@codesourcery.com>
+
+ * c-common.c (c_common_reswords): Add _Alignas and _Alignof.
+ (c_sizeof_or_alignof_type): Diagnose alignof applied to a function
+ type.
+ (check_user_alignment): New. Split out of
+ handle_aligned_attribute. Disallow integer constants with
+ noninteger types. Conditionally allow zero.
+ (handle_aligned_attribute): Use check_user_alignment.
+ * c-common.h (RID_ALIGNAS, check_user_alignment): New.
+
+2011-11-06 Andrew MacLeod <amacleod@redhat.com>
+ Richard Henderson <rth@redhat.com>
+
+ Merged from cxx-mem-model.
+
+ * c-cppbuiltin.c (c_cpp_builtins): Test both atomic and sync patterns.
+ * c-common.c (sync_resolve_params, sync_resolve_return): Only tweak
+ parameters that are the same type size.
+ (get_atomic_generic_size): New. Find size of generic
+ atomic function parameters and do typechecking.
+ (add_atomic_size_parameter): New. Insert size into parameter list.
+ (resolve_overloaded_atomic_exchange): Restructure __atomic_exchange to
+ either __atomic_exchange_n or external library call.
+ (resolve_overloaded_atomic_compare_exchange): Restructure
+ __atomic_compare_exchange to either _n variant or external library call.
+ (resolve_overloaded_atomic_load): Restructure __atomic_load to either
+ __atomic_load_n or an external library call.
+ (resolve_overloaded_atomic_store): Restructure __atomic_store to either
+ __atomic_store_n or an external library call.
+ (resolve_overloaded_builtin): Handle new __atomic builtins.
+
+2011-11-04 Eric Botcazou <ebotcazou@adacore.com>
+
+ PR c++/50608
+ * c-common.c (c_fully_fold_internal) <ADDR_EXPR>: Call fold_offsetof_1.
+ (fold_offsetof_1): Make global. Remove STOP_REF argument and adjust.
+ <INDIRECT_REF>: Return the argument.
+ <ARRAY_REF>: Remove special code for negative offset.
+ Call fold_build_pointer_plus instead of size_binop.
+ (fold_offsetof): Remove STOP_REF argument and adjust.
+ * c-common.h (fold_offsetof_1): Declare.
+ (fold_offsetof): Remove STOP_REF argument.
+
+2011-11-02 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/50810
+ * c-opts.c (c_common_handle_option): Enable -Wnarrowing as part
+ of -Wall; include -Wnarrowing in -Wc++0x-compat; adjust default
+ Wnarrowing for C++0x and C++98.
+ * c.opt ([Wnarrowing]): Update.
+
+2011-11-01 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/44277
+ * c.opt: Add Wzero-as-null-pointer-constant.
+
2011-10-31 Jason Merrill <jason@redhat.com>
* c.opt (-fdeduce-init-list): Off by default.
diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c
index 32daa73f90f..a6823311321 100644
--- a/gcc/c-family/c-common.c
+++ b/gcc/c-family/c-common.c
@@ -407,6 +407,8 @@ static int resort_field_decl_cmp (const void *, const void *);
*/
const struct c_common_resword c_common_reswords[] =
{
+ { "_Alignas", RID_ALIGNAS, D_CONLY },
+ { "_Alignof", RID_ALIGNOF, D_CONLY },
{ "_Bool", RID_BOOL, D_CONLY },
{ "_Complex", RID_COMPLEX, 0 },
{ "_Imaginary", RID_IMAGINARY, D_CONLY },
@@ -1298,12 +1300,7 @@ c_fully_fold_internal (tree expr, bool in_init, bool *maybe_const_operands,
&& (op1 = get_base_address (op0)) != NULL_TREE
&& TREE_CODE (op1) == INDIRECT_REF
&& TREE_CONSTANT (TREE_OPERAND (op1, 0)))
- {
- tree offset = fold_offsetof (op0, op1);
- op1
- = fold_convert_loc (loc, TREE_TYPE (expr), TREE_OPERAND (op1, 0));
- ret = fold_build_pointer_plus_loc (loc, op1, offset);
- }
+ ret = fold_convert_loc (loc, TREE_TYPE (expr), fold_offsetof_1 (op0));
else if (op0 != orig_op0 || in_init)
ret = in_init
? fold_build1_initializer_loc (loc, code, TREE_TYPE (expr), op0)
@@ -4361,7 +4358,18 @@ c_sizeof_or_alignof_type (location_t loc,
value = size_one_node;
}
else
- value = size_int (FUNCTION_BOUNDARY / BITS_PER_UNIT);
+ {
+ if (complain)
+ {
+ if (c_dialect_cxx ())
+ pedwarn (loc, OPT_pedantic, "ISO C++ does not permit "
+ "%<alignof%> applied to a function type");
+ else
+ pedwarn (loc, OPT_pedantic, "ISO C does not permit "
+ "%<_Alignof%> applied to a function type");
+ }
+ value = size_int (FUNCTION_BOUNDARY / BITS_PER_UNIT);
+ }
}
else if (type_code == VOID_TYPE || type_code == ERROR_MARK)
{
@@ -6699,6 +6707,36 @@ handle_section_attribute (tree *node, tree ARG_UNUSED (name), tree args,
return NULL_TREE;
}
+/* Check whether ALIGN is a valid user-specified alignment. If so,
+ return its base-2 log; if not, output an error and return -1. If
+ ALLOW_ZERO then 0 is valid and should result in a return of -1 with
+ no error. */
+int
+check_user_alignment (const_tree align, bool allow_zero)
+{
+ int i;
+
+ if (!INTEGRAL_TYPE_P (TREE_TYPE (align))
+ || TREE_CODE (align) != INTEGER_CST)
+ {
+ error ("requested alignment is not an integer constant");
+ return -1;
+ }
+ else if (allow_zero && integer_zerop (align))
+ return -1;
+ else if ((i = tree_log2 (align)) == -1)
+ {
+ error ("requested alignment is not a power of 2");
+ return -1;
+ }
+ else if (i >= HOST_BITS_PER_INT - BITS_PER_UNIT_LOG)
+ {
+ error ("requested alignment is too large");
+ return -1;
+ }
+ return i;
+}
+
/* Handle a "aligned" attribute; arguments as in
struct attribute_spec.handler. */
@@ -6722,21 +6760,8 @@ handle_aligned_attribute (tree *node, tree ARG_UNUSED (name), tree args,
else if (TYPE_P (*node))
type = node, is_type = 1;
- if (TREE_CODE (align_expr) != INTEGER_CST)
- {
- error ("requested alignment is not a constant");
- *no_add_attrs = true;
- }
- else if ((i = tree_log2 (align_expr)) == -1)
- {
- error ("requested alignment is not a power of 2");
- *no_add_attrs = true;
- }
- else if (i >= HOST_BITS_PER_INT - BITS_PER_UNIT_LOG)
- {
- error ("requested alignment is too large");
- *no_add_attrs = true;
- }
+ if ((i = check_user_alignment (align_expr, false)) == -1)
+ *no_add_attrs = true;
else if (is_type)
{
if ((flags & (int) ATTR_FLAG_TYPE_IN_PLACE))
@@ -8779,20 +8804,15 @@ c_common_to_target_charset (HOST_WIDE_INT c)
return uc;
}
-/* Build the result of __builtin_offsetof. EXPR is a nested sequence of
- component references, with STOP_REF, or alternatively an INDIRECT_REF of
- NULL, at the bottom; much like the traditional rendering of offsetof as a
- macro. Returns the folded and properly cast result. */
+/* Fold an offsetof-like expression. EXPR is a nested sequence of component
+ references with an INDIRECT_REF of a constant at the bottom; much like the
+ traditional rendering of offsetof as a macro. Return the folded result. */
-static tree
-fold_offsetof_1 (tree expr, tree stop_ref)
+tree
+fold_offsetof_1 (tree expr)
{
- enum tree_code code = PLUS_EXPR;
tree base, off, t;
- if (expr == stop_ref && TREE_CODE (expr) != ERROR_MARK)
- return size_zero_node;
-
switch (TREE_CODE (expr))
{
case ERROR_MARK:
@@ -8809,15 +8829,15 @@ fold_offsetof_1 (tree expr, tree stop_ref)
case NOP_EXPR:
case INDIRECT_REF:
- if (!integer_zerop (TREE_OPERAND (expr, 0)))
+ if (!TREE_CONSTANT (TREE_OPERAND (expr, 0)))
{
error ("cannot apply %<offsetof%> to a non constant address");
return error_mark_node;
}
- return size_zero_node;
+ return TREE_OPERAND (expr, 0);
case COMPONENT_REF:
- base = fold_offsetof_1 (TREE_OPERAND (expr, 0), stop_ref);
+ base = fold_offsetof_1 (TREE_OPERAND (expr, 0));
if (base == error_mark_node)
return base;
@@ -8835,21 +8855,14 @@ fold_offsetof_1 (tree expr, tree stop_ref)
break;
case ARRAY_REF:
- base = fold_offsetof_1 (TREE_OPERAND (expr, 0), stop_ref);
+ base = fold_offsetof_1 (TREE_OPERAND (expr, 0));
if (base == error_mark_node)
return base;
t = TREE_OPERAND (expr, 1);
- if (TREE_CODE (t) == INTEGER_CST && tree_int_cst_sgn (t) < 0)
- {
- code = MINUS_EXPR;
- t = fold_build1_loc (input_location, NEGATE_EXPR, TREE_TYPE (t), t);
- }
- t = convert (sizetype, t);
- off = size_binop (MULT_EXPR, TYPE_SIZE_UNIT (TREE_TYPE (expr)), t);
/* Check if the offset goes beyond the upper bound of the array. */
- if (code == PLUS_EXPR && TREE_CODE (t) == INTEGER_CST)
+ if (TREE_CODE (t) == INTEGER_CST && tree_int_cst_sgn (t) >= 0)
{
tree upbound = array_ref_up_bound (expr);
if (upbound != NULL_TREE
@@ -8889,26 +8902,30 @@ fold_offsetof_1 (tree expr, tree stop_ref)
}
}
}
+
+ t = convert (sizetype, t);
+ off = size_binop (MULT_EXPR, TYPE_SIZE_UNIT (TREE_TYPE (expr)), t);
break;
case COMPOUND_EXPR:
/* Handle static members of volatile structs. */
t = TREE_OPERAND (expr, 1);
gcc_assert (TREE_CODE (t) == VAR_DECL);
- return fold_offsetof_1 (t, stop_ref);
+ return fold_offsetof_1 (t);
default:
gcc_unreachable ();
}
- return size_binop (code, base, off);
+ return fold_build_pointer_plus (base, off);
}
+/* Likewise, but convert it to the return type of offsetof. */
+
tree
-fold_offsetof (tree expr, tree stop_ref)
+fold_offsetof (tree expr)
{
- /* Convert back from the internal sizetype to size_t. */
- return convert (size_type_node, fold_offsetof_1 (expr, stop_ref));
+ return convert (size_type_node, fold_offsetof_1 (expr));
}
/* Warn for A ?: C expressions (with B omitted) where A is a boolean
@@ -9261,7 +9278,8 @@ sync_resolve_size (tree function, VEC(tree,gc) *params)
was encountered; true on success. */
static bool
-sync_resolve_params (tree orig_function, tree function, VEC(tree, gc) *params)
+sync_resolve_params (location_t loc, tree orig_function, tree function,
+ VEC(tree, gc) *params, bool orig_format)
{
function_args_iterator iter;
tree ptype;
@@ -9289,21 +9307,34 @@ sync_resolve_params (tree orig_function, tree function, VEC(tree, gc) *params)
++parmnum;
if (VEC_length (tree, params) <= parmnum)
{
- error ("too few arguments to function %qE", orig_function);
+ error_at (loc, "too few arguments to function %qE", orig_function);
return false;
}
- /* ??? Ideally for the first conversion we'd use convert_for_assignment
- so that we get warnings for anything that doesn't match the pointer
- type. This isn't portable across the C and C++ front ends atm. */
- val = VEC_index (tree, params, parmnum);
- val = convert (ptype, val);
- val = convert (arg_type, val);
- VEC_replace (tree, params, parmnum, val);
+ /* Only convert parameters if the size is appropriate with new format
+ sync routines. */
+ if (orig_format
+ || tree_int_cst_equal (TYPE_SIZE (ptype), TYPE_SIZE (arg_type)))
+ {
+ /* Ideally for the first conversion we'd use convert_for_assignment
+ so that we get warnings for anything that doesn't match the pointer
+ type. This isn't portable across the C and C++ front ends atm. */
+ val = VEC_index (tree, params, parmnum);
+ val = convert (ptype, val);
+ val = convert (arg_type, val);
+ VEC_replace (tree, params, parmnum, val);
+ }
function_args_iter_next (&iter);
}
+ /* __atomic routines are not variadic. */
+ if (!orig_format && VEC_length (tree, params) != parmnum + 1)
+ {
+ error_at (loc, "too many arguments to function %qE", orig_function);
+ return false;
+ }
+
/* The definition of these primitives is variadic, with the remaining
being "an optional list of variables protected by the memory barrier".
No clue what that's supposed to mean, precisely, but we consider all
@@ -9318,13 +9349,388 @@ sync_resolve_params (tree orig_function, tree function, VEC(tree, gc) *params)
PARAMS. */
static tree
-sync_resolve_return (tree first_param, tree result)
+sync_resolve_return (tree first_param, tree result, bool orig_format)
{
tree ptype = TREE_TYPE (TREE_TYPE (first_param));
+ tree rtype = TREE_TYPE (result);
ptype = TYPE_MAIN_VARIANT (ptype);
- return convert (ptype, result);
+
+ /* New format doesn't require casting unless the types are the same size. */
+ if (orig_format || tree_int_cst_equal (TYPE_SIZE (ptype), TYPE_SIZE (rtype)))
+ return convert (ptype, result);
+ else
+ return result;
}
+/* This function verifies the PARAMS to generic atomic FUNCTION.
+ It returns the size if all the parameters are the same size, otherwise
+ 0 is returned if the parameters are invalid. */
+
+static int
+get_atomic_generic_size (location_t loc, tree function, VEC(tree,gc) *params)
+{
+ unsigned int n_param;
+ unsigned int n_model;
+ unsigned int x;
+ int size_0;
+ tree type_0;
+
+ /* Determine the parameter makeup. */
+ switch (DECL_FUNCTION_CODE (function))
+ {
+ case BUILT_IN_ATOMIC_EXCHANGE:
+ n_param = 4;
+ n_model = 1;
+ break;
+ case BUILT_IN_ATOMIC_LOAD:
+ case BUILT_IN_ATOMIC_STORE:
+ n_param = 3;
+ n_model = 1;
+ break;
+ case BUILT_IN_ATOMIC_COMPARE_EXCHANGE:
+ n_param = 6;
+ n_model = 2;
+ break;
+ default:
+ return 0;
+ }
+
+ if (VEC_length (tree, params) != n_param)
+ {
+ error_at (loc, "incorrect number of arguments to function %qE", function);
+ return 0;
+ }
+
+ /* Get type of first parameter, and determine its size. */
+ type_0 = TREE_TYPE (VEC_index (tree, params, 0));
+ if (TREE_CODE (type_0) != POINTER_TYPE)
+ {
+ error_at (loc, "argument 1 of %qE must be a pointer type", function);
+ return 0;
+ }
+ size_0 = tree_low_cst (TYPE_SIZE_UNIT (TREE_TYPE (type_0)), 1);
+
+ /* Check each other parameter is a pointer and the same size. */
+ for (x = 0; x < n_param - n_model; x++)
+ {
+ int size;
+ tree type = TREE_TYPE (VEC_index (tree, params, x));
+ /* __atomic_compare_exchange has a bool in the 4th postion, skip it. */
+ if (n_param == 6 && x == 3)
+ continue;
+ if (!POINTER_TYPE_P (type))
+ {
+ error_at (loc, "argument %d of %qE must be a pointer type", x + 1,
+ function);
+ return 0;
+ }
+ size = tree_low_cst (TYPE_SIZE_UNIT (TREE_TYPE (type)), 1);
+ if (size != size_0)
+ {
+ error_at (loc, "size mismatch in argument %d of %qE", x + 1,
+ function);
+ return 0;
+ }
+ }
+
+ /* Check memory model parameters for validity. */
+ for (x = n_param - n_model ; x < n_param; x++)
+ {
+ tree p = VEC_index (tree, params, x);
+ if (TREE_CODE (p) == INTEGER_CST)
+ {
+ int i = tree_low_cst (p, 1);
+ if (i < 0 || i >= MEMMODEL_LAST)
+ {
+ warning_at (loc, OPT_Winvalid_memory_model,
+ "invalid memory model argument %d of %qE", x + 1,
+ function);
+ return MEMMODEL_SEQ_CST;
+ }
+ }
+ else
+ if (!INTEGRAL_TYPE_P (TREE_TYPE (p)))
+ {
+ error_at (loc, "non-integer memory model argument %d of %qE", x + 1,
+ function);
+ return 0;
+ }
+ }
+
+ return size_0;
+}
+
+
+/* This will take an __atomic_ generic FUNCTION call, and add a size parameter N
+ at the beginning of the parameter list PARAMS representing the size of the
+ objects. This is to match the library ABI requirement. LOC is the location
+ of the function call.
+ The new function is returned if it needed rebuilding, otherwise NULL_TREE is
+ returned to allow the external call to be constructed. */
+
+static tree
+add_atomic_size_parameter (unsigned n, location_t loc, tree function,
+ VEC(tree,gc) *params)
+{
+ tree size_node;
+
+ /* Insert a SIZE_T parameter as the first param. If there isn't
+ enough space, allocate a new vector and recursively re-build with that. */
+ if (!VEC_space (tree, params, 1))
+ {
+ unsigned int z, len;
+ VEC(tree,gc) *vec;
+ tree f;
+
+ len = VEC_length (tree, params);
+ vec = VEC_alloc (tree, gc, len + 1);
+ for (z = 0; z < len; z++)
+ VEC_quick_push (tree, vec, VEC_index (tree, params, z));
+ f = build_function_call_vec (loc, function, vec, NULL);
+ VEC_free (tree, gc, vec);
+ return f;
+ }
+
+ /* Add the size parameter and leave as a function call for processing. */
+ size_node = build_int_cst (size_type_node, n);
+ VEC_quick_insert (tree, params, 0, size_node);
+ return NULL_TREE;
+}
+
+
+/* This will process an __atomic_exchange function call, determine whether it
+ needs to be mapped to the _N variation, or turned into a library call.
+ LOC is the location of the builtin call.
+ FUNCTION is the DECL that has been invoked;
+ PARAMS is the argument list for the call. The return value is non-null
+ TRUE is returned if it is translated into the proper format for a call to the
+ external library, and NEW_RETURN is set the tree for that function.
+ FALSE is returned if processing for the _N variation is required, and
+ NEW_RETURN is set to the the return value the result is copied into. */
+static bool
+resolve_overloaded_atomic_exchange (location_t loc, tree function,
+ VEC(tree,gc) *params, tree *new_return)
+{
+ tree p0, p1, p2, p3;
+ tree I_type, I_type_ptr;
+ int n = get_atomic_generic_size (loc, function, params);
+
+ /* If not a lock-free size, change to the library generic format. */
+ if (n != 1 && n != 2 && n != 4 && n != 8 && n != 16)
+ {
+ *new_return = add_atomic_size_parameter (n, loc, function, params);
+ return true;
+ }
+
+ /* Otherwise there is a lockfree match, transform the call from:
+ void fn(T* mem, T* desired, T* return, model)
+ into
+ *return = (T) (fn (In* mem, (In) *desired, model)) */
+
+ p0 = VEC_index (tree, params, 0);
+ p1 = VEC_index (tree, params, 1);
+ p2 = VEC_index (tree, params, 2);
+ p3 = VEC_index (tree, params, 3);
+
+ /* Create pointer to appropriate size. */
+ I_type = builtin_type_for_size (BITS_PER_UNIT * n, 1);
+ I_type_ptr = build_pointer_type (I_type);
+
+ /* Convert object pointer to required type. */
+ p0 = build1 (VIEW_CONVERT_EXPR, I_type_ptr, p0);
+ VEC_replace (tree, params, 0, p0);
+
+ /* Convert new value to required type, and dereference it. */
+ p1 = build_indirect_ref (loc, p1, RO_UNARY_STAR);
+ p1 = build1 (VIEW_CONVERT_EXPR, I_type, p1);
+ VEC_replace (tree, params, 1, p1);
+
+ /* Move memory model to the 3rd position, and end param list. */
+ VEC_replace (tree, params, 2, p3);
+ VEC_truncate (tree, params, 3);
+
+ /* Convert return pointer and dereference it for later assignment. */
+ *new_return = build_indirect_ref (loc, p2, RO_UNARY_STAR);
+
+ return false;
+}
+
+
+/* This will process an __atomic_compare_exchange function call, determine
+ whether it needs to be mapped to the _N variation, or turned into a lib call.
+ LOC is the location of the builtin call.
+ FUNCTION is the DECL that has been invoked;
+ PARAMS is the argument list for the call. The return value is non-null
+ TRUE is returned if it is translated into the proper format for a call to the
+ external library, and NEW_RETURN is set the tree for that function.
+ FALSE is returned if processing for the _N variation is required. */
+
+static bool
+resolve_overloaded_atomic_compare_exchange (location_t loc, tree function,
+ VEC(tree,gc) *params,
+ tree *new_return)
+{
+ tree p0, p1, p2;
+ tree I_type, I_type_ptr;
+ int n = get_atomic_generic_size (loc, function, params);
+
+ /* If not a lock-free size, change to the library generic format. */
+ if (n != 1 && n != 2 && n != 4 && n != 8 && n != 16)
+ {
+ /* The library generic format does not have the weak parameter, so
+ remove it from the param list. Since a parameter has been removed,
+ we can be sure that there is room for the SIZE_T parameter, meaning
+ there will not be a recursive rebuilding of the parameter list, so
+ there is no danger this will be done twice. */
+ if (n > 0)
+ {
+ VEC_replace (tree, params, 3, VEC_index (tree, params, 4));
+ VEC_replace (tree, params, 4, VEC_index (tree, params, 5));
+ VEC_truncate (tree, params, 5);
+ }
+ *new_return = add_atomic_size_parameter (n, loc, function, params);
+ return true;
+ }
+
+ /* Otherwise, there is a match, so the call needs to be transformed from:
+ bool fn(T* mem, T* desired, T* return, weak, success, failure)
+ into
+ bool fn ((In *)mem, (In *)expected, (In) *desired, weak, succ, fail) */
+
+ p0 = VEC_index (tree, params, 0);
+ p1 = VEC_index (tree, params, 1);
+ p2 = VEC_index (tree, params, 2);
+
+ /* Create pointer to appropriate size. */
+ I_type = builtin_type_for_size (BITS_PER_UNIT * n, 1);
+ I_type_ptr = build_pointer_type (I_type);
+
+ /* Convert object pointer to required type. */
+ p0 = build1 (VIEW_CONVERT_EXPR, I_type_ptr, p0);
+ VEC_replace (tree, params, 0, p0);
+
+ /* Convert expected pointer to required type. */
+ p1 = build1 (VIEW_CONVERT_EXPR, I_type_ptr, p1);
+ VEC_replace (tree, params, 1, p1);
+
+ /* Convert desired value to required type, and dereference it. */
+ p2 = build_indirect_ref (loc, p2, RO_UNARY_STAR);
+ p2 = build1 (VIEW_CONVERT_EXPR, I_type, p2);
+ VEC_replace (tree, params, 2, p2);
+
+ /* The rest of the parameters are fine. NULL means no special return value
+ processing.*/
+ *new_return = NULL;
+ return false;
+}
+
+
+/* This will process an __atomic_load function call, determine whether it
+ needs to be mapped to the _N variation, or turned into a library call.
+ LOC is the location of the builtin call.
+ FUNCTION is the DECL that has been invoked;
+ PARAMS is the argument list for the call. The return value is non-null
+ TRUE is returned if it is translated into the proper format for a call to the
+ external library, and NEW_RETURN is set the tree for that function.
+ FALSE is returned if processing for the _N variation is required, and
+ NEW_RETURN is set to the the return value the result is copied into. */
+
+static bool
+resolve_overloaded_atomic_load (location_t loc, tree function,
+ VEC(tree,gc) *params, tree *new_return)
+{
+ tree p0, p1, p2;
+ tree I_type, I_type_ptr;
+ int n = get_atomic_generic_size (loc, function, params);
+
+ /* If not a lock-free size, change to the library generic format. */
+ if (n != 1 && n != 2 && n != 4 && n != 8 && n != 16)
+ {
+ *new_return = add_atomic_size_parameter (n, loc, function, params);
+ return true;
+ }
+
+ /* Otherwise, there is a match, so the call needs to be transformed from:
+ void fn(T* mem, T* return, model)
+ into
+ *return = (T) (fn ((In *) mem, model)) */
+
+ p0 = VEC_index (tree, params, 0);
+ p1 = VEC_index (tree, params, 1);
+ p2 = VEC_index (tree, params, 2);
+
+ /* Create pointer to appropriate size. */
+ I_type = builtin_type_for_size (BITS_PER_UNIT * n, 1);
+ I_type_ptr = build_pointer_type (I_type);
+
+ /* Convert object pointer to required type. */
+ p0 = build1 (VIEW_CONVERT_EXPR, I_type_ptr, p0);
+ VEC_replace (tree, params, 0, p0);
+
+ /* Move memory model to the 2nd position, and end param list. */
+ VEC_replace (tree, params, 1, p2);
+ VEC_truncate (tree, params, 2);
+
+ /* Convert return pointer and dereference it for later assignment. */
+ *new_return = build_indirect_ref (loc, p1, RO_UNARY_STAR);
+
+ return false;
+}
+
+
+/* This will process an __atomic_store function call, determine whether it
+ needs to be mapped to the _N variation, or turned into a library call.
+ LOC is the location of the builtin call.
+ FUNCTION is the DECL that has been invoked;
+ PARAMS is the argument list for the call. The return value is non-null
+ TRUE is returned if it is translated into the proper format for a call to the
+ external library, and NEW_RETURN is set the tree for that function.
+ FALSE is returned if processing for the _N variation is required, and
+ NEW_RETURN is set to the the return value the result is copied into. */
+
+static bool
+resolve_overloaded_atomic_store (location_t loc, tree function,
+ VEC(tree,gc) *params, tree *new_return)
+{
+ tree p0, p1;
+ tree I_type, I_type_ptr;
+ int n = get_atomic_generic_size (loc, function, params);
+
+ /* If not a lock-free size, change to the library generic format. */
+ if (n != 1 && n != 2 && n != 4 && n != 8 && n != 16)
+ {
+ *new_return = add_atomic_size_parameter (n, loc, function, params);
+ return true;
+ }
+
+ /* Otherwise, there is a match, so the call needs to be transformed from:
+ void fn(T* mem, T* value, model)
+ into
+ fn ((In *) mem, (In) *value, model) */
+
+ p0 = VEC_index (tree, params, 0);
+ p1 = VEC_index (tree, params, 1);
+
+ /* Create pointer to appropriate size. */
+ I_type = builtin_type_for_size (BITS_PER_UNIT * n, 1);
+ I_type_ptr = build_pointer_type (I_type);
+
+ /* Convert object pointer to required type. */
+ p0 = build1 (VIEW_CONVERT_EXPR, I_type_ptr, p0);
+ VEC_replace (tree, params, 0, p0);
+
+ /* Convert new value to required type, and dereference it. */
+ p1 = build_indirect_ref (loc, p1, RO_UNARY_STAR);
+ p1 = build1 (VIEW_CONVERT_EXPR, I_type, p1);
+ VEC_replace (tree, params, 1, p1);
+
+ /* The memory model is in the right spot already. Return is void. */
+ *new_return = NULL_TREE;
+
+ return false;
+}
+
+
/* Some builtin functions are placeholders for other expressions. This
function should be called immediately after parsing the call expression
before surrounding code has committed to the type of the expression.
@@ -9340,6 +9746,9 @@ tree
resolve_overloaded_builtin (location_t loc, tree function, VEC(tree,gc) *params)
{
enum built_in_function orig_code = DECL_FUNCTION_CODE (function);
+ bool orig_format = true;
+ tree new_return = NULL_TREE;
+
switch (DECL_BUILT_IN_CLASS (function))
{
case BUILT_IN_NORMAL:
@@ -9356,6 +9765,78 @@ resolve_overloaded_builtin (location_t loc, tree function, VEC(tree,gc) *params)
/* Handle BUILT_IN_NORMAL here. */
switch (orig_code)
{
+ case BUILT_IN_ATOMIC_EXCHANGE:
+ case BUILT_IN_ATOMIC_COMPARE_EXCHANGE:
+ case BUILT_IN_ATOMIC_LOAD:
+ case BUILT_IN_ATOMIC_STORE:
+ {
+ /* Handle these 4 together so that they can fall through to the next
+ case if the call is transformed to an _N variant. */
+ switch (orig_code)
+ {
+ case BUILT_IN_ATOMIC_EXCHANGE:
+ {
+ if (resolve_overloaded_atomic_exchange (loc, function, params,
+ &new_return))
+ return new_return;
+ /* Change to the _N variant. */
+ orig_code = BUILT_IN_ATOMIC_EXCHANGE_N;
+ break;
+ }
+
+ case BUILT_IN_ATOMIC_COMPARE_EXCHANGE:
+ {
+ if (resolve_overloaded_atomic_compare_exchange (loc, function,
+ params,
+ &new_return))
+ return new_return;
+ /* Change to the _N variant. */
+ orig_code = BUILT_IN_ATOMIC_COMPARE_EXCHANGE_N;
+ break;
+ }
+ case BUILT_IN_ATOMIC_LOAD:
+ {
+ if (resolve_overloaded_atomic_load (loc, function, params,
+ &new_return))
+ return new_return;
+ /* Change to the _N variant. */
+ orig_code = BUILT_IN_ATOMIC_LOAD_N;
+ break;
+ }
+ case BUILT_IN_ATOMIC_STORE:
+ {
+ if (resolve_overloaded_atomic_store (loc, function, params,
+ &new_return))
+ return new_return;
+ /* Change to the _N variant. */
+ orig_code = BUILT_IN_ATOMIC_STORE_N;
+ break;
+ }
+ default:
+ gcc_unreachable ();
+ }
+ /* Fallthrough to the normal processing. */
+ }
+ case BUILT_IN_ATOMIC_EXCHANGE_N:
+ case BUILT_IN_ATOMIC_COMPARE_EXCHANGE_N:
+ case BUILT_IN_ATOMIC_LOAD_N:
+ case BUILT_IN_ATOMIC_STORE_N:
+ case BUILT_IN_ATOMIC_ADD_FETCH_N:
+ case BUILT_IN_ATOMIC_SUB_FETCH_N:
+ case BUILT_IN_ATOMIC_AND_FETCH_N:
+ case BUILT_IN_ATOMIC_NAND_FETCH_N:
+ case BUILT_IN_ATOMIC_XOR_FETCH_N:
+ case BUILT_IN_ATOMIC_OR_FETCH_N:
+ case BUILT_IN_ATOMIC_FETCH_ADD_N:
+ case BUILT_IN_ATOMIC_FETCH_SUB_N:
+ case BUILT_IN_ATOMIC_FETCH_AND_N:
+ case BUILT_IN_ATOMIC_FETCH_NAND_N:
+ case BUILT_IN_ATOMIC_FETCH_XOR_N:
+ case BUILT_IN_ATOMIC_FETCH_OR_N:
+ {
+ orig_format = false;
+ /* Fallthru for parameter processing. */
+ }
case BUILT_IN_SYNC_FETCH_AND_ADD_N:
case BUILT_IN_SYNC_FETCH_AND_SUB_N:
case BUILT_IN_SYNC_FETCH_AND_OR_N:
@@ -9382,15 +9863,31 @@ resolve_overloaded_builtin (location_t loc, tree function, VEC(tree,gc) *params)
fncode = (enum built_in_function)((int)orig_code + exact_log2 (n) + 1);
new_function = builtin_decl_explicit (fncode);
- if (!sync_resolve_params (function, new_function, params))
+ if (!sync_resolve_params (loc, function, new_function, params,
+ orig_format))
return error_mark_node;
first_param = VEC_index (tree, params, 0);
result = build_function_call_vec (loc, new_function, params, NULL);
+ if (result == error_mark_node)
+ return result;
if (orig_code != BUILT_IN_SYNC_BOOL_COMPARE_AND_SWAP_N
- && orig_code != BUILT_IN_SYNC_LOCK_RELEASE_N)
- result = sync_resolve_return (first_param, result);
+ && orig_code != BUILT_IN_SYNC_LOCK_RELEASE_N
+ && orig_code != BUILT_IN_ATOMIC_STORE_N)
+ result = sync_resolve_return (first_param, result, orig_format);
+ /* If new_return is set, assign function to that expr and cast the
+ result to void since the generic interface returned void. */
+ if (new_return)
+ {
+ /* Cast function result from I{1,2,4,8,16} to the required type. */
+ result = build1 (VIEW_CONVERT_EXPR, TREE_TYPE (new_return), result);
+ result = build2 (MODIFY_EXPR, TREE_TYPE (new_return), new_return,
+ result);
+ TREE_SIDE_EFFECTS (result) = 1;
+ protected_set_expr_location (result, loc);
+ result = convert (void_type_node, result);
+ }
return result;
}
diff --git a/gcc/c-family/c-common.h b/gcc/c-family/c-common.h
index db58b95a37c..4d65dd1b7f1 100644
--- a/gcc/c-family/c-common.h
+++ b/gcc/c-family/c-common.h
@@ -106,6 +106,9 @@ enum rid
RID_DFLOAT32, RID_DFLOAT64, RID_DFLOAT128,
RID_FRACT, RID_ACCUM,
+ /* C1X */
+ RID_ALIGNAS,
+
/* This means to warn that this is a C++ keyword, and then treat it
as a normal identifier. */
RID_CXX_COMPAT_WARN,
@@ -727,6 +730,7 @@ extern void finish_fname_decls (void);
extern const char *fname_as_string (int);
extern tree fname_decl (location_t, unsigned, tree);
+extern int check_user_alignment (const_tree, bool);
extern void check_function_arguments (const_tree, int, tree *);
extern void check_function_arguments_recurse (void (*)
(void *, tree,
@@ -959,7 +963,8 @@ extern bool c_dump_tree (void *, tree);
extern void verify_sequence_points (tree);
-extern tree fold_offsetof (tree, tree);
+extern tree fold_offsetof_1 (tree);
+extern tree fold_offsetof (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 bb9893a9681..bf83c261c20 100644
--- a/gcc/c-family/c-cppbuiltin.c
+++ b/gcc/c-family/c-cppbuiltin.c
@@ -758,30 +758,50 @@ c_cpp_builtins (cpp_reader *pfile)
/* Tell source code if the compiler makes sync_compare_and_swap
builtins available. */
-#ifdef HAVE_sync_compare_and_swapqi
- if (HAVE_sync_compare_and_swapqi)
- cpp_define (pfile, "__GCC_HAVE_SYNC_COMPARE_AND_SWAP_1");
+#ifndef HAVE_sync_compare_and_swapqi
+#define HAVE_sync_compare_and_swapqi 0
+#endif
+#ifndef HAVE_atomic_compare_and_swapqi
+#define HAVE_atomic_compare_and_swapqi 0
#endif
+ if (HAVE_sync_compare_and_swapqi || HAVE_atomic_compare_and_swapqi)
+ cpp_define (pfile, "__GCC_HAVE_SYNC_COMPARE_AND_SWAP_1");
-#ifdef HAVE_sync_compare_and_swaphi
- if (HAVE_sync_compare_and_swaphi)
- cpp_define (pfile, "__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2");
+#ifndef HAVE_sync_compare_and_swaphi
+#define HAVE_sync_compare_and_swaphi 0
#endif
+#ifndef HAVE_atomic_compare_and_swaphi
+#define HAVE_atomic_compare_and_swaphi 0
+#endif
+ if (HAVE_sync_compare_and_swaphi || HAVE_atomic_compare_and_swaphi)
+ cpp_define (pfile, "__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2");
-#ifdef HAVE_sync_compare_and_swapsi
- if (HAVE_sync_compare_and_swapsi)
- cpp_define (pfile, "__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4");
+#ifndef HAVE_sync_compare_and_swapsi
+#define HAVE_sync_compare_and_swapsi 0
+#endif
+#ifndef HAVE_atomic_compare_and_swapsi
+#define HAVE_atomic_compare_and_swapsi 0
#endif
+ if (HAVE_sync_compare_and_swapsi || HAVE_atomic_compare_and_swapsi)
+ cpp_define (pfile, "__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4");
-#ifdef HAVE_sync_compare_and_swapdi
- if (HAVE_sync_compare_and_swapdi)
- cpp_define (pfile, "__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8");
+#ifndef HAVE_sync_compare_and_swapdi
+#define HAVE_sync_compare_and_swapdi 0
#endif
+#ifndef HAVE_atomic_compare_and_swapdi
+#define HAVE_atomic_compare_and_swapdi 0
+#endif
+ if (HAVE_sync_compare_and_swapdi || HAVE_atomic_compare_and_swapdi)
+ cpp_define (pfile, "__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8");
-#ifdef HAVE_sync_compare_and_swapti
- if (HAVE_sync_compare_and_swapti)
- cpp_define (pfile, "__GCC_HAVE_SYNC_COMPARE_AND_SWAP_16");
+#ifndef HAVE_sync_compare_and_swapti
+#define HAVE_sync_compare_and_swapti 0
+#endif
+#ifndef HAVE_atomic_compare_and_swapti
+#define HAVE_atomic_compare_and_swapti 0
#endif
+ if (HAVE_sync_compare_and_swapti || HAVE_atomic_compare_and_swapti)
+ cpp_define (pfile, "__GCC_HAVE_SYNC_COMPARE_AND_SWAP_16");
#ifdef DWARF2_UNWIND_INFO
if (dwarf2out_do_cfi_asm ())
diff --git a/gcc/c-family/c-opts.c b/gcc/c-family/c-opts.c
index b56aec79906..465bce35de3 100644
--- a/gcc/c-family/c-opts.c
+++ b/gcc/c-family/c-opts.c
@@ -406,6 +406,7 @@ c_common_handle_option (size_t scode, const char *arg, int value,
warn_reorder = value;
warn_cxx0x_compat = value;
warn_delnonvdtor = value;
+ warn_narrowing = value;
}
cpp_opts->warn_trigraphs = value;
@@ -436,6 +437,10 @@ c_common_handle_option (size_t scode, const char *arg, int value,
cpp_opts->warn_cxx_operator_names = value;
break;
+ case OPT_Wc__0x_compat:
+ warn_narrowing = value;
+ break;
+
case OPT_Wdeprecated:
cpp_opts->cpp_warn_deprecated = value;
break;
@@ -997,10 +1002,17 @@ c_common_post_options (const char **pfilename)
if (warn_implicit_function_declaration == -1)
warn_implicit_function_declaration = flag_isoc99;
- /* If we're allowing C++0x constructs, don't warn about C++0x
- compatibility problems. */
if (cxx_dialect == cxx0x)
- warn_cxx0x_compat = 0;
+ {
+ /* If we're allowing C++0x constructs, don't warn about C++98
+ identifiers which are keywords in C++0x. */
+ warn_cxx0x_compat = 0;
+
+ if (warn_narrowing == -1)
+ warn_narrowing = 1;
+ }
+ else if (warn_narrowing == -1)
+ warn_narrowing = 0;
if (flag_preprocess_only)
{
diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt
index 6d500975898..0d7dc88b1ca 100644
--- a/gcc/c-family/c.opt
+++ b/gcc/c-family/c.opt
@@ -494,8 +494,8 @@ C ObjC C++ ObjC++ Warning
Warn about use of multi-character character constants
Wnarrowing
-C ObjC C++ ObjC++ Warning Var(warn_narrowing) Init(1)
--Wno-narrowing In C++0x mode, ignore ill-formed narrowing conversions within { }
+C ObjC C++ ObjC++ Warning Var(warn_narrowing) Init(-1)
+Warn about narrowing conversions within { } that are ill-formed in C++11
Wnested-externs
C ObjC Var(warn_nested_externs) Warning
@@ -689,6 +689,10 @@ Wpointer-sign
C ObjC Var(warn_pointer_sign) Init(-1) Warning
Warn when a pointer differs in signedness in an assignment
+Wzero-as-null-pointer-constant
+C++ ObjC++ Var(warn_zero_as_null_pointer_constant) Warning
+Warn when a literal '0' is used as null pointer
+
ansi
C ObjC C++ ObjC++
A synonym for -std=c89 (for C) or -std=c++98 (for C++)
diff --git a/gcc/c-parser.c b/gcc/c-parser.c
index 25a4741a1b6..aed390f31e8 100644
--- a/gcc/c-parser.c
+++ b/gcc/c-parser.c
@@ -653,6 +653,7 @@ c_token_starts_declspecs (c_token *token)
case RID_FRACT:
case RID_ACCUM:
case RID_SAT:
+ case RID_ALIGNAS:
return true;
default:
return false;
@@ -1123,6 +1124,7 @@ static struct c_typespec c_parser_enum_specifier (c_parser *);
static struct c_typespec c_parser_struct_or_union_specifier (c_parser *);
static tree c_parser_struct_declaration (c_parser *);
static struct c_typespec c_parser_typeof_specifier (c_parser *);
+static tree c_parser_alignas_specifier (c_parser *);
static struct c_declarator *c_parser_declarator (c_parser *, bool, c_dtr_syn,
bool *);
static struct c_declarator *c_parser_direct_declarator (c_parser *, bool,
@@ -1896,9 +1898,11 @@ c_parser_static_assert_declaration_no_semi (c_parser *parser)
type-specifier declaration-specifiers[opt]
type-qualifier declaration-specifiers[opt]
function-specifier declaration-specifiers[opt]
+ alignment-specifier declaration-specifiers[opt]
Function specifiers (inline) are from C99, and are currently
- handled as storage class specifiers, as is __thread.
+ handled as storage class specifiers, as is __thread. Alignment
+ specifiers are from C1X.
C90 6.5.1, C99 6.7.1:
storage-class-specifier:
@@ -1997,6 +2001,7 @@ c_parser_declspecs (c_parser *parser, struct c_declspecs *specs,
{
struct c_typespec t;
tree attrs;
+ tree align;
location_t loc = c_parser_peek_token (parser)->location;
/* If we cannot accept a type, exit if the next token must start
@@ -2175,6 +2180,10 @@ c_parser_declspecs (c_parser *parser, struct c_declspecs *specs,
attrs = c_parser_attributes (parser);
declspecs_add_attrs (specs, attrs);
break;
+ case RID_ALIGNAS:
+ align = c_parser_alignas_specifier (parser);
+ declspecs_add_alignas (specs, align);
+ break;
default:
goto out;
}
@@ -2757,6 +2766,45 @@ c_parser_typeof_specifier (c_parser *parser)
return ret;
}
+/* Parse an alignment-specifier.
+
+ C1X 6.7.5:
+
+ alignment-specifier:
+ _Alignas ( type-name )
+ _Alignas ( constant-expression )
+*/
+
+static tree
+c_parser_alignas_specifier (c_parser * parser)
+{
+ tree ret = error_mark_node;
+ location_t loc = c_parser_peek_token (parser)->location;
+ gcc_assert (c_parser_next_token_is_keyword (parser, RID_ALIGNAS));
+ c_parser_consume_token (parser);
+ if (!flag_isoc1x)
+ {
+ if (flag_isoc99)
+ pedwarn (loc, OPT_pedantic,
+ "ISO C99 does not support %<_Alignas%>");
+ else
+ pedwarn (loc, OPT_pedantic,
+ "ISO C90 does not support %<_Alignas%>");
+ }
+ if (!c_parser_require (parser, CPP_OPEN_PAREN, "expected %<(%>"))
+ return ret;
+ if (c_parser_next_tokens_start_typename (parser, cla_prefer_id))
+ {
+ struct c_type_name *type = c_parser_type_name (parser);
+ if (type != NULL)
+ ret = c_alignof (loc, groktypename (type, NULL, NULL));
+ }
+ else
+ ret = c_parser_expr_no_commas (parser, NULL).value;
+ c_parser_skip_until_found (parser, CPP_CLOSE_PAREN, "expected %<)%>");
+ return ret;
+}
+
/* Parse a declarator, possibly an abstract declarator (C90 6.5.4,
6.5.5, C99 6.7.5, 6.7.6). If TYPE_SEEN_P then a typedef name may
be redeclared; otherwise it may not. KIND indicates which kind of
@@ -5793,6 +5841,8 @@ c_parser_cast_expression (c_parser *parser, struct c_expr *after)
__alignof__ ( type-name )
&& identifier
+ (C1X permits _Alignof with type names only.)
+
unary-operator: one of
__extension__ __real__ __imag__
@@ -5985,7 +6035,21 @@ c_parser_alignof_expression (c_parser *parser)
{
struct c_expr expr;
location_t loc = c_parser_peek_token (parser)->location;
+ tree alignof_spelling = c_parser_peek_token (parser)->value;
gcc_assert (c_parser_next_token_is_keyword (parser, RID_ALIGNOF));
+ /* A diagnostic is not required for the use of this identifier in
+ the implementation namespace; only diagnose it for the C1X
+ spelling because of existing code using the other spellings. */
+ if (!flag_isoc1x
+ && strcmp (IDENTIFIER_POINTER (alignof_spelling), "_Alignof") == 0)
+ {
+ if (flag_isoc99)
+ pedwarn (loc, OPT_pedantic, "ISO C99 does not support %qE",
+ alignof_spelling);
+ else
+ pedwarn (loc, OPT_pedantic, "ISO C90 does not support %qE",
+ alignof_spelling);
+ }
c_parser_consume_token (parser);
c_inhibit_evaluation_warnings++;
in_alignof++;
@@ -6034,6 +6098,8 @@ c_parser_alignof_expression (c_parser *parser)
mark_exp_read (expr.value);
c_inhibit_evaluation_warnings--;
in_alignof--;
+ pedwarn (loc, OPT_pedantic, "ISO C does not allow %<%E (expression)%>",
+ alignof_spelling);
ret.value = c_alignof_expr (loc, expr.value);
ret.original_code = ERROR_MARK;
ret.original_type = NULL;
@@ -6431,7 +6497,7 @@ c_parser_postfix_expression (c_parser *parser)
c_parser_error (parser, "expected identifier");
c_parser_skip_until_found (parser, CPP_CLOSE_PAREN,
"expected %<)%>");
- expr.value = fold_offsetof (offsetof_ref, NULL_TREE);
+ expr.value = fold_offsetof (offsetof_ref);
}
break;
case RID_CHOOSE_EXPR:
diff --git a/gcc/c-tree.h b/gcc/c-tree.h
index bca84243984..51c660c0346 100644
--- a/gcc/c-tree.h
+++ b/gcc/c-tree.h
@@ -238,6 +238,10 @@ struct c_declspecs {
NULL; attributes (possibly from multiple lists) will be passed
separately. */
tree attrs;
+ /* The base-2 log of the greatest alignment required by an _Alignas
+ specifier, in bytes, or -1 if no such specifiers with nonzero
+ alignment. */
+ int align_log;
/* The storage class specifier, or csc_none if none. */
enum c_storage_class storage_class;
/* Any type specifier keyword used such as "int", not reflecting
@@ -294,6 +298,9 @@ struct c_declspecs {
BOOL_BITFIELD restrict_p : 1;
/* Whether "_Sat" was specified. */
BOOL_BITFIELD saturating_p : 1;
+ /* Whether any alignment specifier (even with zero alignment) was
+ specified. */
+ BOOL_BITFIELD alignas_p : 1;
/* The address space that the declaration belongs to. */
addr_space_t address_space;
};
@@ -510,6 +517,7 @@ extern struct c_declspecs *declspecs_add_scspec (struct c_declspecs *, tree);
extern struct c_declspecs *declspecs_add_attrs (struct c_declspecs *, tree);
extern struct c_declspecs *declspecs_add_addrspace (struct c_declspecs *,
addr_space_t);
+extern struct c_declspecs *declspecs_add_alignas (struct c_declspecs *, tree);
extern struct c_declspecs *finish_declspecs (struct c_declspecs *);
/* in c-objc-common.c */
diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c
index c4e8930e0fb..4a134b0e524 100644
--- a/gcc/c-typeck.c
+++ b/gcc/c-typeck.c
@@ -2720,6 +2720,10 @@ build_function_call_vec (location_t loc, tree function, VEC(tree,gc) *params,
if (flag_tm)
tm_malloc_replacement (function);
fundecl = function;
+ /* Atomic functions have type checking/casting already done. They are
+ often rewritten and don't match the original parameter list. */
+ if (name && !strncmp (IDENTIFIER_POINTER (name), "__atomic_", 9))
+ origtypes = NULL;
}
if (TREE_CODE (TREE_TYPE (function)) == FUNCTION_TYPE)
function = function_to_pointer_conversion (loc, function);
@@ -3893,10 +3897,7 @@ build_unary_op (location_t location,
if (val && TREE_CODE (val) == INDIRECT_REF
&& TREE_CONSTANT (TREE_OPERAND (val, 0)))
{
- tree op0 = fold_offsetof (arg, val), op1;
-
- op1 = fold_convert_loc (location, argtype, TREE_OPERAND (val, 0));
- ret = fold_build_pointer_plus_loc (location, op1, op0);
+ ret = fold_convert_loc (location, argtype, fold_offsetof_1 (arg));
goto return_build_unary_op;
}
diff --git a/gcc/cfglayout.c b/gcc/cfglayout.c
index 62ac6bfe151..22d3d87e68b 100644
--- a/gcc/cfglayout.c
+++ b/gcc/cfglayout.c
@@ -149,6 +149,7 @@ skip_insns_after_block (basic_block bb)
break;
case NOTE_INSN_DELETED:
case NOTE_INSN_DELETED_LABEL:
+ case NOTE_INSN_DELETED_DEBUG_LABEL:
continue;
default:
reorder_insns (insn, insn, last_insn);
@@ -1174,6 +1175,10 @@ duplicate_insn_chain (rtx from, rtx to)
switch (GET_CODE (insn))
{
case DEBUG_INSN:
+ /* Don't duplicate label debug insns. */
+ if (TREE_CODE (INSN_VAR_LOCATION_DECL (insn)) == LABEL_DECL)
+ break;
+ /* FALLTHRU */
case INSN:
case CALL_INSN:
case JUMP_INSN:
@@ -1219,6 +1224,7 @@ duplicate_insn_chain (rtx from, rtx to)
case NOTE_INSN_DELETED:
case NOTE_INSN_DELETED_LABEL:
+ case NOTE_INSN_DELETED_DEBUG_LABEL:
/* No problem to strip these. */
case NOTE_INSN_FUNCTION_BEG:
/* There is always just single entry to function. */
diff --git a/gcc/collect2.c b/gcc/collect2.c
index cf39693f653..92ef7ba024e 100644
--- a/gcc/collect2.c
+++ b/gcc/collect2.c
@@ -1091,6 +1091,9 @@ main (int argc, char **argv)
const char **ld2;
char **object_lst;
const char **object;
+#ifdef TARGET_AIX_VERSION
+ int object_nbr = argc;
+#endif
int first_file;
int num_c_args;
char **old_argv;
@@ -1440,6 +1443,57 @@ main (int argc, char **argv)
"configuration");
#endif
}
+#ifdef TARGET_AIX_VERSION
+ else
+ {
+ /* File containing a list of input files to process. */
+
+ FILE *stream;
+ char buf[MAXPATHLEN + 2];
+ /* Number of additionnal object files. */
+ int add_nbr = 0;
+ /* Maximum of additionnal object files before vector
+ expansion. */
+ int add_max = 0;
+ const char *list_filename = arg + 2;
+
+ /* Accept -fFILENAME and -f FILENAME. */
+ if (*list_filename == '\0' && argv[1])
+ {
+ ++argv;
+ list_filename = *argv;
+ *ld1++ = *ld2++ = *argv;
+ }
+
+ stream = fopen (list_filename, "r");
+ if (stream == NULL)
+ fatal_error ("can't open %s: %m", list_filename);
+
+ while (fgets (buf, sizeof buf, stream) != NULL)
+ {
+ /* Remove end of line. */
+ int len = strlen (buf);
+ if (len >= 1 && buf[len - 1] =='\n')
+ buf[len - 1] = '\0';
+
+ /* Put on object vector.
+ Note: we only expanse vector here, so we must keep
+ extra space for remaining arguments. */
+ if (add_nbr >= add_max)
+ {
+ int pos = object - (const char **)object_lst;
+ add_max = (add_max == 0) ? 16 : add_max * 2;
+ object_lst = XRESIZEVEC (char *, object_lst,
+ object_nbr + add_max);
+ object = (const char **) object_lst + pos;
+ object_nbr += add_max;
+ }
+ *object++ = xstrdup (buf);
+ add_nbr++;
+ }
+ fclose (stream);
+ }
+#endif
break;
case 'l':
diff --git a/gcc/common.opt b/gcc/common.opt
index be2a967992c..4eb5b30b1c4 100644
--- a/gcc/common.opt
+++ b/gcc/common.opt
@@ -551,6 +551,10 @@ Winline
Common Var(warn_inline) Warning
Warn when an inlined function cannot be inlined
+Winvalid-memory-model
+Common Var(warn_invalid_memory_model) Init(1) Warning
+Warn when an atomic memory model parameter is known to be outside the valid range.
+
Wlarger-than-
Common RejectNegative Joined Warning Undocumented Alias(Wlarger-than=)
@@ -1270,6 +1274,10 @@ finline-limit=
Common RejectNegative Joined UInteger
-finline-limit=<number> Limit the size of inlined functions to <number>
+finline-atomics
+Common Report Var(flag_inline_atomics) Init(1) Optimization
+Inline __atomic operations when a lock free instruction sequence is available.
+
finstrument-functions
Common Report Var(flag_instrument_function_entry_exit)
Instrument function entry and exit with profiling calls
diff --git a/gcc/common/config/alpha/alpha-common.c b/gcc/common/config/alpha/alpha-common.c
index fcf5369034d..8a366b687c9 100644
--- a/gcc/common/config/alpha/alpha-common.c
+++ b/gcc/common/config/alpha/alpha-common.c
@@ -36,6 +36,17 @@ static const struct default_options alpha_option_optimization_table[] =
{ OPT_LEVELS_NONE, 0, NULL, 0 }
};
+/* Implement TARGET_OPTION_INIT_STRUCT. */
+
+static void
+alpha_option_init_struct (struct gcc_options *opts ATTRIBUTE_UNUSED)
+{
+#if TARGET_ABI_OPEN_VMS
+ /* Enable section anchors by default. */
+ opts->x_flag_section_anchors = 1;
+#endif
+}
+
/* Implement TARGET_HANDLE_OPTION. */
static bool
@@ -75,6 +86,9 @@ alpha_handle_option (struct gcc_options *opts,
#undef TARGET_HANDLE_OPTION
#define TARGET_HANDLE_OPTION alpha_handle_option
+#undef TARGET_OPTION_INIT_STRUCT
+#define TARGET_OPTION_INIT_STRUCT alpha_option_init_struct
+
#undef TARGET_OPTION_OPTIMIZATION_TABLE
#define TARGET_OPTION_OPTIMIZATION_TABLE alpha_option_optimization_table
diff --git a/gcc/common/config/epiphany/epiphany-common.c b/gcc/common/config/epiphany/epiphany-common.c
new file mode 100644
index 00000000000..0382cb61839
--- /dev/null
+++ b/gcc/common/config/epiphany/epiphany-common.c
@@ -0,0 +1,46 @@
+/* Common hooks for Adapteva Epiphany
+ Copyright (C) 1994, 1995, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
+ 2004, 2005, 2006, 2007, 2009, 2011 Free Software Foundation, Inc.
+ Contributed by Embecosm on behalf of Adapteva, 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/>. */
+
+#include "config.h"
+#include "system.h"
+#include "coretypes.h"
+#include "common/common-target.h"
+#include "opts.h"
+#include "flags.h"
+
+#define TARGET_OPTION_OPTIMIZATION_TABLE epiphany_option_optimization_table
+
+#define TARGET_DEFAULT_TARGET_FLAGS \
+ (MASK_CMOVE | MASK_SOFT_CMPSF | MASK_SPLIT_LOHI | MASK_ROUND_NEAREST \
+ | MASK_VECT_DOUBLE | MASK_POST_INC | MASK_POST_MODIFY)
+
+#define TARGET_HAVE_NAMED_SECTIONS true
+
+#include "common/common-target-def.h"
+
+/* Implement TARGET_OPTION_OPTIMIZATION_TABLE. */
+static const struct default_options epiphany_option_optimization_table[] =
+ {
+ { OPT_LEVELS_1_PLUS, OPT_fomit_frame_pointer, NULL, 1 },
+ { OPT_LEVELS_NONE, 0, NULL, 0 }
+ };
+
+struct gcc_targetm_common targetm_common = TARGETM_COMMON_INITIALIZER;
diff --git a/gcc/config.gcc b/gcc/config.gcc
index 2cb8b365891..45ba919dadf 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -84,12 +84,6 @@
# build-directory files by prefixing them with "./".
# All other files should relative to $srcdir/config.
#
-# libgcc_tm_file A list of target macro files used only for code
-# built for the target, not the host. These files
-# are relative to $srcdir/../libgcc/config and
-# must not have the same names as files in
-# $srcdir/config.
-#
# tm_p_file Location of file with declarations for functions
# in $out_file.
#
@@ -138,9 +132,6 @@
# extra_passes List of extra executables compiled for this target
# machine, used for compiling from source to object.
#
-# extra_parts List of extra object files that should be compiled
-# for this target machine.
-#
# extra_programs Like extra_passes, but these are used when linking.
#
# extra_options List of target-dependent .opt files.
@@ -215,7 +206,6 @@ user_headers_inc_next_post=
use_gcc_tgmath=yes
use_gcc_stdint=none
extra_passes=
-extra_parts=
extra_programs=
extra_objs=
extra_gcc_objs=
@@ -227,7 +217,6 @@ target_has_targetcm=no
target_has_targetm_common=yes
tm_defines=
xm_defines=
-libgcc_tm_file=
# Set this to force installation and use of collect2.
use_collect2=
# Set this to override the default target model.
@@ -361,7 +350,7 @@ i[34567]86-*-*)
immintrin.h x86intrin.h avxintrin.h xopintrin.h
ia32intrin.h cross-stdarg.h lwpintrin.h popcntintrin.h
lzcntintrin.h bmiintrin.h bmi2intrin.h tbmintrin.h
- avx2intrin.h fmaintrin.h"
+ avx2intrin.h fmaintrin.h f16cintrin.h"
;;
x86_64-*-*)
cpu_type=i386
@@ -374,7 +363,7 @@ x86_64-*-*)
immintrin.h x86intrin.h avxintrin.h xopintrin.h
ia32intrin.h cross-stdarg.h lwpintrin.h popcntintrin.h
lzcntintrin.h bmiintrin.h tbmintrin.h bmi2intrin.h
- avx2intrin.h fmaintrin.h"
+ avx2intrin.h fmaintrin.h f16cintrin.h"
need_64bit_hwint=yes
;;
ia64-*-*)
@@ -556,24 +545,15 @@ case ${target} in
# pleases around the provided core setting.
gas=yes
gnu_ld=yes
- extra_parts="crtbegin.o crtend.o crtbeginS.o crtendS.o"
fbsd_major=`echo ${target} | sed -e 's/.*freebsd//g' | sed -e 's/\..*//g'`
tm_defines="${tm_defines} FBSD_MAJOR=${fbsd_major}"
- tmake_file="t-slibgcc-elf-ver t-freebsd"
+ tmake_file="t-slibgcc"
case ${enable_threads} in
no)
fbsd_tm_file="${fbsd_tm_file} freebsd-nthr.h"
;;
"" | yes | posix)
thread_file='posix'
- tmake_file="${tmake_file} t-freebsd-thread"
- # Before 5.0, FreeBSD can't bind shared libraries to -lc
- # when "optionally" threaded via weak pthread_* checks.
- case ${target} in
- *-*-freebsd[34] | *-*-freebsd[34].*)
- tmake_file="${tmake_file} t-slibgcc-nolc-override"
- ;;
- esac
;;
*)
echo 'Unknown thread configuration for FreeBSD'
@@ -593,13 +573,12 @@ case ${target} in
;;
*-*-linux* | frv-*-*linux* | *-*-kfreebsd*-gnu | *-*-knetbsd*-gnu | *-*-gnu* | *-*-kopensolaris*-gnu)
extra_options="$extra_options gnu-user.opt"
- extra_parts="crtbegin.o crtbeginS.o crtbeginT.o crtend.o crtendS.o"
gas=yes
gnu_ld=yes
case ${enable_threads} in
"" | yes | posix) thread_file='posix' ;;
esac
- tmake_file="t-slibgcc-elf-ver t-linux"
+ tmake_file="t-slibgcc"
case $target in
*-*-linux* | frv-*-*linux* | *-*-kfreebsd*-gnu | *-*-knetbsd*-gnu | *-*-kopensolaris*-gnu)
:;;
@@ -647,7 +626,7 @@ case ${target} in
esac
;;
*-*-netbsd*)
- tmake_file="t-slibgcc-elf-ver t-libc-ok t-netbsd t-libgcc-pic"
+ tmake_file="t-slibgcc"
gas=yes
gnu_ld=yes
@@ -668,15 +647,6 @@ case ${target} in
;;
esac
- # NetBSD 1.7 and later are set up to use GCC's crtstuff for
- # ELF configurations. We will clear extra_parts in the
- # a.out configurations.
- case ${target} in
- *-*-netbsd*1.[7-9]* | *-*-netbsd[2-9]* | *-*-netbsdelf[2-9]*)
- extra_parts="crtbegin.o crtend.o crtbeginS.o crtendS.o crtbeginT.o"
- ;;
- esac
-
# NetBSD 2.0 and later provide __cxa_atexit(), which we use by
# default (unless overridden by --disable-__cxa_atexit).
case ${target} in
@@ -686,11 +656,10 @@ case ${target} in
esac
;;
*-*-openbsd*)
- tmake_file="t-libc-ok t-openbsd t-libgcc-pic"
+ tmake_file="t-openbsd"
case ${enable_threads} in
yes)
thread_file='posix'
- tmake_file="${tmake_file} t-openbsd-thread"
;;
esac
case ${target} in
@@ -730,7 +699,7 @@ case ${target} in
tm_file="usegas.h ${tm_file}"
fi
tm_p_file="${tm_p_file} sol2-protos.h"
- tmake_file="${tmake_file} t-sol2 t-slibgcc-dummy"
+ tmake_file="${tmake_file} t-sol2 t-slibgcc"
c_target_objs="${c_target_objs} sol2-c.o"
cxx_target_objs="${cxx_target_objs} sol2-c.o sol2-cxx.o"
extra_objs="sol2.o sol2-stubs.o"
@@ -744,10 +713,12 @@ case ${target} in
*-*-*vms*)
extra_options="${extra_options} vms/vms.opt"
xmake_file=vms/x-vms
- tmake_file="vms/t-vms"
+ tmake_file="vms/t-vms t-slibgcc"
extra_objs="vms.o"
target_gtfiles="$target_gtfiles \$(srcdir)/config/vms/vms.c"
tm_p_file="${tm_p_file} vms/vms-protos.h"
+ c_target_objs="vms-c.o"
+ cxx_target_objs="vms-c.o"
if test x$gnu_ld != xyes; then
# Build wrappers for native case.
extra_programs="ld\$(exeext) ar\$(exeext)"
@@ -777,22 +748,17 @@ alpha*-*-linux*)
tm_file="${tm_file} alpha/elf.h alpha/linux.h alpha/linux-elf.h glibc-stdint.h"
extra_options="${extra_options} alpha/elf.opt"
target_cpu_default="MASK_GAS"
- tmake_file="${tmake_file} alpha/t-alpha alpha/t-ieee alpha/t-linux"
- extra_parts="${extra_parts} crtfastmath.o"
;;
alpha*-*-freebsd*)
tm_file="${tm_file} ${fbsd_tm_file} alpha/elf.h alpha/freebsd.h"
extra_options="${extra_options} alpha/elf.opt"
target_cpu_default="MASK_GAS"
- tmake_file="${tmake_file} alpha/t-alpha alpha/t-ieee"
- extra_parts="crtbegin.o crtend.o crtbeginS.o crtendS.o crtbeginT.o crtfastmath.o"
;;
alpha*-*-netbsd*)
tm_file="${tm_file} netbsd.h alpha/elf.h netbsd-elf.h alpha/netbsd.h"
extra_options="${extra_options} netbsd.opt netbsd-elf.opt \
alpha/elf.opt"
target_cpu_default="MASK_GAS"
- tmake_file="${tmake_file} alpha/t-alpha alpha/t-ieee"
;;
alpha*-*-openbsd*)
tm_defines="${tm_defines} OBSD_HAS_DECLARE_FUNCTION_NAME OBSD_HAS_DECLARE_FUNCTION_SIZE OBSD_HAS_DECLARE_OBJECT"
@@ -800,7 +766,6 @@ alpha*-*-openbsd*)
extra_options="${extra_options} openbsd.opt alpha/elf.opt"
# default x-alpha is only appropriate for dec-osf.
target_cpu_default="MASK_GAS"
- tmake_file="${tmake_file} alpha/t-alpha alpha/t-ieee"
;;
alpha*-dec-osf5.1*)
if test x$stabs = xyes
@@ -814,7 +779,7 @@ alpha*-dec-osf5.1*)
extra_passes="mips-tfile mips-tdump"
fi
use_collect2=yes
- tmake_file="t-slibgcc-dummy"
+ tmake_file="t-slibgcc"
tm_file="${tm_file} alpha/osf5.h"
tm_defines="${tm_defines} TARGET_SUPPORT_ARCH=1"
extra_options="${extra_options} rpath.opt alpha/osf5.opt"
@@ -827,14 +792,14 @@ alpha*-dec-osf5.1*)
esac
;;
alpha64-dec-*vms*)
- tm_file="${tm_file} alpha/vms.h alpha/vms64.h"
+ tm_file="${tm_file} vms/vms.h vms/vms64.h alpha/vms.h"
xm_file="alpha/xm-vms.h vms/xm-vms64.h"
- tmake_file="${tmake_file} alpha/t-alpha vms/t-vms64 alpha/t-vms alpha/t-ieee"
+ tmake_file="${tmake_file} vms/t-vms64 alpha/t-vms"
;;
alpha*-dec-*vms*)
- tm_file="${tm_file} alpha/vms.h"
+ tm_file="${tm_file} vms/vms.h alpha/vms.h"
xm_file="alpha/xm-vms.h"
- tmake_file="${tmake_file} alpha/t-alpha alpha/t-vms alpha/t-ieee"
+ tmake_file="${tmake_file} alpha/t-vms"
;;
arm-wrs-vxworks)
tm_file="elfos.h arm/elf.h arm/aout.h ${tm_file} vx-common.h vxworks.h arm/vxworks.h"
@@ -848,7 +813,7 @@ arm*-*-freebsd*)
arm*-*-netbsdelf*)
tm_file="dbxelf.h elfos.h netbsd.h netbsd-elf.h arm/elf.h arm/aout.h arm/arm.h arm/netbsd-elf.h"
extra_options="${extra_options} netbsd.opt netbsd-elf.opt"
- tmake_file="${tmake_file} arm/t-arm arm/t-netbsd"
+ tmake_file="${tmake_file} arm/t-arm"
;;
arm*-*-linux*) # ARM GNU/Linux with ELF
tm_file="dbxelf.h elfos.h gnu-user.h linux.h linux-android.h glibc-stdint.h arm/elf.h arm/linux-gas.h arm/linux-elf.h"
@@ -857,12 +822,11 @@ arm*-*-linux*) # ARM GNU/Linux with ELF
tm_defines="${tm_defines} TARGET_BIG_ENDIAN_DEFAULT=1"
;;
esac
- tmake_file="${tmake_file} t-linux arm/t-arm"
+ tmake_file="${tmake_file} arm/t-arm"
case ${target} in
arm*-*-linux-*eabi)
tm_file="$tm_file arm/bpabi.h arm/linux-eabi.h"
- libgcc_tm_file="$libgcc_tm_file arm/bpabi-lib.h"
- tmake_file="$tmake_file arm/t-arm-elf arm/t-bpabi arm/t-linux-eabi t-slibgcc-libgcc"
+ tmake_file="$tmake_file arm/t-arm-elf arm/t-bpabi arm/t-linux-eabi"
# Define multilib configuration for arm-linux-androideabi.
case ${target} in
*-androideabi)
@@ -889,7 +853,6 @@ arm*-*-uclinux*) # ARM ucLinux
case ${target} in
arm*-*-uclinux*eabi)
tm_file="$tm_file arm/bpabi.h arm/uclinux-eabi.h"
- libgcc_tm_file="$libgcc_tm_file arm/bpabi-lib.h"
tmake_file="$tmake_file arm/t-bpabi"
# The BPABI long long divmod functions return a 128-bit value in
# registers r0-r3. Correctly modeling that requires the use of
@@ -904,14 +867,13 @@ arm*-*-ecos-elf)
tm_file="dbxelf.h elfos.h newlib-stdint.h arm/unknown-elf.h arm/elf.h arm/aout.h arm/arm.h arm/ecos-elf.h"
tmake_file="arm/t-arm arm/t-arm-elf"
;;
-arm*-*-eabi* | arm*-*-symbianelf* )
+arm*-*-eabi* | arm*-*-symbianelf* | arm*-*-rtemseabi*)
# The BPABI long long divmod functions return a 128-bit value in
# registers r0-r3. Correctly modeling that requires the use of
# TImode.
need_64bit_hwint=yes
default_use_cxa_atexit=yes
tm_file="dbxelf.h elfos.h arm/unknown-elf.h arm/elf.h arm/bpabi.h"
- libgcc_tm_file="$libgcc_tm_file arm/bpabi-lib.h"
tmake_file="arm/t-arm arm/t-arm-elf"
case ${target} in
arm*-*-eabi*)
@@ -919,9 +881,12 @@ arm*-*-eabi* | arm*-*-symbianelf* )
tmake_file="${tmake_file} arm/t-bpabi"
use_gcc_stdint=wrap
;;
+ arm*-*-rtemseabi*)
+ tm_file="${tm_file} rtems.h arm/rtems-eabi.h newlib-stdint.h"
+ tmake_file="${tmake_file} arm/t-bpabi t-rtems arm/t-rtems-eabi"
+ ;;
arm*-*-symbianelf*)
tm_file="${tm_file} arm/symbian.h"
- libgcc_tm_file="$libgcc_tm_file arm/symbian-lib.h"
# We do not include t-bpabi for Symbian OS because the system
# provides its own implementation of the BPABI functions.
tmake_file="${tmake_file} arm/t-symbian"
@@ -945,14 +910,12 @@ arm*-wince-pe*)
;;
avr-*-rtems*)
tm_file="elfos.h avr/elf.h avr/avr.h dbxelf.h avr/rtems.h rtems.h newlib-stdint.h"
- libgcc_tm_file="$libgcc_tm_file avr/avr-lib.h"
tmake_file="avr/t-avr t-rtems avr/t-rtems"
extra_gcc_objs="driver-avr.o avr-devices.o"
extra_objs="avr-devices.o avr-log.o"
;;
avr-*-*)
tm_file="elfos.h avr/elf.h avr/avr.h dbxelf.h newlib-stdint.h"
- libgcc_tm_file="$libgcc_tm_file avr/avr-lib.h"
use_gcc_stdint=wrap
extra_gcc_objs="driver-avr.o avr-devices.o"
extra_objs="avr-devices.o avr-log.o"
@@ -969,17 +932,15 @@ bfin*-uclinux*)
;;
bfin*-linux-uclibc*)
tm_file="${tm_file} dbxelf.h elfos.h bfin/elf.h gnu-user.h linux.h glibc-stdint.h bfin/linux.h ./linux-sysroot-suffix.h"
- tmake_file="t-slibgcc-elf-ver bfin/t-bfin-linux"
- extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o"
+ tmake_file="bfin/t-bfin-linux t-slibgcc"
use_collect2=no
;;
bfin*-rtems*)
tm_file="${tm_file} dbxelf.h elfos.h bfin/elf.h bfin/rtems.h rtems.h newlib-stdint.h"
- tmake_file="bfin/t-bfin t-rtems bfin/t-rtems"
+ tmake_file="t-rtems bfin/t-rtems"
;;
bfin*-*)
tm_file="${tm_file} dbxelf.h elfos.h newlib-stdint.h bfin/elf.h"
- tmake_file=bfin/t-bfin
use_collect2=no
use_gcc_stdint=wrap
;;
@@ -1001,7 +962,7 @@ cris-*-elf | cris-*-none)
crisv32-*-linux* | cris-*-linux*)
tm_file="dbxelf.h elfos.h ${tm_file} gnu-user.h linux.h glibc-stdint.h cris/linux.h"
# We need to avoid using t-linux, so override default tmake_file
- tmake_file="cris/t-cris t-slibgcc-elf-ver cris/t-linux"
+ tmake_file="cris/t-cris cris/t-linux t-slibgcc"
extra_options="${extra_options} cris/linux.opt"
case $target in
cris-*-*)
@@ -1012,34 +973,36 @@ crisv32-*-linux* | cris-*-linux*)
;;
esac
;;
+epiphany-*-elf )
+ tm_file="dbxelf.h elfos.h newlib-stdint.h ${tm_file}"
+ tmake_file="epiphany/t-epiphany"
+ extra_options="${extra_options} fused-madd.opt"
+ extra_objs="$extra_objs mode-switch-use.o resolve-sw-modes.o"
+ tm_defines="${tm_defines} EPIPHANY_STACK_OFFSET=${with_stack_offset:-8}"
+ extra_headers="epiphany_intrinsics.h"
+ ;;
fr30-*-elf)
tm_file="dbxelf.h elfos.h newlib-stdint.h ${tm_file}"
- tmake_file=fr30/t-fr30
- extra_parts="crti.o crtn.o crtbegin.o crtend.o"
;;
frv-*-elf)
tm_file="dbxelf.h elfos.h newlib-stdint.h ${tm_file}"
- libgcc_tm_file="${libgcc_tm_file} frv/frv-abi.h"
tmake_file=frv/t-frv
;;
frv-*-*linux*)
tm_file="dbxelf.h elfos.h ${tm_file} \
gnu-user.h linux.h glibc-stdint.h frv/linux.h"
- libgcc_tm_file="${libgcc_tm_file} frv/frv-abi.h"
tmake_file="${tmake_file} frv/t-frv frv/t-linux"
;;
moxie-*-elf)
gas=yes
gnu_ld=yes
tm_file="dbxelf.h elfos.h newlib-stdint.h ${tm_file}"
- extra_parts="crti.o crtn.o crtbegin.o crtend.o"
tmake_file="${tmake_file} moxie/t-moxie"
;;
moxie-*-uclinux*)
gas=yes
gnu_ld=yes
tm_file="dbxelf.h elfos.h ${tm_file} gnu-user.h linux.h glibc-stdint.h moxie/uclinux.h"
- extra_parts="crti.o crtn.o crtbegin.o crtend.o"
tmake_file="${tmake_file} moxie/t-moxie"
;;
moxie-*-rtems*)
@@ -1047,21 +1010,18 @@ moxie-*-rtems*)
tm_file="moxie/moxie.h dbxelf.h elfos.h moxie/rtems.h rtems.h newlib-stdint.h"
;;
h8300-*-rtems*)
- tmake_file="h8300/t-h8300 h8300/t-elf t-rtems h8300/t-rtems"
+ tmake_file="h8300/t-h8300 t-rtems h8300/t-rtems"
tm_file="h8300/h8300.h dbxelf.h elfos.h h8300/elf.h h8300/rtems.h rtems.h newlib-stdint.h"
- libgcc_tm_file="$libgcc_tm_file h8300/h8300-lib.h"
;;
h8300-*-elf*)
- tmake_file="h8300/t-h8300 h8300/t-elf"
+ tmake_file="h8300/t-h8300"
tm_file="h8300/h8300.h dbxelf.h elfos.h newlib-stdint.h h8300/elf.h"
- libgcc_tm_file="$libgcc_tm_file h8300/h8300-lib.h"
;;
hppa*64*-*-linux*)
target_cpu_default="MASK_PA_11|MASK_PA_20"
tm_file="pa/pa64-start.h ${tm_file} dbxelf.h elfos.h gnu-user.h linux.h \
glibc-stdint.h pa/pa-linux.h pa/pa64-regs.h pa/pa-64.h \
pa/pa64-linux.h"
- tmake_file="${tmake_file} pa/t-linux64"
gas=yes gnu_ld=yes
need_64bit_hwint=yes
;;
@@ -1069,13 +1029,6 @@ hppa*-*-linux*)
target_cpu_default="MASK_PA_11|MASK_NO_SPACE_REGS"
tm_file="${tm_file} dbxelf.h elfos.h gnu-user.h linux.h glibc-stdint.h pa/pa-linux.h \
pa/pa32-regs.h pa/pa32-linux.h"
- tmake_file="${tmake_file} pa/t-linux t-slibgcc-libgcc"
- # Set the libgcc version number
- if test x$sjlj = x1; then
- tmake_file="$tmake_file pa/t-slibgcc-sjlj-ver"
- else
- tmake_file="$tmake_file pa/t-slibgcc-dwarf-ver"
- fi
;;
# port not yet contributed.
#hppa*-*-openbsd*)
@@ -1098,7 +1051,7 @@ hppa[12]*-*-hpux10*)
esac
use_gcc_stdint=provide
tm_file="${tm_file} hpux-stdint.h"
- tmake_file="pa/t-pa-hpux10 pa/t-pa-hpux pa/t-hpux-shlib"
+ tmake_file="t-slibgcc"
case ${enable_threads} in
"")
if test x$have_pthread_h = xyes ; then
@@ -1109,12 +1062,6 @@ hppa[12]*-*-hpux10*)
tmake_file="${tmake_file} pa/t-dce-thr"
;;
esac
- # Set the libgcc version number
- if test x$sjlj = x1; then
- tmake_file="$tmake_file pa/t-slibgcc-sjlj-ver"
- else
- tmake_file="$tmake_file pa/t-slibgcc-dwarf-ver"
- fi
use_collect2=yes
gas=yes
if test "x$with_dwarf2" != x; then
@@ -1147,15 +1094,7 @@ hppa*64*-*-hpux11*)
extra_options="${extra_options} pa/pa-hpux.opt \
pa/pa-hpux1010.opt pa/pa64-hpux.opt hpux11.opt"
need_64bit_hwint=yes
- tmake_file="pa/t-pa64 pa/t-pa-hpux pa/t-hpux-shlib"
- # Set the libgcc version number
- if test x$sjlj = x1; then
- tmake_file="$tmake_file pa/t-slibgcc-sjlj-ver"
- else
- tmake_file="$tmake_file pa/t-slibgcc-dwarf-ver"
- fi
- extra_parts="crtbegin.o crtend.o crtbeginS.o crtendS.o crtbeginT.o \
- libgcc_stub.a"
+ tmake_file="t-slibgcc"
case x${enable_threads} in
x | xyes | xposix )
thread_file=posix
@@ -1193,14 +1132,7 @@ hppa[12]*-*-hpux11*)
extra_options="${extra_options} pa/pa-hpux1131.opt"
;;
esac
- tmake_file="pa/t-pa-hpux11 pa/t-pa-hpux pa/t-hpux-shlib"
- # Set the libgcc version number
- if test x$sjlj = x1; then
- tmake_file="$tmake_file pa/t-slibgcc-sjlj-ver"
- else
- tmake_file="$tmake_file pa/t-slibgcc-dwarf-ver"
- fi
- extra_parts="libgcc_stub.a"
+ tmake_file="t-slibgcc"
case x${enable_threads} in
x | xyes | xposix )
thread_file=posix
@@ -1227,30 +1159,24 @@ i[34567]86-*-darwin*)
need_64bit_isa=yes
# Baseline choice for a machine that allows m64 support.
with_cpu=${with_cpu:-core2}
- tmake_file="${tmake_file} t-slibgcc-dummy"
- libgcc_tm_file="$libgcc_tm_file i386/darwin-lib.h"
+ tmake_file="${tmake_file} t-slibgcc"
;;
x86_64-*-darwin*)
with_cpu=${with_cpu:-core2}
- tmake_file="${tmake_file} ${cpu_type}/t-darwin64 t-slibgcc-dummy"
+ tmake_file="${tmake_file} ${cpu_type}/t-darwin64 t-slibgcc"
tm_file="${tm_file} ${cpu_type}/darwin64.h"
- libgcc_tm_file="$libgcc_tm_file i386/darwin-lib.h"
;;
i[34567]86-*-elf*)
tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h newlib-stdint.h i386/i386elf.h"
- tmake_file="${tmake_file} i386/t-i386elf i386/t-crtstuff t-svr4"
;;
x86_64-*-elf*)
tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h newlib-stdint.h i386/i386elf.h i386/x86-64.h"
- tmake_file="${tmake_file} i386/t-i386elf i386/t-crtstuff t-svr4"
;;
i[34567]86-*-freebsd*)
tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h ${fbsd_tm_file} i386/freebsd.h"
- tmake_file="${tmake_file} i386/t-crtstuff"
;;
x86_64-*-freebsd*)
tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h ${fbsd_tm_file} i386/x86-64.h i386/freebsd.h i386/freebsd64.h"
- tmake_file="${tmake_file} i386/t-crtstuff"
;;
i[34567]86-*-netbsdelf*)
tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h netbsd.h netbsd-elf.h i386/netbsd-elf.h"
@@ -1259,13 +1185,12 @@ i[34567]86-*-netbsdelf*)
x86_64-*-netbsd*)
tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h netbsd.h netbsd-elf.h i386/x86-64.h i386/netbsd64.h"
extra_options="${extra_options} netbsd.opt netbsd-elf.opt"
- tmake_file="${tmake_file} i386/t-crtstuff"
;;
i[34567]86-*-openbsd2.*|i[34567]86-*openbsd3.[0123])
tm_file="i386/i386.h i386/unix.h i386/bsd.h i386/gas.h i386/gstabs.h openbsd-oldgas.h openbsd.h i386/openbsd.h"
extra_options="${extra_options} openbsd.opt"
# needed to unconfuse gdb
- tmake_file="${tmake_file} t-libc-ok t-openbsd i386/t-openbsd"
+ tmake_file="${tmake_file} t-openbsd i386/t-openbsd"
# we need collect2 until our bug is fixed...
use_collect2=yes
;;
@@ -1337,10 +1262,6 @@ i[34567]86-*-linux* | i[34567]86-*-kfreebsd*-gnu | i[34567]86-*-knetbsd*-gnu | i
tm_file="$tm_file i386/gnu-user.h gnu.h i386/gnu.h"
;;
esac
- tmake_file="${tmake_file} i386/t-crtstuff"
- # This is a hack to avoid a configuration mismatch
- # until the toplevel libgcc move is complete.
- extra_parts="${extra_parts} crtprec32.o crtprec64.o crtprec80.o crtfastmath.o"
;;
x86_64-*-linux* | x86_64-*-kfreebsd*-gnu | x86_64-*-knetbsd*-gnu)
tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h gnu-user.h glibc-stdint.h \
@@ -1358,7 +1279,7 @@ x86_64-*-linux* | x86_64-*-kfreebsd*-gnu | x86_64-*-knetbsd*-gnu)
tm_file="${tm_file} knetbsd-gnu.h"
;;
esac
- tmake_file="${tmake_file} i386/t-linux64 i386/t-crtstuff"
+ tmake_file="${tmake_file} i386/t-linux64"
x86_multilibs="${with_multilib_list}"
if test "$x86_multilibs" = "default"; then
x86_multilibs="m64,m32"
@@ -1388,8 +1309,7 @@ i[34567]86-pc-msdosdjgpp*)
i[34567]86-*-lynxos*)
xm_defines=POSIX
tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h i386/lynx.h lynx.h"
- tmake_file="${tmake_file} i386/t-crtstuff t-lynx"
- extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o"
+ tmake_file="${tmake_file} t-lynx"
extra_options="${extra_options} lynx.opt"
thread_file=lynx
gnu_ld=yes
@@ -1398,7 +1318,6 @@ i[34567]86-*-lynxos*)
i[34567]86-*-nto-qnx*)
tm_file="${tm_file} i386/att.h dbxelf.h tm-dwarf2.h elfos.h i386/unix.h i386/nto.h"
extra_options="${extra_options} i386/nto.opt"
- tmake_file="${tmake_file} i386/t-nto"
gnu_ld=yes
gas=yes
;;
@@ -1460,19 +1379,7 @@ i[4567]86-wrs-vxworks|i[4567]86-wrs-vxworksae)
i[34567]86-*-cygwin*)
tm_file="${tm_file} i386/unix.h i386/bsd.h i386/gas.h dbxcoff.h i386/cygming.h i386/cygwin.h i386/cygwin-stdint.h"
xm_file=i386/xm-cygwin.h
- # This has to match the logic for DWARF2_UNWIND_INFO in gcc/config/i386/cygming.h
- if test x$sjlj = x0; then
- tmake_eh_file="i386/t-dw2-eh"
- else
- tmake_eh_file="i386/t-sjlj-eh"
- fi
- # Shared libgcc DLL install dir depends on cross/native build.
- if test x${host} = x${target} ; then
- tmake_dlldir_file="i386/t-dlldir"
- else
- tmake_dlldir_file="i386/t-dlldir-x"
- fi
- tmake_file="${tmake_file} ${tmake_eh_file} ${tmake_dlldir_file} i386/t-cygming i386/t-cygwin"
+ tmake_file="${tmake_file} i386/t-cygming t-slibgcc"
target_gtfiles="\$(srcdir)/config/i386/winnt.c"
extra_options="${extra_options} i386/cygming.opt"
extra_objs="winnt.o winnt-stubs.o"
@@ -1525,19 +1432,7 @@ i[34567]86-*-mingw* | x86_64-*-mingw*)
;;
esac
tm_file="${tm_file} i386/mingw-stdint.h"
- # This has to match the logic for DWARF2_UNWIND_INFO in gcc/config/i386/cygming.h
- if test x$sjlj = x0; then
- tmake_eh_file="i386/t-dw2-eh"
- else
- tmake_eh_file="i386/t-sjlj-eh"
- fi
- # Shared libgcc DLL install dir depends on cross/native build.
- if test x${host} = x${target} ; then
- tmake_dlldir_file="i386/t-dlldir"
- else
- tmake_dlldir_file="i386/t-dlldir-x"
- fi
- tmake_file="${tmake_file} ${tmake_eh_file} ${tmake_dlldir_file} i386/t-cygming"
+ tmake_file="${tmake_file} i386/t-cygming t-slibgcc"
case ${target} in
x86_64-w64-*)
tmake_file="${tmake_file} i386/t-mingw-w64"
@@ -1545,9 +1440,6 @@ i[34567]86-*-mingw* | x86_64-*-mingw*)
i[34567]86-w64-*)
tmake_file="${tmake_file} i386/t-mingw-w32"
;;
- *)
- tmake_file="${tmake_file} i386/t-mingw32"
- ;;
esac
native_system_header_dir=/mingw/include
target_gtfiles="\$(srcdir)/config/i386/winnt.c"
@@ -1565,12 +1457,11 @@ i[34567]86-*-mingw* | x86_64-*-mingw*)
default_use_cxa_atexit=yes
use_gcc_stdint=wrap
case ${enable_threads} in
- "" | yes | win32) thread_file='win32'
- tmake_file="${tmake_file} i386/t-gthr-win32"
+ "" | yes | win32)
+ thread_file='win32'
;;
posix)
thread_file='posix'
- tmake_file="i386/t-mingw-pthread ${tmake_file}"
;;
esac
case ${target} in
@@ -1606,23 +1497,20 @@ ia64*-*-elf*)
then
target_cpu_default="${target_cpu_default}|MASK_GNU_LD"
fi
- extra_parts="crtbegin.o crtend.o crtbeginS.o crtendS.o crtfastmath.o"
;;
ia64*-*-freebsd*)
tm_file="${tm_file} dbxelf.h elfos.h ${fbsd_tm_file} ia64/sysv4.h ia64/freebsd.h"
target_cpu_default="MASK_GNU_AS|MASK_GNU_LD"
tmake_file="${tmake_file} ia64/t-ia64"
- extra_parts="crtbegin.o crtend.o crtbeginS.o crtendS.o crtfastmath.o"
;;
ia64*-*-linux*)
tm_file="${tm_file} dbxelf.h elfos.h gnu-user.h linux.h glibc-stdint.h ia64/sysv4.h ia64/linux.h"
- tmake_file="${tmake_file} ia64/t-ia64 t-libunwind ia64/t-glibc"
+ tmake_file="${tmake_file} ia64/t-ia64 t-libunwind"
target_cpu_default="MASK_GNU_AS|MASK_GNU_LD"
- extra_parts="crtbegin.o crtend.o crtbeginS.o crtendS.o crtfastmath.o"
;;
ia64*-*-hpux*)
tm_file="${tm_file} dbxelf.h elfos.h ia64/sysv4.h ia64/hpux.h"
- tmake_file="ia64/t-ia64 ia64/t-hpux"
+ tmake_file="ia64/t-ia64 ia64/t-hpux t-slibgcc"
target_cpu_default="MASK_GNU_AS"
case x$enable_threads in
x | xyes | xposix )
@@ -1642,9 +1530,9 @@ ia64*-*-hpux*)
esac
;;
ia64-hp-*vms*)
- tm_file="${tm_file} elfos.h ia64/sysv4.h ia64/elf.h ia64/vms.h ia64/vms64.h"
+ tm_file="${tm_file} elfos.h ia64/sysv4.h ia64/elf.h vms/vms.h vms/vms64.h ia64/vms.h"
xm_file="vms/xm-vms.h vms/xm-vms64.h"
- tmake_file="${tmake_file} vms/t-vms64 ia64/t-ia64 ia64/t-vms"
+ tmake_file="${tmake_file} vms/t-vms64 ia64/t-ia64"
target_cpu_default="0"
if test x$gas = xyes
then
@@ -1654,7 +1542,6 @@ ia64-hp-*vms*)
;;
iq2000*-*-elf*)
tm_file="elfos.h newlib-stdint.h iq2000/iq2000.h"
- tmake_file=iq2000/t-iq2000
out_file=iq2000/iq2000.c
md_file=iq2000/iq2000.md
;;
@@ -1666,6 +1553,7 @@ lm32-*-rtems*)
tm_file="dbxelf.h elfos.h ${tm_file} lm32/rtems.h rtems.h newlib-stdint.h"
tmake_file="${tmake_file} lm32/t-lm32"
tmake_file="${tmake_file} t-rtems"
+ tmake_file="${tmake_file} lm32/t-rtems"
;;
lm32-*-uclinux*)
tm_file="dbxelf.h elfos.h ${tm_file} gnu-user.h linux.h lm32/uclinux-elf.h"
@@ -1673,21 +1561,18 @@ lm32-*-uclinux*)
;;
m32r-*-elf*)
tm_file="dbxelf.h elfos.h newlib-stdint.h ${tm_file}"
- extra_parts="crtinit.o crtfini.o"
;;
m32rle-*-elf*)
tm_file="dbxelf.h elfos.h newlib-stdint.h m32r/little.h ${tm_file}"
- extra_parts="crtinit.o crtfini.o m32rx/crtinit.o m32rx/crtfini.o"
;;
m32r-*-rtems*)
tm_file="dbxelf.h elfos.h ${tm_file} m32r/rtems.h rtems.h newlib-stdint.h"
tmake_file="m32r/t-m32r t-rtems"
- extra_parts="crtinit.o crtfini.o"
;;
m32r-*-linux*)
tm_file="dbxelf.h elfos.h gnu-user.h linux.h glibc-stdint.h ${tm_file} m32r/linux.h"
# We override the tmake_file for linux -- why?
- tmake_file="t-slibgcc-elf-ver m32r/t-linux"
+ tmake_file="m32r/t-linux t-slibgcc"
gnu_ld=yes
if test x$enable_threads = xyes; then
thread_file='posix'
@@ -1696,7 +1581,7 @@ m32r-*-linux*)
m32rle-*-linux*)
tm_file="dbxelf.h elfos.h gnu-user.h linux.h glibc-stdint.h m32r/little.h ${tm_file} m32r/linux.h"
# We override the tmake_file for linux -- why?
- tmake_file="t-slibgcc-elf-ver m32r/t-linux"
+ tmake_file="m32r/t-linux t-slibgcc"
gnu_ld=yes
if test x$enable_threads = xyes; then
thread_file='posix'
@@ -1732,7 +1617,6 @@ m68k-*-elf* | fido-*-elf*)
tmake_file="$tmake_file m68k/t-mlibs"
;;
esac
- extra_parts="crtbegin.o crtend.o"
;;
m68k*-*-netbsdelf*)
default_m68k_cpu=68020
@@ -1748,7 +1632,7 @@ m68k*-*-openbsd*)
tm_defines="${tm_defines} OBSD_OLD_GAS"
tm_file="${tm_file} openbsd.h openbsd-stdint.h openbsd-libpthread.h m68k/openbsd.h"
extra_options="${extra_options} openbsd.opt"
- tmake_file="t-libc-ok t-openbsd m68k/t-openbsd"
+ tmake_file="t-openbsd m68k/t-openbsd"
# we need collect2 until our bug is fixed...
use_collect2=yes
;;
@@ -1762,7 +1646,7 @@ m68k-*-uclinux*) # Motorola m68k/ColdFire running uClinux
tm_defines="${tm_defines} MOTOROLA=1"
tmake_file="m68k/t-floatlib m68k/t-uclinux m68k/t-mlibs"
;;
-m68k-*-linux*) # Motorola m68k's running GNU/Linux
+m68k-*-linux*) # Motorola m68k's running GNU/Linux
# with ELF format using glibc 2
# aka the GNU/Linux C library 6.
default_m68k_cpu=68020
@@ -1772,11 +1656,6 @@ m68k-*-linux*) # Motorola m68k's running GNU/Linux
extra_options="${extra_options} m68k/ieee.opt"
tm_defines="${tm_defines} MOTOROLA=1"
tmake_file="${tmake_file} m68k/t-floatlib m68k/t-linux m68k/t-mlibs"
- # if not configured with --enable-sjlj-exceptions, bump the
- # libgcc version number
- if test x$sjlj != x1; then
- tmake_file="$tmake_file m68k/t-slibgcc-elf-ver"
- fi
;;
m68k-*-rtems*)
default_m68k_cpu=68020
@@ -1784,7 +1663,6 @@ m68k-*-rtems*)
tmake_file="m68k/t-floatlib m68k/t-m68kbare m68k/t-crtstuff t-rtems m68k/t-rtems m68k/t-mlibs"
tm_file="${tm_file} m68k/m68k-none.h m68k/m68kelf.h dbxelf.h elfos.h m68k/m68kemb.h m68k/m68020-elf.h m68k/rtemself.h rtems.h newlib-stdint.h"
tm_defines="${tm_defines} MOTOROLA=1"
- extra_parts="crtbegin.o crtend.o"
;;
mcore-*-elf)
tm_file="dbxelf.h elfos.h newlib-stdint.h ${tm_file} mcore/mcore-elf.h"
@@ -1794,7 +1672,6 @@ mcore-*-elf)
mep-*-*)
tm_file="dbxelf.h elfos.h ${tm_file}"
tmake_file=mep/t-mep
- extra_parts="crtbegin.o crtend.o"
c_target_objs="mep-pragma.o"
cxx_target_objs="mep-pragma.o"
if test -d "${srcdir}/../newlib/libc/include" &&
@@ -1807,8 +1684,6 @@ microblaze*-linux*)
tm_file="${tm_file} dbxelf.h gnu-user.h linux.h microblaze/linux.h"
c_target_objs="${c_target_objs} microblaze-c.o"
cxx_target_objs="${cxx_target_objs} microblaze-c.o"
- tmake_file="${tmake_file} t-slibgcc-elf-ver t-slibgcc-nolc-override t-linux microblaze/t-microblaze"
- extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o crtbeginT.o"
;;
microblaze*-*-*)
tm_file="${tm_file} dbxelf.h"
@@ -1818,7 +1693,7 @@ microblaze*-*-*)
;;
mips-sgi-irix6.5*)
tm_file="elfos.h ${tm_file} mips/iris6.h"
- tmake_file="mips/t-irix6 t-slibgcc-dummy"
+ tmake_file="mips/t-irix6 t-slibgcc"
extra_options="${extra_options} rpath.opt mips/iris6.opt"
target_cpu_default="MASK_ABICALLS"
tm_defines="${tm_defines} MIPS_ISA_DEFAULT=3 MIPS_ABI_DEFAULT=ABI_N32"
@@ -1843,7 +1718,7 @@ mips*-*-netbsd*) # NetBSD/mips, either endian.
;;
mips64*-*-linux* | mipsisa64*-*-linux*)
tm_file="dbxelf.h elfos.h gnu-user.h linux.h glibc-stdint.h ${tm_file} mips/gnu-user.h mips/gnu-user64.h mips/linux64.h"
- tmake_file="${tmake_file} mips/t-linux64 mips/t-libgcc-mips16"
+ tmake_file="${tmake_file} mips/t-linux64"
tm_defines="${tm_defines} MIPS_ABI_DEFAULT=ABI_N32"
case ${target} in
mips64el-st-linux-gnu)
@@ -1858,14 +1733,12 @@ mips64*-*-linux* | mipsisa64*-*-linux*)
tm_defines="${tm_defines} MIPS_ISA_DEFAULT=65"
;;
esac
- extra_parts="$extra_parts crtfastmath.o"
gnu_ld=yes
gas=yes
test x$with_llsc != x || with_llsc=yes
;;
mips*-*-linux*) # Linux MIPS, either endian.
tm_file="dbxelf.h elfos.h gnu-user.h linux.h glibc-stdint.h ${tm_file} mips/gnu-user.h mips/linux.h"
- tmake_file="${tmake_file} mips/t-libgcc-mips16"
if test x$enable_targets = xall; then
tm_file="${tm_file} mips/gnu-user64.h mips/linux64.h"
tmake_file="${tmake_file} mips/t-linux64"
@@ -1877,7 +1750,6 @@ mips*-*-linux*) # Linux MIPS, either endian.
mipsisa32*)
tm_defines="${tm_defines} MIPS_ISA_DEFAULT=32"
esac
- extra_parts="$extra_parts crtfastmath.o"
test x$with_llsc != x || with_llsc=yes
;;
mips*-*-openbsd*)
@@ -1893,7 +1765,7 @@ mips*-*-openbsd*)
;;
mips*-sde-elf*)
tm_file="elfos.h newlib-stdint.h ${tm_file} mips/elf.h mips/sde.h"
- tmake_file="mips/t-sde mips/t-libgcc-mips16"
+ tmake_file="mips/t-sde"
extra_options="${extra_options} mips/sde.opt"
case "${with_newlib}" in
yes)
@@ -1930,7 +1802,7 @@ mipsisa32r2-*-elf* | mipsisa32r2el-*-elf* | \
mipsisa64-*-elf* | mipsisa64el-*-elf* | \
mipsisa64r2-*-elf* | mipsisa64r2el-*-elf*)
tm_file="elfos.h newlib-stdint.h ${tm_file} mips/elf.h"
- tmake_file="mips/t-isa3264 mips/t-libgcc-mips16"
+ tmake_file="mips/t-isa3264"
case ${target} in
mipsisa32r2*)
tm_defines="${tm_defines} MIPS_ISA_DEFAULT=33"
@@ -1967,17 +1839,17 @@ mipsisa64sr71k-*-elf*)
;;
mipsisa64sb1-*-elf* | mipsisa64sb1el-*-elf*)
tm_file="elfos.h newlib-stdint.h ${tm_file} mips/elf.h"
- tmake_file="mips/t-elf mips/t-libgcc-mips16 mips/t-sb1"
+ tmake_file="mips/t-elf mips/t-sb1"
target_cpu_default="MASK_64BIT|MASK_FLOAT64"
tm_defines="${tm_defines} MIPS_ISA_DEFAULT=64 MIPS_CPU_STRING_DEFAULT=\\\"sb1\\\" MIPS_ABI_DEFAULT=ABI_O64"
;;
mips-*-elf* | mipsel-*-elf*)
tm_file="elfos.h newlib-stdint.h ${tm_file} mips/elf.h"
- tmake_file="mips/t-elf mips/t-libgcc-mips16"
+ tmake_file="mips/t-elf"
;;
mips64-*-elf* | mips64el-*-elf*)
tm_file="elfos.h newlib-stdint.h ${tm_file} mips/elf.h"
- tmake_file="mips/t-elf mips/t-libgcc-mips16"
+ tmake_file="mips/t-elf"
target_cpu_default="MASK_64BIT|MASK_FLOAT64"
tm_defines="${tm_defines} MIPS_ISA_DEFAULT=3 MIPS_ABI_DEFAULT=ABI_O64"
;;
@@ -1988,13 +1860,13 @@ mips64vr-*-elf* | mips64vrel-*-elf*)
;;
mips64orion-*-elf* | mips64orionel-*-elf*)
tm_file="elfos.h newlib-stdint.h ${tm_file} mips/elforion.h mips/elf.h"
- tmake_file="mips/t-elf mips/t-libgcc-mips16"
+ tmake_file="mips/t-elf"
target_cpu_default="MASK_64BIT|MASK_FLOAT64"
tm_defines="${tm_defines} MIPS_ISA_DEFAULT=3 MIPS_ABI_DEFAULT=ABI_O64"
;;
mips*-*-rtems*)
tm_file="elfos.h newlib-stdint.h ${tm_file} mips/elf.h mips/rtems.h rtems.h"
- tmake_file="mips/t-elf mips/t-libgcc-mips16 t-rtems mips/t-rtems"
+ tmake_file="mips/t-elf t-rtems mips/t-rtems"
;;
mips-wrs-vxworks)
tm_file="elfos.h ${tm_file} mips/elf.h vx-common.h vxworks.h mips/vxworks.h"
@@ -2002,7 +1874,7 @@ mips-wrs-vxworks)
;;
mipstx39-*-elf* | mipstx39el-*-elf*)
tm_file="elfos.h newlib-stdint.h ${tm_file} mips/r3900.h mips/elf.h"
- tmake_file="mips/t-r3900 mips/t-libgcc-mips16"
+ tmake_file="mips/t-r3900"
;;
mmix-knuth-mmixware)
tm_file="${tm_file} newlib-stdint.h"
@@ -2045,19 +1917,18 @@ powerpc-*-darwin*)
*-darwin[0-6]*)
;;
esac
- tmake_file="${tmake_file} t-slibgcc-dummy"
+ tmake_file="${tmake_file} t-slibgcc"
extra_headers=altivec.h
;;
powerpc64-*-darwin*)
extra_options="${extra_options} ${cpu_type}/darwin.opt"
- tmake_file="${tmake_file} ${cpu_type}/t-darwin64 t-slibgcc-dummy"
+ tmake_file="${tmake_file} ${cpu_type}/t-darwin64 t-slibgcc"
tm_file="${tm_file} ${cpu_type}/darwin8.h ${cpu_type}/darwin64.h"
extra_headers=altivec.h
;;
powerpc-*-freebsd*)
tm_file="${tm_file} dbxelf.h elfos.h ${fbsd_tm_file} rs6000/sysv4.h rs6000/freebsd.h"
tmake_file="rs6000/t-fprules rs6000/t-ppcos ${tmake_file} rs6000/t-ppccomm"
- tmake_file="${tmake_file} t-slibgcc-libgcc"
extra_options="${extra_options} rs6000/sysv4.opt"
;;
powerpc-*-netbsd*)
@@ -2143,7 +2014,6 @@ powerpc-*-linux* | powerpc64-*-linux*)
tm_file="${tm_file} rs6000/linux.h glibc-stdint.h"
;;
esac
- tmake_file="${tmake_file} t-slibgcc-libgcc"
case ${target} in
powerpc*-*-linux*ppc476*)
tm_file="${tm_file} rs6000/476.h"
@@ -2179,7 +2049,6 @@ powerpc-*-lynxos*)
tm_file="${tm_file} dbxelf.h elfos.h rs6000/sysv4.h rs6000/lynx.h lynx.h"
tmake_file="t-lynx rs6000/t-lynx"
extra_options="${extra_options} rs6000/sysv4.opt lynx.opt"
- extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o"
thread_file=lynx
gnu_ld=yes
gas=yes
@@ -2203,7 +2072,7 @@ powerpcle-*-eabi*)
;;
rs6000-ibm-aix4.[3456789]* | powerpc-ibm-aix4.[3456789]*)
tm_file="rs6000/biarch64.h ${tm_file} rs6000/aix.h rs6000/aix43.h rs6000/xcoff.h rs6000/aix-stdint.h"
- tmake_file=rs6000/t-aix43
+ tmake_file="rs6000/t-aix43 t-slibgcc"
extra_options="${extra_options} rs6000/aix64.opt"
use_collect2=yes
thread_file='aix'
@@ -2213,7 +2082,7 @@ rs6000-ibm-aix4.[3456789]* | powerpc-ibm-aix4.[3456789]*)
rs6000-ibm-aix5.1.* | powerpc-ibm-aix5.1.*)
tm_file="rs6000/biarch64.h ${tm_file} rs6000/aix.h rs6000/aix51.h rs6000/xcoff.h rs6000/aix-stdint.h"
extra_options="${extra_options} rs6000/aix64.opt"
- tmake_file=rs6000/t-aix43
+ tmake_file="rs6000/t-aix43 t-slibgcc"
use_collect2=yes
thread_file='aix'
use_gcc_stdint=wrap
@@ -2221,7 +2090,7 @@ rs6000-ibm-aix5.1.* | powerpc-ibm-aix5.1.*)
;;
rs6000-ibm-aix5.2.* | powerpc-ibm-aix5.2.*)
tm_file="${tm_file} rs6000/aix.h rs6000/aix52.h rs6000/xcoff.h rs6000/aix-stdint.h"
- tmake_file=rs6000/t-aix52
+ tmake_file="rs6000/t-aix52 t-slibgcc"
extra_options="${extra_options} rs6000/aix64.opt"
use_collect2=yes
thread_file='aix'
@@ -2230,7 +2099,7 @@ rs6000-ibm-aix5.2.* | powerpc-ibm-aix5.2.*)
;;
rs6000-ibm-aix5.3.* | powerpc-ibm-aix5.3.*)
tm_file="${tm_file} rs6000/aix.h rs6000/aix53.h rs6000/xcoff.h rs6000/aix-stdint.h"
- tmake_file=rs6000/t-aix52
+ tmake_file="rs6000/t-aix52 t-slibgcc"
extra_options="${extra_options} rs6000/aix64.opt"
use_collect2=yes
thread_file='aix'
@@ -2239,7 +2108,7 @@ rs6000-ibm-aix5.3.* | powerpc-ibm-aix5.3.*)
;;
rs6000-ibm-aix[6789].* | powerpc-ibm-aix[6789].*)
tm_file="${tm_file} rs6000/aix.h rs6000/aix61.h rs6000/xcoff.h rs6000/aix-stdint.h"
- tmake_file=rs6000/t-aix52
+ tmake_file="rs6000/t-aix52 t-slibgcc"
extra_options="${extra_options} rs6000/aix64.opt"
use_collect2=yes
thread_file='aix'
@@ -2248,7 +2117,6 @@ rs6000-ibm-aix[6789].* | powerpc-ibm-aix[6789].*)
;;
rx-*-elf*)
tm_file="dbxelf.h elfos.h newlib-stdint.h ${tm_file}"
- libgcc_tm_file="${libgcc_tm_file} rx/rx-abi.h rx/rx-lib.h"
tmake_file="${tmake_file} rx/t-rx"
;;
s390-*-linux*)
@@ -2271,7 +2139,6 @@ s390x-ibm-tpf*)
md_file=s390/s390.md
extra_modes=s390/s390-modes.def
out_file=s390/s390.c
- extra_parts="crtbeginS.o crtendS.o"
thread_file='tpf'
extra_options="${extra_options} s390/tpf.opt"
;;
@@ -2279,13 +2146,11 @@ score-*-elf)
gas=yes
gnu_ld=yes
tm_file="dbxelf.h elfos.h score/elf.h score/score.h newlib-stdint.h"
- extra_parts="crti.o crtn.o crtbegin.o crtend.o"
- tmake_file="${tmake_file} score/t-score-elf"
;;
sh-*-elf* | sh[12346l]*-*-elf* | \
sh-*-linux* | sh[2346lbe]*-*-linux* | \
sh-*-netbsdelf* | shl*-*-netbsdelf* | sh5-*-netbsd* | sh5l*-*-netbsd* | \
- sh64-*-netbsd* | sh64l*-*-netbsd*)
+ sh64-*-netbsd* | sh64l*-*-netbsd*)
tmake_file="${tmake_file} sh/t-sh sh/t-elf"
if test x${with_endian} = x; then
case ${target} in
@@ -2326,7 +2191,6 @@ sh-*-elf* | sh[12346l]*-*-elf* | \
fi
tm_file="${tm_file} sh/embed-elf.h"
tm_file="${tm_file} sh/superh.h"
- tmake_file="${tmake_file} sh/t-superh"
extra_options="${extra_options} sh/superh.opt" ;;
*) if test x$with_newlib = xyes \
&& test x$with_libgloss = xyes; then
@@ -2337,17 +2201,16 @@ sh-*-elf* | sh[12346l]*-*-elf* | \
case ${target} in
sh5*-*-netbsd*)
# SHmedia, 32-bit ABI
- tmake_file="${tmake_file} sh/t-sh64 sh/t-netbsd"
+ tmake_file="${tmake_file} sh/t-sh64"
;;
sh64*-netbsd*)
# SHmedia, 64-bit ABI
- tmake_file="${tmake_file} sh/t-sh64 sh/t-netbsd sh/t-netbsd-sh5-64"
+ tmake_file="${tmake_file} sh/t-sh64 sh/t-netbsd-sh5-64"
;;
*-*-netbsd)
- tmake_file="${tmake_file} sh/t-netbsd"
;;
sh64*-*-linux*)
- tmake_file="${tmake_file} sh/t-sh64 sh/t-linux64"
+ tmake_file="${tmake_file} sh/t-sh64"
tm_file="${tm_file} sh/sh64.h"
extra_headers="shmedia.h ushmedia.h sshmedia.h"
;;
@@ -2461,11 +2324,11 @@ sh-*-elf* | sh[12346l]*-*-elf* | \
tmake_file="$tmake_file t-sysroot-suffix"
;;
sh-*-rtems*)
- tmake_file="sh/t-sh sh/t-elf t-rtems sh/t-rtems"
+ tmake_file="sh/t-sh t-rtems sh/t-rtems"
tm_file="${tm_file} dbxelf.h elfos.h sh/elf.h sh/embed-elf.h sh/rtemself.h rtems.h newlib-stdint.h"
;;
sh-wrs-vxworks)
- tmake_file="$tmake_file sh/t-sh sh/t-elf sh/t-vxworks"
+ tmake_file="$tmake_file sh/t-sh sh/t-vxworks"
tm_file="${tm_file} elfos.h sh/elf.h sh/embed-elf.h vx-common.h vxworks.h sh/vxworks.h"
;;
sparc-*-elf*)
@@ -2497,7 +2360,7 @@ sparc-*-linux*)
tmake_file="${tmake_file} sparc/t-sparc sparc/t-leon3"
;;
*)
- tmake_file="${tmake_file} sparc/t-sparc sparc/t-linux"
+ tmake_file="${tmake_file} sparc/t-sparc"
;;
esac
if test x$enable_targets = xall; then
@@ -2506,7 +2369,6 @@ sparc-*-linux*)
else
tm_file="${tm_file} sparc/linux.h"
fi
- extra_parts="${extra_parts} crtfastmath.o"
;;
sparc-*-netbsdelf*)
tm_file="${tm_file} dbxelf.h elfos.h sparc/sysv4.h netbsd.h netbsd-elf.h sparc/netbsd-elf.h"
@@ -2543,8 +2405,7 @@ sparc64-*-rtems*)
sparc64-*-linux*)
tm_file="sparc/biarch64.h ${tm_file} dbxelf.h elfos.h sparc/sysv4.h gnu-user.h linux.h glibc-stdint.h sparc/default-64.h sparc/linux64.h"
extra_options="${extra_options} sparc/long-double-switch.opt"
- tmake_file="${tmake_file} sparc/t-sparc sparc/t-linux sparc/t-linux64"
- extra_parts="${extra_parts} crtfastmath.o"
+ tmake_file="${tmake_file} sparc/t-sparc sparc/t-linux64"
;;
sparc64-*-freebsd*|ultrasparc-*-freebsd*)
tm_file="${tm_file} ${fbsd_tm_file} dbxelf.h elfos.h sparc/sysv4.h sparc/freebsd.h"
@@ -2554,7 +2415,6 @@ sparc64-*-freebsd*|ultrasparc-*-freebsd*)
x) with_cpu=ultrasparc ;;
*) echo "$with_cpu not supported for freebsd target"; exit 1 ;;
esac
- extra_parts="${extra_parts} crtfastmath.o"
tmake_file="${tmake_file} sparc/t-sparc"
;;
sparc64-*-netbsd*)
@@ -2585,7 +2445,6 @@ spu-*-elf*)
tic6x-*-elf)
tm_file="elfos.h ${tm_file} c6x/elf-common.h c6x/elf.h"
tm_file="${tm_file} dbxelf.h tm-dwarf2.h newlib-stdint.h"
- libgcc_tm_file="${libgcc_tm_file} c6x/c6x-abi.h"
tmake_file="c6x/t-c6x c6x/t-c6x-elf"
use_collect2=no
;;
@@ -2593,8 +2452,7 @@ tic6x-*-uclinux)
tm_file="elfos.h ${tm_file} gnu-user.h linux.h c6x/elf-common.h c6x/uclinux-elf.h"
tm_file="${tm_file} dbxelf.h tm-dwarf2.h glibc-stdint.h"
tm_file="${tm_file} ./sysroot-suffix.h"
- libgcc_tm_file="${libgcc_tm_file} c6x/c6x-abi.h"
- tmake_file="t-slibgcc-elf-ver t-sysroot-suffix"
+ tmake_file="t-sysroot-suffix t-slibgcc"
tmake_file="${tmake_file} c6x/t-c6x c6x/t-c6x-elf c6x/t-c6x-uclinux"
use_collect2=no
;;
@@ -2629,7 +2487,6 @@ v850*-*-*)
vax-*-linux*)
tm_file="${tm_file} dbxelf.h elfos.h gnu-user.h linux.h vax/elf.h vax/linux.h"
extra_options="${extra_options} vax/elf.opt"
- tmake_file="${tmake_file} vax/t-linux"
;;
vax-*-netbsdelf*)
tm_file="${tm_file} elfos.h netbsd.h netbsd-elf.h vax/elf.h vax/netbsd-elf.h"
@@ -2648,21 +2505,18 @@ xstormy16-*-elf)
out_file=stormy16/stormy16.c
extra_options=stormy16/stormy16.opt
tmake_file="stormy16/t-stormy16"
- extra_parts="crtbegin.o crtend.o"
;;
xtensa*-*-elf*)
tm_file="${tm_file} dbxelf.h elfos.h newlib-stdint.h xtensa/elf.h"
extra_options="${extra_options} xtensa/elf.opt"
- tmake_file="xtensa/t-xtensa xtensa/t-elf"
;;
xtensa*-*-linux*)
tm_file="${tm_file} dbxelf.h elfos.h gnu-user.h linux.h glibc-stdint.h xtensa/linux.h"
- tmake_file="${tmake_file} xtensa/t-xtensa xtensa/t-linux"
+ tmake_file="${tmake_file} xtensa/t-xtensa"
;;
am33_2.0-*-linux*)
tm_file="mn10300/mn10300.h dbxelf.h elfos.h gnu-user.h linux.h glibc-stdint.h mn10300/linux.h"
gas=yes gnu_ld=yes
- extra_parts="crtbegin.o crtend.o crtbeginS.o crtendS.o"
use_collect2=no
;;
m32c-*-rtems*)
@@ -2685,7 +2539,6 @@ esac
case ${target} in
i[34567]86-*-linux* | x86_64-*-linux*)
tmake_file="${tmake_file} i386/t-pmm_malloc i386/t-i386"
- libgcc_tm_file="${libgcc_tm_file} i386/value-unwind.h"
;;
i[34567]86-*-* | x86_64-*-*)
tmake_file="${tmake_file} i386/t-gmm_malloc i386/t-i386"
@@ -3610,7 +3463,6 @@ case ${target} in
i[34567]86-*-linux* | x86_64-*-linux* | \
i[34567]86-*-kfreebsd*-gnu | x86_64-*-kfreebsd*-gnu | \
i[34567]86-*-gnu*)
- tmake_file="${tmake_file} i386/t-linux"
;;
i[34567]86-*-solaris2* | x86_64-*-solaris2.1[0-9]*)
;;
diff --git a/gcc/config/alpha/alpha-protos.h b/gcc/config/alpha/alpha-protos.h
index 13b5ce936b8..31551689a27 100644
--- a/gcc/config/alpha/alpha-protos.h
+++ b/gcc/config/alpha/alpha-protos.h
@@ -99,8 +99,7 @@ extern void alpha_split_lock_test_and_set_12 (enum machine_mode, rtx, rtx,
rtx, rtx, rtx);
#endif
-extern rtx alpha_need_linkage (const char *, int);
-extern rtx alpha_use_linkage (rtx, tree, int, int);
+extern rtx alpha_use_linkage (rtx, bool, bool);
#if TARGET_ABI_OPEN_VMS
extern enum avms_arg_type alpha_arg_type (enum machine_mode);
diff --git a/gcc/config/alpha/alpha.c b/gcc/config/alpha/alpha.c
index e195df5c0d6..9a43f80243f 100644
--- a/gcc/config/alpha/alpha.c
+++ b/gcc/config/alpha/alpha.c
@@ -196,7 +196,7 @@ static struct machine_function *alpha_init_machine_status (void);
static rtx alpha_emit_xfloating_compare (enum rtx_code *, rtx, rtx);
#if TARGET_ABI_OPEN_VMS
-static void alpha_write_linkage (FILE *, const char *, tree);
+static void alpha_write_linkage (FILE *, const char *);
static bool vms_valid_pointer_mode (enum machine_mode);
#else
#define vms_patch_builtins() gcc_unreachable()
@@ -4509,6 +4509,8 @@ alpha_multipass_dfa_lookahead (void)
/* Machine-specific function data. */
+struct GTY(()) alpha_links;
+
struct GTY(()) machine_function
{
/* For OSF. */
@@ -4518,7 +4520,11 @@ struct GTY(()) machine_function
rtx gp_save_rtx;
/* For VMS condition handlers. */
- bool uses_condition_handler;
+ bool uses_condition_handler;
+
+ /* Linkage entries. */
+ splay_tree GTY ((param1_is (char *), param2_is (struct alpha_links *)))
+ links;
};
/* How to allocate a 'struct machine_function'. */
@@ -7862,16 +7868,17 @@ alpha_start_function (FILE *file, const char *fnname,
fprintf (file, "\t.handler_data %d\n", VMS_COND_HANDLER_FP_OFFSET);
}
- /* Ifdef'ed cause link_section are only available then. */
+#ifdef TARGET_VMS_CRASH_DEBUG
+ /* Support of minimal traceback info. */
switch_to_section (readonly_data_section);
fprintf (file, "\t.align 3\n");
assemble_name (file, fnname); fputs ("..na:\n", file);
fputs ("\t.ascii \"", file);
assemble_name (file, fnname);
fputs ("\\0\"\n", file);
- alpha_need_linkage (fnname, 1);
switch_to_section (text_section);
#endif
+#endif /* TARGET_ABI_OPEN_VMS */
}
/* Emit the .prologue note at the scheduled end of the prologue. */
@@ -8104,7 +8111,8 @@ alpha_end_function (FILE *file, const char *fnname, tree decl ATTRIBUTE_UNUSED)
output_asm_insn (get_insn_template (CODE_FOR_nop, NULL), NULL);
#if TARGET_ABI_OPEN_VMS
- alpha_write_linkage (file, fnname, decl);
+ /* Write the linkage entries. */
+ alpha_write_linkage (file, fnname);
#endif
/* End the function. */
@@ -9299,32 +9307,19 @@ alpha_elf_section_type_flags (tree decl, const char *name, int reloc)
/* Structure to collect function names for final output in link section. */
/* Note that items marked with GTY can't be ifdef'ed out. */
-enum links_kind {KIND_UNUSED, KIND_LOCAL, KIND_EXTERN};
-enum reloc_kind {KIND_LINKAGE, KIND_CODEADDR};
+enum reloc_kind
+{
+ KIND_LINKAGE,
+ KIND_CODEADDR
+};
struct GTY(()) alpha_links
{
- int num;
- const char *target;
+ rtx func;
rtx linkage;
- enum links_kind lkind;
enum reloc_kind rkind;
};
-struct GTY(()) alpha_funcs
-{
- int num;
- splay_tree GTY ((param1_is (char *), param2_is (struct alpha_links *)))
- links;
-};
-
-static GTY ((param1_is (char *), param2_is (struct alpha_links *)))
- splay_tree alpha_links_tree;
-static GTY ((param1_is (tree), param2_is (struct alpha_funcs *)))
- splay_tree alpha_funcs_tree;
-
-static GTY(()) int alpha_funcs_num;
-
#if TARGET_ABI_OPEN_VMS
/* Return the VMS argument type corresponding to MODE. */
@@ -9358,95 +9353,6 @@ alpha_arg_info_reg_val (CUMULATIVE_ARGS cum)
return GEN_INT (regval);
}
-/* Register the need for a (fake) .linkage entry for calls to function NAME.
- IS_LOCAL is 1 if this is for a definition, 0 if this is for a real call.
- Return a SYMBOL_REF suited to the call instruction. */
-
-rtx
-alpha_need_linkage (const char *name, int is_local)
-{
- splay_tree_node node;
- struct alpha_links *al;
- const char *target;
- tree id;
-
- if (name[0] == '*')
- name++;
-
- if (is_local)
- {
- struct alpha_funcs *cfaf;
-
- if (!alpha_funcs_tree)
- alpha_funcs_tree = splay_tree_new_ggc
- (splay_tree_compare_pointers,
- ggc_alloc_splay_tree_tree_node_tree_node_splay_tree_s,
- ggc_alloc_splay_tree_tree_node_tree_node_splay_tree_node_s);
-
-
- cfaf = ggc_alloc_alpha_funcs ();
-
- cfaf->links = 0;
- cfaf->num = ++alpha_funcs_num;
-
- splay_tree_insert (alpha_funcs_tree,
- (splay_tree_key) current_function_decl,
- (splay_tree_value) cfaf);
- }
-
- if (alpha_links_tree)
- {
- /* Is this name already defined? */
-
- node = splay_tree_lookup (alpha_links_tree, (splay_tree_key) name);
- if (node)
- {
- al = (struct alpha_links *) node->value;
- if (is_local)
- {
- /* Defined here but external assumed. */
- if (al->lkind == KIND_EXTERN)
- al->lkind = KIND_LOCAL;
- }
- else
- {
- /* Used here but unused assumed. */
- if (al->lkind == KIND_UNUSED)
- al->lkind = KIND_LOCAL;
- }
- return al->linkage;
- }
- }
- else
- alpha_links_tree = splay_tree_new_ggc
- ((splay_tree_compare_fn) strcmp,
- ggc_alloc_splay_tree_str_alpha_links_splay_tree_s,
- ggc_alloc_splay_tree_str_alpha_links_splay_tree_node_s);
-
- al = ggc_alloc_alpha_links ();
- name = ggc_strdup (name);
-
- /* Assume external if no definition. */
- al->lkind = (is_local ? KIND_UNUSED : KIND_EXTERN);
-
- /* Ensure we have an IDENTIFIER so assemble_name can mark it used
- and find the ultimate alias target like assemble_name. */
- id = get_identifier (name);
- target = NULL;
- while (IDENTIFIER_TRANSPARENT_ALIAS (id))
- {
- id = TREE_CHAIN (id);
- target = IDENTIFIER_POINTER (id);
- }
-
- al->target = target ? target : name;
- al->linkage = gen_rtx_SYMBOL_REF (Pmode, name);
-
- splay_tree_insert (alpha_links_tree, (splay_tree_key) name,
- (splay_tree_value) al);
-
- return al->linkage;
-}
/* Return a SYMBOL_REF representing the reference to the .linkage entry
of function FUNC built for calls made from CFUNDECL. LFLAG is 1 if
@@ -9455,75 +9361,48 @@ alpha_need_linkage (const char *name, int is_local)
reference (code address only), 0 if this is a full reference. */
rtx
-alpha_use_linkage (rtx func, tree cfundecl, int lflag, int rflag)
+alpha_use_linkage (rtx func, bool lflag, bool rflag)
{
- splay_tree_node cfunnode;
- struct alpha_funcs *cfaf;
- struct alpha_links *al;
+ struct alpha_links *al = NULL;
const char *name = XSTR (func, 0);
- cfaf = (struct alpha_funcs *) 0;
- al = (struct alpha_links *) 0;
-
- cfunnode = splay_tree_lookup (alpha_funcs_tree, (splay_tree_key) cfundecl);
- cfaf = (struct alpha_funcs *) cfunnode->value;
-
- if (cfaf->links)
+ if (cfun->machine->links)
{
splay_tree_node lnode;
/* Is this name already defined? */
-
- lnode = splay_tree_lookup (cfaf->links, (splay_tree_key) name);
+ lnode = splay_tree_lookup (cfun->machine->links, (splay_tree_key) name);
if (lnode)
al = (struct alpha_links *) lnode->value;
}
else
- cfaf->links = splay_tree_new_ggc
+ cfun->machine->links = splay_tree_new_ggc
((splay_tree_compare_fn) strcmp,
ggc_alloc_splay_tree_str_alpha_links_splay_tree_s,
ggc_alloc_splay_tree_str_alpha_links_splay_tree_node_s);
- if (!al)
+ if (al == NULL)
{
- size_t name_len;
- size_t buflen;
+ size_t buf_len;
char *linksym;
- splay_tree_node node = 0;
- struct alpha_links *anl;
if (name[0] == '*')
name++;
- name_len = strlen (name);
- linksym = (char *) alloca (name_len + 50);
+ buf_len = strlen (name) + 8 + 9;
+ linksym = (char *) alloca (buf_len);
+ snprintf (linksym, buf_len, "$%d..%s..lk", cfun->funcdef_no, name);
al = ggc_alloc_alpha_links ();
- al->num = cfaf->num;
- al->target = NULL;
-
- node = splay_tree_lookup (alpha_links_tree, (splay_tree_key) name);
- if (node)
- {
- anl = (struct alpha_links *) node->value;
- al->lkind = anl->lkind;
- name = anl->target;
- }
-
- sprintf (linksym, "$%d..%s..lk", cfaf->num, name);
- buflen = strlen (linksym);
-
- al->linkage = gen_rtx_SYMBOL_REF
- (Pmode, ggc_alloc_string (linksym, buflen + 1));
+ al->func = func;
+ al->linkage = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (linksym));
- splay_tree_insert (cfaf->links, (splay_tree_key) name,
+ splay_tree_insert (cfun->machine->links,
+ (splay_tree_key) ggc_strdup (name),
(splay_tree_value) al);
}
- if (rflag)
- al->rkind = KIND_CODEADDR;
- else
- al->rkind = KIND_LINKAGE;
+ al->rkind = rflag ? KIND_CODEADDR : KIND_LINKAGE;
if (lflag)
return gen_rtx_MEM (Pmode, plus_constant (al->linkage, 8));
@@ -9538,31 +9417,24 @@ alpha_write_one_linkage (splay_tree_node node, void *data)
struct alpha_links *link = (struct alpha_links *) node->value;
FILE *stream = (FILE *) data;
- fprintf (stream, "$%d..%s..lk:\n", link->num, name);
+ ASM_OUTPUT_INTERNAL_LABEL (stream, XSTR (link->linkage, 0));
if (link->rkind == KIND_CODEADDR)
{
- if (link->lkind == KIND_LOCAL)
- {
- /* Local and used */
- fprintf (stream, "\t.quad %s..en\n", name);
- }
- else
- {
- /* External and used, request code address. */
- fprintf (stream, "\t.code_address %s\n", name);
- }
+ /* External and used, request code address. */
+ fprintf (stream, "\t.code_address %s\n", name);
}
else
{
- if (link->lkind == KIND_LOCAL)
+ if (!SYMBOL_REF_EXTERNAL_P (link->func)
+ && SYMBOL_REF_LOCAL_P (link->func))
{
- /* Local and used, build linkage pair. */
+ /* Locally defined, build linkage pair. */
fprintf (stream, "\t.quad %s..en\n", name);
fprintf (stream, "\t.quad %s\n", name);
}
else
{
- /* External and used, request linkage pair. */
+ /* External, request linkage pair. */
fprintf (stream, "\t.linkage %s\n", name);
}
}
@@ -9571,21 +9443,18 @@ alpha_write_one_linkage (splay_tree_node node, void *data)
}
static void
-alpha_write_linkage (FILE *stream, const char *funname, tree fundecl)
+alpha_write_linkage (FILE *stream, const char *funname)
{
- splay_tree_node node;
- struct alpha_funcs *func;
-
fprintf (stream, "\t.link\n");
fprintf (stream, "\t.align 3\n");
in_section = NULL;
- node = splay_tree_lookup (alpha_funcs_tree, (splay_tree_key) fundecl);
- func = (struct alpha_funcs *) node->value;
-
+#ifdef TARGET_VMS_CRASH_DEBUG
fputs ("\t.name ", stream);
assemble_name (stream, funname);
fputs ("..na\n", stream);
+#endif
+
ASM_OUTPUT_LABEL (stream, funname);
fprintf (stream, "\t.pdesc ");
assemble_name (stream, funname);
@@ -9593,9 +9462,9 @@ alpha_write_linkage (FILE *stream, const char *funname, tree fundecl)
alpha_procedure_type == PT_STACK ? "stack"
: alpha_procedure_type == PT_REGISTER ? "reg" : "null");
- if (func->links)
+ if (cfun->machine->links)
{
- splay_tree_foreach (func->links, alpha_write_one_linkage, stream);
+ splay_tree_foreach (cfun->machine->links, alpha_write_one_linkage, stream);
/* splay_tree_delete (func->links); */
}
}
@@ -9641,19 +9510,10 @@ vms_asm_out_destructor (rtx symbol, int priority ATTRIBUTE_UNUSED)
assemble_integer (symbol, UNITS_PER_WORD, BITS_PER_WORD, 1);
}
#else
-
-rtx
-alpha_need_linkage (const char *name ATTRIBUTE_UNUSED,
- int is_local ATTRIBUTE_UNUSED)
-{
- return NULL_RTX;
-}
-
rtx
alpha_use_linkage (rtx func ATTRIBUTE_UNUSED,
- tree cfundecl ATTRIBUTE_UNUSED,
- int lflag ATTRIBUTE_UNUSED,
- int rflag ATTRIBUTE_UNUSED)
+ bool lflag ATTRIBUTE_UNUSED,
+ bool rflag ATTRIBUTE_UNUSED)
{
return NULL_RTX;
}
@@ -9783,6 +9643,14 @@ alpha_conditional_register_usage (void)
#define TARGET_STDARG_OPTIMIZE_HOOK alpha_stdarg_optimize_hook
#endif
+/* Use 16-bits anchor. */
+#undef TARGET_MIN_ANCHOR_OFFSET
+#define TARGET_MIN_ANCHOR_OFFSET -0x7fff - 1
+#undef TARGET_MAX_ANCHOR_OFFSET
+#define TARGET_MAX_ANCHOR_OFFSET 0x7fff
+#undef TARGET_USE_BLOCKS_FOR_CONSTANT_P
+#define TARGET_USE_BLOCKS_FOR_CONSTANT_P hook_bool_mode_const_rtx_true
+
#undef TARGET_RTX_COSTS
#define TARGET_RTX_COSTS alpha_rtx_costs
#undef TARGET_ADDRESS_COST
diff --git a/gcc/config/alpha/alpha.md b/gcc/config/alpha/alpha.md
index b83510d7cb1..64229245065 100644
--- a/gcc/config/alpha/alpha.md
+++ b/gcc/config/alpha/alpha.md
@@ -3965,8 +3965,6 @@
emit_move_insn (gen_rtx_REG (DImode, 25), operands[1]);
if (GET_CODE (operands[0]) == SYMBOL_REF)
{
- alpha_need_linkage (XSTR (operands[0], 0), 0);
-
operands[2] = const0_rtx;
}
else
@@ -4042,8 +4040,6 @@
emit_move_insn (gen_rtx_REG (DImode, 25), operands[2]);
if (GET_CODE (operands[1]) == SYMBOL_REF)
{
- alpha_need_linkage (XSTR (operands[1], 0), 0);
-
operands[3] = const0_rtx;
}
else
@@ -4244,8 +4240,8 @@
case 0:
return "mov %2,$27\;jsr $26,0\;ldq $27,0($29)";
case 1:
- operands [2] = alpha_use_linkage (operands [0], cfun->decl, 1, 0);
- operands [3] = alpha_use_linkage (operands [0], cfun->decl, 0, 0);
+ operands [2] = alpha_use_linkage (operands [0], true, false);
+ operands [3] = alpha_use_linkage (operands [0], false, false);
return "ldq $26,%3\;ldq $27,%2\;jsr $26,%0\;ldq $27,0($29)";
default:
gcc_unreachable ();
@@ -5472,7 +5468,7 @@
(clobber (reg:DI 27))])]
"TARGET_ABI_OPEN_VMS"
{
- operands[4] = alpha_need_linkage ("OTS$MOVE", 0);
+ operands[4] = gen_rtx_SYMBOL_REF (Pmode, "OTS$MOVE");
})
(define_insn "*movmemdi_1"
@@ -5491,7 +5487,7 @@
(clobber (reg:DI 27))]
"TARGET_ABI_OPEN_VMS"
{
- operands [5] = alpha_use_linkage (operands [4], cfun->decl, 0, 1);
+ operands [5] = alpha_use_linkage (operands [4], false, true);
switch (which_alternative)
{
case 0:
@@ -5539,7 +5535,7 @@
if (operands[2] != const0_rtx)
FAIL;
- operands[4] = alpha_need_linkage ("OTS$ZERO", 0);
+ operands[4] = gen_rtx_SYMBOL_REF (Pmode, "OTS$ZERO");
})
(define_insn "*clrmemdi_1"
@@ -5555,7 +5551,7 @@
(clobber (reg:DI 27))]
"TARGET_ABI_OPEN_VMS"
{
- operands [4] = alpha_use_linkage (operands [3], cfun->decl, 0, 1);
+ operands [4] = alpha_use_linkage (operands [3], false, true);
switch (which_alternative)
{
case 0:
@@ -6825,8 +6821,8 @@
case 0:
return "mov %3,$27\;jsr $26,0\;ldq $27,0($29)";
case 1:
- operands [3] = alpha_use_linkage (operands [1], cfun->decl, 1, 0);
- operands [4] = alpha_use_linkage (operands [1], cfun->decl, 0, 0);
+ operands [3] = alpha_use_linkage (operands [1], true, false);
+ operands [4] = alpha_use_linkage (operands [1], false, false);
return "ldq $26,%4\;ldq $27,%3\;jsr $26,%1\;ldq $27,0($29)";
default:
gcc_unreachable ();
diff --git a/gcc/config/alpha/libgcc-alpha-ldbl.ver b/gcc/config/alpha/libgcc-alpha-ldbl.ver
deleted file mode 100644
index 8dc54a74980..00000000000
--- a/gcc/config/alpha/libgcc-alpha-ldbl.ver
+++ /dev/null
@@ -1,50 +0,0 @@
-# Copyright (C) 2006 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/>.
-
-%ifdef __LONG_DOUBLE_128__
-
-# long double 128 bit support in libgcc_s.so.1 is only available
-# when configured with --with-long-double-128. Make sure all the
-# symbols are available at @@GCC_LDBL_* versions to make it clear
-# there is a configurable symbol set.
-
-%exclude {
- __fixtfdi
- __fixunstfdi
- __floatditf
-
- __divtc3
- __multc3
- __powitf2
-}
-
-%inherit GCC_LDBL_3.0 GCC_3.0
-GCC_LDBL_3.0 {
- __fixtfdi
- __fixunstfdi
- __floatditf
-}
-
-%inherit GCC_LDBL_4.0.0 GCC_4.0.0
-GCC_LDBL_4.0.0 {
- __divtc3
- __multc3
- __powitf2
-}
-
-%endif
diff --git a/gcc/config/alpha/qrnnd.asm b/gcc/config/alpha/qrnnd.asm
deleted file mode 100644
index 51b13bce6ad..00000000000
--- a/gcc/config/alpha/qrnnd.asm
+++ /dev/null
@@ -1,163 +0,0 @@
- # Alpha 21064 __udiv_qrnnd
- # Copyright (C) 1992, 1994, 1995, 2000, 2009 Free Software Foundation, Inc.
-
- # This file is part of GCC.
-
- # The GNU MP Library is free software; you can redistribute it and/or modify
- # it under the terms of the GNU General Public License as published by
- # the Free Software Foundation; either version 3 of the License, or (at your
- # option) any later version.
-
- # This file is distributed in the hope that it will be useful, but
- # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
- # License for more details.
-
- # Under Section 7 of GPL version 3, you are granted additional
- # permissions described in the GCC Runtime Library Exception, version
- # 3.1, as published by the Free Software Foundation.
-
- # You should have received a copy of the GNU General Public License and
- # a copy of the GCC Runtime Library Exception along with this program;
- # see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
- # <http://www.gnu.org/licenses/>.
-
-#ifdef __ELF__
-.section .note.GNU-stack,""
-#endif
-
- .set noreorder
- .set noat
-
- .text
-
- .globl __udiv_qrnnd
- .ent __udiv_qrnnd
-__udiv_qrnnd:
- .frame $30,0,$26,0
- .prologue 0
-
-#define cnt $2
-#define tmp $3
-#define rem_ptr $16
-#define n1 $17
-#define n0 $18
-#define d $19
-#define qb $20
-#define AT $at
-
- ldiq cnt,16
- blt d,$largedivisor
-
-$loop1: cmplt n0,0,tmp
- addq n1,n1,n1
- bis n1,tmp,n1
- addq n0,n0,n0
- cmpule d,n1,qb
- subq n1,d,tmp
- cmovne qb,tmp,n1
- bis n0,qb,n0
- cmplt n0,0,tmp
- addq n1,n1,n1
- bis n1,tmp,n1
- addq n0,n0,n0
- cmpule d,n1,qb
- subq n1,d,tmp
- cmovne qb,tmp,n1
- bis n0,qb,n0
- cmplt n0,0,tmp
- addq n1,n1,n1
- bis n1,tmp,n1
- addq n0,n0,n0
- cmpule d,n1,qb
- subq n1,d,tmp
- cmovne qb,tmp,n1
- bis n0,qb,n0
- cmplt n0,0,tmp
- addq n1,n1,n1
- bis n1,tmp,n1
- addq n0,n0,n0
- cmpule d,n1,qb
- subq n1,d,tmp
- cmovne qb,tmp,n1
- bis n0,qb,n0
- subq cnt,1,cnt
- bgt cnt,$loop1
- stq n1,0(rem_ptr)
- bis $31,n0,$0
- ret $31,($26),1
-
-$largedivisor:
- and n0,1,$4
-
- srl n0,1,n0
- sll n1,63,tmp
- or tmp,n0,n0
- srl n1,1,n1
-
- and d,1,$6
- srl d,1,$5
- addq $5,$6,$5
-
-$loop2: cmplt n0,0,tmp
- addq n1,n1,n1
- bis n1,tmp,n1
- addq n0,n0,n0
- cmpule $5,n1,qb
- subq n1,$5,tmp
- cmovne qb,tmp,n1
- bis n0,qb,n0
- cmplt n0,0,tmp
- addq n1,n1,n1
- bis n1,tmp,n1
- addq n0,n0,n0
- cmpule $5,n1,qb
- subq n1,$5,tmp
- cmovne qb,tmp,n1
- bis n0,qb,n0
- cmplt n0,0,tmp
- addq n1,n1,n1
- bis n1,tmp,n1
- addq n0,n0,n0
- cmpule $5,n1,qb
- subq n1,$5,tmp
- cmovne qb,tmp,n1
- bis n0,qb,n0
- cmplt n0,0,tmp
- addq n1,n1,n1
- bis n1,tmp,n1
- addq n0,n0,n0
- cmpule $5,n1,qb
- subq n1,$5,tmp
- cmovne qb,tmp,n1
- bis n0,qb,n0
- subq cnt,1,cnt
- bgt cnt,$loop2
-
- addq n1,n1,n1
- addq $4,n1,n1
- bne $6,$Odd
- stq n1,0(rem_ptr)
- bis $31,n0,$0
- ret $31,($26),1
-
-$Odd:
- /* q' in n0. r' in n1 */
- addq n1,n0,n1
-
- cmpult n1,n0,tmp # tmp := carry from addq
- subq n1,d,AT
- addq n0,tmp,n0
- cmovne tmp,AT,n1
-
- cmpult n1,d,tmp
- addq n0,1,AT
- cmoveq tmp,AT,n0
- subq n1,d,AT
- cmoveq tmp,AT,n1
-
- stq n1,0(rem_ptr)
- bis $31,n0,$0
- ret $31,($26),1
-
- .end __udiv_qrnnd
diff --git a/gcc/config/alpha/t-alpha b/gcc/config/alpha/t-alpha
deleted file mode 100644
index d0b58d69a4e..00000000000
--- a/gcc/config/alpha/t-alpha
+++ /dev/null
@@ -1,2 +0,0 @@
-# This is a support routine for longlong.h, used by libgcc2.c.
-LIB2FUNCS_EXTRA = $(srcdir)/config/alpha/qrnnd.asm
diff --git a/gcc/config/alpha/t-ieee b/gcc/config/alpha/t-ieee
deleted file mode 100644
index fe549dfc992..00000000000
--- a/gcc/config/alpha/t-ieee
+++ /dev/null
@@ -1,2 +0,0 @@
-# All alphas get an IEEE complaint set of libraries.
-TARGET_LIBGCC2_CFLAGS += -mieee
diff --git a/gcc/config/alpha/t-linux b/gcc/config/alpha/t-linux
deleted file mode 100644
index fabf38f9cce..00000000000
--- a/gcc/config/alpha/t-linux
+++ /dev/null
@@ -1 +0,0 @@
-SHLIB_MAPFILES += $(srcdir)/config/alpha/libgcc-alpha-ldbl.ver
diff --git a/gcc/config/alpha/t-vms b/gcc/config/alpha/t-vms
index 410e219ff5b..760f943d063 100644
--- a/gcc/config/alpha/t-vms
+++ b/gcc/config/alpha/t-vms
@@ -1,5 +1,5 @@
# Copyright (C) 1996, 1997, 1998, 2001, 2002,
-# 2007, 2009 Free Software Foundation, Inc.
+# 2007, 2009, 2011 Free Software Foundation, Inc.
#
# This file is part of GCC.
#
@@ -17,49 +17,6 @@
# along with GCC; see the file COPYING3. If not see
# <http://www.gnu.org/licenses/>.
-LIB2FUNCS_EXTRA = $(srcdir)/config/alpha/vms-gcc_shell_handler.c
-
-EXTRA_PARTS = vms-dwarf2.o vms-dwarf2eh.o $(VMS_EXTRA_PARTS) \
- crtbegin.o crtbeginS.o crtend.o crtendS.o
-
-# This object must be linked with in order to make the executable debuggable.
-# vms-ld handles it automatically when passed -g.
-$(T)vms-dwarf2.o : $(srcdir)/config/alpha/vms-dwarf2.asm
- $(GCC_FOR_TARGET) -c -x assembler $< -o $@
-
-$(T)vms-dwarf2eh.o : $(srcdir)/config/alpha/vms-dwarf2eh.asm
- $(GCC_FOR_TARGET) -c -x assembler $< -o $@
-
MULTILIB_OPTIONS = mcpu=ev6
MULTILIB_DIRNAMES = ev6
MULTILIB_OSDIRNAMES = ev6
-LIBGCC = stmp-multilib
-INSTALL_LIBGCC = install-multilib
-
-shlib_version:=$(shell echo $(BASEVER_c) | sed -e 's/\./,/' -e 's/\.//g')
-SHLIB_EXT = .exe
-SHLIB_OBJS = @shlib_objs@
-SHLIB_NAME = @shlib_base_name@.exe
-SHLIB_MULTILIB =
-SHLIB_INSTALL = $(INSTALL_DATA) $(SHLIB_NAME) $$(DESTDIR)$$(libsubdir)/$(SHLIB_NAME)
-SHLIB_SYMVEC = \
- grep -F -e "\$$BSS\$$" -e "\$$DATA\$$" -e " sdata " -e " data.rel " -e " data.rel.ro " -e " sbss " \
- -e "\$$LINK\$$" -e "\$$READONLY\$$" | \
- sed -e "s/.*\$$LINK\$$ \(.*\)/SYMBOL_VECTOR=(\1=PROCEDURE)/" \
- -e "s/.*\$$DATA\$$ \(.*\)/SYMBOL_VECTOR=(\1=DATA)/" \
- -e "s/.* sbss \(.*\)/SYMBOL_VECTOR=(\1=DATA)/" \
- -e "s/.* sdata \(.*\)/SYMBOL_VECTOR=(\1=DATA)/" \
- -e "s/.* data.rel \(.*\)/SYMBOL_VECTOR=(\1=DATA)/" \
- -e "s/.* data.rel.ro \(.*\)/SYMBOL_VECTOR=(\1=DATA)/" \
- -e "s/.*\$$BSS\$$ \(.*\)/SYMBOL_VECTOR=(\1=DATA)/" \
- -e "s/.*\$$READONLY\$$ \(.*\)/SYMBOL_VECTOR=(\1=DATA)/"
-SHLIB_SYMVECX2 := $(subst $$,$$$$,$(SHLIB_SYMVEC))
-SHLIB_LINK = \
- echo "case_sensitive=yes" > SYMVEC_$$$$$$$$.opt; \
- objdump --syms $(SHLIB_OBJS) | \
- $(SHLIB_SYMVECX2) >> SYMVEC_$$$$$$$$.opt ; \
- echo "case_sensitive=NO" >> SYMVEC_$$$$$$$$.opt; \
- $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) -nodefaultlibs \
- -shared --for-linker=/noinform -o $(SHLIB_NAME) $(SHLIB_OBJS) \
- --for-linker=SYMVEC_$$$$$$$$.opt \
- --for-linker=gsmatch=equal,$(shlib_version)
diff --git a/gcc/config/alpha/vms-dwarf2.asm b/gcc/config/alpha/vms-dwarf2.asm
deleted file mode 100644
index 531c7aa9984..00000000000
--- a/gcc/config/alpha/vms-dwarf2.asm
+++ /dev/null
@@ -1,77 +0,0 @@
-/* VMS dwarf2 section sequentializer.
- Copyright (C) 2001, 2009 Free Software Foundation, Inc.
- Contributed by Douglas B. Rupp (rupp@gnat.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.
-
-Under Section 7 of GPL version 3, you are granted additional
-permissions described in the GCC Runtime Library Exception, version
-3.1, as published by the Free Software Foundation.
-
-You should have received a copy of the GNU General Public License and
-a copy of the GCC Runtime Library Exception along with this program;
-see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
-<http://www.gnu.org/licenses/>. */
-
-/* Linking with this file forces Dwarf2 debug sections to be
- sequentially loaded by the VMS linker, enabling GDB to read them. */
-
-.section .debug_abbrev,NOWRT
- .align 0
- .globl $dwarf2.debug_abbrev
-$dwarf2.debug_abbrev:
-
-.section .debug_aranges,NOWRT
- .align 0
- .globl $dwarf2.debug_aranges
-$dwarf2.debug_aranges:
-
-.section .debug_frame,NOWRT
- .align 0
- .globl $dwarf2.debug_frame
-$dwarf2.debug_frame:
-
-.section .debug_info,NOWRT
- .align 0
- .globl $dwarf2.debug_info
-$dwarf2.debug_info:
-
-.section .debug_line,NOWRT
- .align 0
- .globl $dwarf2.debug_line
-$dwarf2.debug_line:
-
-.section .debug_loc,NOWRT
- .align 0
- .globl $dwarf2.debug_loc
-$dwarf2.debug_loc:
-
-.section .debug_macinfo,NOWRT
- .align 0
- .globl $dwarf2.debug_macinfo
-$dwarf2.debug_macinfo:
-
-.section .debug_pubnames,NOWRT
- .align 0
- .globl $dwarf2.debug_pubnames
-$dwarf2.debug_pubnames:
-
-.section .debug_str,NOWRT
- .align 0
- .globl $dwarf2.debug_str
-$dwarf2.debug_str:
-
-.section .debug_zzzzzz,NOWRT
- .align 0
- .globl $dwarf2.debug_zzzzzz
-$dwarf2.debug_zzzzzz:
diff --git a/gcc/config/alpha/vms-dwarf2eh.asm b/gcc/config/alpha/vms-dwarf2eh.asm
deleted file mode 100644
index e0eaf9d3741..00000000000
--- a/gcc/config/alpha/vms-dwarf2eh.asm
+++ /dev/null
@@ -1,30 +0,0 @@
-/* VMS dwarf2 exception handling section sequentializer.
- Copyright (C) 2002, 2009 Free Software Foundation, Inc.
- Contributed by Douglas B. Rupp (rupp@gnat.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.
-
-Under Section 7 of GPL version 3, you are granted additional
-permissions described in the GCC Runtime Library Exception, version
-3.1, as published by the Free Software Foundation.
-
-You should have received a copy of the GNU General Public License and
-a copy of the GCC Runtime Library Exception along with this program;
-see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
-<http://www.gnu.org/licenses/>. */
-
-/* Linking with this file forces the Dwarf2 EH section to be
- individually loaded by the VMS linker an the unwinder to read it. */
-
-.section .eh_frame,NOWRT
- .align 0
diff --git a/gcc/config/alpha/vms-gcc_shell_handler.c b/gcc/config/alpha/vms-gcc_shell_handler.c
deleted file mode 100644
index 67d0fe7f9aa..00000000000
--- a/gcc/config/alpha/vms-gcc_shell_handler.c
+++ /dev/null
@@ -1,124 +0,0 @@
-/* Static condition handler for Alpha/VMS.
- Copyright (C) 2005-2009
- 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/>. */
-
-/* This file implements __gcc_shell_handler, the static VMS condition handler
- used as the indirection wrapper around user level handlers installed with
- establish_vms_condition_handler GCC builtin.
-
- [ABI] in comments refers to the "HP OpenVMS calling standard" document
- dated January 2005. */
-
-#include <vms/chfdef.h>
-#include <vms/pdscdef.h>
-#include <vms/ssdef.h>
-
-typedef void * ADDR;
-typedef unsigned long long REG;
-
-#define REG_AT(addr) (*(REG *)(addr))
-
-/* Compute pointer to procedure descriptor (Procedure Value) from Frame
- Pointer FP, according to the rules in [ABI-3.5.1 Current Procedure]. */
-#define PV_FOR(FP) \
- (((FP) != 0) \
- ? (((REG_AT (FP) & 0x7) == 0) ? *(PDSCDEF **)(FP) : (PDSCDEF *)(FP)) : 0)
-
-long
-__gcc_shell_handler (struct chf$signal_array *sig_arr,
- struct chf$mech_array *mech_arr);
-
-/* Helper for __gcc_shell_handler. Fetch the pointer to procedure currently
- registered as the VMS condition handler for the live function with a frame
- pointer FP. */
-
-static ADDR
-get_dyn_handler_pointer (REG fp)
-{
- /* From the frame pointer we find the procedure descriptor, and fetch
- the handler_data field from there. This field contains the offset
- from FP at which the address of the currently installed handler is
- to be found. */
-
- PDSCDEF * pd = PV_FOR (fp);
- /* Procedure descriptor pointer for the live subprogram with FP as the frame
- pointer, and to which _gcc_shell_handler is attached as a condition
- handler. */
-
- REG handler_slot_offset;
- /* Offset from FP at which the address of the currently established real
- condition handler is to be found. This offset is available from the
- handler_data field of the procedure descriptor. */
-
- REG handler_data_offset;
- /* The handler_data field position in the procedure descriptor, which
- depends on the kind of procedure at hand. */
-
- switch (pd->pdsc$w_flags & 0xf)
- {
- case PDSC$K_KIND_FP_STACK: /* [3.4.2 PD for stack frame procedures] */
- handler_data_offset = 40;
- break;
-
- case PDSC$K_KIND_FP_REGISTER: /* [3.4.5 PD for reg frame procedures] */
- handler_data_offset = 32;
- break;
-
- default:
- handler_data_offset = 0;
- break;
- }
-
- /* If we couldn't determine the handler_data field position, give up. */
- if (handler_data_offset == 0)
- return 0;
-
- /* Otherwise, fetch the fp offset at which the real handler address is to be
- found, then fetch and return the latter in turn. */
-
- handler_slot_offset = REG_AT ((REG)pd + handler_data_offset);
-
- return (ADDR) REG_AT (fp + handler_slot_offset);
-}
-
-/* The static VMS condition handler for GCC code. Fetch the address of the
- currently established condition handler, then resignal if there is none or
- call the handler with the VMS condition arguments. */
-
-long
-__gcc_shell_handler (struct chf$signal_array *sig_arr,
- struct chf$mech_array *mech_arr)
-{
- long ret;
- long (*user_handler) (struct chf$signal_array *, struct chf$mech_array *);
-
- user_handler = get_dyn_handler_pointer (mech_arr->chf$q_mch_frame);
- if (!user_handler)
- ret = SS$_RESIGNAL;
- else
- ret = user_handler (sig_arr, mech_arr);
-
- return ret;
-}
-
diff --git a/gcc/config/alpha/vms.h b/gcc/config/alpha/vms.h
index fc74c236a37..32794c80368 100644
--- a/gcc/config/alpha/vms.h
+++ b/gcc/config/alpha/vms.h
@@ -19,9 +19,6 @@ You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. */
-#define TARGET_OBJECT_SUFFIX ".obj"
-#define TARGET_EXECUTABLE_SUFFIX ".exe"
-
/* Alpha/VMS object format is not really Elf, but this makes compiling
crtstuff.c and dealing with shared library initialization much easier. */
#define OBJECT_FORMAT_ELF
@@ -33,37 +30,26 @@ along with GCC; see the file COPYING3. If not see
#define NO_EXTERNAL_INDIRECT_ADDRESS
-#define TARGET_OS_CPP_BUILTINS() \
+#define SUBTARGET_OS_CPP_BUILTINS() \
do { \
- builtin_define_std ("vms"); \
- builtin_define_std ("VMS"); \
- builtin_define ("__ALPHA"); \
- builtin_assert ("system=vms"); \
- if (TARGET_FLOAT_VAX) \
- builtin_define ("__G_FLOAT"); \
- else \
- builtin_define ("__IEEE_FLOAT"); \
+ builtin_define ("__ALPHA"); \
+ if (TARGET_FLOAT_VAX) \
+ builtin_define ("__G_FLOAT"); \
+ else \
+ builtin_define ("__IEEE_FLOAT"); \
} while (0)
#undef TARGET_DEFAULT
-#define TARGET_DEFAULT (MASK_FPREGS|MASK_GAS)
-#undef TARGET_ABI_OPEN_VMS
-#define TARGET_ABI_OPEN_VMS 1
+#if POINTER_SIZE == 64
+#define TARGET_DEFAULT (MASK_FPREGS | MASK_GAS | MASK_MALLOC64)
+#else
+#define TARGET_DEFAULT (MASK_FPREGS | MASK_GAS)
+#endif
#define VMS_DEBUG_MAIN_POINTER "TRANSFER$BREAK$GO"
#undef PCC_STATIC_STRUCT_RETURN
-/* "long" is 32 bits, but 64 bits for Ada. */
-#undef LONG_TYPE_SIZE
-#define LONG_TYPE_SIZE 32
-#define ADA_LONG_TYPE_SIZE 64
-
-/* Pointer is 32 bits but the hardware has 64-bit addresses, sign extended. */
-#undef POINTER_SIZE
-#define POINTER_SIZE 32
-#define POINTERS_EXTEND_UNSIGNED 0
-
#define MAX_OFILE_ALIGNMENT 524288 /* 8 x 2^16 by DEC Ada Test CD40VRA */
/* The maximum alignment 'malloc' honors. */
@@ -170,6 +156,12 @@ typedef struct {int num_args; enum avms_arg_type atypes[6];} avms_arg_info;
#define DEFAULT_PCC_STRUCT_RETURN 0
+#if POINTER_SIZE == 64
+/* Eventhough pointers are 64bits, only 32bit ever remain significant in code
+ addresses. */
+#define MASK_RETURN_ADDR (GEN_INT (0xffffffff))
+#endif
+
#undef ASM_WEAKEN_LABEL
#define ASM_WEAKEN_LABEL(FILE, NAME) \
do { fputs ("\t.weak\t", FILE); assemble_name (FILE, NAME); \
@@ -236,15 +228,16 @@ typedef struct {int num_args; enum avms_arg_type atypes[6];} avms_arg_info;
/* Switch into a generic section. */
#define TARGET_ASM_NAMED_SECTION vms_asm_named_section
-#define ASM_OUTPUT_DEF(FILE,LABEL1,LABEL2) \
- do { fprintf ((FILE), "\t.literals\n"); \
- in_section = NULL; \
- fprintf ((FILE), "\t"); \
- assemble_name (FILE, LABEL1); \
- fprintf (FILE, " = "); \
- assemble_name (FILE, LABEL2); \
- fprintf (FILE, "\n"); \
- } while (0)
+#define ASM_OUTPUT_DEF(FILE,LABEL1,LABEL2) \
+ do \
+ { \
+ fprintf ((FILE), "\t"); \
+ assemble_name (FILE, LABEL1); \
+ fprintf (FILE, " = "); \
+ assemble_name (FILE, LABEL2); \
+ fprintf (FILE, "\n"); \
+ } \
+ while (0)
#undef PREFERRED_DEBUGGING_TYPE
#define PREFERRED_DEBUGGING_TYPE VMS_AND_DWARF2_DEBUG
diff --git a/gcc/config/alpha/vms64.h b/gcc/config/alpha/vms64.h
deleted file mode 100644
index 495d3c6167d..00000000000
--- a/gcc/config/alpha/vms64.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/* Output variables, constants and external declarations, for GNU compiler.
- Copyright (C) 2001, 2007, 2009 Free Software Foundation, Inc.
- Contributed by Douglas Rupp (rupp@gnat.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/>. */
-
-#undef TARGET_OS_CPP_BUILTINS
-#define TARGET_OS_CPP_BUILTINS() \
- do { \
- builtin_define_std ("vms"); \
- builtin_define_std ("VMS"); \
- builtin_define ("__ALPHA"); \
- builtin_assert ("system=vms"); \
- builtin_define ("__IEEE_FLOAT"); \
- builtin_define ("__LONG_POINTERS=1"); \
- } while (0)
-
-#undef SUBTARGET_SWITCHES
-#define SUBTARGET_SWITCHES \
- { "malloc64", MASK_MALLOC64, "Malloc data into P2 space" },
-
-#undef TARGET_DEFAULT
-#define TARGET_DEFAULT (MASK_FPREGS | MASK_GAS | MASK_MALLOC64)
-
-#undef LONG_TYPE_SIZE
-#define LONG_TYPE_SIZE 64
-
-#undef POINTER_SIZE
-#define POINTER_SIZE 64
-
-/* Eventhough pointers are 64bits, only 32bit ever remain significant in code
- addresses. */
-#define MASK_RETURN_ADDR (GEN_INT (0xffffffff))
-
-/* Defaults to "long int" */
-#undef SIZE_TYPE
-#undef PTRDIFF_TYPE
diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
index e07c8c328c6..6ef6f62d28d 100644
--- a/gcc/config/arm/arm.c
+++ b/gcc/config/arm/arm.c
@@ -22216,6 +22216,8 @@ thumb1_expand_epilogue (void)
gcc_assert (amount >= 0);
if (amount)
{
+ emit_insn (gen_blockage ());
+
if (amount < 512)
emit_insn (gen_addsi3 (stack_pointer_rtx, stack_pointer_rtx,
GEN_INT (amount)));
@@ -23495,7 +23497,7 @@ arm_small_register_classes_for_mode_p (enum machine_mode mode ATTRIBUTE_UNUSED)
/* Implement TARGET_SHIFT_TRUNCATION_MASK. SImode shifts use normal
ARM insns and therefore guarantee that the shift count is modulo 256.
- DImode shifts (those implemented by lib1funcs.asm or by optabs.c)
+ DImode shifts (those implemented by lib1funcs.S or by optabs.c)
guarantee no particular behavior for out-of-range counts. */
static unsigned HOST_WIDE_INT
diff --git a/gcc/config/arm/bpabi-v6m.S b/gcc/config/arm/bpabi-v6m.S
deleted file mode 100644
index 4ecea6da5a6..00000000000
--- a/gcc/config/arm/bpabi-v6m.S
+++ /dev/null
@@ -1,318 +0,0 @@
-/* Miscellaneous BPABI functions. ARMv6M implementation
-
- Copyright (C) 2006, 2008, 2009, 2010 Free Software Foundation, Inc.
- Contributed by CodeSourcery.
-
- This file is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the
- Free Software Foundation; either version 3, or (at your option) any
- later version.
-
- This file 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/>. */
-
-#ifdef __ARM_EABI__
-/* Some attributes that are common to all routines in this file. */
- /* Tag_ABI_align_needed: This code does not require 8-byte
- alignment from the caller. */
- /* .eabi_attribute 24, 0 -- default setting. */
- /* Tag_ABI_align_preserved: This code preserves 8-byte
- alignment in any callee. */
- .eabi_attribute 25, 1
-#endif /* __ARM_EABI__ */
-
-#ifdef L_aeabi_lcmp
-
-FUNC_START aeabi_lcmp
- cmp xxh, yyh
- beq 1f
- bgt 2f
- mov r0, #1
- neg r0, r0
- RET
-2:
- mov r0, #1
- RET
-1:
- sub r0, xxl, yyl
- beq 1f
- bhi 2f
- mov r0, #1
- neg r0, r0
- RET
-2:
- mov r0, #1
-1:
- RET
- FUNC_END aeabi_lcmp
-
-#endif /* L_aeabi_lcmp */
-
-#ifdef L_aeabi_ulcmp
-
-FUNC_START aeabi_ulcmp
- cmp xxh, yyh
- bne 1f
- sub r0, xxl, yyl
- beq 2f
-1:
- bcs 1f
- mov r0, #1
- neg r0, r0
- RET
-1:
- mov r0, #1
-2:
- RET
- FUNC_END aeabi_ulcmp
-
-#endif /* L_aeabi_ulcmp */
-
-.macro test_div_by_zero signed
- cmp yyh, #0
- bne 7f
- cmp yyl, #0
- bne 7f
- cmp xxh, #0
- bne 2f
- cmp xxl, #0
-2:
- .ifc \signed, unsigned
- beq 3f
- mov xxh, #0
- mvn xxh, xxh @ 0xffffffff
- mov xxl, xxh
-3:
- .else
- beq 5f
- blt 6f
- mov xxl, #0
- mvn xxl, xxl @ 0xffffffff
- lsr xxh, xxl, #1 @ 0x7fffffff
- b 5f
-6: mov xxh, #0x80
- lsl xxh, xxh, #24 @ 0x80000000
- mov xxl, #0
-5:
- .endif
- @ tailcalls are tricky on v6-m.
- push {r0, r1, r2}
- ldr r0, 1f
- adr r1, 1f
- add r0, r1
- str r0, [sp, #8]
- @ We know we are not on armv4t, so pop pc is safe.
- pop {r0, r1, pc}
- .align 2
-1:
- .word __aeabi_ldiv0 - 1b
-7:
-.endm
-
-#ifdef L_aeabi_ldivmod
-
-FUNC_START aeabi_ldivmod
- test_div_by_zero signed
-
- push {r0, r1}
- mov r0, sp
- push {r0, lr}
- ldr r0, [sp, #8]
- bl SYM(__gnu_ldivmod_helper)
- ldr r3, [sp, #4]
- mov lr, r3
- add sp, sp, #8
- pop {r2, r3}
- RET
- FUNC_END aeabi_ldivmod
-
-#endif /* L_aeabi_ldivmod */
-
-#ifdef L_aeabi_uldivmod
-
-FUNC_START aeabi_uldivmod
- test_div_by_zero unsigned
-
- push {r0, r1}
- mov r0, sp
- push {r0, lr}
- ldr r0, [sp, #8]
- bl SYM(__gnu_uldivmod_helper)
- ldr r3, [sp, #4]
- mov lr, r3
- add sp, sp, #8
- pop {r2, r3}
- RET
- FUNC_END aeabi_uldivmod
-
-#endif /* L_aeabi_uldivmod */
-
-#ifdef L_arm_addsubsf3
-
-FUNC_START aeabi_frsub
-
- push {r4, lr}
- mov r4, #1
- lsl r4, #31
- eor r0, r0, r4
- bl __aeabi_fadd
- pop {r4, pc}
-
- FUNC_END aeabi_frsub
-
-#endif /* L_arm_addsubsf3 */
-
-#ifdef L_arm_cmpsf2
-
-FUNC_START aeabi_cfrcmple
-
- mov ip, r0
- mov r0, r1
- mov r1, ip
- b 6f
-
-FUNC_START aeabi_cfcmpeq
-FUNC_ALIAS aeabi_cfcmple aeabi_cfcmpeq
-
- @ The status-returning routines are required to preserve all
- @ registers except ip, lr, and cpsr.
-6: push {r0, r1, r2, r3, r4, lr}
- bl __lesf2
- @ Set the Z flag correctly, and the C flag unconditionally.
- cmp r0, #0
- @ Clear the C flag if the return value was -1, indicating
- @ that the first operand was smaller than the second.
- bmi 1f
- mov r1, #0
- cmn r0, r1
-1:
- pop {r0, r1, r2, r3, r4, pc}
-
- FUNC_END aeabi_cfcmple
- FUNC_END aeabi_cfcmpeq
- FUNC_END aeabi_cfrcmple
-
-FUNC_START aeabi_fcmpeq
-
- push {r4, lr}
- bl __eqsf2
- neg r0, r0
- add r0, r0, #1
- pop {r4, pc}
-
- FUNC_END aeabi_fcmpeq
-
-.macro COMPARISON cond, helper, mode=sf2
-FUNC_START aeabi_fcmp\cond
-
- push {r4, lr}
- bl __\helper\mode
- cmp r0, #0
- b\cond 1f
- mov r0, #0
- pop {r4, pc}
-1:
- mov r0, #1
- pop {r4, pc}
-
- FUNC_END aeabi_fcmp\cond
-.endm
-
-COMPARISON lt, le
-COMPARISON le, le
-COMPARISON gt, ge
-COMPARISON ge, ge
-
-#endif /* L_arm_cmpsf2 */
-
-#ifdef L_arm_addsubdf3
-
-FUNC_START aeabi_drsub
-
- push {r4, lr}
- mov r4, #1
- lsl r4, #31
- eor xxh, xxh, r4
- bl __aeabi_dadd
- pop {r4, pc}
-
- FUNC_END aeabi_drsub
-
-#endif /* L_arm_addsubdf3 */
-
-#ifdef L_arm_cmpdf2
-
-FUNC_START aeabi_cdrcmple
-
- mov ip, r0
- mov r0, r2
- mov r2, ip
- mov ip, r1
- mov r1, r3
- mov r3, ip
- b 6f
-
-FUNC_START aeabi_cdcmpeq
-FUNC_ALIAS aeabi_cdcmple aeabi_cdcmpeq
-
- @ The status-returning routines are required to preserve all
- @ registers except ip, lr, and cpsr.
-6: push {r0, r1, r2, r3, r4, lr}
- bl __ledf2
- @ Set the Z flag correctly, and the C flag unconditionally.
- cmp r0, #0
- @ Clear the C flag if the return value was -1, indicating
- @ that the first operand was smaller than the second.
- bmi 1f
- mov r1, #0
- cmn r0, r1
-1:
- pop {r0, r1, r2, r3, r4, pc}
-
- FUNC_END aeabi_cdcmple
- FUNC_END aeabi_cdcmpeq
- FUNC_END aeabi_cdrcmple
-
-FUNC_START aeabi_dcmpeq
-
- push {r4, lr}
- bl __eqdf2
- neg r0, r0
- add r0, r0, #1
- pop {r4, pc}
-
- FUNC_END aeabi_dcmpeq
-
-.macro COMPARISON cond, helper, mode=df2
-FUNC_START aeabi_dcmp\cond
-
- push {r4, lr}
- bl __\helper\mode
- cmp r0, #0
- b\cond 1f
- mov r0, #0
- pop {r4, pc}
-1:
- mov r0, #1
- pop {r4, pc}
-
- FUNC_END aeabi_dcmp\cond
-.endm
-
-COMPARISON lt, le
-COMPARISON le, le
-COMPARISON gt, ge
-COMPARISON ge, ge
-
-#endif /* L_arm_cmpdf2 */
diff --git a/gcc/config/arm/bpabi.S b/gcc/config/arm/bpabi.S
deleted file mode 100644
index 2ff338927fa..00000000000
--- a/gcc/config/arm/bpabi.S
+++ /dev/null
@@ -1,163 +0,0 @@
-/* Miscellaneous BPABI functions.
-
- Copyright (C) 2003, 2004, 2007, 2008, 2009, 2010
- Free Software Foundation, Inc.
- Contributed by CodeSourcery, LLC.
-
- This file is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the
- Free Software Foundation; either version 3, or (at your option) any
- later version.
-
- This file 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/>. */
-
-#ifdef __ARM_EABI__
-/* Some attributes that are common to all routines in this file. */
- /* Tag_ABI_align_needed: This code does not require 8-byte
- alignment from the caller. */
- /* .eabi_attribute 24, 0 -- default setting. */
- /* Tag_ABI_align_preserved: This code preserves 8-byte
- alignment in any callee. */
- .eabi_attribute 25, 1
-#endif /* __ARM_EABI__ */
-
-#ifdef L_aeabi_lcmp
-
-ARM_FUNC_START aeabi_lcmp
- cmp xxh, yyh
- do_it lt
- movlt r0, #-1
- do_it gt
- movgt r0, #1
- do_it ne
- RETc(ne)
- subs r0, xxl, yyl
- do_it lo
- movlo r0, #-1
- do_it hi
- movhi r0, #1
- RET
- FUNC_END aeabi_lcmp
-
-#endif /* L_aeabi_lcmp */
-
-#ifdef L_aeabi_ulcmp
-
-ARM_FUNC_START aeabi_ulcmp
- cmp xxh, yyh
- do_it lo
- movlo r0, #-1
- do_it hi
- movhi r0, #1
- do_it ne
- RETc(ne)
- cmp xxl, yyl
- do_it lo
- movlo r0, #-1
- do_it hi
- movhi r0, #1
- do_it eq
- moveq r0, #0
- RET
- FUNC_END aeabi_ulcmp
-
-#endif /* L_aeabi_ulcmp */
-
-.macro test_div_by_zero signed
-/* Tail-call to divide-by-zero handlers which may be overridden by the user,
- so unwinding works properly. */
-#if defined(__thumb2__)
- cbnz yyh, 1f
- cbnz yyl, 1f
- cmp xxh, #0
- do_it eq
- cmpeq xxl, #0
- .ifc \signed, unsigned
- beq 2f
- mov xxh, #0xffffffff
- mov xxl, xxh
-2:
- .else
- do_it lt, t
- movlt xxl, #0
- movlt xxh, #0x80000000
- do_it gt, t
- movgt xxh, #0x7fffffff
- movgt xxl, #0xffffffff
- .endif
- b SYM (__aeabi_ldiv0) __PLT__
-1:
-#else
- /* Note: Thumb-1 code calls via an ARM shim on processors which
- support ARM mode. */
- cmp yyh, #0
- cmpeq yyl, #0
- bne 2f
- cmp xxh, #0
- cmpeq xxl, #0
- .ifc \signed, unsigned
- movne xxh, #0xffffffff
- movne xxl, #0xffffffff
- .else
- movlt xxh, #0x80000000
- movlt xxl, #0
- movgt xxh, #0x7fffffff
- movgt xxl, #0xffffffff
- .endif
- b SYM (__aeabi_ldiv0) __PLT__
-2:
-#endif
-.endm
-
-#ifdef L_aeabi_ldivmod
-
-ARM_FUNC_START aeabi_ldivmod
- test_div_by_zero signed
-
- sub sp, sp, #8
-#if defined(__thumb2__)
- mov ip, sp
- push {ip, lr}
-#else
- do_push {sp, lr}
-#endif
- bl SYM(__gnu_ldivmod_helper) __PLT__
- ldr lr, [sp, #4]
- add sp, sp, #8
- do_pop {r2, r3}
- RET
-
-#endif /* L_aeabi_ldivmod */
-
-#ifdef L_aeabi_uldivmod
-
-ARM_FUNC_START aeabi_uldivmod
- test_div_by_zero unsigned
-
- sub sp, sp, #8
-#if defined(__thumb2__)
- mov ip, sp
- push {ip, lr}
-#else
- do_push {sp, lr}
-#endif
- bl SYM(__gnu_uldivmod_helper) __PLT__
- ldr lr, [sp, #4]
- add sp, sp, #8
- do_pop {r2, r3}
- RET
-
-#endif /* L_aeabi_divmod */
-
diff --git a/gcc/config/arm/bpabi.c b/gcc/config/arm/bpabi.c
deleted file mode 100644
index 283bdc0acf0..00000000000
--- a/gcc/config/arm/bpabi.c
+++ /dev/null
@@ -1,56 +0,0 @@
-/* Miscellaneous BPABI functions.
-
- Copyright (C) 2003, 2004, 2009 Free Software Foundation, Inc.
- Contributed by CodeSourcery, LLC.
-
- This file is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the
- Free Software Foundation; either version 3, or (at your option) any
- later version.
-
- This file 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/>. */
-
-extern long long __divdi3 (long long, long long);
-extern unsigned long long __udivdi3 (unsigned long long,
- unsigned long long);
-extern long long __gnu_ldivmod_helper (long long, long long, long long *);
-extern unsigned long long __gnu_uldivmod_helper (unsigned long long,
- unsigned long long,
- unsigned long long *);
-
-
-long long
-__gnu_ldivmod_helper (long long a,
- long long b,
- long long *remainder)
-{
- long long quotient;
-
- quotient = __divdi3 (a, b);
- *remainder = a - b * quotient;
- return quotient;
-}
-
-unsigned long long
-__gnu_uldivmod_helper (unsigned long long a,
- unsigned long long b,
- unsigned long long *remainder)
-{
- unsigned long long quotient;
-
- quotient = __udivdi3 (a, b);
- *remainder = a - b * quotient;
- return quotient;
-}
diff --git a/gcc/config/arm/bpabi.h b/gcc/config/arm/bpabi.h
index 20ff2f82929..64d7df4b251 100644
--- a/gcc/config/arm/bpabi.h
+++ b/gcc/config/arm/bpabi.h
@@ -58,6 +58,7 @@
#define BE8_LINK_SPEC \
" %{mbig-endian:%{march=armv7-a|mcpu=cortex-a5 \
|mcpu=cortex-a8|mcpu=cortex-a9|mcpu=cortex-a15 \
+ |mcpu=generic-armv7-a \
|march=armv7-m|mcpu=cortex-m3 \
|march=armv7e-m|mcpu=cortex-m4 \
|march=armv6-m|mcpu=cortex-m0 \
diff --git a/gcc/config/arm/crti.asm b/gcc/config/arm/crti.asm
deleted file mode 100644
index 9454273dd29..00000000000
--- a/gcc/config/arm/crti.asm
+++ /dev/null
@@ -1,86 +0,0 @@
-# Copyright (C) 2001, 2008, 2009, 2010 Free Software Foundation, Inc.
-# Written By Nick Clifton
-#
-# This file is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the
-# Free Software Foundation; either version 3, or (at your option) any
-# later version.
-#
-# This file 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/>.
-
-/* An executable stack is *not* required for these functions. */
-#if defined(__ELF__) && defined(__linux__)
-.section .note.GNU-stack,"",%progbits
-.previous
-#endif
-
-# This file just make a stack frame for the contents of the .fini and
-# .init sections. Users may put any desired instructions in those
-# sections.
-
-#ifdef __ELF__
-#define TYPE(x) .type x,function
-#else
-#define TYPE(x)
-#endif
-#ifdef __ARM_EABI__
-/* Some attributes that are common to all routines in this file. */
- /* Tag_ABI_align_needed: This code does not require 8-byte
- alignment from the caller. */
- /* .eabi_attribute 24, 0 -- default setting. */
- /* Tag_ABI_align_preserved: This code preserves 8-byte
- alignment in any callee. */
- .eabi_attribute 25, 1
-#endif /* __ARM_EABI__ */
-
- # Note - this macro is complemented by the FUNC_END macro
- # in crtn.asm. If you change this macro you must also change
- # that macro match.
-.macro FUNC_START
-#ifdef __thumb__
- .thumb
-
- push {r3, r4, r5, r6, r7, lr}
-#else
- .arm
- # Create a stack frame and save any call-preserved registers
- mov ip, sp
- stmdb sp!, {r3, r4, r5, r6, r7, r8, r9, sl, fp, ip, lr, pc}
- sub fp, ip, #4
-#endif
-.endm
-
- .section ".init"
- .align 2
- .global _init
-#ifdef __thumb__
- .thumb_func
-#endif
- TYPE(_init)
-_init:
- FUNC_START
-
-
- .section ".fini"
- .align 2
- .global _fini
-#ifdef __thumb__
- .thumb_func
-#endif
- TYPE(_fini)
-_fini:
- FUNC_START
-
-# end of crti.asm
diff --git a/gcc/config/arm/crtn.asm b/gcc/config/arm/crtn.asm
deleted file mode 100644
index c7f90814d79..00000000000
--- a/gcc/config/arm/crtn.asm
+++ /dev/null
@@ -1,82 +0,0 @@
-# Copyright (C) 2001, 2004, 2008, 2009, 2010 Free Software Foundation, Inc.
-# Written By Nick Clifton
-#
-# This file is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the
-# Free Software Foundation; either version 3, or (at your option) any
-# later version.
-#
-# This file 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/>.
-
-/* An executable stack is *not* required for these functions. */
-#if defined(__ELF__) && defined(__linux__)
-.section .note.GNU-stack,"",%progbits
-.previous
-#endif
-
-#ifdef __ARM_EABI__
-/* Some attributes that are common to all routines in this file. */
- /* Tag_ABI_align_needed: This code does not require 8-byte
- alignment from the caller. */
- /* .eabi_attribute 24, 0 -- default setting. */
- /* Tag_ABI_align_preserved: This code preserves 8-byte
- alignment in any callee. */
- .eabi_attribute 25, 1
-#endif /* __ARM_EABI__ */
-
-# This file just makes sure that the .fini and .init sections do in
-# fact return. Users may put any desired instructions in those sections.
-# This file is the last thing linked into any executable.
-
- # Note - this macro is complemented by the FUNC_START macro
- # in crti.asm. If you change this macro you must also change
- # that macro match.
- #
- # Note - we do not try any fancy optimizations of the return
- # sequences here, it is just not worth it. Instead keep things
- # simple. Restore all the save resgisters, including the link
- # register and then perform the correct function return instruction.
- # We also save/restore r3 to ensure stack alignment.
-.macro FUNC_END
-#ifdef __thumb__
- .thumb
-
- pop {r3, r4, r5, r6, r7}
- pop {r3}
- mov lr, r3
-#else
- .arm
-
- sub sp, fp, #40
- ldmfd sp, {r4, r5, r6, r7, r8, r9, sl, fp, sp, lr}
-#endif
-
-#if defined __THUMB_INTERWORK__ || defined __thumb__
- bx lr
-#else
- mov pc, lr
-#endif
-.endm
-
-
- .section ".init"
- ;;
- FUNC_END
-
- .section ".fini"
- ;;
- FUNC_END
-
-# end of crtn.asm
diff --git a/gcc/config/arm/fp16.c b/gcc/config/arm/fp16.c
deleted file mode 100644
index 936caeb78d0..00000000000
--- a/gcc/config/arm/fp16.c
+++ /dev/null
@@ -1,145 +0,0 @@
-/* Half-float conversion routines.
-
- Copyright (C) 2008, 2009 Free Software Foundation, Inc.
- Contributed by CodeSourcery.
-
- This file is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the
- Free Software Foundation; either version 3, or (at your option) any
- later version.
-
- This file 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/>. */
-
-static inline unsigned short
-__gnu_f2h_internal(unsigned int a, int ieee)
-{
- unsigned short sign = (a >> 16) & 0x8000;
- int aexp = (a >> 23) & 0xff;
- unsigned int mantissa = a & 0x007fffff;
- unsigned int mask;
- unsigned int increment;
-
- if (aexp == 0xff)
- {
- if (!ieee)
- return sign;
- return sign | 0x7e00 | (mantissa >> 13);
- }
-
- if (aexp == 0 && mantissa == 0)
- return sign;
-
- aexp -= 127;
-
- /* Decimal point between bits 22 and 23. */
- mantissa |= 0x00800000;
- if (aexp < -14)
- {
- mask = 0x007fffff;
- if (aexp < -25)
- aexp = -26;
- else if (aexp != -25)
- mask >>= 24 + aexp;
- }
- else
- mask = 0x00001fff;
-
- /* Round. */
- if (mantissa & mask)
- {
- increment = (mask + 1) >> 1;
- if ((mantissa & mask) == increment)
- increment = mantissa & (increment << 1);
- mantissa += increment;
- if (mantissa >= 0x01000000)
- {
- mantissa >>= 1;
- aexp++;
- }
- }
-
- if (ieee)
- {
- if (aexp > 15)
- return sign | 0x7c00;
- }
- else
- {
- if (aexp > 16)
- return sign | 0x7fff;
- }
-
- if (aexp < -24)
- return sign;
-
- if (aexp < -14)
- {
- mantissa >>= -14 - aexp;
- aexp = -14;
- }
-
- /* We leave the leading 1 in the mantissa, and subtract one
- from the exponent bias to compensate. */
- return sign | (((aexp + 14) << 10) + (mantissa >> 13));
-}
-
-unsigned int
-__gnu_h2f_internal(unsigned short a, int ieee)
-{
- unsigned int sign = (unsigned int)(a & 0x8000) << 16;
- int aexp = (a >> 10) & 0x1f;
- unsigned int mantissa = a & 0x3ff;
-
- if (aexp == 0x1f && ieee)
- return sign | 0x7f800000 | (mantissa << 13);
-
- if (aexp == 0)
- {
- int shift;
-
- if (mantissa == 0)
- return sign;
-
- shift = __builtin_clz(mantissa) - 21;
- mantissa <<= shift;
- aexp = -shift;
- }
-
- return sign | (((aexp + 0x70) << 23) + (mantissa << 13));
-}
-
-unsigned short
-__gnu_f2h_ieee(unsigned int a)
-{
- return __gnu_f2h_internal(a, 1);
-}
-
-unsigned int
-__gnu_h2f_ieee(unsigned short a)
-{
- return __gnu_h2f_internal(a, 1);
-}
-
-unsigned short
-__gnu_f2h_alternative(unsigned int x)
-{
- return __gnu_f2h_internal(x, 0);
-}
-
-unsigned int
-__gnu_h2f_alternative(unsigned short a)
-{
- return __gnu_h2f_internal(a, 0);
-}
diff --git a/gcc/config/arm/ieee754-df.S b/gcc/config/arm/ieee754-df.S
deleted file mode 100644
index eb0c38632d0..00000000000
--- a/gcc/config/arm/ieee754-df.S
+++ /dev/null
@@ -1,1447 +0,0 @@
-/* ieee754-df.S double-precision floating point support for ARM
-
- Copyright (C) 2003, 2004, 2005, 2007, 2008, 2009 Free Software Foundation, Inc.
- Contributed by Nicolas Pitre (nico@cam.org)
-
- This file is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the
- Free Software Foundation; either version 3, or (at your option) any
- later version.
-
- This file 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/>. */
-
-/*
- * Notes:
- *
- * The goal of this code is to be as fast as possible. This is
- * not meant to be easy to understand for the casual reader.
- * For slightly simpler code please see the single precision version
- * of this file.
- *
- * Only the default rounding mode is intended for best performances.
- * Exceptions aren't supported yet, but that can be added quite easily
- * if necessary without impacting performances.
- */
-
-
-@ For FPA, float words are always big-endian.
-@ For VFP, floats words follow the memory system mode.
-#if defined(__VFP_FP__) && !defined(__ARMEB__)
-#define xl r0
-#define xh r1
-#define yl r2
-#define yh r3
-#else
-#define xh r0
-#define xl r1
-#define yh r2
-#define yl r3
-#endif
-
-
-#ifdef L_arm_negdf2
-
-ARM_FUNC_START negdf2
-ARM_FUNC_ALIAS aeabi_dneg negdf2
-
- @ flip sign bit
- eor xh, xh, #0x80000000
- RET
-
- FUNC_END aeabi_dneg
- FUNC_END negdf2
-
-#endif
-
-#ifdef L_arm_addsubdf3
-
-ARM_FUNC_START aeabi_drsub
-
- eor xh, xh, #0x80000000 @ flip sign bit of first arg
- b 1f
-
-ARM_FUNC_START subdf3
-ARM_FUNC_ALIAS aeabi_dsub subdf3
-
- eor yh, yh, #0x80000000 @ flip sign bit of second arg
-#if defined(__INTERWORKING_STUBS__)
- b 1f @ Skip Thumb-code prologue
-#endif
-
-ARM_FUNC_START adddf3
-ARM_FUNC_ALIAS aeabi_dadd adddf3
-
-1: do_push {r4, r5, lr}
-
- @ Look for zeroes, equal values, INF, or NAN.
- shift1 lsl, r4, xh, #1
- shift1 lsl, r5, yh, #1
- teq r4, r5
- do_it eq
- teqeq xl, yl
- do_it ne, ttt
- COND(orr,s,ne) ip, r4, xl
- COND(orr,s,ne) ip, r5, yl
- COND(mvn,s,ne) ip, r4, asr #21
- COND(mvn,s,ne) ip, r5, asr #21
- beq LSYM(Lad_s)
-
- @ Compute exponent difference. Make largest exponent in r4,
- @ corresponding arg in xh-xl, and positive exponent difference in r5.
- shift1 lsr, r4, r4, #21
- rsbs r5, r4, r5, lsr #21
- do_it lt
- rsblt r5, r5, #0
- ble 1f
- add r4, r4, r5
- eor yl, xl, yl
- eor yh, xh, yh
- eor xl, yl, xl
- eor xh, yh, xh
- eor yl, xl, yl
- eor yh, xh, yh
-1:
- @ If exponent difference is too large, return largest argument
- @ already in xh-xl. We need up to 54 bit to handle proper rounding
- @ of 0x1p54 - 1.1.
- cmp r5, #54
- do_it hi
- RETLDM "r4, r5" hi
-
- @ Convert mantissa to signed integer.
- tst xh, #0x80000000
- mov xh, xh, lsl #12
- mov ip, #0x00100000
- orr xh, ip, xh, lsr #12
- beq 1f
-#if defined(__thumb2__)
- negs xl, xl
- sbc xh, xh, xh, lsl #1
-#else
- rsbs xl, xl, #0
- rsc xh, xh, #0
-#endif
-1:
- tst yh, #0x80000000
- mov yh, yh, lsl #12
- orr yh, ip, yh, lsr #12
- beq 1f
-#if defined(__thumb2__)
- negs yl, yl
- sbc yh, yh, yh, lsl #1
-#else
- rsbs yl, yl, #0
- rsc yh, yh, #0
-#endif
-1:
- @ If exponent == difference, one or both args were denormalized.
- @ Since this is not common case, rescale them off line.
- teq r4, r5
- beq LSYM(Lad_d)
-LSYM(Lad_x):
-
- @ Compensate for the exponent overlapping the mantissa MSB added later
- sub r4, r4, #1
-
- @ Shift yh-yl right per r5, add to xh-xl, keep leftover bits into ip.
- rsbs lr, r5, #32
- blt 1f
- shift1 lsl, ip, yl, lr
- shiftop adds xl xl yl lsr r5 yl
- adc xh, xh, #0
- shiftop adds xl xl yh lsl lr yl
- shiftop adcs xh xh yh asr r5 yh
- b 2f
-1: sub r5, r5, #32
- add lr, lr, #32
- cmp yl, #1
- shift1 lsl,ip, yh, lr
- do_it cs
- orrcs ip, ip, #2 @ 2 not 1, to allow lsr #1 later
- shiftop adds xl xl yh asr r5 yh
- adcs xh, xh, yh, asr #31
-2:
- @ We now have a result in xh-xl-ip.
- @ Keep absolute value in xh-xl-ip, sign in r5 (the n bit was set above)
- and r5, xh, #0x80000000
- bpl LSYM(Lad_p)
-#if defined(__thumb2__)
- mov lr, #0
- negs ip, ip
- sbcs xl, lr, xl
- sbc xh, lr, xh
-#else
- rsbs ip, ip, #0
- rscs xl, xl, #0
- rsc xh, xh, #0
-#endif
-
- @ Determine how to normalize the result.
-LSYM(Lad_p):
- cmp xh, #0x00100000
- bcc LSYM(Lad_a)
- cmp xh, #0x00200000
- bcc LSYM(Lad_e)
-
- @ Result needs to be shifted right.
- movs xh, xh, lsr #1
- movs xl, xl, rrx
- mov ip, ip, rrx
- add r4, r4, #1
-
- @ Make sure we did not bust our exponent.
- mov r2, r4, lsl #21
- cmn r2, #(2 << 21)
- bcs LSYM(Lad_o)
-
- @ Our result is now properly aligned into xh-xl, remaining bits in ip.
- @ Round with MSB of ip. If halfway between two numbers, round towards
- @ LSB of xl = 0.
- @ Pack final result together.
-LSYM(Lad_e):
- cmp ip, #0x80000000
- do_it eq
- COND(mov,s,eq) ip, xl, lsr #1
- adcs xl, xl, #0
- adc xh, xh, r4, lsl #20
- orr xh, xh, r5
- RETLDM "r4, r5"
-
- @ Result must be shifted left and exponent adjusted.
-LSYM(Lad_a):
- movs ip, ip, lsl #1
- adcs xl, xl, xl
- adc xh, xh, xh
- tst xh, #0x00100000
- sub r4, r4, #1
- bne LSYM(Lad_e)
-
- @ No rounding necessary since ip will always be 0 at this point.
-LSYM(Lad_l):
-
-#if __ARM_ARCH__ < 5
-
- teq xh, #0
- movne r3, #20
- moveq r3, #52
- moveq xh, xl
- moveq xl, #0
- mov r2, xh
- cmp r2, #(1 << 16)
- movhs r2, r2, lsr #16
- subhs r3, r3, #16
- cmp r2, #(1 << 8)
- movhs r2, r2, lsr #8
- subhs r3, r3, #8
- cmp r2, #(1 << 4)
- movhs r2, r2, lsr #4
- subhs r3, r3, #4
- cmp r2, #(1 << 2)
- subhs r3, r3, #2
- sublo r3, r3, r2, lsr #1
- sub r3, r3, r2, lsr #3
-
-#else
-
- teq xh, #0
- do_it eq, t
- moveq xh, xl
- moveq xl, #0
- clz r3, xh
- do_it eq
- addeq r3, r3, #32
- sub r3, r3, #11
-
-#endif
-
- @ determine how to shift the value.
- subs r2, r3, #32
- bge 2f
- adds r2, r2, #12
- ble 1f
-
- @ shift value left 21 to 31 bits, or actually right 11 to 1 bits
- @ since a register switch happened above.
- add ip, r2, #20
- rsb r2, r2, #12
- shift1 lsl, xl, xh, ip
- shift1 lsr, xh, xh, r2
- b 3f
-
- @ actually shift value left 1 to 20 bits, which might also represent
- @ 32 to 52 bits if counting the register switch that happened earlier.
-1: add r2, r2, #20
-2: do_it le
- rsble ip, r2, #32
- shift1 lsl, xh, xh, r2
-#if defined(__thumb2__)
- lsr ip, xl, ip
- itt le
- orrle xh, xh, ip
- lslle xl, xl, r2
-#else
- orrle xh, xh, xl, lsr ip
- movle xl, xl, lsl r2
-#endif
-
- @ adjust exponent accordingly.
-3: subs r4, r4, r3
- do_it ge, tt
- addge xh, xh, r4, lsl #20
- orrge xh, xh, r5
- RETLDM "r4, r5" ge
-
- @ Exponent too small, denormalize result.
- @ Find out proper shift value.
- mvn r4, r4
- subs r4, r4, #31
- bge 2f
- adds r4, r4, #12
- bgt 1f
-
- @ shift result right of 1 to 20 bits, sign is in r5.
- add r4, r4, #20
- rsb r2, r4, #32
- shift1 lsr, xl, xl, r4
- shiftop orr xl xl xh lsl r2 yh
- shiftop orr xh r5 xh lsr r4 yh
- RETLDM "r4, r5"
-
- @ shift result right of 21 to 31 bits, or left 11 to 1 bits after
- @ a register switch from xh to xl.
-1: rsb r4, r4, #12
- rsb r2, r4, #32
- shift1 lsr, xl, xl, r2
- shiftop orr xl xl xh lsl r4 yh
- mov xh, r5
- RETLDM "r4, r5"
-
- @ Shift value right of 32 to 64 bits, or 0 to 32 bits after a switch
- @ from xh to xl.
-2: shift1 lsr, xl, xh, r4
- mov xh, r5
- RETLDM "r4, r5"
-
- @ Adjust exponents for denormalized arguments.
- @ Note that r4 must not remain equal to 0.
-LSYM(Lad_d):
- teq r4, #0
- eor yh, yh, #0x00100000
- do_it eq, te
- eoreq xh, xh, #0x00100000
- addeq r4, r4, #1
- subne r5, r5, #1
- b LSYM(Lad_x)
-
-
-LSYM(Lad_s):
- mvns ip, r4, asr #21
- do_it ne
- COND(mvn,s,ne) ip, r5, asr #21
- beq LSYM(Lad_i)
-
- teq r4, r5
- do_it eq
- teqeq xl, yl
- beq 1f
-
- @ Result is x + 0.0 = x or 0.0 + y = y.
- orrs ip, r4, xl
- do_it eq, t
- moveq xh, yh
- moveq xl, yl
- RETLDM "r4, r5"
-
-1: teq xh, yh
-
- @ Result is x - x = 0.
- do_it ne, tt
- movne xh, #0
- movne xl, #0
- RETLDM "r4, r5" ne
-
- @ Result is x + x = 2x.
- movs ip, r4, lsr #21
- bne 2f
- movs xl, xl, lsl #1
- adcs xh, xh, xh
- do_it cs
- orrcs xh, xh, #0x80000000
- RETLDM "r4, r5"
-2: adds r4, r4, #(2 << 21)
- do_it cc, t
- addcc xh, xh, #(1 << 20)
- RETLDM "r4, r5" cc
- and r5, xh, #0x80000000
-
- @ Overflow: return INF.
-LSYM(Lad_o):
- orr xh, r5, #0x7f000000
- orr xh, xh, #0x00f00000
- mov xl, #0
- RETLDM "r4, r5"
-
- @ At least one of x or y is INF/NAN.
- @ if xh-xl != INF/NAN: return yh-yl (which is INF/NAN)
- @ if yh-yl != INF/NAN: return xh-xl (which is INF/NAN)
- @ if either is NAN: return NAN
- @ if opposite sign: return NAN
- @ otherwise return xh-xl (which is INF or -INF)
-LSYM(Lad_i):
- mvns ip, r4, asr #21
- do_it ne, te
- movne xh, yh
- movne xl, yl
- COND(mvn,s,eq) ip, r5, asr #21
- do_it ne, t
- movne yh, xh
- movne yl, xl
- orrs r4, xl, xh, lsl #12
- do_it eq, te
- COND(orr,s,eq) r5, yl, yh, lsl #12
- teqeq xh, yh
- orrne xh, xh, #0x00080000 @ quiet NAN
- RETLDM "r4, r5"
-
- FUNC_END aeabi_dsub
- FUNC_END subdf3
- FUNC_END aeabi_dadd
- FUNC_END adddf3
-
-ARM_FUNC_START floatunsidf
-ARM_FUNC_ALIAS aeabi_ui2d floatunsidf
-
- teq r0, #0
- do_it eq, t
- moveq r1, #0
- RETc(eq)
- do_push {r4, r5, lr}
- mov r4, #0x400 @ initial exponent
- add r4, r4, #(52-1 - 1)
- mov r5, #0 @ sign bit is 0
- .ifnc xl, r0
- mov xl, r0
- .endif
- mov xh, #0
- b LSYM(Lad_l)
-
- FUNC_END aeabi_ui2d
- FUNC_END floatunsidf
-
-ARM_FUNC_START floatsidf
-ARM_FUNC_ALIAS aeabi_i2d floatsidf
-
- teq r0, #0
- do_it eq, t
- moveq r1, #0
- RETc(eq)
- do_push {r4, r5, lr}
- mov r4, #0x400 @ initial exponent
- add r4, r4, #(52-1 - 1)
- ands r5, r0, #0x80000000 @ sign bit in r5
- do_it mi
- rsbmi r0, r0, #0 @ absolute value
- .ifnc xl, r0
- mov xl, r0
- .endif
- mov xh, #0
- b LSYM(Lad_l)
-
- FUNC_END aeabi_i2d
- FUNC_END floatsidf
-
-ARM_FUNC_START extendsfdf2
-ARM_FUNC_ALIAS aeabi_f2d extendsfdf2
-
- movs r2, r0, lsl #1 @ toss sign bit
- mov xh, r2, asr #3 @ stretch exponent
- mov xh, xh, rrx @ retrieve sign bit
- mov xl, r2, lsl #28 @ retrieve remaining bits
- do_it ne, ttt
- COND(and,s,ne) r3, r2, #0xff000000 @ isolate exponent
- teqne r3, #0xff000000 @ if not 0, check if INF or NAN
- eorne xh, xh, #0x38000000 @ fixup exponent otherwise.
- RETc(ne) @ and return it.
-
- teq r2, #0 @ if actually 0
- do_it ne, e
- teqne r3, #0xff000000 @ or INF or NAN
- RETc(eq) @ we are done already.
-
- @ value was denormalized. We can normalize it now.
- do_push {r4, r5, lr}
- mov r4, #0x380 @ setup corresponding exponent
- and r5, xh, #0x80000000 @ move sign bit in r5
- bic xh, xh, #0x80000000
- b LSYM(Lad_l)
-
- FUNC_END aeabi_f2d
- FUNC_END extendsfdf2
-
-ARM_FUNC_START floatundidf
-ARM_FUNC_ALIAS aeabi_ul2d floatundidf
-
- orrs r2, r0, r1
-#if !defined (__VFP_FP__) && !defined(__SOFTFP__)
- do_it eq, t
- mvfeqd f0, #0.0
-#else
- do_it eq
-#endif
- RETc(eq)
-
-#if !defined (__VFP_FP__) && !defined(__SOFTFP__)
- @ For hard FPA code we want to return via the tail below so that
- @ we can return the result in f0 as well as in r0/r1 for backwards
- @ compatibility.
- adr ip, LSYM(f0_ret)
- @ Push pc as well so that RETLDM works correctly.
- do_push {r4, r5, ip, lr, pc}
-#else
- do_push {r4, r5, lr}
-#endif
-
- mov r5, #0
- b 2f
-
-ARM_FUNC_START floatdidf
-ARM_FUNC_ALIAS aeabi_l2d floatdidf
-
- orrs r2, r0, r1
-#if !defined (__VFP_FP__) && !defined(__SOFTFP__)
- do_it eq, t
- mvfeqd f0, #0.0
-#else
- do_it eq
-#endif
- RETc(eq)
-
-#if !defined (__VFP_FP__) && !defined(__SOFTFP__)
- @ For hard FPA code we want to return via the tail below so that
- @ we can return the result in f0 as well as in r0/r1 for backwards
- @ compatibility.
- adr ip, LSYM(f0_ret)
- @ Push pc as well so that RETLDM works correctly.
- do_push {r4, r5, ip, lr, pc}
-#else
- do_push {r4, r5, lr}
-#endif
-
- ands r5, ah, #0x80000000 @ sign bit in r5
- bpl 2f
-#if defined(__thumb2__)
- negs al, al
- sbc ah, ah, ah, lsl #1
-#else
- rsbs al, al, #0
- rsc ah, ah, #0
-#endif
-2:
- mov r4, #0x400 @ initial exponent
- add r4, r4, #(52-1 - 1)
-
- @ FPA little-endian: must swap the word order.
- .ifnc xh, ah
- mov ip, al
- mov xh, ah
- mov xl, ip
- .endif
-
- movs ip, xh, lsr #22
- beq LSYM(Lad_p)
-
- @ The value is too big. Scale it down a bit...
- mov r2, #3
- movs ip, ip, lsr #3
- do_it ne
- addne r2, r2, #3
- movs ip, ip, lsr #3
- do_it ne
- addne r2, r2, #3
- add r2, r2, ip, lsr #3
-
- rsb r3, r2, #32
- shift1 lsl, ip, xl, r3
- shift1 lsr, xl, xl, r2
- shiftop orr xl xl xh lsl r3 lr
- shift1 lsr, xh, xh, r2
- add r4, r4, r2
- b LSYM(Lad_p)
-
-#if !defined (__VFP_FP__) && !defined(__SOFTFP__)
-
- @ Legacy code expects the result to be returned in f0. Copy it
- @ there as well.
-LSYM(f0_ret):
- do_push {r0, r1}
- ldfd f0, [sp], #8
- RETLDM
-
-#endif
-
- FUNC_END floatdidf
- FUNC_END aeabi_l2d
- FUNC_END floatundidf
- FUNC_END aeabi_ul2d
-
-#endif /* L_addsubdf3 */
-
-#ifdef L_arm_muldivdf3
-
-ARM_FUNC_START muldf3
-ARM_FUNC_ALIAS aeabi_dmul muldf3
- do_push {r4, r5, r6, lr}
-
- @ Mask out exponents, trap any zero/denormal/INF/NAN.
- mov ip, #0xff
- orr ip, ip, #0x700
- ands r4, ip, xh, lsr #20
- do_it ne, tte
- COND(and,s,ne) r5, ip, yh, lsr #20
- teqne r4, ip
- teqne r5, ip
- bleq LSYM(Lml_s)
-
- @ Add exponents together
- add r4, r4, r5
-
- @ Determine final sign.
- eor r6, xh, yh
-
- @ Convert mantissa to unsigned integer.
- @ If power of two, branch to a separate path.
- bic xh, xh, ip, lsl #21
- bic yh, yh, ip, lsl #21
- orrs r5, xl, xh, lsl #12
- do_it ne
- COND(orr,s,ne) r5, yl, yh, lsl #12
- orr xh, xh, #0x00100000
- orr yh, yh, #0x00100000
- beq LSYM(Lml_1)
-
-#if __ARM_ARCH__ < 4
-
- @ Put sign bit in r6, which will be restored in yl later.
- and r6, r6, #0x80000000
-
- @ Well, no way to make it shorter without the umull instruction.
- stmfd sp!, {r6, r7, r8, r9, sl, fp}
- mov r7, xl, lsr #16
- mov r8, yl, lsr #16
- mov r9, xh, lsr #16
- mov sl, yh, lsr #16
- bic xl, xl, r7, lsl #16
- bic yl, yl, r8, lsl #16
- bic xh, xh, r9, lsl #16
- bic yh, yh, sl, lsl #16
- mul ip, xl, yl
- mul fp, xl, r8
- mov lr, #0
- adds ip, ip, fp, lsl #16
- adc lr, lr, fp, lsr #16
- mul fp, r7, yl
- adds ip, ip, fp, lsl #16
- adc lr, lr, fp, lsr #16
- mul fp, xl, sl
- mov r5, #0
- adds lr, lr, fp, lsl #16
- adc r5, r5, fp, lsr #16
- mul fp, r7, yh
- adds lr, lr, fp, lsl #16
- adc r5, r5, fp, lsr #16
- mul fp, xh, r8
- adds lr, lr, fp, lsl #16
- adc r5, r5, fp, lsr #16
- mul fp, r9, yl
- adds lr, lr, fp, lsl #16
- adc r5, r5, fp, lsr #16
- mul fp, xh, sl
- mul r6, r9, sl
- adds r5, r5, fp, lsl #16
- adc r6, r6, fp, lsr #16
- mul fp, r9, yh
- adds r5, r5, fp, lsl #16
- adc r6, r6, fp, lsr #16
- mul fp, xl, yh
- adds lr, lr, fp
- mul fp, r7, sl
- adcs r5, r5, fp
- mul fp, xh, yl
- adc r6, r6, #0
- adds lr, lr, fp
- mul fp, r9, r8
- adcs r5, r5, fp
- mul fp, r7, r8
- adc r6, r6, #0
- adds lr, lr, fp
- mul fp, xh, yh
- adcs r5, r5, fp
- adc r6, r6, #0
- ldmfd sp!, {yl, r7, r8, r9, sl, fp}
-
-#else
-
- @ Here is the actual multiplication.
- umull ip, lr, xl, yl
- mov r5, #0
- umlal lr, r5, xh, yl
- and yl, r6, #0x80000000
- umlal lr, r5, xl, yh
- mov r6, #0
- umlal r5, r6, xh, yh
-
-#endif
-
- @ The LSBs in ip are only significant for the final rounding.
- @ Fold them into lr.
- teq ip, #0
- do_it ne
- orrne lr, lr, #1
-
- @ Adjust result upon the MSB position.
- sub r4, r4, #0xff
- cmp r6, #(1 << (20-11))
- sbc r4, r4, #0x300
- bcs 1f
- movs lr, lr, lsl #1
- adcs r5, r5, r5
- adc r6, r6, r6
-1:
- @ Shift to final position, add sign to result.
- orr xh, yl, r6, lsl #11
- orr xh, xh, r5, lsr #21
- mov xl, r5, lsl #11
- orr xl, xl, lr, lsr #21
- mov lr, lr, lsl #11
-
- @ Check exponent range for under/overflow.
- subs ip, r4, #(254 - 1)
- do_it hi
- cmphi ip, #0x700
- bhi LSYM(Lml_u)
-
- @ Round the result, merge final exponent.
- cmp lr, #0x80000000
- do_it eq
- COND(mov,s,eq) lr, xl, lsr #1
- adcs xl, xl, #0
- adc xh, xh, r4, lsl #20
- RETLDM "r4, r5, r6"
-
- @ Multiplication by 0x1p*: let''s shortcut a lot of code.
-LSYM(Lml_1):
- and r6, r6, #0x80000000
- orr xh, r6, xh
- orr xl, xl, yl
- eor xh, xh, yh
- subs r4, r4, ip, lsr #1
- do_it gt, tt
- COND(rsb,s,gt) r5, r4, ip
- orrgt xh, xh, r4, lsl #20
- RETLDM "r4, r5, r6" gt
-
- @ Under/overflow: fix things up for the code below.
- orr xh, xh, #0x00100000
- mov lr, #0
- subs r4, r4, #1
-
-LSYM(Lml_u):
- @ Overflow?
- bgt LSYM(Lml_o)
-
- @ Check if denormalized result is possible, otherwise return signed 0.
- cmn r4, #(53 + 1)
- do_it le, tt
- movle xl, #0
- bicle xh, xh, #0x7fffffff
- RETLDM "r4, r5, r6" le
-
- @ Find out proper shift value.
- rsb r4, r4, #0
- subs r4, r4, #32
- bge 2f
- adds r4, r4, #12
- bgt 1f
-
- @ shift result right of 1 to 20 bits, preserve sign bit, round, etc.
- add r4, r4, #20
- rsb r5, r4, #32
- shift1 lsl, r3, xl, r5
- shift1 lsr, xl, xl, r4
- shiftop orr xl xl xh lsl r5 r2
- and r2, xh, #0x80000000
- bic xh, xh, #0x80000000
- adds xl, xl, r3, lsr #31
- shiftop adc xh r2 xh lsr r4 r6
- orrs lr, lr, r3, lsl #1
- do_it eq
- biceq xl, xl, r3, lsr #31
- RETLDM "r4, r5, r6"
-
- @ shift result right of 21 to 31 bits, or left 11 to 1 bits after
- @ a register switch from xh to xl. Then round.
-1: rsb r4, r4, #12
- rsb r5, r4, #32
- shift1 lsl, r3, xl, r4
- shift1 lsr, xl, xl, r5
- shiftop orr xl xl xh lsl r4 r2
- bic xh, xh, #0x7fffffff
- adds xl, xl, r3, lsr #31
- adc xh, xh, #0
- orrs lr, lr, r3, lsl #1
- do_it eq
- biceq xl, xl, r3, lsr #31
- RETLDM "r4, r5, r6"
-
- @ Shift value right of 32 to 64 bits, or 0 to 32 bits after a switch
- @ from xh to xl. Leftover bits are in r3-r6-lr for rounding.
-2: rsb r5, r4, #32
- shiftop orr lr lr xl lsl r5 r2
- shift1 lsr, r3, xl, r4
- shiftop orr r3 r3 xh lsl r5 r2
- shift1 lsr, xl, xh, r4
- bic xh, xh, #0x7fffffff
- shiftop bic xl xl xh lsr r4 r2
- add xl, xl, r3, lsr #31
- orrs lr, lr, r3, lsl #1
- do_it eq
- biceq xl, xl, r3, lsr #31
- RETLDM "r4, r5, r6"
-
- @ One or both arguments are denormalized.
- @ Scale them leftwards and preserve sign bit.
-LSYM(Lml_d):
- teq r4, #0
- bne 2f
- and r6, xh, #0x80000000
-1: movs xl, xl, lsl #1
- adc xh, xh, xh
- tst xh, #0x00100000
- do_it eq
- subeq r4, r4, #1
- beq 1b
- orr xh, xh, r6
- teq r5, #0
- do_it ne
- RETc(ne)
-2: and r6, yh, #0x80000000
-3: movs yl, yl, lsl #1
- adc yh, yh, yh
- tst yh, #0x00100000
- do_it eq
- subeq r5, r5, #1
- beq 3b
- orr yh, yh, r6
- RET
-
-LSYM(Lml_s):
- @ Isolate the INF and NAN cases away
- teq r4, ip
- and r5, ip, yh, lsr #20
- do_it ne
- teqne r5, ip
- beq 1f
-
- @ Here, one or more arguments are either denormalized or zero.
- orrs r6, xl, xh, lsl #1
- do_it ne
- COND(orr,s,ne) r6, yl, yh, lsl #1
- bne LSYM(Lml_d)
-
- @ Result is 0, but determine sign anyway.
-LSYM(Lml_z):
- eor xh, xh, yh
- and xh, xh, #0x80000000
- mov xl, #0
- RETLDM "r4, r5, r6"
-
-1: @ One or both args are INF or NAN.
- orrs r6, xl, xh, lsl #1
- do_it eq, te
- moveq xl, yl
- moveq xh, yh
- COND(orr,s,ne) r6, yl, yh, lsl #1
- beq LSYM(Lml_n) @ 0 * INF or INF * 0 -> NAN
- teq r4, ip
- bne 1f
- orrs r6, xl, xh, lsl #12
- bne LSYM(Lml_n) @ NAN * <anything> -> NAN
-1: teq r5, ip
- bne LSYM(Lml_i)
- orrs r6, yl, yh, lsl #12
- do_it ne, t
- movne xl, yl
- movne xh, yh
- bne LSYM(Lml_n) @ <anything> * NAN -> NAN
-
- @ Result is INF, but we need to determine its sign.
-LSYM(Lml_i):
- eor xh, xh, yh
-
- @ Overflow: return INF (sign already in xh).
-LSYM(Lml_o):
- and xh, xh, #0x80000000
- orr xh, xh, #0x7f000000
- orr xh, xh, #0x00f00000
- mov xl, #0
- RETLDM "r4, r5, r6"
-
- @ Return a quiet NAN.
-LSYM(Lml_n):
- orr xh, xh, #0x7f000000
- orr xh, xh, #0x00f80000
- RETLDM "r4, r5, r6"
-
- FUNC_END aeabi_dmul
- FUNC_END muldf3
-
-ARM_FUNC_START divdf3
-ARM_FUNC_ALIAS aeabi_ddiv divdf3
-
- do_push {r4, r5, r6, lr}
-
- @ Mask out exponents, trap any zero/denormal/INF/NAN.
- mov ip, #0xff
- orr ip, ip, #0x700
- ands r4, ip, xh, lsr #20
- do_it ne, tte
- COND(and,s,ne) r5, ip, yh, lsr #20
- teqne r4, ip
- teqne r5, ip
- bleq LSYM(Ldv_s)
-
- @ Substract divisor exponent from dividend''s.
- sub r4, r4, r5
-
- @ Preserve final sign into lr.
- eor lr, xh, yh
-
- @ Convert mantissa to unsigned integer.
- @ Dividend -> r5-r6, divisor -> yh-yl.
- orrs r5, yl, yh, lsl #12
- mov xh, xh, lsl #12
- beq LSYM(Ldv_1)
- mov yh, yh, lsl #12
- mov r5, #0x10000000
- orr yh, r5, yh, lsr #4
- orr yh, yh, yl, lsr #24
- mov yl, yl, lsl #8
- orr r5, r5, xh, lsr #4
- orr r5, r5, xl, lsr #24
- mov r6, xl, lsl #8
-
- @ Initialize xh with final sign bit.
- and xh, lr, #0x80000000
-
- @ Ensure result will land to known bit position.
- @ Apply exponent bias accordingly.
- cmp r5, yh
- do_it eq
- cmpeq r6, yl
- adc r4, r4, #(255 - 2)
- add r4, r4, #0x300
- bcs 1f
- movs yh, yh, lsr #1
- mov yl, yl, rrx
-1:
- @ Perform first substraction to align result to a nibble.
- subs r6, r6, yl
- sbc r5, r5, yh
- movs yh, yh, lsr #1
- mov yl, yl, rrx
- mov xl, #0x00100000
- mov ip, #0x00080000
-
- @ The actual division loop.
-1: subs lr, r6, yl
- sbcs lr, r5, yh
- do_it cs, tt
- subcs r6, r6, yl
- movcs r5, lr
- orrcs xl, xl, ip
- movs yh, yh, lsr #1
- mov yl, yl, rrx
- subs lr, r6, yl
- sbcs lr, r5, yh
- do_it cs, tt
- subcs r6, r6, yl
- movcs r5, lr
- orrcs xl, xl, ip, lsr #1
- movs yh, yh, lsr #1
- mov yl, yl, rrx
- subs lr, r6, yl
- sbcs lr, r5, yh
- do_it cs, tt
- subcs r6, r6, yl
- movcs r5, lr
- orrcs xl, xl, ip, lsr #2
- movs yh, yh, lsr #1
- mov yl, yl, rrx
- subs lr, r6, yl
- sbcs lr, r5, yh
- do_it cs, tt
- subcs r6, r6, yl
- movcs r5, lr
- orrcs xl, xl, ip, lsr #3
-
- orrs lr, r5, r6
- beq 2f
- mov r5, r5, lsl #4
- orr r5, r5, r6, lsr #28
- mov r6, r6, lsl #4
- mov yh, yh, lsl #3
- orr yh, yh, yl, lsr #29
- mov yl, yl, lsl #3
- movs ip, ip, lsr #4
- bne 1b
-
- @ We are done with a word of the result.
- @ Loop again for the low word if this pass was for the high word.
- tst xh, #0x00100000
- bne 3f
- orr xh, xh, xl
- mov xl, #0
- mov ip, #0x80000000
- b 1b
-2:
- @ Be sure result starts in the high word.
- tst xh, #0x00100000
- do_it eq, t
- orreq xh, xh, xl
- moveq xl, #0
-3:
- @ Check exponent range for under/overflow.
- subs ip, r4, #(254 - 1)
- do_it hi
- cmphi ip, #0x700
- bhi LSYM(Lml_u)
-
- @ Round the result, merge final exponent.
- subs ip, r5, yh
- do_it eq, t
- COND(sub,s,eq) ip, r6, yl
- COND(mov,s,eq) ip, xl, lsr #1
- adcs xl, xl, #0
- adc xh, xh, r4, lsl #20
- RETLDM "r4, r5, r6"
-
- @ Division by 0x1p*: shortcut a lot of code.
-LSYM(Ldv_1):
- and lr, lr, #0x80000000
- orr xh, lr, xh, lsr #12
- adds r4, r4, ip, lsr #1
- do_it gt, tt
- COND(rsb,s,gt) r5, r4, ip
- orrgt xh, xh, r4, lsl #20
- RETLDM "r4, r5, r6" gt
-
- orr xh, xh, #0x00100000
- mov lr, #0
- subs r4, r4, #1
- b LSYM(Lml_u)
-
- @ Result mightt need to be denormalized: put remainder bits
- @ in lr for rounding considerations.
-LSYM(Ldv_u):
- orr lr, r5, r6
- b LSYM(Lml_u)
-
- @ One or both arguments is either INF, NAN or zero.
-LSYM(Ldv_s):
- and r5, ip, yh, lsr #20
- teq r4, ip
- do_it eq
- teqeq r5, ip
- beq LSYM(Lml_n) @ INF/NAN / INF/NAN -> NAN
- teq r4, ip
- bne 1f
- orrs r4, xl, xh, lsl #12
- bne LSYM(Lml_n) @ NAN / <anything> -> NAN
- teq r5, ip
- bne LSYM(Lml_i) @ INF / <anything> -> INF
- mov xl, yl
- mov xh, yh
- b LSYM(Lml_n) @ INF / (INF or NAN) -> NAN
-1: teq r5, ip
- bne 2f
- orrs r5, yl, yh, lsl #12
- beq LSYM(Lml_z) @ <anything> / INF -> 0
- mov xl, yl
- mov xh, yh
- b LSYM(Lml_n) @ <anything> / NAN -> NAN
-2: @ If both are nonzero, we need to normalize and resume above.
- orrs r6, xl, xh, lsl #1
- do_it ne
- COND(orr,s,ne) r6, yl, yh, lsl #1
- bne LSYM(Lml_d)
- @ One or both arguments are 0.
- orrs r4, xl, xh, lsl #1
- bne LSYM(Lml_i) @ <non_zero> / 0 -> INF
- orrs r5, yl, yh, lsl #1
- bne LSYM(Lml_z) @ 0 / <non_zero> -> 0
- b LSYM(Lml_n) @ 0 / 0 -> NAN
-
- FUNC_END aeabi_ddiv
- FUNC_END divdf3
-
-#endif /* L_muldivdf3 */
-
-#ifdef L_arm_cmpdf2
-
-@ Note: only r0 (return value) and ip are clobbered here.
-
-ARM_FUNC_START gtdf2
-ARM_FUNC_ALIAS gedf2 gtdf2
- mov ip, #-1
- b 1f
-
-ARM_FUNC_START ltdf2
-ARM_FUNC_ALIAS ledf2 ltdf2
- mov ip, #1
- b 1f
-
-ARM_FUNC_START cmpdf2
-ARM_FUNC_ALIAS nedf2 cmpdf2
-ARM_FUNC_ALIAS eqdf2 cmpdf2
- mov ip, #1 @ how should we specify unordered here?
-
-1: str ip, [sp, #-4]!
-
- @ Trap any INF/NAN first.
- mov ip, xh, lsl #1
- mvns ip, ip, asr #21
- mov ip, yh, lsl #1
- do_it ne
- COND(mvn,s,ne) ip, ip, asr #21
- beq 3f
-
- @ Test for equality.
- @ Note that 0.0 is equal to -0.0.
-2: add sp, sp, #4
- orrs ip, xl, xh, lsl #1 @ if x == 0.0 or -0.0
- do_it eq, e
- COND(orr,s,eq) ip, yl, yh, lsl #1 @ and y == 0.0 or -0.0
- teqne xh, yh @ or xh == yh
- do_it eq, tt
- teqeq xl, yl @ and xl == yl
- moveq r0, #0 @ then equal.
- RETc(eq)
-
- @ Clear C flag
- cmn r0, #0
-
- @ Compare sign,
- teq xh, yh
-
- @ Compare values if same sign
- do_it pl
- cmppl xh, yh
- do_it eq
- cmpeq xl, yl
-
- @ Result:
- do_it cs, e
- movcs r0, yh, asr #31
- mvncc r0, yh, asr #31
- orr r0, r0, #1
- RET
-
- @ Look for a NAN.
-3: mov ip, xh, lsl #1
- mvns ip, ip, asr #21
- bne 4f
- orrs ip, xl, xh, lsl #12
- bne 5f @ x is NAN
-4: mov ip, yh, lsl #1
- mvns ip, ip, asr #21
- bne 2b
- orrs ip, yl, yh, lsl #12
- beq 2b @ y is not NAN
-5: ldr r0, [sp], #4 @ unordered return code
- RET
-
- FUNC_END gedf2
- FUNC_END gtdf2
- FUNC_END ledf2
- FUNC_END ltdf2
- FUNC_END nedf2
- FUNC_END eqdf2
- FUNC_END cmpdf2
-
-ARM_FUNC_START aeabi_cdrcmple
-
- mov ip, r0
- mov r0, r2
- mov r2, ip
- mov ip, r1
- mov r1, r3
- mov r3, ip
- b 6f
-
-ARM_FUNC_START aeabi_cdcmpeq
-ARM_FUNC_ALIAS aeabi_cdcmple aeabi_cdcmpeq
-
- @ The status-returning routines are required to preserve all
- @ registers except ip, lr, and cpsr.
-6: do_push {r0, lr}
- ARM_CALL cmpdf2
- @ Set the Z flag correctly, and the C flag unconditionally.
- cmp r0, #0
- @ Clear the C flag if the return value was -1, indicating
- @ that the first operand was smaller than the second.
- do_it mi
- cmnmi r0, #0
- RETLDM "r0"
-
- FUNC_END aeabi_cdcmple
- FUNC_END aeabi_cdcmpeq
- FUNC_END aeabi_cdrcmple
-
-ARM_FUNC_START aeabi_dcmpeq
-
- str lr, [sp, #-8]!
- ARM_CALL aeabi_cdcmple
- do_it eq, e
- moveq r0, #1 @ Equal to.
- movne r0, #0 @ Less than, greater than, or unordered.
- RETLDM
-
- FUNC_END aeabi_dcmpeq
-
-ARM_FUNC_START aeabi_dcmplt
-
- str lr, [sp, #-8]!
- ARM_CALL aeabi_cdcmple
- do_it cc, e
- movcc r0, #1 @ Less than.
- movcs r0, #0 @ Equal to, greater than, or unordered.
- RETLDM
-
- FUNC_END aeabi_dcmplt
-
-ARM_FUNC_START aeabi_dcmple
-
- str lr, [sp, #-8]!
- ARM_CALL aeabi_cdcmple
- do_it ls, e
- movls r0, #1 @ Less than or equal to.
- movhi r0, #0 @ Greater than or unordered.
- RETLDM
-
- FUNC_END aeabi_dcmple
-
-ARM_FUNC_START aeabi_dcmpge
-
- str lr, [sp, #-8]!
- ARM_CALL aeabi_cdrcmple
- do_it ls, e
- movls r0, #1 @ Operand 2 is less than or equal to operand 1.
- movhi r0, #0 @ Operand 2 greater than operand 1, or unordered.
- RETLDM
-
- FUNC_END aeabi_dcmpge
-
-ARM_FUNC_START aeabi_dcmpgt
-
- str lr, [sp, #-8]!
- ARM_CALL aeabi_cdrcmple
- do_it cc, e
- movcc r0, #1 @ Operand 2 is less than operand 1.
- movcs r0, #0 @ Operand 2 is greater than or equal to operand 1,
- @ or they are unordered.
- RETLDM
-
- FUNC_END aeabi_dcmpgt
-
-#endif /* L_cmpdf2 */
-
-#ifdef L_arm_unorddf2
-
-ARM_FUNC_START unorddf2
-ARM_FUNC_ALIAS aeabi_dcmpun unorddf2
-
- mov ip, xh, lsl #1
- mvns ip, ip, asr #21
- bne 1f
- orrs ip, xl, xh, lsl #12
- bne 3f @ x is NAN
-1: mov ip, yh, lsl #1
- mvns ip, ip, asr #21
- bne 2f
- orrs ip, yl, yh, lsl #12
- bne 3f @ y is NAN
-2: mov r0, #0 @ arguments are ordered.
- RET
-
-3: mov r0, #1 @ arguments are unordered.
- RET
-
- FUNC_END aeabi_dcmpun
- FUNC_END unorddf2
-
-#endif /* L_unorddf2 */
-
-#ifdef L_arm_fixdfsi
-
-ARM_FUNC_START fixdfsi
-ARM_FUNC_ALIAS aeabi_d2iz fixdfsi
-
- @ check exponent range.
- mov r2, xh, lsl #1
- adds r2, r2, #(1 << 21)
- bcs 2f @ value is INF or NAN
- bpl 1f @ value is too small
- mov r3, #(0xfffffc00 + 31)
- subs r2, r3, r2, asr #21
- bls 3f @ value is too large
-
- @ scale value
- mov r3, xh, lsl #11
- orr r3, r3, #0x80000000
- orr r3, r3, xl, lsr #21
- tst xh, #0x80000000 @ the sign bit
- shift1 lsr, r0, r3, r2
- do_it ne
- rsbne r0, r0, #0
- RET
-
-1: mov r0, #0
- RET
-
-2: orrs xl, xl, xh, lsl #12
- bne 4f @ x is NAN.
-3: ands r0, xh, #0x80000000 @ the sign bit
- do_it eq
- moveq r0, #0x7fffffff @ maximum signed positive si
- RET
-
-4: mov r0, #0 @ How should we convert NAN?
- RET
-
- FUNC_END aeabi_d2iz
- FUNC_END fixdfsi
-
-#endif /* L_fixdfsi */
-
-#ifdef L_arm_fixunsdfsi
-
-ARM_FUNC_START fixunsdfsi
-ARM_FUNC_ALIAS aeabi_d2uiz fixunsdfsi
-
- @ check exponent range.
- movs r2, xh, lsl #1
- bcs 1f @ value is negative
- adds r2, r2, #(1 << 21)
- bcs 2f @ value is INF or NAN
- bpl 1f @ value is too small
- mov r3, #(0xfffffc00 + 31)
- subs r2, r3, r2, asr #21
- bmi 3f @ value is too large
-
- @ scale value
- mov r3, xh, lsl #11
- orr r3, r3, #0x80000000
- orr r3, r3, xl, lsr #21
- shift1 lsr, r0, r3, r2
- RET
-
-1: mov r0, #0
- RET
-
-2: orrs xl, xl, xh, lsl #12
- bne 4f @ value is NAN.
-3: mov r0, #0xffffffff @ maximum unsigned si
- RET
-
-4: mov r0, #0 @ How should we convert NAN?
- RET
-
- FUNC_END aeabi_d2uiz
- FUNC_END fixunsdfsi
-
-#endif /* L_fixunsdfsi */
-
-#ifdef L_arm_truncdfsf2
-
-ARM_FUNC_START truncdfsf2
-ARM_FUNC_ALIAS aeabi_d2f truncdfsf2
-
- @ check exponent range.
- mov r2, xh, lsl #1
- subs r3, r2, #((1023 - 127) << 21)
- do_it cs, t
- COND(sub,s,cs) ip, r3, #(1 << 21)
- COND(rsb,s,cs) ip, ip, #(254 << 21)
- bls 2f @ value is out of range
-
-1: @ shift and round mantissa
- and ip, xh, #0x80000000
- mov r2, xl, lsl #3
- orr xl, ip, xl, lsr #29
- cmp r2, #0x80000000
- adc r0, xl, r3, lsl #2
- do_it eq
- biceq r0, r0, #1
- RET
-
-2: @ either overflow or underflow
- tst xh, #0x40000000
- bne 3f @ overflow
-
- @ check if denormalized value is possible
- adds r2, r3, #(23 << 21)
- do_it lt, t
- andlt r0, xh, #0x80000000 @ too small, return signed 0.
- RETc(lt)
-
- @ denormalize value so we can resume with the code above afterwards.
- orr xh, xh, #0x00100000
- mov r2, r2, lsr #21
- rsb r2, r2, #24
- rsb ip, r2, #32
-#if defined(__thumb2__)
- lsls r3, xl, ip
-#else
- movs r3, xl, lsl ip
-#endif
- shift1 lsr, xl, xl, r2
- do_it ne
- orrne xl, xl, #1 @ fold r3 for rounding considerations.
- mov r3, xh, lsl #11
- mov r3, r3, lsr #11
- shiftop orr xl xl r3 lsl ip ip
- shift1 lsr, r3, r3, r2
- mov r3, r3, lsl #1
- b 1b
-
-3: @ chech for NAN
- mvns r3, r2, asr #21
- bne 5f @ simple overflow
- orrs r3, xl, xh, lsl #12
- do_it ne, tt
- movne r0, #0x7f000000
- orrne r0, r0, #0x00c00000
- RETc(ne) @ return NAN
-
-5: @ return INF with sign
- and r0, xh, #0x80000000
- orr r0, r0, #0x7f000000
- orr r0, r0, #0x00800000
- RET
-
- FUNC_END aeabi_d2f
- FUNC_END truncdfsf2
-
-#endif /* L_truncdfsf2 */
diff --git a/gcc/config/arm/ieee754-sf.S b/gcc/config/arm/ieee754-sf.S
deleted file mode 100644
index c93f66d8ff8..00000000000
--- a/gcc/config/arm/ieee754-sf.S
+++ /dev/null
@@ -1,1060 +0,0 @@
-/* ieee754-sf.S single-precision floating point support for ARM
-
- Copyright (C) 2003, 2004, 2005, 2007, 2008, 2009 Free Software Foundation, Inc.
- Contributed by Nicolas Pitre (nico@cam.org)
-
- This file is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the
- Free Software Foundation; either version 3, or (at your option) any
- later version.
-
- This file 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/>. */
-
-/*
- * Notes:
- *
- * The goal of this code is to be as fast as possible. This is
- * not meant to be easy to understand for the casual reader.
- *
- * Only the default rounding mode is intended for best performances.
- * Exceptions aren't supported yet, but that can be added quite easily
- * if necessary without impacting performances.
- */
-
-#ifdef L_arm_negsf2
-
-ARM_FUNC_START negsf2
-ARM_FUNC_ALIAS aeabi_fneg negsf2
-
- eor r0, r0, #0x80000000 @ flip sign bit
- RET
-
- FUNC_END aeabi_fneg
- FUNC_END negsf2
-
-#endif
-
-#ifdef L_arm_addsubsf3
-
-ARM_FUNC_START aeabi_frsub
-
- eor r0, r0, #0x80000000 @ flip sign bit of first arg
- b 1f
-
-ARM_FUNC_START subsf3
-ARM_FUNC_ALIAS aeabi_fsub subsf3
-
- eor r1, r1, #0x80000000 @ flip sign bit of second arg
-#if defined(__INTERWORKING_STUBS__)
- b 1f @ Skip Thumb-code prologue
-#endif
-
-ARM_FUNC_START addsf3
-ARM_FUNC_ALIAS aeabi_fadd addsf3
-
-1: @ Look for zeroes, equal values, INF, or NAN.
- movs r2, r0, lsl #1
- do_it ne, ttt
- COND(mov,s,ne) r3, r1, lsl #1
- teqne r2, r3
- COND(mvn,s,ne) ip, r2, asr #24
- COND(mvn,s,ne) ip, r3, asr #24
- beq LSYM(Lad_s)
-
- @ Compute exponent difference. Make largest exponent in r2,
- @ corresponding arg in r0, and positive exponent difference in r3.
- mov r2, r2, lsr #24
- rsbs r3, r2, r3, lsr #24
- do_it gt, ttt
- addgt r2, r2, r3
- eorgt r1, r0, r1
- eorgt r0, r1, r0
- eorgt r1, r0, r1
- do_it lt
- rsblt r3, r3, #0
-
- @ If exponent difference is too large, return largest argument
- @ already in r0. We need up to 25 bit to handle proper rounding
- @ of 0x1p25 - 1.1.
- cmp r3, #25
- do_it hi
- RETc(hi)
-
- @ Convert mantissa to signed integer.
- tst r0, #0x80000000
- orr r0, r0, #0x00800000
- bic r0, r0, #0xff000000
- do_it ne
- rsbne r0, r0, #0
- tst r1, #0x80000000
- orr r1, r1, #0x00800000
- bic r1, r1, #0xff000000
- do_it ne
- rsbne r1, r1, #0
-
- @ If exponent == difference, one or both args were denormalized.
- @ Since this is not common case, rescale them off line.
- teq r2, r3
- beq LSYM(Lad_d)
-LSYM(Lad_x):
-
- @ Compensate for the exponent overlapping the mantissa MSB added later
- sub r2, r2, #1
-
- @ Shift and add second arg to first arg in r0.
- @ Keep leftover bits into r1.
- shiftop adds r0 r0 r1 asr r3 ip
- rsb r3, r3, #32
- shift1 lsl, r1, r1, r3
-
- @ Keep absolute value in r0-r1, sign in r3 (the n bit was set above)
- and r3, r0, #0x80000000
- bpl LSYM(Lad_p)
-#if defined(__thumb2__)
- negs r1, r1
- sbc r0, r0, r0, lsl #1
-#else
- rsbs r1, r1, #0
- rsc r0, r0, #0
-#endif
-
- @ Determine how to normalize the result.
-LSYM(Lad_p):
- cmp r0, #0x00800000
- bcc LSYM(Lad_a)
- cmp r0, #0x01000000
- bcc LSYM(Lad_e)
-
- @ Result needs to be shifted right.
- movs r0, r0, lsr #1
- mov r1, r1, rrx
- add r2, r2, #1
-
- @ Make sure we did not bust our exponent.
- cmp r2, #254
- bhs LSYM(Lad_o)
-
- @ Our result is now properly aligned into r0, remaining bits in r1.
- @ Pack final result together.
- @ Round with MSB of r1. If halfway between two numbers, round towards
- @ LSB of r0 = 0.
-LSYM(Lad_e):
- cmp r1, #0x80000000
- adc r0, r0, r2, lsl #23
- do_it eq
- biceq r0, r0, #1
- orr r0, r0, r3
- RET
-
- @ Result must be shifted left and exponent adjusted.
-LSYM(Lad_a):
- movs r1, r1, lsl #1
- adc r0, r0, r0
- tst r0, #0x00800000
- sub r2, r2, #1
- bne LSYM(Lad_e)
-
- @ No rounding necessary since r1 will always be 0 at this point.
-LSYM(Lad_l):
-
-#if __ARM_ARCH__ < 5
-
- movs ip, r0, lsr #12
- moveq r0, r0, lsl #12
- subeq r2, r2, #12
- tst r0, #0x00ff0000
- moveq r0, r0, lsl #8
- subeq r2, r2, #8
- tst r0, #0x00f00000
- moveq r0, r0, lsl #4
- subeq r2, r2, #4
- tst r0, #0x00c00000
- moveq r0, r0, lsl #2
- subeq r2, r2, #2
- cmp r0, #0x00800000
- movcc r0, r0, lsl #1
- sbcs r2, r2, #0
-
-#else
-
- clz ip, r0
- sub ip, ip, #8
- subs r2, r2, ip
- shift1 lsl, r0, r0, ip
-
-#endif
-
- @ Final result with sign
- @ If exponent negative, denormalize result.
- do_it ge, et
- addge r0, r0, r2, lsl #23
- rsblt r2, r2, #0
- orrge r0, r0, r3
-#if defined(__thumb2__)
- do_it lt, t
- lsrlt r0, r0, r2
- orrlt r0, r3, r0
-#else
- orrlt r0, r3, r0, lsr r2
-#endif
- RET
-
- @ Fixup and adjust bit position for denormalized arguments.
- @ Note that r2 must not remain equal to 0.
-LSYM(Lad_d):
- teq r2, #0
- eor r1, r1, #0x00800000
- do_it eq, te
- eoreq r0, r0, #0x00800000
- addeq r2, r2, #1
- subne r3, r3, #1
- b LSYM(Lad_x)
-
-LSYM(Lad_s):
- mov r3, r1, lsl #1
-
- mvns ip, r2, asr #24
- do_it ne
- COND(mvn,s,ne) ip, r3, asr #24
- beq LSYM(Lad_i)
-
- teq r2, r3
- beq 1f
-
- @ Result is x + 0.0 = x or 0.0 + y = y.
- teq r2, #0
- do_it eq
- moveq r0, r1
- RET
-
-1: teq r0, r1
-
- @ Result is x - x = 0.
- do_it ne, t
- movne r0, #0
- RETc(ne)
-
- @ Result is x + x = 2x.
- tst r2, #0xff000000
- bne 2f
- movs r0, r0, lsl #1
- do_it cs
- orrcs r0, r0, #0x80000000
- RET
-2: adds r2, r2, #(2 << 24)
- do_it cc, t
- addcc r0, r0, #(1 << 23)
- RETc(cc)
- and r3, r0, #0x80000000
-
- @ Overflow: return INF.
-LSYM(Lad_o):
- orr r0, r3, #0x7f000000
- orr r0, r0, #0x00800000
- RET
-
- @ At least one of r0/r1 is INF/NAN.
- @ if r0 != INF/NAN: return r1 (which is INF/NAN)
- @ if r1 != INF/NAN: return r0 (which is INF/NAN)
- @ if r0 or r1 is NAN: return NAN
- @ if opposite sign: return NAN
- @ otherwise return r0 (which is INF or -INF)
-LSYM(Lad_i):
- mvns r2, r2, asr #24
- do_it ne, et
- movne r0, r1
- COND(mvn,s,eq) r3, r3, asr #24
- movne r1, r0
- movs r2, r0, lsl #9
- do_it eq, te
- COND(mov,s,eq) r3, r1, lsl #9
- teqeq r0, r1
- orrne r0, r0, #0x00400000 @ quiet NAN
- RET
-
- FUNC_END aeabi_frsub
- FUNC_END aeabi_fadd
- FUNC_END addsf3
- FUNC_END aeabi_fsub
- FUNC_END subsf3
-
-ARM_FUNC_START floatunsisf
-ARM_FUNC_ALIAS aeabi_ui2f floatunsisf
-
- mov r3, #0
- b 1f
-
-ARM_FUNC_START floatsisf
-ARM_FUNC_ALIAS aeabi_i2f floatsisf
-
- ands r3, r0, #0x80000000
- do_it mi
- rsbmi r0, r0, #0
-
-1: movs ip, r0
- do_it eq
- RETc(eq)
-
- @ Add initial exponent to sign
- orr r3, r3, #((127 + 23) << 23)
-
- .ifnc ah, r0
- mov ah, r0
- .endif
- mov al, #0
- b 2f
-
- FUNC_END aeabi_i2f
- FUNC_END floatsisf
- FUNC_END aeabi_ui2f
- FUNC_END floatunsisf
-
-ARM_FUNC_START floatundisf
-ARM_FUNC_ALIAS aeabi_ul2f floatundisf
-
- orrs r2, r0, r1
-#if !defined (__VFP_FP__) && !defined(__SOFTFP__)
- do_it eq, t
- mvfeqs f0, #0.0
-#else
- do_it eq
-#endif
- RETc(eq)
-
- mov r3, #0
- b 1f
-
-ARM_FUNC_START floatdisf
-ARM_FUNC_ALIAS aeabi_l2f floatdisf
-
- orrs r2, r0, r1
-#if !defined (__VFP_FP__) && !defined(__SOFTFP__)
- do_it eq, t
- mvfeqs f0, #0.0
-#else
- do_it eq
-#endif
- RETc(eq)
-
- ands r3, ah, #0x80000000 @ sign bit in r3
- bpl 1f
-#if defined(__thumb2__)
- negs al, al
- sbc ah, ah, ah, lsl #1
-#else
- rsbs al, al, #0
- rsc ah, ah, #0
-#endif
-1:
-#if !defined (__VFP_FP__) && !defined(__SOFTFP__)
- @ For hard FPA code we want to return via the tail below so that
- @ we can return the result in f0 as well as in r0 for backwards
- @ compatibility.
- str lr, [sp, #-8]!
- adr lr, LSYM(f0_ret)
-#endif
-
- movs ip, ah
- do_it eq, tt
- moveq ip, al
- moveq ah, al
- moveq al, #0
-
- @ Add initial exponent to sign
- orr r3, r3, #((127 + 23 + 32) << 23)
- do_it eq
- subeq r3, r3, #(32 << 23)
-2: sub r3, r3, #(1 << 23)
-
-#if __ARM_ARCH__ < 5
-
- mov r2, #23
- cmp ip, #(1 << 16)
- do_it hs, t
- movhs ip, ip, lsr #16
- subhs r2, r2, #16
- cmp ip, #(1 << 8)
- do_it hs, t
- movhs ip, ip, lsr #8
- subhs r2, r2, #8
- cmp ip, #(1 << 4)
- do_it hs, t
- movhs ip, ip, lsr #4
- subhs r2, r2, #4
- cmp ip, #(1 << 2)
- do_it hs, e
- subhs r2, r2, #2
- sublo r2, r2, ip, lsr #1
- subs r2, r2, ip, lsr #3
-
-#else
-
- clz r2, ip
- subs r2, r2, #8
-
-#endif
-
- sub r3, r3, r2, lsl #23
- blt 3f
-
- shiftop add r3 r3 ah lsl r2 ip
- shift1 lsl, ip, al, r2
- rsb r2, r2, #32
- cmp ip, #0x80000000
- shiftop adc r0 r3 al lsr r2 r2
- do_it eq
- biceq r0, r0, #1
- RET
-
-3: add r2, r2, #32
- shift1 lsl, ip, ah, r2
- rsb r2, r2, #32
- orrs al, al, ip, lsl #1
- shiftop adc r0 r3 ah lsr r2 r2
- do_it eq
- biceq r0, r0, ip, lsr #31
- RET
-
-#if !defined (__VFP_FP__) && !defined(__SOFTFP__)
-
-LSYM(f0_ret):
- str r0, [sp, #-4]!
- ldfs f0, [sp], #4
- RETLDM
-
-#endif
-
- FUNC_END floatdisf
- FUNC_END aeabi_l2f
- FUNC_END floatundisf
- FUNC_END aeabi_ul2f
-
-#endif /* L_addsubsf3 */
-
-#ifdef L_arm_muldivsf3
-
-ARM_FUNC_START mulsf3
-ARM_FUNC_ALIAS aeabi_fmul mulsf3
-
- @ Mask out exponents, trap any zero/denormal/INF/NAN.
- mov ip, #0xff
- ands r2, ip, r0, lsr #23
- do_it ne, tt
- COND(and,s,ne) r3, ip, r1, lsr #23
- teqne r2, ip
- teqne r3, ip
- beq LSYM(Lml_s)
-LSYM(Lml_x):
-
- @ Add exponents together
- add r2, r2, r3
-
- @ Determine final sign.
- eor ip, r0, r1
-
- @ Convert mantissa to unsigned integer.
- @ If power of two, branch to a separate path.
- @ Make up for final alignment.
- movs r0, r0, lsl #9
- do_it ne
- COND(mov,s,ne) r1, r1, lsl #9
- beq LSYM(Lml_1)
- mov r3, #0x08000000
- orr r0, r3, r0, lsr #5
- orr r1, r3, r1, lsr #5
-
-#if __ARM_ARCH__ < 4
-
- @ Put sign bit in r3, which will be restored into r0 later.
- and r3, ip, #0x80000000
-
- @ Well, no way to make it shorter without the umull instruction.
- do_push {r3, r4, r5}
- mov r4, r0, lsr #16
- mov r5, r1, lsr #16
- bic r0, r0, r4, lsl #16
- bic r1, r1, r5, lsl #16
- mul ip, r4, r5
- mul r3, r0, r1
- mul r0, r5, r0
- mla r0, r4, r1, r0
- adds r3, r3, r0, lsl #16
- adc r1, ip, r0, lsr #16
- do_pop {r0, r4, r5}
-
-#else
-
- @ The actual multiplication.
- umull r3, r1, r0, r1
-
- @ Put final sign in r0.
- and r0, ip, #0x80000000
-
-#endif
-
- @ Adjust result upon the MSB position.
- cmp r1, #(1 << 23)
- do_it cc, tt
- movcc r1, r1, lsl #1
- orrcc r1, r1, r3, lsr #31
- movcc r3, r3, lsl #1
-
- @ Add sign to result.
- orr r0, r0, r1
-
- @ Apply exponent bias, check for under/overflow.
- sbc r2, r2, #127
- cmp r2, #(254 - 1)
- bhi LSYM(Lml_u)
-
- @ Round the result, merge final exponent.
- cmp r3, #0x80000000
- adc r0, r0, r2, lsl #23
- do_it eq
- biceq r0, r0, #1
- RET
-
- @ Multiplication by 0x1p*: let''s shortcut a lot of code.
-LSYM(Lml_1):
- teq r0, #0
- and ip, ip, #0x80000000
- do_it eq
- moveq r1, r1, lsl #9
- orr r0, ip, r0, lsr #9
- orr r0, r0, r1, lsr #9
- subs r2, r2, #127
- do_it gt, tt
- COND(rsb,s,gt) r3, r2, #255
- orrgt r0, r0, r2, lsl #23
- RETc(gt)
-
- @ Under/overflow: fix things up for the code below.
- orr r0, r0, #0x00800000
- mov r3, #0
- subs r2, r2, #1
-
-LSYM(Lml_u):
- @ Overflow?
- bgt LSYM(Lml_o)
-
- @ Check if denormalized result is possible, otherwise return signed 0.
- cmn r2, #(24 + 1)
- do_it le, t
- bicle r0, r0, #0x7fffffff
- RETc(le)
-
- @ Shift value right, round, etc.
- rsb r2, r2, #0
- movs r1, r0, lsl #1
- shift1 lsr, r1, r1, r2
- rsb r2, r2, #32
- shift1 lsl, ip, r0, r2
- movs r0, r1, rrx
- adc r0, r0, #0
- orrs r3, r3, ip, lsl #1
- do_it eq
- biceq r0, r0, ip, lsr #31
- RET
-
- @ One or both arguments are denormalized.
- @ Scale them leftwards and preserve sign bit.
-LSYM(Lml_d):
- teq r2, #0
- and ip, r0, #0x80000000
-1: do_it eq, tt
- moveq r0, r0, lsl #1
- tsteq r0, #0x00800000
- subeq r2, r2, #1
- beq 1b
- orr r0, r0, ip
- teq r3, #0
- and ip, r1, #0x80000000
-2: do_it eq, tt
- moveq r1, r1, lsl #1
- tsteq r1, #0x00800000
- subeq r3, r3, #1
- beq 2b
- orr r1, r1, ip
- b LSYM(Lml_x)
-
-LSYM(Lml_s):
- @ Isolate the INF and NAN cases away
- and r3, ip, r1, lsr #23
- teq r2, ip
- do_it ne
- teqne r3, ip
- beq 1f
-
- @ Here, one or more arguments are either denormalized or zero.
- bics ip, r0, #0x80000000
- do_it ne
- COND(bic,s,ne) ip, r1, #0x80000000
- bne LSYM(Lml_d)
-
- @ Result is 0, but determine sign anyway.
-LSYM(Lml_z):
- eor r0, r0, r1
- bic r0, r0, #0x7fffffff
- RET
-
-1: @ One or both args are INF or NAN.
- teq r0, #0x0
- do_it ne, ett
- teqne r0, #0x80000000
- moveq r0, r1
- teqne r1, #0x0
- teqne r1, #0x80000000
- beq LSYM(Lml_n) @ 0 * INF or INF * 0 -> NAN
- teq r2, ip
- bne 1f
- movs r2, r0, lsl #9
- bne LSYM(Lml_n) @ NAN * <anything> -> NAN
-1: teq r3, ip
- bne LSYM(Lml_i)
- movs r3, r1, lsl #9
- do_it ne
- movne r0, r1
- bne LSYM(Lml_n) @ <anything> * NAN -> NAN
-
- @ Result is INF, but we need to determine its sign.
-LSYM(Lml_i):
- eor r0, r0, r1
-
- @ Overflow: return INF (sign already in r0).
-LSYM(Lml_o):
- and r0, r0, #0x80000000
- orr r0, r0, #0x7f000000
- orr r0, r0, #0x00800000
- RET
-
- @ Return a quiet NAN.
-LSYM(Lml_n):
- orr r0, r0, #0x7f000000
- orr r0, r0, #0x00c00000
- RET
-
- FUNC_END aeabi_fmul
- FUNC_END mulsf3
-
-ARM_FUNC_START divsf3
-ARM_FUNC_ALIAS aeabi_fdiv divsf3
-
- @ Mask out exponents, trap any zero/denormal/INF/NAN.
- mov ip, #0xff
- ands r2, ip, r0, lsr #23
- do_it ne, tt
- COND(and,s,ne) r3, ip, r1, lsr #23
- teqne r2, ip
- teqne r3, ip
- beq LSYM(Ldv_s)
-LSYM(Ldv_x):
-
- @ Substract divisor exponent from dividend''s
- sub r2, r2, r3
-
- @ Preserve final sign into ip.
- eor ip, r0, r1
-
- @ Convert mantissa to unsigned integer.
- @ Dividend -> r3, divisor -> r1.
- movs r1, r1, lsl #9
- mov r0, r0, lsl #9
- beq LSYM(Ldv_1)
- mov r3, #0x10000000
- orr r1, r3, r1, lsr #4
- orr r3, r3, r0, lsr #4
-
- @ Initialize r0 (result) with final sign bit.
- and r0, ip, #0x80000000
-
- @ Ensure result will land to known bit position.
- @ Apply exponent bias accordingly.
- cmp r3, r1
- do_it cc
- movcc r3, r3, lsl #1
- adc r2, r2, #(127 - 2)
-
- @ The actual division loop.
- mov ip, #0x00800000
-1: cmp r3, r1
- do_it cs, t
- subcs r3, r3, r1
- orrcs r0, r0, ip
- cmp r3, r1, lsr #1
- do_it cs, t
- subcs r3, r3, r1, lsr #1
- orrcs r0, r0, ip, lsr #1
- cmp r3, r1, lsr #2
- do_it cs, t
- subcs r3, r3, r1, lsr #2
- orrcs r0, r0, ip, lsr #2
- cmp r3, r1, lsr #3
- do_it cs, t
- subcs r3, r3, r1, lsr #3
- orrcs r0, r0, ip, lsr #3
- movs r3, r3, lsl #4
- do_it ne
- COND(mov,s,ne) ip, ip, lsr #4
- bne 1b
-
- @ Check exponent for under/overflow.
- cmp r2, #(254 - 1)
- bhi LSYM(Lml_u)
-
- @ Round the result, merge final exponent.
- cmp r3, r1
- adc r0, r0, r2, lsl #23
- do_it eq
- biceq r0, r0, #1
- RET
-
- @ Division by 0x1p*: let''s shortcut a lot of code.
-LSYM(Ldv_1):
- and ip, ip, #0x80000000
- orr r0, ip, r0, lsr #9
- adds r2, r2, #127
- do_it gt, tt
- COND(rsb,s,gt) r3, r2, #255
- orrgt r0, r0, r2, lsl #23
- RETc(gt)
-
- orr r0, r0, #0x00800000
- mov r3, #0
- subs r2, r2, #1
- b LSYM(Lml_u)
-
- @ One or both arguments are denormalized.
- @ Scale them leftwards and preserve sign bit.
-LSYM(Ldv_d):
- teq r2, #0
- and ip, r0, #0x80000000
-1: do_it eq, tt
- moveq r0, r0, lsl #1
- tsteq r0, #0x00800000
- subeq r2, r2, #1
- beq 1b
- orr r0, r0, ip
- teq r3, #0
- and ip, r1, #0x80000000
-2: do_it eq, tt
- moveq r1, r1, lsl #1
- tsteq r1, #0x00800000
- subeq r3, r3, #1
- beq 2b
- orr r1, r1, ip
- b LSYM(Ldv_x)
-
- @ One or both arguments are either INF, NAN, zero or denormalized.
-LSYM(Ldv_s):
- and r3, ip, r1, lsr #23
- teq r2, ip
- bne 1f
- movs r2, r0, lsl #9
- bne LSYM(Lml_n) @ NAN / <anything> -> NAN
- teq r3, ip
- bne LSYM(Lml_i) @ INF / <anything> -> INF
- mov r0, r1
- b LSYM(Lml_n) @ INF / (INF or NAN) -> NAN
-1: teq r3, ip
- bne 2f
- movs r3, r1, lsl #9
- beq LSYM(Lml_z) @ <anything> / INF -> 0
- mov r0, r1
- b LSYM(Lml_n) @ <anything> / NAN -> NAN
-2: @ If both are nonzero, we need to normalize and resume above.
- bics ip, r0, #0x80000000
- do_it ne
- COND(bic,s,ne) ip, r1, #0x80000000
- bne LSYM(Ldv_d)
- @ One or both arguments are zero.
- bics r2, r0, #0x80000000
- bne LSYM(Lml_i) @ <non_zero> / 0 -> INF
- bics r3, r1, #0x80000000
- bne LSYM(Lml_z) @ 0 / <non_zero> -> 0
- b LSYM(Lml_n) @ 0 / 0 -> NAN
-
- FUNC_END aeabi_fdiv
- FUNC_END divsf3
-
-#endif /* L_muldivsf3 */
-
-#ifdef L_arm_cmpsf2
-
- @ The return value in r0 is
- @
- @ 0 if the operands are equal
- @ 1 if the first operand is greater than the second, or
- @ the operands are unordered and the operation is
- @ CMP, LT, LE, NE, or EQ.
- @ -1 if the first operand is less than the second, or
- @ the operands are unordered and the operation is GT
- @ or GE.
- @
- @ The Z flag will be set iff the operands are equal.
- @
- @ The following registers are clobbered by this function:
- @ ip, r0, r1, r2, r3
-
-ARM_FUNC_START gtsf2
-ARM_FUNC_ALIAS gesf2 gtsf2
- mov ip, #-1
- b 1f
-
-ARM_FUNC_START ltsf2
-ARM_FUNC_ALIAS lesf2 ltsf2
- mov ip, #1
- b 1f
-
-ARM_FUNC_START cmpsf2
-ARM_FUNC_ALIAS nesf2 cmpsf2
-ARM_FUNC_ALIAS eqsf2 cmpsf2
- mov ip, #1 @ how should we specify unordered here?
-
-1: str ip, [sp, #-4]!
-
- @ Trap any INF/NAN first.
- mov r2, r0, lsl #1
- mov r3, r1, lsl #1
- mvns ip, r2, asr #24
- do_it ne
- COND(mvn,s,ne) ip, r3, asr #24
- beq 3f
-
- @ Compare values.
- @ Note that 0.0 is equal to -0.0.
-2: add sp, sp, #4
- orrs ip, r2, r3, lsr #1 @ test if both are 0, clear C flag
- do_it ne
- teqne r0, r1 @ if not 0 compare sign
- do_it pl
- COND(sub,s,pl) r0, r2, r3 @ if same sign compare values, set r0
-
- @ Result:
- do_it hi
- movhi r0, r1, asr #31
- do_it lo
- mvnlo r0, r1, asr #31
- do_it ne
- orrne r0, r0, #1
- RET
-
- @ Look for a NAN.
-3: mvns ip, r2, asr #24
- bne 4f
- movs ip, r0, lsl #9
- bne 5f @ r0 is NAN
-4: mvns ip, r3, asr #24
- bne 2b
- movs ip, r1, lsl #9
- beq 2b @ r1 is not NAN
-5: ldr r0, [sp], #4 @ return unordered code.
- RET
-
- FUNC_END gesf2
- FUNC_END gtsf2
- FUNC_END lesf2
- FUNC_END ltsf2
- FUNC_END nesf2
- FUNC_END eqsf2
- FUNC_END cmpsf2
-
-ARM_FUNC_START aeabi_cfrcmple
-
- mov ip, r0
- mov r0, r1
- mov r1, ip
- b 6f
-
-ARM_FUNC_START aeabi_cfcmpeq
-ARM_FUNC_ALIAS aeabi_cfcmple aeabi_cfcmpeq
-
- @ The status-returning routines are required to preserve all
- @ registers except ip, lr, and cpsr.
-6: do_push {r0, r1, r2, r3, lr}
- ARM_CALL cmpsf2
- @ Set the Z flag correctly, and the C flag unconditionally.
- cmp r0, #0
- @ Clear the C flag if the return value was -1, indicating
- @ that the first operand was smaller than the second.
- do_it mi
- cmnmi r0, #0
- RETLDM "r0, r1, r2, r3"
-
- FUNC_END aeabi_cfcmple
- FUNC_END aeabi_cfcmpeq
- FUNC_END aeabi_cfrcmple
-
-ARM_FUNC_START aeabi_fcmpeq
-
- str lr, [sp, #-8]!
- ARM_CALL aeabi_cfcmple
- do_it eq, e
- moveq r0, #1 @ Equal to.
- movne r0, #0 @ Less than, greater than, or unordered.
- RETLDM
-
- FUNC_END aeabi_fcmpeq
-
-ARM_FUNC_START aeabi_fcmplt
-
- str lr, [sp, #-8]!
- ARM_CALL aeabi_cfcmple
- do_it cc, e
- movcc r0, #1 @ Less than.
- movcs r0, #0 @ Equal to, greater than, or unordered.
- RETLDM
-
- FUNC_END aeabi_fcmplt
-
-ARM_FUNC_START aeabi_fcmple
-
- str lr, [sp, #-8]!
- ARM_CALL aeabi_cfcmple
- do_it ls, e
- movls r0, #1 @ Less than or equal to.
- movhi r0, #0 @ Greater than or unordered.
- RETLDM
-
- FUNC_END aeabi_fcmple
-
-ARM_FUNC_START aeabi_fcmpge
-
- str lr, [sp, #-8]!
- ARM_CALL aeabi_cfrcmple
- do_it ls, e
- movls r0, #1 @ Operand 2 is less than or equal to operand 1.
- movhi r0, #0 @ Operand 2 greater than operand 1, or unordered.
- RETLDM
-
- FUNC_END aeabi_fcmpge
-
-ARM_FUNC_START aeabi_fcmpgt
-
- str lr, [sp, #-8]!
- ARM_CALL aeabi_cfrcmple
- do_it cc, e
- movcc r0, #1 @ Operand 2 is less than operand 1.
- movcs r0, #0 @ Operand 2 is greater than or equal to operand 1,
- @ or they are unordered.
- RETLDM
-
- FUNC_END aeabi_fcmpgt
-
-#endif /* L_cmpsf2 */
-
-#ifdef L_arm_unordsf2
-
-ARM_FUNC_START unordsf2
-ARM_FUNC_ALIAS aeabi_fcmpun unordsf2
-
- mov r2, r0, lsl #1
- mov r3, r1, lsl #1
- mvns ip, r2, asr #24
- bne 1f
- movs ip, r0, lsl #9
- bne 3f @ r0 is NAN
-1: mvns ip, r3, asr #24
- bne 2f
- movs ip, r1, lsl #9
- bne 3f @ r1 is NAN
-2: mov r0, #0 @ arguments are ordered.
- RET
-3: mov r0, #1 @ arguments are unordered.
- RET
-
- FUNC_END aeabi_fcmpun
- FUNC_END unordsf2
-
-#endif /* L_unordsf2 */
-
-#ifdef L_arm_fixsfsi
-
-ARM_FUNC_START fixsfsi
-ARM_FUNC_ALIAS aeabi_f2iz fixsfsi
-
- @ check exponent range.
- mov r2, r0, lsl #1
- cmp r2, #(127 << 24)
- bcc 1f @ value is too small
- mov r3, #(127 + 31)
- subs r2, r3, r2, lsr #24
- bls 2f @ value is too large
-
- @ scale value
- mov r3, r0, lsl #8
- orr r3, r3, #0x80000000
- tst r0, #0x80000000 @ the sign bit
- shift1 lsr, r0, r3, r2
- do_it ne
- rsbne r0, r0, #0
- RET
-
-1: mov r0, #0
- RET
-
-2: cmp r2, #(127 + 31 - 0xff)
- bne 3f
- movs r2, r0, lsl #9
- bne 4f @ r0 is NAN.
-3: ands r0, r0, #0x80000000 @ the sign bit
- do_it eq
- moveq r0, #0x7fffffff @ the maximum signed positive si
- RET
-
-4: mov r0, #0 @ What should we convert NAN to?
- RET
-
- FUNC_END aeabi_f2iz
- FUNC_END fixsfsi
-
-#endif /* L_fixsfsi */
-
-#ifdef L_arm_fixunssfsi
-
-ARM_FUNC_START fixunssfsi
-ARM_FUNC_ALIAS aeabi_f2uiz fixunssfsi
-
- @ check exponent range.
- movs r2, r0, lsl #1
- bcs 1f @ value is negative
- cmp r2, #(127 << 24)
- bcc 1f @ value is too small
- mov r3, #(127 + 31)
- subs r2, r3, r2, lsr #24
- bmi 2f @ value is too large
-
- @ scale the value
- mov r3, r0, lsl #8
- orr r3, r3, #0x80000000
- shift1 lsr, r0, r3, r2
- RET
-
-1: mov r0, #0
- RET
-
-2: cmp r2, #(127 + 31 - 0xff)
- bne 3f
- movs r2, r0, lsl #9
- bne 4f @ r0 is NAN.
-3: mov r0, #0xffffffff @ maximum unsigned si
- RET
-
-4: mov r0, #0 @ What should we convert NAN to?
- RET
-
- FUNC_END aeabi_f2uiz
- FUNC_END fixunssfsi
-
-#endif /* L_fixunssfsi */
diff --git a/gcc/config/arm/lib1funcs.asm b/gcc/config/arm/lib1funcs.asm
deleted file mode 100644
index 2e76c01df4b..00000000000
--- a/gcc/config/arm/lib1funcs.asm
+++ /dev/null
@@ -1,1829 +0,0 @@
-@ libgcc routines for ARM cpu.
-@ Division routines, written by Richard Earnshaw, (rearnsha@armltd.co.uk)
-
-/* Copyright 1995, 1996, 1998, 1999, 2000, 2003, 2004, 2005, 2007, 2008,
- 2009, 2010 Free Software Foundation, Inc.
-
-This file is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3, or (at your option) any
-later version.
-
-This file 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/>. */
-
-/* An executable stack is *not* required for these functions. */
-#if defined(__ELF__) && defined(__linux__)
-.section .note.GNU-stack,"",%progbits
-.previous
-#endif /* __ELF__ and __linux__ */
-
-#ifdef __ARM_EABI__
-/* Some attributes that are common to all routines in this file. */
- /* Tag_ABI_align_needed: This code does not require 8-byte
- alignment from the caller. */
- /* .eabi_attribute 24, 0 -- default setting. */
- /* Tag_ABI_align_preserved: This code preserves 8-byte
- alignment in any callee. */
- .eabi_attribute 25, 1
-#endif /* __ARM_EABI__ */
-/* ------------------------------------------------------------------------ */
-
-/* We need to know what prefix to add to function names. */
-
-#ifndef __USER_LABEL_PREFIX__
-#error __USER_LABEL_PREFIX__ not defined
-#endif
-
-/* ANSI concatenation macros. */
-
-#define CONCAT1(a, b) CONCAT2(a, b)
-#define CONCAT2(a, b) a ## b
-
-/* Use the right prefix for global labels. */
-
-#define SYM(x) CONCAT1 (__USER_LABEL_PREFIX__, x)
-
-#ifdef __ELF__
-#ifdef __thumb__
-#define __PLT__ /* Not supported in Thumb assembler (for now). */
-#elif defined __vxworks && !defined __PIC__
-#define __PLT__ /* Not supported by the kernel loader. */
-#else
-#define __PLT__ (PLT)
-#endif
-#define TYPE(x) .type SYM(x),function
-#define SIZE(x) .size SYM(x), . - SYM(x)
-#define LSYM(x) .x
-#else
-#define __PLT__
-#define TYPE(x)
-#define SIZE(x)
-#define LSYM(x) x
-#endif
-
-/* Function end macros. Variants for interworking. */
-
-#if defined(__ARM_ARCH_2__)
-# define __ARM_ARCH__ 2
-#endif
-
-#if defined(__ARM_ARCH_3__)
-# define __ARM_ARCH__ 3
-#endif
-
-#if defined(__ARM_ARCH_3M__) || defined(__ARM_ARCH_4__) \
- || defined(__ARM_ARCH_4T__)
-/* We use __ARM_ARCH__ set to 4 here, but in reality it's any processor with
- long multiply instructions. That includes v3M. */
-# define __ARM_ARCH__ 4
-#endif
-
-#if defined(__ARM_ARCH_5__) || defined(__ARM_ARCH_5T__) \
- || defined(__ARM_ARCH_5E__) || defined(__ARM_ARCH_5TE__) \
- || defined(__ARM_ARCH_5TEJ__)
-# define __ARM_ARCH__ 5
-#endif
-
-#if defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) \
- || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6Z__) \
- || defined(__ARM_ARCH_6ZK__) || defined(__ARM_ARCH_6T2__) \
- || defined(__ARM_ARCH_6M__)
-# define __ARM_ARCH__ 6
-#endif
-
-#if defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) \
- || defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) \
- || defined(__ARM_ARCH_7EM__)
-# define __ARM_ARCH__ 7
-#endif
-
-#ifndef __ARM_ARCH__
-#error Unable to determine architecture.
-#endif
-
-/* There are times when we might prefer Thumb1 code even if ARM code is
- permitted, for example, the code might be smaller, or there might be
- interworking problems with switching to ARM state if interworking is
- disabled. */
-#if (defined(__thumb__) \
- && !defined(__thumb2__) \
- && (!defined(__THUMB_INTERWORK__) \
- || defined (__OPTIMIZE_SIZE__) \
- || defined(__ARM_ARCH_6M__)))
-# define __prefer_thumb__
-#endif
-
-/* How to return from a function call depends on the architecture variant. */
-
-#if (__ARM_ARCH__ > 4) || defined(__ARM_ARCH_4T__)
-
-# define RET bx lr
-# define RETc(x) bx##x lr
-
-/* Special precautions for interworking on armv4t. */
-# if (__ARM_ARCH__ == 4)
-
-/* Always use bx, not ldr pc. */
-# if (defined(__thumb__) || defined(__THUMB_INTERWORK__))
-# define __INTERWORKING__
-# endif /* __THUMB__ || __THUMB_INTERWORK__ */
-
-/* Include thumb stub before arm mode code. */
-# if defined(__thumb__) && !defined(__THUMB_INTERWORK__)
-# define __INTERWORKING_STUBS__
-# endif /* __thumb__ && !__THUMB_INTERWORK__ */
-
-#endif /* __ARM_ARCH == 4 */
-
-#else
-
-# define RET mov pc, lr
-# define RETc(x) mov##x pc, lr
-
-#endif
-
-.macro cfi_pop advance, reg, cfa_offset
-#ifdef __ELF__
- .pushsection .debug_frame
- .byte 0x4 /* DW_CFA_advance_loc4 */
- .4byte \advance
- .byte (0xc0 | \reg) /* DW_CFA_restore */
- .byte 0xe /* DW_CFA_def_cfa_offset */
- .uleb128 \cfa_offset
- .popsection
-#endif
-.endm
-.macro cfi_push advance, reg, offset, cfa_offset
-#ifdef __ELF__
- .pushsection .debug_frame
- .byte 0x4 /* DW_CFA_advance_loc4 */
- .4byte \advance
- .byte (0x80 | \reg) /* DW_CFA_offset */
- .uleb128 (\offset / -4)
- .byte 0xe /* DW_CFA_def_cfa_offset */
- .uleb128 \cfa_offset
- .popsection
-#endif
-.endm
-.macro cfi_start start_label, end_label
-#ifdef __ELF__
- .pushsection .debug_frame
-LSYM(Lstart_frame):
- .4byte LSYM(Lend_cie) - LSYM(Lstart_cie) @ Length of CIE
-LSYM(Lstart_cie):
- .4byte 0xffffffff @ CIE Identifier Tag
- .byte 0x1 @ CIE Version
- .ascii "\0" @ CIE Augmentation
- .uleb128 0x1 @ CIE Code Alignment Factor
- .sleb128 -4 @ CIE Data Alignment Factor
- .byte 0xe @ CIE RA Column
- .byte 0xc @ DW_CFA_def_cfa
- .uleb128 0xd
- .uleb128 0x0
-
- .align 2
-LSYM(Lend_cie):
- .4byte LSYM(Lend_fde)-LSYM(Lstart_fde) @ FDE Length
-LSYM(Lstart_fde):
- .4byte LSYM(Lstart_frame) @ FDE CIE offset
- .4byte \start_label @ FDE initial location
- .4byte \end_label-\start_label @ FDE address range
- .popsection
-#endif
-.endm
-.macro cfi_end end_label
-#ifdef __ELF__
- .pushsection .debug_frame
- .align 2
-LSYM(Lend_fde):
- .popsection
-\end_label:
-#endif
-.endm
-
-/* Don't pass dirn, it's there just to get token pasting right. */
-
-.macro RETLDM regs=, cond=, unwind=, dirn=ia
-#if defined (__INTERWORKING__)
- .ifc "\regs",""
- ldr\cond lr, [sp], #8
- .else
-# if defined(__thumb2__)
- pop\cond {\regs, lr}
-# else
- ldm\cond\dirn sp!, {\regs, lr}
-# endif
- .endif
- .ifnc "\unwind", ""
- /* Mark LR as restored. */
-97: cfi_pop 97b - \unwind, 0xe, 0x0
- .endif
- bx\cond lr
-#else
- /* Caller is responsible for providing IT instruction. */
- .ifc "\regs",""
- ldr\cond pc, [sp], #8
- .else
-# if defined(__thumb2__)
- pop\cond {\regs, pc}
-# else
- ldm\cond\dirn sp!, {\regs, pc}
-# endif
- .endif
-#endif
-.endm
-
-/* The Unified assembly syntax allows the same code to be assembled for both
- ARM and Thumb-2. However this is only supported by recent gas, so define
- a set of macros to allow ARM code on older assemblers. */
-#if defined(__thumb2__)
-.macro do_it cond, suffix=""
- it\suffix \cond
-.endm
-.macro shift1 op, arg0, arg1, arg2
- \op \arg0, \arg1, \arg2
-.endm
-#define do_push push
-#define do_pop pop
-#define COND(op1, op2, cond) op1 ## op2 ## cond
-/* Perform an arithmetic operation with a variable shift operand. This
- requires two instructions and a scratch register on Thumb-2. */
-.macro shiftop name, dest, src1, src2, shiftop, shiftreg, tmp
- \shiftop \tmp, \src2, \shiftreg
- \name \dest, \src1, \tmp
-.endm
-#else
-.macro do_it cond, suffix=""
-.endm
-.macro shift1 op, arg0, arg1, arg2
- mov \arg0, \arg1, \op \arg2
-.endm
-#define do_push stmfd sp!,
-#define do_pop ldmfd sp!,
-#define COND(op1, op2, cond) op1 ## cond ## op2
-.macro shiftop name, dest, src1, src2, shiftop, shiftreg, tmp
- \name \dest, \src1, \src2, \shiftop \shiftreg
-.endm
-#endif
-
-#ifdef __ARM_EABI__
-.macro ARM_LDIV0 name signed
- cmp r0, #0
- .ifc \signed, unsigned
- movne r0, #0xffffffff
- .else
- movgt r0, #0x7fffffff
- movlt r0, #0x80000000
- .endif
- b SYM (__aeabi_idiv0) __PLT__
-.endm
-#else
-.macro ARM_LDIV0 name signed
- str lr, [sp, #-8]!
-98: cfi_push 98b - __\name, 0xe, -0x8, 0x8
- bl SYM (__div0) __PLT__
- mov r0, #0 @ About as wrong as it could be.
- RETLDM unwind=98b
-.endm
-#endif
-
-
-#ifdef __ARM_EABI__
-.macro THUMB_LDIV0 name signed
-#if defined(__ARM_ARCH_6M__)
- .ifc \signed, unsigned
- cmp r0, #0
- beq 1f
- mov r0, #0
- mvn r0, r0 @ 0xffffffff
-1:
- .else
- cmp r0, #0
- beq 2f
- blt 3f
- mov r0, #0
- mvn r0, r0
- lsr r0, r0, #1 @ 0x7fffffff
- b 2f
-3: mov r0, #0x80
- lsl r0, r0, #24 @ 0x80000000
-2:
- .endif
- push {r0, r1, r2}
- ldr r0, 4f
- adr r1, 4f
- add r0, r1
- str r0, [sp, #8]
- @ We know we are not on armv4t, so pop pc is safe.
- pop {r0, r1, pc}
- .align 2
-4:
- .word __aeabi_idiv0 - 4b
-#elif defined(__thumb2__)
- .syntax unified
- .ifc \signed, unsigned
- cbz r0, 1f
- mov r0, #0xffffffff
-1:
- .else
- cmp r0, #0
- do_it gt
- movgt r0, #0x7fffffff
- do_it lt
- movlt r0, #0x80000000
- .endif
- b.w SYM(__aeabi_idiv0) __PLT__
-#else
- .align 2
- bx pc
- nop
- .arm
- cmp r0, #0
- .ifc \signed, unsigned
- movne r0, #0xffffffff
- .else
- movgt r0, #0x7fffffff
- movlt r0, #0x80000000
- .endif
- b SYM(__aeabi_idiv0) __PLT__
- .thumb
-#endif
-.endm
-#else
-.macro THUMB_LDIV0 name signed
- push { r1, lr }
-98: cfi_push 98b - __\name, 0xe, -0x4, 0x8
- bl SYM (__div0)
- mov r0, #0 @ About as wrong as it could be.
-#if defined (__INTERWORKING__)
- pop { r1, r2 }
- bx r2
-#else
- pop { r1, pc }
-#endif
-.endm
-#endif
-
-.macro FUNC_END name
- SIZE (__\name)
-.endm
-
-.macro DIV_FUNC_END name signed
- cfi_start __\name, LSYM(Lend_div0)
-LSYM(Ldiv0):
-#ifdef __thumb__
- THUMB_LDIV0 \name \signed
-#else
- ARM_LDIV0 \name \signed
-#endif
- cfi_end LSYM(Lend_div0)
- FUNC_END \name
-.endm
-
-.macro THUMB_FUNC_START name
- .globl SYM (\name)
- TYPE (\name)
- .thumb_func
-SYM (\name):
-.endm
-
-/* Function start macros. Variants for ARM and Thumb. */
-
-#ifdef __thumb__
-#define THUMB_FUNC .thumb_func
-#define THUMB_CODE .force_thumb
-# if defined(__thumb2__)
-#define THUMB_SYNTAX .syntax divided
-# else
-#define THUMB_SYNTAX
-# endif
-#else
-#define THUMB_FUNC
-#define THUMB_CODE
-#define THUMB_SYNTAX
-#endif
-
-.macro FUNC_START name
- .text
- .globl SYM (__\name)
- TYPE (__\name)
- .align 0
- THUMB_CODE
- THUMB_FUNC
- THUMB_SYNTAX
-SYM (__\name):
-.endm
-
-/* Special function that will always be coded in ARM assembly, even if
- in Thumb-only compilation. */
-
-#if defined(__thumb2__)
-
-/* For Thumb-2 we build everything in thumb mode. */
-.macro ARM_FUNC_START name
- FUNC_START \name
- .syntax unified
-.endm
-#define EQUIV .thumb_set
-.macro ARM_CALL name
- bl __\name
-.endm
-
-#elif defined(__INTERWORKING_STUBS__)
-
-.macro ARM_FUNC_START name
- FUNC_START \name
- bx pc
- nop
- .arm
-/* A hook to tell gdb that we've switched to ARM mode. Also used to call
- directly from other local arm routines. */
-_L__\name:
-.endm
-#define EQUIV .thumb_set
-/* Branch directly to a function declared with ARM_FUNC_START.
- Must be called in arm mode. */
-.macro ARM_CALL name
- bl _L__\name
-.endm
-
-#else /* !(__INTERWORKING_STUBS__ || __thumb2__) */
-
-#ifdef __ARM_ARCH_6M__
-#define EQUIV .thumb_set
-#else
-.macro ARM_FUNC_START name
- .text
- .globl SYM (__\name)
- TYPE (__\name)
- .align 0
- .arm
-SYM (__\name):
-.endm
-#define EQUIV .set
-.macro ARM_CALL name
- bl __\name
-.endm
-#endif
-
-#endif
-
-.macro FUNC_ALIAS new old
- .globl SYM (__\new)
-#if defined (__thumb__)
- .thumb_set SYM (__\new), SYM (__\old)
-#else
- .set SYM (__\new), SYM (__\old)
-#endif
-.endm
-
-#ifndef __ARM_ARCH_6M__
-.macro ARM_FUNC_ALIAS new old
- .globl SYM (__\new)
- EQUIV SYM (__\new), SYM (__\old)
-#if defined(__INTERWORKING_STUBS__)
- .set SYM (_L__\new), SYM (_L__\old)
-#endif
-.endm
-#endif
-
-#ifdef __ARMEB__
-#define xxh r0
-#define xxl r1
-#define yyh r2
-#define yyl r3
-#else
-#define xxh r1
-#define xxl r0
-#define yyh r3
-#define yyl r2
-#endif
-
-#ifdef __ARM_EABI__
-.macro WEAK name
- .weak SYM (__\name)
-.endm
-#endif
-
-#ifdef __thumb__
-/* Register aliases. */
-
-work .req r4 @ XXXX is this safe ?
-dividend .req r0
-divisor .req r1
-overdone .req r2
-result .req r2
-curbit .req r3
-#endif
-#if 0
-ip .req r12
-sp .req r13
-lr .req r14
-pc .req r15
-#endif
-
-/* ------------------------------------------------------------------------ */
-/* Bodies of the division and modulo routines. */
-/* ------------------------------------------------------------------------ */
-.macro ARM_DIV_BODY dividend, divisor, result, curbit
-
-#if __ARM_ARCH__ >= 5 && ! defined (__OPTIMIZE_SIZE__)
-
-#if defined (__thumb2__)
- clz \curbit, \dividend
- clz \result, \divisor
- sub \curbit, \result, \curbit
- rsb \curbit, \curbit, #31
- adr \result, 1f
- add \curbit, \result, \curbit, lsl #4
- mov \result, #0
- mov pc, \curbit
-.p2align 3
-1:
- .set shift, 32
- .rept 32
- .set shift, shift - 1
- cmp.w \dividend, \divisor, lsl #shift
- nop.n
- adc.w \result, \result, \result
- it cs
- subcs.w \dividend, \dividend, \divisor, lsl #shift
- .endr
-#else
- clz \curbit, \dividend
- clz \result, \divisor
- sub \curbit, \result, \curbit
- rsbs \curbit, \curbit, #31
- addne \curbit, \curbit, \curbit, lsl #1
- mov \result, #0
- addne pc, pc, \curbit, lsl #2
- nop
- .set shift, 32
- .rept 32
- .set shift, shift - 1
- cmp \dividend, \divisor, lsl #shift
- adc \result, \result, \result
- subcs \dividend, \dividend, \divisor, lsl #shift
- .endr
-#endif
-
-#else /* __ARM_ARCH__ < 5 || defined (__OPTIMIZE_SIZE__) */
-#if __ARM_ARCH__ >= 5
-
- clz \curbit, \divisor
- clz \result, \dividend
- sub \result, \curbit, \result
- mov \curbit, #1
- mov \divisor, \divisor, lsl \result
- mov \curbit, \curbit, lsl \result
- mov \result, #0
-
-#else /* __ARM_ARCH__ < 5 */
-
- @ Initially shift the divisor left 3 bits if possible,
- @ set curbit accordingly. This allows for curbit to be located
- @ at the left end of each 4-bit nibbles in the division loop
- @ to save one loop in most cases.
- tst \divisor, #0xe0000000
- moveq \divisor, \divisor, lsl #3
- moveq \curbit, #8
- movne \curbit, #1
-
- @ Unless the divisor is very big, shift it up in multiples of
- @ four bits, since this is the amount of unwinding in the main
- @ division loop. Continue shifting until the divisor is
- @ larger than the dividend.
-1: cmp \divisor, #0x10000000
- cmplo \divisor, \dividend
- movlo \divisor, \divisor, lsl #4
- movlo \curbit, \curbit, lsl #4
- blo 1b
-
- @ For very big divisors, we must shift it a bit at a time, or
- @ we will be in danger of overflowing.
-1: cmp \divisor, #0x80000000
- cmplo \divisor, \dividend
- movlo \divisor, \divisor, lsl #1
- movlo \curbit, \curbit, lsl #1
- blo 1b
-
- mov \result, #0
-
-#endif /* __ARM_ARCH__ < 5 */
-
- @ Division loop
-1: cmp \dividend, \divisor
- do_it hs, t
- subhs \dividend, \dividend, \divisor
- orrhs \result, \result, \curbit
- cmp \dividend, \divisor, lsr #1
- do_it hs, t
- subhs \dividend, \dividend, \divisor, lsr #1
- orrhs \result, \result, \curbit, lsr #1
- cmp \dividend, \divisor, lsr #2
- do_it hs, t
- subhs \dividend, \dividend, \divisor, lsr #2
- orrhs \result, \result, \curbit, lsr #2
- cmp \dividend, \divisor, lsr #3
- do_it hs, t
- subhs \dividend, \dividend, \divisor, lsr #3
- orrhs \result, \result, \curbit, lsr #3
- cmp \dividend, #0 @ Early termination?
- do_it ne, t
- movnes \curbit, \curbit, lsr #4 @ No, any more bits to do?
- movne \divisor, \divisor, lsr #4
- bne 1b
-
-#endif /* __ARM_ARCH__ < 5 || defined (__OPTIMIZE_SIZE__) */
-
-.endm
-/* ------------------------------------------------------------------------ */
-.macro ARM_DIV2_ORDER divisor, order
-
-#if __ARM_ARCH__ >= 5
-
- clz \order, \divisor
- rsb \order, \order, #31
-
-#else
-
- cmp \divisor, #(1 << 16)
- movhs \divisor, \divisor, lsr #16
- movhs \order, #16
- movlo \order, #0
-
- cmp \divisor, #(1 << 8)
- movhs \divisor, \divisor, lsr #8
- addhs \order, \order, #8
-
- cmp \divisor, #(1 << 4)
- movhs \divisor, \divisor, lsr #4
- addhs \order, \order, #4
-
- cmp \divisor, #(1 << 2)
- addhi \order, \order, #3
- addls \order, \order, \divisor, lsr #1
-
-#endif
-
-.endm
-/* ------------------------------------------------------------------------ */
-.macro ARM_MOD_BODY dividend, divisor, order, spare
-
-#if __ARM_ARCH__ >= 5 && ! defined (__OPTIMIZE_SIZE__)
-
- clz \order, \divisor
- clz \spare, \dividend
- sub \order, \order, \spare
- rsbs \order, \order, #31
- addne pc, pc, \order, lsl #3
- nop
- .set shift, 32
- .rept 32
- .set shift, shift - 1
- cmp \dividend, \divisor, lsl #shift
- subcs \dividend, \dividend, \divisor, lsl #shift
- .endr
-
-#else /* __ARM_ARCH__ < 5 || defined (__OPTIMIZE_SIZE__) */
-#if __ARM_ARCH__ >= 5
-
- clz \order, \divisor
- clz \spare, \dividend
- sub \order, \order, \spare
- mov \divisor, \divisor, lsl \order
-
-#else /* __ARM_ARCH__ < 5 */
-
- mov \order, #0
-
- @ Unless the divisor is very big, shift it up in multiples of
- @ four bits, since this is the amount of unwinding in the main
- @ division loop. Continue shifting until the divisor is
- @ larger than the dividend.
-1: cmp \divisor, #0x10000000
- cmplo \divisor, \dividend
- movlo \divisor, \divisor, lsl #4
- addlo \order, \order, #4
- blo 1b
-
- @ For very big divisors, we must shift it a bit at a time, or
- @ we will be in danger of overflowing.
-1: cmp \divisor, #0x80000000
- cmplo \divisor, \dividend
- movlo \divisor, \divisor, lsl #1
- addlo \order, \order, #1
- blo 1b
-
-#endif /* __ARM_ARCH__ < 5 */
-
- @ Perform all needed substractions to keep only the reminder.
- @ Do comparisons in batch of 4 first.
- subs \order, \order, #3 @ yes, 3 is intended here
- blt 2f
-
-1: cmp \dividend, \divisor
- subhs \dividend, \dividend, \divisor
- cmp \dividend, \divisor, lsr #1
- subhs \dividend, \dividend, \divisor, lsr #1
- cmp \dividend, \divisor, lsr #2
- subhs \dividend, \dividend, \divisor, lsr #2
- cmp \dividend, \divisor, lsr #3
- subhs \dividend, \dividend, \divisor, lsr #3
- cmp \dividend, #1
- mov \divisor, \divisor, lsr #4
- subges \order, \order, #4
- bge 1b
-
- tst \order, #3
- teqne \dividend, #0
- beq 5f
-
- @ Either 1, 2 or 3 comparison/substractions are left.
-2: cmn \order, #2
- blt 4f
- beq 3f
- cmp \dividend, \divisor
- subhs \dividend, \dividend, \divisor
- mov \divisor, \divisor, lsr #1
-3: cmp \dividend, \divisor
- subhs \dividend, \dividend, \divisor
- mov \divisor, \divisor, lsr #1
-4: cmp \dividend, \divisor
- subhs \dividend, \dividend, \divisor
-5:
-
-#endif /* __ARM_ARCH__ < 5 || defined (__OPTIMIZE_SIZE__) */
-
-.endm
-/* ------------------------------------------------------------------------ */
-.macro THUMB_DIV_MOD_BODY modulo
- @ Load the constant 0x10000000 into our work register.
- mov work, #1
- lsl work, #28
-LSYM(Loop1):
- @ Unless the divisor is very big, shift it up in multiples of
- @ four bits, since this is the amount of unwinding in the main
- @ division loop. Continue shifting until the divisor is
- @ larger than the dividend.
- cmp divisor, work
- bhs LSYM(Lbignum)
- cmp divisor, dividend
- bhs LSYM(Lbignum)
- lsl divisor, #4
- lsl curbit, #4
- b LSYM(Loop1)
-LSYM(Lbignum):
- @ Set work to 0x80000000
- lsl work, #3
-LSYM(Loop2):
- @ For very big divisors, we must shift it a bit at a time, or
- @ we will be in danger of overflowing.
- cmp divisor, work
- bhs LSYM(Loop3)
- cmp divisor, dividend
- bhs LSYM(Loop3)
- lsl divisor, #1
- lsl curbit, #1
- b LSYM(Loop2)
-LSYM(Loop3):
- @ Test for possible subtractions ...
- .if \modulo
- @ ... On the final pass, this may subtract too much from the dividend,
- @ so keep track of which subtractions are done, we can fix them up
- @ afterwards.
- mov overdone, #0
- cmp dividend, divisor
- blo LSYM(Lover1)
- sub dividend, dividend, divisor
-LSYM(Lover1):
- lsr work, divisor, #1
- cmp dividend, work
- blo LSYM(Lover2)
- sub dividend, dividend, work
- mov ip, curbit
- mov work, #1
- ror curbit, work
- orr overdone, curbit
- mov curbit, ip
-LSYM(Lover2):
- lsr work, divisor, #2
- cmp dividend, work
- blo LSYM(Lover3)
- sub dividend, dividend, work
- mov ip, curbit
- mov work, #2
- ror curbit, work
- orr overdone, curbit
- mov curbit, ip
-LSYM(Lover3):
- lsr work, divisor, #3
- cmp dividend, work
- blo LSYM(Lover4)
- sub dividend, dividend, work
- mov ip, curbit
- mov work, #3
- ror curbit, work
- orr overdone, curbit
- mov curbit, ip
-LSYM(Lover4):
- mov ip, curbit
- .else
- @ ... and note which bits are done in the result. On the final pass,
- @ this may subtract too much from the dividend, but the result will be ok,
- @ since the "bit" will have been shifted out at the bottom.
- cmp dividend, divisor
- blo LSYM(Lover1)
- sub dividend, dividend, divisor
- orr result, result, curbit
-LSYM(Lover1):
- lsr work, divisor, #1
- cmp dividend, work
- blo LSYM(Lover2)
- sub dividend, dividend, work
- lsr work, curbit, #1
- orr result, work
-LSYM(Lover2):
- lsr work, divisor, #2
- cmp dividend, work
- blo LSYM(Lover3)
- sub dividend, dividend, work
- lsr work, curbit, #2
- orr result, work
-LSYM(Lover3):
- lsr work, divisor, #3
- cmp dividend, work
- blo LSYM(Lover4)
- sub dividend, dividend, work
- lsr work, curbit, #3
- orr result, work
-LSYM(Lover4):
- .endif
-
- cmp dividend, #0 @ Early termination?
- beq LSYM(Lover5)
- lsr curbit, #4 @ No, any more bits to do?
- beq LSYM(Lover5)
- lsr divisor, #4
- b LSYM(Loop3)
-LSYM(Lover5):
- .if \modulo
- @ Any subtractions that we should not have done will be recorded in
- @ the top three bits of "overdone". Exactly which were not needed
- @ are governed by the position of the bit, stored in ip.
- mov work, #0xe
- lsl work, #28
- and overdone, work
- beq LSYM(Lgot_result)
-
- @ If we terminated early, because dividend became zero, then the
- @ bit in ip will not be in the bottom nibble, and we should not
- @ perform the additions below. We must test for this though
- @ (rather relying upon the TSTs to prevent the additions) since
- @ the bit in ip could be in the top two bits which might then match
- @ with one of the smaller RORs.
- mov curbit, ip
- mov work, #0x7
- tst curbit, work
- beq LSYM(Lgot_result)
-
- mov curbit, ip
- mov work, #3
- ror curbit, work
- tst overdone, curbit
- beq LSYM(Lover6)
- lsr work, divisor, #3
- add dividend, work
-LSYM(Lover6):
- mov curbit, ip
- mov work, #2
- ror curbit, work
- tst overdone, curbit
- beq LSYM(Lover7)
- lsr work, divisor, #2
- add dividend, work
-LSYM(Lover7):
- mov curbit, ip
- mov work, #1
- ror curbit, work
- tst overdone, curbit
- beq LSYM(Lgot_result)
- lsr work, divisor, #1
- add dividend, work
- .endif
-LSYM(Lgot_result):
-.endm
-/* ------------------------------------------------------------------------ */
-/* Start of the Real Functions */
-/* ------------------------------------------------------------------------ */
-#ifdef L_udivsi3
-
-#if defined(__prefer_thumb__)
-
- FUNC_START udivsi3
- FUNC_ALIAS aeabi_uidiv udivsi3
-
- cmp divisor, #0
- beq LSYM(Ldiv0)
-LSYM(udivsi3_skip_div0_test):
- mov curbit, #1
- mov result, #0
-
- push { work }
- cmp dividend, divisor
- blo LSYM(Lgot_result)
-
- THUMB_DIV_MOD_BODY 0
-
- mov r0, result
- pop { work }
- RET
-
-#else /* ARM version/Thumb-2. */
-
- ARM_FUNC_START udivsi3
- ARM_FUNC_ALIAS aeabi_uidiv udivsi3
-
- /* Note: if called via udivsi3_skip_div0_test, this will unnecessarily
- check for division-by-zero a second time. */
-LSYM(udivsi3_skip_div0_test):
- subs r2, r1, #1
- do_it eq
- RETc(eq)
- bcc LSYM(Ldiv0)
- cmp r0, r1
- bls 11f
- tst r1, r2
- beq 12f
-
- ARM_DIV_BODY r0, r1, r2, r3
-
- mov r0, r2
- RET
-
-11: do_it eq, e
- moveq r0, #1
- movne r0, #0
- RET
-
-12: ARM_DIV2_ORDER r1, r2
-
- mov r0, r0, lsr r2
- RET
-
-#endif /* ARM version */
-
- DIV_FUNC_END udivsi3 unsigned
-
-#if defined(__prefer_thumb__)
-FUNC_START aeabi_uidivmod
- cmp r1, #0
- beq LSYM(Ldiv0)
- push {r0, r1, lr}
- bl LSYM(udivsi3_skip_div0_test)
- POP {r1, r2, r3}
- mul r2, r0
- sub r1, r1, r2
- bx r3
-#else
-ARM_FUNC_START aeabi_uidivmod
- cmp r1, #0
- beq LSYM(Ldiv0)
- stmfd sp!, { r0, r1, lr }
- bl LSYM(udivsi3_skip_div0_test)
- ldmfd sp!, { r1, r2, lr }
- mul r3, r2, r0
- sub r1, r1, r3
- RET
-#endif
- FUNC_END aeabi_uidivmod
-
-#endif /* L_udivsi3 */
-/* ------------------------------------------------------------------------ */
-#ifdef L_umodsi3
-
- FUNC_START umodsi3
-
-#ifdef __thumb__
-
- cmp divisor, #0
- beq LSYM(Ldiv0)
- mov curbit, #1
- cmp dividend, divisor
- bhs LSYM(Lover10)
- RET
-
-LSYM(Lover10):
- push { work }
-
- THUMB_DIV_MOD_BODY 1
-
- pop { work }
- RET
-
-#else /* ARM version. */
-
- subs r2, r1, #1 @ compare divisor with 1
- bcc LSYM(Ldiv0)
- cmpne r0, r1 @ compare dividend with divisor
- moveq r0, #0
- tsthi r1, r2 @ see if divisor is power of 2
- andeq r0, r0, r2
- RETc(ls)
-
- ARM_MOD_BODY r0, r1, r2, r3
-
- RET
-
-#endif /* ARM version. */
-
- DIV_FUNC_END umodsi3 unsigned
-
-#endif /* L_umodsi3 */
-/* ------------------------------------------------------------------------ */
-#ifdef L_divsi3
-
-#if defined(__prefer_thumb__)
-
- FUNC_START divsi3
- FUNC_ALIAS aeabi_idiv divsi3
-
- cmp divisor, #0
- beq LSYM(Ldiv0)
-LSYM(divsi3_skip_div0_test):
- push { work }
- mov work, dividend
- eor work, divisor @ Save the sign of the result.
- mov ip, work
- mov curbit, #1
- mov result, #0
- cmp divisor, #0
- bpl LSYM(Lover10)
- neg divisor, divisor @ Loops below use unsigned.
-LSYM(Lover10):
- cmp dividend, #0
- bpl LSYM(Lover11)
- neg dividend, dividend
-LSYM(Lover11):
- cmp dividend, divisor
- blo LSYM(Lgot_result)
-
- THUMB_DIV_MOD_BODY 0
-
- mov r0, result
- mov work, ip
- cmp work, #0
- bpl LSYM(Lover12)
- neg r0, r0
-LSYM(Lover12):
- pop { work }
- RET
-
-#else /* ARM/Thumb-2 version. */
-
- ARM_FUNC_START divsi3
- ARM_FUNC_ALIAS aeabi_idiv divsi3
-
- cmp r1, #0
- beq LSYM(Ldiv0)
-LSYM(divsi3_skip_div0_test):
- eor ip, r0, r1 @ save the sign of the result.
- do_it mi
- rsbmi r1, r1, #0 @ loops below use unsigned.
- subs r2, r1, #1 @ division by 1 or -1 ?
- beq 10f
- movs r3, r0
- do_it mi
- rsbmi r3, r0, #0 @ positive dividend value
- cmp r3, r1
- bls 11f
- tst r1, r2 @ divisor is power of 2 ?
- beq 12f
-
- ARM_DIV_BODY r3, r1, r0, r2
-
- cmp ip, #0
- do_it mi
- rsbmi r0, r0, #0
- RET
-
-10: teq ip, r0 @ same sign ?
- do_it mi
- rsbmi r0, r0, #0
- RET
-
-11: do_it lo
- movlo r0, #0
- do_it eq,t
- moveq r0, ip, asr #31
- orreq r0, r0, #1
- RET
-
-12: ARM_DIV2_ORDER r1, r2
-
- cmp ip, #0
- mov r0, r3, lsr r2
- do_it mi
- rsbmi r0, r0, #0
- RET
-
-#endif /* ARM version */
-
- DIV_FUNC_END divsi3 signed
-
-#if defined(__prefer_thumb__)
-FUNC_START aeabi_idivmod
- cmp r1, #0
- beq LSYM(Ldiv0)
- push {r0, r1, lr}
- bl LSYM(divsi3_skip_div0_test)
- POP {r1, r2, r3}
- mul r2, r0
- sub r1, r1, r2
- bx r3
-#else
-ARM_FUNC_START aeabi_idivmod
- cmp r1, #0
- beq LSYM(Ldiv0)
- stmfd sp!, { r0, r1, lr }
- bl LSYM(divsi3_skip_div0_test)
- ldmfd sp!, { r1, r2, lr }
- mul r3, r2, r0
- sub r1, r1, r3
- RET
-#endif
- FUNC_END aeabi_idivmod
-
-#endif /* L_divsi3 */
-/* ------------------------------------------------------------------------ */
-#ifdef L_modsi3
-
- FUNC_START modsi3
-
-#ifdef __thumb__
-
- mov curbit, #1
- cmp divisor, #0
- beq LSYM(Ldiv0)
- bpl LSYM(Lover10)
- neg divisor, divisor @ Loops below use unsigned.
-LSYM(Lover10):
- push { work }
- @ Need to save the sign of the dividend, unfortunately, we need
- @ work later on. Must do this after saving the original value of
- @ the work register, because we will pop this value off first.
- push { dividend }
- cmp dividend, #0
- bpl LSYM(Lover11)
- neg dividend, dividend
-LSYM(Lover11):
- cmp dividend, divisor
- blo LSYM(Lgot_result)
-
- THUMB_DIV_MOD_BODY 1
-
- pop { work }
- cmp work, #0
- bpl LSYM(Lover12)
- neg dividend, dividend
-LSYM(Lover12):
- pop { work }
- RET
-
-#else /* ARM version. */
-
- cmp r1, #0
- beq LSYM(Ldiv0)
- rsbmi r1, r1, #0 @ loops below use unsigned.
- movs ip, r0 @ preserve sign of dividend
- rsbmi r0, r0, #0 @ if negative make positive
- subs r2, r1, #1 @ compare divisor with 1
- cmpne r0, r1 @ compare dividend with divisor
- moveq r0, #0
- tsthi r1, r2 @ see if divisor is power of 2
- andeq r0, r0, r2
- bls 10f
-
- ARM_MOD_BODY r0, r1, r2, r3
-
-10: cmp ip, #0
- rsbmi r0, r0, #0
- RET
-
-#endif /* ARM version */
-
- DIV_FUNC_END modsi3 signed
-
-#endif /* L_modsi3 */
-/* ------------------------------------------------------------------------ */
-#ifdef L_dvmd_tls
-
-#ifdef __ARM_EABI__
- WEAK aeabi_idiv0
- WEAK aeabi_ldiv0
- FUNC_START aeabi_idiv0
- FUNC_START aeabi_ldiv0
- RET
- FUNC_END aeabi_ldiv0
- FUNC_END aeabi_idiv0
-#else
- FUNC_START div0
- RET
- FUNC_END div0
-#endif
-
-#endif /* L_divmodsi_tools */
-/* ------------------------------------------------------------------------ */
-#ifdef L_dvmd_lnx
-@ GNU/Linux division-by zero handler. Used in place of L_dvmd_tls
-
-/* Constant taken from <asm/signal.h>. */
-#define SIGFPE 8
-
-#ifdef __ARM_EABI__
- WEAK aeabi_idiv0
- WEAK aeabi_ldiv0
- ARM_FUNC_START aeabi_idiv0
- ARM_FUNC_START aeabi_ldiv0
-#else
- ARM_FUNC_START div0
-#endif
-
- do_push {r1, lr}
- mov r0, #SIGFPE
- bl SYM(raise) __PLT__
- RETLDM r1
-
-#ifdef __ARM_EABI__
- FUNC_END aeabi_ldiv0
- FUNC_END aeabi_idiv0
-#else
- FUNC_END div0
-#endif
-
-#endif /* L_dvmd_lnx */
-#ifdef L_clear_cache
-#if defined __ARM_EABI__ && defined __linux__
-@ EABI GNU/Linux call to cacheflush syscall.
- ARM_FUNC_START clear_cache
- do_push {r7}
-#if __ARM_ARCH__ >= 7 || defined(__ARM_ARCH_6T2__)
- movw r7, #2
- movt r7, #0xf
-#else
- mov r7, #0xf0000
- add r7, r7, #2
-#endif
- mov r2, #0
- swi 0
- do_pop {r7}
- RET
- FUNC_END clear_cache
-#else
-#error "This is only for ARM EABI GNU/Linux"
-#endif
-#endif /* L_clear_cache */
-/* ------------------------------------------------------------------------ */
-/* Dword shift operations. */
-/* All the following Dword shift variants rely on the fact that
- shft xxx, Reg
- is in fact done as
- shft xxx, (Reg & 255)
- so for Reg value in (32...63) and (-1...-31) we will get zero (in the
- case of logical shifts) or the sign (for asr). */
-
-#ifdef __ARMEB__
-#define al r1
-#define ah r0
-#else
-#define al r0
-#define ah r1
-#endif
-
-/* Prevent __aeabi double-word shifts from being produced on SymbianOS. */
-#ifndef __symbian__
-
-#ifdef L_lshrdi3
-
- FUNC_START lshrdi3
- FUNC_ALIAS aeabi_llsr lshrdi3
-
-#ifdef __thumb__
- lsr al, r2
- mov r3, ah
- lsr ah, r2
- mov ip, r3
- sub r2, #32
- lsr r3, r2
- orr al, r3
- neg r2, r2
- mov r3, ip
- lsl r3, r2
- orr al, r3
- RET
-#else
- subs r3, r2, #32
- rsb ip, r2, #32
- movmi al, al, lsr r2
- movpl al, ah, lsr r3
- orrmi al, al, ah, lsl ip
- mov ah, ah, lsr r2
- RET
-#endif
- FUNC_END aeabi_llsr
- FUNC_END lshrdi3
-
-#endif
-
-#ifdef L_ashrdi3
-
- FUNC_START ashrdi3
- FUNC_ALIAS aeabi_lasr ashrdi3
-
-#ifdef __thumb__
- lsr al, r2
- mov r3, ah
- asr ah, r2
- sub r2, #32
- @ If r2 is negative at this point the following step would OR
- @ the sign bit into all of AL. That's not what we want...
- bmi 1f
- mov ip, r3
- asr r3, r2
- orr al, r3
- mov r3, ip
-1:
- neg r2, r2
- lsl r3, r2
- orr al, r3
- RET
-#else
- subs r3, r2, #32
- rsb ip, r2, #32
- movmi al, al, lsr r2
- movpl al, ah, asr r3
- orrmi al, al, ah, lsl ip
- mov ah, ah, asr r2
- RET
-#endif
-
- FUNC_END aeabi_lasr
- FUNC_END ashrdi3
-
-#endif
-
-#ifdef L_ashldi3
-
- FUNC_START ashldi3
- FUNC_ALIAS aeabi_llsl ashldi3
-
-#ifdef __thumb__
- lsl ah, r2
- mov r3, al
- lsl al, r2
- mov ip, r3
- sub r2, #32
- lsl r3, r2
- orr ah, r3
- neg r2, r2
- mov r3, ip
- lsr r3, r2
- orr ah, r3
- RET
-#else
- subs r3, r2, #32
- rsb ip, r2, #32
- movmi ah, ah, lsl r2
- movpl ah, al, lsl r3
- orrmi ah, ah, al, lsr ip
- mov al, al, lsl r2
- RET
-#endif
- FUNC_END aeabi_llsl
- FUNC_END ashldi3
-
-#endif
-
-#endif /* __symbian__ */
-
-#if ((__ARM_ARCH__ > 5) && !defined(__ARM_ARCH_6M__)) \
- || defined(__ARM_ARCH_5E__) || defined(__ARM_ARCH_5TE__) \
- || defined(__ARM_ARCH_5TEJ__)
-#define HAVE_ARM_CLZ 1
-#endif
-
-#ifdef L_clzsi2
-#if defined(__ARM_ARCH_6M__)
-FUNC_START clzsi2
- mov r1, #28
- mov r3, #1
- lsl r3, r3, #16
- cmp r0, r3 /* 0x10000 */
- bcc 2f
- lsr r0, r0, #16
- sub r1, r1, #16
-2: lsr r3, r3, #8
- cmp r0, r3 /* #0x100 */
- bcc 2f
- lsr r0, r0, #8
- sub r1, r1, #8
-2: lsr r3, r3, #4
- cmp r0, r3 /* #0x10 */
- bcc 2f
- lsr r0, r0, #4
- sub r1, r1, #4
-2: adr r2, 1f
- ldrb r0, [r2, r0]
- add r0, r0, r1
- bx lr
-.align 2
-1:
-.byte 4, 3, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0
- FUNC_END clzsi2
-#else
-ARM_FUNC_START clzsi2
-# if defined(HAVE_ARM_CLZ)
- clz r0, r0
- RET
-# else
- mov r1, #28
- cmp r0, #0x10000
- do_it cs, t
- movcs r0, r0, lsr #16
- subcs r1, r1, #16
- cmp r0, #0x100
- do_it cs, t
- movcs r0, r0, lsr #8
- subcs r1, r1, #8
- cmp r0, #0x10
- do_it cs, t
- movcs r0, r0, lsr #4
- subcs r1, r1, #4
- adr r2, 1f
- ldrb r0, [r2, r0]
- add r0, r0, r1
- RET
-.align 2
-1:
-.byte 4, 3, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0
-# endif /* !HAVE_ARM_CLZ */
- FUNC_END clzsi2
-#endif
-#endif /* L_clzsi2 */
-
-#ifdef L_clzdi2
-#if !defined(HAVE_ARM_CLZ)
-
-# if defined(__ARM_ARCH_6M__)
-FUNC_START clzdi2
- push {r4, lr}
-# else
-ARM_FUNC_START clzdi2
- do_push {r4, lr}
-# endif
- cmp xxh, #0
- bne 1f
-# ifdef __ARMEB__
- mov r0, xxl
- bl __clzsi2
- add r0, r0, #32
- b 2f
-1:
- bl __clzsi2
-# else
- bl __clzsi2
- add r0, r0, #32
- b 2f
-1:
- mov r0, xxh
- bl __clzsi2
-# endif
-2:
-# if defined(__ARM_ARCH_6M__)
- pop {r4, pc}
-# else
- RETLDM r4
-# endif
- FUNC_END clzdi2
-
-#else /* HAVE_ARM_CLZ */
-
-ARM_FUNC_START clzdi2
- cmp xxh, #0
- do_it eq, et
- clzeq r0, xxl
- clzne r0, xxh
- addeq r0, r0, #32
- RET
- FUNC_END clzdi2
-
-#endif
-#endif /* L_clzdi2 */
-
-/* ------------------------------------------------------------------------ */
-/* These next two sections are here despite the fact that they contain Thumb
- assembler because their presence allows interworked code to be linked even
- when the GCC library is this one. */
-
-/* Do not build the interworking functions when the target architecture does
- not support Thumb instructions. (This can be a multilib option). */
-#if defined __ARM_ARCH_4T__ || defined __ARM_ARCH_5T__\
- || defined __ARM_ARCH_5TE__ || defined __ARM_ARCH_5TEJ__ \
- || __ARM_ARCH__ >= 6
-
-#if defined L_call_via_rX
-
-/* These labels & instructions are used by the Arm/Thumb interworking code.
- The address of function to be called is loaded into a register and then
- one of these labels is called via a BL instruction. This puts the
- return address into the link register with the bottom bit set, and the
- code here switches to the correct mode before executing the function. */
-
- .text
- .align 0
- .force_thumb
-
-.macro call_via register
- THUMB_FUNC_START _call_via_\register
-
- bx \register
- nop
-
- SIZE (_call_via_\register)
-.endm
-
- call_via r0
- call_via r1
- call_via r2
- call_via r3
- call_via r4
- call_via r5
- call_via r6
- call_via r7
- call_via r8
- call_via r9
- call_via sl
- call_via fp
- call_via ip
- call_via sp
- call_via lr
-
-#endif /* L_call_via_rX */
-
-/* Don't bother with the old interworking routines for Thumb-2. */
-/* ??? Maybe only omit these on "m" variants. */
-#if !defined(__thumb2__) && !defined(__ARM_ARCH_6M__)
-
-#if defined L_interwork_call_via_rX
-
-/* These labels & instructions are used by the Arm/Thumb interworking code,
- when the target address is in an unknown instruction set. The address
- of function to be called is loaded into a register and then one of these
- labels is called via a BL instruction. This puts the return address
- into the link register with the bottom bit set, and the code here
- switches to the correct mode before executing the function. Unfortunately
- the target code cannot be relied upon to return via a BX instruction, so
- instead we have to store the resturn address on the stack and allow the
- called function to return here instead. Upon return we recover the real
- return address and use a BX to get back to Thumb mode.
-
- There are three variations of this code. The first,
- _interwork_call_via_rN(), will push the return address onto the
- stack and pop it in _arm_return(). It should only be used if all
- arguments are passed in registers.
-
- The second, _interwork_r7_call_via_rN(), instead stores the return
- address at [r7, #-4]. It is the caller's responsibility to ensure
- that this address is valid and contains no useful data.
-
- The third, _interwork_r11_call_via_rN(), works in the same way but
- uses r11 instead of r7. It is useful if the caller does not really
- need a frame pointer. */
-
- .text
- .align 0
-
- .code 32
- .globl _arm_return
-LSYM(Lstart_arm_return):
- cfi_start LSYM(Lstart_arm_return) LSYM(Lend_arm_return)
- cfi_push 0, 0xe, -0x8, 0x8
- nop @ This nop is for the benefit of debuggers, so that
- @ backtraces will use the correct unwind information.
-_arm_return:
- RETLDM unwind=LSYM(Lstart_arm_return)
- cfi_end LSYM(Lend_arm_return)
-
- .globl _arm_return_r7
-_arm_return_r7:
- ldr lr, [r7, #-4]
- bx lr
-
- .globl _arm_return_r11
-_arm_return_r11:
- ldr lr, [r11, #-4]
- bx lr
-
-.macro interwork_with_frame frame, register, name, return
- .code 16
-
- THUMB_FUNC_START \name
-
- bx pc
- nop
-
- .code 32
- tst \register, #1
- streq lr, [\frame, #-4]
- adreq lr, _arm_return_\frame
- bx \register
-
- SIZE (\name)
-.endm
-
-.macro interwork register
- .code 16
-
- THUMB_FUNC_START _interwork_call_via_\register
-
- bx pc
- nop
-
- .code 32
- .globl LSYM(Lchange_\register)
-LSYM(Lchange_\register):
- tst \register, #1
- streq lr, [sp, #-8]!
- adreq lr, _arm_return
- bx \register
-
- SIZE (_interwork_call_via_\register)
-
- interwork_with_frame r7,\register,_interwork_r7_call_via_\register
- interwork_with_frame r11,\register,_interwork_r11_call_via_\register
-.endm
-
- interwork r0
- interwork r1
- interwork r2
- interwork r3
- interwork r4
- interwork r5
- interwork r6
- interwork r7
- interwork r8
- interwork r9
- interwork sl
- interwork fp
- interwork ip
- interwork sp
-
- /* The LR case has to be handled a little differently... */
- .code 16
-
- THUMB_FUNC_START _interwork_call_via_lr
-
- bx pc
- nop
-
- .code 32
- .globl .Lchange_lr
-.Lchange_lr:
- tst lr, #1
- stmeqdb r13!, {lr, pc}
- mov ip, lr
- adreq lr, _arm_return
- bx ip
-
- SIZE (_interwork_call_via_lr)
-
-#endif /* L_interwork_call_via_rX */
-#endif /* !__thumb2__ */
-
-/* Functions to support compact pic switch tables in thumb1 state.
- All these routines take an index into the table in r0. The
- table is at LR & ~1 (but this must be rounded up in the case
- of 32-bit entires). They are only permitted to clobber r12
- and r14 and r0 must be preserved on exit. */
-#ifdef L_thumb1_case_sqi
-
- .text
- .align 0
- .force_thumb
- .syntax unified
- THUMB_FUNC_START __gnu_thumb1_case_sqi
- push {r1}
- mov r1, lr
- lsrs r1, r1, #1
- lsls r1, r1, #1
- ldrsb r1, [r1, r0]
- lsls r1, r1, #1
- add lr, lr, r1
- pop {r1}
- bx lr
- SIZE (__gnu_thumb1_case_sqi)
-#endif
-
-#ifdef L_thumb1_case_uqi
-
- .text
- .align 0
- .force_thumb
- .syntax unified
- THUMB_FUNC_START __gnu_thumb1_case_uqi
- push {r1}
- mov r1, lr
- lsrs r1, r1, #1
- lsls r1, r1, #1
- ldrb r1, [r1, r0]
- lsls r1, r1, #1
- add lr, lr, r1
- pop {r1}
- bx lr
- SIZE (__gnu_thumb1_case_uqi)
-#endif
-
-#ifdef L_thumb1_case_shi
-
- .text
- .align 0
- .force_thumb
- .syntax unified
- THUMB_FUNC_START __gnu_thumb1_case_shi
- push {r0, r1}
- mov r1, lr
- lsrs r1, r1, #1
- lsls r0, r0, #1
- lsls r1, r1, #1
- ldrsh r1, [r1, r0]
- lsls r1, r1, #1
- add lr, lr, r1
- pop {r0, r1}
- bx lr
- SIZE (__gnu_thumb1_case_shi)
-#endif
-
-#ifdef L_thumb1_case_uhi
-
- .text
- .align 0
- .force_thumb
- .syntax unified
- THUMB_FUNC_START __gnu_thumb1_case_uhi
- push {r0, r1}
- mov r1, lr
- lsrs r1, r1, #1
- lsls r0, r0, #1
- lsls r1, r1, #1
- ldrh r1, [r1, r0]
- lsls r1, r1, #1
- add lr, lr, r1
- pop {r0, r1}
- bx lr
- SIZE (__gnu_thumb1_case_uhi)
-#endif
-
-#ifdef L_thumb1_case_si
-
- .text
- .align 0
- .force_thumb
- .syntax unified
- THUMB_FUNC_START __gnu_thumb1_case_si
- push {r0, r1}
- mov r1, lr
- adds.n r1, r1, #2 /* Align to word. */
- lsrs r1, r1, #2
- lsls r0, r0, #2
- lsls r1, r1, #2
- ldr r0, [r1, r0]
- adds r0, r0, r1
- mov lr, r0
- pop {r0, r1}
- mov pc, lr /* We know we were called from thumb code. */
- SIZE (__gnu_thumb1_case_si)
-#endif
-
-#endif /* Arch supports thumb. */
-
-#ifndef __symbian__
-#ifndef __ARM_ARCH_6M__
-#include "ieee754-df.S"
-#include "ieee754-sf.S"
-#include "bpabi.S"
-#else /* __ARM_ARCH_6M__ */
-#include "bpabi-v6m.S"
-#endif /* __ARM_ARCH_6M__ */
-#endif /* !__symbian__ */
diff --git a/gcc/config/arm/libgcc-bpabi.ver b/gcc/config/arm/libgcc-bpabi.ver
deleted file mode 100644
index 3ba8364dc8e..00000000000
--- a/gcc/config/arm/libgcc-bpabi.ver
+++ /dev/null
@@ -1,108 +0,0 @@
-# Copyright (C) 2004, 2005, 2007 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_3.5 {
- # BPABI symbols
- __aeabi_cdcmpeq
- __aeabi_cdcmple
- __aeabi_cdrcmple
- __aeabi_cfcmpeq
- __aeabi_cfcmple
- __aeabi_cfrcmple
- __aeabi_d2f
- __aeabi_d2iz
- __aeabi_d2lz
- __aeabi_d2uiz
- __aeabi_d2ulz
- __aeabi_dadd
- __aeabi_dcmpeq
- __aeabi_dcmpge
- __aeabi_dcmpgt
- __aeabi_dcmple
- __aeabi_dcmplt
- __aeabi_dcmpun
- __aeabi_ddiv
- __aeabi_dmul
- __aeabi_dneg
- __aeabi_drsub
- __aeabi_dsub
- __aeabi_f2d
- __aeabi_f2iz
- __aeabi_f2lz
- __aeabi_f2uiz
- __aeabi_f2ulz
- __aeabi_fadd
- __aeabi_fcmpeq
- __aeabi_fcmpge
- __aeabi_fcmpgt
- __aeabi_fcmple
- __aeabi_fcmplt
- __aeabi_fcmpun
- __aeabi_fdiv
- __aeabi_fmul
- __aeabi_fneg
- __aeabi_frsub
- __aeabi_fsub
- __aeabi_i2d
- __aeabi_i2f
- __aeabi_idiv
- __aeabi_idiv0
- __aeabi_idivmod
- __aeabi_l2d
- __aeabi_l2f
- __aeabi_lasr
- __aeabi_lcmp
- __aeabi_ldiv0
- __aeabi_ldivmod
- __aeabi_llsl
- __aeabi_llsr
- __aeabi_lmul
- __aeabi_ui2d
- __aeabi_ui2f
- __aeabi_uidiv
- __aeabi_uidivmod
- __aeabi_uldivmod
- __aeabi_ulcmp
- __aeabi_ul2d
- __aeabi_ul2f
- __aeabi_uread4
- __aeabi_uread8
- __aeabi_uwrite4
- __aeabi_uwrite8
-
- # Exception-Handling
- # \S 7.5
- _Unwind_Complete
- _Unwind_VRS_Get
- _Unwind_VRS_Set
- _Unwind_VRS_Pop
- # \S 9.2
- __aeabi_unwind_cpp_pr0
- __aeabi_unwind_cpp_pr1
- __aeabi_unwind_cpp_pr2
- # The libstdc++ exception-handling personality routine uses this
- # GNU-specific entry point.
- __gnu_unwind_frame
-}
-
-%exclude {
- _Unwind_Backtrace
-}
-GCC_4.3.0 {
- _Unwind_Backtrace
-}
diff --git a/gcc/config/arm/linux-atomic-64bit.c b/gcc/config/arm/linux-atomic-64bit.c
deleted file mode 100644
index af94c7f4ae5..00000000000
--- a/gcc/config/arm/linux-atomic-64bit.c
+++ /dev/null
@@ -1,166 +0,0 @@
-/* 64bit Linux-specific atomic operations for ARM EABI.
- Copyright (C) 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
- Based on linux-atomic.c
-
- 64 bit additions david.gilbert@linaro.org
-
-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/>. */
-
-/* 64bit helper functions for atomic operations; the compiler will
- call these when the code is compiled for a CPU without ldrexd/strexd.
- (If the CPU had those then the compiler inlines the operation).
-
- These helpers require a kernel helper that's only present on newer
- kernels; we check for that in an init section and bail out rather
- unceremoneously. */
-
-extern unsigned int __write (int fd, const void *buf, unsigned int count);
-extern void abort (void);
-
-/* Kernel helper for compare-and-exchange. */
-typedef int (__kernel_cmpxchg64_t) (const long long* oldval,
- const long long* newval,
- long long *ptr);
-#define __kernel_cmpxchg64 (*(__kernel_cmpxchg64_t *) 0xffff0f60)
-
-/* Kernel helper page version number. */
-#define __kernel_helper_version (*(unsigned int *)0xffff0ffc)
-
-/* Check that the kernel has a new enough version at load. */
-static void __check_for_sync8_kernelhelper (void)
-{
- if (__kernel_helper_version < 5)
- {
- const char err[] = "A newer kernel is required to run this binary. "
- "(__kernel_cmpxchg64 helper)\n";
- /* At this point we need a way to crash with some information
- for the user - I'm not sure I can rely on much else being
- available at this point, so do the same as generic-morestack.c
- write () and abort (). */
- __write (2 /* stderr. */, err, sizeof (err));
- abort ();
- }
-};
-
-static void (*__sync8_kernelhelper_inithook[]) (void)
- __attribute__ ((used, section (".init_array"))) = {
- &__check_for_sync8_kernelhelper
-};
-
-#define HIDDEN __attribute__ ((visibility ("hidden")))
-
-#define FETCH_AND_OP_WORD64(OP, PFX_OP, INF_OP) \
- long long HIDDEN \
- __sync_fetch_and_##OP##_8 (long long *ptr, long long val) \
- { \
- int failure; \
- long long tmp,tmp2; \
- \
- do { \
- tmp = *ptr; \
- tmp2 = PFX_OP (tmp INF_OP val); \
- failure = __kernel_cmpxchg64 (&tmp, &tmp2, ptr); \
- } while (failure != 0); \
- \
- return tmp; \
- }
-
-FETCH_AND_OP_WORD64 (add, , +)
-FETCH_AND_OP_WORD64 (sub, , -)
-FETCH_AND_OP_WORD64 (or, , |)
-FETCH_AND_OP_WORD64 (and, , &)
-FETCH_AND_OP_WORD64 (xor, , ^)
-FETCH_AND_OP_WORD64 (nand, ~, &)
-
-#define NAME_oldval(OP, WIDTH) __sync_fetch_and_##OP##_##WIDTH
-#define NAME_newval(OP, WIDTH) __sync_##OP##_and_fetch_##WIDTH
-
-/* Implement both __sync_<op>_and_fetch and __sync_fetch_and_<op> for
- subword-sized quantities. */
-
-#define OP_AND_FETCH_WORD64(OP, PFX_OP, INF_OP) \
- long long HIDDEN \
- __sync_##OP##_and_fetch_8 (long long *ptr, long long val) \
- { \
- int failure; \
- long long tmp,tmp2; \
- \
- do { \
- tmp = *ptr; \
- tmp2 = PFX_OP (tmp INF_OP val); \
- failure = __kernel_cmpxchg64 (&tmp, &tmp2, ptr); \
- } while (failure != 0); \
- \
- return tmp2; \
- }
-
-OP_AND_FETCH_WORD64 (add, , +)
-OP_AND_FETCH_WORD64 (sub, , -)
-OP_AND_FETCH_WORD64 (or, , |)
-OP_AND_FETCH_WORD64 (and, , &)
-OP_AND_FETCH_WORD64 (xor, , ^)
-OP_AND_FETCH_WORD64 (nand, ~, &)
-
-long long HIDDEN
-__sync_val_compare_and_swap_8 (long long *ptr, long long oldval,
- long long newval)
-{
- int failure;
- long long actual_oldval;
-
- while (1)
- {
- actual_oldval = *ptr;
-
- if (__builtin_expect (oldval != actual_oldval, 0))
- return actual_oldval;
-
- failure = __kernel_cmpxchg64 (&actual_oldval, &newval, ptr);
-
- if (__builtin_expect (!failure, 1))
- return oldval;
- }
-}
-
-typedef unsigned char bool;
-
-bool HIDDEN
-__sync_bool_compare_and_swap_8 (long long *ptr, long long oldval,
- long long newval)
-{
- int failure = __kernel_cmpxchg64 (&oldval, &newval, ptr);
- return (failure == 0);
-}
-
-long long HIDDEN
-__sync_lock_test_and_set_8 (long long *ptr, long long val)
-{
- int failure;
- long long oldval;
-
- do {
- oldval = *ptr;
- failure = __kernel_cmpxchg64 (&oldval, &val, ptr);
- } while (failure != 0);
-
- return oldval;
-}
diff --git a/gcc/config/arm/linux-atomic.c b/gcc/config/arm/linux-atomic.c
deleted file mode 100644
index 80f161d06a7..00000000000
--- a/gcc/config/arm/linux-atomic.c
+++ /dev/null
@@ -1,279 +0,0 @@
-/* Linux-specific atomic operations for ARM EABI.
- Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
- Contributed by CodeSourcery.
-
-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/>. */
-
-/* Kernel helper for compare-and-exchange. */
-typedef int (__kernel_cmpxchg_t) (int oldval, int newval, int *ptr);
-#define __kernel_cmpxchg (*(__kernel_cmpxchg_t *) 0xffff0fc0)
-
-/* Kernel helper for memory barrier. */
-typedef void (__kernel_dmb_t) (void);
-#define __kernel_dmb (*(__kernel_dmb_t *) 0xffff0fa0)
-
-/* Note: we implement byte, short and int versions of atomic operations using
- the above kernel helpers; see linux-atomic-64bit.c for "long long" (64-bit)
- operations. */
-
-#define HIDDEN __attribute__ ((visibility ("hidden")))
-
-#ifdef __ARMEL__
-#define INVERT_MASK_1 0
-#define INVERT_MASK_2 0
-#else
-#define INVERT_MASK_1 24
-#define INVERT_MASK_2 16
-#endif
-
-#define MASK_1 0xffu
-#define MASK_2 0xffffu
-
-#define FETCH_AND_OP_WORD(OP, PFX_OP, INF_OP) \
- int HIDDEN \
- __sync_fetch_and_##OP##_4 (int *ptr, int val) \
- { \
- int failure, tmp; \
- \
- do { \
- tmp = *ptr; \
- failure = __kernel_cmpxchg (tmp, PFX_OP (tmp INF_OP val), ptr); \
- } while (failure != 0); \
- \
- return tmp; \
- }
-
-FETCH_AND_OP_WORD (add, , +)
-FETCH_AND_OP_WORD (sub, , -)
-FETCH_AND_OP_WORD (or, , |)
-FETCH_AND_OP_WORD (and, , &)
-FETCH_AND_OP_WORD (xor, , ^)
-FETCH_AND_OP_WORD (nand, ~, &)
-
-#define NAME_oldval(OP, WIDTH) __sync_fetch_and_##OP##_##WIDTH
-#define NAME_newval(OP, WIDTH) __sync_##OP##_and_fetch_##WIDTH
-
-/* Implement both __sync_<op>_and_fetch and __sync_fetch_and_<op> for
- subword-sized quantities. */
-
-#define SUBWORD_SYNC_OP(OP, PFX_OP, INF_OP, TYPE, WIDTH, RETURN) \
- TYPE HIDDEN \
- NAME##_##RETURN (OP, WIDTH) (TYPE *ptr, TYPE val) \
- { \
- int *wordptr = (int *) ((unsigned int) ptr & ~3); \
- unsigned int mask, shift, oldval, newval; \
- int failure; \
- \
- shift = (((unsigned int) ptr & 3) << 3) ^ INVERT_MASK_##WIDTH; \
- mask = MASK_##WIDTH << shift; \
- \
- do { \
- oldval = *wordptr; \
- newval = ((PFX_OP (((oldval & mask) >> shift) \
- INF_OP (unsigned int) val)) << shift) & mask; \
- newval |= oldval & ~mask; \
- failure = __kernel_cmpxchg (oldval, newval, wordptr); \
- } while (failure != 0); \
- \
- return (RETURN & mask) >> shift; \
- }
-
-SUBWORD_SYNC_OP (add, , +, unsigned short, 2, oldval)
-SUBWORD_SYNC_OP (sub, , -, unsigned short, 2, oldval)
-SUBWORD_SYNC_OP (or, , |, unsigned short, 2, oldval)
-SUBWORD_SYNC_OP (and, , &, unsigned short, 2, oldval)
-SUBWORD_SYNC_OP (xor, , ^, unsigned short, 2, oldval)
-SUBWORD_SYNC_OP (nand, ~, &, unsigned short, 2, oldval)
-
-SUBWORD_SYNC_OP (add, , +, unsigned char, 1, oldval)
-SUBWORD_SYNC_OP (sub, , -, unsigned char, 1, oldval)
-SUBWORD_SYNC_OP (or, , |, unsigned char, 1, oldval)
-SUBWORD_SYNC_OP (and, , &, unsigned char, 1, oldval)
-SUBWORD_SYNC_OP (xor, , ^, unsigned char, 1, oldval)
-SUBWORD_SYNC_OP (nand, ~, &, unsigned char, 1, oldval)
-
-#define OP_AND_FETCH_WORD(OP, PFX_OP, INF_OP) \
- int HIDDEN \
- __sync_##OP##_and_fetch_4 (int *ptr, int val) \
- { \
- int tmp, failure; \
- \
- do { \
- tmp = *ptr; \
- failure = __kernel_cmpxchg (tmp, PFX_OP (tmp INF_OP val), ptr); \
- } while (failure != 0); \
- \
- return PFX_OP (tmp INF_OP val); \
- }
-
-OP_AND_FETCH_WORD (add, , +)
-OP_AND_FETCH_WORD (sub, , -)
-OP_AND_FETCH_WORD (or, , |)
-OP_AND_FETCH_WORD (and, , &)
-OP_AND_FETCH_WORD (xor, , ^)
-OP_AND_FETCH_WORD (nand, ~, &)
-
-SUBWORD_SYNC_OP (add, , +, unsigned short, 2, newval)
-SUBWORD_SYNC_OP (sub, , -, unsigned short, 2, newval)
-SUBWORD_SYNC_OP (or, , |, unsigned short, 2, newval)
-SUBWORD_SYNC_OP (and, , &, unsigned short, 2, newval)
-SUBWORD_SYNC_OP (xor, , ^, unsigned short, 2, newval)
-SUBWORD_SYNC_OP (nand, ~, &, unsigned short, 2, newval)
-
-SUBWORD_SYNC_OP (add, , +, unsigned char, 1, newval)
-SUBWORD_SYNC_OP (sub, , -, unsigned char, 1, newval)
-SUBWORD_SYNC_OP (or, , |, unsigned char, 1, newval)
-SUBWORD_SYNC_OP (and, , &, unsigned char, 1, newval)
-SUBWORD_SYNC_OP (xor, , ^, unsigned char, 1, newval)
-SUBWORD_SYNC_OP (nand, ~, &, unsigned char, 1, newval)
-
-int HIDDEN
-__sync_val_compare_and_swap_4 (int *ptr, int oldval, int newval)
-{
- int actual_oldval, fail;
-
- while (1)
- {
- actual_oldval = *ptr;
-
- if (__builtin_expect (oldval != actual_oldval, 0))
- return actual_oldval;
-
- fail = __kernel_cmpxchg (actual_oldval, newval, ptr);
-
- if (__builtin_expect (!fail, 1))
- return oldval;
- }
-}
-
-#define SUBWORD_VAL_CAS(TYPE, WIDTH) \
- TYPE HIDDEN \
- __sync_val_compare_and_swap_##WIDTH (TYPE *ptr, TYPE oldval, \
- TYPE newval) \
- { \
- int *wordptr = (int *)((unsigned int) ptr & ~3), fail; \
- unsigned int mask, shift, actual_oldval, actual_newval; \
- \
- shift = (((unsigned int) ptr & 3) << 3) ^ INVERT_MASK_##WIDTH; \
- mask = MASK_##WIDTH << shift; \
- \
- while (1) \
- { \
- actual_oldval = *wordptr; \
- \
- if (__builtin_expect (((actual_oldval & mask) >> shift) != \
- (unsigned int) oldval, 0)) \
- return (actual_oldval & mask) >> shift; \
- \
- actual_newval = (actual_oldval & ~mask) \
- | (((unsigned int) newval << shift) & mask); \
- \
- fail = __kernel_cmpxchg (actual_oldval, actual_newval, \
- wordptr); \
- \
- if (__builtin_expect (!fail, 1)) \
- return oldval; \
- } \
- }
-
-SUBWORD_VAL_CAS (unsigned short, 2)
-SUBWORD_VAL_CAS (unsigned char, 1)
-
-typedef unsigned char bool;
-
-bool HIDDEN
-__sync_bool_compare_and_swap_4 (int *ptr, int oldval, int newval)
-{
- int failure = __kernel_cmpxchg (oldval, newval, ptr);
- return (failure == 0);
-}
-
-#define SUBWORD_BOOL_CAS(TYPE, WIDTH) \
- bool HIDDEN \
- __sync_bool_compare_and_swap_##WIDTH (TYPE *ptr, TYPE oldval, \
- TYPE newval) \
- { \
- TYPE actual_oldval \
- = __sync_val_compare_and_swap_##WIDTH (ptr, oldval, newval); \
- return (oldval == actual_oldval); \
- }
-
-SUBWORD_BOOL_CAS (unsigned short, 2)
-SUBWORD_BOOL_CAS (unsigned char, 1)
-
-void HIDDEN
-__sync_synchronize (void)
-{
- __kernel_dmb ();
-}
-
-int HIDDEN
-__sync_lock_test_and_set_4 (int *ptr, int val)
-{
- int failure, oldval;
-
- do {
- oldval = *ptr;
- failure = __kernel_cmpxchg (oldval, val, ptr);
- } while (failure != 0);
-
- return oldval;
-}
-
-#define SUBWORD_TEST_AND_SET(TYPE, WIDTH) \
- TYPE HIDDEN \
- __sync_lock_test_and_set_##WIDTH (TYPE *ptr, TYPE val) \
- { \
- int failure; \
- unsigned int oldval, newval, shift, mask; \
- int *wordptr = (int *) ((unsigned int) ptr & ~3); \
- \
- shift = (((unsigned int) ptr & 3) << 3) ^ INVERT_MASK_##WIDTH; \
- mask = MASK_##WIDTH << shift; \
- \
- do { \
- oldval = *wordptr; \
- newval = (oldval & ~mask) \
- | (((unsigned int) val << shift) & mask); \
- failure = __kernel_cmpxchg (oldval, newval, wordptr); \
- } while (failure != 0); \
- \
- return (oldval & mask) >> shift; \
- }
-
-SUBWORD_TEST_AND_SET (unsigned short, 2)
-SUBWORD_TEST_AND_SET (unsigned char, 1)
-
-#define SYNC_LOCK_RELEASE(TYPE, WIDTH) \
- void HIDDEN \
- __sync_lock_release_##WIDTH (TYPE *ptr) \
- { \
- /* All writes before this point must be seen before we release \
- the lock itself. */ \
- __kernel_dmb (); \
- *ptr = 0; \
- }
-
-SYNC_LOCK_RELEASE (long long, 8)
-SYNC_LOCK_RELEASE (int, 4)
-SYNC_LOCK_RELEASE (short, 2)
-SYNC_LOCK_RELEASE (char, 1)
diff --git a/gcc/config/arm/linux-eabi.h b/gcc/config/arm/linux-eabi.h
index a3830955948..80bd8259375 100644
--- a/gcc/config/arm/linux-eabi.h
+++ b/gcc/config/arm/linux-eabi.h
@@ -97,7 +97,7 @@
#undef LIBGCC_SPEC
/* Clear the instruction cache from `beg' to `end'. This is
- implemented in lib1funcs.asm, so ensure an error if this definition
+ implemented in lib1funcs.S, so ensure an error if this definition
is used. */
#undef CLEAR_INSN_CACHE
#define CLEAR_INSN_CACHE(BEG, END) not_used
diff --git a/gcc/config/arm/rtems-eabi.h b/gcc/config/arm/rtems-eabi.h
new file mode 100644
index 00000000000..ced98a91bfd
--- /dev/null
+++ b/gcc/config/arm/rtems-eabi.h
@@ -0,0 +1,29 @@
+/* Definitions for RTEMS based ARM systems using EABI.
+ Copyright (C) 2011 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/>. */
+
+#define HAS_INIT_SECTION
+
+#undef TARGET_OS_CPP_BUILTINS
+#define TARGET_OS_CPP_BUILTINS() \
+ do { \
+ builtin_define ("__rtems__"); \
+ builtin_define ("__USE_INIT_FINI__"); \
+ builtin_assert ("system=rtems"); \
+ TARGET_BPABI_CPP_BUILTINS(); \
+ } while (0)
diff --git a/gcc/config/arm/rtems-elf.h b/gcc/config/arm/rtems-elf.h
index 8d5a1d7cf95..d9d24a7c83b 100644
--- a/gcc/config/arm/rtems-elf.h
+++ b/gcc/config/arm/rtems-elf.h
@@ -35,7 +35,7 @@
*/
#undef SUBTARGET_EXTRA_ASM_SPEC
#define SUBTARGET_EXTRA_ASM_SPEC "\
- %{!mfloat-abi=hard: %{!mfloat-abi=soft:-mfpu=softfpa}}"
+ %{!mfloat-abi=hard: %{!mfpu=vfp: %{!mfloat-abi=soft:-mfpu=softfpa}}}"
/*
* The default includes --start-group and --end-group which conflicts
diff --git a/gcc/config/arm/t-arm b/gcc/config/arm/t-arm
index b970ec26a35..a9a174d473d 100644
--- a/gcc/config/arm/t-arm
+++ b/gcc/config/arm/t-arm
@@ -40,9 +40,6 @@ MD_INCLUDES= $(srcdir)/config/arm/arm-tune.md \
$(srcdir)/config/arm/thumb2.md \
$(srcdir)/config/arm/arm-fixed.md
-LIB1ASMSRC = arm/lib1funcs.asm
-LIB1ASMFUNCS = _thumb1_case_sqi _thumb1_case_uqi _thumb1_case_shi \
- _thumb1_case_uhi _thumb1_case_si
s-config s-conditions s-flags s-codes s-constants s-emit s-recog s-preds \
s-opinit s-extract s-peep s-attr s-attrtab s-output: $(MD_INCLUDES)
diff --git a/gcc/config/arm/t-arm-elf b/gcc/config/arm/t-arm-elf
index ab85293ee91..25b7acb5da4 100644
--- a/gcc/config/arm/t-arm-elf
+++ b/gcc/config/arm/t-arm-elf
@@ -17,20 +17,6 @@
# along with GCC; see the file COPYING3. If not see
# <http://www.gnu.org/licenses/>.
-# For most CPUs we have an assembly soft-float implementations.
-# However this is not true for ARMv6M. Here we want to use the soft-fp C
-# implementation. The soft-fp code is only build for ARMv6M. This pulls
-# in the asm implementation for other CPUs.
-LIB1ASMFUNCS += _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_tls _bb_init_func \
- _call_via_rX _interwork_call_via_rX \
- _lshrdi3 _ashrdi3 _ashldi3 \
- _arm_negdf2 _arm_addsubdf3 _arm_muldivdf3 _arm_cmpdf2 _arm_unorddf2 \
- _arm_fixdfsi _arm_fixunsdfsi \
- _arm_truncdfsf2 _arm_negsf2 _arm_addsubsf3 _arm_muldivsf3 \
- _arm_cmpsf2 _arm_unordsf2 _arm_fixsfsi _arm_fixunssfsi \
- _arm_floatdidf _arm_floatdisf _arm_floatundidf _arm_floatundisf \
- _clzsi2 _clzdi2
-
MULTILIB_OPTIONS = marm/mthumb
MULTILIB_DIRNAMES = arm thumb
MULTILIB_EXCEPTIONS =
@@ -103,26 +89,3 @@ MULTILIB_EXCEPTIONS += *mthumb/*mfloat-abi=hard*
# MULTILIB_MATCHES += mcpu?arm7=mcpu?arm600
# MULTILIB_MATCHES += mcpu?arm7=mcpu?arm610
# MULTILIB_MATCHES += mcpu?arm7=mcpu?arm620
-
-EXTRA_MULTILIB_PARTS = crtbegin.o crtend.o crti.o crtn.o
-
-# If EXTRA_MULTILIB_PARTS is not defined above then define EXTRA_PARTS here
-# EXTRA_PARTS = crtbegin.o crtend.o crti.o crtn.o
-
-LIBGCC = stmp-multilib
-INSTALL_LIBGCC = install-multilib
-
-# Currently there is a bug somewhere in GCC's alias analysis
-# or scheduling code that is breaking _fpmul_parts in fp-bit.c.
-# Disabling function inlining is a workaround for this problem.
-TARGET_LIBGCC2_CFLAGS = -fno-inline
-
-# Assemble startup files.
-$(T)crti.o: $(srcdir)/config/arm/crti.asm $(GCC_PASSES)
- $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(MULTILIB_CFLAGS) $(INCLUDES) \
- -c -o $(T)crti.o -x assembler-with-cpp $(srcdir)/config/arm/crti.asm
-
-$(T)crtn.o: $(srcdir)/config/arm/crtn.asm $(GCC_PASSES)
- $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(MULTILIB_CFLAGS) $(INCLUDES) \
- -c -o $(T)crtn.o -x assembler-with-cpp $(srcdir)/config/arm/crtn.asm
-
diff --git a/gcc/config/arm/t-bpabi b/gcc/config/arm/t-bpabi
index d8a1be45dcd..ef019ea3748 100644
--- a/gcc/config/arm/t-bpabi
+++ b/gcc/config/arm/t-bpabi
@@ -1,31 +1 @@
-# Copyright (C) 2004, 2005, 2011 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/>.
-
-# Add the bpabi.S functions.
-LIB1ASMFUNCS += _aeabi_lcmp _aeabi_ulcmp _aeabi_ldivmod _aeabi_uldivmod
-
-# Add the BPABI C functions.
-LIB2FUNCS_EXTRA = $(srcdir)/config/arm/bpabi.c \
- $(srcdir)/config/arm/unaligned-funcs.c
-
-LIB2FUNCS_STATIC_EXTRA = $(srcdir)/config/arm/fp16.c
-
-# Add the BPABI names.
-SHLIB_MAPFILES += $(srcdir)/config/arm/libgcc-bpabi.ver
-
EXTRA_HEADERS += $(srcdir)/ginclude/unwind-arm-common.h
diff --git a/gcc/config/arm/t-linux b/gcc/config/arm/t-linux
deleted file mode 100644
index 9a2cb1aed10..00000000000
--- a/gcc/config/arm/t-linux
+++ /dev/null
@@ -1,34 +0,0 @@
-# Copyright (C) 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2006,
-# 2008, 2011 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/>.
-
-# Just for these, we omit the frame pointer since it makes such a big
-# difference.
-TARGET_LIBGCC2_CFLAGS = -fomit-frame-pointer -fPIC
-
-LIB1ASMSRC = arm/lib1funcs.asm
-LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_lnx _clzsi2 _clzdi2 \
- _arm_addsubdf3 _arm_addsubsf3
-
-# MULTILIB_OPTIONS = mfloat-abi=hard/mfloat-abi=soft
-# MULTILIB_DIRNAMES = hard-float soft-float
-
-# EXTRA_MULTILIB_PARTS = crtbegin.o crtend.o
-
-# LIBGCC = stmp-multilib
-# INSTALL_LIBGCC = install-multilib
diff --git a/gcc/config/arm/t-linux-eabi b/gcc/config/arm/t-linux-eabi
index 3814cc09b81..8004a7d0155 100644
--- a/gcc/config/arm/t-linux-eabi
+++ b/gcc/config/arm/t-linux-eabi
@@ -1,4 +1,4 @@
-# Copyright (C) 2005, 2009, 2010 Free Software Foundation, Inc.
+# Copyright (C) 2005, 2009, 2010, 2011 Free Software Foundation, Inc.
#
# This file is part of GCC.
#
@@ -16,9 +16,6 @@
# along with GCC; see the file COPYING3. If not see
# <http://www.gnu.org/licenses/>.
-# These functions are included in shared libraries.
-TARGET_LIBGCC2_CFLAGS = -fPIC
-
# We do not build a Thumb multilib for Linux because the definition of
# CLEAR_INSN_CACHE in linux-gas.h does not work in Thumb mode.
MULTILIB_OPTIONS =
@@ -27,13 +24,3 @@ MULTILIB_DIRNAMES =
#MULTILIB_OPTIONS += mcpu=fa606te/mcpu=fa626te/mcpu=fmp626/mcpu=fa726te
#MULTILIB_DIRNAMES += fa606te fa626te fmp626 fa726te
#MULTILIB_EXCEPTIONS += *mthumb/*mcpu=fa606te *mthumb/*mcpu=fa626te *mthumb/*mcpu=fmp626 *mthumb/*mcpu=fa726te*
-
-# Use a version of div0 which raises SIGFPE, and a special __clear_cache.
-LIB1ASMFUNCS := $(filter-out _dvmd_tls,$(LIB1ASMFUNCS)) _dvmd_lnx _clear_cache
-
-# Multilib the standard Linux files. Don't include crti.o or crtn.o,
-# which are provided by glibc.
-EXTRA_MULTILIB_PARTS=crtbegin.o crtend.o crtbeginS.o crtendS.o crtbeginT.o
-
-LIB2FUNCS_STATIC_EXTRA += $(srcdir)/config/arm/linux-atomic.c
-LIB2FUNCS_STATIC_EXTRA += $(srcdir)/config/arm/linux-atomic-64bit.c
diff --git a/gcc/config/arm/t-netbsd b/gcc/config/arm/t-netbsd
deleted file mode 100644
index 22bbbe7dd4b..00000000000
--- a/gcc/config/arm/t-netbsd
+++ /dev/null
@@ -1,47 +0,0 @@
-# Copyright (C) 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
-# 2006 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/>.
-
-# Just for these, we omit the frame pointer since it makes such a big
-# difference. It is then pointless adding debugging.
-TARGET_LIBGCC2_CFLAGS = -fomit-frame-pointer -fpic
-LIBGCC2_DEBUG_CFLAGS = -g0
-LIB2FUNCS_EXTRA = $(srcdir)/config/floatunsidf.c $(srcdir)/config/floatunsisf.c
-
-# Build a shared libgcc library.
-SHLIB_EXT = .so
-SHLIB_NAME = @shlib_base_name@.so
-SHLIB_SONAME = @shlib_base_name@.so.1
-SHLIB_OBJS = @shlib_objs@
-
-SHLIB_LINK = $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) -shared -nodefaultlibs \
- -Wl,-soname,$(SHLIB_SONAME) \
- -o $(SHLIB_NAME).tmp @multilib_flags@ $(SHLIB_OBJS) -lc && \
- rm -f $(SHLIB_SONAME) && \
- if [ -f $(SHLIB_NAME) ]; then \
- mv -f $(SHLIB_NAME) $(SHLIB_NAME).backup; \
- else true; fi && \
- mv $(SHLIB_NAME).tmp $(SHLIB_NAME) && \
- $(LN_S) $(SHLIB_NAME) $(SHLIB_SONAME)
-# $(slibdir) double quoted to protect it from expansion while building
-# libgcc.mk. We want this delayed until actual install time.
-SHLIB_INSTALL = \
- $$(mkinstalldirs) $$(DESTDIR)$$(slibdir); \
- $(INSTALL_DATA) $(SHLIB_NAME) $$(DESTDIR)$$(slibdir)/$(SHLIB_SONAME); \
- rm -f $$(DESTDIR)$$(slibdir)/$(SHLIB_NAME); \
- $(LN_S) $(SHLIB_SONAME) $$(DESTDIR)$$(slibdir)/$(SHLIB_NAME)
diff --git a/gcc/config/arm/t-rtems b/gcc/config/arm/t-rtems
index f12387fb1b9..5eff411e76e 100644
--- a/gcc/config/arm/t-rtems
+++ b/gcc/config/arm/t-rtems
@@ -5,6 +5,41 @@ MULTILIB_DIRNAMES = arm thumb
MULTILIB_EXCEPTIONS =
MULTILIB_MATCHES = marm=mno-thumb
-MULTILIB_OPTIONS += mfloat-abi=soft/mfloat-abi=hard
-MULTILIB_DIRNAMES += soft fpu
-MULTILIB_EXCEPTIONS += *mthumb/*mfloat-abi=hard*
+MULTILIB_OPTIONS += mfloat-abi=hard/mfloat-abi=softfp
+MULTILIB_DIRNAMES += fpu softfp
+MULTILIB_EXCEPTIONS += *mthumb*/*mfloat-abi=hard* *mthumb*/*mfloat-abi=softfp*
+MULTILIB_MATCHES =
+
+MULTILIB_OPTIONS += mfpu=vfp
+MULTILIB_DIRNAMES += vfp
+MULTILIB_EXCEPTIONS += *mfloat-abi=hard*/*mfpu=vfp* *marm*/*mfloat-abi=softfp*/*mfpu=fpa*
+MULTILIB_EXCLUSIONS += !mthumb/mfloat-abi=softfp/!mfpu=vfp
+
+# default float model is fpa, so don't create a explicit copy of it
+MULTILIB_EXCEPTIONS += *marm*/*mfpa*
+
+# permutations of the options which are useful (+) or make no sense (-),
+# defaults are in brackets:
+# + (arm/soft/fpa)
+# + (arm/soft)/vfp
+# - (arm)/softfp(/fpa)
+# + (arm)/softfp/vfp
+# + (arm)/float-abi=hard(/fpa)
+# - (arm)/float-abi=hard/vfp
+# + thumb/(soft/fpa)
+# + thumb/(soft/)vfp
+# - thumb/softfp/fpa
+# - thumb/softfp/vfp
+# - thumb/float-abi=hard/fpa
+# - thumb/float-abi=hard/vfp
+
+# subdirs to be used for multilibs and their respective options:
+#/thumb/vfp -> thumb/soft/vfp
+#/thumb/fpa -> thumb/soft/fpa
+#/thumb -> thumb/soft/fpa
+#/vfp -> arm/soft/vfp
+#/softfp/vfp -> arm/softfp/cfp
+#/fpu/fpa -> arm/hard/fpa
+#/fpu -> arm/hard/fpa
+#/fpa -> arm/soft/fpa
+#. -> arm/soft/fpa
diff --git a/gcc/config/arm/t-rtems-eabi b/gcc/config/arm/t-rtems-eabi
new file mode 100644
index 00000000000..f0e714a9bc5
--- /dev/null
+++ b/gcc/config/arm/t-rtems-eabi
@@ -0,0 +1,8 @@
+# Custom RTEMS EABI multilibs
+
+MULTILIB_OPTIONS = mthumb march=armv6-m/march=armv7/march=armv7-m
+MULTILIB_DIRNAMES = thumb armv6-m armv7 armv7-m
+MULTILIB_EXCEPTIONS = march=armv6-m march=armv7 march=armv7-m
+MULTILIB_MATCHES =
+MULTILIB_EXCLUSIONS =
+MULTILIB_OSDIRNAMES =
diff --git a/gcc/config/arm/t-strongarm-elf b/gcc/config/arm/t-strongarm-elf
index 4a4f4533ec1..0639e695800 100644
--- a/gcc/config/arm/t-strongarm-elf
+++ b/gcc/config/arm/t-strongarm-elf
@@ -17,27 +17,7 @@
# along with GCC; see the file COPYING3. If not see
# <http://www.gnu.org/licenses/>.
-LIB1ASMFUNCS += _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_tls _bb_init_func _clzsi2 _clzdi2
-
MULTILIB_OPTIONS = mlittle-endian/mbig-endian mfloat-abi=hard/mfloat-abi=soft
MULTILIB_DIRNAMES = le be fpu soft
MULTILIB_EXCEPTIONS =
MULTILIB_MATCHES = mbig-endian=mbe mlittle-endian=mle
-EXTRA_MULTILIB_PARTS = crtbegin.o crtend.o crti.o crtn.o
-
-LIBGCC = stmp-multilib
-INSTALL_LIBGCC = install-multilib
-
-# Currently there is a bug somewhere in GCC's alias analysis
-# or scheduling code that is breaking _fpmul_parts in fp-bit.c.
-# Disabling function inlining is a workaround for this problem.
-TARGET_LIBGCC2_CFLAGS = -fno-inline
-
-# Assemble startup files.
-$(T)crti.o: $(srcdir)/config/arm/crti.asm $(GCC_PASSES)
- $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(MULTILIB_CFLAGS) $(INCLUDES) \
- -c -o $(T)crti.o -x assembler-with-cpp $(srcdir)/config/arm/crti.asm
-
-$(T)crtn.o: $(srcdir)/config/arm/crtn.asm $(GCC_PASSES)
- $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(MULTILIB_CFLAGS) $(INCLUDES) \
- -c -o $(T)crtn.o -x assembler-with-cpp $(srcdir)/config/arm/crtn.asm
diff --git a/gcc/config/arm/t-symbian b/gcc/config/arm/t-symbian
index e37d473eca0..473957e3290 100644
--- a/gcc/config/arm/t-symbian
+++ b/gcc/config/arm/t-symbian
@@ -16,23 +16,7 @@
# along with GCC; see the file COPYING3. If not see
# <http://www.gnu.org/licenses/>.
-LIB1ASMFUNCS += _bb_init_func _call_via_rX _interwork_call_via_rX _clzsi2 _clzdi2
-
-# These functions have __aeabi equivalents and will never be called by GCC.
-# By putting them in LIB1ASMFUNCS, we avoid the standard libgcc2.c code being
-# used -- and we make sure that definitions are not available in lib1funcs.asm,
-# either, so they end up undefined.
-LIB1ASMFUNCS += \
- _ashldi3 _ashrdi3 _divdi3 _floatdidf _udivmoddi4 _umoddi3 \
- _udivdi3 _lshrdi3 _moddi3 _muldi3 _negdi2 _cmpdi2 \
- _fixdfdi _fixsfdi _fixunsdfdi _fixunssfdi _floatdisf \
- _negdf2 _addsubdf3 _muldivdf3 _cmpdf2 _unorddf2 _fixdfsi _fixunsdfsi \
- _truncdfsf2 _negsf2 _addsubsf3 _muldivsf3 _cmpsf2 _unordsf2 \
- _fixsfsi _fixunssfsi
-
EXTRA_HEADERS += $(srcdir)/ginclude/unwind-arm-common.h
-# Include half-float helpers.
-LIB2FUNCS_STATIC_EXTRA = $(srcdir)/config/arm/fp16.c
# Create a multilib for processors with VFP floating-point, and a
# multilib for those without -- using the soft-float ABI in both
@@ -40,10 +24,3 @@ LIB2FUNCS_STATIC_EXTRA = $(srcdir)/config/arm/fp16.c
# enabled, so there are no separate thumb-mode libraries.
MULTILIB_OPTIONS = mfloat-abi=softfp
MULTILIB_DIRNAMES = softfp
-
-# There is no C library to link against on Symbian OS -- at least when
-# building GCC.
-SHLIB_LC =
-
-# Symbian OS provides its own startup code.
-EXTRA_MULTILIB_PARTS=
diff --git a/gcc/config/arm/t-vxworks b/gcc/config/arm/t-vxworks
index 8ac0d9bcec5..0900ffe15ed 100644
--- a/gcc/config/arm/t-vxworks
+++ b/gcc/config/arm/t-vxworks
@@ -16,8 +16,6 @@
# along with GCC; see the file COPYING3. If not see
# <http://www.gnu.org/licenses/>.
-LIB1ASMFUNCS += _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_tls _bb_init_func _call_via_rX _interwork_call_via_rX _clzsi2 _clzdi2
-
MULTILIB_OPTIONS = \
mrtp fPIC \
t4/t4be/t4t/t4tbe/t5/t5be/t5t/t5tbe/tstrongarm/txscale/txscalebe
diff --git a/gcc/config/arm/t-wince-pe b/gcc/config/arm/t-wince-pe
index 9ce1f313140..becda7f25a4 100644
--- a/gcc/config/arm/t-wince-pe
+++ b/gcc/config/arm/t-wince-pe
@@ -17,8 +17,6 @@
# along with GCC; see the file COPYING3. If not see
# <http://www.gnu.org/licenses/>.
-LIB1ASMFUNCS += _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_tls _call_via_rX _interwork_call_via_rX _clzsi2 _clzdi2
-
pe.o: $(srcdir)/config/arm/pe.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
$(RTL_H) output.h flags.h $(TREE_H) expr.h $(TM_P_H)
$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
@@ -31,7 +29,3 @@ MULTILIB_DIRNAMES = fpu
# yet...
# MULTILIB_OPTIONS += thumb
# MULTILIB_DIRNAMES += thumb
-
-LIBGCC = stmp-multilib
-INSTALL_LIBGCC = install-multilib
-TARGET_LIBGCC2_CFLAGS =
diff --git a/gcc/config/arm/unaligned-funcs.c b/gcc/config/arm/unaligned-funcs.c
deleted file mode 100644
index 4e684f4fc94..00000000000
--- a/gcc/config/arm/unaligned-funcs.c
+++ /dev/null
@@ -1,57 +0,0 @@
-/* EABI unaligned read/write functions.
-
- Copyright (C) 2005, 2009 Free Software Foundation, Inc.
- Contributed by CodeSourcery, LLC.
-
- This file is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the
- Free Software Foundation; either version 3, or (at your option) any
- later version.
-
- This file 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/>. */
-
-int __aeabi_uread4 (void *);
-int __aeabi_uwrite4 (int, void *);
-long long __aeabi_uread8 (void *);
-long long __aeabi_uwrite8 (long long, void *);
-
-struct __attribute__((packed)) u4 { int data; };
-struct __attribute__((packed)) u8 { long long data; };
-
-int
-__aeabi_uread4 (void *ptr)
-{
- return ((struct u4 *) ptr)->data;
-}
-
-int
-__aeabi_uwrite4 (int data, void *ptr)
-{
- ((struct u4 *) ptr)->data = data;
- return data;
-}
-
-long long
-__aeabi_uread8 (void *ptr)
-{
- return ((struct u8 *) ptr)->data;
-}
-
-long long
-__aeabi_uwrite8 (long long data, void *ptr)
-{
- ((struct u8 *) ptr)->data = data;
- return data;
-}
diff --git a/gcc/config/avr/avr-c.c b/gcc/config/avr/avr-c.c
index abe25ab590e..55de2d7fe4b 100644
--- a/gcc/config/avr/avr-c.c
+++ b/gcc/config/avr/avr-c.c
@@ -105,4 +105,8 @@ avr_cpu_cpp_builtins (struct cpp_reader *pfile)
cpp_define (pfile, "__BUILTIN_AVR_FMUL");
cpp_define (pfile, "__BUILTIN_AVR_FMULS");
cpp_define (pfile, "__BUILTIN_AVR_FMULSU");
+
+ cpp_define (pfile, "__INT24_MAX__=8388607L");
+ cpp_define (pfile, "__INT24_MIN__=(-__INT24_MAX__-1)");
+ cpp_define (pfile, "__UINT24_MAX__=16777215UL");
}
diff --git a/gcc/config/avr/avr-modes.def b/gcc/config/avr/avr-modes.def
new file mode 100644
index 00000000000..4a16f888ddf
--- /dev/null
+++ b/gcc/config/avr/avr-modes.def
@@ -0,0 +1 @@
+FRACTIONAL_INT_MODE (PSI, 24, 3);
diff --git a/gcc/config/avr/avr-protos.h b/gcc/config/avr/avr-protos.h
index b32e697f9ca..f72c5f8ab15 100644
--- a/gcc/config/avr/avr-protos.h
+++ b/gcc/config/avr/avr-protos.h
@@ -59,8 +59,10 @@ extern const char *out_movsi_mr_r (rtx insn, rtx op[], int *l);
extern const char *output_movsisf (rtx insn, rtx operands[], int *l);
extern const char *avr_out_tstsi (rtx, rtx*, int*);
extern const char *avr_out_tsthi (rtx, rtx*, int*);
+extern const char *avr_out_tstpsi (rtx, rtx*, int*);
extern const char *avr_out_compare (rtx, rtx*, int*);
extern const char *ret_cond_branch (rtx x, int len, int reverse);
+extern const char *avr_out_movpsi (rtx, rtx*, int*);
extern const char *ashlqi3_out (rtx insn, rtx operands[], int *len);
extern const char *ashlhi3_out (rtx insn, rtx operands[], int *len);
@@ -73,6 +75,11 @@ extern const char *ashrsi3_out (rtx insn, rtx operands[], int *len);
extern const char *lshrqi3_out (rtx insn, rtx operands[], int *len);
extern const char *lshrhi3_out (rtx insn, rtx operands[], int *len);
extern const char *lshrsi3_out (rtx insn, rtx operands[], int *len);
+
+extern const char *avr_out_ashlpsi3 (rtx, rtx*, int*);
+extern const char *avr_out_ashrpsi3 (rtx, rtx*, int*);
+extern const char *avr_out_lshrpsi3 (rtx, rtx*, int*);
+
extern bool avr_rotate_bytes (rtx operands[]);
extern void expand_prologue (void);
@@ -93,6 +100,7 @@ extern int extra_constraint_Q (rtx x);
extern int adjust_insn_length (rtx insn, int len);
extern const char* output_reload_inhi (rtx*, rtx, int*);
extern const char* output_reload_insisf (rtx*, rtx, int*);
+extern const char* avr_out_reload_inpsi (rtx*, rtx, int*);
extern void notice_update_cc (rtx body, rtx insn);
extern void print_operand (FILE *file, rtx x, int code);
extern void print_operand_address (FILE *file, rtx addr);
diff --git a/gcc/config/avr/avr.c b/gcc/config/avr/avr.c
index 6435c4854f5..630b7ef19ee 100644
--- a/gcc/config/avr/avr.c
+++ b/gcc/config/avr/avr.c
@@ -71,7 +71,8 @@ static const char *ptrreg_to_str (int);
static const char *cond_string (enum rtx_code);
static int avr_num_arg_regs (enum machine_mode, const_tree);
static int avr_operand_rtx_cost (rtx, enum machine_mode, enum rtx_code,
- int, bool);
+ int, bool);
+static void output_reload_in_const (rtx*, rtx, int*, bool);
static struct machine_function * avr_init_machine_status (void);
@@ -217,6 +218,9 @@ bool avr_need_copy_data_p = false;
#undef TARGET_ASM_FUNCTION_RODATA_SECTION
#define TARGET_ASM_FUNCTION_RODATA_SECTION avr_asm_function_rodata_section
+#undef TARGET_SCALAR_MODE_SUPPORTED_P
+#define TARGET_SCALAR_MODE_SUPPORTED_P avr_scalar_mode_supported_p
+
/* Custom function to replace string prefix.
@@ -369,6 +373,17 @@ avr_regno_reg_class (int r)
return ALL_REGS;
}
+
+static bool
+avr_scalar_mode_supported_p (enum machine_mode mode)
+{
+ if (PSImode == mode)
+ return true;
+
+ return default_scalar_mode_supported_p (mode);
+}
+
+
/* A helper for the subsequent function attribute used to dig for
attribute 'name' in a FUNCTION_DECL or FUNCTION_TYPE */
@@ -1487,7 +1502,7 @@ avr_legitimize_reload_address (rtx *px, enum machine_mode mode,
/* Helper function to print assembler resp. track instruction
- sequence lengths.
+ sequence lengths. Always return "".
If PLEN == NULL:
Output assembler code from template TPL with operands supplied
@@ -1499,7 +1514,7 @@ avr_legitimize_reload_address (rtx *px, enum machine_mode mode,
Don't output anything.
*/
-static void
+static const char*
avr_asm_len (const char* tpl, rtx* operands, int* plen, int n_words)
{
if (NULL == plen)
@@ -1513,6 +1528,8 @@ avr_asm_len (const char* tpl, rtx* operands, int* plen, int n_words)
else
*plen += n_words;
}
+
+ return "";
}
@@ -1562,6 +1579,8 @@ cond_string (enum rtx_code code)
default:
gcc_unreachable ();
}
+
+ return "";
}
/* Output ADDR to FILE as address. */
@@ -1968,6 +1987,7 @@ avr_simplify_comparison_p (enum machine_mode mode, RTX_CODE op, rtx x)
{
unsigned int max = (mode == QImode ? 0xff :
mode == HImode ? 0xffff :
+ mode == PSImode ? 0xffffff :
mode == SImode ? 0xffffffff : 0);
if (max && op && GET_CODE (x) == CONST_INT)
{
@@ -2182,52 +2202,10 @@ output_movqi (rtx insn, rtx operands[], int *l)
return AS2 (mov,%0,%1);
}
else if (CONSTANT_P (src))
- {
- if (test_hard_reg_class (LD_REGS, dest)) /* ldi d,i */
- return AS2 (ldi,%0,lo8(%1));
-
- if (GET_CODE (src) == CONST_INT)
- {
- if (src == const0_rtx) /* mov r,L */
- return AS1 (clr,%0);
- else if (src == const1_rtx)
- {
- *l = 2;
- return (AS1 (clr,%0) CR_TAB
- AS1 (inc,%0));
- }
- else if (src == constm1_rtx)
- {
- /* Immediate constants -1 to any register */
- *l = 2;
- return (AS1 (clr,%0) CR_TAB
- AS1 (dec,%0));
- }
- else
- {
- int bit_nr = exact_log2 (INTVAL (src));
-
- if (bit_nr >= 0)
- {
- *l = 3;
- if (!real_l)
- output_asm_insn ((AS1 (clr,%0) CR_TAB
- "set"), operands);
- if (!real_l)
- avr_output_bld (operands, bit_nr);
-
- return "";
- }
- }
- }
-
- /* Last resort, larger than loading from memory. */
- *l = 4;
- return (AS2 (mov,__tmp_reg__,r31) CR_TAB
- AS2 (ldi,r31,lo8(%1)) CR_TAB
- AS2 (mov,%0,r31) CR_TAB
- AS2 (mov,r31,__tmp_reg__));
- }
+ {
+ output_reload_in_const (operands, NULL_RTX, real_l, false);
+ return "";
+ }
else if (GET_CODE (src) == MEM)
return out_movqi_r_mr (insn, operands, real_l); /* mov r,m */
}
@@ -2956,6 +2934,306 @@ output_movsisf (rtx insn, rtx operands[], int *l)
return "";
}
+
+/* Handle loads of 24-bit types from memory to register. */
+
+static const char*
+avr_out_load_psi (rtx insn, rtx *op, int *plen)
+{
+ rtx dest = op[0];
+ rtx src = op[1];
+ rtx base = XEXP (src, 0);
+ int reg_dest = true_regnum (dest);
+ int reg_base = true_regnum (base);
+
+ if (reg_base > 0)
+ {
+ if (reg_base == REG_X) /* (R26) */
+ {
+ if (reg_dest == REG_X)
+ /* "ld r26,-X" is undefined */
+ return avr_asm_len ("adiw r26,2" CR_TAB
+ "ld r28,X" CR_TAB
+ "ld __tmp_reg__,-X" CR_TAB
+ "sbiw r26,1" CR_TAB
+ "ld r26,X" CR_TAB
+ "mov r27,__tmp_reg__", op, plen, -6);
+ else
+ {
+ avr_asm_len ("ld %A0,X+" CR_TAB
+ "ld %B0,X+" CR_TAB
+ "ld %C0,X", op, plen, -3);
+
+ if (reg_dest != REG_X - 2
+ && !reg_unused_after (insn, base))
+ {
+ avr_asm_len ("sbiw r26,2", op, plen, 1);
+ }
+
+ return "";
+ }
+ }
+ else /* reg_base != REG_X */
+ {
+ if (reg_dest == reg_base)
+ return avr_asm_len ("ldd %C0,%1+2" CR_TAB
+ "ldd __tmp_reg__,%1+1" CR_TAB
+ "ld %A0,%1" CR_TAB
+ "mov %B0,__tmp_reg__", op, plen, -4);
+ else
+ return avr_asm_len ("ld %A0,%1" CR_TAB
+ "ldd %B0,%1+1" CR_TAB
+ "ldd %C0,%1+2", op, plen, -3);
+ }
+ }
+ else if (GET_CODE (base) == PLUS) /* (R + i) */
+ {
+ int disp = INTVAL (XEXP (base, 1));
+
+ if (disp > MAX_LD_OFFSET (GET_MODE (src)))
+ {
+ if (REGNO (XEXP (base, 0)) != REG_Y)
+ fatal_insn ("incorrect insn:",insn);
+
+ if (disp <= 63 + MAX_LD_OFFSET (GET_MODE (src)))
+ return avr_asm_len ("adiw r28,%o1-61" CR_TAB
+ "ldd %A0,Y+61" CR_TAB
+ "ldd %B0,Y+62" CR_TAB
+ "ldd %C0,Y+63" CR_TAB
+ "sbiw r28,%o1-61", op, plen, -5);
+
+ return avr_asm_len ("subi r28,lo8(-%o1)" CR_TAB
+ "sbci r29,hi8(-%o1)" CR_TAB
+ "ld %A0,Y" CR_TAB
+ "ldd %B0,Y+1" CR_TAB
+ "ldd %C0,Y+2" CR_TAB
+ "subi r28,lo8(%o1)" CR_TAB
+ "sbci r29,hi8(%o1)", op, plen, -7);
+ }
+
+ reg_base = true_regnum (XEXP (base, 0));
+ if (reg_base == REG_X)
+ {
+ /* R = (X + d) */
+ if (reg_dest == REG_X)
+ {
+ /* "ld r26,-X" is undefined */
+ return avr_asm_len ("adiw r26,%o1+2" CR_TAB
+ "ld r28,X" CR_TAB
+ "ld __tmp_reg__,-X" CR_TAB
+ "sbiw r26,1" CR_TAB
+ "ld r26,X" CR_TAB
+ "mov r27,__tmp_reg__", op, plen, -6);
+ }
+
+ avr_asm_len ("adiw r26,%o1" CR_TAB
+ "ld r24,X+" CR_TAB
+ "ld r25,X+" CR_TAB
+ "ld r26,X", op, plen, -4);
+
+ if (reg_dest != REG_X - 2)
+ avr_asm_len ("sbiw r26,%o1+2", op, plen, 1);
+
+ return "";
+ }
+
+ if (reg_dest == reg_base)
+ return avr_asm_len ("ldd %C0,%C1" CR_TAB
+ "ldd __tmp_reg__,%B1" CR_TAB
+ "ldd %A0,%A1" CR_TAB
+ "mov %B0,__tmp_reg__", op, plen, -4);
+
+ return avr_asm_len ("ldd %A0,%A1" CR_TAB
+ "ldd %B0,%B1" CR_TAB
+ "ldd %C0,%C1", op, plen, -3);
+ }
+ else if (GET_CODE (base) == PRE_DEC) /* (--R) */
+ return avr_asm_len ("ld %C0,%1" CR_TAB
+ "ld %B0,%1" CR_TAB
+ "ld %A0,%1", op, plen, -3);
+ else if (GET_CODE (base) == POST_INC) /* (R++) */
+ return avr_asm_len ("ld %A0,%1" CR_TAB
+ "ld %B0,%1" CR_TAB
+ "ld %C0,%1", op, plen, -3);
+
+ else if (CONSTANT_ADDRESS_P (base))
+ return avr_asm_len ("lds %A0,%m1" CR_TAB
+ "lds %B0,%m1+1" CR_TAB
+ "lds %C0,%m1+2", op, plen , -6);
+
+ fatal_insn ("unknown move insn:",insn);
+ return "";
+}
+
+/* Handle store of 24-bit type from register or zero to memory. */
+
+static const char*
+avr_out_store_psi (rtx insn, rtx *op, int *plen)
+{
+ rtx dest = op[0];
+ rtx src = op[1];
+ rtx base = XEXP (dest, 0);
+ int reg_base = true_regnum (base);
+
+ if (CONSTANT_ADDRESS_P (base))
+ return avr_asm_len ("sts %m0,%A1" CR_TAB
+ "sts %m0+1,%B1" CR_TAB
+ "sts %m0+2,%C1", op, plen, -6);
+
+ if (reg_base > 0) /* (r) */
+ {
+ if (reg_base == REG_X) /* (R26) */
+ {
+ gcc_assert (!reg_overlap_mentioned_p (base, src));
+
+ avr_asm_len ("st %0+,%A1" CR_TAB
+ "st %0+,%B1" CR_TAB
+ "st %0,%C1", op, plen, -3);
+
+ if (!reg_unused_after (insn, base))
+ avr_asm_len ("sbiw r26,2", op, plen, 1);
+
+ return "";
+ }
+ else
+ return avr_asm_len ("st %0,%A1" CR_TAB
+ "std %0+1,%B1" CR_TAB
+ "std %0+2,%C1", op, plen, -3);
+ }
+ else if (GET_CODE (base) == PLUS) /* (R + i) */
+ {
+ int disp = INTVAL (XEXP (base, 1));
+ reg_base = REGNO (XEXP (base, 0));
+
+ if (disp > MAX_LD_OFFSET (GET_MODE (dest)))
+ {
+ if (reg_base != REG_Y)
+ fatal_insn ("incorrect insn:",insn);
+
+ if (disp <= 63 + MAX_LD_OFFSET (GET_MODE (dest)))
+ return avr_asm_len ("adiw r28,%o0-61" CR_TAB
+ "std Y+61,%A1" CR_TAB
+ "std Y+62,%B1" CR_TAB
+ "std Y+63,%C1" CR_TAB
+ "sbiw r28,%o0-60", op, plen, -5);
+
+ return avr_asm_len ("subi r28,lo8(-%o0)" CR_TAB
+ "sbci r29,hi8(-%o0)" CR_TAB
+ "st Y,%A1" CR_TAB
+ "std Y+1,%B1" CR_TAB
+ "std Y+2,%C1" CR_TAB
+ "subi r28,lo8(%o0)" CR_TAB
+ "sbci r29,hi8(%o0)", op, plen, -7);
+ }
+ if (reg_base == REG_X)
+ {
+ /* (X + d) = R */
+ gcc_assert (!reg_overlap_mentioned_p (XEXP (base, 0), src));
+
+ avr_asm_len ("adiw r26,%o0" CR_TAB
+ "st X+,%A1" CR_TAB
+ "st X+,%B1" CR_TAB
+ "st X,%C1", op, plen, -4);
+
+ if (!reg_unused_after (insn, XEXP (base, 0)))
+ avr_asm_len ("sbiw r26,%o0+2", op, plen, 1);
+
+ return "";
+ }
+
+ return avr_asm_len ("std %A0,%A1" CR_TAB
+ "std %B0,%B1" CR_TAB
+ "std %C0,%C1", op, plen, -3);
+ }
+ else if (GET_CODE (base) == PRE_DEC) /* (--R) */
+ return avr_asm_len ("st %0,%C1" CR_TAB
+ "st %0,%B1" CR_TAB
+ "st %0,%A1", op, plen, -3);
+ else if (GET_CODE (base) == POST_INC) /* (R++) */
+ return avr_asm_len ("st %0,%A1" CR_TAB
+ "st %0,%B1" CR_TAB
+ "st %0,%C1", op, plen, -3);
+
+ fatal_insn ("unknown move insn:",insn);
+ return "";
+}
+
+
+/* Move around 24-bit stuff. */
+
+const char *
+avr_out_movpsi (rtx insn, rtx *op, int *plen)
+{
+ rtx dest = op[0];
+ rtx src = op[1];
+
+ if (register_operand (dest, VOIDmode))
+ {
+ if (register_operand (src, VOIDmode)) /* mov r,r */
+ {
+ if (true_regnum (dest) > true_regnum (src))
+ {
+ avr_asm_len ("mov %C0,%C1", op, plen, -1);
+
+ if (AVR_HAVE_MOVW)
+ return avr_asm_len ("movw %A0,%A1", op, plen, 1);
+ else
+ return avr_asm_len ("mov %B0,%B1" CR_TAB
+ "mov %A0,%A1", op, plen, 2);
+ }
+ else
+ {
+ if (AVR_HAVE_MOVW)
+ avr_asm_len ("movw %A0,%A1", op, plen, -1);
+ else
+ avr_asm_len ("mov %A0,%A1" CR_TAB
+ "mov %B0,%B1", op, plen, -2);
+
+ return avr_asm_len ("mov %C0,%C1", op, plen, 1);
+ }
+ }
+ else if (CONST_INT_P (src))
+ {
+ return avr_out_reload_inpsi (op, NULL_RTX, plen);
+ }
+ else if (CONSTANT_P (src))
+ {
+ if (test_hard_reg_class (LD_REGS, dest)) /* ldi d,i */
+ {
+ return avr_asm_len ("ldi %A0,lo8(%1)" CR_TAB
+ "ldi %B0,hi8(%1)" CR_TAB
+ "ldi %C0,hh8(%1)", op, plen, -3);
+ }
+
+ /* Last resort, better than loading from memory. */
+ return avr_asm_len ("mov __tmp_reg__,r31" CR_TAB
+ "ldi r31,lo8(%1)" CR_TAB
+ "mov %A0,r31" CR_TAB
+ "ldi r31,hi8(%1)" CR_TAB
+ "mov %B0,r31" CR_TAB
+ "ldi r31,hh8(%1)" CR_TAB
+ "mov %C0,r31" CR_TAB
+ "mov r31,__tmp_reg__", op, plen, -8);
+ }
+ else if (MEM_P (src))
+ return avr_out_load_psi (insn, op, plen); /* mov r,m */
+ }
+ else if (MEM_P (dest))
+ {
+ if (src == CONST0_RTX (GET_MODE (dest)))
+ op[1] = zero_reg_rtx;
+
+ avr_out_store_psi (insn, op, plen);
+
+ op[1] = src;
+ return "";
+ }
+
+ fatal_insn ("invalid insn:", insn);
+ return "";
+}
+
+
const char *
out_movqi_mr_r (rtx insn, rtx op[], int *l)
{
@@ -3280,22 +3558,24 @@ avr_out_compare (rtx insn, rtx *xop, int *plen)
avr_asm_len ("dec %A0" CR_TAB
"or %A0,%B0", xop, plen, 2);
- if (n_bytes == 4)
- avr_asm_len ("or %A0,%C0" CR_TAB
- "or %A0,%D0", xop, plen, 2);
+ if (n_bytes >= 3)
+ avr_asm_len ("or %A0,%C0", xop, plen, 1);
+
+ if (n_bytes >= 4)
+ avr_asm_len ("or %A0,%D0", xop, plen, 1);
return "";
}
else if (xval == constm1_rtx)
{
- if (n_bytes == 4)
- avr_asm_len ("and %A0,%D0" CR_TAB
- "and %A0,%C0", xop, plen, 2);
+ if (n_bytes >= 4)
+ avr_asm_len ("and %A0,%D0", xop, plen, 1);
- avr_asm_len ("and %A0,%B0" CR_TAB
- "com %A0", xop, plen, 2);
+ if (n_bytes >= 3)
+ avr_asm_len ("and %A0,%C0", xop, plen, 1);
- return "";
+ return avr_asm_len ("and %A0,%B0" CR_TAB
+ "com %A0", xop, plen, 2);
}
}
@@ -3335,8 +3615,7 @@ avr_out_compare (rtx insn, rtx *xop, int *plen)
&& compare_eq_p (insn)
&& reg_unused_after (insn, xreg))
{
- avr_asm_len ("adiw %0,%n1", xop, plen, 1);
- break;
+ return avr_asm_len ("adiw %0,%n1", xop, plen, 1);
}
}
@@ -3410,6 +3689,31 @@ avr_out_tsthi (rtx insn, rtx *op, int *plen)
}
+/* Output test instruction for PSImode. */
+
+const char*
+avr_out_tstpsi (rtx insn, rtx *op, int *plen)
+{
+ if (compare_sign_p (insn))
+ {
+ avr_asm_len ("tst %C0", op, plen, -1);
+ }
+ else if (reg_unused_after (insn, op[0])
+ && compare_eq_p (insn))
+ {
+ /* Faster than sbiw if we can clobber the operand. */
+ avr_asm_len ("or %A0,%B0" CR_TAB
+ "or %A0,%C0", op, plen, -2);
+ }
+ else
+ {
+ avr_out_compare (insn, op, plen);
+ }
+
+ return "";
+}
+
+
/* Output test instruction for SImode. */
const char*
@@ -3938,6 +4242,69 @@ ashlhi3_out (rtx insn, rtx operands[], int *len)
}
+/* 24-bit shift left */
+
+const char*
+avr_out_ashlpsi3 (rtx insn, rtx *op, int *plen)
+{
+ if (plen)
+ *plen = 0;
+
+ if (CONST_INT_P (op[2]))
+ {
+ switch (INTVAL (op[2]))
+ {
+ default:
+ if (INTVAL (op[2]) < 24)
+ break;
+
+ return avr_asm_len ("clr %A0" CR_TAB
+ "clr %B0" CR_TAB
+ "clr %C0", op, plen, 3);
+
+ case 8:
+ {
+ int reg0 = REGNO (op[0]);
+ int reg1 = REGNO (op[1]);
+
+ if (reg0 >= reg1)
+ return avr_asm_len ("mov %C0,%B1" CR_TAB
+ "mov %B0,%A1" CR_TAB
+ "clr %A0", op, plen, 3);
+ else
+ return avr_asm_len ("clr %A0" CR_TAB
+ "mov %B0,%A1" CR_TAB
+ "mov %C0,%B1", op, plen, 3);
+ }
+
+ case 16:
+ {
+ int reg0 = REGNO (op[0]);
+ int reg1 = REGNO (op[1]);
+
+ if (reg0 + 2 != reg1)
+ avr_asm_len ("mov %C0,%A0", op, plen, 1);
+
+ return avr_asm_len ("clr %B0" CR_TAB
+ "clr %A0", op, plen, 2);
+ }
+
+ case 23:
+ return avr_asm_len ("clr %C0" CR_TAB
+ "lsr %A0" CR_TAB
+ "ror %C0" CR_TAB
+ "clr %B0" CR_TAB
+ "clr %A0", op, plen, 5);
+ }
+ }
+
+ out_shift_with_cnt ("lsl %A0" CR_TAB
+ "rol %B0" CR_TAB
+ "rol %C0", insn, op, plen, 3);
+ return "";
+}
+
+
/* 32bit shift left ((long)x << i) */
const char *
@@ -4264,6 +4631,65 @@ ashrhi3_out (rtx insn, rtx operands[], int *len)
}
+/* 24-bit arithmetic shift right */
+
+const char*
+avr_out_ashrpsi3 (rtx insn, rtx *op, int *plen)
+{
+ int dest = REGNO (op[0]);
+ int src = REGNO (op[1]);
+
+ if (CONST_INT_P (op[2]))
+ {
+ if (plen)
+ *plen = 0;
+
+ switch (INTVAL (op[2]))
+ {
+ case 8:
+ if (dest <= src)
+ return avr_asm_len ("mov %A0,%B1" CR_TAB
+ "mov %B0,%C1" CR_TAB
+ "clr %C0" CR_TAB
+ "sbrc %B0,7" CR_TAB
+ "dec %C0", op, plen, 5);
+ else
+ return avr_asm_len ("clr %C0" CR_TAB
+ "sbrc %C1,7" CR_TAB
+ "dec %C0" CR_TAB
+ "mov %B0,%C1" CR_TAB
+ "mov %A0,%B1", op, plen, 5);
+
+ case 16:
+ if (dest != src + 2)
+ avr_asm_len ("mov %A0,%C1", op, plen, 1);
+
+ return avr_asm_len ("clr %B0" CR_TAB
+ "sbrc %A0,7" CR_TAB
+ "com %B0" CR_TAB
+ "mov %C0,%B0", op, plen, 4);
+
+ default:
+ if (INTVAL (op[2]) < 24)
+ break;
+
+ /* fall through */
+
+ case 31:
+ return avr_asm_len ("lsl %C0" CR_TAB
+ "sbc %A0,%A0" CR_TAB
+ "mov %B0,%A0" CR_TAB
+ "mov %C0,%A0", op, plen, 4);
+ } /* switch */
+ }
+
+ out_shift_with_cnt ("asr %C0" CR_TAB
+ "ror %B0" CR_TAB
+ "ror %A0", insn, op, plen, 3);
+ return "";
+}
+
+
/* 32bit arithmetic shift right ((signed long)x >> i) */
const char *
@@ -4714,6 +5140,61 @@ lshrhi3_out (rtx insn, rtx operands[], int *len)
return "";
}
+
+/* 24-bit logic shift right */
+
+const char*
+avr_out_lshrpsi3 (rtx insn, rtx *op, int *plen)
+{
+ int dest = REGNO (op[0]);
+ int src = REGNO (op[1]);
+
+ if (CONST_INT_P (op[2]))
+ {
+ if (plen)
+ *plen = 0;
+
+ switch (INTVAL (op[2]))
+ {
+ case 8:
+ if (dest <= src)
+ return avr_asm_len ("mov %A0,%B1" CR_TAB
+ "mov %B0,%C1" CR_TAB
+ "clr %C0", op, plen, 3);
+ else
+ return avr_asm_len ("clr %C0" CR_TAB
+ "mov %B0,%C1" CR_TAB
+ "mov %A0,%B1", op, plen, 3);
+
+ case 16:
+ if (dest != src + 2)
+ avr_asm_len ("mov %A0,%C1", op, plen, 1);
+
+ return avr_asm_len ("clr %B0" CR_TAB
+ "clr %C0", op, plen, 2);
+
+ default:
+ if (INTVAL (op[2]) < 24)
+ break;
+
+ /* fall through */
+
+ case 23:
+ return avr_asm_len ("clr %A0" CR_TAB
+ "sbrc %C0,7" CR_TAB
+ "inc %A0" CR_TAB
+ "clr %B0" CR_TAB
+ "clr %C0", op, plen, 5);
+ } /* switch */
+ }
+
+ out_shift_with_cnt ("lsr %C0" CR_TAB
+ "ror %B0" CR_TAB
+ "ror %A0", insn, op, plen, 3);
+ return "";
+}
+
+
/* 32bit logic shift right ((unsigned int)x >> i) */
const char *
@@ -4874,7 +5355,9 @@ avr_out_plus_1 (rtx *xop, int *plen, enum rtx_code code, int *pcc)
if (i && !started)
*pcc = CC_CLOBBER;
- if (!started && i % 2 == 0
+ if (!started
+ && i % 2 == 0
+ && i + 2 <= n_bytes
&& test_hard_reg_class (ADDW_REGS, reg8))
{
rtx xval16 = simplify_gen_subreg (HImode, xval, mode, i);
@@ -4911,11 +5394,11 @@ avr_out_plus_1 (rtx *xop, int *plen, enum rtx_code code, int *pcc)
else if ((val8 == 1 || val8 == 0xff)
&& !started
&& i == n_bytes - 1)
- {
+ {
avr_asm_len ((code == PLUS) ^ (val8 == 1) ? "dec %0" : "inc %0",
op, plen, 1);
break;
- }
+ }
switch (code)
{
@@ -5399,6 +5882,7 @@ adjust_insn_length (rtx insn, int len)
switch (adjust_len)
{
case ADJUST_LEN_RELOAD_IN16: output_reload_inhi (op, op[2], &len); break;
+ case ADJUST_LEN_RELOAD_IN24: avr_out_reload_inpsi (op, op[2], &len); break;
case ADJUST_LEN_RELOAD_IN32: output_reload_insisf (op, op[2], &len); break;
case ADJUST_LEN_OUT_BITOP: avr_out_bitop (insn, op, &len); break;
@@ -5411,9 +5895,11 @@ adjust_insn_length (rtx insn, int len)
case ADJUST_LEN_MOV8: output_movqi (insn, op, &len); break;
case ADJUST_LEN_MOV16: output_movhi (insn, op, &len); break;
+ case ADJUST_LEN_MOV24: avr_out_movpsi (insn, op, &len); break;
case ADJUST_LEN_MOV32: output_movsisf (insn, op, &len); break;
case ADJUST_LEN_TSTHI: avr_out_tsthi (insn, op, &len); break;
+ case ADJUST_LEN_TSTPSI: avr_out_tstpsi (insn, op, &len); break;
case ADJUST_LEN_TSTSI: avr_out_tstsi (insn, op, &len); break;
case ADJUST_LEN_COMPARE: avr_out_compare (insn, op, &len); break;
@@ -5429,6 +5915,10 @@ adjust_insn_length (rtx insn, int len)
case ADJUST_LEN_ASHLHI: ashlhi3_out (insn, op, &len); break;
case ADJUST_LEN_ASHLSI: ashlsi3_out (insn, op, &len); break;
+ case ADJUST_LEN_ASHLPSI: avr_out_ashlpsi3 (insn, op, &len); break;
+ case ADJUST_LEN_ASHRPSI: avr_out_ashrpsi3 (insn, op, &len); break;
+ case ADJUST_LEN_LSHRPSI: avr_out_lshrpsi3 (insn, op, &len); break;
+
case ADJUST_LEN_CALL: len = AVR_HAVE_JMP_CALL ? 2 : 1; break;
default:
@@ -6228,13 +6718,11 @@ avr_rtx_costs_1 (rtx x, int codearg, int outer_code ATTRIBUTE_UNUSED,
*total = COSTS_N_INSNS (1);
break;
- case HImode:
- *total = COSTS_N_INSNS (3);
- break;
-
- case SImode:
- *total = COSTS_N_INSNS (7);
- break;
+ case HImode:
+ case PSImode:
+ case SImode:
+ *total = COSTS_N_INSNS (2 * GET_MODE_SIZE (mode) - 1);
+ break;
default:
return false;
@@ -6320,6 +6808,19 @@ avr_rtx_costs_1 (rtx x, int codearg, int outer_code ATTRIBUTE_UNUSED,
*total = COSTS_N_INSNS (2);
break;
+ case PSImode:
+ if (!CONST_INT_P (XEXP (x, 1)))
+ {
+ *total = COSTS_N_INSNS (3);
+ *total += avr_operand_rtx_cost (XEXP (x, 1), mode, code, 1,
+ speed);
+ }
+ else if (INTVAL (XEXP (x, 1)) >= -63 && INTVAL (XEXP (x, 1)) <= 63)
+ *total = COSTS_N_INSNS (2);
+ else
+ *total = COSTS_N_INSNS (3);
+ break;
+
case SImode:
if (GET_CODE (XEXP (x, 1)) != CONST_INT)
{
@@ -6367,6 +6868,7 @@ avr_rtx_costs_1 (rtx x, int codearg, int outer_code ATTRIBUTE_UNUSED,
*total = COSTS_N_INSNS (1) + *total;
return true;
}
+ /* FALLTHRU */
case AND:
case IOR:
*total = COSTS_N_INSNS (GET_MODE_SIZE (mode));
@@ -6437,6 +6939,13 @@ avr_rtx_costs_1 (rtx x, int codearg, int outer_code ATTRIBUTE_UNUSED,
return false;
break;
+ case PSImode:
+ if (!speed)
+ *total = COSTS_N_INSNS (AVR_HAVE_JMP_CALL ? 2 : 1);
+ else
+ *total = 10;
+ break;
+
case SImode:
if (AVR_HAVE_MUL)
{
@@ -6611,6 +7120,31 @@ avr_rtx_costs_1 (rtx x, int codearg, int outer_code ATTRIBUTE_UNUSED,
}
break;
+ case PSImode:
+ if (!CONST_INT_P (XEXP (x, 1)))
+ {
+ *total = COSTS_N_INSNS (!speed ? 6 : 73);
+ }
+ else
+ switch (INTVAL (XEXP (x, 1)))
+ {
+ case 0:
+ *total = 0;
+ break;
+ case 1:
+ case 8:
+ case 16:
+ *total = COSTS_N_INSNS (3);
+ break;
+ case 23:
+ *total = COSTS_N_INSNS (5);
+ break;
+ default:
+ *total = COSTS_N_INSNS (!speed ? 5 : 3 * INTVAL (XEXP (x, 1)));
+ break;
+ }
+ break;
+
case SImode:
if (GET_CODE (XEXP (x, 1)) != CONST_INT)
{
@@ -6721,6 +7255,33 @@ avr_rtx_costs_1 (rtx x, int codearg, int outer_code ATTRIBUTE_UNUSED,
}
break;
+ case PSImode:
+ if (!CONST_INT_P (XEXP (x, 1)))
+ {
+ *total = COSTS_N_INSNS (!speed ? 6 : 73);
+ }
+ else
+ switch (INTVAL (XEXP (x, 1)))
+ {
+ case 0:
+ *total = 0;
+ break;
+ case 1:
+ *total = COSTS_N_INSNS (3);
+ break;
+ case 16:
+ case 8:
+ *total = COSTS_N_INSNS (5);
+ break;
+ case 23:
+ *total = COSTS_N_INSNS (4);
+ break;
+ default:
+ *total = COSTS_N_INSNS (!speed ? 5 : 3 * INTVAL (XEXP (x, 1)));
+ break;
+ }
+ break;
+
case SImode:
if (GET_CODE (XEXP (x, 1)) != CONST_INT)
{
@@ -6832,6 +7393,31 @@ avr_rtx_costs_1 (rtx x, int codearg, int outer_code ATTRIBUTE_UNUSED,
}
break;
+ case PSImode:
+ if (!CONST_INT_P (XEXP (x, 1)))
+ {
+ *total = COSTS_N_INSNS (!speed ? 6 : 73);
+ }
+ else
+ switch (INTVAL (XEXP (x, 1)))
+ {
+ case 0:
+ *total = 0;
+ break;
+ case 1:
+ case 8:
+ case 16:
+ *total = COSTS_N_INSNS (3);
+ break;
+ case 23:
+ *total = COSTS_N_INSNS (5);
+ break;
+ default:
+ *total = COSTS_N_INSNS (!speed ? 5 : 3 * INTVAL (XEXP (x, 1)));
+ break;
+ }
+ break;
+
case SImode:
if (GET_CODE (XEXP (x, 1)) != CONST_INT)
{
@@ -6889,6 +7475,12 @@ avr_rtx_costs_1 (rtx x, int codearg, int outer_code ATTRIBUTE_UNUSED,
*total += COSTS_N_INSNS (1);
break;
+ case PSImode:
+ *total = COSTS_N_INSNS (3);
+ if (CONST_INT_P (XEXP (x, 1)) && INTVAL (XEXP (x, 1)) != 0)
+ *total += COSTS_N_INSNS (2);
+ break;
+
case SImode:
*total = COSTS_N_INSNS (4);
if (GET_CODE (XEXP (x, 1)) != CONST_INT)
@@ -7310,8 +7902,10 @@ avr_libcall_value (enum machine_mode mode,
const_rtx func ATTRIBUTE_UNUSED)
{
int offs = GET_MODE_SIZE (mode);
- if (offs < 2)
- offs = 2;
+
+ if (offs <= 4)
+ offs = (offs + 1) & ~1;
+
return gen_rtx_REG (mode, avr_ret_register () + 2 - offs);
}
@@ -7528,8 +8122,10 @@ output_reload_in_const (rtx *op, rtx clobber_reg, int *len, bool clear_p)
bool set_p = false;
unsigned int n;
enum machine_mode mode = GET_MODE (dest);
+ int n_bytes = GET_MODE_SIZE (mode);
- gcc_assert (REG_P (dest));
+ gcc_assert (REG_P (dest)
+ && CONSTANT_P (src));
if (len)
*len = 0;
@@ -7537,20 +8133,21 @@ output_reload_in_const (rtx *op, rtx clobber_reg, int *len, bool clear_p)
/* (REG:SI 14) is special: It's neither in LD_REGS nor in NO_LD_REGS
but has some subregs that are in LD_REGS. Use the MSB (REG:QI 17). */
- if (14 == REGNO (dest)
- && 4 == GET_MODE_SIZE (mode))
+ if (REGNO (dest) < 16
+ && REGNO (dest) + GET_MODE_SIZE (mode) > 16)
{
- clobber_reg = gen_rtx_REG (QImode, 17);
+ clobber_reg = gen_rtx_REG (QImode, REGNO (dest) + n_bytes - 1);
}
- /* We might need a clobber reg but don't have one. Look at the value
- to be loaded more closely. A clobber is only needed if it contains
- a byte that is neither 0, -1 or a power of 2. */
+ /* We might need a clobber reg but don't have one. Look at the value to
+ be loaded more closely. A clobber is only needed if it is a symbol
+ or contains a byte that is neither 0, -1 or a power of 2. */
if (NULL_RTX == clobber_reg
&& !test_hard_reg_class (LD_REGS, dest)
- && !avr_popcount_each_byte (src, GET_MODE_SIZE (mode),
- (1 << 0) | (1 << 1) | (1 << 8)))
+ && (! (CONST_INT_P (src) || CONST_DOUBLE_P (src))
+ || !avr_popcount_each_byte (src, n_bytes,
+ (1 << 0) | (1 << 1) | (1 << 8))))
{
/* We have no clobber register but need one. Cook one up.
That's cheaper than loading from constant pool. */
@@ -7562,21 +8159,49 @@ output_reload_in_const (rtx *op, rtx clobber_reg, int *len, bool clear_p)
/* Now start filling DEST from LSB to MSB. */
- for (n = 0; n < GET_MODE_SIZE (mode); n++)
+ for (n = 0; n < n_bytes; n++)
{
+ int ldreg_p;
bool done_byte = false;
unsigned int j;
rtx xop[3];
- /* Crop the n-th sub-byte. */
-
- xval = simplify_gen_subreg (QImode, src, mode, n);
+ /* Crop the n-th destination byte. */
+
xdest[n] = simplify_gen_subreg (QImode, dest, mode, n);
+ ldreg_p = test_hard_reg_class (LD_REGS, xdest[n]);
+
+ if (!CONST_INT_P (src)
+ && !CONST_DOUBLE_P (src))
+ {
+ static const char* const asm_code[][2] =
+ {
+ { "ldi %2,lo8(%1)" CR_TAB "mov %0,%2", "ldi %0,lo8(%1)" },
+ { "ldi %2,hi8(%1)" CR_TAB "mov %0,%2", "ldi %0,hi8(%1)" },
+ { "ldi %2,hlo8(%1)" CR_TAB "mov %0,%2", "ldi %0,hlo8(%1)" },
+ { "ldi %2,hhi8(%1)" CR_TAB "mov %0,%2", "ldi %0,hhi8(%1)" }
+ };
+
+ xop[0] = xdest[n];
+ xop[1] = src;
+ xop[2] = clobber_reg;
+
+ if (n >= 2)
+ avr_asm_len ("clr %0", xop, len, 1);
+ else
+ avr_asm_len (asm_code[n][ldreg_p], xop, len, ldreg_p ? 1 : 2);
+ continue;
+ }
+
+ /* Crop the n-th source byte. */
+
+ xval = simplify_gen_subreg (QImode, src, mode, n);
ival[n] = INTVAL (xval);
/* Look if we can reuse the low word by means of MOVW. */
if (n == 2
+ && n_bytes >= 4
&& AVR_HAVE_MOVW)
{
rtx lo16 = simplify_gen_subreg (HImode, src, mode, 0);
@@ -7613,7 +8238,7 @@ output_reload_in_const (rtx *op, rtx clobber_reg, int *len, bool clear_p)
/* LD_REGS can use LDI to move a constant value */
- if (test_hard_reg_class (LD_REGS, xdest[n]))
+ if (ldreg_p)
{
xop[0] = xdest[n];
xop[1] = xval;
@@ -7716,45 +8341,7 @@ output_reload_in_const (rtx *op, rtx clobber_reg, int *len, bool clear_p)
const char*
output_reload_inhi (rtx *op, rtx clobber_reg, int *plen)
{
- if (CONST_INT_P (op[1]))
- {
- output_reload_in_const (op, clobber_reg, plen, false);
- }
- else if (test_hard_reg_class (LD_REGS, op[0]))
- {
- avr_asm_len ("ldi %A0,lo8(%1)" CR_TAB
- "ldi %B0,hi8(%1)", op, plen, -2);
- }
- else
- {
- rtx xop[3];
-
- xop[0] = op[0];
- xop[1] = op[1];
- xop[2] = clobber_reg;
-
- if (plen)
- *plen = 0;
-
- if (clobber_reg == NULL_RTX)
- {
- /* No scratch register provided: cook une up. */
-
- xop[2] = gen_rtx_REG (QImode, REG_Z + 1);
- avr_asm_len ("mov __tmp_reg__,%2", xop, plen, 1);
- }
-
- avr_asm_len ("ldi %2,lo8(%1)" CR_TAB
- "mov %A0,%2" CR_TAB
- "ldi %2,hi8(%1)" CR_TAB
- "mov %B0,%2", xop, plen, 4);
-
- if (clobber_reg == NULL_RTX)
- {
- avr_asm_len ("mov %2,__tmp_reg__", xop, plen, 1);
- }
- }
-
+ output_reload_in_const (op, clobber_reg, plen, false);
return "";
}
@@ -7774,9 +8361,6 @@ output_reload_inhi (rtx *op, rtx clobber_reg, int *plen)
const char *
output_reload_insisf (rtx *op, rtx clobber_reg, int *len)
{
- gcc_assert (REG_P (op[0])
- && CONSTANT_P (op[1]));
-
if (AVR_HAVE_MOVW
&& !test_hard_reg_class (LD_REGS, op[0]))
{
@@ -7820,6 +8404,13 @@ output_reload_insisf (rtx *op, rtx clobber_reg, int *len)
return "";
}
+const char *
+avr_out_reload_inpsi (rtx *op, rtx clobber_reg, int *len)
+{
+ output_reload_in_const (op, clobber_reg, len, false);
+ return "";
+}
+
void
avr_output_bld (rtx operands[], int bit_nr)
{
@@ -8078,6 +8669,16 @@ enum avr_builtin_id
AVR_BUILTIN_DELAY_CYCLES
};
+static void
+avr_init_builtin_int24 (void)
+{
+ tree int24_type = make_signed_type (GET_MODE_BITSIZE (PSImode));
+ tree uint24_type = make_unsigned_type (GET_MODE_BITSIZE (PSImode));
+
+ (*lang_hooks.types.register_builtin_type) (int24_type, "__int24");
+ (*lang_hooks.types.register_builtin_type) (uint24_type, "__uint24");
+}
+
#define DEF_BUILTIN(NAME, TYPE, CODE) \
do \
{ \
@@ -8133,6 +8734,8 @@ avr_init_builtins (void)
AVR_BUILTIN_FMULS);
DEF_BUILTIN ("__builtin_avr_fmulsu", int_ftype_char_uchar,
AVR_BUILTIN_FMULSU);
+
+ avr_init_builtin_int24 ();
}
#undef DEF_BUILTIN
diff --git a/gcc/config/avr/avr.md b/gcc/config/avr/avr.md
index f3edbbcd026..59330104fa0 100644
--- a/gcc/config/avr/avr.md
+++ b/gcc/config/avr/avr.md
@@ -125,11 +125,12 @@
(define_attr "adjust_len"
"out_bitop, out_plus, out_plus_noclobber, addto_sp,
- tsthi, tstsi, compare, call,
- mov8, mov16, mov32, reload_in16, reload_in32,
+ tsthi, tstpsi, tstsi, compare, call,
+ mov8, mov16, mov24, mov32, reload_in16, reload_in24, reload_in32,
ashlqi, ashrqi, lshrqi,
ashlhi, ashrhi, lshrhi,
ashlsi, ashrsi, lshrsi,
+ ashlpsi, ashrpsi, lshrpsi,
no"
(const_string "no"))
@@ -180,10 +181,13 @@
;; Define mode iterators
(define_mode_iterator QIHI [(QI "") (HI "")])
(define_mode_iterator QIHI2 [(QI "") (HI "")])
-(define_mode_iterator QISI [(QI "") (HI "") (SI "")])
-(define_mode_iterator QIDI [(QI "") (HI "") (SI "") (DI "")])
-(define_mode_iterator HIDI [(HI "") (SI "") (DI "")])
-(define_mode_iterator HISI [(HI "") (SI "")])
+(define_mode_iterator QISI [(QI "") (HI "") (PSI "") (SI "")])
+(define_mode_iterator QIDI [(QI "") (HI "") (PSI "") (SI "") (DI "")])
+(define_mode_iterator HIDI [(HI "") (PSI "") (SI "") (DI "")])
+(define_mode_iterator HISI [(HI "") (PSI "") (SI "")])
+
+;; All supported move-modes
+(define_mode_iterator MOVMODE [(QI "") (HI "") (SI "") (SF "") (PSI "")])
;; Define code iterators
;; Define two incarnations so that we can build the cross product.
@@ -279,6 +283,7 @@
(define_mode_iterator MPUSH
[(CQI "")
(HI "") (CHI "")
+ (PSI "")
(SI "") (CSI "")
(DI "") (CDI "")
(SF "") (SC "")])
@@ -310,6 +315,28 @@
"")
;;========================================================================
+
+;; "movqi"
+;; "movhi"
+;; "movsi"
+;; "movsf"
+;; "movpsi"
+
+(define_expand "mov<mode>"
+ [(set (match_operand:MOVMODE 0 "nonimmediate_operand" "")
+ (match_operand:MOVMODE 1 "general_operand" ""))]
+ ""
+ {
+ /* One of the ops has to be in a register. */
+ if (!register_operand (operands[0], <MODE>mode)
+ && !(register_operand (operands[1], <MODE>mode)
+ || CONST0_RTX (<MODE>mode) == operands[1]))
+ {
+ operands[1] = copy_to_mode_reg (<MODE>mode, operands[1]);
+ }
+ })
+
+;;========================================================================
;; move byte
;; The last alternative (any immediate constant to any register) is
;; very expensive. It should be optimized by peephole2 if a scratch
@@ -318,16 +345,6 @@
;; are call-saved registers, and most of LD_REGS are call-used registers,
;; so this may still be a win for registers live across function calls.
-(define_expand "movqi"
- [(set (match_operand:QI 0 "nonimmediate_operand" "")
- (match_operand:QI 1 "general_operand" ""))]
- ""
- "/* One of the ops has to be in a register. */
- if (!register_operand(operand0, QImode)
- && ! (register_operand(operand1, QImode) || const0_rtx == operand1))
- operands[1] = copy_to_mode_reg(QImode, operand1);
- ")
-
(define_insn "movqi_insn"
[(set (match_operand:QI 0 "nonimmediate_operand" "=r,d,Qm,r,q,r,*r")
(match_operand:QI 1 "general_operand" "rL,i,rL,Qm,r,q,i"))]
@@ -365,21 +382,6 @@
;;============================================================================
;; move word (16 bit)
-(define_expand "movhi"
- [(set (match_operand:HI 0 "nonimmediate_operand" "")
- (match_operand:HI 1 "general_operand" ""))]
- ""
- "
-{
- /* One of the ops has to be in a register. */
- if (!register_operand(operand0, HImode)
- && !(register_operand(operand1, HImode) || const0_rtx == operands[1]))
- {
- operands[1] = copy_to_mode_reg(HImode, operand1);
- }
-}")
-
-
;; Move register $1 to the Stack Pointer register SP.
;; This insn is emit during function prologue/epilogue generation.
;; $2 = 0: We know that IRQs are off
@@ -461,23 +463,48 @@
})
;;==========================================================================
-;; move double word (32 bit)
-
-(define_expand "movsi"
- [(set (match_operand:SI 0 "nonimmediate_operand" "")
- (match_operand:SI 1 "general_operand" ""))]
- ""
- "
-{
- /* One of the ops has to be in a register. */
- if (!register_operand (operand0, SImode)
- && !(register_operand (operand1, SImode) || const0_rtx == operand1))
- {
- operands[1] = copy_to_mode_reg (SImode, operand1);
- }
-}")
-
+;; xpointer move (24 bit)
+
+(define_peephole2 ; *reload_inpsi
+ [(match_scratch:QI 2 "d")
+ (set (match_operand:PSI 0 "l_register_operand" "")
+ (match_operand:PSI 1 "immediate_operand" ""))
+ (match_dup 2)]
+ "operands[1] != const0_rtx
+ && operands[1] != constm1_rtx"
+ [(parallel [(set (match_dup 0)
+ (match_dup 1))
+ (clobber (match_dup 2))])]
+ "")
+
+;; '*' because it is not used in rtl generation.
+(define_insn "*reload_inpsi"
+ [(set (match_operand:PSI 0 "register_operand" "=r")
+ (match_operand:PSI 1 "immediate_operand" "i"))
+ (clobber (match_operand:QI 2 "register_operand" "=&d"))]
+ "reload_completed"
+ {
+ return avr_out_reload_inpsi (operands, operands[2], NULL);
+ }
+ [(set_attr "length" "6")
+ (set_attr "adjust_len" "reload_in24")
+ (set_attr "cc" "clobber")])
+(define_insn "*movpsi"
+ [(set (match_operand:PSI 0 "nonimmediate_operand" "=r,r,r ,Qm,!d,r")
+ (match_operand:PSI 1 "general_operand" "r,L,Qm,rL,i ,i"))]
+ "register_operand (operands[0], PSImode)
+ || register_operand (operands[1], PSImode)
+ || const0_rtx == operands[1]"
+ {
+ return avr_out_movpsi (insn, operands, NULL);
+ }
+ [(set_attr "length" "3,3,8,9,4,10")
+ (set_attr "adjust_len" "mov24")
+ (set_attr "cc" "none,set_zn,clobber,clobber,clobber,clobber")])
+
+;;==========================================================================
+;; move double word (32 bit)
(define_peephole2 ; *reload_insi
[(match_scratch:QI 2 "d")
@@ -519,20 +546,6 @@
;; fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
;; move floating point numbers (32 bit)
-(define_expand "movsf"
- [(set (match_operand:SF 0 "nonimmediate_operand" "")
- (match_operand:SF 1 "general_operand" ""))]
- ""
- "
-{
- /* One of the ops has to be in a register. */
- if (!register_operand (operand1, SFmode)
- && !register_operand (operand0, SFmode))
- {
- operands[1] = copy_to_mode_reg (SFmode, operand1);
- }
-}")
-
(define_insn "*movsf"
[(set (match_operand:SF 0 "nonimmediate_operand" "=r,r,r,Qm,!d,r")
(match_operand:SF 1 "general_operand" "r,G,Qm,rG,F,F"))]
@@ -739,17 +752,19 @@
; add bytes
(define_insn "addqi3"
- [(set (match_operand:QI 0 "register_operand" "=r,d,r,r")
- (plus:QI (match_operand:QI 1 "register_operand" "%0,0,0,0")
- (match_operand:QI 2 "nonmemory_operand" "r,i,P,N")))]
+ [(set (match_operand:QI 0 "register_operand" "=r,d,r,r,r,r")
+ (plus:QI (match_operand:QI 1 "register_operand" "%0,0,0,0,0,0")
+ (match_operand:QI 2 "nonmemory_operand" "r,i,P,N,K,Cm2")))]
""
"@
add %0,%2
subi %0,lo8(-(%2))
inc %0
- dec %0"
- [(set_attr "length" "1,1,1,1")
- (set_attr "cc" "set_czn,set_czn,set_zn,set_zn")])
+ dec %0
+ inc %0\;inc %0
+ dec %0\;dec %0"
+ [(set_attr "length" "1,1,1,1,2,2")
+ (set_attr "cc" "set_czn,set_czn,set_zn,set_zn,set_zn,set_zn")])
(define_expand "addhi3"
@@ -914,6 +929,33 @@
(set_attr "adjust_len" "*,*,out_plus,out_plus")
(set_attr "cc" "set_n,set_czn,out_plus,out_plus")])
+(define_insn "*addpsi3_zero_extend.qi"
+ [(set (match_operand:PSI 0 "register_operand" "=r")
+ (plus:PSI (zero_extend:PSI (match_operand:QI 1 "register_operand" "r"))
+ (match_operand:PSI 2 "register_operand" "0")))]
+ ""
+ "add %A0,%A1\;adc %B0,__zero_reg__\;adc %C0,__zero_reg__"
+ [(set_attr "length" "3")
+ (set_attr "cc" "set_n")])
+
+(define_insn "*addpsi3_zero_extend.hi"
+ [(set (match_operand:PSI 0 "register_operand" "=r")
+ (plus:PSI (zero_extend:PSI (match_operand:HI 1 "register_operand" "r"))
+ (match_operand:PSI 2 "register_operand" "0")))]
+ ""
+ "add %A0,%A1\;adc %B0,%B1\;adc %C0,__zero_reg__"
+ [(set_attr "length" "3")
+ (set_attr "cc" "set_n")])
+
+(define_insn "*addpsi3_sign_extend.hi"
+ [(set (match_operand:PSI 0 "register_operand" "=r")
+ (plus:PSI (sign_extend:PSI (match_operand:HI 1 "register_operand" "r"))
+ (match_operand:PSI 2 "register_operand" "0")))]
+ ""
+ "add %A0,%1\;adc %B0,%B1\;adc %C0,__zero_reg__\;sbrc %B1,7\;dec %C0"
+ [(set_attr "length" "5")
+ (set_attr "cc" "set_n")])
+
(define_insn "*addsi3_zero_extend"
[(set (match_operand:SI 0 "register_operand" "=r")
(plus:SI (zero_extend:SI (match_operand:QI 1 "register_operand" "r"))
@@ -932,6 +974,66 @@
[(set_attr "length" "4")
(set_attr "cc" "set_n")])
+(define_insn "addpsi3"
+ [(set (match_operand:PSI 0 "register_operand" "=r,d ,d,r")
+ (plus:PSI (match_operand:PSI 1 "register_operand" "%0,0 ,0,0")
+ (match_operand:PSI 2 "nonmemory_operand" "r,s ,n,n")))
+ (clobber (match_scratch:QI 3 "=X,X ,X,&d"))]
+ ""
+ {
+ static const char * const asm_code[] =
+ {
+ "add %A0,%A2\;adc %B0,%B2\;adc %C0,%C2",
+ "subi %0,lo8(-(%2))\;sbci %B0,hi8(-(%2))\;sbci %C0,hlo8(-(%2))",
+ "",
+ ""
+ };
+
+ if (*asm_code[which_alternative])
+ return asm_code [which_alternative];
+
+ return avr_out_plus (operands, NULL, NULL);
+ }
+ [(set_attr "length" "3,3,3,6")
+ (set_attr "adjust_len" "*,*,out_plus,out_plus")
+ (set_attr "cc" "set_n,set_czn,out_plus,out_plus")])
+
+(define_insn "subpsi3"
+ [(set (match_operand:PSI 0 "register_operand" "=r")
+ (minus:PSI (match_operand:PSI 1 "register_operand" "0")
+ (match_operand:PSI 2 "register_operand" "r")))]
+ ""
+ "sub %0,%2\;sbc %B0,%B2\;sbc %C0,%C2"
+ [(set_attr "length" "3")
+ (set_attr "cc" "set_czn")])
+
+(define_insn "*subpsi3_zero_extend.qi"
+ [(set (match_operand:PSI 0 "register_operand" "=r")
+ (minus:PSI (match_operand:SI 1 "register_operand" "0")
+ (zero_extend:PSI (match_operand:QI 2 "register_operand" "r"))))]
+ ""
+ "sub %A0,%2\;sbc %B0,__zero_reg__\;sbc %C0,__zero_reg__"
+ [(set_attr "length" "3")
+ (set_attr "cc" "set_czn")])
+
+(define_insn "*subpsi3_zero_extend.hi"
+ [(set (match_operand:PSI 0 "register_operand" "=r")
+ (minus:PSI (match_operand:PSI 1 "register_operand" "0")
+ (zero_extend:PSI (match_operand:HI 2 "register_operand" "r"))))]
+ ""
+ "sub %A0,%2\;sbc %B0,%B2\;sbc %C0,__zero_reg__"
+ [(set_attr "length" "3")
+ (set_attr "cc" "set_czn")])
+
+(define_insn "*subpsi3_sign_extend.hi"
+ [(set (match_operand:PSI 0 "register_operand" "=r")
+ (minus:PSI (match_operand:PSI 1 "register_operand" "0")
+ (sign_extend:PSI (match_operand:HI 2 "register_operand" "r"))))]
+ ""
+ "sub %A0,%A2\;sbc %B0,%B2\;sbc %C0,__zero_reg__\;sbrc %B2,7\;inc %C0"
+ [(set_attr "length" "5")
+ (set_attr "cc" "set_czn")])
+
;-----------------------------------------------------------------------------
; sub bytes
(define_insn "subqi3"
@@ -1099,6 +1201,17 @@
[(set_attr "length" "2,3")
(set_attr "cc" "clobber")])
+(define_insn "*addpsi3.lt0"
+ [(set (match_operand:PSI 0 "register_operand" "=r")
+ (plus:PSI (lshiftrt:PSI (match_operand:PSI 1 "register_operand" "r")
+ (const_int 23))
+ (match_operand:PSI 2 "register_operand" "0")))]
+ ""
+ "mov __tmp_reg__,%C1\;lsl __tmp_reg__
+ adc %A0,__zero_reg__\;adc %B0,__zero_reg__\;adc %C0,__zero_reg__"
+ [(set_attr "length" "5")
+ (set_attr "cc" "clobber")])
+
(define_insn "*addsi3.lt0"
[(set (match_operand:SI 0 "register_operand" "=r")
(plus:SI (lshiftrt:SI (match_operand:SI 1 "register_operand" "r")
@@ -2062,7 +2175,7 @@
; / % / % / % / % / % / % / % / % / % / % / % / % / % / % / % / % / % / % / %
; divmod
-;; Generate libgcc.S calls ourselves, because:
+;; Generate lib1funcs.S calls ourselves, because:
;; - we know exactly which registers are clobbered (for QI and HI
;; modes, some of the call-used registers are preserved)
;; - we get both the quotient and the remainder at no extra cost
@@ -2199,6 +2312,80 @@
[(set_attr "type" "xcall")
(set_attr "cc" "clobber")])
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; 24-bit signed/unsigned division and modulo.
+;; Notice that the libgcc implementation return the quotient in R22
+;; and the remainder in R18 whereas the 32-bit [u]divmodsi4
+;; implementation works the other way round.
+
+(define_insn_and_split "divmodpsi4"
+ [(parallel [(set (match_operand:PSI 0 "pseudo_register_operand" "")
+ (div:PSI (match_operand:PSI 1 "pseudo_register_operand" "")
+ (match_operand:PSI 2 "pseudo_register_operand" "")))
+ (set (match_operand:PSI 3 "pseudo_register_operand" "")
+ (mod:PSI (match_dup 1)
+ (match_dup 2)))
+ (clobber (reg:DI 18))
+ (clobber (reg:QI 26))])]
+ ""
+ { gcc_unreachable(); }
+ ""
+ [(set (reg:PSI 22) (match_dup 1))
+ (set (reg:PSI 18) (match_dup 2))
+ (parallel [(set (reg:PSI 22) (div:PSI (reg:PSI 22) (reg:PSI 18)))
+ (set (reg:PSI 18) (mod:PSI (reg:PSI 22) (reg:PSI 18)))
+ (clobber (reg:QI 21))
+ (clobber (reg:QI 25))
+ (clobber (reg:QI 26))])
+ (set (match_dup 0) (reg:PSI 22))
+ (set (match_dup 3) (reg:PSI 18))])
+
+(define_insn "*divmodpsi4_call"
+ [(set (reg:PSI 22) (div:PSI (reg:PSI 22) (reg:PSI 18)))
+ (set (reg:PSI 18) (mod:PSI (reg:PSI 22) (reg:PSI 18)))
+ (clobber (reg:QI 21))
+ (clobber (reg:QI 25))
+ (clobber (reg:QI 26))]
+ ""
+ "%~call __divmodpsi4"
+ [(set_attr "type" "xcall")
+ (set_attr "cc" "clobber")])
+
+(define_insn_and_split "udivmodpsi4"
+ [(parallel [(set (match_operand:PSI 0 "pseudo_register_operand" "")
+ (udiv:PSI (match_operand:PSI 1 "pseudo_register_operand" "")
+ (match_operand:PSI 2 "pseudo_register_operand" "")))
+ (set (match_operand:PSI 3 "pseudo_register_operand" "")
+ (umod:PSI (match_dup 1)
+ (match_dup 2)))
+ (clobber (reg:DI 18))
+ (clobber (reg:QI 26))])]
+ ""
+ { gcc_unreachable(); }
+ ""
+ [(set (reg:PSI 22) (match_dup 1))
+ (set (reg:PSI 18) (match_dup 2))
+ (parallel [(set (reg:PSI 22) (udiv:PSI (reg:PSI 22) (reg:PSI 18)))
+ (set (reg:PSI 18) (umod:PSI (reg:PSI 22) (reg:PSI 18)))
+ (clobber (reg:QI 21))
+ (clobber (reg:QI 25))
+ (clobber (reg:QI 26))])
+ (set (match_dup 0) (reg:PSI 22))
+ (set (match_dup 3) (reg:PSI 18))])
+
+(define_insn "*udivmodpsi4_call"
+ [(set (reg:PSI 22) (udiv:PSI (reg:PSI 22) (reg:PSI 18)))
+ (set (reg:PSI 18) (umod:PSI (reg:PSI 22) (reg:PSI 18)))
+ (clobber (reg:QI 21))
+ (clobber (reg:QI 25))
+ (clobber (reg:QI 26))]
+ ""
+ "%~call __udivmodpsi4"
+ [(set_attr "type" "xcall")
+ (set_attr "cc" "clobber")])
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
(define_insn_and_split "divmodsi4"
[(parallel [(set (match_operand:SI 0 "pseudo_register_operand" "")
(div:SI (match_operand:SI 1 "pseudo_register_operand" "")
@@ -2297,6 +2484,24 @@
(set_attr "adjust_len" "*,*,out_bitop,out_bitop,out_bitop")
(set_attr "cc" "set_n,set_n,clobber,clobber,clobber")])
+(define_insn "andpsi3"
+ [(set (match_operand:PSI 0 "register_operand" "=r,d,r ,r")
+ (and:PSI (match_operand:PSI 1 "register_operand" "%0,0,0 ,0")
+ (match_operand:PSI 2 "nonmemory_operand" "r,n,Ca3,n")))
+ (clobber (match_scratch:QI 3 "=X,X,X ,&d"))]
+ ""
+ {
+ if (which_alternative == 0)
+ return "and %A0,%A2" CR_TAB
+ "and %B0,%B2" CR_TAB
+ "and %C0,%C2";
+
+ return avr_out_bitop (insn, operands, NULL);
+ }
+ [(set_attr "length" "3,3,6,6")
+ (set_attr "adjust_len" "*,out_bitop,out_bitop,out_bitop")
+ (set_attr "cc" "set_n,clobber,clobber,clobber")])
+
(define_insn "andsi3"
[(set (match_operand:SI 0 "register_operand" "=r,d,r ,r")
(and:SI (match_operand:SI 1 "register_operand" "%0,0,0 ,0")
@@ -2361,6 +2566,24 @@
(set_attr "adjust_len" "*,*,out_bitop,out_bitop,out_bitop")
(set_attr "cc" "set_n,set_n,clobber,clobber,clobber")])
+(define_insn "iorpsi3"
+ [(set (match_operand:PSI 0 "register_operand" "=r,d,r ,r")
+ (ior:PSI (match_operand:PSI 1 "register_operand" "%0,0,0 ,0")
+ (match_operand:PSI 2 "nonmemory_operand" "r,n,Co3,n")))
+ (clobber (match_scratch:QI 3 "=X,X,X ,&d"))]
+ ""
+ {
+ if (which_alternative == 0)
+ return "or %A0,%A2" CR_TAB
+ "or %B0,%B2" CR_TAB
+ "or %C0,%C2";
+
+ return avr_out_bitop (insn, operands, NULL);
+ }
+ [(set_attr "length" "3,3,6,6")
+ (set_attr "adjust_len" "*,out_bitop,out_bitop,out_bitop")
+ (set_attr "cc" "set_n,clobber,clobber,clobber")])
+
(define_insn "iorsi3"
[(set (match_operand:SI 0 "register_operand" "=r,d,r ,r")
(ior:SI (match_operand:SI 1 "register_operand" "%0,0,0 ,0")
@@ -2408,6 +2631,24 @@
(set_attr "adjust_len" "*,out_bitop,out_bitop")
(set_attr "cc" "set_n,clobber,clobber")])
+(define_insn "xorpsi3"
+ [(set (match_operand:PSI 0 "register_operand" "=r,r ,r")
+ (xor:PSI (match_operand:PSI 1 "register_operand" "%0,0 ,0")
+ (match_operand:PSI 2 "nonmemory_operand" "r,Cx3,n")))
+ (clobber (match_scratch:QI 3 "=X,X ,&d"))]
+ ""
+ {
+ if (which_alternative == 0)
+ return "eor %A0,%A2" CR_TAB
+ "eor %B0,%B2" CR_TAB
+ "eor %C0,%C2";
+
+ return avr_out_bitop (insn, operands, NULL);
+ }
+ [(set_attr "length" "3,6,6")
+ (set_attr "adjust_len" "*,out_bitop,out_bitop")
+ (set_attr "cc" "set_n,clobber,clobber")])
+
(define_insn "xorsi3"
[(set (match_operand:SI 0 "register_operand" "=r,r ,r")
(xor:SI (match_operand:SI 1 "register_operand" "%0,0 ,0")
@@ -2472,10 +2713,11 @@
;; HImode does not need scratch. Use attribute for this constraint.
;; Use QI scratch for DI mode as this is often split into byte sized operands.
-(define_mode_attr rotx [(DI "&r,&r,X") (SI "&r,&r,X") (HI "X,X,X")])
-(define_mode_attr rotsmode [(DI "QI") (SI "HI") (HI "QI")])
+(define_mode_attr rotx [(DI "&r,&r,X") (SI "&r,&r,X") (PSI "&r,&r,X") (HI "X,X,X")])
+(define_mode_attr rotsmode [(DI "QI") (SI "HI") (PSI "QI") (HI "QI")])
;; "rotlhi3"
+;; "rotlpsi3"
;; "rotlsi3"
;; "rotldi3"
(define_expand "rotl<mode>3"
@@ -2531,6 +2773,24 @@
[(set_attr "length" "3")
(set_attr "cc" "clobber")])
+(define_insn "*rotlpsi2.1"
+ [(set (match_operand:PSI 0 "register_operand" "=r")
+ (rotate:PSI (match_operand:PSI 1 "register_operand" "0")
+ (const_int 1)))]
+ ""
+ "lsl %A0\;rol %B0\;rol %C0\;adc %A0,__zero_reg__"
+ [(set_attr "length" "4")
+ (set_attr "cc" "clobber")])
+
+(define_insn "*rotlpsi2.23"
+ [(set (match_operand:PSI 0 "register_operand" "=r")
+ (rotate:PSI (match_operand:PSI 1 "register_operand" "0")
+ (const_int 23)))]
+ ""
+ "bst %A0,0\;ror %C0\;ror %B0\;ror %A0\;bld %C0,7"
+ [(set_attr "length" "5")
+ (set_attr "cc" "clobber")])
+
(define_insn "*rotlsi2.1"
[(set (match_operand:SI 0 "register_operand" "=r")
(rotate:SI (match_operand:SI 1 "register_operand" "0")
@@ -2567,6 +2827,7 @@
(clobber (match_scratch:<rotsmode> 3 "=<rotx>"))]
"AVR_HAVE_MOVW
&& CONST_INT_P (operands[2])
+ && GET_MODE_SIZE (<MODE>mode) % 2 == 0
&& 0 == INTVAL (operands[2]) % 16"
"#"
"&& (reload_completed || <MODE>mode == DImode)"
@@ -2580,6 +2841,7 @@
;; Split byte aligned rotates using scratch that is always QI mode.
;; "*rotbhi"
+;; "*rotbpsi"
;; "*rotbsi"
;; "*rotbdi"
(define_insn_and_split "*rotb<mode>"
@@ -2589,7 +2851,8 @@
(clobber (match_scratch:QI 3 "=<rotx>"))]
"CONST_INT_P (operands[2])
&& (8 == INTVAL (operands[2]) % 16
- || (!AVR_HAVE_MOVW
+ || ((!AVR_HAVE_MOVW
+ || GET_MODE_SIZE (<MODE>mode) % 2 != 0)
&& 0 == INTVAL (operands[2]) % 16))"
"#"
"&& (reload_completed || <MODE>mode == DImode)"
@@ -2830,6 +3093,18 @@
(set_attr "adjust_len" "ashlsi")
(set_attr "cc" "none,set_n,clobber,clobber")])
+(define_insn "ashlpsi3"
+ [(set (match_operand:PSI 0 "register_operand" "=r,r,r,r")
+ (ashift:PSI (match_operand:PSI 1 "register_operand" "0,0,r,0")
+ (match_operand:QI 2 "nonmemory_operand" "r,P,O,n")))
+ (clobber (match_scratch:QI 3 "=X,X,X,&d"))]
+ ""
+ {
+ return avr_out_ashlpsi3 (insn, operands, NULL);
+ }
+ [(set_attr "adjust_len" "ashlpsi")
+ (set_attr "cc" "clobber")])
+
;; >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >>
;; arithmetic shift right
@@ -2853,6 +3128,18 @@
(set_attr "adjust_len" "ashrhi")
(set_attr "cc" "clobber,none,clobber,set_n,clobber,clobber,clobber")])
+(define_insn "ashrpsi3"
+ [(set (match_operand:PSI 0 "register_operand" "=r,r,r,r,r")
+ (ashiftrt:PSI (match_operand:PSI 1 "register_operand" "0,0,0,r,0")
+ (match_operand:QI 2 "nonmemory_operand" "r,P,K,O,n")))
+ (clobber (match_scratch:QI 3 "=X,X,X,X,&d"))]
+ ""
+ {
+ return avr_out_ashrpsi3 (insn, operands, NULL);
+ }
+ [(set_attr "adjust_len" "ashrpsi")
+ (set_attr "cc" "clobber")])
+
(define_insn "ashrsi3"
[(set (match_operand:SI 0 "register_operand" "=r,r,r,r,r,r,r")
(ashiftrt:SI (match_operand:SI 1 "register_operand" "0,0,0,r,0,0,0")
@@ -2966,6 +3253,18 @@
(set_attr "adjust_len" "lshrhi")
(set_attr "cc" "clobber,none,clobber,clobber,clobber,clobber,clobber")])
+(define_insn "lshrpsi3"
+ [(set (match_operand:PSI 0 "register_operand" "=r,r,r,r,r")
+ (lshiftrt:PSI (match_operand:PSI 1 "register_operand" "0,0,r,0,0")
+ (match_operand:QI 2 "nonmemory_operand" "r,P,O,K,n")))
+ (clobber (match_scratch:QI 3 "=X,X,X,X,&d"))]
+ ""
+ {
+ return avr_out_lshrpsi3 (insn, operands, NULL);
+ }
+ [(set_attr "adjust_len" "lshrpsi")
+ (set_attr "cc" "clobber")])
+
(define_insn "lshrsi3"
[(set (match_operand:SI 0 "register_operand" "=r,r,r,r,r,r,r")
(lshiftrt:SI (match_operand:SI 1 "register_operand" "0,0,0,r,0,0,0")
@@ -3089,6 +3388,14 @@
[(set_attr "length" "1")
(set_attr "cc" "set_zn")])
+(define_insn "*negqihi2"
+ [(set (match_operand:HI 0 "register_operand" "=r")
+ (neg:HI (sign_extend:HI (match_operand:QI 1 "register_operand" "0"))))]
+ ""
+ "clr %B0\;neg %A0\;brge .+2\;com %B0"
+ [(set_attr "length" "4")
+ (set_attr "cc" "set_n")])
+
(define_insn "neghi2"
[(set (match_operand:HI 0 "register_operand" "=!d,r,&r")
(neg:HI (match_operand:HI 1 "register_operand" "0,0,r")))]
@@ -3100,6 +3407,17 @@
[(set_attr "length" "3,4,4")
(set_attr "cc" "set_czn,set_n,set_czn")])
+(define_insn "negpsi2"
+ [(set (match_operand:PSI 0 "register_operand" "=!d,r,&r")
+ (neg:PSI (match_operand:PSI 1 "register_operand" "0,0,r")))]
+ ""
+ "@
+ com %C0\;com %B0\;neg %A0\;sbci %B0,-1\;sbci %C0,-1
+ com %C0\;com %B0\;com %A0\;adc %A0,__zero_reg__\;adc %B0,__zero_reg__\;adc %C0,__zero_reg__
+ clr %A0\;clr %B0\;clr %C0\;sub %A0,%A1\;sbc %B0,%B1\;sbc %C0,%C1"
+ [(set_attr "length" "5,6,6")
+ (set_attr "cc" "set_czn,set_n,set_czn")])
+
(define_insn "negsi2"
[(set (match_operand:SI 0 "register_operand" "=!d,r,&r,&r")
(neg:SI (match_operand:SI 1 "register_operand" "0,0,r ,r")))]
@@ -3143,6 +3461,14 @@
[(set_attr "length" "2")
(set_attr "cc" "set_n")])
+(define_insn "one_cmplpsi2"
+ [(set (match_operand:PSI 0 "register_operand" "=r")
+ (not:PSI (match_operand:PSI 1 "register_operand" "0")))]
+ ""
+ "com %0\;com %B0\;com %C0"
+ [(set_attr "length" "3")
+ (set_attr "cc" "set_n")])
+
(define_insn "one_cmplsi2"
[(set (match_operand:SI 0 "register_operand" "=r")
(not:SI (match_operand:SI 1 "register_operand" "0")))]
@@ -3174,6 +3500,16 @@
[(set_attr "length" "3,4")
(set_attr "cc" "set_n,set_n")])
+(define_insn "extendqipsi2"
+ [(set (match_operand:PSI 0 "register_operand" "=r,r")
+ (sign_extend:PSI (match_operand:QI 1 "combine_pseudo_register_operand" "0,*r")))]
+ ""
+ "@
+ clr %B0\;sbrc %A0,7\;com %B0\;mov %C0,%B0
+ mov %A0,%A1\;clr %B0\;sbrc %A0,7\;com %B0\;mov %C0,%B0"
+ [(set_attr "length" "4,5")
+ (set_attr "cc" "set_n,set_n")])
+
(define_insn "extendqisi2"
[(set (match_operand:SI 0 "register_operand" "=r,r")
(sign_extend:SI (match_operand:QI 1 "combine_pseudo_register_operand" "0,*r")))]
@@ -3184,6 +3520,18 @@
[(set_attr "length" "5,6")
(set_attr "cc" "set_n,set_n")])
+(define_insn "extendhipsi2"
+ [(set (match_operand:PSI 0 "register_operand" "=r,r ,r")
+ (sign_extend:PSI (match_operand:HI 1 "combine_pseudo_register_operand" "0,*r,*r")))]
+ ""
+ "@
+ clr %C0\;sbrc %B0,7\;com %C0
+ mov %A0,%A1\;mov %B0,%B1\;clr %C0\;sbrc %B0,7\;com %C0
+ movw %A0,%A1\;clr %C0\;sbrc %B0,7\;com %C0"
+ [(set_attr "length" "3,5,4")
+ (set_attr "isa" "*,mov,movw")
+ (set_attr "cc" "set_n")])
+
(define_insn "extendhisi2"
[(set (match_operand:SI 0 "register_operand" "=r,r ,r")
(sign_extend:SI (match_operand:HI 1 "combine_pseudo_register_operand" "0,*r,*r")))]
@@ -3196,6 +3544,14 @@
(set_attr "isa" "*,mov,movw")
(set_attr "cc" "set_n")])
+(define_insn "extendpsisi2"
+ [(set (match_operand:SI 0 "register_operand" "=r")
+ (sign_extend:SI (match_operand:PSI 1 "combine_pseudo_register_operand" "0")))]
+ ""
+ "clr %D0\;sbrc %C0,7\;com %D0"
+ [(set_attr "length" "3")
+ (set_attr "cc" "set_n")])
+
;; xx<---x xx<---x xx<---x xx<---x xx<---x xx<---x xx<---x xx<---x xx<---x
;; zero extend
@@ -3215,6 +3571,21 @@
operands[3] = simplify_gen_subreg (QImode, operands[0], HImode, high_off);
})
+(define_insn_and_split "zero_extendqipsi2"
+ [(set (match_operand:PSI 0 "register_operand" "=r")
+ (zero_extend:PSI (match_operand:QI 1 "combine_pseudo_register_operand" "r")))]
+ ""
+ "#"
+ "reload_completed"
+ [(set (match_dup 2) (match_dup 1))
+ (set (match_dup 3) (const_int 0))
+ (set (match_dup 4) (const_int 0))]
+ {
+ operands[2] = simplify_gen_subreg (QImode, operands[0], PSImode, 0);
+ operands[3] = simplify_gen_subreg (QImode, operands[0], PSImode, 1);
+ operands[4] = simplify_gen_subreg (QImode, operands[0], PSImode, 2);
+ })
+
(define_insn_and_split "zero_extendqisi2"
[(set (match_operand:SI 0 "register_operand" "=r")
(zero_extend:SI (match_operand:QI 1 "combine_pseudo_register_operand" "r")))]
@@ -3231,6 +3602,19 @@
operands[3] = simplify_gen_subreg (HImode, operands[0], SImode, high_off);
})
+(define_insn_and_split "zero_extendhipsi2"
+ [(set (match_operand:PSI 0 "register_operand" "=r")
+ (zero_extend:PSI (match_operand:HI 1 "combine_pseudo_register_operand" "r")))]
+ ""
+ "#"
+ "reload_completed"
+ [(set (match_dup 2) (match_dup 1))
+ (set (match_dup 3) (const_int 0))]
+ {
+ operands[2] = simplify_gen_subreg (HImode, operands[0], PSImode, 0);
+ operands[3] = simplify_gen_subreg (QImode, operands[0], PSImode, 2);
+ })
+
(define_insn_and_split "zero_extendhisi2"
[(set (match_operand:SI 0 "register_operand" "=r")
(zero_extend:SI (match_operand:HI 1 "combine_pseudo_register_operand" "r")))]
@@ -3247,6 +3631,19 @@
operands[3] = simplify_gen_subreg (HImode, operands[0], SImode, high_off);
})
+(define_insn_and_split "zero_extendpsisi2"
+ [(set (match_operand:SI 0 "register_operand" "=r")
+ (zero_extend:SI (match_operand:PSI 1 "combine_pseudo_register_operand" "r")))]
+ ""
+ "#"
+ "reload_completed"
+ [(set (match_dup 2) (match_dup 1))
+ (set (match_dup 3) (const_int 0))]
+ {
+ operands[2] = simplify_gen_subreg (PSImode, operands[0], SImode, 0);
+ operands[3] = simplify_gen_subreg (QImode, operands[0], SImode, 3);
+ })
+
(define_insn_and_split "zero_extendqidi2"
[(set (match_operand:DI 0 "register_operand" "=r")
(zero_extend:DI (match_operand:QI 1 "register_operand" "r")))]
@@ -3340,6 +3737,25 @@
[(set_attr "cc" "compare")
(set_attr "length" "2")])
+(define_insn "*negated_tstpsi"
+ [(set (cc0)
+ (compare (neg:PSI (match_operand:PSI 0 "register_operand" "r"))
+ (const_int 0)))]
+ "!flag_wrapv && !flag_trapv && flag_strict_overflow"
+ "cp __zero_reg__,%A0\;cpc __zero_reg__,%B0\;cpc __zero_reg__,%C0"
+ [(set_attr "cc" "compare")
+ (set_attr "length" "3")])
+
+(define_insn "*reversed_tstpsi"
+ [(set (cc0)
+ (compare (const_int 0)
+ (match_operand:PSI 0 "register_operand" "r")))
+ (clobber (match_scratch:QI 1 "=X"))]
+ ""
+ "cp __zero_reg__,%A0\;cpc __zero_reg__,%B0\;cpc __zero_reg__,%C0"
+ [(set_attr "cc" "compare")
+ (set_attr "length" "3")])
+
(define_insn "*negated_tstsi"
[(set (cc0)
(compare (neg:SI (match_operand:SI 0 "register_operand" "r"))
@@ -3418,6 +3834,35 @@
(set_attr "length" "1,2,2,3,4,2,4")
(set_attr "adjust_len" "tsthi,tsthi,*,*,*,compare,compare")])
+(define_insn "*cmppsi"
+ [(set (cc0)
+ (compare (match_operand:PSI 0 "register_operand" "r,r,d ,r ,d,r")
+ (match_operand:PSI 1 "nonmemory_operand" "L,r,s ,s ,M,n")))
+ (clobber (match_scratch:QI 2 "=X,X,&d,&d ,X,&d"))]
+ ""
+ {
+ switch (which_alternative)
+ {
+ case 0:
+ return avr_out_tstpsi (insn, operands, NULL);
+
+ case 1:
+ return "cp %A0,%A1\;cpc %B0,%B1\;cpc %C0,%C1";
+
+ case 2:
+ return reg_unused_after (insn, operands[0])
+ ? "subi %A0,lo8(%1)\;sbci %B0,hi8(%1)\;sbci %C0,hh8(%1)"
+ : "cpi %A0,lo8(%1)\;ldi %2,hi8(%1)\;cpc %B0,%2\;ldi %2,hh8(%1)\;cpc %C0,%2";
+
+ case 3:
+ return "ldi %2,lo8(%1)\;cp %A0,%2\;ldi %2,hi8(%1)\;cpc %B0,%2\;ldi %2,hh8(%1)\;cpc %C0,%2";
+ }
+
+ return avr_out_compare (insn, operands, NULL);
+ }
+ [(set_attr "cc" "compare")
+ (set_attr "length" "3,3,5,6,3,7")
+ (set_attr "adjust_len" "tstpsi,*,*,*,compare,compare")])
(define_insn "*cmpsi"
[(set (cc0)
@@ -3456,6 +3901,18 @@
(pc)))]
"")
+(define_expand "cbranchpsi4"
+ [(parallel [(set (cc0)
+ (compare (match_operand:PSI 1 "register_operand" "")
+ (match_operand:PSI 2 "nonmemory_operand" "")))
+ (clobber (match_scratch:QI 4 ""))])
+ (set (pc)
+ (if_then_else (match_operator 0 "ordered_comparison_operator" [(cc0)
+ (const_int 0)])
+ (label_ref (match_operand 3 "" ""))
+ (pc)))]
+ "")
+
(define_expand "cbranchhi4"
[(parallel [(set (cc0)
(compare (match_operand:HI 1 "register_operand" "")
diff --git a/gcc/config/avr/constraints.md b/gcc/config/avr/constraints.md
index d26bff3ca19..50aae32b01a 100644
--- a/gcc/config/avr/constraints.md
+++ b/gcc/config/avr/constraints.md
@@ -103,6 +103,11 @@
(and (match_code "mem")
(match_test "extra_constraint_Q (op)")))
+(define_constraint "Cm2"
+ "Constant integer @minus{}2."
+ (and (match_code "const_int")
+ (match_test "ival == -2")))
+
(define_constraint "C03"
"Constant integer 3."
(and (match_code "const_int")
@@ -133,6 +138,11 @@
(and (match_code "const_int")
(match_test "avr_popcount_each_byte (op, 2, (1<<0) | (1<<7) | (1<<8))")))
+(define_constraint "Ca3"
+ "Constant 3-byte integer that allows AND without clobber register."
+ (and (match_code "const_int")
+ (match_test "avr_popcount_each_byte (op, 3, (1<<0) | (1<<7) | (1<<8))")))
+
(define_constraint "Ca4"
"Constant 4-byte integer that allows AND without clobber register."
(and (match_code "const_int")
@@ -143,6 +153,11 @@
(and (match_code "const_int")
(match_test "avr_popcount_each_byte (op, 2, (1<<0) | (1<<1) | (1<<8))")))
+(define_constraint "Co3"
+ "Constant 3-byte integer that allows OR without clobber register."
+ (and (match_code "const_int")
+ (match_test "avr_popcount_each_byte (op, 3, (1<<0) | (1<<1) | (1<<8))")))
+
(define_constraint "Co4"
"Constant 4-byte integer that allows OR without clobber register."
(and (match_code "const_int")
@@ -153,6 +168,11 @@
(and (match_code "const_int")
(match_test "avr_popcount_each_byte (op, 2, (1<<0) | (1<<8))")))
+(define_constraint "Cx3"
+ "Constant 3-byte integer that allows XOR without clobber register."
+ (and (match_code "const_int")
+ (match_test "avr_popcount_each_byte (op, 3, (1<<0) | (1<<8))")))
+
(define_constraint "Cx4"
"Constant 4-byte integer that allows XOR without clobber register."
(and (match_code "const_int")
diff --git a/gcc/config/avr/libgcc.S b/gcc/config/avr/libgcc.S
deleted file mode 100644
index 8c369c96a77..00000000000
--- a/gcc/config/avr/libgcc.S
+++ /dev/null
@@ -1,1533 +0,0 @@
-/* -*- Mode: Asm -*- */
-/* Copyright (C) 1998, 1999, 2000, 2007, 2008, 2009
- Free Software Foundation, Inc.
- Contributed by Denis Chertykov <chertykov@gmail.com>
-
-This file is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3, or (at your option) any
-later version.
-
-This file 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/>. */
-
-#define __zero_reg__ r1
-#define __tmp_reg__ r0
-#define __SREG__ 0x3f
-#define __SP_H__ 0x3e
-#define __SP_L__ 0x3d
-#define __RAMPZ__ 0x3B
-#define __EIND__ 0x3C
-
-/* Most of the functions here are called directly from avr.md
- patterns, instead of using the standard libcall mechanisms.
- This can make better code because GCC knows exactly which
- of the call-used registers (not all of them) are clobbered. */
-
-/* FIXME: At present, there is no SORT directive in the linker
- script so that we must not assume that different modules
- in the same input section like .libgcc.text.mul will be
- located close together. Therefore, we cannot use
- RCALL/RJMP to call a function like __udivmodhi4 from
- __divmodhi4 and have to use lengthy XCALL/XJMP even
- though they are in the same input section and all same
- input sections together are small enough to reach every
- location with a RCALL/RJMP instruction. */
-
- .macro mov_l r_dest, r_src
-#if defined (__AVR_HAVE_MOVW__)
- movw \r_dest, \r_src
-#else
- mov \r_dest, \r_src
-#endif
- .endm
-
- .macro mov_h r_dest, r_src
-#if defined (__AVR_HAVE_MOVW__)
- ; empty
-#else
- mov \r_dest, \r_src
-#endif
- .endm
-
-#if defined (__AVR_HAVE_JMP_CALL__)
-#define XCALL call
-#define XJMP jmp
-#else
-#define XCALL rcall
-#define XJMP rjmp
-#endif
-
-.macro DEFUN name
-.global \name
-.func \name
-\name:
-.endm
-
-.macro ENDF name
-.size \name, .-\name
-.endfunc
-.endm
-
-
-.section .text.libgcc.mul, "ax", @progbits
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-/* Note: mulqi3, mulhi3 are open-coded on the enhanced core. */
-#if !defined (__AVR_HAVE_MUL__)
-/*******************************************************
- Multiplication 8 x 8 without MUL
-*******************************************************/
-#if defined (L_mulqi3)
-
-#define r_arg2 r22 /* multiplicand */
-#define r_arg1 r24 /* multiplier */
-#define r_res __tmp_reg__ /* result */
-
-DEFUN __mulqi3
- clr r_res ; clear result
-__mulqi3_loop:
- sbrc r_arg1,0
- add r_res,r_arg2
- add r_arg2,r_arg2 ; shift multiplicand
- breq __mulqi3_exit ; while multiplicand != 0
- lsr r_arg1 ;
- brne __mulqi3_loop ; exit if multiplier = 0
-__mulqi3_exit:
- mov r_arg1,r_res ; result to return register
- ret
-ENDF __mulqi3
-
-#undef r_arg2
-#undef r_arg1
-#undef r_res
-
-#endif /* defined (L_mulqi3) */
-
-#if defined (L_mulqihi3)
-DEFUN __mulqihi3
- clr r25
- sbrc r24, 7
- dec r25
- clr r23
- sbrc r22, 7
- dec r22
- XJMP __mulhi3
-ENDF __mulqihi3:
-#endif /* defined (L_mulqihi3) */
-
-#if defined (L_umulqihi3)
-DEFUN __umulqihi3
- clr r25
- clr r23
- XJMP __mulhi3
-ENDF __umulqihi3
-#endif /* defined (L_umulqihi3) */
-
-/*******************************************************
- Multiplication 16 x 16 without MUL
-*******************************************************/
-#if defined (L_mulhi3)
-#define r_arg1L r24 /* multiplier Low */
-#define r_arg1H r25 /* multiplier High */
-#define r_arg2L r22 /* multiplicand Low */
-#define r_arg2H r23 /* multiplicand High */
-#define r_resL __tmp_reg__ /* result Low */
-#define r_resH r21 /* result High */
-
-DEFUN __mulhi3
- clr r_resH ; clear result
- clr r_resL ; clear result
-__mulhi3_loop:
- sbrs r_arg1L,0
- rjmp __mulhi3_skip1
- add r_resL,r_arg2L ; result + multiplicand
- adc r_resH,r_arg2H
-__mulhi3_skip1:
- add r_arg2L,r_arg2L ; shift multiplicand
- adc r_arg2H,r_arg2H
-
- cp r_arg2L,__zero_reg__
- cpc r_arg2H,__zero_reg__
- breq __mulhi3_exit ; while multiplicand != 0
-
- lsr r_arg1H ; gets LSB of multiplier
- ror r_arg1L
- sbiw r_arg1L,0
- brne __mulhi3_loop ; exit if multiplier = 0
-__mulhi3_exit:
- mov r_arg1H,r_resH ; result to return register
- mov r_arg1L,r_resL
- ret
-ENDF __mulhi3
-
-#undef r_arg1L
-#undef r_arg1H
-#undef r_arg2L
-#undef r_arg2H
-#undef r_resL
-#undef r_resH
-
-#endif /* defined (L_mulhi3) */
-
-/*******************************************************
- Widening Multiplication 32 = 16 x 16 without MUL
-*******************************************************/
-
-#if defined (L_mulhisi3)
-DEFUN __mulhisi3
-;;; FIXME: This is dead code (noone calls it)
- mov_l r18, r24
- mov_h r19, r25
- clr r24
- sbrc r23, 7
- dec r24
- mov r25, r24
- clr r20
- sbrc r19, 7
- dec r20
- mov r21, r20
- XJMP __mulsi3
-ENDF __mulhisi3
-#endif /* defined (L_mulhisi3) */
-
-#if defined (L_umulhisi3)
-DEFUN __umulhisi3
-;;; FIXME: This is dead code (noone calls it)
- mov_l r18, r24
- mov_h r19, r25
- clr r24
- clr r25
- mov_l r20, r24
- mov_h r21, r25
- XJMP __mulsi3
-ENDF __umulhisi3
-#endif /* defined (L_umulhisi3) */
-
-#if defined (L_mulsi3)
-/*******************************************************
- Multiplication 32 x 32 without MUL
-*******************************************************/
-#define r_arg1L r22 /* multiplier Low */
-#define r_arg1H r23
-#define r_arg1HL r24
-#define r_arg1HH r25 /* multiplier High */
-
-#define r_arg2L r18 /* multiplicand Low */
-#define r_arg2H r19
-#define r_arg2HL r20
-#define r_arg2HH r21 /* multiplicand High */
-
-#define r_resL r26 /* result Low */
-#define r_resH r27
-#define r_resHL r30
-#define r_resHH r31 /* result High */
-
-DEFUN __mulsi3
- clr r_resHH ; clear result
- clr r_resHL ; clear result
- clr r_resH ; clear result
- clr r_resL ; clear result
-__mulsi3_loop:
- sbrs r_arg1L,0
- rjmp __mulsi3_skip1
- add r_resL,r_arg2L ; result + multiplicand
- adc r_resH,r_arg2H
- adc r_resHL,r_arg2HL
- adc r_resHH,r_arg2HH
-__mulsi3_skip1:
- add r_arg2L,r_arg2L ; shift multiplicand
- adc r_arg2H,r_arg2H
- adc r_arg2HL,r_arg2HL
- adc r_arg2HH,r_arg2HH
-
- lsr r_arg1HH ; gets LSB of multiplier
- ror r_arg1HL
- ror r_arg1H
- ror r_arg1L
- brne __mulsi3_loop
- sbiw r_arg1HL,0
- cpc r_arg1H,r_arg1L
- brne __mulsi3_loop ; exit if multiplier = 0
-__mulsi3_exit:
- mov_h r_arg1HH,r_resHH ; result to return register
- mov_l r_arg1HL,r_resHL
- mov_h r_arg1H,r_resH
- mov_l r_arg1L,r_resL
- ret
-ENDF __mulsi3
-
-#undef r_arg1L
-#undef r_arg1H
-#undef r_arg1HL
-#undef r_arg1HH
-
-#undef r_arg2L
-#undef r_arg2H
-#undef r_arg2HL
-#undef r_arg2HH
-
-#undef r_resL
-#undef r_resH
-#undef r_resHL
-#undef r_resHH
-
-#endif /* defined (L_mulsi3) */
-
-#endif /* !defined (__AVR_HAVE_MUL__) */
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-#if defined (__AVR_HAVE_MUL__)
-#define A0 26
-#define B0 18
-#define C0 22
-
-#define A1 A0+1
-
-#define B1 B0+1
-#define B2 B0+2
-#define B3 B0+3
-
-#define C1 C0+1
-#define C2 C0+2
-#define C3 C0+3
-
-/*******************************************************
- Widening Multiplication 32 = 16 x 16
-*******************************************************/
-
-#if defined (L_mulhisi3)
-;;; R25:R22 = (signed long) R27:R26 * (signed long) R19:R18
-;;; C3:C0 = (signed long) A1:A0 * (signed long) B1:B0
-;;; Clobbers: __tmp_reg__
-DEFUN __mulhisi3
- XCALL __umulhisi3
- ;; Sign-extend B
- tst B1
- brpl 1f
- sub C2, A0
- sbc C3, A1
-1: ;; Sign-extend A
- XJMP __usmulhisi3_tail
-ENDF __mulhisi3
-#endif /* L_mulhisi3 */
-
-#if defined (L_usmulhisi3)
-;;; R25:R22 = (signed long) R27:R26 * (unsigned long) R19:R18
-;;; C3:C0 = (signed long) A1:A0 * (unsigned long) B1:B0
-;;; Clobbers: __tmp_reg__
-DEFUN __usmulhisi3
- XCALL __umulhisi3
- ;; FALLTHRU
-ENDF __usmulhisi3
-
-DEFUN __usmulhisi3_tail
- ;; Sign-extend A
- sbrs A1, 7
- ret
- sub C2, B0
- sbc C3, B1
- ret
-ENDF __usmulhisi3_tail
-#endif /* L_usmulhisi3 */
-
-#if defined (L_umulhisi3)
-;;; R25:R22 = (unsigned long) R27:R26 * (unsigned long) R19:R18
-;;; C3:C0 = (unsigned long) A1:A0 * (unsigned long) B1:B0
-;;; Clobbers: __tmp_reg__
-DEFUN __umulhisi3
- mul A0, B0
- movw C0, r0
- mul A1, B1
- movw C2, r0
- mul A0, B1
- rcall 1f
- mul A1, B0
-1: add C1, r0
- adc C2, r1
- clr __zero_reg__
- adc C3, __zero_reg__
- ret
-ENDF __umulhisi3
-#endif /* L_umulhisi3 */
-
-/*******************************************************
- Widening Multiplication 32 = 16 x 32
-*******************************************************/
-
-#if defined (L_mulshisi3)
-;;; R25:R22 = (signed long) R27:R26 * R21:R18
-;;; (C3:C0) = (signed long) A1:A0 * B3:B0
-;;; Clobbers: __tmp_reg__
-DEFUN __mulshisi3
-#ifdef __AVR_ERRATA_SKIP_JMP_CALL__
- ;; Some cores have problem skipping 2-word instruction
- tst A1
- brmi __mulohisi3
-#else
- sbrs A1, 7
-#endif /* __AVR_HAVE_JMP_CALL__ */
- XJMP __muluhisi3
- ;; FALLTHRU
-ENDF __mulshisi3
-
-;;; R25:R22 = (one-extended long) R27:R26 * R21:R18
-;;; (C3:C0) = (one-extended long) A1:A0 * B3:B0
-;;; Clobbers: __tmp_reg__
-DEFUN __mulohisi3
- XCALL __muluhisi3
- ;; One-extend R27:R26 (A1:A0)
- sub C2, B0
- sbc C3, B1
- ret
-ENDF __mulohisi3
-#endif /* L_mulshisi3 */
-
-#if defined (L_muluhisi3)
-;;; R25:R22 = (unsigned long) R27:R26 * R21:R18
-;;; (C3:C0) = (unsigned long) A1:A0 * B3:B0
-;;; Clobbers: __tmp_reg__
-DEFUN __muluhisi3
- XCALL __umulhisi3
- mul A0, B3
- add C3, r0
- mul A1, B2
- add C3, r0
- mul A0, B2
- add C2, r0
- adc C3, r1
- clr __zero_reg__
- ret
-ENDF __muluhisi3
-#endif /* L_muluhisi3 */
-
-/*******************************************************
- Multiplication 32 x 32
-*******************************************************/
-
-#if defined (L_mulsi3)
-;;; R25:R22 = R25:R22 * R21:R18
-;;; (C3:C0) = C3:C0 * B3:B0
-;;; Clobbers: R26, R27, __tmp_reg__
-DEFUN __mulsi3
- movw A0, C0
- push C2
- push C3
- XCALL __muluhisi3
- pop A1
- pop A0
- ;; A1:A0 now contains the high word of A
- mul A0, B0
- add C2, r0
- adc C3, r1
- mul A0, B1
- add C3, r0
- mul A1, B0
- add C3, r0
- clr __zero_reg__
- ret
-ENDF __mulsi3
-#endif /* L_mulsi3 */
-
-#undef A0
-#undef A1
-
-#undef B0
-#undef B1
-#undef B2
-#undef B3
-
-#undef C0
-#undef C1
-#undef C2
-#undef C3
-
-#endif /* __AVR_HAVE_MUL__ */
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
-
-.section .text.libgcc.div, "ax", @progbits
-
-/*******************************************************
- Division 8 / 8 => (result + remainder)
-*******************************************************/
-#define r_rem r25 /* remainder */
-#define r_arg1 r24 /* dividend, quotient */
-#define r_arg2 r22 /* divisor */
-#define r_cnt r23 /* loop count */
-
-#if defined (L_udivmodqi4)
-DEFUN __udivmodqi4
- sub r_rem,r_rem ; clear remainder and carry
- ldi r_cnt,9 ; init loop counter
- rjmp __udivmodqi4_ep ; jump to entry point
-__udivmodqi4_loop:
- rol r_rem ; shift dividend into remainder
- cp r_rem,r_arg2 ; compare remainder & divisor
- brcs __udivmodqi4_ep ; remainder <= divisor
- sub r_rem,r_arg2 ; restore remainder
-__udivmodqi4_ep:
- rol r_arg1 ; shift dividend (with CARRY)
- dec r_cnt ; decrement loop counter
- brne __udivmodqi4_loop
- com r_arg1 ; complement result
- ; because C flag was complemented in loop
- ret
-ENDF __udivmodqi4
-#endif /* defined (L_udivmodqi4) */
-
-#if defined (L_divmodqi4)
-DEFUN __divmodqi4
- bst r_arg1,7 ; store sign of dividend
- mov __tmp_reg__,r_arg1
- eor __tmp_reg__,r_arg2; r0.7 is sign of result
- sbrc r_arg1,7
- neg r_arg1 ; dividend negative : negate
- sbrc r_arg2,7
- neg r_arg2 ; divisor negative : negate
- XCALL __udivmodqi4 ; do the unsigned div/mod
- brtc __divmodqi4_1
- neg r_rem ; correct remainder sign
-__divmodqi4_1:
- sbrc __tmp_reg__,7
- neg r_arg1 ; correct result sign
-__divmodqi4_exit:
- ret
-ENDF __divmodqi4
-#endif /* defined (L_divmodqi4) */
-
-#undef r_rem
-#undef r_arg1
-#undef r_arg2
-#undef r_cnt
-
-
-/*******************************************************
- Division 16 / 16 => (result + remainder)
-*******************************************************/
-#define r_remL r26 /* remainder Low */
-#define r_remH r27 /* remainder High */
-
-/* return: remainder */
-#define r_arg1L r24 /* dividend Low */
-#define r_arg1H r25 /* dividend High */
-
-/* return: quotient */
-#define r_arg2L r22 /* divisor Low */
-#define r_arg2H r23 /* divisor High */
-
-#define r_cnt r21 /* loop count */
-
-#if defined (L_udivmodhi4)
-DEFUN __udivmodhi4
- sub r_remL,r_remL
- sub r_remH,r_remH ; clear remainder and carry
- ldi r_cnt,17 ; init loop counter
- rjmp __udivmodhi4_ep ; jump to entry point
-__udivmodhi4_loop:
- rol r_remL ; shift dividend into remainder
- rol r_remH
- cp r_remL,r_arg2L ; compare remainder & divisor
- cpc r_remH,r_arg2H
- brcs __udivmodhi4_ep ; remainder < divisor
- sub r_remL,r_arg2L ; restore remainder
- sbc r_remH,r_arg2H
-__udivmodhi4_ep:
- rol r_arg1L ; shift dividend (with CARRY)
- rol r_arg1H
- dec r_cnt ; decrement loop counter
- brne __udivmodhi4_loop
- com r_arg1L
- com r_arg1H
-; div/mod results to return registers, as for the div() function
- mov_l r_arg2L, r_arg1L ; quotient
- mov_h r_arg2H, r_arg1H
- mov_l r_arg1L, r_remL ; remainder
- mov_h r_arg1H, r_remH
- ret
-ENDF __udivmodhi4
-#endif /* defined (L_udivmodhi4) */
-
-#if defined (L_divmodhi4)
-DEFUN __divmodhi4
- .global _div
-_div:
- bst r_arg1H,7 ; store sign of dividend
- mov __tmp_reg__,r_arg1H
- eor __tmp_reg__,r_arg2H ; r0.7 is sign of result
- rcall __divmodhi4_neg1 ; dividend negative : negate
- sbrc r_arg2H,7
- rcall __divmodhi4_neg2 ; divisor negative : negate
- XCALL __udivmodhi4 ; do the unsigned div/mod
- rcall __divmodhi4_neg1 ; correct remainder sign
- tst __tmp_reg__
- brpl __divmodhi4_exit
-__divmodhi4_neg2:
- com r_arg2H
- neg r_arg2L ; correct divisor/result sign
- sbci r_arg2H,0xff
-__divmodhi4_exit:
- ret
-__divmodhi4_neg1:
- brtc __divmodhi4_exit
- com r_arg1H
- neg r_arg1L ; correct dividend/remainder sign
- sbci r_arg1H,0xff
- ret
-ENDF __divmodhi4
-#endif /* defined (L_divmodhi4) */
-
-#undef r_remH
-#undef r_remL
-
-#undef r_arg1H
-#undef r_arg1L
-
-#undef r_arg2H
-#undef r_arg2L
-
-#undef r_cnt
-
-/*******************************************************
- Division 32 / 32 => (result + remainder)
-*******************************************************/
-#define r_remHH r31 /* remainder High */
-#define r_remHL r30
-#define r_remH r27
-#define r_remL r26 /* remainder Low */
-
-/* return: remainder */
-#define r_arg1HH r25 /* dividend High */
-#define r_arg1HL r24
-#define r_arg1H r23
-#define r_arg1L r22 /* dividend Low */
-
-/* return: quotient */
-#define r_arg2HH r21 /* divisor High */
-#define r_arg2HL r20
-#define r_arg2H r19
-#define r_arg2L r18 /* divisor Low */
-
-#define r_cnt __zero_reg__ /* loop count (0 after the loop!) */
-
-#if defined (L_udivmodsi4)
-DEFUN __udivmodsi4
- ldi r_remL, 33 ; init loop counter
- mov r_cnt, r_remL
- sub r_remL,r_remL
- sub r_remH,r_remH ; clear remainder and carry
- mov_l r_remHL, r_remL
- mov_h r_remHH, r_remH
- rjmp __udivmodsi4_ep ; jump to entry point
-__udivmodsi4_loop:
- rol r_remL ; shift dividend into remainder
- rol r_remH
- rol r_remHL
- rol r_remHH
- cp r_remL,r_arg2L ; compare remainder & divisor
- cpc r_remH,r_arg2H
- cpc r_remHL,r_arg2HL
- cpc r_remHH,r_arg2HH
- brcs __udivmodsi4_ep ; remainder <= divisor
- sub r_remL,r_arg2L ; restore remainder
- sbc r_remH,r_arg2H
- sbc r_remHL,r_arg2HL
- sbc r_remHH,r_arg2HH
-__udivmodsi4_ep:
- rol r_arg1L ; shift dividend (with CARRY)
- rol r_arg1H
- rol r_arg1HL
- rol r_arg1HH
- dec r_cnt ; decrement loop counter
- brne __udivmodsi4_loop
- ; __zero_reg__ now restored (r_cnt == 0)
- com r_arg1L
- com r_arg1H
- com r_arg1HL
- com r_arg1HH
-; div/mod results to return registers, as for the ldiv() function
- mov_l r_arg2L, r_arg1L ; quotient
- mov_h r_arg2H, r_arg1H
- mov_l r_arg2HL, r_arg1HL
- mov_h r_arg2HH, r_arg1HH
- mov_l r_arg1L, r_remL ; remainder
- mov_h r_arg1H, r_remH
- mov_l r_arg1HL, r_remHL
- mov_h r_arg1HH, r_remHH
- ret
-ENDF __udivmodsi4
-#endif /* defined (L_udivmodsi4) */
-
-#if defined (L_divmodsi4)
-DEFUN __divmodsi4
- bst r_arg1HH,7 ; store sign of dividend
- mov __tmp_reg__,r_arg1HH
- eor __tmp_reg__,r_arg2HH ; r0.7 is sign of result
- rcall __divmodsi4_neg1 ; dividend negative : negate
- sbrc r_arg2HH,7
- rcall __divmodsi4_neg2 ; divisor negative : negate
- XCALL __udivmodsi4 ; do the unsigned div/mod
- rcall __divmodsi4_neg1 ; correct remainder sign
- rol __tmp_reg__
- brcc __divmodsi4_exit
-__divmodsi4_neg2:
- com r_arg2HH
- com r_arg2HL
- com r_arg2H
- neg r_arg2L ; correct divisor/quotient sign
- sbci r_arg2H,0xff
- sbci r_arg2HL,0xff
- sbci r_arg2HH,0xff
-__divmodsi4_exit:
- ret
-__divmodsi4_neg1:
- brtc __divmodsi4_exit
- com r_arg1HH
- com r_arg1HL
- com r_arg1H
- neg r_arg1L ; correct dividend/remainder sign
- sbci r_arg1H, 0xff
- sbci r_arg1HL,0xff
- sbci r_arg1HH,0xff
- ret
-ENDF __divmodsi4
-#endif /* defined (L_divmodsi4) */
-
-
-.section .text.libgcc.prologue, "ax", @progbits
-
-/**********************************
- * This is a prologue subroutine
- **********************************/
-#if defined (L_prologue)
-
-DEFUN __prologue_saves__
- push r2
- push r3
- push r4
- push r5
- push r6
- push r7
- push r8
- push r9
- push r10
- push r11
- push r12
- push r13
- push r14
- push r15
- push r16
- push r17
- push r28
- push r29
- in r28,__SP_L__
- in r29,__SP_H__
- sub r28,r26
- sbc r29,r27
- in __tmp_reg__,__SREG__
- cli
- out __SP_H__,r29
- out __SREG__,__tmp_reg__
- out __SP_L__,r28
-#if defined (__AVR_HAVE_EIJMP_EICALL__)
- eijmp
-#else
- ijmp
-#endif
-
-ENDF __prologue_saves__
-#endif /* defined (L_prologue) */
-
-/*
- * This is an epilogue subroutine
- */
-#if defined (L_epilogue)
-
-DEFUN __epilogue_restores__
- ldd r2,Y+18
- ldd r3,Y+17
- ldd r4,Y+16
- ldd r5,Y+15
- ldd r6,Y+14
- ldd r7,Y+13
- ldd r8,Y+12
- ldd r9,Y+11
- ldd r10,Y+10
- ldd r11,Y+9
- ldd r12,Y+8
- ldd r13,Y+7
- ldd r14,Y+6
- ldd r15,Y+5
- ldd r16,Y+4
- ldd r17,Y+3
- ldd r26,Y+2
- ldd r27,Y+1
- add r28,r30
- adc r29,__zero_reg__
- in __tmp_reg__,__SREG__
- cli
- out __SP_H__,r29
- out __SREG__,__tmp_reg__
- out __SP_L__,r28
- mov_l r28, r26
- mov_h r29, r27
- ret
-ENDF __epilogue_restores__
-#endif /* defined (L_epilogue) */
-
-#ifdef L_exit
- .section .fini9,"ax",@progbits
-DEFUN _exit
- .weak exit
-exit:
-ENDF _exit
-
- /* Code from .fini8 ... .fini1 sections inserted by ld script. */
-
- .section .fini0,"ax",@progbits
- cli
-__stop_program:
- rjmp __stop_program
-#endif /* defined (L_exit) */
-
-#ifdef L_cleanup
- .weak _cleanup
- .func _cleanup
-_cleanup:
- ret
-.endfunc
-#endif /* defined (L_cleanup) */
-
-
-.section .text.libgcc, "ax", @progbits
-
-#ifdef L_tablejump
-DEFUN __tablejump2__
- lsl r30
- rol r31
- ;; FALLTHRU
-ENDF __tablejump2__
-
-DEFUN __tablejump__
-#if defined (__AVR_HAVE_LPMX__)
- lpm __tmp_reg__, Z+
- lpm r31, Z
- mov r30, __tmp_reg__
-#if defined (__AVR_HAVE_EIJMP_EICALL__)
- eijmp
-#else
- ijmp
-#endif
-
-#else /* !HAVE_LPMX */
- lpm
- adiw r30, 1
- push r0
- lpm
- push r0
-#if defined (__AVR_HAVE_EIJMP_EICALL__)
- in __tmp_reg__, __EIND__
- push __tmp_reg__
-#endif
- ret
-#endif /* !HAVE_LPMX */
-ENDF __tablejump__
-#endif /* defined (L_tablejump) */
-
-#ifdef L_copy_data
- .section .init4,"ax",@progbits
-DEFUN __do_copy_data
-#if defined(__AVR_HAVE_ELPMX__)
- ldi r17, hi8(__data_end)
- ldi r26, lo8(__data_start)
- ldi r27, hi8(__data_start)
- ldi r30, lo8(__data_load_start)
- ldi r31, hi8(__data_load_start)
- ldi r16, hh8(__data_load_start)
- out __RAMPZ__, r16
- rjmp .L__do_copy_data_start
-.L__do_copy_data_loop:
- elpm r0, Z+
- st X+, r0
-.L__do_copy_data_start:
- cpi r26, lo8(__data_end)
- cpc r27, r17
- brne .L__do_copy_data_loop
-#elif !defined(__AVR_HAVE_ELPMX__) && defined(__AVR_HAVE_ELPM__)
- ldi r17, hi8(__data_end)
- ldi r26, lo8(__data_start)
- ldi r27, hi8(__data_start)
- ldi r30, lo8(__data_load_start)
- ldi r31, hi8(__data_load_start)
- ldi r16, hh8(__data_load_start - 0x10000)
-.L__do_copy_data_carry:
- inc r16
- out __RAMPZ__, r16
- rjmp .L__do_copy_data_start
-.L__do_copy_data_loop:
- elpm
- st X+, r0
- adiw r30, 1
- brcs .L__do_copy_data_carry
-.L__do_copy_data_start:
- cpi r26, lo8(__data_end)
- cpc r27, r17
- brne .L__do_copy_data_loop
-#elif !defined(__AVR_HAVE_ELPMX__) && !defined(__AVR_HAVE_ELPM__)
- ldi r17, hi8(__data_end)
- ldi r26, lo8(__data_start)
- ldi r27, hi8(__data_start)
- ldi r30, lo8(__data_load_start)
- ldi r31, hi8(__data_load_start)
- rjmp .L__do_copy_data_start
-.L__do_copy_data_loop:
-#if defined (__AVR_HAVE_LPMX__)
- lpm r0, Z+
-#else
- lpm
- adiw r30, 1
-#endif
- st X+, r0
-.L__do_copy_data_start:
- cpi r26, lo8(__data_end)
- cpc r27, r17
- brne .L__do_copy_data_loop
-#endif /* !defined(__AVR_HAVE_ELPMX__) && !defined(__AVR_HAVE_ELPM__) */
-ENDF __do_copy_data
-#endif /* L_copy_data */
-
-/* __do_clear_bss is only necessary if there is anything in .bss section. */
-
-#ifdef L_clear_bss
- .section .init4,"ax",@progbits
-DEFUN __do_clear_bss
- ldi r17, hi8(__bss_end)
- ldi r26, lo8(__bss_start)
- ldi r27, hi8(__bss_start)
- rjmp .do_clear_bss_start
-.do_clear_bss_loop:
- st X+, __zero_reg__
-.do_clear_bss_start:
- cpi r26, lo8(__bss_end)
- cpc r27, r17
- brne .do_clear_bss_loop
-ENDF __do_clear_bss
-#endif /* L_clear_bss */
-
-/* __do_global_ctors and __do_global_dtors are only necessary
- if there are any constructors/destructors. */
-
-#ifdef L_ctors
- .section .init6,"ax",@progbits
-DEFUN __do_global_ctors
-#if defined(__AVR_HAVE_RAMPZ__)
- ldi r17, hi8(__ctors_start)
- ldi r28, lo8(__ctors_end)
- ldi r29, hi8(__ctors_end)
- ldi r16, hh8(__ctors_end)
- rjmp .L__do_global_ctors_start
-.L__do_global_ctors_loop:
- sbiw r28, 2
- sbc r16, __zero_reg__
- mov_h r31, r29
- mov_l r30, r28
- out __RAMPZ__, r16
- XCALL __tablejump_elpm__
-.L__do_global_ctors_start:
- cpi r28, lo8(__ctors_start)
- cpc r29, r17
- ldi r24, hh8(__ctors_start)
- cpc r16, r24
- brne .L__do_global_ctors_loop
-#else
- ldi r17, hi8(__ctors_start)
- ldi r28, lo8(__ctors_end)
- ldi r29, hi8(__ctors_end)
- rjmp .L__do_global_ctors_start
-.L__do_global_ctors_loop:
- sbiw r28, 2
- mov_h r31, r29
- mov_l r30, r28
- XCALL __tablejump__
-.L__do_global_ctors_start:
- cpi r28, lo8(__ctors_start)
- cpc r29, r17
- brne .L__do_global_ctors_loop
-#endif /* defined(__AVR_HAVE_RAMPZ__) */
-ENDF __do_global_ctors
-#endif /* L_ctors */
-
-#ifdef L_dtors
- .section .fini6,"ax",@progbits
-DEFUN __do_global_dtors
-#if defined(__AVR_HAVE_RAMPZ__)
- ldi r17, hi8(__dtors_end)
- ldi r28, lo8(__dtors_start)
- ldi r29, hi8(__dtors_start)
- ldi r16, hh8(__dtors_start)
- rjmp .L__do_global_dtors_start
-.L__do_global_dtors_loop:
- sbiw r28, 2
- sbc r16, __zero_reg__
- mov_h r31, r29
- mov_l r30, r28
- out __RAMPZ__, r16
- XCALL __tablejump_elpm__
-.L__do_global_dtors_start:
- cpi r28, lo8(__dtors_end)
- cpc r29, r17
- ldi r24, hh8(__dtors_end)
- cpc r16, r24
- brne .L__do_global_dtors_loop
-#else
- ldi r17, hi8(__dtors_end)
- ldi r28, lo8(__dtors_start)
- ldi r29, hi8(__dtors_start)
- rjmp .L__do_global_dtors_start
-.L__do_global_dtors_loop:
- mov_h r31, r29
- mov_l r30, r28
- XCALL __tablejump__
- adiw r28, 2
-.L__do_global_dtors_start:
- cpi r28, lo8(__dtors_end)
- cpc r29, r17
- brne .L__do_global_dtors_loop
-#endif /* defined(__AVR_HAVE_RAMPZ__) */
-ENDF __do_global_dtors
-#endif /* L_dtors */
-
-.section .text.libgcc, "ax", @progbits
-
-#ifdef L_tablejump_elpm
-DEFUN __tablejump_elpm__
-#if defined (__AVR_HAVE_ELPM__)
-#if defined (__AVR_HAVE_LPMX__)
- elpm __tmp_reg__, Z+
- elpm r31, Z
- mov r30, __tmp_reg__
-#if defined (__AVR_HAVE_EIJMP_EICALL__)
- eijmp
-#else
- ijmp
-#endif
-
-#else
- elpm
- adiw r30, 1
- push r0
- elpm
- push r0
-#if defined (__AVR_HAVE_EIJMP_EICALL__)
- in __tmp_reg__, __EIND__
- push __tmp_reg__
-#endif
- ret
-#endif
-#endif /* defined (__AVR_HAVE_ELPM__) */
-ENDF __tablejump_elpm__
-#endif /* defined (L_tablejump_elpm) */
-
-
-.section .text.libgcc.builtins, "ax", @progbits
-
-/**********************************
- * Find first set Bit (ffs)
- **********************************/
-
-#if defined (L_ffssi2)
-;; find first set bit
-;; r25:r24 = ffs32 (r25:r22)
-;; clobbers: r22, r26
-DEFUN __ffssi2
- clr r26
- tst r22
- brne 1f
- subi r26, -8
- or r22, r23
- brne 1f
- subi r26, -8
- or r22, r24
- brne 1f
- subi r26, -8
- or r22, r25
- brne 1f
- ret
-1: mov r24, r22
- XJMP __loop_ffsqi2
-ENDF __ffssi2
-#endif /* defined (L_ffssi2) */
-
-#if defined (L_ffshi2)
-;; find first set bit
-;; r25:r24 = ffs16 (r25:r24)
-;; clobbers: r26
-DEFUN __ffshi2
- clr r26
-#ifdef __AVR_ERRATA_SKIP_JMP_CALL__
- ;; Some cores have problem skipping 2-word instruction
- tst r24
- breq 2f
-#else
- cpse r24, __zero_reg__
-#endif /* __AVR_HAVE_JMP_CALL__ */
-1: XJMP __loop_ffsqi2
-2: ldi r26, 8
- or r24, r25
- brne 1b
- ret
-ENDF __ffshi2
-#endif /* defined (L_ffshi2) */
-
-#if defined (L_loop_ffsqi2)
-;; Helper for ffshi2, ffssi2
-;; r25:r24 = r26 + zero_extend16 (ffs8(r24))
-;; r24 must be != 0
-;; clobbers: r26
-DEFUN __loop_ffsqi2
- inc r26
- lsr r24
- brcc __loop_ffsqi2
- mov r24, r26
- clr r25
- ret
-ENDF __loop_ffsqi2
-#endif /* defined (L_loop_ffsqi2) */
-
-
-/**********************************
- * Count trailing Zeros (ctz)
- **********************************/
-
-#if defined (L_ctzsi2)
-;; count trailing zeros
-;; r25:r24 = ctz32 (r25:r22)
-;; clobbers: r26, r22
-;; ctz(0) = 255
-;; Note that ctz(0) in undefined for GCC
-DEFUN __ctzsi2
- XCALL __ffssi2
- dec r24
- ret
-ENDF __ctzsi2
-#endif /* defined (L_ctzsi2) */
-
-#if defined (L_ctzhi2)
-;; count trailing zeros
-;; r25:r24 = ctz16 (r25:r24)
-;; clobbers: r26
-;; ctz(0) = 255
-;; Note that ctz(0) in undefined for GCC
-DEFUN __ctzhi2
- XCALL __ffshi2
- dec r24
- ret
-ENDF __ctzhi2
-#endif /* defined (L_ctzhi2) */
-
-
-/**********************************
- * Count leading Zeros (clz)
- **********************************/
-
-#if defined (L_clzdi2)
-;; count leading zeros
-;; r25:r24 = clz64 (r25:r18)
-;; clobbers: r22, r23, r26
-DEFUN __clzdi2
- XCALL __clzsi2
- sbrs r24, 5
- ret
- mov_l r22, r18
- mov_h r23, r19
- mov_l r24, r20
- mov_h r25, r21
- XCALL __clzsi2
- subi r24, -32
- ret
-ENDF __clzdi2
-#endif /* defined (L_clzdi2) */
-
-#if defined (L_clzsi2)
-;; count leading zeros
-;; r25:r24 = clz32 (r25:r22)
-;; clobbers: r26
-DEFUN __clzsi2
- XCALL __clzhi2
- sbrs r24, 4
- ret
- mov_l r24, r22
- mov_h r25, r23
- XCALL __clzhi2
- subi r24, -16
- ret
-ENDF __clzsi2
-#endif /* defined (L_clzsi2) */
-
-#if defined (L_clzhi2)
-;; count leading zeros
-;; r25:r24 = clz16 (r25:r24)
-;; clobbers: r26
-DEFUN __clzhi2
- clr r26
- tst r25
- brne 1f
- subi r26, -8
- or r25, r24
- brne 1f
- ldi r24, 16
- ret
-1: cpi r25, 16
- brsh 3f
- subi r26, -3
- swap r25
-2: inc r26
-3: lsl r25
- brcc 2b
- mov r24, r26
- clr r25
- ret
-ENDF __clzhi2
-#endif /* defined (L_clzhi2) */
-
-
-/**********************************
- * Parity
- **********************************/
-
-#if defined (L_paritydi2)
-;; r25:r24 = parity64 (r25:r18)
-;; clobbers: __tmp_reg__
-DEFUN __paritydi2
- eor r24, r18
- eor r24, r19
- eor r24, r20
- eor r24, r21
- XJMP __paritysi2
-ENDF __paritydi2
-#endif /* defined (L_paritydi2) */
-
-#if defined (L_paritysi2)
-;; r25:r24 = parity32 (r25:r22)
-;; clobbers: __tmp_reg__
-DEFUN __paritysi2
- eor r24, r22
- eor r24, r23
- XJMP __parityhi2
-ENDF __paritysi2
-#endif /* defined (L_paritysi2) */
-
-#if defined (L_parityhi2)
-;; r25:r24 = parity16 (r25:r24)
-;; clobbers: __tmp_reg__
-DEFUN __parityhi2
- eor r24, r25
-;; FALLTHRU
-ENDF __parityhi2
-
-;; r25:r24 = parity8 (r24)
-;; clobbers: __tmp_reg__
-DEFUN __parityqi2
- ;; parity is in r24[0..7]
- mov __tmp_reg__, r24
- swap __tmp_reg__
- eor r24, __tmp_reg__
- ;; parity is in r24[0..3]
- subi r24, -4
- andi r24, -5
- subi r24, -6
- ;; parity is in r24[0,3]
- sbrc r24, 3
- inc r24
- ;; parity is in r24[0]
- andi r24, 1
- clr r25
- ret
-ENDF __parityqi2
-#endif /* defined (L_parityhi2) */
-
-
-/**********************************
- * Population Count
- **********************************/
-
-#if defined (L_popcounthi2)
-;; population count
-;; r25:r24 = popcount16 (r25:r24)
-;; clobbers: __tmp_reg__
-DEFUN __popcounthi2
- XCALL __popcountqi2
- push r24
- mov r24, r25
- XCALL __popcountqi2
- clr r25
- ;; FALLTHRU
-ENDF __popcounthi2
-
-DEFUN __popcounthi2_tail
- pop __tmp_reg__
- add r24, __tmp_reg__
- ret
-ENDF __popcounthi2_tail
-#endif /* defined (L_popcounthi2) */
-
-#if defined (L_popcountsi2)
-;; population count
-;; r25:r24 = popcount32 (r25:r22)
-;; clobbers: __tmp_reg__
-DEFUN __popcountsi2
- XCALL __popcounthi2
- push r24
- mov_l r24, r22
- mov_h r25, r23
- XCALL __popcounthi2
- XJMP __popcounthi2_tail
-ENDF __popcountsi2
-#endif /* defined (L_popcountsi2) */
-
-#if defined (L_popcountdi2)
-;; population count
-;; r25:r24 = popcount64 (r25:r18)
-;; clobbers: r22, r23, __tmp_reg__
-DEFUN __popcountdi2
- XCALL __popcountsi2
- push r24
- mov_l r22, r18
- mov_h r23, r19
- mov_l r24, r20
- mov_h r25, r21
- XCALL __popcountsi2
- XJMP __popcounthi2_tail
-ENDF __popcountdi2
-#endif /* defined (L_popcountdi2) */
-
-#if defined (L_popcountqi2)
-;; population count
-;; r24 = popcount8 (r24)
-;; clobbers: __tmp_reg__
-DEFUN __popcountqi2
- mov __tmp_reg__, r24
- andi r24, 1
- lsr __tmp_reg__
- lsr __tmp_reg__
- adc r24, __zero_reg__
- lsr __tmp_reg__
- adc r24, __zero_reg__
- lsr __tmp_reg__
- adc r24, __zero_reg__
- lsr __tmp_reg__
- adc r24, __zero_reg__
- lsr __tmp_reg__
- adc r24, __zero_reg__
- lsr __tmp_reg__
- adc r24, __tmp_reg__
- ret
-ENDF __popcountqi2
-#endif /* defined (L_popcountqi2) */
-
-
-/**********************************
- * Swap bytes
- **********************************/
-
-;; swap two registers with different register number
-.macro bswap a, b
- eor \a, \b
- eor \b, \a
- eor \a, \b
-.endm
-
-#if defined (L_bswapsi2)
-;; swap bytes
-;; r25:r22 = bswap32 (r25:r22)
-DEFUN __bswapsi2
- bswap r22, r25
- bswap r23, r24
- ret
-ENDF __bswapsi2
-#endif /* defined (L_bswapsi2) */
-
-#if defined (L_bswapdi2)
-;; swap bytes
-;; r25:r18 = bswap64 (r25:r18)
-DEFUN __bswapdi2
- bswap r18, r25
- bswap r19, r24
- bswap r20, r23
- bswap r21, r22
- ret
-ENDF __bswapdi2
-#endif /* defined (L_bswapdi2) */
-
-
-/**********************************
- * 64-bit shifts
- **********************************/
-
-#if defined (L_ashrdi3)
-;; Arithmetic shift right
-;; r25:r18 = ashr64 (r25:r18, r17:r16)
-DEFUN __ashrdi3
- push r16
- andi r16, 63
- breq 2f
-1: asr r25
- ror r24
- ror r23
- ror r22
- ror r21
- ror r20
- ror r19
- ror r18
- dec r16
- brne 1b
-2: pop r16
- ret
-ENDF __ashrdi3
-#endif /* defined (L_ashrdi3) */
-
-#if defined (L_lshrdi3)
-;; Logic shift right
-;; r25:r18 = lshr64 (r25:r18, r17:r16)
-DEFUN __lshrdi3
- push r16
- andi r16, 63
- breq 2f
-1: lsr r25
- ror r24
- ror r23
- ror r22
- ror r21
- ror r20
- ror r19
- ror r18
- dec r16
- brne 1b
-2: pop r16
- ret
-ENDF __lshrdi3
-#endif /* defined (L_lshrdi3) */
-
-#if defined (L_ashldi3)
-;; Shift left
-;; r25:r18 = ashl64 (r25:r18, r17:r16)
-DEFUN __ashldi3
- push r16
- andi r16, 63
- breq 2f
-1: lsl r18
- rol r19
- rol r20
- rol r21
- rol r22
- rol r23
- rol r24
- rol r25
- dec r16
- brne 1b
-2: pop r16
- ret
-ENDF __ashldi3
-#endif /* defined (L_ashldi3) */
-
-
-.section .text.libgcc.fmul, "ax", @progbits
-
-/***********************************************************/
-;;; Softmul versions of FMUL, FMULS and FMULSU to implement
-;;; __builtin_avr_fmul* if !AVR_HAVE_MUL
-/***********************************************************/
-
-#define A1 24
-#define B1 25
-#define C0 22
-#define C1 23
-#define A0 __tmp_reg__
-
-#ifdef L_fmuls
-;;; r23:r22 = fmuls (r24, r25) like in FMULS instruction
-;;; Clobbers: r24, r25, __tmp_reg__
-DEFUN __fmuls
- ;; A0.7 = negate result?
- mov A0, A1
- eor A0, B1
- ;; B1 = |B1|
- sbrc B1, 7
- neg B1
- XJMP __fmulsu_exit
-ENDF __fmuls
-#endif /* L_fmuls */
-
-#ifdef L_fmulsu
-;;; r23:r22 = fmulsu (r24, r25) like in FMULSU instruction
-;;; Clobbers: r24, r25, __tmp_reg__
-DEFUN __fmulsu
- ;; A0.7 = negate result?
- mov A0, A1
-;; FALLTHRU
-ENDF __fmulsu
-
-;; Helper for __fmuls and __fmulsu
-DEFUN __fmulsu_exit
- ;; A1 = |A1|
- sbrc A1, 7
- neg A1
-#ifdef __AVR_ERRATA_SKIP_JMP_CALL__
- ;; Some cores have problem skipping 2-word instruction
- tst A0
- brmi 1f
-#else
- sbrs A0, 7
-#endif /* __AVR_HAVE_JMP_CALL__ */
- XJMP __fmul
-1: XCALL __fmul
- ;; C = -C iff A0.7 = 1
- com C1
- neg C0
- sbci C1, -1
- ret
-ENDF __fmulsu_exit
-#endif /* L_fmulsu */
-
-
-#ifdef L_fmul
-;;; r22:r23 = fmul (r24, r25) like in FMUL instruction
-;;; Clobbers: r24, r25, __tmp_reg__
-DEFUN __fmul
- ; clear result
- clr C0
- clr C1
- clr A0
-1: tst B1
- ;; 1.0 = 0x80, so test for bit 7 of B to see if A must to be added to C.
-2: brpl 3f
- ;; C += A
- add C0, A0
- adc C1, A1
-3: ;; A >>= 1
- lsr A1
- ror A0
- ;; B <<= 1
- lsl B1
- brne 2b
- ret
-ENDF __fmul
-#endif /* L_fmul */
-
-#undef A0
-#undef A1
-#undef B1
-#undef C0
-#undef C1
diff --git a/gcc/config/avr/t-avr b/gcc/config/avr/t-avr
index 30e8d96447e..ee2dc56ced6 100644
--- a/gcc/config/avr/t-avr
+++ b/gcc/config/avr/t-avr
@@ -39,62 +39,6 @@ $(srcdir)/config/avr/avr-tables.opt: $(srcdir)/config/avr/genopt.sh \
$(SHELL) $(srcdir)/config/avr/genopt.sh $(srcdir)/config/avr > \
$(srcdir)/config/avr/avr-tables.opt
-LIB1ASMSRC = avr/libgcc.S
-LIB1ASMFUNCS = \
- _mulqi3 \
- _mulhi3 \
- _mulhisi3 \
- _umulhisi3 \
- _usmulhisi3 \
- _muluhisi3 \
- _mulshisi3 \
- _mulsi3 \
- _udivmodqi4 \
- _divmodqi4 \
- _udivmodhi4 \
- _divmodhi4 \
- _udivmodsi4 \
- _divmodsi4 \
- _prologue \
- _epilogue \
- _exit \
- _cleanup \
- _tablejump \
- _tablejump_elpm \
- _copy_data \
- _clear_bss \
- _ctors \
- _dtors \
- _ffssi2 \
- _ffshi2 \
- _loop_ffsqi2 \
- _ctzsi2 \
- _ctzhi2 \
- _clzdi2 \
- _clzsi2 \
- _clzhi2 \
- _paritydi2 \
- _paritysi2 \
- _parityhi2 \
- _popcounthi2 \
- _popcountsi2 \
- _popcountdi2 \
- _popcountqi2 \
- _bswapsi2 \
- _bswapdi2 \
- _ashldi3 \
- _ashrdi3 \
- _lshrdi3 \
- _fmul _fmuls _fmulsu
-
-LIB2FUNCS_EXCLUDE = \
- _clz
-
-# We do not have the DF type.
-# Most of the C functions in libgcc2 use almost all registers,
-# so use -mcall-prologues for smaller code size.
-TARGET_LIBGCC2_CFLAGS = -DDF=SF -Dinhibit_libc -mcall-prologues -Os
-
MULTILIB_OPTIONS = mmcu=avr2/mmcu=avr25/mmcu=avr3/mmcu=avr31/mmcu=avr35/mmcu=avr4/mmcu=avr5/mmcu=avr51/mmcu=avr6
MULTILIB_DIRNAMES = avr2 avr25 avr3 avr31 avr35 avr4 avr5 avr51 avr6
@@ -243,6 +187,3 @@ MULTILIB_MATCHES = \
mmcu?avr6=mmcu?atmega2561
MULTILIB_EXCEPTIONS =
-
-LIBGCC = stmp-multilib
-INSTALL_LIBGCC = install-multilib
diff --git a/gcc/config/bfin/crti.s b/gcc/config/bfin/crti.s
deleted file mode 100644
index b6f20fc9e6b..00000000000
--- a/gcc/config/bfin/crti.s
+++ /dev/null
@@ -1,59 +0,0 @@
-/* Specialized code needed to support construction and destruction of
- file-scope objects in C++ and Java code, and to support exception handling.
- Copyright (C) 2005, 2008, 2009 Free Software Foundation, Inc.
- Contributed by Analog Devices.
-
-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/>. */
-
-/*
- * This file just supplies function prologues for the .init and .fini
- * sections. It is linked in before crtbegin.o.
- */
-
- .ident "GNU C crti.o"
-
- .section .init
- .globl __init
- .type __init,@function
-__init:
-#if defined __ID_SHARED_LIB__
- [--SP] = P5;
-#elif defined __BFIN_FDPIC__
- [--SP] = P3;
-#endif
- LINK 12;
-#if defined __ID_SHARED_LIB__
- P5 = [P5 + _current_shared_library_p5_offset_]
-#endif
- .section .fini
- .globl __fini
- .type __fini,@function
-__fini:
-#if defined __ID_SHARED_LIB__
- [--SP] = P5;
-#elif defined __BFIN_FDPIC__
- [--SP] = P3;
-#endif
- LINK 12;
-#if defined __ID_SHARED_LIB__
- P5 = [P5 + _current_shared_library_p5_offset_]
-#endif
diff --git a/gcc/config/bfin/crtn.s b/gcc/config/bfin/crtn.s
deleted file mode 100644
index 7fcd27bfade..00000000000
--- a/gcc/config/bfin/crtn.s
+++ /dev/null
@@ -1,50 +0,0 @@
-/* Specialized code needed to support construction and destruction of
- file-scope objects in C++ and Java code, and to support exception handling.
- Copyright (C) 2005, 2008, 2009 Free Software Foundation, Inc.
- Contributed by Analog Devices.
-
-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/>. */
-
-/*
- * This file supplies function epilogues for the .init and .fini sections.
- * It is linked in after all other files.
- */
-
- .ident "GNU C crtn.o"
-
- .section .init
- unlink;
-#if defined __ID_SHARED_LIB__
- P5 = [SP++];
-#elif defined __BFIN_FDPIC__
- P3 = [SP++];
-#endif
- rts;
-
- .section .fini
- unlink;
-#if defined __ID_SHARED_LIB__
- P5 = [SP++];
-#elif defined __BFIN_FDPIC__
- P3 = [SP++];
-#endif
- rts;
diff --git a/gcc/config/bfin/lib1funcs.asm b/gcc/config/bfin/lib1funcs.asm
deleted file mode 100644
index c7bf4f3f05c..00000000000
--- a/gcc/config/bfin/lib1funcs.asm
+++ /dev/null
@@ -1,211 +0,0 @@
-/* libgcc functions for Blackfin.
- Copyright (C) 2005, 2009 Free Software Foundation, Inc.
- Contributed by Analog Devices.
-
-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/>. */
-
-#ifdef L_divsi3
-.text
-.align 2
-.global ___divsi3;
-.type ___divsi3, STT_FUNC;
-
-___divsi3:
- [--SP]= RETS;
- [--SP] = R7;
-
- R2 = -R0;
- CC = R0 < 0;
- IF CC R0 = R2;
- R7 = CC;
-
- R2 = -R1;
- CC = R1 < 0;
- IF CC R1 = R2;
- R2 = CC;
- R7 = R7 ^ R2;
-
- CALL ___udivsi3;
-
- CC = R7;
- R1 = -R0;
- IF CC R0 = R1;
-
- R7 = [SP++];
- RETS = [SP++];
- RTS;
-#endif
-
-#ifdef L_modsi3
-.align 2
-.global ___modsi3;
-.type ___modsi3, STT_FUNC;
-
-___modsi3:
- [--SP] = RETS;
- [--SP] = R0;
- [--SP] = R1;
- CALL ___divsi3;
- R2 = [SP++];
- R1 = [SP++];
- R2 *= R0;
- R0 = R1 - R2;
- RETS = [SP++];
- RTS;
-#endif
-
-#ifdef L_udivsi3
-.align 2
-.global ___udivsi3;
-.type ___udivsi3, STT_FUNC;
-
-___udivsi3:
- P0 = 32;
- LSETUP (0f, 1f) LC0 = P0;
- /* upper half of dividend */
- R3 = 0;
-0:
- /* The first time round in the loop we shift in garbage, but since we
- perform 33 shifts, it doesn't matter. */
- R0 = ROT R0 BY 1;
- R3 = ROT R3 BY 1;
- R2 = R3 - R1;
- CC = R3 < R1 (IU);
-1:
- /* Last instruction of the loop. */
- IF ! CC R3 = R2;
-
- /* Shift in the last bit. */
- R0 = ROT R0 BY 1;
- /* R0 is the result, R3 contains the remainder. */
- R0 = ~ R0;
- RTS;
-#endif
-
-#ifdef L_umodsi3
-.align 2
-.global ___umodsi3;
-.type ___umodsi3, STT_FUNC;
-
-___umodsi3:
- [--SP] = RETS;
- CALL ___udivsi3;
- R0 = R3;
- RETS = [SP++];
- RTS;
-#endif
-
-#ifdef L_umulsi3_highpart
-.align 2
-.global ___umulsi3_highpart;
-.type ___umulsi3_highpart, STT_FUNC;
-
-___umulsi3_highpart:
- A1 = R1.L * R0.L (FU);
- A1 = A1 >> 16;
- A0 = R1.H * R0.H, A1 += R1.L * R0.H (FU);
- A1 += R0.L * R1.H (FU);
- A1 = A1 >> 16;
- A0 += A1;
- R0 = A0 (FU);
- RTS;
-#endif
-
-#ifdef L_smulsi3_highpart
-.align 2
-.global ___smulsi3_highpart;
-.type ___smulsi3_highpart, STT_FUNC;
-
-___smulsi3_highpart:
- A1 = R1.L * R0.L (FU);
- A1 = A1 >> 16;
- A0 = R0.H * R1.H, A1 += R0.H * R1.L (IS,M);
- A1 += R1.H * R0.L (IS,M);
- A1 = A1 >>> 16;
- R0 = (A0 += A1);
- RTS;
-#endif
-
-#ifdef L_muldi3
-.align 2
-.global ___muldi3;
-.type ___muldi3, STT_FUNC;
-
-/*
- R1:R0 * R3:R2
- = R1.h:R1.l:R0.h:R0.l * R3.h:R3.l:R2.h:R2.l
-[X] = (R1.h * R3.h) * 2^96
-[X] + (R1.h * R3.l + R1.l * R3.h) * 2^80
-[X] + (R1.h * R2.h + R1.l * R3.l + R3.h * R0.h) * 2^64
-[T1] + (R1.h * R2.l + R3.h * R0.l + R1.l * R2.h + R3.l * R0.h) * 2^48
-[T2] + (R1.l * R2.l + R3.l * R0.l + R0.h * R2.h) * 2^32
-[T3] + (R0.l * R2.h + R2.l * R0.h) * 2^16
-[T4] + (R0.l * R2.l)
-
- We can discard the first three lines marked "X" since we produce
- only a 64 bit result. So, we need ten 16-bit multiplies.
-
- Individual mul-acc results:
-[E1] = R1.h * R2.l + R3.h * R0.l + R1.l * R2.h + R3.l * R0.h
-[E2] = R1.l * R2.l + R3.l * R0.l + R0.h * R2.h
-[E3] = R0.l * R2.h + R2.l * R0.h
-[E4] = R0.l * R2.l
-
- We also need to add high parts from lower-level results to higher ones:
- E[n]c = E[n] + (E[n+1]c >> 16), where E4c := E4
-
- One interesting property is that all parts of the result that depend
- on the sign of the multiplication are discarded. Those would be the
- multiplications involving R1.h and R3.h, but only the top 16 bit of
- the 32 bit result depend on the sign, and since R1.h and R3.h only
- occur in E1, the top half of these results is cut off.
- So, we can just use FU mode for all of the 16-bit multiplies, and
- ignore questions of when to use mixed mode. */
-
-___muldi3:
- /* [SP] technically is part of the caller's frame, but we can
- use it as scratch space. */
- A0 = R2.H * R1.L, A1 = R2.L * R1.H (FU) || R3 = [SP + 12]; /* E1 */
- A0 += R3.H * R0.L, A1 += R3.L * R0.H (FU) || [SP] = R4; /* E1 */
- A0 += A1; /* E1 */
- R4 = A0.w;
- A0 = R0.l * R3.l (FU); /* E2 */
- A0 += R2.l * R1.l (FU); /* E2 */
-
- A1 = R2.L * R0.L (FU); /* E4 */
- R3 = A1.w;
- A1 = A1 >> 16; /* E3c */
- A0 += R2.H * R0.H, A1 += R2.L * R0.H (FU); /* E2, E3c */
- A1 += R0.L * R2.H (FU); /* E3c */
- R0 = A1.w;
- A1 = A1 >> 16; /* E2c */
- A0 += A1; /* E2c */
- R1 = A0.w;
-
- /* low(result) = low(E3c):low(E4) */
- R0 = PACK (R0.l, R3.l);
- /* high(result) = E2c + (E1 << 16) */
- R1.h = R1.h + R4.l (NS) || R4 = [SP];
- RTS;
-
-.size ___muldi3, .-___muldi3
-#endif
diff --git a/gcc/config/bfin/libgcc-bfin.ver b/gcc/config/bfin/libgcc-bfin.ver
deleted file mode 100644
index 516d91f6584..00000000000
--- a/gcc/config/bfin/libgcc-bfin.ver
+++ /dev/null
@@ -1,1914 +0,0 @@
-# Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
-# 2008, 2009, 2010 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_3.0 {
- # libgcc1 integer symbols
- ___absvsi2
- ___addvsi3
- ___ashlsi3
- ___ashrsi3
- ___divsi3
- ___lshrsi3
- ___modsi3
- ___mulsi3
- ___mulvsi3
- ___negvsi2
- ___subvsi3
- ___udivsi3
- ___umodsi3
-
- # libgcc1 floating point symbols
- ___addsf3
- ___adddf3
- ___addxf3
- ___addtf3
- ___divsf3
- ___divdf3
- ___divxf3
- ___divtf3
- ___eqsf2
- ___eqdf2
- ___eqxf2
- ___eqtf2
- ___extenddfxf2
- ___extenddftf2
- ___extendsfdf2
- ___extendsfxf2
- ___extendsftf2
- ___fixsfsi
- ___fixdfsi
- ___fixxfsi
- ___fixtfsi
- ___floatsisf
- ___floatsidf
- ___floatsixf
- ___floatsitf
- ___gesf2
- ___gedf2
- ___gexf2
- ___getf2
- ___gtsf2
- ___gtdf2
- ___gtxf2
- ___gttf2
- ___lesf2
- ___ledf2
- ___lexf2
- ___letf2
- ___ltsf2
- ___ltdf2
- ___ltxf2
- ___lttf2
- ___mulsf3
- ___muldf3
- ___mulxf3
- ___multf3
- ___negsf2
- ___negdf2
- ___negxf2
- ___negtf2
- ___nesf2
- ___nedf2
- ___nexf2
- ___netf2
- ___subsf3
- ___subdf3
- ___subxf3
- ___subtf3
- ___truncdfsf2
- ___truncxfsf2
- ___trunctfsf2
- ___truncxfdf2
- ___trunctfdf2
-
- # libgcc2 DImode arithmetic (for 32-bit targets).
- ___absvdi2
- ___addvdi3
- ___ashldi3
- ___ashrdi3
- ___cmpdi2
- ___divdi3
- ___ffsdi2
- ___fixdfdi
- ___fixsfdi
- ___fixtfdi
- ___fixxfdi
- ___fixunsdfdi
- ___fixunsdfsi
- ___fixunssfsi
- ___fixunssfdi
- ___fixunstfdi
- ___fixunstfsi
- ___fixunsxfdi
- ___fixunsxfsi
- ___floatdidf
- ___floatdisf
- ___floatdixf
- ___floatditf
- ___lshrdi3
- ___moddi3
- ___muldi3
- ___mulvdi3
- ___negdi2
- ___negvdi2
- ___subvdi3
- ___ucmpdi2
- ___udivdi3
- ___udivmoddi4
- ___umoddi3
-
- # libgcc2 TImode arithmetic (for 64-bit targets).
- ___ashlti3
- ___ashrti3
- ___cmpti2
- ___divti3
- ___ffsti2
- ___fixdfti
- ___fixsfti
- ___fixtfti
- ___fixxfti
- ___lshrti3
- ___modti3
- ___multi3
- ___negti2
- ___ucmpti2
- ___udivmodti4
- ___udivti3
- ___umodti3
- ___fixunsdfti
- ___fixunssfti
- ___fixunstfti
- ___fixunsxfti
- ___floattidf
- ___floattisf
- ___floattixf
- ___floattitf
-
- # Used to deal with trampoline initialization on some platforms
- ___clear_cache
-
- # EH symbols
- __Unwind_DeleteException
- __Unwind_Find_FDE
- __Unwind_ForcedUnwind
- __Unwind_GetGR
- __Unwind_GetIP
- __Unwind_GetLanguageSpecificData
- __Unwind_GetRegionStart
- __Unwind_GetTextRelBase
- __Unwind_GetDataRelBase
- __Unwind_RaiseException
- __Unwind_Resume
- __Unwind_SetGR
- __Unwind_SetIP
- ___deregister_frame
- ___deregister_frame_info
- ___deregister_frame_info_bases
- ___register_frame
- ___register_frame_info
- ___register_frame_info_bases
- ___register_frame_info_table
- ___register_frame_info_table_bases
- ___register_frame_table
-
- # SjLj EH symbols
- __Unwind_SjLj_Register
- __Unwind_SjLj_Unregister
- __Unwind_SjLj_RaiseException
- __Unwind_SjLj_ForcedUnwind
- __Unwind_SjLj_Resume
-}
-
-%inherit GCC_3.3 GCC_3.0
-GCC_3.3 {
- __Unwind_FindEnclosingFunction
- __Unwind_GetCFA
- __Unwind_Backtrace
- __Unwind_Resume_or_Rethrow
- __Unwind_SjLj_Resume_or_Rethrow
-}
-
-%inherit GCC_3.3.1 GCC_3.3
-GCC_3.3.1 {
- ___gcc_personality_sj0
- ___gcc_personality_v0
-}
-
-%inherit GCC_3.3.2 GCC_3.3.1
-GCC_3.3.2 {
-}
-%inherit GCC_3.3.4 GCC_3.3.2
-GCC_3.3.4 {
- ___unorddf2
- ___unordsf2
-}
-
-%inherit GCC_3.4 GCC_3.3.4
-GCC_3.4 {
- # bit scanning and counting built-ins
- ___clzsi2
- ___clzdi2
- ___clzti2
- ___ctzsi2
- ___ctzdi2
- ___ctzti2
- ___popcountsi2
- ___popcountdi2
- ___popcountti2
- ___paritysi2
- ___paritydi2
- ___parityti2
-}
-
-%inherit GCC_3.4.2 GCC_3.4
-GCC_3.4.2 {
- # Used to deal with trampoline initialization on some platforms
- ___enable_execute_stack
- ___trampoline_setup
-}
-
-%inherit GCC_3.4.4 GCC_3.4.2
-GCC_3.4.4 {
- # libgcc2 TImode arithmetic (for 64-bit targets).
- ___absvti2
- ___addvti3
- ___mulvti3
- ___negvti2
- ___subvti3
-}
-
-%inherit GCC_4.0.0 GCC_3.4.4
-GCC_4.0.0 {
- # libgcc2 __builtin_powi helpers.
- ___powisf2
- ___powidf2
- ___powixf2
- ___powitf2
-
- # c99 compliant complex arithmetic
- ___divsc3
- ___divdc3
- ___divxc3
- ___divtc3
- ___mulsc3
- ___muldc3
- ___mulxc3
- ___multc3
-}
-
-%inherit GCC_4.1.0 GCC_4.0.0
-GCC_4.1.0 {
- ___smulsi3_highpart
- ___umulsi3_highpart
-}
-
-%inherit GCC_4.2.0 GCC_4.1.0
-GCC_4.2.0 {
- # unsigned-to-floating conversions
- ___floatunsisf
- ___floatunsidf
- ___floatunsixf
- ___floatunsitf
- ___floatundidf
- ___floatundisf
- ___floatundixf
- ___floatunditf
- ___floatuntidf
- ___floatuntisf
- ___floatuntixf
- ___floatuntitf
- __Unwind_GetIPInfo
-}
-
-%inherit GCC_4.3.0 GCC_4.2.0
-GCC_4.3.0 {
- # byte swapping routines
- ___bswapsi2
- ___bswapdi2
- ___emutls_get_address
- ___emutls_register_common
- ___ffssi2
- ___extendxftf2
- ___trunctfxf2
-
- # fixed-point routines
- ___addqq3
- ___addhq3
- ___addsq3
- ___adddq3
- ___addtq3
- ___adduqq3
- ___adduhq3
- ___addusq3
- ___addudq3
- ___addutq3
- ___addha3
- ___addsa3
- ___addda3
- ___addta3
- ___adduha3
- ___addusa3
- ___adduda3
- ___adduta3
- ___ssaddqq3
- ___ssaddhq3
- ___ssaddsq3
- ___ssadddq3
- ___ssaddtq3
- ___ssaddha3
- ___ssaddsa3
- ___ssaddda3
- ___ssaddta3
- ___usadduqq3
- ___usadduhq3
- ___usaddusq3
- ___usaddudq3
- ___usaddutq3
- ___usadduha3
- ___usaddusa3
- ___usadduda3
- ___usadduta3
- ___subqq3
- ___subhq3
- ___subsq3
- ___subdq3
- ___subtq3
- ___subuqq3
- ___subuhq3
- ___subusq3
- ___subudq3
- ___subutq3
- ___subha3
- ___subsa3
- ___subda3
- ___subta3
- ___subuha3
- ___subusa3
- ___subuda3
- ___subuta3
- ___sssubqq3
- ___sssubhq3
- ___sssubsq3
- ___sssubdq3
- ___sssubtq3
- ___sssubha3
- ___sssubsa3
- ___sssubda3
- ___sssubta3
- ___ussubuqq3
- ___ussubuhq3
- ___ussubusq3
- ___ussubudq3
- ___ussubutq3
- ___ussubuha3
- ___ussubusa3
- ___ussubuda3
- ___ussubuta3
- ___mulqq3
- ___mulhq3
- ___mulsq3
- ___muldq3
- ___multq3
- ___muluqq3
- ___muluhq3
- ___mulusq3
- ___muludq3
- ___mulutq3
- ___mulha3
- ___mulsa3
- ___mulda3
- ___multa3
- ___muluha3
- ___mulusa3
- ___muluda3
- ___muluta3
- ___ssmulqq3
- ___ssmulhq3
- ___ssmulsq3
- ___ssmuldq3
- ___ssmultq3
- ___ssmulha3
- ___ssmulsa3
- ___ssmulda3
- ___ssmulta3
- ___usmuluqq3
- ___usmuluhq3
- ___usmulusq3
- ___usmuludq3
- ___usmulutq3
- ___usmuluha3
- ___usmulusa3
- ___usmuluda3
- ___usmuluta3
- ___divqq3
- ___divhq3
- ___divsq3
- ___divdq3
- ___divtq3
- ___divha3
- ___divsa3
- ___divda3
- ___divta3
- ___udivuqq3
- ___udivuhq3
- ___udivusq3
- ___udivudq3
- ___udivutq3
- ___udivuha3
- ___udivusa3
- ___udivuda3
- ___udivuta3
- ___ssdivqq3
- ___ssdivhq3
- ___ssdivsq3
- ___ssdivdq3
- ___ssdivtq3
- ___ssdivha3
- ___ssdivsa3
- ___ssdivda3
- ___ssdivta3
- ___usdivuqq3
- ___usdivuhq3
- ___usdivusq3
- ___usdivudq3
- ___usdivutq3
- ___usdivuha3
- ___usdivusa3
- ___usdivuda3
- ___usdivuta3
- ___negqq2
- ___neghq2
- ___negsq2
- ___negdq2
- ___negtq2
- ___neguqq2
- ___neguhq2
- ___negusq2
- ___negudq2
- ___negutq2
- ___negha2
- ___negsa2
- ___negda2
- ___negta2
- ___neguha2
- ___negusa2
- ___neguda2
- ___neguta2
- ___ssnegqq2
- ___ssneghq2
- ___ssnegsq2
- ___ssnegdq2
- ___ssnegtq2
- ___ssnegha2
- ___ssnegsa2
- ___ssnegda2
- ___ssnegta2
- ___usneguqq2
- ___usneguhq2
- ___usnegusq2
- ___usnegudq2
- ___usnegutq2
- ___usneguha2
- ___usnegusa2
- ___usneguda2
- ___usneguta2
- ___ashlqq3
- ___ashlhq3
- ___ashlsq3
- ___ashldq3
- ___ashltq3
- ___ashluqq3
- ___ashluhq3
- ___ashlusq3
- ___ashludq3
- ___ashlutq3
- ___ashlha3
- ___ashlsa3
- ___ashlda3
- ___ashlta3
- ___ashluha3
- ___ashlusa3
- ___ashluda3
- ___ashluta3
- ___ashrqq3
- ___ashrhq3
- ___ashrsq3
- ___ashrdq3
- ___ashrtq3
- ___ashrha3
- ___ashrsa3
- ___ashrda3
- ___ashrta3
- ___lshruqq3
- ___lshruhq3
- ___lshrusq3
- ___lshrudq3
- ___lshrutq3
- ___lshruha3
- ___lshrusa3
- ___lshruda3
- ___lshruta3
- ___ssashlqq3
- ___ssashlhq3
- ___ssashlsq3
- ___ssashldq3
- ___ssashltq3
- ___ssashlha3
- ___ssashlsa3
- ___ssashlda3
- ___ssashlta3
- ___usashluqq3
- ___usashluhq3
- ___usashlusq3
- ___usashludq3
- ___usashlutq3
- ___usashluha3
- ___usashlusa3
- ___usashluda3
- ___usashluta3
- ___cmpqq2
- ___cmphq2
- ___cmpsq2
- ___cmpdq2
- ___cmptq2
- ___cmpuqq2
- ___cmpuhq2
- ___cmpusq2
- ___cmpudq2
- ___cmputq2
- ___cmpha2
- ___cmpsa2
- ___cmpda2
- ___cmpta2
- ___cmpuha2
- ___cmpusa2
- ___cmpuda2
- ___cmputa2
- ___fractqqhq2
- ___fractqqsq2
- ___fractqqdq2
- ___fractqqtq2
- ___fractqqha
- ___fractqqsa
- ___fractqqda
- ___fractqqta
- ___fractqquqq
- ___fractqquhq
- ___fractqqusq
- ___fractqqudq
- ___fractqqutq
- ___fractqquha
- ___fractqqusa
- ___fractqquda
- ___fractqquta
- ___fractqqqi
- ___fractqqhi
- ___fractqqsi
- ___fractqqdi
- ___fractqqti
- ___fractqqsf
- ___fractqqdf
- ___fracthqqq2
- ___fracthqsq2
- ___fracthqdq2
- ___fracthqtq2
- ___fracthqha
- ___fracthqsa
- ___fracthqda
- ___fracthqta
- ___fracthquqq
- ___fracthquhq
- ___fracthqusq
- ___fracthqudq
- ___fracthqutq
- ___fracthquha
- ___fracthqusa
- ___fracthquda
- ___fracthquta
- ___fracthqqi
- ___fracthqhi
- ___fracthqsi
- ___fracthqdi
- ___fracthqti
- ___fracthqsf
- ___fracthqdf
- ___fractsqqq2
- ___fractsqhq2
- ___fractsqdq2
- ___fractsqtq2
- ___fractsqha
- ___fractsqsa
- ___fractsqda
- ___fractsqta
- ___fractsquqq
- ___fractsquhq
- ___fractsqusq
- ___fractsqudq
- ___fractsqutq
- ___fractsquha
- ___fractsqusa
- ___fractsquda
- ___fractsquta
- ___fractsqqi
- ___fractsqhi
- ___fractsqsi
- ___fractsqdi
- ___fractsqti
- ___fractsqsf
- ___fractsqdf
- ___fractdqqq2
- ___fractdqhq2
- ___fractdqsq2
- ___fractdqtq2
- ___fractdqha
- ___fractdqsa
- ___fractdqda
- ___fractdqta
- ___fractdquqq
- ___fractdquhq
- ___fractdqusq
- ___fractdqudq
- ___fractdqutq
- ___fractdquha
- ___fractdqusa
- ___fractdquda
- ___fractdquta
- ___fractdqqi
- ___fractdqhi
- ___fractdqsi
- ___fractdqdi
- ___fractdqti
- ___fractdqsf
- ___fractdqdf
- ___fracttqqq2
- ___fracttqhq2
- ___fracttqsq2
- ___fracttqdq2
- ___fracttqha
- ___fracttqsa
- ___fracttqda
- ___fracttqta
- ___fracttquqq
- ___fracttquhq
- ___fracttqusq
- ___fracttqudq
- ___fracttqutq
- ___fracttquha
- ___fracttqusa
- ___fracttquda
- ___fracttquta
- ___fracttqqi
- ___fracttqhi
- ___fracttqsi
- ___fracttqdi
- ___fracttqti
- ___fracttqsf
- ___fracttqdf
- ___fracthaqq
- ___fracthahq
- ___fracthasq
- ___fracthadq
- ___fracthatq
- ___fracthasa2
- ___fracthada2
- ___fracthata2
- ___fracthauqq
- ___fracthauhq
- ___fracthausq
- ___fracthaudq
- ___fracthautq
- ___fracthauha
- ___fracthausa
- ___fracthauda
- ___fracthauta
- ___fracthaqi
- ___fracthahi
- ___fracthasi
- ___fracthadi
- ___fracthati
- ___fracthasf
- ___fracthadf
- ___fractsaqq
- ___fractsahq
- ___fractsasq
- ___fractsadq
- ___fractsatq
- ___fractsaha2
- ___fractsada2
- ___fractsata2
- ___fractsauqq
- ___fractsauhq
- ___fractsausq
- ___fractsaudq
- ___fractsautq
- ___fractsauha
- ___fractsausa
- ___fractsauda
- ___fractsauta
- ___fractsaqi
- ___fractsahi
- ___fractsasi
- ___fractsadi
- ___fractsati
- ___fractsasf
- ___fractsadf
- ___fractdaqq
- ___fractdahq
- ___fractdasq
- ___fractdadq
- ___fractdatq
- ___fractdaha2
- ___fractdasa2
- ___fractdata2
- ___fractdauqq
- ___fractdauhq
- ___fractdausq
- ___fractdaudq
- ___fractdautq
- ___fractdauha
- ___fractdausa
- ___fractdauda
- ___fractdauta
- ___fractdaqi
- ___fractdahi
- ___fractdasi
- ___fractdadi
- ___fractdati
- ___fractdasf
- ___fractdadf
- ___fracttaqq
- ___fracttahq
- ___fracttasq
- ___fracttadq
- ___fracttatq
- ___fracttaha2
- ___fracttasa2
- ___fracttada2
- ___fracttauqq
- ___fracttauhq
- ___fracttausq
- ___fracttaudq
- ___fracttautq
- ___fracttauha
- ___fracttausa
- ___fracttauda
- ___fracttauta
- ___fracttaqi
- ___fracttahi
- ___fracttasi
- ___fracttadi
- ___fracttati
- ___fracttasf
- ___fracttadf
- ___fractuqqqq
- ___fractuqqhq
- ___fractuqqsq
- ___fractuqqdq
- ___fractuqqtq
- ___fractuqqha
- ___fractuqqsa
- ___fractuqqda
- ___fractuqqta
- ___fractuqquhq2
- ___fractuqqusq2
- ___fractuqqudq2
- ___fractuqqutq2
- ___fractuqquha
- ___fractuqqusa
- ___fractuqquda
- ___fractuqquta
- ___fractuqqqi
- ___fractuqqhi
- ___fractuqqsi
- ___fractuqqdi
- ___fractuqqti
- ___fractuqqsf
- ___fractuqqdf
- ___fractuhqqq
- ___fractuhqhq
- ___fractuhqsq
- ___fractuhqdq
- ___fractuhqtq
- ___fractuhqha
- ___fractuhqsa
- ___fractuhqda
- ___fractuhqta
- ___fractuhquqq2
- ___fractuhqusq2
- ___fractuhqudq2
- ___fractuhqutq2
- ___fractuhquha
- ___fractuhqusa
- ___fractuhquda
- ___fractuhquta
- ___fractuhqqi
- ___fractuhqhi
- ___fractuhqsi
- ___fractuhqdi
- ___fractuhqti
- ___fractuhqsf
- ___fractuhqdf
- ___fractusqqq
- ___fractusqhq
- ___fractusqsq
- ___fractusqdq
- ___fractusqtq
- ___fractusqha
- ___fractusqsa
- ___fractusqda
- ___fractusqta
- ___fractusquqq2
- ___fractusquhq2
- ___fractusqudq2
- ___fractusqutq2
- ___fractusquha
- ___fractusqusa
- ___fractusquda
- ___fractusquta
- ___fractusqqi
- ___fractusqhi
- ___fractusqsi
- ___fractusqdi
- ___fractusqti
- ___fractusqsf
- ___fractusqdf
- ___fractudqqq
- ___fractudqhq
- ___fractudqsq
- ___fractudqdq
- ___fractudqtq
- ___fractudqha
- ___fractudqsa
- ___fractudqda
- ___fractudqta
- ___fractudquqq2
- ___fractudquhq2
- ___fractudqusq2
- ___fractudqutq2
- ___fractudquha
- ___fractudqusa
- ___fractudquda
- ___fractudquta
- ___fractudqqi
- ___fractudqhi
- ___fractudqsi
- ___fractudqdi
- ___fractudqti
- ___fractudqsf
- ___fractudqdf
- ___fractutqqq
- ___fractutqhq
- ___fractutqsq
- ___fractutqdq
- ___fractutqtq
- ___fractutqha
- ___fractutqsa
- ___fractutqda
- ___fractutqta
- ___fractutquqq2
- ___fractutquhq2
- ___fractutqusq2
- ___fractutqudq2
- ___fractutquha
- ___fractutqusa
- ___fractutquda
- ___fractutquta
- ___fractutqqi
- ___fractutqhi
- ___fractutqsi
- ___fractutqdi
- ___fractutqti
- ___fractutqsf
- ___fractutqdf
- ___fractuhaqq
- ___fractuhahq
- ___fractuhasq
- ___fractuhadq
- ___fractuhatq
- ___fractuhaha
- ___fractuhasa
- ___fractuhada
- ___fractuhata
- ___fractuhauqq
- ___fractuhauhq
- ___fractuhausq
- ___fractuhaudq
- ___fractuhautq
- ___fractuhausa2
- ___fractuhauda2
- ___fractuhauta2
- ___fractuhaqi
- ___fractuhahi
- ___fractuhasi
- ___fractuhadi
- ___fractuhati
- ___fractuhasf
- ___fractuhadf
- ___fractusaqq
- ___fractusahq
- ___fractusasq
- ___fractusadq
- ___fractusatq
- ___fractusaha
- ___fractusasa
- ___fractusada
- ___fractusata
- ___fractusauqq
- ___fractusauhq
- ___fractusausq
- ___fractusaudq
- ___fractusautq
- ___fractusauha2
- ___fractusauda2
- ___fractusauta2
- ___fractusaqi
- ___fractusahi
- ___fractusasi
- ___fractusadi
- ___fractusati
- ___fractusasf
- ___fractusadf
- ___fractudaqq
- ___fractudahq
- ___fractudasq
- ___fractudadq
- ___fractudatq
- ___fractudaha
- ___fractudasa
- ___fractudada
- ___fractudata
- ___fractudauqq
- ___fractudauhq
- ___fractudausq
- ___fractudaudq
- ___fractudautq
- ___fractudauha2
- ___fractudausa2
- ___fractudauta2
- ___fractudaqi
- ___fractudahi
- ___fractudasi
- ___fractudadi
- ___fractudati
- ___fractudasf
- ___fractudadf
- ___fractutaqq
- ___fractutahq
- ___fractutasq
- ___fractutadq
- ___fractutatq
- ___fractutaha
- ___fractutasa
- ___fractutada
- ___fractutata
- ___fractutauqq
- ___fractutauhq
- ___fractutausq
- ___fractutaudq
- ___fractutautq
- ___fractutauha2
- ___fractutausa2
- ___fractutauda2
- ___fractutaqi
- ___fractutahi
- ___fractutasi
- ___fractutadi
- ___fractutati
- ___fractutasf
- ___fractutadf
- ___fractqiqq
- ___fractqihq
- ___fractqisq
- ___fractqidq
- ___fractqitq
- ___fractqiha
- ___fractqisa
- ___fractqida
- ___fractqita
- ___fractqiuqq
- ___fractqiuhq
- ___fractqiusq
- ___fractqiudq
- ___fractqiutq
- ___fractqiuha
- ___fractqiusa
- ___fractqiuda
- ___fractqiuta
- ___fracthiqq
- ___fracthihq
- ___fracthisq
- ___fracthidq
- ___fracthitq
- ___fracthiha
- ___fracthisa
- ___fracthida
- ___fracthita
- ___fracthiuqq
- ___fracthiuhq
- ___fracthiusq
- ___fracthiudq
- ___fracthiutq
- ___fracthiuha
- ___fracthiusa
- ___fracthiuda
- ___fracthiuta
- ___fractsiqq
- ___fractsihq
- ___fractsisq
- ___fractsidq
- ___fractsitq
- ___fractsiha
- ___fractsisa
- ___fractsida
- ___fractsita
- ___fractsiuqq
- ___fractsiuhq
- ___fractsiusq
- ___fractsiudq
- ___fractsiutq
- ___fractsiuha
- ___fractsiusa
- ___fractsiuda
- ___fractsiuta
- ___fractdiqq
- ___fractdihq
- ___fractdisq
- ___fractdidq
- ___fractditq
- ___fractdiha
- ___fractdisa
- ___fractdida
- ___fractdita
- ___fractdiuqq
- ___fractdiuhq
- ___fractdiusq
- ___fractdiudq
- ___fractdiutq
- ___fractdiuha
- ___fractdiusa
- ___fractdiuda
- ___fractdiuta
- ___fracttiqq
- ___fracttihq
- ___fracttisq
- ___fracttidq
- ___fracttitq
- ___fracttiha
- ___fracttisa
- ___fracttida
- ___fracttita
- ___fracttiuqq
- ___fracttiuhq
- ___fracttiusq
- ___fracttiudq
- ___fracttiutq
- ___fracttiuha
- ___fracttiusa
- ___fracttiuda
- ___fracttiuta
- ___fractsfqq
- ___fractsfhq
- ___fractsfsq
- ___fractsfdq
- ___fractsftq
- ___fractsfha
- ___fractsfsa
- ___fractsfda
- ___fractsfta
- ___fractsfuqq
- ___fractsfuhq
- ___fractsfusq
- ___fractsfudq
- ___fractsfutq
- ___fractsfuha
- ___fractsfusa
- ___fractsfuda
- ___fractsfuta
- ___fractdfqq
- ___fractdfhq
- ___fractdfsq
- ___fractdfdq
- ___fractdftq
- ___fractdfha
- ___fractdfsa
- ___fractdfda
- ___fractdfta
- ___fractdfuqq
- ___fractdfuhq
- ___fractdfusq
- ___fractdfudq
- ___fractdfutq
- ___fractdfuha
- ___fractdfusa
- ___fractdfuda
- ___fractdfuta
- ___satfractqqhq2
- ___satfractqqsq2
- ___satfractqqdq2
- ___satfractqqtq2
- ___satfractqqha
- ___satfractqqsa
- ___satfractqqda
- ___satfractqqta
- ___satfractqquqq
- ___satfractqquhq
- ___satfractqqusq
- ___satfractqqudq
- ___satfractqqutq
- ___satfractqquha
- ___satfractqqusa
- ___satfractqquda
- ___satfractqquta
- ___satfracthqqq2
- ___satfracthqsq2
- ___satfracthqdq2
- ___satfracthqtq2
- ___satfracthqha
- ___satfracthqsa
- ___satfracthqda
- ___satfracthqta
- ___satfracthquqq
- ___satfracthquhq
- ___satfracthqusq
- ___satfracthqudq
- ___satfracthqutq
- ___satfracthquha
- ___satfracthqusa
- ___satfracthquda
- ___satfracthquta
- ___satfractsqqq2
- ___satfractsqhq2
- ___satfractsqdq2
- ___satfractsqtq2
- ___satfractsqha
- ___satfractsqsa
- ___satfractsqda
- ___satfractsqta
- ___satfractsquqq
- ___satfractsquhq
- ___satfractsqusq
- ___satfractsqudq
- ___satfractsqutq
- ___satfractsquha
- ___satfractsqusa
- ___satfractsquda
- ___satfractsquta
- ___satfractdqqq2
- ___satfractdqhq2
- ___satfractdqsq2
- ___satfractdqtq2
- ___satfractdqha
- ___satfractdqsa
- ___satfractdqda
- ___satfractdqta
- ___satfractdquqq
- ___satfractdquhq
- ___satfractdqusq
- ___satfractdqudq
- ___satfractdqutq
- ___satfractdquha
- ___satfractdqusa
- ___satfractdquda
- ___satfractdquta
- ___satfracttqqq2
- ___satfracttqhq2
- ___satfracttqsq2
- ___satfracttqdq2
- ___satfracttqha
- ___satfracttqsa
- ___satfracttqda
- ___satfracttqta
- ___satfracttquqq
- ___satfracttquhq
- ___satfracttqusq
- ___satfracttqudq
- ___satfracttqutq
- ___satfracttquha
- ___satfracttqusa
- ___satfracttquda
- ___satfracttquta
- ___satfracthaqq
- ___satfracthahq
- ___satfracthasq
- ___satfracthadq
- ___satfracthatq
- ___satfracthasa2
- ___satfracthada2
- ___satfracthata2
- ___satfracthauqq
- ___satfracthauhq
- ___satfracthausq
- ___satfracthaudq
- ___satfracthautq
- ___satfracthauha
- ___satfracthausa
- ___satfracthauda
- ___satfracthauta
- ___satfractsaqq
- ___satfractsahq
- ___satfractsasq
- ___satfractsadq
- ___satfractsatq
- ___satfractsaha2
- ___satfractsada2
- ___satfractsata2
- ___satfractsauqq
- ___satfractsauhq
- ___satfractsausq
- ___satfractsaudq
- ___satfractsautq
- ___satfractsauha
- ___satfractsausa
- ___satfractsauda
- ___satfractsauta
- ___satfractdaqq
- ___satfractdahq
- ___satfractdasq
- ___satfractdadq
- ___satfractdatq
- ___satfractdaha2
- ___satfractdasa2
- ___satfractdata2
- ___satfractdauqq
- ___satfractdauhq
- ___satfractdausq
- ___satfractdaudq
- ___satfractdautq
- ___satfractdauha
- ___satfractdausa
- ___satfractdauda
- ___satfractdauta
- ___satfracttaqq
- ___satfracttahq
- ___satfracttasq
- ___satfracttadq
- ___satfracttatq
- ___satfracttaha2
- ___satfracttasa2
- ___satfracttada2
- ___satfracttauqq
- ___satfracttauhq
- ___satfracttausq
- ___satfracttaudq
- ___satfracttautq
- ___satfracttauha
- ___satfracttausa
- ___satfracttauda
- ___satfracttauta
- ___satfractuqqqq
- ___satfractuqqhq
- ___satfractuqqsq
- ___satfractuqqdq
- ___satfractuqqtq
- ___satfractuqqha
- ___satfractuqqsa
- ___satfractuqqda
- ___satfractuqqta
- ___satfractuqquhq2
- ___satfractuqqusq2
- ___satfractuqqudq2
- ___satfractuqqutq2
- ___satfractuqquha
- ___satfractuqqusa
- ___satfractuqquda
- ___satfractuqquta
- ___satfractuhqqq
- ___satfractuhqhq
- ___satfractuhqsq
- ___satfractuhqdq
- ___satfractuhqtq
- ___satfractuhqha
- ___satfractuhqsa
- ___satfractuhqda
- ___satfractuhqta
- ___satfractuhquqq2
- ___satfractuhqusq2
- ___satfractuhqudq2
- ___satfractuhqutq2
- ___satfractuhquha
- ___satfractuhqusa
- ___satfractuhquda
- ___satfractuhquta
- ___satfractusqqq
- ___satfractusqhq
- ___satfractusqsq
- ___satfractusqdq
- ___satfractusqtq
- ___satfractusqha
- ___satfractusqsa
- ___satfractusqda
- ___satfractusqta
- ___satfractusquqq2
- ___satfractusquhq2
- ___satfractusqudq2
- ___satfractusqutq2
- ___satfractusquha
- ___satfractusqusa
- ___satfractusquda
- ___satfractusquta
- ___satfractudqqq
- ___satfractudqhq
- ___satfractudqsq
- ___satfractudqdq
- ___satfractudqtq
- ___satfractudqha
- ___satfractudqsa
- ___satfractudqda
- ___satfractudqta
- ___satfractudquqq2
- ___satfractudquhq2
- ___satfractudqusq2
- ___satfractudqutq2
- ___satfractudquha
- ___satfractudqusa
- ___satfractudquda
- ___satfractudquta
- ___satfractutqqq
- ___satfractutqhq
- ___satfractutqsq
- ___satfractutqdq
- ___satfractutqtq
- ___satfractutqha
- ___satfractutqsa
- ___satfractutqda
- ___satfractutqta
- ___satfractutquqq2
- ___satfractutquhq2
- ___satfractutqusq2
- ___satfractutqudq2
- ___satfractutquha
- ___satfractutqusa
- ___satfractutquda
- ___satfractutquta
- ___satfractuhaqq
- ___satfractuhahq
- ___satfractuhasq
- ___satfractuhadq
- ___satfractuhatq
- ___satfractuhaha
- ___satfractuhasa
- ___satfractuhada
- ___satfractuhata
- ___satfractuhauqq
- ___satfractuhauhq
- ___satfractuhausq
- ___satfractuhaudq
- ___satfractuhautq
- ___satfractuhausa2
- ___satfractuhauda2
- ___satfractuhauta2
- ___satfractusaqq
- ___satfractusahq
- ___satfractusasq
- ___satfractusadq
- ___satfractusatq
- ___satfractusaha
- ___satfractusasa
- ___satfractusada
- ___satfractusata
- ___satfractusauqq
- ___satfractusauhq
- ___satfractusausq
- ___satfractusaudq
- ___satfractusautq
- ___satfractusauha2
- ___satfractusauda2
- ___satfractusauta2
- ___satfractudaqq
- ___satfractudahq
- ___satfractudasq
- ___satfractudadq
- ___satfractudatq
- ___satfractudaha
- ___satfractudasa
- ___satfractudada
- ___satfractudata
- ___satfractudauqq
- ___satfractudauhq
- ___satfractudausq
- ___satfractudaudq
- ___satfractudautq
- ___satfractudauha2
- ___satfractudausa2
- ___satfractudauta2
- ___satfractutaqq
- ___satfractutahq
- ___satfractutasq
- ___satfractutadq
- ___satfractutatq
- ___satfractutaha
- ___satfractutasa
- ___satfractutada
- ___satfractutata
- ___satfractutauqq
- ___satfractutauhq
- ___satfractutausq
- ___satfractutaudq
- ___satfractutautq
- ___satfractutauha2
- ___satfractutausa2
- ___satfractutauda2
- ___satfractqiqq
- ___satfractqihq
- ___satfractqisq
- ___satfractqidq
- ___satfractqitq
- ___satfractqiha
- ___satfractqisa
- ___satfractqida
- ___satfractqita
- ___satfractqiuqq
- ___satfractqiuhq
- ___satfractqiusq
- ___satfractqiudq
- ___satfractqiutq
- ___satfractqiuha
- ___satfractqiusa
- ___satfractqiuda
- ___satfractqiuta
- ___satfracthiqq
- ___satfracthihq
- ___satfracthisq
- ___satfracthidq
- ___satfracthitq
- ___satfracthiha
- ___satfracthisa
- ___satfracthida
- ___satfracthita
- ___satfracthiuqq
- ___satfracthiuhq
- ___satfracthiusq
- ___satfracthiudq
- ___satfracthiutq
- ___satfracthiuha
- ___satfracthiusa
- ___satfracthiuda
- ___satfracthiuta
- ___satfractsiqq
- ___satfractsihq
- ___satfractsisq
- ___satfractsidq
- ___satfractsitq
- ___satfractsiha
- ___satfractsisa
- ___satfractsida
- ___satfractsita
- ___satfractsiuqq
- ___satfractsiuhq
- ___satfractsiusq
- ___satfractsiudq
- ___satfractsiutq
- ___satfractsiuha
- ___satfractsiusa
- ___satfractsiuda
- ___satfractsiuta
- ___satfractdiqq
- ___satfractdihq
- ___satfractdisq
- ___satfractdidq
- ___satfractditq
- ___satfractdiha
- ___satfractdisa
- ___satfractdida
- ___satfractdita
- ___satfractdiuqq
- ___satfractdiuhq
- ___satfractdiusq
- ___satfractdiudq
- ___satfractdiutq
- ___satfractdiuha
- ___satfractdiusa
- ___satfractdiuda
- ___satfractdiuta
- ___satfracttiqq
- ___satfracttihq
- ___satfracttisq
- ___satfracttidq
- ___satfracttitq
- ___satfracttiha
- ___satfracttisa
- ___satfracttida
- ___satfracttita
- ___satfracttiuqq
- ___satfracttiuhq
- ___satfracttiusq
- ___satfracttiudq
- ___satfracttiutq
- ___satfracttiuha
- ___satfracttiusa
- ___satfracttiuda
- ___satfracttiuta
- ___satfractsfqq
- ___satfractsfhq
- ___satfractsfsq
- ___satfractsfdq
- ___satfractsftq
- ___satfractsfha
- ___satfractsfsa
- ___satfractsfda
- ___satfractsfta
- ___satfractsfuqq
- ___satfractsfuhq
- ___satfractsfusq
- ___satfractsfudq
- ___satfractsfutq
- ___satfractsfuha
- ___satfractsfusa
- ___satfractsfuda
- ___satfractsfuta
- ___satfractdfqq
- ___satfractdfhq
- ___satfractdfsq
- ___satfractdfdq
- ___satfractdftq
- ___satfractdfha
- ___satfractdfsa
- ___satfractdfda
- ___satfractdfta
- ___satfractdfuqq
- ___satfractdfuhq
- ___satfractdfusq
- ___satfractdfudq
- ___satfractdfutq
- ___satfractdfuha
- ___satfractdfusa
- ___satfractdfuda
- ___satfractdfuta
- ___fractunsqqqi
- ___fractunsqqhi
- ___fractunsqqsi
- ___fractunsqqdi
- ___fractunsqqti
- ___fractunshqqi
- ___fractunshqhi
- ___fractunshqsi
- ___fractunshqdi
- ___fractunshqti
- ___fractunssqqi
- ___fractunssqhi
- ___fractunssqsi
- ___fractunssqdi
- ___fractunssqti
- ___fractunsdqqi
- ___fractunsdqhi
- ___fractunsdqsi
- ___fractunsdqdi
- ___fractunsdqti
- ___fractunstqqi
- ___fractunstqhi
- ___fractunstqsi
- ___fractunstqdi
- ___fractunstqti
- ___fractunshaqi
- ___fractunshahi
- ___fractunshasi
- ___fractunshadi
- ___fractunshati
- ___fractunssaqi
- ___fractunssahi
- ___fractunssasi
- ___fractunssadi
- ___fractunssati
- ___fractunsdaqi
- ___fractunsdahi
- ___fractunsdasi
- ___fractunsdadi
- ___fractunsdati
- ___fractunstaqi
- ___fractunstahi
- ___fractunstasi
- ___fractunstadi
- ___fractunstati
- ___fractunsuqqqi
- ___fractunsuqqhi
- ___fractunsuqqsi
- ___fractunsuqqdi
- ___fractunsuqqti
- ___fractunsuhqqi
- ___fractunsuhqhi
- ___fractunsuhqsi
- ___fractunsuhqdi
- ___fractunsuhqti
- ___fractunsusqqi
- ___fractunsusqhi
- ___fractunsusqsi
- ___fractunsusqdi
- ___fractunsusqti
- ___fractunsudqqi
- ___fractunsudqhi
- ___fractunsudqsi
- ___fractunsudqdi
- ___fractunsudqti
- ___fractunsutqqi
- ___fractunsutqhi
- ___fractunsutqsi
- ___fractunsutqdi
- ___fractunsutqti
- ___fractunsuhaqi
- ___fractunsuhahi
- ___fractunsuhasi
- ___fractunsuhadi
- ___fractunsuhati
- ___fractunsusaqi
- ___fractunsusahi
- ___fractunsusasi
- ___fractunsusadi
- ___fractunsusati
- ___fractunsudaqi
- ___fractunsudahi
- ___fractunsudasi
- ___fractunsudadi
- ___fractunsudati
- ___fractunsutaqi
- ___fractunsutahi
- ___fractunsutasi
- ___fractunsutadi
- ___fractunsutati
- ___fractunsqiqq
- ___fractunsqihq
- ___fractunsqisq
- ___fractunsqidq
- ___fractunsqitq
- ___fractunsqiha
- ___fractunsqisa
- ___fractunsqida
- ___fractunsqita
- ___fractunsqiuqq
- ___fractunsqiuhq
- ___fractunsqiusq
- ___fractunsqiudq
- ___fractunsqiutq
- ___fractunsqiuha
- ___fractunsqiusa
- ___fractunsqiuda
- ___fractunsqiuta
- ___fractunshiqq
- ___fractunshihq
- ___fractunshisq
- ___fractunshidq
- ___fractunshitq
- ___fractunshiha
- ___fractunshisa
- ___fractunshida
- ___fractunshita
- ___fractunshiuqq
- ___fractunshiuhq
- ___fractunshiusq
- ___fractunshiudq
- ___fractunshiutq
- ___fractunshiuha
- ___fractunshiusa
- ___fractunshiuda
- ___fractunshiuta
- ___fractunssiqq
- ___fractunssihq
- ___fractunssisq
- ___fractunssidq
- ___fractunssitq
- ___fractunssiha
- ___fractunssisa
- ___fractunssida
- ___fractunssita
- ___fractunssiuqq
- ___fractunssiuhq
- ___fractunssiusq
- ___fractunssiudq
- ___fractunssiutq
- ___fractunssiuha
- ___fractunssiusa
- ___fractunssiuda
- ___fractunssiuta
- ___fractunsdiqq
- ___fractunsdihq
- ___fractunsdisq
- ___fractunsdidq
- ___fractunsditq
- ___fractunsdiha
- ___fractunsdisa
- ___fractunsdida
- ___fractunsdita
- ___fractunsdiuqq
- ___fractunsdiuhq
- ___fractunsdiusq
- ___fractunsdiudq
- ___fractunsdiutq
- ___fractunsdiuha
- ___fractunsdiusa
- ___fractunsdiuda
- ___fractunsdiuta
- ___fractunstiqq
- ___fractunstihq
- ___fractunstisq
- ___fractunstidq
- ___fractunstitq
- ___fractunstiha
- ___fractunstisa
- ___fractunstida
- ___fractunstita
- ___fractunstiuqq
- ___fractunstiuhq
- ___fractunstiusq
- ___fractunstiudq
- ___fractunstiutq
- ___fractunstiuha
- ___fractunstiusa
- ___fractunstiuda
- ___fractunstiuta
- ___satfractunsqiqq
- ___satfractunsqihq
- ___satfractunsqisq
- ___satfractunsqidq
- ___satfractunsqitq
- ___satfractunsqiha
- ___satfractunsqisa
- ___satfractunsqida
- ___satfractunsqita
- ___satfractunsqiuqq
- ___satfractunsqiuhq
- ___satfractunsqiusq
- ___satfractunsqiudq
- ___satfractunsqiutq
- ___satfractunsqiuha
- ___satfractunsqiusa
- ___satfractunsqiuda
- ___satfractunsqiuta
- ___satfractunshiqq
- ___satfractunshihq
- ___satfractunshisq
- ___satfractunshidq
- ___satfractunshitq
- ___satfractunshiha
- ___satfractunshisa
- ___satfractunshida
- ___satfractunshita
- ___satfractunshiuqq
- ___satfractunshiuhq
- ___satfractunshiusq
- ___satfractunshiudq
- ___satfractunshiutq
- ___satfractunshiuha
- ___satfractunshiusa
- ___satfractunshiuda
- ___satfractunshiuta
- ___satfractunssiqq
- ___satfractunssihq
- ___satfractunssisq
- ___satfractunssidq
- ___satfractunssitq
- ___satfractunssiha
- ___satfractunssisa
- ___satfractunssida
- ___satfractunssita
- ___satfractunssiuqq
- ___satfractunssiuhq
- ___satfractunssiusq
- ___satfractunssiudq
- ___satfractunssiutq
- ___satfractunssiuha
- ___satfractunssiusa
- ___satfractunssiuda
- ___satfractunssiuta
- ___satfractunsdiqq
- ___satfractunsdihq
- ___satfractunsdisq
- ___satfractunsdidq
- ___satfractunsditq
- ___satfractunsdiha
- ___satfractunsdisa
- ___satfractunsdida
- ___satfractunsdita
- ___satfractunsdiuqq
- ___satfractunsdiuhq
- ___satfractunsdiusq
- ___satfractunsdiudq
- ___satfractunsdiutq
- ___satfractunsdiuha
- ___satfractunsdiusa
- ___satfractunsdiuda
- ___satfractunsdiuta
- ___satfractunstiqq
- ___satfractunstihq
- ___satfractunstisq
- ___satfractunstidq
- ___satfractunstitq
- ___satfractunstiha
- ___satfractunstisa
- ___satfractunstida
- ___satfractunstita
- ___satfractunstiuqq
- ___satfractunstiuhq
- ___satfractunstiusq
- ___satfractunstiudq
- ___satfractunstiutq
- ___satfractunstiuha
- ___satfractunstiusa
- ___satfractunstiuda
- ___satfractunstiuta
-}
-
-%inherit GCC_4.4.0 GCC_4.3.0
-GCC_4.4.0 {
- ___sync_fetch_and_add_1
- ___sync_fetch_and_sub_1
- ___sync_fetch_and_or_1
- ___sync_fetch_and_and_1
- ___sync_fetch_and_xor_1
- ___sync_fetch_and_nand_1
- ___sync_add_and_fetch_1
- ___sync_sub_and_fetch_1
- ___sync_or_and_fetch_1
- ___sync_and_and_fetch_1
- ___sync_xor_and_fetch_1
- ___sync_nand_and_fetch_1
- ___sync_bool_compare_and_swap_1
- ___sync_val_compare_and_swap_1
- ___sync_lock_test_and_set_1
-
- ___sync_fetch_and_add_2
- ___sync_fetch_and_sub_2
- ___sync_fetch_and_or_2
- ___sync_fetch_and_and_2
- ___sync_fetch_and_xor_2
- ___sync_fetch_and_nand_2
- ___sync_add_and_fetch_2
- ___sync_sub_and_fetch_2
- ___sync_or_and_fetch_2
- ___sync_and_and_fetch_2
- ___sync_xor_and_fetch_2
- ___sync_nand_and_fetch_2
- ___sync_bool_compare_and_swap_2
- ___sync_val_compare_and_swap_2
- ___sync_lock_test_and_set_2
-
- ___sync_fetch_and_add_4
- ___sync_fetch_and_sub_4
- ___sync_fetch_and_or_4
- ___sync_fetch_and_and_4
- ___sync_fetch_and_xor_4
- ___sync_fetch_and_nand_4
- ___sync_add_and_fetch_4
- ___sync_sub_and_fetch_4
- ___sync_or_and_fetch_4
- ___sync_and_and_fetch_4
- ___sync_xor_and_fetch_4
- ___sync_nand_and_fetch_4
- ___sync_bool_compare_and_swap_4
- ___sync_val_compare_and_swap_4
- ___sync_lock_test_and_set_4
-
- ___sync_fetch_and_add_8
- ___sync_fetch_and_sub_8
- ___sync_fetch_and_or_8
- ___sync_fetch_and_and_8
- ___sync_fetch_and_xor_8
- ___sync_fetch_and_nand_8
- ___sync_add_and_fetch_8
- ___sync_sub_and_fetch_8
- ___sync_or_and_fetch_8
- ___sync_and_and_fetch_8
- ___sync_xor_and_fetch_8
- ___sync_nand_and_fetch_8
- ___sync_bool_compare_and_swap_8
- ___sync_val_compare_and_swap_8
- ___sync_lock_test_and_set_8
-
- ___sync_fetch_and_add_16
- ___sync_fetch_and_sub_16
- ___sync_fetch_and_or_16
- ___sync_fetch_and_and_16
- ___sync_fetch_and_xor_16
- ___sync_fetch_and_nand_16
- ___sync_add_and_fetch_16
- ___sync_sub_and_fetch_16
- ___sync_or_and_fetch_16
- ___sync_and_and_fetch_16
- ___sync_xor_and_fetch_16
- ___sync_nand_and_fetch_16
- ___sync_bool_compare_and_swap_16
- ___sync_val_compare_and_swap_16
- ___sync_lock_test_and_set_16
-
- ___sync_synchronize
-}
-
-%inherit GCC_4.5.0 GCC_4.4.0
-GCC_4.5.0 {
- ___unordxf2
- ___unordtf2
-}
diff --git a/gcc/config/bfin/t-bfin b/gcc/config/bfin/t-bfin
deleted file mode 100644
index 730043e4b63..00000000000
--- a/gcc/config/bfin/t-bfin
+++ /dev/null
@@ -1,34 +0,0 @@
-# Copyright (C) 2005, 2007, 2011 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/>.
-
-## Target part of the Makefile
-
-LIB1ASMSRC = bfin/lib1funcs.asm
-LIB1ASMFUNCS = _divsi3 _udivsi3 _umodsi3 _modsi3 _muldi3 _umulsi3_highpart
-LIB1ASMFUNCS += _smulsi3_highpart
-
-EXTRA_PARTS = crtbegin.o crtend.o crti.o crtn.o
-
-# Assemble startup files.
-$(T)crti.o: $(srcdir)/config/bfin/crti.s $(GCC_PASSES)
- $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(MULTILIB_CFLAGS) $(INCLUDES) \
- -c -o $(T)crti.o -x assembler-with-cpp $(srcdir)/config/bfin/crti.s
-
-$(T)crtn.o: $(srcdir)/config/bfin/crtn.s $(GCC_PASSES)
- $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(MULTILIB_CFLAGS) $(INCLUDES) \
- -c -o $(T)crtn.o -x assembler-with-cpp $(srcdir)/config/bfin/crtn.s
diff --git a/gcc/config/bfin/t-bfin-elf b/gcc/config/bfin/t-bfin-elf
index 61797bfad2a..742740ebc44 100644
--- a/gcc/config/bfin/t-bfin-elf
+++ b/gcc/config/bfin/t-bfin-elf
@@ -18,13 +18,6 @@
## Target part of the Makefile
-LIB1ASMSRC = bfin/lib1funcs.asm
-LIB1ASMFUNCS = _divsi3 _udivsi3 _umodsi3 _modsi3 _muldi3 _umulsi3_highpart
-LIB1ASMFUNCS += _smulsi3_highpart
-
-CRTSTUFF_T_CFLAGS = -fpic
-TARGET_LIBGCC2_CFLAGS = -fpic
-
MULTILIB_OPTIONS=mcpu=bf532-none
MULTILIB_OPTIONS+=mid-shared-library/msep-data/mfdpic mleaf-id-shared-library
MULTILIB_DIRNAMES=bf532-none mid-shared-library msep-data mfdpic mleaf-id-shared-library
@@ -54,19 +47,3 @@ MULTILIB_EXCEPTIONS=mleaf-id-shared-library*
MULTILIB_EXCEPTIONS+=mcpu=bf532-none/mleaf-id-shared-library*
MULTILIB_EXCEPTIONS+=*mfdpic/mleaf-id-shared-library*
MULTILIB_EXCEPTIONS+=*msep-data/mleaf-id-shared-library*
-
-# Assemble startup files.
-$(T)crti.o: $(srcdir)/config/bfin/crti.s $(GCC_PASSES)
- $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(MULTILIB_CFLAGS) $(INCLUDES) \
- -c -o $(T)crti.o -x assembler-with-cpp $(srcdir)/config/bfin/crti.s
-
-$(T)crtn.o: $(srcdir)/config/bfin/crtn.s $(GCC_PASSES)
- $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(MULTILIB_CFLAGS) $(INCLUDES) \
- -c -o $(T)crtn.o -x assembler-with-cpp $(srcdir)/config/bfin/crtn.s
-
-$(T)crtlibid.o: $(srcdir)/config/bfin/crtlibid.s $(GCC_PASSES)
- $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(MULTILIB_CFLAGS) $(INCLUDES) \
- -c -o $(T)crtlibid.o -x assembler-with-cpp \
- $(srcdir)/config/bfin/crtlibid.s
-
-EXTRA_MULTILIB_PARTS = crtbegin.o crtend.o crtbeginS.o crtendS.o crti.o crtn.o crtlibid.o
diff --git a/gcc/config/bfin/t-bfin-linux b/gcc/config/bfin/t-bfin-linux
index e7e705ef1d4..7d25358c265 100644
--- a/gcc/config/bfin/t-bfin-linux
+++ b/gcc/config/bfin/t-bfin-linux
@@ -18,13 +18,6 @@
## Target part of the Makefile
-LIB1ASMSRC = bfin/lib1funcs.asm
-LIB1ASMFUNCS = _divsi3 _udivsi3 _umodsi3 _modsi3 _muldi3 _umulsi3_highpart
-LIB1ASMFUNCS += _smulsi3_highpart
-
-CRTSTUFF_T_CFLAGS = -fpic
-TARGET_LIBGCC2_CFLAGS = -fpic
-
MULTILIB_OPTIONS=mcpu=bf532-none
MULTILIB_DIRNAMES=bf532-none
@@ -49,10 +42,6 @@ MULTILIB_MATCHES+=mcpu?bf532-none=mcpu?bf549m-none
MULTILIB_MATCHES+=mcpu?bf532-none=mcpu?bf561-none
MULTILIB_MATCHES+=mcpu?bf532-none=mcpu?bf592-none
-SHLIB_MAPFILES=$(srcdir)/config/bfin/libgcc-bfin.ver
-
-EXTRA_MULTILIB_PARTS = crtbegin.o crtend.o crtbeginS.o crtendS.o
-
# This rule uses MULTILIB_MATCHES to generate a definition of
# SYSROOT_SUFFIX_SPEC.
linux-sysroot-suffix.h: $(srcdir)/config/bfin/print-sysroot-suffix.sh
diff --git a/gcc/config/bfin/t-bfin-uclinux b/gcc/config/bfin/t-bfin-uclinux
index a46d7b3ac15..e3e9b13e712 100644
--- a/gcc/config/bfin/t-bfin-uclinux
+++ b/gcc/config/bfin/t-bfin-uclinux
@@ -18,13 +18,6 @@
## Target part of the Makefile
-LIB1ASMSRC = bfin/lib1funcs.asm
-LIB1ASMFUNCS = _divsi3 _udivsi3 _umodsi3 _modsi3 _muldi3 _umulsi3_highpart
-LIB1ASMFUNCS += _smulsi3_highpart
-
-CRTSTUFF_T_CFLAGS = -fpic
-TARGET_LIBGCC2_CFLAGS = -fpic
-
MULTILIB_OPTIONS=mcpu=bf532-none
MULTILIB_OPTIONS+=mid-shared-library/msep-data mleaf-id-shared-library
MULTILIB_DIRNAMES=bf532-none mid-shared-library msep-data mleaf-id-shared-library
@@ -53,11 +46,3 @@ MULTILIB_MATCHES+=mcpu?bf532-none=mcpu?bf592-none
MULTILIB_EXCEPTIONS=mleaf-id-shared-library*
MULTILIB_EXCEPTIONS+=mcpu=bf532-none/mleaf-id-shared-library*
MULTILIB_EXCEPTIONS+=*msep-data/mleaf-id-shared-library*
-
-# Assemble startup files.
-$(T)crtlibid.o: $(srcdir)/config/bfin/crtlibid.s $(GCC_PASSES)
- $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(MULTILIB_CFLAGS) $(INCLUDES) \
- -c -o $(T)crtlibid.o -x assembler-with-cpp \
- $(srcdir)/config/bfin/crtlibid.s
-
-EXTRA_MULTILIB_PARTS = crtbegin.o crtend.o crtbeginS.o crtendS.o crtlibid.o
diff --git a/gcc/config/c6x/crti.s b/gcc/config/c6x/crti.s
deleted file mode 100644
index 8fe35c1f121..00000000000
--- a/gcc/config/c6x/crti.s
+++ /dev/null
@@ -1,39 +0,0 @@
-/* Copyright 2010, 2011 Free Software Foundation, Inc.
- Contributed by Bernd Schmidt <bernds@codesourcery.com>.
-
-This file is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3, or (at your option) any
-later version.
-
-This file 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/>. */
-
-/*
- * This file just supplies function prologues for the .init and .fini
- * sections. It is linked in before crtbegin.o.
- */
-
- .section .init
- .globl _init
- .type _init,@function
-_init:
- add .l2 -8, B15, B15
- stw .d2t2 B3,*+B15(4)
- .section .fini
- .globl _fini
- .type _fini,@function
-_fini:
- add .l2 -8, B15, B15
- stw .d2t2 B3,*+B15(4)
diff --git a/gcc/config/c6x/eqd.c b/gcc/config/c6x/eqd.c
deleted file mode 100644
index d6b32013bcb..00000000000
--- a/gcc/config/c6x/eqd.c
+++ /dev/null
@@ -1,47 +0,0 @@
-/* Software floating-point emulation.
- Return 1 iff a == b, 0 otherwise.
- Copyright (C) 1997,1999,2006,2007,2011 Free Software Foundation, Inc.
- Contributed by Richard Henderson (rth@cygnus.com) and
- Jakub Jelinek (jj@ultra.linux.cz).
-
- This file is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- In addition to the permissions in the GNU Lesser General Public
- License, the Free Software Foundation gives you unlimited
- permission to link the compiled version of this file into
- combinations with other programs, and to distribute those
- combinations without any restriction coming from the use of this
- file. (The Lesser General Public License restrictions do apply in
- other respects; for example, they cover modification of the file,
- and distribution when not linked into a combine executable.)
-
- This file 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with GCC; see the file COPYING.LIB. If not see
- <http://www.gnu.org/licenses/>. */
-
-#include <soft-fp/soft-fp.h>
-#include <soft-fp/double.h>
-
-CMPtype __c6xabi_eqd(DFtype a, DFtype b)
-{
- FP_DECL_EX;
- FP_DECL_D(A); FP_DECL_D(B);
- CMPtype r;
-
- FP_UNPACK_RAW_D(A, a);
- FP_UNPACK_RAW_D(B, b);
- FP_CMP_EQ_D(r, A, B);
- if (r && (FP_ISSIGNAN_D(A) || FP_ISSIGNAN_D(B)))
- FP_SET_EXCEPTION(FP_EX_INVALID);
- FP_HANDLE_EXCEPTIONS;
-
- return !r;
-}
diff --git a/gcc/config/c6x/eqf.c b/gcc/config/c6x/eqf.c
deleted file mode 100644
index ee6dafc98b7..00000000000
--- a/gcc/config/c6x/eqf.c
+++ /dev/null
@@ -1,47 +0,0 @@
-/* Software floating-point emulation.
- Return 1 iff a == b, 0 otherwise.
- Copyright (C) 1997,1999,2006,2007,2011 Free Software Foundation, Inc.
- Contributed by Richard Henderson (rth@cygnus.com) and
- Jakub Jelinek (jj@ultra.linux.cz).
-
- This file is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- In addition to the permissions in the GNU Lesser General Public
- License, the Free Software Foundation gives you unlimited
- permission to link the compiled version of this file into
- combinations with other programs, and to distribute those
- combinations without any restriction coming from the use of this
- file. (The Lesser General Public License restrictions do apply in
- other respects; for example, they cover modification of the file,
- and distribution when not linked into a combine executable.)
-
- This file 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with GCC; see the file COPYING.LIB. If not see
- <http://www.gnu.org/licenses/>. */
-
-#include <soft-fp/soft-fp.h>
-#include <soft-fp/single.h>
-
-CMPtype __c6xabi_eqf(SFtype a, SFtype b)
-{
- FP_DECL_EX;
- FP_DECL_S(A); FP_DECL_S(B);
- CMPtype r;
-
- FP_UNPACK_RAW_S(A, a);
- FP_UNPACK_RAW_S(B, b);
- FP_CMP_EQ_S(r, A, B);
- if (r && (FP_ISSIGNAN_S(A) || FP_ISSIGNAN_S(B)))
- FP_SET_EXCEPTION(FP_EX_INVALID);
- FP_HANDLE_EXCEPTIONS;
-
- return !r;
-}
diff --git a/gcc/config/c6x/ged.c b/gcc/config/c6x/ged.c
deleted file mode 100644
index 2089904f92a..00000000000
--- a/gcc/config/c6x/ged.c
+++ /dev/null
@@ -1,47 +0,0 @@
-/* Software floating-point emulation.
- Return 1 iff a >= b, 0 otherwise.
- Copyright (C) 1997,1999,2006,2007,2011 Free Software Foundation, Inc.
- Contributed by Richard Henderson (rth@cygnus.com) and
- Jakub Jelinek (jj@ultra.linux.cz).
-
- This file is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- In addition to the permissions in the GNU Lesser General Public
- License, the Free Software Foundation gives you unlimited
- permission to link the compiled version of this file into
- combinations with other programs, and to distribute those
- combinations without any restriction coming from the use of this
- file. (The Lesser General Public License restrictions do apply in
- other respects; for example, they cover modification of the file,
- and distribution when not linked into a combine executable.)
-
- This file 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with GCC; see the file COPYING.LIB. If not see
- <http://www.gnu.org/licenses/>. */
-
-#include <soft-fp/soft-fp.h>
-#include <soft-fp/double.h>
-
-CMPtype __c6xabi_ged(DFtype a, DFtype b)
-{
- FP_DECL_EX;
- FP_DECL_D(A); FP_DECL_D(B);
- CMPtype r;
-
- FP_UNPACK_RAW_D(A, a);
- FP_UNPACK_RAW_D(B, b);
- FP_CMP_D(r, A, B, -2);
- if (r == -2 && (FP_ISSIGNAN_D(A) || FP_ISSIGNAN_D(B)))
- FP_SET_EXCEPTION(FP_EX_INVALID);
- FP_HANDLE_EXCEPTIONS;
-
- return r >= 0;
-}
diff --git a/gcc/config/c6x/gef.c b/gcc/config/c6x/gef.c
deleted file mode 100644
index ce4c1c0af3d..00000000000
--- a/gcc/config/c6x/gef.c
+++ /dev/null
@@ -1,47 +0,0 @@
-/* Software floating-point emulation.
- Return 1 iff a >= b, 0 otherwise.
- Copyright (C) 1997,1999,2006,2007 Free Software Foundation, Inc.
- Contributed by Richard Henderson (rth@cygnus.com) and
- Jakub Jelinek (jj@ultra.linux.cz).
-
- This file is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- In addition to the permissions in the GNU Lesser General Public
- License, the Free Software Foundation gives you unlimited
- permission to link the compiled version of this file into
- combinations with other programs, and to distribute those
- combinations without any restriction coming from the use of this
- file. (The Lesser General Public License restrictions do apply in
- other respects; for example, they cover modification of the file,
- and distribution when not linked into a combine executable.)
-
- This file 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with GCC; see the file COPYING.LIB. If not see
- <http://www.gnu.org/licenses/>. */
-
-#include <soft-fp/soft-fp.h>
-#include <soft-fp/single.h>
-
-CMPtype __c6xabi_gef(SFtype a, SFtype b)
-{
- FP_DECL_EX;
- FP_DECL_S(A); FP_DECL_S(B);
- CMPtype r;
-
- FP_UNPACK_RAW_S(A, a);
- FP_UNPACK_RAW_S(B, b);
- FP_CMP_S(r, A, B, -2);
- if (r == -2 && (FP_ISSIGNAN_S(A) || FP_ISSIGNAN_S(B)))
- FP_SET_EXCEPTION(FP_EX_INVALID);
- FP_HANDLE_EXCEPTIONS;
-
- return r >= 0;
-}
diff --git a/gcc/config/c6x/gtd.c b/gcc/config/c6x/gtd.c
deleted file mode 100644
index 6d45aef9af8..00000000000
--- a/gcc/config/c6x/gtd.c
+++ /dev/null
@@ -1,47 +0,0 @@
-/* Software floating-point emulation.
- Return 1 iff a > b, 0 otherwise.
- Copyright (C) 1997,1999,2006,2007,2011 Free Software Foundation, Inc.
- Contributed by Richard Henderson (rth@cygnus.com) and
- Jakub Jelinek (jj@ultra.linux.cz).
-
- This file is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- In addition to the permissions in the GNU Lesser General Public
- License, the Free Software Foundation gives you unlimited
- permission to link the compiled version of this file into
- combinations with other programs, and to distribute those
- combinations without any restriction coming from the use of this
- file. (The Lesser General Public License restrictions do apply in
- other respects; for example, they cover modification of the file,
- and distribution when not linked into a combine executable.)
-
- This file 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with GCC; see the file COPYING.LIB. If not see
- <http://www.gnu.org/licenses/>. */
-
-#include <soft-fp/soft-fp.h>
-#include <soft-fp/double.h>
-
-CMPtype __c6xabi_gtd(DFtype a, DFtype b)
-{
- FP_DECL_EX;
- FP_DECL_D(A); FP_DECL_D(B);
- CMPtype r;
-
- FP_UNPACK_RAW_D(A, a);
- FP_UNPACK_RAW_D(B, b);
- FP_CMP_D(r, A, B, -2);
- if (r == -2 && (FP_ISSIGNAN_D(A) || FP_ISSIGNAN_D(B)))
- FP_SET_EXCEPTION(FP_EX_INVALID);
- FP_HANDLE_EXCEPTIONS;
-
- return r > 0;
-}
diff --git a/gcc/config/c6x/gtf.c b/gcc/config/c6x/gtf.c
deleted file mode 100644
index c6a108a2833..00000000000
--- a/gcc/config/c6x/gtf.c
+++ /dev/null
@@ -1,47 +0,0 @@
-/* Software floating-point emulation.
- Return 1 iff a > b, 0 otherwise.
- Copyright (C) 1997,1999,2006,2007,2011 Free Software Foundation, Inc.
- Contributed by Richard Henderson (rth@cygnus.com) and
- Jakub Jelinek (jj@ultra.linux.cz).
-
- This file is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- In addition to the permissions in the GNU Lesser General Public
- License, the Free Software Foundation gives you unlimited
- permission to link the compiled version of this file into
- combinations with other programs, and to distribute those
- combinations without any restriction coming from the use of this
- file. (The Lesser General Public License restrictions do apply in
- other respects; for example, they cover modification of the file,
- and distribution when not linked into a combine executable.)
-
- This file 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with GCC; see the file COPYING.LIB. If not see
- <http://www.gnu.org/licenses/>. */
-
-#include <soft-fp/soft-fp.h>
-#include <soft-fp/single.h>
-
-CMPtype __c6xabi_gtf(SFtype a, SFtype b)
-{
- FP_DECL_EX;
- FP_DECL_S(A); FP_DECL_S(B);
- CMPtype r;
-
- FP_UNPACK_RAW_S(A, a);
- FP_UNPACK_RAW_S(B, b);
- FP_CMP_S(r, A, B, -2);
- if (r == -2 && (FP_ISSIGNAN_S(A) || FP_ISSIGNAN_S(B)))
- FP_SET_EXCEPTION(FP_EX_INVALID);
- FP_HANDLE_EXCEPTIONS;
-
- return r > 0;
-}
diff --git a/gcc/config/c6x/led.c b/gcc/config/c6x/led.c
deleted file mode 100644
index c99e29e0ddf..00000000000
--- a/gcc/config/c6x/led.c
+++ /dev/null
@@ -1,47 +0,0 @@
-/* Software floating-point emulation.
- Return 1 iff a <= b, 0 otherwise.
- Copyright (C) 1997,1999,2006,2007,2011 Free Software Foundation, Inc.
- Contributed by Richard Henderson (rth@cygnus.com) and
- Jakub Jelinek (jj@ultra.linux.cz).
-
- This file is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- In addition to the permissions in the GNU Lesser General Public
- License, the Free Software Foundation gives you unlimited
- permission to link the compiled version of this file into
- combinations with other programs, and to distribute those
- combinations without any restriction coming from the use of this
- file. (The Lesser General Public License restrictions do apply in
- other respects; for example, they cover modification of the file,
- and distribution when not linked into a combine executable.)
-
- This file 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with GCC; see the file COPYING.LIB. If not see
- <http://www.gnu.org/licenses/>. */
-
-#include <soft-fp/soft-fp.h>
-#include <soft-fp/double.h>
-
-CMPtype __c6xabi_led(DFtype a, DFtype b)
-{
- FP_DECL_EX;
- FP_DECL_D(A); FP_DECL_D(B);
- CMPtype r;
-
- FP_UNPACK_RAW_D(A, a);
- FP_UNPACK_RAW_D(B, b);
- FP_CMP_D(r, A, B, 2);
- if (r == 2 && (FP_ISSIGNAN_D(A) || FP_ISSIGNAN_D(B)))
- FP_SET_EXCEPTION(FP_EX_INVALID);
- FP_HANDLE_EXCEPTIONS;
-
- return r <= 0;
-}
diff --git a/gcc/config/c6x/lef.c b/gcc/config/c6x/lef.c
deleted file mode 100644
index ce2c16f8ede..00000000000
--- a/gcc/config/c6x/lef.c
+++ /dev/null
@@ -1,47 +0,0 @@
-/* Software floating-point emulation.
- Return 1 iff a <= b, 0 otherwise.
- Copyright (C) 1997,1999,2006,2007,2011 Free Software Foundation, Inc.
- Contributed by Richard Henderson (rth@cygnus.com) and
- Jakub Jelinek (jj@ultra.linux.cz).
-
- This file is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- In addition to the permissions in the GNU Lesser General Public
- License, the Free Software Foundation gives you unlimited
- permission to link the compiled version of this file into
- combinations with other programs, and to distribute those
- combinations without any restriction coming from the use of this
- file. (The Lesser General Public License restrictions do apply in
- other respects; for example, they cover modification of the file,
- and distribution when not linked into a combine executable.)
-
- This file 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with GCC; see the file COPYING.LIB. If not see
- <http://www.gnu.org/licenses/>. */
-
-#include <soft-fp/soft-fp.h>
-#include <soft-fp/single.h>
-
-CMPtype __c6xabi_lef(SFtype a, SFtype b)
-{
- FP_DECL_EX;
- FP_DECL_S(A); FP_DECL_S(B);
- CMPtype r;
-
- FP_UNPACK_RAW_S(A, a);
- FP_UNPACK_RAW_S(B, b);
- FP_CMP_S(r, A, B, 2);
- if (r == 2 && (FP_ISSIGNAN_S(A) || FP_ISSIGNAN_S(B)))
- FP_SET_EXCEPTION(FP_EX_INVALID);
- FP_HANDLE_EXCEPTIONS;
-
- return r <= 0;
-}
diff --git a/gcc/config/c6x/lib1funcs.asm b/gcc/config/c6x/lib1funcs.asm
deleted file mode 100644
index 5bf34474bbd..00000000000
--- a/gcc/config/c6x/lib1funcs.asm
+++ /dev/null
@@ -1,438 +0,0 @@
-/* Copyright 2010, 2011 Free Software Foundation, Inc.
- Contributed by Bernd Schmidt <bernds@codesourcery.com>.
-
-This file is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3, or (at your option) any
-later version.
-
-This file 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/>. */
-
- ;; ABI considerations for the divide functions
- ;; The following registers are call-used:
- ;; __c6xabi_divi A0,A1,A2,A4,A6,B0,B1,B2,B4,B5
- ;; __c6xabi_divu A0,A1,A2,A4,A6,B0,B1,B2,B4
- ;; __c6xabi_remi A1,A2,A4,A5,A6,B0,B1,B2,B4
- ;; __c6xabi_remu A1,A4,A5,A7,B0,B1,B2,B4
- ;;
- ;; In our implementation, divu and remu are leaf functions,
- ;; while both divi and remi call into divu.
- ;; A0 is not clobbered by any of the functions.
- ;; divu does not clobber B2 either, which is taken advantage of
- ;; in remi.
- ;; divi uses B5 to hold the original return address during
- ;; the call to divu.
- ;; remi uses B2 and A5 to hold the input values during the
- ;; call to divu. It stores B3 in on the stack.
-
-#ifdef L_divsi3
-.text
-.align 2
-.global __c6xabi_divi
-.hidden __c6xabi_divi
-.type __c6xabi_divi, STT_FUNC
-
-__c6xabi_divi:
- call .s2 __c6xabi_divu
-|| mv .d2 B3, B5
-|| cmpgt .l1 0, A4, A1
-|| cmpgt .l2 0, B4, B1
-
- [A1] neg .l1 A4, A4
-|| [B1] neg .l2 B4, B4
-|| xor .s1x A1, B1, A1
-
-#ifdef _TMS320C6400
- [A1] addkpc .s2 1f, B3, 4
-#else
- [A1] mvkl .s2 1f, B3
- [A1] mvkh .s2 1f, B3
- nop 2
-#endif
-1:
- neg .l1 A4, A4
-|| mv .l2 B3,B5
-|| ret .s2 B5
- nop 5
-#endif
-
-#if defined L_modsi3 || defined L_divmodsi4
-.align 2
-#ifdef L_modsi3
-#define MOD_OUTPUT_REG A4
-.global __c6xabi_remi
-.hidden __c6xabi_remi
-.type __c6xabi_remi, STT_FUNC
-#else
-#define MOD_OUTPUT_REG A5
-.global __c6xabi_divremi
-.hidden __c6xabi_divremi
-.type __c6xabi_divremi, STT_FUNC
-__c6xabi_divremi:
-#endif
-
-__c6xabi_remi:
- stw .d2t2 B3, *B15--[2]
-|| cmpgt .l1 0, A4, A1
-|| cmpgt .l2 0, B4, B2
-|| mv .s1 A4, A5
-|| call .s2 __c6xabi_divu
-
- [A1] neg .l1 A4, A4
-|| [B2] neg .l2 B4, B4
-|| xor .s2x B2, A1, B0
-|| mv .d2 B4, B2
-
-#ifdef _TMS320C6400
- [B0] addkpc .s2 1f, B3, 1
- [!B0] addkpc .s2 2f, B3, 1
- nop 2
-#else
- [B0] mvkl .s2 1f,B3
- [!B0] mvkl .s2 2f,B3
-
- [B0] mvkh .s2 1f,B3
- [!B0] mvkh .s2 2f,B3
-#endif
-1:
- neg .l1 A4, A4
-2:
- ldw .d2t2 *++B15[2], B3
-
-#ifdef _TMS320C6400_PLUS
- mpy32 .m1x A4, B2, A6
- nop 3
- ret .s2 B3
- sub .l1 A5, A6, MOD_OUTPUT_REG
- nop 4
-#else
- mpyu .m1x A4, B2, A1
- nop 1
- mpylhu .m1x A4, B2, A6
-|| mpylhu .m2x B2, A4, B2
- nop 1
- add .l1x A6, B2, A6
-|| ret .s2 B3
- shl .s1 A6, 16, A6
- add .d1 A6, A1, A6
- sub .l1 A5, A6, MOD_OUTPUT_REG
- nop 2
-#endif
-
-#endif
-
-#if defined L_udivsi3 || defined L_udivmodsi4
-.align 2
-#ifdef L_udivsi3
-.global __c6xabi_divu
-.hidden __c6xabi_divu
-.type __c6xabi_divu, STT_FUNC
-__c6xabi_divu:
-#else
-.global __c6xabi_divremu
-.hidden __c6xabi_divremu
-.type __c6xabi_divremu, STT_FUNC
-__c6xabi_divremu:
-#endif
- ;; We use a series of up to 31 subc instructions. First, we find
- ;; out how many leading zero bits there are in the divisor. This
- ;; gives us both a shift count for aligning (shifting) the divisor
- ;; to the, and the number of times we have to execute subc.
-
- ;; At the end, we have both the remainder and most of the quotient
- ;; in A4. The top bit of the quotient is computed first and is
- ;; placed in A2.
-
- ;; Return immediately if the dividend is zero. Setting B4 to 1
- ;; is a trick to allow us to leave the following insns in the jump
- ;; delay slot without affecting the result.
- mv .s2x A4, B1
-
-#ifndef _TMS320C6400
-[!b1] mvk .s2 1, B4
-#endif
-[b1] lmbd .l2 1, B4, B1
-||[!b1] b .s2 B3 ; RETURN A
-#ifdef _TMS320C6400
-||[!b1] mvk .d2 1, B4
-#endif
-#ifdef L_udivmodsi4
-||[!b1] zero .s1 A5
-#endif
- mv .l1x B1, A6
-|| shl .s2 B4, B1, B4
-
- ;; The loop performs a maximum of 28 steps, so we do the
- ;; first 3 here.
- cmpltu .l1x A4, B4, A2
-[!A2] sub .l1x A4, B4, A4
-|| shru .s2 B4, 1, B4
-|| xor .s1 1, A2, A2
-
- shl .s1 A2, 31, A2
-|| [b1] subc .l1x A4,B4,A4
-|| [b1] add .s2 -1, B1, B1
-[b1] subc .l1x A4,B4,A4
-|| [b1] add .s2 -1, B1, B1
-
- ;; RETURN A may happen here (note: must happen before the next branch)
-0:
- cmpgt .l2 B1, 7, B0
-|| [b1] subc .l1x A4,B4,A4
-|| [b1] add .s2 -1, B1, B1
-[b1] subc .l1x A4,B4,A4
-|| [b1] add .s2 -1, B1, B1
-|| [b0] b .s1 0b
-[b1] subc .l1x A4,B4,A4
-|| [b1] add .s2 -1, B1, B1
-[b1] subc .l1x A4,B4,A4
-|| [b1] add .s2 -1, B1, B1
-[b1] subc .l1x A4,B4,A4
-|| [b1] add .s2 -1, B1, B1
-[b1] subc .l1x A4,B4,A4
-|| [b1] add .s2 -1, B1, B1
-[b1] subc .l1x A4,B4,A4
-|| [b1] add .s2 -1, B1, B1
- ;; loop backwards branch happens here
-
- ret .s2 B3
-|| mvk .s1 32, A1
- sub .l1 A1, A6, A6
-#ifdef L_udivmodsi4
-|| extu .s1 A4, A6, A5
-#endif
- shl .s1 A4, A6, A4
- shru .s1 A4, 1, A4
-|| sub .l1 A6, 1, A6
- or .l1 A2, A4, A4
- shru .s1 A4, A6, A4
- nop
-
-#endif
-
-#ifdef L_umodsi3
-.align 2
-.global __c6xabi_remu
-.hidden __c6xabi_remu
-.type __c6xabi_remu, STT_FUNC
-__c6xabi_remu:
- ;; The ABI seems designed to prevent these functions calling each other,
- ;; so we duplicate most of the divsi3 code here.
- mv .s2x A4, B1
-#ifndef _TMS320C6400
-[!b1] mvk .s2 1, B4
-#endif
- lmbd .l2 1, B4, B1
-||[!b1] b .s2 B3 ; RETURN A
-#ifdef _TMS320C6400
-||[!b1] mvk .d2 1, B4
-#endif
-
- mv .l1x B1, A7
-|| shl .s2 B4, B1, B4
-
- cmpltu .l1x A4, B4, A1
-[!a1] sub .l1x A4, B4, A4
- shru .s2 B4, 1, B4
-
-0:
- cmpgt .l2 B1, 7, B0
-|| [b1] subc .l1x A4,B4,A4
-|| [b1] add .s2 -1, B1, B1
- ;; RETURN A may happen here (note: must happen before the next branch)
-[b1] subc .l1x A4,B4,A4
-|| [b1] add .s2 -1, B1, B1
-|| [b0] b .s1 0b
-[b1] subc .l1x A4,B4,A4
-|| [b1] add .s2 -1, B1, B1
-[b1] subc .l1x A4,B4,A4
-|| [b1] add .s2 -1, B1, B1
-[b1] subc .l1x A4,B4,A4
-|| [b1] add .s2 -1, B1, B1
-[b1] subc .l1x A4,B4,A4
-|| [b1] add .s2 -1, B1, B1
-[b1] subc .l1x A4,B4,A4
-|| [b1] add .s2 -1, B1, B1
- ;; loop backwards branch happens here
-
- ret .s2 B3
-[b1] subc .l1x A4,B4,A4
-|| [b1] add .s2 -1, B1, B1
-[b1] subc .l1x A4,B4,A4
-
- extu .s1 A4, A7, A4
- nop 2
-#endif
-
-#if defined L_strasgi_64plus && defined _TMS320C6400_PLUS
-
-.align 2
-.global __c6xabi_strasgi_64plus
-.hidden __c6xabi_strasgi_64plus
-.type __c6xabi_strasgi_64plus, STT_FUNC
-__c6xabi_strasgi_64plus:
- shru .s2x a6, 2, b31
-|| mv .s1 a4, a30
-|| mv .d2 b4, b30
-
- add .s2 -4, b31, b31
-
- sploopd 1
-|| mvc .s2 b31, ilc
- ldw .d2t2 *b30++, b31
- nop 4
- mv .s1x b31,a31
- spkernel 6, 0
-|| stw .d1t1 a31, *a30++
-
- ret .s2 b3
- nop 5
-#endif
-
-#ifdef L_strasgi
-.global __c6xabi_strasgi
-.type __c6xabi_strasgi, STT_FUNC
-__c6xabi_strasgi:
- ;; This is essentially memcpy, with alignment known to be at least
- ;; 4, and the size a multiple of 4 greater than or equal to 28.
- ldw .d2t1 *B4++, A0
-|| mvk .s2 16, B1
- ldw .d2t1 *B4++, A1
-|| mvk .s2 20, B2
-|| sub .d1 A6, 24, A6
- ldw .d2t1 *B4++, A5
- ldw .d2t1 *B4++, A7
-|| mv .l2x A6, B7
- ldw .d2t1 *B4++, A8
- ldw .d2t1 *B4++, A9
-|| mv .s2x A0, B5
-|| cmpltu .l2 B2, B7, B0
-
-0:
- stw .d1t2 B5, *A4++
-||[b0] ldw .d2t1 *B4++, A0
-|| mv .s2x A1, B5
-|| mv .l2 B7, B6
-
-[b0] sub .d2 B6, 24, B7
-||[b0] b .s2 0b
-|| cmpltu .l2 B1, B6, B0
-
-[b0] ldw .d2t1 *B4++, A1
-|| stw .d1t2 B5, *A4++
-|| mv .s2x A5, B5
-|| cmpltu .l2 12, B6, B0
-
-[b0] ldw .d2t1 *B4++, A5
-|| stw .d1t2 B5, *A4++
-|| mv .s2x A7, B5
-|| cmpltu .l2 8, B6, B0
-
-[b0] ldw .d2t1 *B4++, A7
-|| stw .d1t2 B5, *A4++
-|| mv .s2x A8, B5
-|| cmpltu .l2 4, B6, B0
-
-[b0] ldw .d2t1 *B4++, A8
-|| stw .d1t2 B5, *A4++
-|| mv .s2x A9, B5
-|| cmpltu .l2 0, B6, B0
-
-[b0] ldw .d2t1 *B4++, A9
-|| stw .d1t2 B5, *A4++
-|| mv .s2x A0, B5
-|| cmpltu .l2 B2, B7, B0
-
- ;; loop back branch happens here
-
- cmpltu .l2 B1, B6, B0
-|| ret .s2 b3
-
-[b0] stw .d1t1 A1, *A4++
-|| cmpltu .l2 12, B6, B0
-[b0] stw .d1t1 A5, *A4++
-|| cmpltu .l2 8, B6, B0
-[b0] stw .d1t1 A7, *A4++
-|| cmpltu .l2 4, B6, B0
-[b0] stw .d1t1 A8, *A4++
-|| cmpltu .l2 0, B6, B0
-[b0] stw .d1t1 A9, *A4++
-
- ;; return happens here
-
-#endif
-
-#ifdef _TMS320C6400_PLUS
-#ifdef L_push_rts
-.align 2
-.global __c6xabi_push_rts
-.hidden __c6xabi_push_rts
-.type __c6xabi_push_rts, STT_FUNC
-__c6xabi_push_rts:
- stw .d2t2 B14, *B15--[2]
- stdw .d2t1 A15:A14, *B15--
-|| b .s2x A3
- stdw .d2t2 B13:B12, *B15--
- stdw .d2t1 A13:A12, *B15--
- stdw .d2t2 B11:B10, *B15--
- stdw .d2t1 A11:A10, *B15--
- stdw .d2t2 B3:B2, *B15--
-#endif
-
-#ifdef L_pop_rts
-.align 2
-.global __c6xabi_pop_rts
-.hidden __c6xabi_pop_rts
-.type __c6xabi_pop_rts, STT_FUNC
-__c6xabi_pop_rts:
- lddw .d2t2 *++B15, B3:B2
- lddw .d2t1 *++B15, A11:A10
- lddw .d2t2 *++B15, B11:B10
- lddw .d2t1 *++B15, A13:A12
- lddw .d2t2 *++B15, B13:B12
- lddw .d2t1 *++B15, A15:A14
-|| b .s2 B3
- ldw .d2t2 *++B15[2], B14
- nop 4
-#endif
-
-#ifdef L_call_stub
-.align 2
-.global __c6xabi_call_stub
-.type __c6xabi_call_stub, STT_FUNC
-__c6xabi_call_stub:
- stw .d2t1 A2, *B15--[2]
- stdw .d2t1 A7:A6, *B15--
-|| call .s2 B31
- stdw .d2t1 A1:A0, *B15--
- stdw .d2t2 B7:B6, *B15--
- stdw .d2t2 B5:B4, *B15--
- stdw .d2t2 B1:B0, *B15--
- stdw .d2t2 B3:B2, *B15--
-|| addkpc .s2 1f, B3, 0
-1:
- lddw .d2t2 *++B15, B3:B2
- lddw .d2t2 *++B15, B1:B0
- lddw .d2t2 *++B15, B5:B4
- lddw .d2t2 *++B15, B7:B6
- lddw .d2t1 *++B15, A1:A0
- lddw .d2t1 *++B15, A7:A6
-|| b .s2 B3
- ldw .d2t1 *++B15[2], A2
- nop 4
-#endif
-
-#endif
-
diff --git a/gcc/config/c6x/libgcc-c6xeabi.ver b/gcc/config/c6x/libgcc-c6xeabi.ver
deleted file mode 100644
index 6bce556512e..00000000000
--- a/gcc/config/c6x/libgcc-c6xeabi.ver
+++ /dev/null
@@ -1,103 +0,0 @@
-# Copyright (C) 2011 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_4.7.0 {
- __c6xabi_strasgi
- __c6xabi_call_stub
- __c6xabi_mpyll
- __c6xabi_negll
- __c6xabi_llshru
- __c6xabi_llshl
- __c6xabi_llshr
- __c6xabi_fixfu
- __c6xabi_fixdu
- __c6xabi_fixflli
- __c6xabi_fixdlli
- __c6xabi_fixfull
- __c6xabi_fixdull
- __c6xabi_fltllif
- __c6xabi_fltllid
- __c6xabi_fltullf
- __c6xabi_fltulld
- __c6xabi_divlli
- __c6xabi_remlli
- __c6xabi_divull
- __c6xabi_remull
- __c6xabi_divremull
- __c6xabi_gef
- __c6xabi_gtf
- __c6xabi_lef
- __c6xabi_ltf
- __c6xabi_eqf
- __c6xabi_ged
- __c6xabi_gtd
- __c6xabi_led
- __c6xabi_ltd
- __c6xabi_eqd
- __c6xabi_addf
- __c6xabi_divf
- __c6xabi_neqf
- __c6xabi_cmpf
- __c6xabi_mpyf
- __c6xabi_negf
- __c6xabi_subf
- __c6xabi_unordf
- __c6xabi_fixfi
- __c6xabi_fltif
- __c6xabi_fltuf
- __c6xabi_addd
- __c6xabi_divd
- __c6xabi_neqd
- __c6xabi_cmpd
- __c6xabi_mpyd
- __c6xabi_negd
- __c6xabi_subd
- __c6xabi_unordd
- __c6xabi_fixdi
- __c6xabi_fltid
- __c6xabi_fltud
- __c6xabi_cvtfd
- __c6xabi_cvtdf
- __c6xabi_mulcf
- __c6xabi_mulcd
- __c6xabi_divcf
- __c6xabi_divcd
-
- __gnu_ltsf2
- __gnu_ltdf2
- __gnu_gesf2
- __gnu_gedf2
- __gnu_gtsf2
- __gnu_gtdf2
- __gnu_eqsf2
- __gnu_eqdf2
-
- # Exception-Handling
- _Unwind_Complete
- _Unwind_VRS_Get
- _Unwind_VRS_Set
- _Unwind_VRS_Pop
- __c6xabi_unwind_cpp_pr0
- __c6xabi_unwind_cpp_pr1
- __c6xabi_unwind_cpp_pr2
- __c6xabi_unwind_cpp_pr3
- __c6xabi_unwind_cpp_pr4
- # The libstdc++ exception-handling personality routine uses this
- # GNU-specific entry point.
- __gnu_unwind_frame
-}
diff --git a/gcc/config/c6x/ltd.c b/gcc/config/c6x/ltd.c
deleted file mode 100644
index d4de25866b7..00000000000
--- a/gcc/config/c6x/ltd.c
+++ /dev/null
@@ -1,47 +0,0 @@
-/* Software floating-point emulation.
- Return 1 iff a < b, 0 otherwise.
- Copyright (C) 1997,1999,2006,2007,2011 Free Software Foundation, Inc.
- Contributed by Richard Henderson (rth@cygnus.com) and
- Jakub Jelinek (jj@ultra.linux.cz).
-
- This file is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- In addition to the permissions in the GNU Lesser General Public
- License, the Free Software Foundation gives you unlimited
- permission to link the compiled version of this file into
- combinations with other programs, and to distribute those
- combinations without any restriction coming from the use of this
- file. (The Lesser General Public License restrictions do apply in
- other respects; for example, they cover modification of the file,
- and distribution when not linked into a combine executable.)
-
- This file 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with GCC; see the file COPYING.LIB. If not see
- <http://www.gnu.org/licenses/>. */
-
-#include <soft-fp/soft-fp.h>
-#include <soft-fp/double.h>
-
-CMPtype __c6xabi_ltd(DFtype a, DFtype b)
-{
- FP_DECL_EX;
- FP_DECL_D(A); FP_DECL_D(B);
- CMPtype r;
-
- FP_UNPACK_RAW_D(A, a);
- FP_UNPACK_RAW_D(B, b);
- FP_CMP_D(r, A, B, 2);
- if (r == 2 && (FP_ISSIGNAN_D(A) || FP_ISSIGNAN_D(B)))
- FP_SET_EXCEPTION(FP_EX_INVALID);
- FP_HANDLE_EXCEPTIONS;
-
- return r < 0;
-}
diff --git a/gcc/config/c6x/ltf.c b/gcc/config/c6x/ltf.c
deleted file mode 100644
index 2fe15b99fde..00000000000
--- a/gcc/config/c6x/ltf.c
+++ /dev/null
@@ -1,47 +0,0 @@
-/* Software floating-point emulation.
- Return 1 iff a < b, 0 otherwise.
- Copyright (C) 1997,1999,2006,2007,2011 Free Software Foundation, Inc.
- Contributed by Richard Henderson (rth@cygnus.com) and
- Jakub Jelinek (jj@ultra.linux.cz).
-
- This file is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- In addition to the permissions in the GNU Lesser General Public
- License, the Free Software Foundation gives you unlimited
- permission to link the compiled version of this file into
- combinations with other programs, and to distribute those
- combinations without any restriction coming from the use of this
- file. (The Lesser General Public License restrictions do apply in
- other respects; for example, they cover modification of the file,
- and distribution when not linked into a combine executable.)
-
- This file 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with GCC; see the file COPYING.LIB. If not see
- <http://www.gnu.org/licenses/>. */
-
-#include <soft-fp/soft-fp.h>
-#include <soft-fp/single.h>
-
-CMPtype __c6xabi_ltf(SFtype a, SFtype b)
-{
- FP_DECL_EX;
- FP_DECL_S(A); FP_DECL_S(B);
- CMPtype r;
-
- FP_UNPACK_RAW_S(A, a);
- FP_UNPACK_RAW_S(B, b);
- FP_CMP_S(r, A, B, 2);
- if (r == 2 && (FP_ISSIGNAN_S(A) || FP_ISSIGNAN_S(B)))
- FP_SET_EXCEPTION(FP_EX_INVALID);
- FP_HANDLE_EXCEPTIONS;
-
- return r < 0;
-}
diff --git a/gcc/config/c6x/t-c6x-elf b/gcc/config/c6x/t-c6x-elf
index 030a39ce18c..be52588ea30 100644
--- a/gcc/config/c6x/t-c6x-elf
+++ b/gcc/config/c6x/t-c6x-elf
@@ -18,25 +18,8 @@
# along with GCC; see the file COPYING3. If not see
# <http://www.gnu.org/licenses/>.
-LIB1ASMSRC = c6x/lib1funcs.asm
-LIB1ASMFUNCS = _divsi3 _udivsi3 _umodsi3 _modsi3 _udivmodsi4 _divmodsi4
-LIB1ASMFUNCS += _strasgi _strasgi_64plus _clzsi2 _clzdi2 _clz
-LIB1ASMFUNCS += _push_rts _pop_rts _call_stub
-
-LIB2FUNCS_EXCLUDE = _cmpdi2 _ucmpdi2 _gcc_bcmp _eprintf _clzsi _clzdi
EXTRA_HEADERS += $(srcdir)/ginclude/unwind-arm-common.h
-LIB2FUNCS_EXTRA = $(srcdir)/config/c6x/gef.c \
- $(srcdir)/config/c6x/gtf.c \
- $(srcdir)/config/c6x/lef.c \
- $(srcdir)/config/c6x/ltf.c \
- $(srcdir)/config/c6x/eqf.c \
- $(srcdir)/config/c6x/ged.c \
- $(srcdir)/config/c6x/gtd.c \
- $(srcdir)/config/c6x/led.c \
- $(srcdir)/config/c6x/ltd.c \
- $(srcdir)/config/c6x/eqd.c
-
# Use this variant for fully testing all CPU types
#MULTILIB_OPTIONS = mbig-endian march=c674x/march=c64x/march=c67x/march=c67x+/march=c62x
#MULTILIB_DIRNAMES = be c674x c64x c67x c67x+ c62x
@@ -45,23 +28,3 @@ MULTILIB_OPTIONS = mbig-endian march=c674x
MULTILIB_DIRNAMES = be c674x
MULTILIB_EXCEPTIONS =
MULTILIB_MATCHES =
-
-# Assemble startup files.
-$(T)crti.o: $(srcdir)/config/c6x/crti.s $(GCC_PASSES)
- $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(MULTILIB_CFLAGS) $(INCLUDES) \
- -c -o $(T)crti.o $(CRTSTUFF_T_CFLAGS) -x assembler-with-cpp \
- $(srcdir)/config/c6x/crti.s
-
-$(T)crtn.o: $(srcdir)/config/c6x/crtn.s $(GCC_PASSES)
- $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(MULTILIB_CFLAGS) $(INCLUDES) \
- -c -o $(T)crtn.o $(CRTSTUFF_T_CFLAGS) -x assembler-with-cpp \
- $(srcdir)/config/c6x/crtn.s
-
-EXTRA_MULTILIB_PARTS = crtbegin.o crtend.o crtbeginS.o crtendS.o crti.o crtn.o
-
-# Avoid failures when the user's GOT becomes too large.
-CRTSTUFF_T_CFLAGS = -msdata=none
-CRTSTUFF_T_CFLAGS_S = -msdata=none
-TARGET_LIBGCC2_CFLAGS = -msdata=none
-
-SHLIB_MAPFILES += $(srcdir)/config/c6x/libgcc-c6xeabi.ver
diff --git a/gcc/config/c6x/t-c6x-uclinux b/gcc/config/c6x/t-c6x-uclinux
index fdc447ac62c..e4b93908f43 100644
--- a/gcc/config/c6x/t-c6x-uclinux
+++ b/gcc/config/c6x/t-c6x-uclinux
@@ -1,7 +1,3 @@
MULTILIB_OSDIRNAMES = march.c674x=!c674x
MULTILIB_OSDIRNAMES += mbig-endian=!be
MULTILIB_OSDIRNAMES += mbig-endian/march.c674x=!be/c674x
-
-CRTSTUFF_T_CFLAGS = -fPIC -msdata=none
-CRTSTUFF_T_CFLAGS_S = -fPIC -msdata=none
-TARGET_LIBGCC2_CFLAGS = -fPIC -msdata=none
diff --git a/gcc/config/cris/arit.c b/gcc/config/cris/arit.c
deleted file mode 100644
index 32255f99d39..00000000000
--- a/gcc/config/cris/arit.c
+++ /dev/null
@@ -1,304 +0,0 @@
-/* Signed and unsigned multiplication and division and modulus for CRIS.
- Contributed by Axis Communications.
- Written by Hans-Peter Nilsson <hp@axis.se>, c:a 1992.
-
- Copyright (C) 1998, 1999, 2000, 2001, 2002,
- 2005, 2009 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.
-
-This file 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/>. */
-
-
-/* Note that we provide prototypes for all "const" functions, to attach
- the const attribute. This is necessary in 2.7.2 - adding the
- attribute to the function *definition* is a syntax error.
- This did not work with e.g. 2.1; back then, the return type had to
- be "const". */
-
-#include "config.h"
-
-#if defined (__CRIS_arch_version) && __CRIS_arch_version >= 3
-#define LZ(v) __builtin_clz (v)
-#endif
-
-
-#if defined (L_udivsi3) || defined (L_divsi3) || defined (L_umodsi3) \
- || defined (L_modsi3)
-/* Result type of divmod worker function. */
-struct quot_rem
- {
- long quot;
- long rem;
- };
-
-/* This is the worker function for div and mod. It is inlined into the
- respective library function. Parameter A must have bit 31 == 0. */
-
-static __inline__ struct quot_rem
-do_31div (unsigned long a, unsigned long b)
- __attribute__ ((__const__, __always_inline__));
-
-static __inline__ struct quot_rem
-do_31div (unsigned long a, unsigned long b)
-{
- /* Adjust operands and result if a is 31 bits. */
- long extra = 0;
- int quot_digits = 0;
-
- if (b == 0)
- {
- struct quot_rem ret;
- ret.quot = 0xffffffff;
- ret.rem = 0xffffffff;
- return ret;
- }
-
- if (a < b)
- return (struct quot_rem) { 0, a };
-
-#ifdef LZ
- if (b <= a)
- {
- quot_digits = LZ (b) - LZ (a);
- quot_digits += (a >= (b << quot_digits));
- b <<= quot_digits;
- }
-#else
- while (b <= a)
- {
- b <<= 1;
- quot_digits++;
- }
-#endif
-
- /* Is a 31 bits? Note that bit 31 is handled by the caller. */
- if (a & 0x40000000)
- {
- /* Then make b:s highest bit max 0x40000000, because it must have
- been 0x80000000 to be 1 bit higher than a. */
- b >>= 1;
-
- /* Adjust a to be maximum 0x3fffffff, i.e. two upper bits zero. */
- if (a >= b)
- {
- a -= b;
- extra = 1 << (quot_digits - 1);
- }
- else
- {
- a -= b >> 1;
-
- /* Remember that we adjusted a by subtracting b * 2 ** Something. */
- extra = 1 << quot_digits;
- }
-
- /* The number of quotient digits will be one less, because
- we just adjusted b. */
- quot_digits--;
- }
-
- /* Now do the division part. */
-
- /* Subtract b and add ones to the right when a >= b
- i.e. "a - (b - 1) == (a - b) + 1". */
- b--;
-
-#define DS __asm__ ("dstep %2,%0" : "=r" (a) : "0" (a), "r" (b))
-
- switch (quot_digits)
- {
- case 32: DS; case 31: DS; case 30: DS; case 29: DS;
- case 28: DS; case 27: DS; case 26: DS; case 25: DS;
- case 24: DS; case 23: DS; case 22: DS; case 21: DS;
- case 20: DS; case 19: DS; case 18: DS; case 17: DS;
- case 16: DS; case 15: DS; case 14: DS; case 13: DS;
- case 12: DS; case 11: DS; case 10: DS; case 9: DS;
- case 8: DS; case 7: DS; case 6: DS; case 5: DS;
- case 4: DS; case 3: DS; case 2: DS; case 1: DS;
- case 0:;
- }
-
- {
- struct quot_rem ret;
- ret.quot = (a & ((1 << quot_digits) - 1)) + extra;
- ret.rem = a >> quot_digits;
- return ret;
- }
-}
-
-#ifdef L_udivsi3
-unsigned long
-__Udiv (unsigned long a, unsigned long b) __attribute__ ((__const__));
-
-unsigned long
-__Udiv (unsigned long a, unsigned long b)
-{
- long extra = 0;
-
- /* Adjust operands and result, if a and/or b is 32 bits. */
- /* Effectively: b & 0x80000000. */
- if ((long) b < 0)
- return a >= b;
-
- /* Effectively: a & 0x80000000. */
- if ((long) a < 0)
- {
- int tmp = 0;
-
- if (b == 0)
- return 0xffffffff;
-#ifdef LZ
- tmp = LZ (b);
-#else
- for (tmp = 31; (((long) b & (1 << tmp)) == 0); tmp--)
- ;
-
- tmp = 31 - tmp;
-#endif
-
- if ((b << tmp) > a)
- {
- extra = 1 << (tmp-1);
- a -= b << (tmp - 1);
- }
- else
- {
- extra = 1 << tmp;
- a -= b << tmp;
- }
- }
-
- return do_31div (a, b).quot+extra;
-}
-#endif /* L_udivsi3 */
-
-#ifdef L_divsi3
-long
-__Div (long a, long b) __attribute__ ((__const__));
-
-long
-__Div (long a, long b)
-{
- long extra = 0;
- long sign = (b < 0) ? -1 : 1;
-
- /* We need to handle a == -2147483648 as expected and must while
- doing that avoid producing a sequence like "abs (a) < 0" as GCC
- may optimize out the test. That sequence may not be obvious as
- we call inline functions. Testing for a being negative and
- handling (presumably much rarer than positive) enables us to get
- a bit of optimization for an (accumulated) reduction of the
- penalty of the 0x80000000 special-case. */
- if (a < 0)
- {
- sign = -sign;
-
- if ((a & 0x7fffffff) == 0)
- {
- /* We're at 0x80000000. Tread carefully. */
- a -= b * sign;
- extra = sign;
- }
- a = -a;
- }
-
- /* We knowingly penalize pre-v10 models by multiplication with the
- sign. */
- return sign * do_31div (a, __builtin_labs (b)).quot + extra;
-}
-#endif /* L_divsi3 */
-
-
-#ifdef L_umodsi3
-unsigned long
-__Umod (unsigned long a, unsigned long b) __attribute__ ((__const__));
-
-unsigned long
-__Umod (unsigned long a, unsigned long b)
-{
- /* Adjust operands and result if a and/or b is 32 bits. */
- if ((long) b < 0)
- return a >= b ? a - b : a;
-
- if ((long) a < 0)
- {
- int tmp = 0;
-
- if (b == 0)
- return a;
-#ifdef LZ
- tmp = LZ (b);
-#else
- for (tmp = 31; (((long) b & (1 << tmp)) == 0); tmp--)
- ;
- tmp = 31 - tmp;
-#endif
-
- if ((b << tmp) > a)
- {
- a -= b << (tmp - 1);
- }
- else
- {
- a -= b << tmp;
- }
- }
-
- return do_31div (a, b).rem;
-}
-#endif /* L_umodsi3 */
-
-#ifdef L_modsi3
-long
-__Mod (long a, long b) __attribute__ ((__const__));
-
-long
-__Mod (long a, long b)
-{
- long sign = 1;
-
- /* We need to handle a == -2147483648 as expected and must while
- doing that avoid producing a sequence like "abs (a) < 0" as GCC
- may optimize out the test. That sequence may not be obvious as
- we call inline functions. Testing for a being negative and
- handling (presumably much rarer than positive) enables us to get
- a bit of optimization for an (accumulated) reduction of the
- penalty of the 0x80000000 special-case. */
- if (a < 0)
- {
- sign = -1;
- if ((a & 0x7fffffff) == 0)
- /* We're at 0x80000000. Tread carefully. */
- a += __builtin_labs (b);
- a = -a;
- }
-
- return sign * do_31div (a, __builtin_labs (b)).rem;
-}
-#endif /* L_modsi3 */
-#endif /* L_udivsi3 || L_divsi3 || L_umodsi3 || L_modsi3 */
-
-/*
- * Local variables:
- * eval: (c-set-style "gnu")
- * indent-tabs-mode: t
- * End:
- */
diff --git a/gcc/config/cris/constraints.md b/gcc/config/cris/constraints.md
new file mode 100644
index 00000000000..42944e73f41
--- /dev/null
+++ b/gcc/config/cris/constraints.md
@@ -0,0 +1,164 @@
+;; Constraint definitions for CRIS.
+;; Copyright (C) 2011 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/>.
+
+;; Register constraints.
+(define_register_constraint "a" "ACR_REGS"
+ "@internal")
+
+(define_register_constraint "b" "GENNONACR_REGS"
+ "@internal")
+
+(define_register_constraint "h" "MOF_REGS"
+ "@internal")
+
+(define_register_constraint "x" "SPECIAL_REGS"
+ "@internal")
+
+(define_register_constraint "c" "CC0_REGS"
+ "@internal")
+
+;; Integer constraints.
+(define_constraint "I"
+ "MOVEQ, CMPQ, ANDQ, ORQ."
+ (and (match_code "const_int")
+ (match_test "IN_RANGE (ival, -32, 31)")))
+
+(define_constraint "J"
+ "ADDQ, SUBQ."
+ (and (match_code "const_int")
+ (match_test "IN_RANGE (ival, 0, 63)")))
+
+(define_constraint "Kc"
+ "ASRQ, BTSTQ, LSRQ, LSLQ."
+ (and (match_code "const_int")
+ (match_test "IN_RANGE (ival, 0, 31)")))
+
+(define_constraint "Kp"
+ "A power of two."
+ (and (match_code "const_int")
+ (match_test "exact_log2 (ival) >= 0")))
+
+(define_constraint "L"
+ "A 16-bit signed number."
+ (and (match_code "const_int")
+ (match_test "IN_RANGE (ival, -32768, 32767)")))
+
+(define_constraint "M"
+ "The constant 0 for CLEAR."
+ (and (match_code "const_int")
+ (match_test "ival == 0")))
+
+(define_constraint "N"
+ "A negative ADDQ or SUBQ."
+ (and (match_code "const_int")
+ (match_test "IN_RANGE (ival, -63, -1)")))
+
+(define_constraint "O"
+ "Quickened ints, QI and HI."
+ (and (match_code "const_int")
+ (ior (match_test "IN_RANGE (ival, (65535 - 31), 65535)")
+ (match_test "IN_RANGE (ival, (255 - 31), 255)"))))
+
+(define_constraint "P"
+ "A 16-bit number signed *or* unsigned."
+ (and (match_code "const_int")
+ (match_test "IN_RANGE (ival, -32768, 65535)")))
+
+;; Floating-point constant constraints.
+(define_constraint "G"
+ "The floating point zero constant"
+ (and (match_code "const_double")
+ (match_test "GET_MODE_CLASS (mode) == MODE_FLOAT")
+ (match_test "op == CONST0_RTX (mode)")))
+
+;; Memory constraints.
+
+;; Just an indirect register (happens to also be "all" slottable
+;; memory addressing modes not covered by other constraints, i.e. '>').
+(define_memory_constraint "Q"
+ "@internal"
+ (and (match_code "mem")
+ (match_test "cris_base_p (XEXP (op, 0), reload_in_progress
+ || reload_completed)")))
+
+;; Extra constraints.
+(define_constraint "R"
+ "An operand to BDAP or BIAP."
+ ;; A BIAP; r.S?
+ (ior (match_test "cris_biap_index_p (op, reload_in_progress
+ || reload_completed)")
+ ;; A [reg] or (int) [reg], maybe with post-increment.
+ (match_test "cris_bdap_index_p (op, reload_in_progress
+ || reload_completed)")
+ (match_test "cris_constant_index_p (op)")))
+
+(define_constraint "T"
+ "Memory three-address operand."
+ ;; All are indirect-memory:
+ (and (match_code "mem")
+ ;; Double indirect: [[reg]] or [[reg+]]?
+ (ior (and (match_code "mem" "0")
+ (match_test "cris_base_or_autoincr_p (XEXP (XEXP (op, 0), 0),
+ reload_in_progress
+ || reload_completed)"))
+ ;; Just an explicit indirect reference: [const]?
+ (match_test "CONSTANT_P (XEXP (op, 0))")
+ ;; Something that is indexed; [...+...]?
+ (and (match_code "plus" "0")
+ ;; A BDAP constant: [reg+(8|16|32)bit offset]?
+ (ior (and (match_test "cris_base_p (XEXP (XEXP (op, 0), 0),
+ reload_in_progress
+ || reload_completed)")
+ (match_test "cris_constant_index_p (XEXP (XEXP (op, 0), 1))"))
+ ;; A BDAP register: [reg+[reg(+)].S]?
+ (and (match_test "cris_base_p (XEXP (XEXP (op, 0), 0),
+ reload_in_progress
+ || reload_completed)")
+ (match_test "cris_bdap_index_p (XEXP (XEXP (op, 0), 1),
+ reload_in_progress
+ || reload_completed)"))
+ ;; Same, but with swapped arguments (no canonical
+ ;; ordering between e.g. REG and MEM as of LAST_UPDATED
+ ;; "Thu May 12 03:59:11 UTC 2005").
+ (and (match_test "cris_base_p (XEXP (XEXP (op, 0), 1),
+ reload_in_progress
+ || reload_completed)")
+ (match_test "cris_bdap_index_p (XEXP (XEXP (op, 0), 0),
+ reload_in_progress
+ || reload_completed)"))
+ ;; A BIAP: [reg+reg.S] (MULT comes first).
+ (and (match_test "cris_base_p (XEXP (XEXP (op, 0), 1),
+ reload_in_progress
+ || reload_completed)")
+ (match_test "cris_biap_index_p (XEXP (XEXP (op, 0), 0),
+ reload_in_progress
+ || reload_completed)")))))))
+
+(define_constraint "S"
+ "PIC-constructs for symbols."
+ (and (match_test "flag_pic")
+ (match_code "const")
+ (match_test "cris_valid_pic_const (op, false)")))
+
+(define_constraint "U"
+ "@internal"
+ (and (match_test "flag_pic")
+ (match_test "CONSTANT_P (op)")
+ (match_operand 0 "cris_nonmemory_operand_or_callable_symbol")))
+
diff --git a/gcc/config/cris/cris.c b/gcc/config/cris/cris.c
index 4a08ae03aee..06568023051 100644
--- a/gcc/config/cris/cris.c
+++ b/gcc/config/cris/cris.c
@@ -40,6 +40,7 @@ along with GCC; see the file COPYING3. If not see
#include "tm_p.h"
#include "debug.h"
#include "output.h"
+#include "tm-constrs.h"
#include "target.h"
#include "target-def.h"
#include "ggc.h"
@@ -703,8 +704,7 @@ cris_print_operand (FILE *file, rtx x, int code)
case 'b':
/* Print the unsigned supplied integer as if it were signed
and < 0, i.e print 255 or 65535 as -1, 254, 65534 as -2, etc. */
- if (!CONST_INT_P (x)
- || !CRIS_CONST_OK_FOR_LETTER_P (INTVAL (x), 'O'))
+ if (!satisfies_constraint_O (x))
LOSE_AND_RETURN ("invalid operand for 'b' modifier", x);
fprintf (file, HOST_WIDE_INT_PRINT_DEC,
INTVAL (x)| (INTVAL (x) <= 255 ? ~255 : ~65535));
@@ -1692,9 +1692,7 @@ cris_normal_notice_update_cc (rtx exp, rtx insn)
&& (REGNO (SET_SRC (exp))
> CRIS_LAST_GENERAL_REGISTER))
|| (TARGET_V32
- && GET_CODE (SET_SRC (exp)) == CONST_INT
- && CRIS_CONST_OK_FOR_LETTER_P (INTVAL (SET_SRC (exp)),
- 'I')))
+ && satisfies_constraint_I (SET_SRC (exp))))
{
/* There's no CC0 change for this case. Just check
for overlap. */
@@ -2037,7 +2035,7 @@ cris_rtx_costs (rtx x, int code, int outer_code, int opno, int *total,
if (CONST_INT_P (XEXP (x, 1))
/* Two constants may actually happen before optimization. */
&& !CONST_INT_P (XEXP (x, 0))
- && !CRIS_CONST_OK_FOR_LETTER_P (INTVAL (XEXP (x, 1)), 'I'))
+ && !satisfies_constraint_I (XEXP (x, 1)))
{
*total
= (rtx_cost (XEXP (x, 0), (enum rtx_code) outer_code,
@@ -2118,8 +2116,7 @@ cris_address_cost (rtx x, bool speed ATTRIBUTE_UNUSED)
/* A BDAP -32768 .. 32767 is like BDAP quick, but with 2 extra
bytes. */
- if (CONST_INT_P (tem2)
- && CRIS_CONST_OK_FOR_LETTER_P (INTVAL (tem2), 'L'))
+ if (satisfies_constraint_L (tem2))
return (2 + 2) / 2;
/* A BDAP with some other constant is 2 bytes extra. */
diff --git a/gcc/config/cris/cris.h b/gcc/config/cris/cris.h
index 62461d65cc5..a9a68b8b3c1 100644
--- a/gcc/config/cris/cris.h
+++ b/gcc/config/cris/cris.h
@@ -84,11 +84,7 @@ extern int cris_cpu_version;
/* Changing the order used to be necessary to put the fourth __make_dp
argument (a DImode parameter) in registers, to fit with the libfunc
parameter passing scheme used for intrinsic functions. FIXME: Check
- performance and maybe remove definition from TARGET_LIBGCC2_CFLAGS now
- that it isn't strictly necessary. We used to do this through
- TARGET_LIBGCC2_CFLAGS, but that became increasingly difficult as the
- parenthesis (that needed quoting) travels through several layers of
- make and shell invocations. */
+ performance. */
#ifdef IN_LIBGCC2
#define __make_dp(a,b,c,d) __cris_make_dp(d,a,b,c)
#endif
@@ -554,16 +550,6 @@ enum reg_class
#define INDEX_REG_CLASS GENERAL_REGS
-#define REG_CLASS_FROM_LETTER(C) \
- ( \
- (C) == 'a' ? ACR_REGS : \
- (C) == 'b' ? GENNONACR_REGS : \
- (C) == 'h' ? MOF_REGS : \
- (C) == 'x' ? SPECIAL_REGS : \
- (C) == 'c' ? CC0_REGS : \
- NO_REGS \
- )
-
/* Since it uses reg_renumber, it is safe only once reg_renumber
has been allocated, which happens in local-alloc.c. */
#define REGNO_OK_FOR_BASE_P(REGNO) \
@@ -613,127 +599,6 @@ enum reg_class
? 1 /* + cris_fatal ("CLASS_MAX_NREGS with VOIDmode") */ \
: ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD))
-/* We are now out of letters; we could use ten more. This forces us to
- use C-code in the 'md' file. FIXME: Use some EXTRA_CONSTRAINTS. */
-#define CRIS_CONST_OK_FOR_LETTER_P(VALUE, C) \
- ( \
- /* MOVEQ, CMPQ, ANDQ, ORQ. */ \
- (C) == 'I' ? (VALUE) >= -32 && (VALUE) <= 31 : \
- /* ADDQ, SUBQ. */ \
- (C) == 'J' ? (VALUE) >= 0 && (VALUE) <= 63 : \
- /* ASRQ, BTSTQ, LSRQ, LSLQ. */ \
- (C) == 'K' ? (VALUE) >= 0 && (VALUE) <= 31 : \
- /* A 16-bit signed number. */ \
- (C) == 'L' ? (VALUE) >= -32768 && (VALUE) <= 32767 : \
- /* The constant 0 for CLEAR. */ \
- (C) == 'M' ? (VALUE) == 0 : \
- /* A negative ADDQ or SUBQ. */ \
- (C) == 'N' ? (VALUE) >= -63 && (VALUE) < 0 : \
- /* Quickened ints, QI and HI. */ \
- (C) == 'O' ? (VALUE) >= 0 && (VALUE) <= 65535 \
- && ((VALUE) >= (65535-31) \
- || ((VALUE) >= (255-31) \
- && (VALUE) <= 255 )) : \
- /* A 16-bit number signed *or* unsigned. */ \
- (C) == 'P' ? (VALUE) >= -32768 && (VALUE) <= 65535 : \
- 0)
-
-#define CONST_OK_FOR_CONSTRAINT_P(VALUE, C, S) \
- ( \
- ((C) != 'K' || (S)[1] == 'c') \
- ? CRIS_CONST_OK_FOR_LETTER_P (VALUE, C) : \
- ((C) == 'K' && (S)[1] == 'p') \
- ? exact_log2 (VALUE) >= 0 : \
- 0)
-
-#define CONSTRAINT_LEN(C, S) ((C) == 'K' ? 2 : DEFAULT_CONSTRAINT_LEN (C, S))
-
-/* It is really simple to make up a 0.0; it is the same as int-0 in
- IEEE754. */
-#define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) \
- ((C) == 'G' && ((VALUE) == CONST0_RTX (DFmode) \
- || (VALUE) == CONST0_RTX (SFmode)))
-
-/* We need this on cris to distinguish delay-slottable addressing modes. */
-#define EXTRA_CONSTRAINT(X, C) \
- ( \
- /* Slottable address mode? */ \
- (C) == 'Q' ? EXTRA_CONSTRAINT_Q (X) : \
- /* Operand to BDAP or BIAP? */ \
- (C) == 'R' ? EXTRA_CONSTRAINT_R (X) : \
- /* A local PIC symbol? */ \
- (C) == 'S' ? EXTRA_CONSTRAINT_S (X) : \
- /* A three-address addressing-mode? */ \
- (C) == 'T' ? EXTRA_CONSTRAINT_T (X) : \
- /* A PLT symbol? */ \
- (C) == 'U' ? EXTRA_CONSTRAINT_U (X) : \
- 0)
-
-#define EXTRA_MEMORY_CONSTRAINT(X, STR) ((X) == 'Q')
-
-#define EXTRA_CONSTRAINT_Q(X) \
- ( \
- /* Just an indirect register (happens to also be \
- "all" slottable memory addressing modes not \
- covered by other constraints, i.e. '>'). */ \
- MEM_P (X) \
- && cris_base_p (XEXP (X, 0), reload_in_progress || reload_completed) \
- )
-
-#define EXTRA_CONSTRAINT_R(X) \
- ( \
- /* An operand to BDAP or BIAP: \
- A BIAP; r.S? */ \
- cris_biap_index_p (X, reload_in_progress || reload_completed) \
- /* A [reg] or (int) [reg], maybe with post-increment. */ \
- || cris_bdap_index_p (X, reload_in_progress || reload_completed) \
- || cris_constant_index_p (X) \
- )
-
-#define EXTRA_CONSTRAINT_T(X) \
- ( \
- /* Memory three-address operand. All are indirect-memory: */ \
- MEM_P (X) \
- && ((MEM_P (XEXP (X, 0)) \
- /* Double indirect: [[reg]] or [[reg+]]? */ \
- && (cris_base_or_autoincr_p (XEXP (XEXP (X, 0), 0), \
- reload_in_progress || reload_completed))) \
- /* Just an explicit indirect reference: [const]? */ \
- || CONSTANT_P (XEXP (X, 0)) \
- /* Something that is indexed; [...+...]? */ \
- || (GET_CODE (XEXP (X, 0)) == PLUS \
- /* A BDAP constant: [reg+(8|16|32)bit offset]? */ \
- && ((cris_base_p (XEXP (XEXP (X, 0), 0), \
- reload_in_progress || reload_completed) \
- && cris_constant_index_p (XEXP (XEXP (X, 0), 1))) \
- /* A BDAP register: [reg+[reg(+)].S]? */ \
- || (cris_base_p (XEXP (XEXP (X, 0), 0), \
- reload_in_progress || reload_completed) \
- && cris_bdap_index_p (XEXP(XEXP(X, 0), 1), \
- reload_in_progress || reload_completed)) \
- /* Same, but with swapped arguments (no canonical \
- ordering between e.g. REG and MEM as of LAST_UPDATED \
- "Thu May 12 03:59:11 UTC 2005"). */ \
- || (cris_base_p (XEXP (XEXP (X, 0), 1), \
- reload_in_progress | reload_completed) \
- && cris_bdap_index_p (XEXP (XEXP (X, 0), 0), \
- reload_in_progress || reload_completed)) \
- /* A BIAP: [reg+reg.S] (MULT comes first). */ \
- || (cris_base_p (XEXP (XEXP (X, 0), 1), \
- reload_in_progress || reload_completed) \
- && cris_biap_index_p (XEXP (XEXP (X, 0), 0), \
- reload_in_progress || reload_completed))))) \
- )
-
-/* PIC-constructs for symbols. */
-#define EXTRA_CONSTRAINT_S(X) \
- (flag_pic && GET_CODE (X) == CONST && cris_valid_pic_const (X, false))
-
-#define EXTRA_CONSTRAINT_U(X) \
- (flag_pic \
- && CONSTANT_P (X) \
- && cris_nonmemory_operand_or_callable_symbol (X, VOIDmode))
-
/* Node: Frame Layout */
diff --git a/gcc/config/cris/cris.md b/gcc/config/cris/cris.md
index 428132c2eb4..53525940109 100644
--- a/gcc/config/cris/cris.md
+++ b/gcc/config/cris/cris.md
@@ -242,6 +242,7 @@
;; Operand and operator predicates.
(include "predicates.md")
+(include "constraints.md")
;; Test insns.
@@ -650,8 +651,8 @@
&& (!CONST_INT_P (operands[2])
|| INTVAL (operands[2]) > 127
|| INTVAL (operands[2]) < -128
- || CRIS_CONST_OK_FOR_LETTER_P (INTVAL (operands[2]), 'N')
- || CRIS_CONST_OK_FOR_LETTER_P (INTVAL (operands[2]), 'J')))
+ || satisfies_constraint_N (operands[2])
+ || satisfies_constraint_J (operands[2])))
return "#";
if (which_alternative == 4)
return "move<m> [%3=%2%S1],%0";
@@ -677,8 +678,8 @@
&& (!CONST_INT_P (operands[2])
|| INTVAL (operands[2]) > 127
|| INTVAL (operands[2]) < -128
- || CRIS_CONST_OK_FOR_LETTER_P (INTVAL (operands[2]), 'N')
- || CRIS_CONST_OK_FOR_LETTER_P (INTVAL (operands[2]), 'J')))
+ || satisfies_constraint_N (operands[2])
+ || satisfies_constraint_J (operands[2])))
return "#";
if (which_alternative < 3)
return "move.%s0 [%3=%1%S2],%0";
@@ -796,8 +797,8 @@
&& (!CONST_INT_P (operands[1])
|| INTVAL (operands[1]) > 127
|| INTVAL (operands[1]) < -128
- || CRIS_CONST_OK_FOR_LETTER_P (INTVAL (operands[1]), 'N')
- || CRIS_CONST_OK_FOR_LETTER_P (INTVAL (operands[1]), 'J')))
+ || satisfies_constraint_N (operands[1])
+ || satisfies_constraint_J (operands[1])))
return "#";
if (which_alternative == 1 || which_alternative == 5)
return "#";
@@ -830,8 +831,8 @@
&& (!CONST_INT_P (operands[1])
|| INTVAL (operands[1]) > 127
|| INTVAL (operands[1]) < -128
- || CRIS_CONST_OK_FOR_LETTER_P (INTVAL (operands[1]), 'N')
- || CRIS_CONST_OK_FOR_LETTER_P (INTVAL (operands[1]), 'J')))
+ || satisfies_constraint_N (operands[1])
+ || satisfies_constraint_J (operands[1])))
return "#";
if (which_alternative == 1
|| which_alternative == 7
@@ -903,8 +904,8 @@
&& (!CONST_INT_P (operands[1])
|| INTVAL (operands[1]) > 127
|| INTVAL (operands[1]) < -128
- || CRIS_CONST_OK_FOR_LETTER_P (INTVAL (operands[1]), 'N')
- || CRIS_CONST_OK_FOR_LETTER_P (INTVAL (operands[1]), 'J')))
+ || satisfies_constraint_N (operands[1])
+ || satisfies_constraint_J (operands[1])))
return "#";
if (which_alternative == 4)
return "clear<m> [%2=%1%S0]";
@@ -1246,8 +1247,8 @@
&& (!CONST_INT_P (operands[2])
|| INTVAL (operands[2]) > 127
|| INTVAL (operands[2]) < -128
- || CRIS_CONST_OK_FOR_LETTER_P (INTVAL (operands[2]), 'N')
- || CRIS_CONST_OK_FOR_LETTER_P (INTVAL (operands[2]), 'J')))
+ || satisfies_constraint_N (operands[2])
+ || satisfies_constraint_J (operands[2])))
return "#";
if (which_alternative == 4)
return "mov%e4.%m4 [%3=%2%S1],%0";
@@ -1270,8 +1271,8 @@
&& (!CONST_INT_P (operands[2])
|| INTVAL (operands[2]) > 127
|| INTVAL (operands[2]) < -128
- || CRIS_CONST_OK_FOR_LETTER_P (INTVAL (operands[2]), 'N')
- || CRIS_CONST_OK_FOR_LETTER_P (INTVAL (operands[2]), 'J')))
+ || satisfies_constraint_N (operands[2])
+ || satisfies_constraint_J (operands[2])))
return "#";
if (which_alternative == 4)
return "mov%e4<m> [%3=%2%S1],%0";
@@ -1607,8 +1608,8 @@
&& (!CONST_INT_P (operands[3])
|| INTVAL (operands[3]) > 127
|| INTVAL (operands[3]) < -128
- || CRIS_CONST_OK_FOR_LETTER_P (INTVAL (operands[3]), 'N')
- || CRIS_CONST_OK_FOR_LETTER_P (INTVAL (operands[3]), 'J')))
+ || satisfies_constraint_N (operands[3])
+ || satisfies_constraint_J (operands[3])))
return "#";
if (which_alternative == 4)
return "%x5.%s0 [%4=%3%S2],%0";
@@ -1665,8 +1666,8 @@
&& (!CONST_INT_P (operands[3])
|| INTVAL (operands[3]) > 127
|| INTVAL (operands[3]) < -128
- || CRIS_CONST_OK_FOR_LETTER_P (INTVAL (operands[3]), 'N')
- || CRIS_CONST_OK_FOR_LETTER_P (INTVAL (operands[3]), 'J')))
+ || satisfies_constraint_N (operands[3])
+ || satisfies_constraint_J (operands[3])))
return "#";
if (which_alternative == 4)
return "%x5<m> [%4=%3%S2],%0";
@@ -2097,8 +2098,8 @@
&& (!CONST_INT_P (operands[3])
|| INTVAL (operands[3]) > 127
|| INTVAL (operands[3]) < -128
- || CRIS_CONST_OK_FOR_LETTER_P (INTVAL (operands[3]), 'N')
- || CRIS_CONST_OK_FOR_LETTER_P (INTVAL (operands[3]), 'J')))
+ || satisfies_constraint_N (operands[3])
+ || satisfies_constraint_J (operands[3])))
return "#";
if (which_alternative == 4)
return "%x5%E6.%m6 [%4=%3%S2],%0";
@@ -2126,8 +2127,8 @@
&& (!CONST_INT_P (operands[3])
|| INTVAL (operands[3]) > 127
|| INTVAL (operands[3]) < -128
- || CRIS_CONST_OK_FOR_LETTER_P (INTVAL (operands[3]), 'N')
- || CRIS_CONST_OK_FOR_LETTER_P (INTVAL (operands[3]), 'J')))
+ || satisfies_constraint_N (operands[3])
+ || satisfies_constraint_J (operands[3])))
return "#";
if (which_alternative == 4)
return "%x5%E6<m> [%4=%3%S2],%0";
@@ -2206,8 +2207,8 @@
&& (!CONST_INT_P (operands[3])
|| INTVAL (operands[3]) > 127
|| INTVAL (operands[3]) < -128
- || CRIS_CONST_OK_FOR_LETTER_P (INTVAL (operands[3]), 'N')
- || CRIS_CONST_OK_FOR_LETTER_P (INTVAL (operands[3]), 'J')))
+ || satisfies_constraint_N (operands[3])
+ || satisfies_constraint_J (operands[3])))
return "#";
if (which_alternative == 4)
return "add%e5.b [%4=%3%S2],%0";
@@ -2234,8 +2235,8 @@
&& (!CONST_INT_P (operands[3])
|| INTVAL (operands[3]) > 127
|| INTVAL (operands[3]) < -128
- || CRIS_CONST_OK_FOR_LETTER_P (INTVAL (operands[3]), 'N')
- || CRIS_CONST_OK_FOR_LETTER_P (INTVAL (operands[3]), 'J')))
+ || satisfies_constraint_N (operands[3])
+ || satisfies_constraint_J (operands[3])))
return "#";
if (which_alternative == 4)
return \"%x6%E5.%m5 [%4=%3%S2],%0\";
@@ -4681,8 +4682,8 @@
"GET_MODE_SIZE (GET_MODE (operands[4])) <= UNITS_PER_WORD
&& REGNO (operands[3]) != REGNO (operands[0])
&& (cris_base_p (operands[1], true) || cris_base_p (operands[2], true))
- && !CRIS_CONST_OK_FOR_LETTER_P (INTVAL (operands[2]), 'J')
- && !CRIS_CONST_OK_FOR_LETTER_P (INTVAL (operands[2]), 'N')
+ && !satisfies_constraint_J (operands[2])
+ && !satisfies_constraint_N (operands[2])
&& (INTVAL (operands[2]) >= -128 && INTVAL (operands[2]) < 128)
&& TARGET_SIDE_EFFECT_PREFIXES"
[(parallel
@@ -4717,8 +4718,8 @@
"GET_MODE_SIZE (GET_MODE (operands[4])) <= UNITS_PER_WORD
&& REGNO (operands[4]) != REGNO (operands[0])
&& (cris_base_p (operands[1], true) || cris_base_p (operands[2], true))
- && !CRIS_CONST_OK_FOR_LETTER_P (INTVAL (operands[2]), 'J')
- && !CRIS_CONST_OK_FOR_LETTER_P (INTVAL (operands[2]), 'N')
+ && !satisfies_constraint_J (operands[2])
+ && !satisfies_constraint_N (operands[2])
&& (INTVAL (operands[2]) >= -128 && INTVAL (operands[2]) < 128)
&& TARGET_SIDE_EFFECT_PREFIXES"
[(parallel
@@ -4755,8 +4756,8 @@
;; Change to GET_MODE_SIZE (GET_MODE (operands[3])) <= UNITS_PER_WORD?
"GET_MODE (operands[3]) != DImode
&& REGNO (operands[0]) != REGNO (operands[3])
- && !CRIS_CONST_OK_FOR_LETTER_P (INTVAL (operands[2]), 'J')
- && !CRIS_CONST_OK_FOR_LETTER_P (INTVAL (operands[2]), 'N')
+ && !satisfies_constraint_J (operands[2])
+ && !satisfies_constraint_N (operands[2])
&& INTVAL (operands[2]) >= -128
&& INTVAL (operands[2]) <= 127
&& TARGET_SIDE_EFFECT_PREFIXES"
@@ -4947,7 +4948,7 @@
;; don't do this for a mem-volatile access.
"REGNO (operands[2]) == REGNO (operands[0])
&& INTVAL (operands[3]) <= 65535 && INTVAL (operands[3]) >= 0
- && !CRIS_CONST_OK_FOR_LETTER_P (INTVAL (operands[3]), 'I')
+ && !satisfies_constraint_I (operands[3])
&& !side_effects_p (operands[1])
&& (!REG_P (operands[1])
|| REGNO (operands[1]) <= CRIS_LAST_GENERAL_REGISTER)"
@@ -4957,7 +4958,7 @@
{
enum machine_mode zmode = INTVAL (operands[3]) <= 255 ? QImode : HImode;
enum machine_mode amode
- = CRIS_CONST_OK_FOR_LETTER_P (INTVAL (operands[3]), 'O') ? SImode : zmode;
+ = satisfies_constraint_O (operands[3]) ? SImode : zmode;
rtx op1
= (REG_S_P (operands[1])
? gen_rtx_REG (zmode, REGNO (operands[1]))
diff --git a/gcc/config/cris/cris_abi_symbol.c b/gcc/config/cris/cris_abi_symbol.c
deleted file mode 100644
index db9db2cfe56..00000000000
--- a/gcc/config/cris/cris_abi_symbol.c
+++ /dev/null
@@ -1,45 +0,0 @@
-/* Define symbol to recognize CRIS ABI version 2, for a.out use.
- Contributed by Axis Communications.
- Written by Hans-Peter Nilsson <hp@axis.se>, c:a 1992.
-
- Copyright (C) 2000, 2001, 2003, 2009 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.
-
-This file is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-Under Section 7 of GPL version 3, you are granted additional
-permissions described in the GCC Runtime Library Exception, version
-3.1, as published by the Free Software Foundation.
-
-You should have received a copy of the GNU General Public License and
-a copy of the GCC Runtime Library Exception along with this program;
-see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
-<http://www.gnu.org/licenses/>. */
-
-#include "tconfig.h"
-#include "tm.h"
-
-#ifdef __AOUT__
-
-/* ELF support was not released before the ABI was changed, so we
- restrict this awkwardness to a.out. This symbol is for gdb to
- recognize, so it can debug both old and new programs successfully. */
-__asm__ (".global " CRIS_ABI_VERSION_SYMBOL_STRING);
-__asm__ (".set " CRIS_ABI_VERSION_SYMBOL_STRING ",0");
-
-#else /* not __AOUT__ */
-
-/* The file must not be empty (declaration/definition-wise) according to
- ISO, IIRC. */
-extern int _Dummy;
-
-#endif /* not __AOUT__ */
diff --git a/gcc/config/cris/libgcc.ver b/gcc/config/cris/libgcc.ver
deleted file mode 100644
index e35de83100f..00000000000
--- a/gcc/config/cris/libgcc.ver
+++ /dev/null
@@ -1,7 +0,0 @@
-GCC_4.3 {
- __Mul
- __Div
- __Udiv
- __Mod
- __Umod
-}
diff --git a/gcc/config/cris/mulsi3.asm b/gcc/config/cris/mulsi3.asm
deleted file mode 100644
index 76dfb634680..00000000000
--- a/gcc/config/cris/mulsi3.asm
+++ /dev/null
@@ -1,255 +0,0 @@
-;; Copyright (C) 2001, 2004 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/>.
-;;
-;; This code used to be expanded through interesting expansions in
-;; the machine description, compiled from this code:
-;;
-;; #ifdef L_mulsi3
-;; long __Mul (unsigned long a, unsigned long b) __attribute__ ((__const__));
-;;
-;; /* This must be compiled with the -mexpand-mul flag, to synthesize the
-;; multiplication from the mstep instructions. The check for
-;; smaller-size multiplication pays off in the order of .5-10%;
-;; estimated median 1%, depending on application.
-;; FIXME: It can be further optimized if we go to assembler code, as
-;; gcc 2.7.2 adds a few unnecessary instructions and does not put the
-;; basic blocks in optimal order. */
-;; long
-;; __Mul (unsigned long a, unsigned long b)
-;; {
-;; #if defined (__CRIS_arch_version) && __CRIS_arch_version >= 10
-;; /* In case other code is compiled without -march=v10, they will
-;; contain calls to __Mul, regardless of flags at link-time. The
-;; "else"-code below will work, but is unnecessarily slow. This
-;; sometimes cuts a few minutes off from simulation time by just
-;; returning a "mulu.d". */
-;; return a * b;
-;; #else
-;; unsigned long min;
-;;
-;; /* Get minimum via the bound insn. */
-;; min = a < b ? a : b;
-;;
-;; /* Can we omit computation of the high part? */
-;; if (min > 65535)
-;; /* No. Perform full multiplication. */
-;; return a * b;
-;; else
-;; {
-;; /* Check if both operands are within 16 bits. */
-;; unsigned long max;
-;;
-;; /* Get maximum, by knowing the minimum.
-;; This will partition a and b into max and min.
-;; This is not currently something GCC understands,
-;; so do this trick by asm. */
-;; __asm__ ("xor %1,%0\n\txor %2,%0"
-;; : "=r" (max)
-;; : "r" (b), "r" (a), "0" (min));
-;;
-;; if (max > 65535)
-;; /* Make GCC understand that only the low part of "min" will be
-;; used. */
-;; return max * (unsigned short) min;
-;; else
-;; /* Only the low parts of both operands are necessary. */
-;; return ((unsigned short) max) * (unsigned short) min;
-;; }
-;; #endif /* not __CRIS_arch_version >= 10 */
-;; }
-;; #endif /* L_mulsi3 */
-;;
-;; That approach was abandoned since the caveats outweighted the
-;; benefits. The expand-multiplication machinery is also removed, so you
-;; can't do this anymore.
-;;
-;; For doubters of there being any benefits, some where: insensitivity to:
-;; - ABI changes (mostly for experimentation)
-;; - assembler syntax differences (mostly debug format).
-;; - insn scheduling issues.
-;; Most ABI experiments will presumably happen with arches with mul insns,
-;; so that argument doesn't really hold anymore, and it's unlikely there
-;; being new arch variants needing insn scheduling and not having mul
-;; insns.
-
-;; ELF and a.out have different syntax for local labels: the "wrong"
-;; one may not be omitted from the object.
-#undef L
-#ifdef __AOUT__
-# define L(x) x
-#else
-# define L(x) .x
-#endif
-
- .global ___Mul
- .type ___Mul,@function
-___Mul:
-#if defined (__CRIS_arch_version) && __CRIS_arch_version >= 10
-;; Can't have the mulu.d last on a cache-line (in the delay-slot of the
-;; "ret"), due to hardware bug. See documentation for -mmul-bug-workaround.
-;; Not worthwhile to conditionalize here.
- .p2alignw 2,0x050f
- mulu.d $r11,$r10
- ret
- nop
-#else
- move.d $r10,$r12
- move.d $r11,$r9
- bound.d $r12,$r9
- cmpu.w 65535,$r9
- bls L(L3)
- move.d $r12,$r13
-
- movu.w $r11,$r9
- lslq 16,$r13
- mstep $r9,$r13
- mstep $r9,$r13
- mstep $r9,$r13
- mstep $r9,$r13
- mstep $r9,$r13
- mstep $r9,$r13
- mstep $r9,$r13
- mstep $r9,$r13
- mstep $r9,$r13
- mstep $r9,$r13
- mstep $r9,$r13
- mstep $r9,$r13
- mstep $r9,$r13
- mstep $r9,$r13
- mstep $r9,$r13
- mstep $r9,$r13
- clear.w $r10
- test.d $r10
- mstep $r9,$r10
- mstep $r9,$r10
- mstep $r9,$r10
- mstep $r9,$r10
- mstep $r9,$r10
- mstep $r9,$r10
- mstep $r9,$r10
- mstep $r9,$r10
- mstep $r9,$r10
- mstep $r9,$r10
- mstep $r9,$r10
- mstep $r9,$r10
- mstep $r9,$r10
- mstep $r9,$r10
- mstep $r9,$r10
- mstep $r9,$r10
- movu.w $r12,$r12
- move.d $r11,$r9
- clear.w $r9
- test.d $r9
- mstep $r12,$r9
- mstep $r12,$r9
- mstep $r12,$r9
- mstep $r12,$r9
- mstep $r12,$r9
- mstep $r12,$r9
- mstep $r12,$r9
- mstep $r12,$r9
- mstep $r12,$r9
- mstep $r12,$r9
- mstep $r12,$r9
- mstep $r12,$r9
- mstep $r12,$r9
- mstep $r12,$r9
- mstep $r12,$r9
- mstep $r12,$r9
- add.w $r9,$r10
- lslq 16,$r10
- ret
- add.d $r13,$r10
-
-L(L3):
- move.d $r9,$r10
- xor $r11,$r10
- xor $r12,$r10
- cmpu.w 65535,$r10
- bls L(L5)
- movu.w $r9,$r13
-
- movu.w $r13,$r13
- move.d $r10,$r9
- lslq 16,$r9
- mstep $r13,$r9
- mstep $r13,$r9
- mstep $r13,$r9
- mstep $r13,$r9
- mstep $r13,$r9
- mstep $r13,$r9
- mstep $r13,$r9
- mstep $r13,$r9
- mstep $r13,$r9
- mstep $r13,$r9
- mstep $r13,$r9
- mstep $r13,$r9
- mstep $r13,$r9
- mstep $r13,$r9
- mstep $r13,$r9
- mstep $r13,$r9
- clear.w $r10
- test.d $r10
- mstep $r13,$r10
- mstep $r13,$r10
- mstep $r13,$r10
- mstep $r13,$r10
- mstep $r13,$r10
- mstep $r13,$r10
- mstep $r13,$r10
- mstep $r13,$r10
- mstep $r13,$r10
- mstep $r13,$r10
- mstep $r13,$r10
- mstep $r13,$r10
- mstep $r13,$r10
- mstep $r13,$r10
- mstep $r13,$r10
- mstep $r13,$r10
- lslq 16,$r10
- ret
- add.d $r9,$r10
-
-L(L5):
- movu.w $r9,$r9
- lslq 16,$r10
- mstep $r9,$r10
- mstep $r9,$r10
- mstep $r9,$r10
- mstep $r9,$r10
- mstep $r9,$r10
- mstep $r9,$r10
- mstep $r9,$r10
- mstep $r9,$r10
- mstep $r9,$r10
- mstep $r9,$r10
- mstep $r9,$r10
- mstep $r9,$r10
- mstep $r9,$r10
- mstep $r9,$r10
- mstep $r9,$r10
- ret
- mstep $r9,$r10
-#endif
-L(Lfe1):
- .size ___Mul,L(Lfe1)-___Mul
diff --git a/gcc/config/cris/t-cris b/gcc/config/cris/t-cris
index 19d44ce8320..fdaa54e5ce3 100644
--- a/gcc/config/cris/t-cris
+++ b/gcc/config/cris/t-cris
@@ -25,17 +25,5 @@
# section "Target Fragment" in the gcc info-files (or the paper copy) of
# "Using and Porting GCC"
-LIB2FUNCS_EXTRA = _udivsi3.c _divsi3.c _umodsi3.c _modsi3.c
-CRIS_LIB1CSRC = $(srcdir)/config/cris/arit.c
-
-# The fixed-point arithmetic code is in one file, arit.c,
-# similar to libgcc2.c (or the old libgcc1.c). We need to
-# "split it up" with one file per define.
-$(LIB2FUNCS_EXTRA): $(CRIS_LIB1CSRC)
- name=`echo $@ | sed -e 's,.*/,,' | sed -e 's,.c$$,,'`; \
- echo "#define L$$name" > tmp-$@ \
- && echo '#include "$<"' >> tmp-$@ \
- && mv -f tmp-$@ $@
-
$(out_object_file): gt-cris.h
gt-cris.h : s-gtype ; @true
diff --git a/gcc/config/cris/t-elfmulti b/gcc/config/cris/t-elfmulti
index 90eeaaedf44..29ed57dec2f 100644
--- a/gcc/config/cris/t-elfmulti
+++ b/gcc/config/cris/t-elfmulti
@@ -16,7 +16,6 @@
# along with GCC; see the file COPYING3. If not see
# <http://www.gnu.org/licenses/>.
-LIB2FUNCS_STATIC_EXTRA = $(srcdir)/config/cris/mulsi3.asm
MULTILIB_OPTIONS = march=v10/march=v32
MULTILIB_DIRNAMES = v10 v32
MULTILIB_MATCHES = \
@@ -29,6 +28,3 @@ MULTILIB_MATCHES = \
march?v10=mcpu?v10 \
march?v32=mcpu?v32
MULTILIB_EXTRA_OPTS = mbest-lib-options
-INSTALL_LIBGCC = install-multilib
-LIBGCC = stmp-multilib
-CRTSTUFF_T_CFLAGS = -moverride-best-lib-options
diff --git a/gcc/config/cris/t-linux b/gcc/config/cris/t-linux
index 96e861a4283..71a964936db 100644
--- a/gcc/config/cris/t-linux
+++ b/gcc/config/cris/t-linux
@@ -1,7 +1,3 @@
-TARGET_LIBGCC2_CFLAGS += -fPIC
-CRTSTUFF_T_CFLAGS_S = $(TARGET_LIBGCC2_CFLAGS)
-SHLIB_MAPFILES += $(srcdir)/config/cris/libgcc.ver
-
# We *know* we have a limits.h in the glibc library, with extra
# definitions needed for e.g. libgfortran.
ifneq ($(inhibit_libc),true)
diff --git a/gcc/config/darwin-64.c b/gcc/config/darwin-64.c
deleted file mode 100644
index a012e9dbc1e..00000000000
--- a/gcc/config/darwin-64.c
+++ /dev/null
@@ -1,72 +0,0 @@
-/* Functions shipped in the ppc64 and x86_64 version of libgcc_s.1.dylib
- in older Mac OS X versions, preserved for backwards compatibility.
- Copyright (C) 2006, 2009 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 (__ppc64__) || defined (__x86_64__)
-/* Many of these functions have probably never been used by anyone
- anywhere on these targets, but it's hard to prove this, so they're defined
- here. None are actually necessary, as demonstrated below by defining
- each function using the operation it implements. */
-
-typedef long DI;
-typedef unsigned long uDI;
-typedef int SI;
-typedef unsigned int uSI;
-typedef int word_type __attribute__ ((mode (__word__)));
-
-DI __ashldi3 (DI x, word_type c);
-DI __ashrdi3 (DI x, word_type c);
-int __clzsi2 (uSI x);
-word_type __cmpdi2 (DI x, DI y);
-int __ctzsi2 (uSI x);
-DI __divdi3 (DI x, DI y);
-uDI __lshrdi3 (uDI x, word_type c);
-DI __moddi3 (DI x, DI y);
-DI __muldi3 (DI x, DI y);
-DI __negdi2 (DI x);
-int __paritysi2 (uSI x);
-int __popcountsi2 (uSI x);
-word_type __ucmpdi2 (uDI x, uDI y);
-uDI __udivdi3 (uDI x, uDI y);
-uDI __udivmoddi4 (uDI x, uDI y, uDI *r);
-uDI __umoddi3 (uDI x, uDI y);
-
-DI __ashldi3 (DI x, word_type c) { return x << c; }
-DI __ashrdi3 (DI x, word_type c) { return x >> c; }
-int __clzsi2 (uSI x) { return __builtin_clz (x); }
-word_type __cmpdi2 (DI x, DI y) { return x < y ? 0 : x == y ? 1 : 2; }
-int __ctzsi2 (uSI x) { return __builtin_ctz (x); }
-DI __divdi3 (DI x, DI y) { return x / y; }
-uDI __lshrdi3 (uDI x, word_type c) { return x >> c; }
-DI __moddi3 (DI x, DI y) { return x % y; }
-DI __muldi3 (DI x, DI y) { return x * y; }
-DI __negdi2 (DI x) { return -x; }
-int __paritysi2 (uSI x) { return __builtin_parity (x); }
-int __popcountsi2 (uSI x) { return __builtin_popcount (x); }
-word_type __ucmpdi2 (uDI x, uDI y) { return x < y ? 0 : x == y ? 1 : 2; }
-uDI __udivdi3 (uDI x, uDI y) { return x / y; }
-uDI __udivmoddi4 (uDI x, uDI y, uDI *r) { *r = x % y; return x / y; }
-uDI __umoddi3 (uDI x, uDI y) { return x % y; }
-
-#endif /* __ppc64__ || __x86_64__ */
diff --git a/gcc/config/divmod.c b/gcc/config/divmod.c
deleted file mode 100644
index c227b99ccd2..00000000000
--- a/gcc/config/divmod.c
+++ /dev/null
@@ -1,73 +0,0 @@
-/* Copyright (C) 2000 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/>. */
-
-long udivmodsi4 ();
-
-long
-__divsi3 (long a, long b)
-{
- int neg = 0;
- long res;
-
- if (a < 0)
- {
- a = -a;
- neg = !neg;
- }
-
- if (b < 0)
- {
- b = -b;
- neg = !neg;
- }
-
- res = udivmodsi4 (a, b, 0);
-
- if (neg)
- res = -res;
-
- return res;
-}
-
-long
-__modsi3 (long a, long b)
-{
- int neg = 0;
- long res;
-
- if (a < 0)
- {
- a = -a;
- neg = 1;
- }
-
- if (b < 0)
- b = -b;
-
- res = udivmodsi4 (a, b, 1);
-
- if (neg)
- res = -res;
-
- return res;
-}
diff --git a/gcc/config/epiphany/constraints.md b/gcc/config/epiphany/constraints.md
new file mode 100644
index 00000000000..d7c6c17845d
--- /dev/null
+++ b/gcc/config/epiphany/constraints.md
@@ -0,0 +1,125 @@
+;; Constraint definitions for Adaptiva epiphany
+;; Copyright (C) 2007, 2009, 2011 Free Software Foundation, Inc.
+;; Contributed by Embecosm on behalf of Adapteva, 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/>.
+
+;; Integer constraints
+
+(define_constraint "U16"
+ "An unsigned 16-bit constant."
+ (ior (and (match_code "const_int")
+ (match_test "IMM16 (ival)"))
+ (and (match_code "symbol_ref,label_ref,const")
+ (match_test "epiphany_small16 (op)"))))
+
+(define_constraint "K"
+ "An unsigned 5-bit constant."
+ (and (match_code "const_int")
+ (match_test "IMM5 (ival)")))
+
+;; This could also accept symbol_ref, label_ref or const if we introduce
+;; a small area and/or attribute that satisfies the 11-bit signed range.
+(define_constraint "L"
+ "A signed 11-bit constant."
+ (and (match_code "const_int")
+ (match_test "SIMM11 (ival)")))
+
+(define_constraint "Cm1"
+ "A signed 11-bit constant added to -1"
+ (and (match_code "const_int")
+ (match_test "SIMM11 (ival+1)")
+ (match_test "epiphany_m1reg >= 0")))
+
+(define_constraint "Cl1"
+ "Left-shift of -1"
+ (and (match_code "const_int")
+ (match_test "ival == (ival | ~(ival-1))")
+ (match_test "epiphany_m1reg >= 0")))
+
+(define_constraint "Cr1"
+ "Right-shift of -1"
+ (and (match_code "const_int")
+ (match_test "ival == (ival & ~(ival+1))")
+ (match_test "epiphany_m1reg >= 0")))
+
+(define_constraint "Cal"
+ "Constant for arithmetic/logical operations"
+ (match_test "(flag_pic
+ ? nonsymbolic_immediate_operand (op, VOIDmode)
+ : immediate_operand (op, VOIDmode))"))
+
+(define_constraint "Csy"
+ "Symbolic constant for call/jump instruction"
+ (match_test "symbolic_operand (op, VOIDmode)"))
+
+;; Register constraints
+;; proper register constraints define a register class and can thus
+;; drive register allocation and reload. OTOH sometimes we want to
+;; avoid just that.
+
+;; The register class usable in short insns.
+;; Subject to TARGET_PREFER_SHORT_INSN_REGS.
+(define_register_constraint "Rcs" "SHORT_INSN_REGS"
+ "short insn register class.")
+
+; The registers that can be used to hold a sibcall call address.
+; This must not conflict with any callee-saved registers.
+(define_register_constraint "Rsc" "SIBCALL_REGS"
+ "sibcall register class")
+
+; The registers that can be used to hold a status value
+(define_register_constraint "Rct" "CORE_CONTROL_REGS"
+ "Core control register class")
+
+;; The register group usable in short insns.
+(define_constraint "Rgs"
+ "short insn register group."
+ (and (match_code "reg")
+ (match_test "REGNO (op) >= FIRST_PSEUDO_REGISTER || REGNO (op) <= 7")))
+
+;; Constant suitable for the addsi3_r pattern.
+(define_constraint "Car"
+ "addsi3_r constant."
+ (and (match_code "const_int")
+ (ior (match_test "RTX_OK_FOR_OFFSET_P (SImode, op)")
+ (match_test "RTX_OK_FOR_OFFSET_P (HImode, op)")
+ (match_test "RTX_OK_FOR_OFFSET_P (QImode, op)"))))
+
+;; The return address if it can be replaced with GPR_LR.
+(define_constraint "Rra"
+ "return address constraint - register variant"
+ (and (match_code "unspec")
+ (match_test "XINT (op, 1) == UNSPEC_RETURN_ADDR")
+ (match_test "!MACHINE_FUNCTION (cfun)->lr_clobbered")))
+
+(define_constraint "Rcc"
+ "integer condition code"
+ (and (match_code "reg")
+ (match_test "REGNO (op) == CC_REGNUM")))
+
+;; The return address, which might be a stack slot. */
+(define_constraint "Sra"
+ "return address constraint - memory variant"
+ (and (match_code "unspec")
+ (match_test "XINT (op, 1) == UNSPEC_RETURN_ADDR")))
+
+(define_constraint "Cfm"
+ "control register values to switch fp mode"
+ (and (match_code "const")
+ (match_test "GET_CODE (XEXP (op, 0)) == UNSPEC")
+ (match_test "XINT (XEXP (op, 0), 1) == UNSPEC_FP_MODE")))
diff --git a/gcc/config/epiphany/epiphany-modes.def b/gcc/config/epiphany/epiphany-modes.def
new file mode 100644
index 00000000000..c8375a1d75b
--- /dev/null
+++ b/gcc/config/epiphany/epiphany-modes.def
@@ -0,0 +1,40 @@
+/* Definitions of target machine for GNU compiler, Adapteva Epiphany cpu.
+ Copyright (C) 2002, 2007, 2009, 2011 Free Software Foundation, Inc.
+ Contributed by Embecosm on behalf of Adapteva, 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/>. */
+
+CC_MODE (CC_Z); /* only Z valid - for add, testing result. */
+CC_MODE (CC_N_NE); /* N for not-equal (for lsl). */
+CC_MODE (CC_C_LTU); /* C for unsigned-less-than (for add with carry). */
+CC_MODE (CC_C_GTU); /* C for unsigned-greater-than (for sub with carry). */
+CC_MODE (CC_FP);
+CC_MODE (CC_FP_EQ); /* AZ for equal. */
+CC_MODE (CC_FP_ORD); /* AZ || ~AC for ordered. */
+CC_MODE (CC_FP_UNEQ); /* AZ || ~AC for unordered / equal. */
+CC_MODE (CC_FP_GTE); /* ~AC / AZ for greater than / equal. */
+#if 0 /* This would be needed for simplified NaN testing. */
+RESET_FLOAT_FORMAT (SF, motorola_single_format);
+RESET_FLOAT_FORMAT (DF, motorola_double_format);
+#endif
+VECTOR_MODES (INT, 4); /* V4QI V2HI */
+VECTOR_MODES (INT, 8); /* V8QI V4HI V2SI */
+VECTOR_MODE (FLOAT, SF, 2); /* V2SF */
+ADJUST_ALIGNMENT (V8QI, epiphany_vect_align);
+ADJUST_ALIGNMENT (V4HI, epiphany_vect_align);
+ADJUST_ALIGNMENT (V2SI, epiphany_vect_align);
+ADJUST_ALIGNMENT (V2SF, epiphany_vect_align);
diff --git a/gcc/config/epiphany/epiphany-protos.h b/gcc/config/epiphany/epiphany-protos.h
new file mode 100644
index 00000000000..334c5337f7c
--- /dev/null
+++ b/gcc/config/epiphany/epiphany-protos.h
@@ -0,0 +1,55 @@
+/* Definitions of target machine for GNU compiler, EPIPHANY cpu.
+ Copyright (C) 2000, 2004, 2007, 2009, 2011 Free Software Foundation, Inc.
+ Contributed by Embecosm on behalf of Adapteva, 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/>. */
+
+#ifdef RTX_CODE
+extern enum machine_mode epiphany_select_cc_mode (enum rtx_code, rtx, rtx);
+
+/* Define the function that build the compare insn for scc and bcc. */
+extern struct rtx_def *gen_compare_reg (enum machine_mode, enum rtx_code,
+ enum machine_mode, rtx, rtx);
+#endif
+
+/* Declarations for various fns used in the .md file. */
+extern void epiphany_final_prescan_insn (rtx, rtx *, int);
+extern bool epiphany_is_long_call_p (rtx);
+extern bool epiphany_small16 (rtx);
+bool epiphany_uninterruptible_p (tree decl);
+bool epiphany_call_uninterruptible_p (rtx mem);
+extern rtx sfunc_symbol (const char *name);
+
+extern void epiphany_expand_prologue (void);
+extern void epiphany_expand_epilogue (int);
+extern int epiphany_initial_elimination_offset (int, int);
+extern void epiphany_init_expanders (void);
+extern int hard_regno_mode_ok (int regno, enum machine_mode mode);
+#ifdef HARD_CONST
+extern void emit_set_fp_mode (int entity, int mode, HARD_REG_SET regs_live);
+#endif
+extern void epiphany_insert_mode_switch_use (rtx insn, int, int);
+extern void epiphany_expand_set_fp_mode (rtx *operands);
+extern int epiphany_mode_needed (int entity, rtx insn);
+extern int epiphany_mode_entry_exit (int entity, bool);
+extern int epiphany_mode_after (int entity, int last_mode, rtx insn);
+extern int epiphany_mode_priority_to_mode (int entity, unsigned priority);
+extern bool epiphany_epilogue_uses (int regno);
+extern bool epiphany_optimize_mode_switching (int entity);
+extern bool epiphany_is_interrupt_p (tree);
+extern unsigned epiphany_special_round_type_align (tree, unsigned, unsigned);
+extern unsigned epiphany_adjust_field_align (tree, unsigned);
diff --git a/gcc/config/epiphany/epiphany-sched.md b/gcc/config/epiphany/epiphany-sched.md
new file mode 100644
index 00000000000..a2420a562ae
--- /dev/null
+++ b/gcc/config/epiphany/epiphany-sched.md
@@ -0,0 +1,135 @@
+;; DFA scheduling description for EPIPHANY
+;; Copyright (C) 2004, 2006, 2007, 2009 Free Software Foundation, Inc.
+;; Contributed by Embecosm on behalf of Adapteva, 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/>.
+
+;; Two automata are defined to reduce number of states
+;; which a single large automaton will have. (Factoring)
+
+(define_automaton "inst_pipeline,fpu_pipe")
+
+;; This unit is basically the decode unit of the processor.
+;; Since epiphany is a dual issue machine, it is as if there are two
+;; units so that any insn can be processed by either one
+;; of the decoding unit.
+
+(define_cpu_unit "pipe_01,pipe_02" "inst_pipeline")
+
+;; The fixed point arithmetic unit.
+
+(define_cpu_unit "int" "inst_pipeline")
+
+;; The floating point unit.
+
+(define_cpu_unit "F0" "fpu_pipe")
+
+;; ----------------------------------------------------
+;; This reservation is to simplify the dual issue description.
+
+(define_reservation "issue" "pipe_01|pipe_02")
+
+;; This is to express instructions that cannot be paired.
+
+(define_reservation "d_lock" "pipe_01+pipe_02")
+
+;; We don't model all pipeline stages; we model the issue stage
+;; inasmuch as we allow only two instructions to issue simultaneously,
+;; and flow instructions prevent any simultaneous issue of another instruction.
+;; (This uses pipe_01 and pipe_02).
+;; Double issue of 'other' insns is prevented by using the int unit in the
+;; E1 stage.
+;; Double issue of float instructions is prevented by using F0 in the E1 stage.
+
+(define_insn_reservation "simple_arith" 2
+ (and (eq_attr "pipe_model" "epiphany")
+ (eq_attr "type" "move,cmove,compare,shift,misc,mul")
+ (eq_attr "length" "4"))
+ "issue,int")
+
+; anything but fp / fp_int has a bypass
+(define_bypass 1 "simple_arith" "simple_arith,simple_arith_2,simple_arith_4,load,store,branch,call,flow")
+
+(define_insn_reservation "simple_arith_2" 2
+ (and (eq_attr "pipe_model" "epiphany")
+ (eq_attr "type" "move,cmove,compare,shift,misc,mul")
+ (eq_attr "length" "8"))
+ "issue,issue+int,int")
+
+(define_insn_reservation "simple_arith_4" 4
+ (and (eq_attr "pipe_model" "epiphany")
+ (eq_attr "type" "move,compare,shift,misc,mul")
+ (eq_attr "length" "12,16,20,24"))
+ "issue,issue+int,issue+int,issue+int,int")
+
+;; Loads have a latency of two.
+;; Note that we fix up the latency of post_modify in epiphany.c:epiphany_adjust_cost
+
+(define_insn_reservation "load" 3
+ (and (eq_attr "pipe_model" "epiphany")
+ (eq_attr "type" "load"))
+ "issue,int")
+
+; anything but fp / fp_int has a bypass
+(define_bypass 2 "load" "simple_arith,simple_arith_2,simple_arith_4,load,store,branch,call,flow")
+
+(define_insn_reservation "store" 1
+ (and (eq_attr "pipe_model" "epiphany")
+ (eq_attr "type" "store"))
+ "issue,int")
+
+;; Branch
+;; Latency when taken: 3
+;; Issue Rate: 1
+;; The latency is 1 when the branch is not taken.
+;; We can't really do much with the latency, even if we could express it,
+;; but the pairing restrictions are useful to take into account.
+
+(define_insn_reservation "branch" 1
+ (and (eq_attr "pipe_model" "epiphany")
+ (eq_attr "type" "branch,uncond_branch"))
+ "d_lock")
+
+;; calls introduce a longisch delay that is likely to flush the pipelines
+;; of the caller's instructions. Both the call instruction itself and
+;; the rts at the end of the call / sfunc incurs a three cycle penalty,
+;; thus also isolating the scheduling of caller and callee.
+
+(define_insn_reservation "call" 8
+ (and (eq_attr "pipe_model" "epiphany")
+ (eq_attr "type" "call,sfunc,fp_sfunc"))
+ "d_lock*8")
+
+(define_insn_reservation "flow" 1
+ (and (eq_attr "pipe_model" "epiphany")
+ (eq_attr "type" "flow"))
+ "d_lock")
+
+(define_insn_reservation "fp_arith_trunc" 3
+ (and (eq_attr "pipe_model" "epiphany")
+ (and (eq_attr "type" "fp,fp_int")
+ (eq_attr "rounding" "trunc")))
+ "issue,F0")
+
+(define_insn_reservation "fp_arith_nearest" 5
+ (and (eq_attr "pipe_model" "epiphany")
+ (and (eq_attr "type" "fp,fp_int")
+ (eq_attr "rounding" "nearest")))
+ "issue,F0")
+
+(define_bypass 2 "fp_arith_trunc" "store")
+(define_bypass 4 "fp_arith_nearest" "store")
diff --git a/gcc/config/epiphany/epiphany.c b/gcc/config/epiphany/epiphany.c
new file mode 100644
index 00000000000..a4652da87b8
--- /dev/null
+++ b/gcc/config/epiphany/epiphany.c
@@ -0,0 +1,2751 @@
+/* Subroutines used for code generation on the EPIPHANY cpu.
+ Copyright (C) 1994, 1995, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
+ 2004, 2005, 2006, 2007, 2009, 2010, 2011 Free Software Foundation, Inc.
+ Contributed by Embecosm on behalf of Adapteva, 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/>. */
+
+#include "config.h"
+#include "system.h"
+#include "coretypes.h"
+#include "tm.h"
+#include "tree.h"
+#include "rtl.h"
+#include "regs.h"
+#include "hard-reg-set.h"
+#include "real.h"
+#include "insn-config.h"
+#include "conditions.h"
+#include "output.h"
+#include "insn-attr.h"
+#include "flags.h"
+#include "function.h"
+#include "expr.h"
+#include "diagnostic-core.h"
+#include "recog.h"
+#include "toplev.h"
+#include "tm_p.h"
+#include "target.h"
+#include "df.h"
+#include "langhooks.h"
+#include "insn-codes.h"
+#include "ggc.h"
+#include "tm-constrs.h"
+#include "tree-pass.h"
+#include "integrate.h"
+
+/* Which cpu we're compiling for. */
+int epiphany_cpu_type;
+
+/* Name of mangle string to add to symbols to separate code compiled for each
+ cpu (or NULL). */
+const char *epiphany_mangle_cpu;
+
+/* Array of valid operand punctuation characters. */
+char epiphany_punct_chars[256];
+
+/* The rounding mode that we generally use for floating point. */
+int epiphany_normal_fp_rounding;
+
+static void epiphany_init_reg_tables (void);
+static int get_epiphany_condition_code (rtx);
+static tree epiphany_handle_interrupt_attribute (tree *, tree, tree, int, bool *);
+static bool epiphany_pass_by_reference (cumulative_args_t, enum machine_mode,
+ const_tree, bool);
+static rtx frame_insn (rtx);
+
+/* defines for the initialization of the GCC target structure. */
+#define TARGET_ATTRIBUTE_TABLE epiphany_attribute_table
+
+#define TARGET_PRINT_OPERAND epiphany_print_operand
+#define TARGET_PRINT_OPERAND_ADDRESS epiphany_print_operand_address
+
+#define TARGET_RTX_COSTS epiphany_rtx_costs
+#define TARGET_ADDRESS_COST epiphany_address_cost
+#define TARGET_MEMORY_MOVE_COST epiphany_memory_move_cost
+
+#define TARGET_PROMOTE_FUNCTION_MODE epiphany_promote_function_mode
+#define TARGET_PROMOTE_PROTOTYPES hook_bool_const_tree_true
+
+#define TARGET_RETURN_IN_MEMORY epiphany_return_in_memory
+#define TARGET_PASS_BY_REFERENCE epiphany_pass_by_reference
+#define TARGET_CALLEE_COPIES hook_bool_CUMULATIVE_ARGS_mode_tree_bool_true
+#define TARGET_FUNCTION_VALUE epiphany_function_value
+#define TARGET_LIBCALL_VALUE epiphany_libcall_value
+#define TARGET_FUNCTION_VALUE_REGNO_P epiphany_function_value_regno_p
+
+#define TARGET_SETUP_INCOMING_VARARGS epiphany_setup_incoming_varargs
+
+/* Using the simplistic varags handling forces us to do partial reg/stack
+ argument passing for types with larger size (> 4 bytes) than alignemnt. */
+#define TARGET_ARG_PARTIAL_BYTES epiphany_arg_partial_bytes
+
+#define TARGET_FUNCTION_OK_FOR_SIBCALL epiphany_function_ok_for_sibcall
+
+#define TARGET_SCHED_ISSUE_RATE epiphany_issue_rate
+#define TARGET_SCHED_ADJUST_COST epiphany_adjust_cost
+
+#define TARGET_LEGITIMATE_ADDRESS_P epiphany_legitimate_address_p
+
+#define TARGET_SECONDARY_RELOAD epiphany_secondary_reload
+
+#define TARGET_OPTION_OVERRIDE epiphany_override_options
+
+#define TARGET_CONDITIONAL_REGISTER_USAGE epiphany_conditional_register_usage
+
+#define TARGET_FUNCTION_ARG epiphany_function_arg
+
+#define TARGET_FUNCTION_ARG_ADVANCE epiphany_function_arg_advance
+
+#define TARGET_FUNCTION_ARG_BOUNDARY epiphany_function_arg_boundary
+
+#define TARGET_TRAMPOLINE_INIT epiphany_trampoline_init
+
+/* Nonzero if the constant rtx value is a legitimate general operand.
+ We can handle any 32- or 64-bit constant. */
+#define TARGET_LEGITIMATE_CONSTANT_P hook_bool_mode_rtx_true
+
+#define TARGET_MIN_DIVISIONS_FOR_RECIP_MUL \
+ epiphany_min_divisions_for_recip_mul
+
+#define TARGET_VECTORIZE_PREFERRED_SIMD_MODE epiphany_preferred_simd_mode
+
+#define TARGET_VECTOR_MODE_SUPPORTED_P epiphany_vector_mode_supported_p
+
+#define TARGET_VECTORIZE_VECTOR_ALIGNMENT_REACHABLE \
+ epiphany_vector_alignment_reachable
+
+#define TARGET_VECTORIZE_SUPPORT_VECTOR_MISALIGNMENT \
+ epiphany_support_vector_misalignment
+
+#define TARGET_ASM_CAN_OUTPUT_MI_THUNK \
+ hook_bool_const_tree_hwi_hwi_const_tree_true
+#define TARGET_ASM_OUTPUT_MI_THUNK epiphany_output_mi_thunk
+
+#include "target-def.h"
+
+#undef TARGET_ASM_ALIGNED_HI_OP
+#define TARGET_ASM_ALIGNED_HI_OP "\t.hword\t"
+#undef TARGET_ASM_ALIGNED_SI_OP
+#define TARGET_ASM_ALIGNED_SI_OP "\t.word\t"
+
+bool
+epiphany_is_interrupt_p (tree decl)
+{
+ tree attrs;
+
+ attrs = DECL_ATTRIBUTES (decl);
+ if (lookup_attribute ("interrupt", attrs))
+ return true;
+ else
+ return false;
+}
+
+/* Called from epiphany_override_options.
+ We use this to initialize various things. */
+
+static void
+epiphany_init (void)
+{
+ /* N.B. this pass must not run before the first optimize_mode_switching
+ pass because of the side offect of epiphany_mode_needed on
+ MACHINE_FUNCTION(cfun)->unknown_mode_uses. But it must run before
+ pass_resolve_sw_modes. */
+ static struct register_pass_info insert_use_info
+ = { &pass_mode_switch_use.pass, "mode_sw",
+ 1, PASS_POS_INSERT_AFTER
+ };
+ static struct register_pass_info mode_sw2_info
+ = { &pass_mode_switching.pass, "mode_sw",
+ 1, PASS_POS_INSERT_AFTER
+ };
+ static struct register_pass_info mode_sw3_info
+ = { &pass_resolve_sw_modes.pass, "mode_sw",
+ 1, PASS_POS_INSERT_AFTER
+ };
+ static struct register_pass_info mode_sw4_info
+ = { &pass_split_all_insns.pass, "mode_sw",
+ 1, PASS_POS_INSERT_AFTER
+ };
+
+ epiphany_init_reg_tables ();
+
+ /* Initialize array for PRINT_OPERAND_PUNCT_VALID_P. */
+ memset (epiphany_punct_chars, 0, sizeof (epiphany_punct_chars));
+ epiphany_punct_chars['-'] = 1;
+
+ epiphany_normal_fp_rounding
+ = (epiphany_normal_fp_mode == FP_MODE_ROUND_TRUNC
+ ? FP_MODE_ROUND_TRUNC : FP_MODE_ROUND_NEAREST);
+ register_pass (&mode_sw4_info);
+ register_pass (&mode_sw2_info);
+ register_pass (&mode_sw3_info);
+ register_pass (&insert_use_info);
+ register_pass (&mode_sw2_info);
+
+#if 1 /* As long as peep2_rescan is not implemented,
+ (see http://gcc.gnu.org/ml/gcc-patches/2011-10/msg02819.html,)
+ we need a second peephole2 pass to get reasonable code. */
+ {
+ static struct register_pass_info peep2_2_info
+ = { &pass_peephole2.pass, "peephole2",
+ 1, PASS_POS_INSERT_AFTER
+ };
+
+ register_pass (&peep2_2_info);
+ }
+#endif
+}
+
+/* The condition codes of the EPIPHANY, and the inverse function. */
+static const char *const epiphany_condition_codes[] =
+{ /* 0 1 2 3 4 5 6 7 8 9 */
+ "eq", "ne", "ltu", "gteu", "gt", "lte", "gte", "lt", "gtu", "lteu",
+ /* 10 11 12 13 */
+ "beq","bne","blt", "blte",
+};
+
+#define EPIPHANY_INVERSE_CONDITION_CODE(X) ((X) ^ 1)
+
+/* Returns the index of the EPIPHANY condition code string in
+ `epiphany_condition_codes'. COMPARISON should be an rtx like
+ `(eq (...) (...))'. */
+
+static int
+get_epiphany_condition_code (rtx comparison)
+{
+ switch (GET_MODE (XEXP (comparison, 0)))
+ {
+ case CCmode:
+ switch (GET_CODE (comparison))
+ {
+ case EQ : return 0;
+ case NE : return 1;
+ case LTU : return 2;
+ case GEU : return 3;
+ case GT : return 4;
+ case LE : return 5;
+ case GE : return 6;
+ case LT : return 7;
+ case GTU : return 8;
+ case LEU : return 9;
+
+ default : gcc_unreachable ();
+ }
+ case CC_N_NEmode:
+ switch (GET_CODE (comparison))
+ {
+ case EQ: return 6;
+ case NE: return 7;
+ default: gcc_unreachable ();
+ }
+ case CC_C_LTUmode:
+ switch (GET_CODE (comparison))
+ {
+ case GEU: return 2;
+ case LTU: return 3;
+ default: gcc_unreachable ();
+ }
+ case CC_C_GTUmode:
+ switch (GET_CODE (comparison))
+ {
+ case LEU: return 3;
+ case GTU: return 2;
+ default: gcc_unreachable ();
+ }
+ case CC_FPmode:
+ switch (GET_CODE (comparison))
+ {
+ case EQ: return 10;
+ case NE: return 11;
+ case LT: return 12;
+ case LE: return 13;
+ default: gcc_unreachable ();
+ }
+ case CC_FP_EQmode:
+ switch (GET_CODE (comparison))
+ {
+ case EQ: return 0;
+ case NE: return 1;
+ default: gcc_unreachable ();
+ }
+ case CC_FP_GTEmode:
+ switch (GET_CODE (comparison))
+ {
+ case EQ: return 0;
+ case NE: return 1;
+ case GT : return 4;
+ case GE : return 6;
+ case UNLE : return 5;
+ case UNLT : return 7;
+ default: gcc_unreachable ();
+ }
+ case CC_FP_ORDmode:
+ switch (GET_CODE (comparison))
+ {
+ case ORDERED: return 9;
+ case UNORDERED: return 8;
+ default: gcc_unreachable ();
+ }
+ case CC_FP_UNEQmode:
+ switch (GET_CODE (comparison))
+ {
+ case UNEQ: return 9;
+ case LTGT: return 8;
+ default: gcc_unreachable ();
+ }
+ default: gcc_unreachable ();
+ }
+ /*NOTREACHED*/
+ return (42);
+}
+
+
+/* Return 1 if hard register REGNO can hold a value of machine_mode MODE. */
+int
+hard_regno_mode_ok (int regno, enum machine_mode mode)
+{
+ if (GET_MODE_SIZE (mode) > UNITS_PER_WORD)
+ return (regno & 1) == 0 && GPR_P (regno);
+ else
+ return 1;
+}
+
+/* Given a comparison code (EQ, NE, etc.) and the first operand of a COMPARE,
+ return the mode to be used for the comparison. */
+
+enum machine_mode
+epiphany_select_cc_mode (enum rtx_code op,
+ rtx x ATTRIBUTE_UNUSED,
+ rtx y ATTRIBUTE_UNUSED)
+{
+ if (GET_MODE_CLASS (GET_MODE (x)) == MODE_FLOAT)
+ {
+ if (TARGET_SOFT_CMPSF)
+ {
+ if (op == EQ || op == NE)
+ return CC_FP_EQmode;
+ if (op == ORDERED || op == UNORDERED)
+ return CC_FP_ORDmode;
+ if (op == UNEQ || op == LTGT)
+ return CC_FP_UNEQmode;
+ return CC_FP_GTEmode;
+ }
+ return CC_FPmode;
+ }
+ /* recognize combiner pattern ashlsi_btst:
+ (parallel [
+ (set (reg:N_NE 65 cc1)
+ (compare:N_NE (zero_extract:SI (reg/v:SI 75 [ a ])
+ (const_int 1 [0x1])
+ (const_int 0 [0x0]))
+ (const_int 0 [0x0])))
+ (clobber (scratch:SI)) */
+ else if ((op == EQ || op == NE)
+ && GET_CODE (x) == ZERO_EXTRACT
+ && XEXP (x, 1) == const1_rtx
+ && CONST_INT_P (XEXP (x, 2)))
+ return CC_N_NEmode;
+ else if ((op == GEU || op == LTU) && GET_CODE (x) == PLUS)
+ return CC_C_LTUmode;
+ else if ((op == LEU || op == GTU) && GET_CODE (x) == MINUS)
+ return CC_C_GTUmode;
+ else
+ return CCmode;
+}
+
+enum reg_class epiphany_regno_reg_class[FIRST_PSEUDO_REGISTER];
+
+static void
+epiphany_init_reg_tables (void)
+{
+ int i;
+
+ for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
+ {
+ if (i == GPR_LR)
+ epiphany_regno_reg_class[i] = LR_REGS;
+ else if (i <= 7 && TARGET_PREFER_SHORT_INSN_REGS)
+ epiphany_regno_reg_class[i] = SHORT_INSN_REGS;
+ else if (call_used_regs[i]
+ && TEST_HARD_REG_BIT (reg_class_contents[GENERAL_REGS], i))
+ epiphany_regno_reg_class[i] = SIBCALL_REGS;
+ else if (i >= CORE_CONTROL_FIRST && i <= CORE_CONTROL_LAST)
+ epiphany_regno_reg_class[i] = CORE_CONTROL_REGS;
+ else if (i < (GPR_LAST+1)
+ || i == ARG_POINTER_REGNUM || i == FRAME_POINTER_REGNUM)
+ epiphany_regno_reg_class[i] = GENERAL_REGS;
+ else if (i == CC_REGNUM)
+ epiphany_regno_reg_class[i] = NO_REGS /* CC_REG: must be NO_REGS */;
+ else
+ epiphany_regno_reg_class[i] = NO_REGS;
+ }
+}
+
+/* EPIPHANY specific attribute support.
+
+ The EPIPHANY has these attributes:
+ interrupt - for interrupt functions.
+ short_call - the function is assumed to be reachable with the b / bl
+ instructions.
+ long_call - the function address is loaded into a register before use.
+ disinterrupt - functions which mask interrupts throughout.
+ They unmask them while calling an interruptible
+ function, though. */
+
+static const struct attribute_spec epiphany_attribute_table[] =
+{
+ /* { name, min_len, max_len, decl_req, type_req, fn_type_req, handler } */
+ { "interrupt", 1, 1, true, false, false, epiphany_handle_interrupt_attribute, true },
+ { "long_call", 0, 0, false, true, true, NULL, false },
+ { "short_call", 0, 0, false, true, true, NULL, false },
+ { "disinterrupt", 0, 0, false, true, true, NULL, false },
+ { NULL, 0, 0, false, false, false, NULL, false }
+};
+
+/* Handle an "interrupt" attribute; arguments as in
+ struct attribute_spec.handler. */
+static tree
+epiphany_handle_interrupt_attribute (tree *node ATTRIBUTE_UNUSED,
+ tree name, tree args,
+ int flags ATTRIBUTE_UNUSED,
+ bool *no_add_attrs)
+{
+ tree value = TREE_VALUE (args);
+
+ if (TREE_CODE (value) != STRING_CST)
+ {
+ warning (OPT_Wattributes,
+ "argument of %qE attribute is not a string constant", name);
+ *no_add_attrs = true;
+ }
+ else if (strcmp (TREE_STRING_POINTER (value), "reset")
+ && strcmp (TREE_STRING_POINTER (value), "software_exception")
+ && strcmp (TREE_STRING_POINTER (value), "timer")
+ && strcmp (TREE_STRING_POINTER (value), "dma0")
+ && strcmp (TREE_STRING_POINTER (value), "dma1")
+ && strcmp (TREE_STRING_POINTER (value), "static_flag")
+ && strcmp (TREE_STRING_POINTER (value), "swi"))
+ {
+ warning (OPT_Wattributes,
+ "argument of %qE attribute is not \"reset\", \"software_exception\", \"timer\", \"dma0\", \"dma1\", \"static_flag\" or \"swi\"",
+ name);
+ *no_add_attrs = true;
+ }
+
+ return NULL_TREE;
+}
+
+
+/* Misc. utilities. */
+
+/* Generate a SYMBOL_REF for the special function NAME. When the address
+ can't be placed directly into a call instruction, and if possible, copy
+ it to a register so that cse / code hoisting is possible. */
+rtx
+sfunc_symbol (const char *name)
+{
+ rtx sym = gen_rtx_SYMBOL_REF (Pmode, name);
+
+ /* These sfuncs should be hidden, and every dso should get a copy. */
+ SYMBOL_REF_FLAGS (sym) = SYMBOL_FLAG_FUNCTION | SYMBOL_FLAG_LOCAL;
+ if (TARGET_SHORT_CALLS)
+ ; /* Nothing to be done. */
+ else if (can_create_pseudo_p ())
+ sym = copy_to_mode_reg (Pmode, sym);
+ else /* We rely on reload to fix this up. */
+ gcc_assert (!reload_in_progress || reload_completed);
+ return sym;
+}
+
+/* X and Y are two things to compare using CODE in IN_MODE.
+ Emit the compare insn, construct the the proper cc reg in the proper
+ mode, and return the rtx for the cc reg comparison in CMODE. */
+
+rtx
+gen_compare_reg (enum machine_mode cmode, enum rtx_code code,
+ enum machine_mode in_mode, rtx x, rtx y)
+{
+ enum machine_mode mode = SELECT_CC_MODE (code, x, y);
+ rtx cc_reg, pat, clob0, clob1, clob2;
+
+ if (in_mode == VOIDmode)
+ in_mode = GET_MODE (x);
+ if (in_mode == VOIDmode)
+ in_mode = GET_MODE (y);
+
+ if (mode == CC_FPmode)
+ {
+ /* The epiphany has only EQ / NE / LT / LE conditions for
+ hardware floating point. */
+ if (code == GT || code == GE || code == UNLE || code == UNLT)
+ {
+ rtx tmp = x; x = y; y = tmp;
+ code = swap_condition (code);
+ }
+ cc_reg = gen_rtx_REG (mode, CCFP_REGNUM);
+ y = force_reg (in_mode, y);
+ }
+ else
+ {
+ if (mode == CC_FP_GTEmode
+ && (code == LE || code == LT || code == UNGT || code == UNGE))
+ {
+ rtx tmp = x; x = y; y = tmp;
+ code = swap_condition (code);
+ }
+ cc_reg = gen_rtx_REG (mode, CC_REGNUM);
+ }
+ if ((mode == CC_FP_EQmode || mode == CC_FP_GTEmode
+ || mode == CC_FP_ORDmode || mode == CC_FP_UNEQmode)
+ /* mov<mode>cc might want to re-emit a comparison during ifcvt. */
+ && (!REG_P (x) || REGNO (x) != 0 || !REG_P (y) || REGNO (y) != 1))
+ {
+ rtx reg;
+
+ gcc_assert (currently_expanding_to_rtl);
+ reg = gen_rtx_REG (in_mode, 0);
+ gcc_assert (!reg_overlap_mentioned_p (reg, y));
+ emit_move_insn (reg, x);
+ x = reg;
+ reg = gen_rtx_REG (in_mode, 1);
+ emit_move_insn (reg, y);
+ y = reg;
+ }
+ else
+ x = force_reg (in_mode, x);
+
+ pat = gen_rtx_SET (VOIDmode, cc_reg, gen_rtx_COMPARE (mode, x, y));
+ if (mode == CC_FP_EQmode || mode == CC_FP_GTEmode)
+ {
+ const char *name = mode == CC_FP_EQmode ? "__eqsf2" : "__gtesf2";
+ rtx use = gen_rtx_USE (VOIDmode, sfunc_symbol (name));
+
+ clob0 = gen_rtx_CLOBBER (VOIDmode, gen_rtx_REG (SImode, GPR_IP));
+ clob1 = gen_rtx_CLOBBER (VOIDmode, gen_rtx_REG (SImode, GPR_LR));
+ pat = gen_rtx_PARALLEL (VOIDmode, gen_rtvec (4, pat, use, clob0, clob1));
+ }
+ else if (mode == CC_FP_ORDmode || mode == CC_FP_UNEQmode)
+ {
+ const char *name = mode == CC_FP_ORDmode ? "__ordsf2" : "__uneqsf2";
+ rtx use = gen_rtx_USE (VOIDmode, sfunc_symbol (name));
+
+ clob0 = gen_rtx_CLOBBER (VOIDmode, gen_rtx_REG (SImode, GPR_IP));
+ clob1 = gen_rtx_CLOBBER (VOIDmode, gen_rtx_REG (SImode, GPR_16));
+ clob2 = gen_rtx_CLOBBER (VOIDmode, gen_rtx_REG (SImode, GPR_LR));
+ pat = gen_rtx_PARALLEL (VOIDmode, gen_rtvec (5, pat, use,
+ clob0, clob1, clob2));
+ }
+ else
+ {
+ clob0 = gen_rtx_CLOBBER (VOIDmode, gen_rtx_SCRATCH (in_mode));
+ pat = gen_rtx_PARALLEL (VOIDmode, gen_rtvec (2, pat, clob0));
+ }
+ emit_insn (pat);
+ return gen_rtx_fmt_ee (code, cmode, cc_reg, const0_rtx);
+}
+
+/* The ROUND_ADVANCE* macros are local to this file. */
+/* Round SIZE up to a word boundary. */
+#define ROUND_ADVANCE(SIZE) \
+ (((SIZE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
+
+/* Round arg MODE/TYPE up to the next word boundary. */
+#define ROUND_ADVANCE_ARG(MODE, TYPE) \
+ ((MODE) == BLKmode \
+ ? ROUND_ADVANCE (int_size_in_bytes (TYPE)) \
+ : ROUND_ADVANCE (GET_MODE_SIZE (MODE)))
+
+/* Round CUM up to the necessary point for argument MODE/TYPE. */
+#define ROUND_ADVANCE_CUM(CUM, MODE, TYPE) \
+ (epiphany_function_arg_boundary ((MODE), (TYPE)) > BITS_PER_WORD \
+ ? (((CUM) + 1) & ~1) \
+ : (CUM))
+
+static unsigned int
+epiphany_function_arg_boundary (enum machine_mode mode, const_tree type)
+{
+ if ((type ? TYPE_ALIGN (type) : GET_MODE_BITSIZE (mode)) <= PARM_BOUNDARY)
+ return PARM_BOUNDARY;
+ return 2 * PARM_BOUNDARY;
+}
+
+/* Do any needed setup for a variadic function. For the EPIPHANY, we
+ actually emit the code in epiphany_expand_prologue.
+
+ CUM has not been updated for the last named argument which has type TYPE
+ and mode MODE, and we rely on this fact. */
+
+
+static void
+epiphany_setup_incoming_varargs (cumulative_args_t cum, enum machine_mode mode,
+ tree type, int *pretend_size, int no_rtl)
+{
+ int first_anon_arg;
+ CUMULATIVE_ARGS next_cum;
+ machine_function_t *mf = MACHINE_FUNCTION (cfun);
+
+ /* All BLKmode values are passed by reference. */
+ gcc_assert (mode != BLKmode);
+
+ next_cum = *get_cumulative_args (cum);
+ next_cum
+ = ROUND_ADVANCE_CUM (next_cum, mode, type) + ROUND_ADVANCE_ARG (mode, type);
+ first_anon_arg = next_cum;
+
+ if (first_anon_arg < MAX_EPIPHANY_PARM_REGS && !no_rtl)
+ {
+ /* Note that first_reg_offset < MAX_EPIPHANY_PARM_REGS. */
+ int first_reg_offset = first_anon_arg;
+
+ *pretend_size = ((MAX_EPIPHANY_PARM_REGS - first_reg_offset)
+ * UNITS_PER_WORD);
+ }
+ mf->args_parsed = 1;
+ mf->pretend_args_odd = ((*pretend_size & UNITS_PER_WORD) ? 1 : 0);
+}
+
+static int
+epiphany_arg_partial_bytes (cumulative_args_t cum, enum machine_mode mode,
+ tree type, bool named ATTRIBUTE_UNUSED)
+{
+ int words = 0, rounded_cum;
+
+ gcc_assert (!epiphany_pass_by_reference (cum, mode, type, /* named */ true));
+
+ rounded_cum = ROUND_ADVANCE_CUM (*get_cumulative_args (cum), mode, type);
+ if (rounded_cum < MAX_EPIPHANY_PARM_REGS)
+ {
+ words = MAX_EPIPHANY_PARM_REGS - rounded_cum;
+ if (words >= ROUND_ADVANCE_ARG (mode, type))
+ words = 0;
+ }
+ return words * UNITS_PER_WORD;
+}
+
+/* Cost functions. */
+
+/* Compute a (partial) cost for rtx X. Return true if the complete
+ cost has been computed, and false if subexpressions should be
+ scanned. In either case, *TOTAL contains the cost result. */
+
+static bool
+epiphany_rtx_costs (rtx x, int code, int outer_code, int opno ATTRIBUTE_UNUSED,
+ int *total, bool speed ATTRIBUTE_UNUSED)
+{
+ switch (code)
+ {
+ /* Small integers in the right context are as cheap as registers. */
+ case CONST_INT:
+ if ((outer_code == PLUS || outer_code == MINUS)
+ && SIMM11 (INTVAL (x)))
+ {
+ *total = 0;
+ return true;
+ }
+ if (IMM16 (INTVAL (x)))
+ {
+ *total = outer_code == SET ? 0 : COSTS_N_INSNS (1);
+ return true;
+ }
+ /* FALLTHRU */
+
+ case CONST:
+ case LABEL_REF:
+ case SYMBOL_REF:
+ *total = COSTS_N_INSNS ((epiphany_small16 (x) ? 0 : 1)
+ + (outer_code == SET ? 0 : 1));
+ return true;
+
+ case CONST_DOUBLE:
+ {
+ rtx high, low;
+ split_double (x, &high, &low);
+ *total = COSTS_N_INSNS (!IMM16 (INTVAL (high))
+ + !IMM16 (INTVAL (low)));
+ return true;
+ }
+
+ case ASHIFT:
+ case ASHIFTRT:
+ case LSHIFTRT:
+ *total = COSTS_N_INSNS (1);
+ return true;
+
+ default:
+ return false;
+ }
+}
+
+
+/* Provide the costs of an addressing mode that contains ADDR.
+ If ADDR is not a valid address, its cost is irrelevant. */
+
+static int
+epiphany_address_cost (rtx addr, bool speed)
+{
+ rtx reg;
+ rtx off = const0_rtx;
+ int i;
+
+ if (speed)
+ return 0;
+ /* Return 0 for addresses valid in short insns, 1 for addresses only valid
+ in long insns. */
+ switch (GET_CODE (addr))
+ {
+ case PLUS :
+ reg = XEXP (addr, 0);
+ off = XEXP (addr, 1);
+ break;
+ case POST_MODIFY:
+ reg = XEXP (addr, 0);
+ off = XEXP (addr, 1);
+ gcc_assert (GET_CODE (off) == PLUS && rtx_equal_p (reg, XEXP (off, 0)));
+ off = XEXP (off, 1);
+ if (satisfies_constraint_Rgs (reg) && satisfies_constraint_Rgs (off))
+ return 0;
+ return 1;
+ case REG:
+ default:
+ reg = addr;
+ break;
+ }
+ if (!satisfies_constraint_Rgs (reg))
+ return 1;
+ /* ??? We don't know the mode of the memory access. We are going to assume
+ SImode, unless lack of offset alignment indicates a smaller access. */
+ /* First, make sure we have a valid integer. */
+ if (!satisfies_constraint_L (off))
+ return 1;
+ i = INTVAL (off);
+ if ((i & 1) == 0)
+ i >>= 1;
+ if ((i & 1) == 0)
+ i >>= 1;
+ if (i < -7 || i > 7)
+ return 1;
+ return 0;
+}
+
+/* Compute the cost of moving data between registers and memory.
+ For integer, load latency is twice as long as register-register moves,
+ but issue pich is the same. For floating point, load latency is three
+ times as much as a reg-reg move. */
+static int
+epiphany_memory_move_cost (enum machine_mode mode,
+ reg_class_t rclass ATTRIBUTE_UNUSED,
+ bool in ATTRIBUTE_UNUSED)
+{
+ return GET_MODE_CLASS (mode) == MODE_INT ? 3 : 4;
+}
+
+/* Function prologue/epilogue handlers. */
+
+/* EPIPHANY stack frames look like:
+
+ Before call After call
+ +-----------------------+ +-----------------------+
+ | | | |
+ high | local variables, | | local variables, |
+ mem | reg save area, etc. | | reg save area, etc. |
+ | | | |
+ +-----------------------+ +-----------------------+
+ | | | |
+ | arguments on stack. | | arguments on stack. |
+ | | | |
+ SP+8->+-----------------------+FP+8m->+-----------------------+
+ | 2 word save area for | | reg parm save area, |
+ | leaf funcs / flags | | only created for |
+ SP+0->+-----------------------+ | variable argument |
+ | functions |
+ FP+8n->+-----------------------+
+ | |
+ | register save area |
+ | |
+ +-----------------------+
+ | |
+ | local variables |
+ | |
+ FP+0->+-----------------------+
+ | |
+ | alloca allocations |
+ | |
+ +-----------------------+
+ | |
+ | arguments on stack |
+ | |
+ SP+8->+-----------------------+
+ low | 2 word save area for |
+ memory | leaf funcs / flags |
+ SP+0->+-----------------------+
+
+Notes:
+1) The "reg parm save area" does not exist for non variable argument fns.
+ The "reg parm save area" could be eliminated if we created our
+ own TARGET_GIMPLIFY_VA_ARG_EXPR, but that has tradeoffs as well
+ (so it's not done). */
+
+/* Structure to be filled in by epiphany_compute_frame_size with register
+ save masks, and offsets for the current function. */
+struct epiphany_frame_info
+{
+ unsigned int total_size; /* # bytes that the entire frame takes up. */
+ unsigned int pretend_size; /* # bytes we push and pretend caller did. */
+ unsigned int args_size; /* # bytes that outgoing arguments take up. */
+ unsigned int reg_size; /* # bytes needed to store regs. */
+ unsigned int var_size; /* # bytes that variables take up. */
+ HARD_REG_SET gmask; /* Set of saved gp registers. */
+ int initialized; /* Nonzero if frame size already calculated. */
+ int stld_sz; /* Current load/store data size for offset
+ adjustment. */
+ int need_fp; /* value to override "frame_pointer_needed */
+ int first_slot, last_slot, first_slot_offset, last_slot_offset;
+ int first_slot_size;
+ int small_threshold;
+};
+
+/* Current frame information calculated by epiphany_compute_frame_size. */
+static struct epiphany_frame_info current_frame_info;
+
+/* Zero structure to initialize current_frame_info. */
+static struct epiphany_frame_info zero_frame_info;
+
+/* The usual; we set up our machine_function data. */
+static struct machine_function *
+epiphany_init_machine_status (void)
+{
+ struct machine_function *machine;
+
+ /* Reset state info for each function. */
+ current_frame_info = zero_frame_info;
+
+ machine = ggc_alloc_cleared_machine_function_t ();
+
+ return machine;
+}
+
+/* Implements INIT_EXPANDERS. We just set up to call the above
+ * function. */
+void
+epiphany_init_expanders (void)
+{
+ init_machine_status = epiphany_init_machine_status;
+}
+
+/* Type of function DECL.
+
+ The result is cached. To reset the cache at the end of a function,
+ call with DECL = NULL_TREE. */
+
+static enum epiphany_function_type
+epiphany_compute_function_type (tree decl)
+{
+ tree a;
+ /* Cached value. */
+ static enum epiphany_function_type fn_type = EPIPHANY_FUNCTION_UNKNOWN;
+ /* Last function we were called for. */
+ static tree last_fn = NULL_TREE;
+
+ /* Resetting the cached value? */
+ if (decl == NULL_TREE)
+ {
+ fn_type = EPIPHANY_FUNCTION_UNKNOWN;
+ last_fn = NULL_TREE;
+ return fn_type;
+ }
+
+ if (decl == last_fn && fn_type != EPIPHANY_FUNCTION_UNKNOWN)
+ return fn_type;
+
+ /* Assume we have a normal function (not an interrupt handler). */
+ fn_type = EPIPHANY_FUNCTION_NORMAL;
+
+ /* Now see if this is an interrupt handler. */
+ for (a = DECL_ATTRIBUTES (decl);
+ a;
+ a = TREE_CHAIN (a))
+ {
+ tree name = TREE_PURPOSE (a), args = TREE_VALUE (a);
+
+ if (name == get_identifier ("interrupt")
+ && list_length (args) == 1
+ && TREE_CODE (TREE_VALUE (args)) == STRING_CST)
+ {
+ tree value = TREE_VALUE (args);
+
+ if (!strcmp (TREE_STRING_POINTER (value), "reset"))
+ fn_type = EPIPHANY_FUNCTION_RESET;
+ else if (!strcmp (TREE_STRING_POINTER (value), "software_exception"))
+ fn_type = EPIPHANY_FUNCTION_SOFTWARE_EXCEPTION;
+ else if (!strcmp (TREE_STRING_POINTER (value), "timer"))
+ fn_type = EPIPHANY_FUNCTION_TIMER;
+ else if (!strcmp (TREE_STRING_POINTER (value), "dma0"))
+ fn_type = EPIPHANY_FUNCTION_DMA0;
+ else if (!strcmp (TREE_STRING_POINTER (value), "dma1"))
+ fn_type = EPIPHANY_FUNCTION_DMA1;
+ else if (!strcmp (TREE_STRING_POINTER (value), "static_flag"))
+ fn_type = EPIPHANY_FUNCTION_STATIC_FLAG;
+ else if (!strcmp (TREE_STRING_POINTER (value), "swi"))
+ fn_type = EPIPHANY_FUNCTION_SWI;
+ else
+ gcc_unreachable ();
+ break;
+ }
+ }
+
+ last_fn = decl;
+ return fn_type;
+}
+
+#define RETURN_ADDR_REGNUM GPR_LR
+#define FRAME_POINTER_MASK (1 << (FRAME_POINTER_REGNUM))
+#define RETURN_ADDR_MASK (1 << (RETURN_ADDR_REGNUM))
+
+/* Tell prologue and epilogue if register REGNO should be saved / restored.
+ The return address and frame pointer are treated separately.
+ Don't consider them here. */
+#define MUST_SAVE_REGISTER(regno, interrupt_p) \
+ ((df_regs_ever_live_p (regno) \
+ || (interrupt_p && !current_function_is_leaf \
+ && call_used_regs[regno] && !fixed_regs[regno])) \
+ && (!call_used_regs[regno] || regno == GPR_LR \
+ || (interrupt_p && regno != GPR_SP)))
+
+#define MUST_SAVE_RETURN_ADDR 0
+
+/* Return the bytes needed to compute the frame pointer from the current
+ stack pointer.
+
+ SIZE is the size needed for local variables. */
+
+static unsigned int
+epiphany_compute_frame_size (int size /* # of var. bytes allocated. */)
+{
+ int regno;
+ unsigned int total_size, var_size, args_size, pretend_size, reg_size;
+ HARD_REG_SET gmask;
+ enum epiphany_function_type fn_type;
+ int interrupt_p;
+ int first_slot, last_slot, first_slot_offset, last_slot_offset;
+ int first_slot_size;
+ int small_slots = 0;
+ long lr_slot_offset;
+
+ var_size = size;
+ args_size = crtl->outgoing_args_size;
+ pretend_size = crtl->args.pretend_args_size;
+ total_size = args_size + var_size;
+ reg_size = 0;
+ CLEAR_HARD_REG_SET (gmask);
+ first_slot = -1;
+ first_slot_offset = 0;
+ last_slot = -1;
+ last_slot_offset = 0;
+ first_slot_size = UNITS_PER_WORD;
+
+ /* See if this is an interrupt handler. Call used registers must be saved
+ for them too. */
+ fn_type = epiphany_compute_function_type (current_function_decl);
+ interrupt_p = EPIPHANY_INTERRUPT_P (fn_type);
+
+ /* Calculate space needed for registers. */
+
+ for (regno = MAX_EPIPHANY_PARM_REGS - 1; pretend_size > reg_size; regno--)
+ {
+ reg_size += UNITS_PER_WORD;
+ SET_HARD_REG_BIT (gmask, regno);
+ if (epiphany_stack_offset - reg_size == 0)
+ first_slot = regno;
+ }
+
+ if (interrupt_p)
+ reg_size += 2 * UNITS_PER_WORD;
+ else
+ small_slots = epiphany_stack_offset / UNITS_PER_WORD;
+
+ if (frame_pointer_needed)
+ {
+ current_frame_info.need_fp = 1;
+ if (!interrupt_p && first_slot < 0)
+ first_slot = GPR_FP;
+ }
+ else
+ current_frame_info.need_fp = 0;
+ for (regno = 0; regno <= GPR_LAST; regno++)
+ {
+ if (MUST_SAVE_REGISTER (regno, interrupt_p))
+ {
+ gcc_assert (!TEST_HARD_REG_BIT (gmask, regno));
+ reg_size += UNITS_PER_WORD;
+ SET_HARD_REG_BIT (gmask, regno);
+ /* FIXME: when optimizing for speed, take schedling into account
+ when selecting these registers. */
+ if (regno == first_slot)
+ gcc_assert (regno == GPR_FP && frame_pointer_needed);
+ else if (!interrupt_p && first_slot < 0)
+ first_slot = regno;
+ else if (last_slot < 0
+ && (first_slot ^ regno) != 1
+ && (!interrupt_p || regno > GPR_0 + 1))
+ last_slot = regno;
+ }
+ }
+ if (TEST_HARD_REG_BIT (gmask, GPR_LR))
+ MACHINE_FUNCTION (cfun)->lr_clobbered = 1;
+ /* ??? Could sometimes do better than that. */
+ current_frame_info.small_threshold
+ = (optimize >= 3 || interrupt_p ? 0
+ : pretend_size ? small_slots
+ : 4 + small_slots - (first_slot == GPR_FP));
+
+ /* If there might be variables with 64-bit alignment requirement, align the
+ start of the variables. */
+ if (var_size >= 2 * UNITS_PER_WORD
+ /* We don't want to split a double reg save/restore across two unpaired
+ stack slots when optimizing. This rounding could be avoided with
+ more complex reordering of the register saves, but that would seem
+ to be a lot of code complexity for little gain. */
+ || (reg_size > 8 && optimize))
+ reg_size = EPIPHANY_STACK_ALIGN (reg_size);
+ if (total_size + reg_size <= (unsigned) epiphany_stack_offset
+ && !interrupt_p
+ && current_function_is_leaf && !frame_pointer_needed)
+ {
+ first_slot = -1;
+ last_slot = -1;
+ goto alloc_done;
+ }
+ else if (reg_size
+ && !interrupt_p
+ && reg_size < (unsigned HOST_WIDE_INT) epiphany_stack_offset)
+ reg_size = epiphany_stack_offset;
+ if (interrupt_p)
+ {
+ if (total_size + reg_size < 0x3fc)
+ {
+ first_slot_offset = EPIPHANY_STACK_ALIGN (total_size + reg_size);
+ first_slot_offset += EPIPHANY_STACK_ALIGN (epiphany_stack_offset);
+ last_slot = -1;
+ }
+ else
+ {
+ first_slot_offset = EPIPHANY_STACK_ALIGN (reg_size);
+ last_slot_offset = EPIPHANY_STACK_ALIGN (total_size);
+ last_slot_offset += EPIPHANY_STACK_ALIGN (epiphany_stack_offset);
+ if (last_slot >= 0)
+ CLEAR_HARD_REG_BIT (gmask, last_slot);
+ }
+ }
+ else if (total_size + reg_size < 0x1ffc && first_slot >= 0)
+ {
+ first_slot_offset = EPIPHANY_STACK_ALIGN (total_size + reg_size);
+ last_slot = -1;
+ }
+ else
+ {
+ if (total_size + reg_size <= (unsigned) epiphany_stack_offset)
+ {
+ gcc_assert (first_slot < 0);
+ gcc_assert (reg_size == 0);
+ last_slot_offset = EPIPHANY_STACK_ALIGN (total_size + reg_size);
+ }
+ else
+ {
+ first_slot_offset
+ = (reg_size
+ ? EPIPHANY_STACK_ALIGN (reg_size - epiphany_stack_offset) : 0);
+ if (!first_slot_offset)
+ {
+ if (first_slot != GPR_FP || !current_frame_info.need_fp)
+ last_slot = first_slot;
+ first_slot = -1;
+ }
+ last_slot_offset = EPIPHANY_STACK_ALIGN (total_size);
+ if (reg_size)
+ last_slot_offset += EPIPHANY_STACK_ALIGN (epiphany_stack_offset);
+ }
+ if (last_slot >= 0)
+ CLEAR_HARD_REG_BIT (gmask, last_slot);
+ }
+ alloc_done:
+ if (first_slot >= 0)
+ {
+ CLEAR_HARD_REG_BIT (gmask, first_slot);
+ if (TEST_HARD_REG_BIT (gmask, first_slot ^ 1)
+ && epiphany_stack_offset - pretend_size >= 2 * UNITS_PER_WORD)
+ {
+ CLEAR_HARD_REG_BIT (gmask, first_slot ^ 1);
+ first_slot_size = 2 * UNITS_PER_WORD;
+ first_slot &= ~1;
+ }
+ }
+ total_size = first_slot_offset + last_slot_offset;
+
+ lr_slot_offset
+ = (frame_pointer_needed ? first_slot_offset : (long) total_size);
+ if (first_slot != GPR_LR)
+ {
+ int stack_offset = epiphany_stack_offset - UNITS_PER_WORD;
+
+ for (regno = 0; ; regno++)
+ {
+ if (stack_offset + UNITS_PER_WORD - first_slot_size == 0
+ && first_slot >= 0)
+ {
+ stack_offset -= first_slot_size;
+ regno--;
+ }
+ else if (regno == GPR_LR)
+ break;
+ else if TEST_HARD_REG_BIT (gmask, regno)
+ stack_offset -= UNITS_PER_WORD;
+ }
+ lr_slot_offset += stack_offset;
+ }
+
+ /* Save computed information. */
+ current_frame_info.total_size = total_size;
+ current_frame_info.pretend_size = pretend_size;
+ current_frame_info.var_size = var_size;
+ current_frame_info.args_size = args_size;
+ current_frame_info.reg_size = reg_size;
+ COPY_HARD_REG_SET (current_frame_info.gmask, gmask);
+ current_frame_info.first_slot = first_slot;
+ current_frame_info.last_slot = last_slot;
+ current_frame_info.first_slot_offset = first_slot_offset;
+ current_frame_info.first_slot_size = first_slot_size;
+ current_frame_info.last_slot_offset = last_slot_offset;
+ MACHINE_FUNCTION (cfun)->lr_slot_offset = lr_slot_offset;
+
+ current_frame_info.initialized = reload_completed;
+
+ /* Ok, we're done. */
+ return total_size;
+}
+
+/* Print operand X (an rtx) in assembler syntax to file FILE.
+ CODE is a letter or dot (`z' in `%z0') or 0 if no letter was specified.
+ For `%' followed by punctuation, CODE is the punctuation and X is null. */
+
+static void
+epiphany_print_operand (FILE *file, rtx x, int code)
+{
+ switch (code)
+ {
+ case 'd':
+ fputs (epiphany_condition_codes[get_epiphany_condition_code (x)], file);
+ return;
+ case 'D':
+ fputs (epiphany_condition_codes[EPIPHANY_INVERSE_CONDITION_CODE
+ (get_epiphany_condition_code (x))],
+ file);
+ return;
+
+ case 'X':
+ current_frame_info.stld_sz = 8;
+ break;
+
+ case 'C' :
+ current_frame_info.stld_sz = 4;
+ break;
+
+ case 'c' :
+ current_frame_info.stld_sz = 2;
+ break;
+
+ case 'f':
+ fputs (REG_P (x) ? "jalr " : "bl ", file);
+ break;
+
+ case '-':
+ fprintf (file, "r%d", epiphany_m1reg);
+ return;
+
+ case 0 :
+ /* Do nothing special. */
+ break;
+ default :
+ /* Unknown flag. */
+ output_operand_lossage ("invalid operand output code");
+ }
+
+ switch (GET_CODE (x))
+ {
+ rtx addr;
+ rtx offset;
+
+ case REG :
+ fputs (reg_names[REGNO (x)], file);
+ break;
+ case MEM :
+ if (code == 0)
+ current_frame_info.stld_sz = 1;
+ fputc ('[', file);
+ addr = XEXP (x, 0);
+ switch (GET_CODE (addr))
+ {
+ case POST_INC:
+ offset = GEN_INT (GET_MODE_SIZE (GET_MODE (x)));
+ addr = XEXP (addr, 0);
+ break;
+ case POST_DEC:
+ offset = GEN_INT (-GET_MODE_SIZE (GET_MODE (x)));
+ addr = XEXP (addr, 0);
+ break;
+ case POST_MODIFY:
+ offset = XEXP (XEXP (addr, 1), 1);
+ addr = XEXP (addr, 0);
+ break;
+ default:
+ offset = 0;
+ break;
+ }
+ output_address (addr);
+ fputc (']', file);
+ if (offset)
+ {
+ fputc (',', file);
+ if (CONST_INT_P (offset)) switch (GET_MODE_SIZE (GET_MODE (x)))
+ {
+ default:
+ gcc_unreachable ();
+ case 8:
+ offset = GEN_INT (INTVAL (offset) >> 3);
+ break;
+ case 4:
+ offset = GEN_INT (INTVAL (offset) >> 2);
+ break;
+ case 2:
+ offset = GEN_INT (INTVAL (offset) >> 1);
+ break;
+ case 1:
+ break;
+ }
+ output_address (offset);
+ }
+ break;
+ case CONST_DOUBLE :
+ /* We handle SFmode constants here as output_addr_const doesn't. */
+ if (GET_MODE (x) == SFmode)
+ {
+ REAL_VALUE_TYPE d;
+ long l;
+
+ REAL_VALUE_FROM_CONST_DOUBLE (d, x);
+ REAL_VALUE_TO_TARGET_SINGLE (d, l);
+ fprintf (file, "%s0x%08lx", IMMEDIATE_PREFIX, l);
+ break;
+ }
+ /* Fall through. Let output_addr_const deal with it. */
+ case CONST_INT:
+ fprintf(file,"%s",IMMEDIATE_PREFIX);
+ if (code == 'C' || code == 'X')
+ {
+ fprintf (file, "%ld",
+ (long) (INTVAL (x) / current_frame_info.stld_sz));
+ break;
+ }
+ /* Fall through */
+ default :
+ output_addr_const (file, x);
+ break;
+ }
+}
+
+/* Print a memory address as an operand to reference that memory location. */
+
+static void
+epiphany_print_operand_address (FILE *file, rtx addr)
+{
+ register rtx base, index = 0;
+ int offset = 0;
+
+ switch (GET_CODE (addr))
+ {
+ case REG :
+ fputs (reg_names[REGNO (addr)], file);
+ break;
+ case SYMBOL_REF :
+ if (/*???*/ 0 && SYMBOL_REF_FUNCTION_P (addr))
+ {
+ output_addr_const (file, addr);
+ }
+ else
+ {
+ output_addr_const (file, addr);
+ }
+ break;
+ case PLUS :
+ if (GET_CODE (XEXP (addr, 0)) == CONST_INT)
+ offset = INTVAL (XEXP (addr, 0)), base = XEXP (addr, 1);
+ else if (GET_CODE (XEXP (addr, 1)) == CONST_INT)
+ offset = INTVAL (XEXP (addr, 1)), base = XEXP (addr, 0);
+ else
+ base = XEXP (addr, 0), index = XEXP (addr, 1);
+ gcc_assert (GET_CODE (base) == REG);
+ fputs (reg_names[REGNO (base)], file);
+ if (index == 0)
+ {
+ /*
+ ** ++rk quirky method to scale offset for ld/str.......
+ */
+ fprintf (file, ",%s%d", IMMEDIATE_PREFIX,
+ offset/current_frame_info.stld_sz);
+ }
+ else
+ {
+ switch (GET_CODE (index))
+ {
+ case REG:
+ fprintf (file, ",%s", reg_names[REGNO (index)]);
+ break;
+ case SYMBOL_REF:
+ fputc (',', file), output_addr_const (file, index);
+ break;
+ default:
+ gcc_unreachable ();
+ }
+ }
+ break;
+ case PRE_INC: case PRE_DEC: case POST_INC: case POST_DEC: case POST_MODIFY:
+ /* We shouldn't get here as we've lost the mode of the memory object
+ (which says how much to inc/dec by. */
+ gcc_unreachable ();
+ break;
+ default:
+ output_addr_const (file, addr);
+ break;
+ }
+}
+
+void
+epiphany_final_prescan_insn (rtx insn ATTRIBUTE_UNUSED,
+ rtx *opvec ATTRIBUTE_UNUSED,
+ int noperands ATTRIBUTE_UNUSED)
+{
+ int i = epiphany_n_nops;
+ rtx pat ATTRIBUTE_UNUSED;
+
+ while (i--)
+ fputs ("\tnop\n", asm_out_file);
+}
+
+
+/* Worker function for TARGET_RETURN_IN_MEMORY. */
+
+static bool
+epiphany_return_in_memory (const_tree type, const_tree fntype ATTRIBUTE_UNUSED)
+{
+ HOST_WIDE_INT size = int_size_in_bytes (type);
+
+ if (AGGREGATE_TYPE_P (type)
+ && (TYPE_MODE (type) == BLKmode || TYPE_NEEDS_CONSTRUCTING (type)))
+ return true;
+ return (size == -1 || size > 8);
+}
+
+/* For EPIPHANY, All aggregates and arguments greater than 8 bytes are
+ passed by reference. */
+
+static bool
+epiphany_pass_by_reference (cumulative_args_t ca ATTRIBUTE_UNUSED,
+ enum machine_mode mode, const_tree type,
+ bool named ATTRIBUTE_UNUSED)
+{
+ if (type)
+ {
+ if (AGGREGATE_TYPE_P (type)
+ && (mode == BLKmode || TYPE_NEEDS_CONSTRUCTING (type)))
+ return true;
+ }
+ return false;
+}
+
+
+static rtx
+epiphany_function_value (const_tree ret_type,
+ const_tree fn_decl_or_type ATTRIBUTE_UNUSED,
+ bool outgoing ATTRIBUTE_UNUSED)
+{
+ enum machine_mode mode;
+
+ mode = TYPE_MODE (ret_type);
+ /* We must change the mode like PROMOTE_MODE does.
+ ??? PROMOTE_MODE is ignored for non-scalar types.
+ The set of types tested here has to be kept in sync
+ with the one in explow.c:promote_mode. */
+ if (GET_MODE_CLASS (mode) == MODE_INT
+ && GET_MODE_SIZE (mode) < 4
+ && (TREE_CODE (ret_type) == INTEGER_TYPE
+ || TREE_CODE (ret_type) == ENUMERAL_TYPE
+ || TREE_CODE (ret_type) == BOOLEAN_TYPE
+ || TREE_CODE (ret_type) == OFFSET_TYPE))
+ mode = SImode;
+ return gen_rtx_REG (mode, 0);
+}
+
+static rtx
+epiphany_libcall_value (enum machine_mode mode, const_rtx fun ATTRIBUTE_UNUSED)
+{
+ return gen_rtx_REG (mode, 0);
+}
+
+bool
+epiphany_function_value_regno_p (const unsigned int regno ATTRIBUTE_UNUSED)
+{
+ return regno == 0;
+}
+
+/* Fix up invalid option settings. */
+static void
+epiphany_override_options (void)
+{
+ if (epiphany_stack_offset < 4)
+ error ("stack_offset must be at least 4");
+ if (epiphany_stack_offset & 3)
+ error ("stack_offset must be a multiple of 4");
+ epiphany_stack_offset = (epiphany_stack_offset + 3) & -4;
+
+ /* This needs to be done at start up. It's convenient to do it here. */
+ epiphany_init ();
+}
+
+/* For a DImode load / store SET, make a SImode set for a
+ REG_FRAME_RELATED_EXPR note, using OFFSET to create a high or lowpart
+ subreg. */
+static rtx
+frame_subreg_note (rtx set, int offset)
+{
+ rtx src = simplify_gen_subreg (SImode, SET_SRC (set), DImode, offset);
+ rtx dst = simplify_gen_subreg (SImode, SET_DEST (set), DImode, offset);
+
+ set = gen_rtx_SET (VOIDmode, dst ,src);
+ RTX_FRAME_RELATED_P (set) = 1;
+ return set;
+}
+
+static rtx
+frame_insn (rtx x)
+{
+ int i;
+ rtx note = NULL_RTX;
+
+ if (GET_CODE (x) == PARALLEL)
+ {
+ rtx part = XVECEXP (x, 0, 0);
+
+ if (GET_MODE (SET_DEST (part)) == DImode)
+ {
+ note = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (XVECLEN (x, 0) + 1));
+ XVECEXP (note, 0, 0) = frame_subreg_note (part, 0);
+ XVECEXP (note, 0, 1) = frame_subreg_note (part, UNITS_PER_WORD);
+ for (i = XVECLEN (x, 0) - 1; i >= 1; i--)
+ {
+ part = copy_rtx (XVECEXP (x, 0, i));
+
+ if (GET_CODE (part) == SET)
+ RTX_FRAME_RELATED_P (part) = 1;
+ XVECEXP (note, 0, i + 1) = part;
+ }
+ }
+ else
+ {
+ for (i = XVECLEN (x, 0) - 1; i >= 0; i--)
+ {
+ part = XVECEXP (x, 0, i);
+
+ if (GET_CODE (part) == SET)
+ RTX_FRAME_RELATED_P (part) = 1;
+ }
+ }
+ }
+ else if (GET_CODE (x) == SET && GET_MODE (SET_DEST (x)) == DImode)
+ note = gen_rtx_PARALLEL (VOIDmode,
+ gen_rtvec (2, frame_subreg_note (x, 0),
+ frame_subreg_note (x, UNITS_PER_WORD)));
+ x = emit_insn (x);
+ RTX_FRAME_RELATED_P (x) = 1;
+ if (note)
+ add_reg_note (x, REG_FRAME_RELATED_EXPR, note);
+ return x;
+}
+
+static rtx
+frame_move_insn (rtx to, rtx from)
+{
+ return frame_insn (gen_rtx_SET (VOIDmode, to, from));
+}
+
+/* Generate a MEM referring to a varargs argument slot. */
+
+static rtx
+gen_varargs_mem (enum machine_mode mode, rtx addr)
+{
+ rtx mem = gen_rtx_MEM (mode, addr);
+ MEM_NOTRAP_P (mem) = 1;
+ set_mem_alias_set (mem, get_varargs_alias_set ());
+ return mem;
+}
+
+/* Emit instructions to save or restore registers in the range [MIN..LIMIT) .
+ If EPILOGUE_P is 0, save; if it is one, restore.
+ ADDR is the stack slot to save the first register to; subsequent
+ registers are written to lower addresses.
+ However, the order of register pairs can be reversed in order to
+ use double-word load-store instructions. Likewise, an unpaired single
+ word save slot can be skipped while double saves are carried out, and
+ reused when a single register is to be saved. */
+
+static void
+epiphany_emit_save_restore (int min, int limit, rtx addr, int epilogue_p)
+{
+ int i;
+ int stack_offset
+ = current_frame_info.first_slot >= 0 ? epiphany_stack_offset : 0;
+ rtx skipped_mem = NULL_RTX;
+ int last_saved = limit - 1;
+
+ if (!optimize)
+ while (last_saved >= 0
+ && !TEST_HARD_REG_BIT (current_frame_info.gmask, last_saved))
+ last_saved--;
+ for (i = 0; i < limit; i++)
+ {
+ enum machine_mode mode = word_mode;
+ rtx mem, reg;
+ int n = i;
+ rtx (*gen_mem) (enum machine_mode, rtx) = gen_frame_mem;
+
+ /* Make sure we push the arguments in the right order. */
+ if (n < MAX_EPIPHANY_PARM_REGS && crtl->args.pretend_args_size)
+ {
+ n = MAX_EPIPHANY_PARM_REGS - 1 - n;
+ gen_mem = gen_varargs_mem;
+ }
+ if (stack_offset == current_frame_info.first_slot_size
+ && current_frame_info.first_slot >= 0)
+ {
+ if (current_frame_info.first_slot_size > UNITS_PER_WORD)
+ {
+ mode = DImode;
+ addr = plus_constant (addr, - (HOST_WIDE_INT) UNITS_PER_WORD);
+ }
+ if (i-- < min || !epilogue_p)
+ goto next_slot;
+ n = current_frame_info.first_slot;
+ gen_mem = gen_frame_mem;
+ }
+ else if (n == UNKNOWN_REGNUM
+ && stack_offset > current_frame_info.first_slot_size)
+ {
+ i--;
+ goto next_slot;
+ }
+ else if (!TEST_HARD_REG_BIT (current_frame_info.gmask, n))
+ continue;
+ else if (i < min)
+ goto next_slot;
+
+ /* Check for a register pair to save. */
+ if (n == i
+ && (n >= MAX_EPIPHANY_PARM_REGS || crtl->args.pretend_args_size == 0)
+ && (n & 1) == 0 && n+1 < limit
+ && TEST_HARD_REG_BIT (current_frame_info.gmask, n+1))
+ {
+ /* If it fits in the current stack slot pair, place it there. */
+ if (GET_CODE (addr) == PLUS && (stack_offset & 7) == 0
+ && stack_offset != 2 * UNITS_PER_WORD
+ && (current_frame_info.last_slot < 0
+ || INTVAL (XEXP (addr, 1)) != UNITS_PER_WORD)
+ && (n+1 != last_saved || !skipped_mem))
+ {
+ mode = DImode;
+ i++;
+ addr = plus_constant (addr, - (HOST_WIDE_INT) UNITS_PER_WORD);
+ }
+ /* If it fits in the following stack slot pair, that's fine, too. */
+ else if (GET_CODE (addr) == PLUS && (stack_offset & 7) == 4
+ && stack_offset != 2 * UNITS_PER_WORD
+ && stack_offset != 3 * UNITS_PER_WORD
+ && (current_frame_info.last_slot < 0
+ || INTVAL (XEXP (addr, 1)) != 2 * UNITS_PER_WORD)
+ && n + 1 != last_saved)
+ {
+ gcc_assert (!skipped_mem);
+ stack_offset -= GET_MODE_SIZE (mode);
+ skipped_mem = gen_mem (mode, addr);
+ mode = DImode;
+ i++;
+ addr = plus_constant (addr, - (HOST_WIDE_INT) 2 * UNITS_PER_WORD);
+ }
+ }
+ reg = gen_rtx_REG (mode, n);
+ if (mode != DImode && skipped_mem)
+ mem = skipped_mem;
+ else
+ mem = gen_mem (mode, addr);
+ if (!epilogue_p)
+ frame_move_insn (mem, reg);
+ else if (n >= MAX_EPIPHANY_PARM_REGS || !crtl->args.pretend_args_size)
+ emit_move_insn (reg, mem);
+ if (mem == skipped_mem)
+ {
+ skipped_mem = NULL_RTX;
+ continue;
+ }
+ next_slot:
+ addr = plus_constant (addr, - (HOST_WIDE_INT) UNITS_PER_WORD);
+ stack_offset -= GET_MODE_SIZE (mode);
+ }
+}
+
+void
+epiphany_expand_prologue (void)
+{
+ int interrupt_p;
+ enum epiphany_function_type fn_type;
+ rtx addr, mem, off, reg;
+ rtx save_config;
+
+ if (!current_frame_info.initialized)
+ epiphany_compute_frame_size (get_frame_size ());
+
+ /* It is debatable if we should adjust this by epiphany_stack_offset. */
+ if (flag_stack_usage_info)
+ current_function_static_stack_size = current_frame_info.total_size;
+
+ fn_type = epiphany_compute_function_type (current_function_decl);
+ interrupt_p = EPIPHANY_INTERRUPT_P (fn_type);
+
+ if (interrupt_p)
+ {
+ addr = plus_constant (stack_pointer_rtx,
+ - (HOST_WIDE_INT) 2 * UNITS_PER_WORD);
+ frame_move_insn (gen_frame_mem (DImode, addr),
+ gen_rtx_REG (DImode, GPR_0));
+ frame_move_insn (gen_rtx_REG (SImode, GPR_0),
+ gen_rtx_REG (word_mode, STATUS_REGNUM));
+ frame_move_insn (gen_rtx_REG (SImode, GPR_0+1),
+ gen_rtx_REG (word_mode, IRET_REGNUM));
+ mem = gen_frame_mem (BLKmode, stack_pointer_rtx);
+ off = GEN_INT (-current_frame_info.first_slot_offset);
+ frame_insn (gen_stack_adjust_add (off, mem));
+ if (!epiphany_uninterruptible_p (current_function_decl))
+ emit_insn (gen_gie ());
+ addr = plus_constant (stack_pointer_rtx,
+ current_frame_info.first_slot_offset
+ - (HOST_WIDE_INT) 3 * UNITS_PER_WORD);
+ }
+ else
+ {
+ addr = plus_constant (stack_pointer_rtx,
+ epiphany_stack_offset
+ - (HOST_WIDE_INT) UNITS_PER_WORD);
+ epiphany_emit_save_restore (0, current_frame_info.small_threshold,
+ addr, 0);
+ /* Allocate register save area; for small to medium size frames,
+ allocate the entire frame; this is joint with one register save. */
+ if (current_frame_info.first_slot >= 0)
+ {
+ enum machine_mode mode
+ = (current_frame_info.first_slot_size == UNITS_PER_WORD
+ ? word_mode : DImode);
+
+ off = GEN_INT (-current_frame_info.first_slot_offset);
+ mem = gen_frame_mem (BLKmode,
+ gen_rtx_PLUS (Pmode, stack_pointer_rtx, off));
+ frame_insn (gen_stack_adjust_str
+ (gen_frame_mem (mode, stack_pointer_rtx),
+ gen_rtx_REG (mode, current_frame_info.first_slot),
+ off, mem));
+ addr = plus_constant (addr, current_frame_info.first_slot_offset);
+ }
+ }
+ epiphany_emit_save_restore (current_frame_info.small_threshold,
+ FIRST_PSEUDO_REGISTER, addr, 0);
+ if (current_frame_info.need_fp)
+ frame_move_insn (hard_frame_pointer_rtx, stack_pointer_rtx);
+ /* For large frames, allocate bulk of frame. This is usually joint with one
+ register save. */
+ if (current_frame_info.last_slot >= 0)
+ {
+ gcc_assert (current_frame_info.last_slot != GPR_FP
+ || (!current_frame_info.need_fp
+ && current_frame_info.first_slot < 0));
+ off = GEN_INT (-current_frame_info.last_slot_offset);
+ mem = gen_frame_mem (BLKmode,
+ gen_rtx_PLUS (Pmode, stack_pointer_rtx, off));
+ reg = gen_rtx_REG (Pmode, GPR_IP);
+ frame_move_insn (reg, off);
+ frame_insn (gen_stack_adjust_str
+ (gen_frame_mem (word_mode, stack_pointer_rtx),
+ gen_rtx_REG (word_mode, current_frame_info.last_slot),
+ reg, mem));
+ }
+ /* If there is only one or no register to save, yet we have a large frame,
+ use an add. */
+ else if (current_frame_info.last_slot_offset)
+ {
+ mem = gen_frame_mem (BLKmode,
+ plus_constant (stack_pointer_rtx,
+ current_frame_info.last_slot_offset));
+ off = GEN_INT (-current_frame_info.last_slot_offset);
+ if (!SIMM11 (INTVAL (off)))
+ {
+ reg = gen_rtx_REG (Pmode, GPR_IP);
+ frame_move_insn (reg, off);
+ off = reg;
+ }
+ frame_insn (gen_stack_adjust_add (off, mem));
+ }
+
+ /* Mode switching uses get_hard_reg_initial_val after
+ emit_initial_value_sets, so we have to fix this up now. */
+ save_config = has_hard_reg_initial_val (SImode, CONFIG_REGNUM);
+ if (save_config)
+ {
+ if (REG_P (save_config))
+ {
+ if (REGNO (save_config) >= FIRST_PSEUDO_REGISTER)
+ gcc_assert (!df_regs_ever_live_p (REGNO (save_config)));
+ else
+ frame_move_insn (save_config,
+ get_hard_reg_initial_reg (save_config));
+ }
+ else
+ {
+ rtx save_dst = save_config;
+
+ reg = gen_rtx_REG (SImode, GPR_IP);
+ gcc_assert (MEM_P (save_dst));
+ if (!memory_operand (save_dst, SImode))
+ {
+ rtx addr = XEXP (save_dst, 0);
+ rtx reg2 = gen_rtx_REG (SImode, GPR_16);
+
+ gcc_assert (GET_CODE (addr) == PLUS);
+ gcc_assert (XEXP (addr, 0) == hard_frame_pointer_rtx
+ || XEXP (addr, 0) == stack_pointer_rtx);
+ emit_move_insn (reg2, XEXP (addr, 1));
+ save_dst
+ = replace_equiv_address (save_dst,
+ gen_rtx_PLUS (Pmode, XEXP (addr, 0),
+ reg2));
+ }
+ emit_move_insn (reg, get_hard_reg_initial_reg (save_config));
+ emit_move_insn (save_dst, reg);
+ }
+ }
+}
+
+void
+epiphany_expand_epilogue (int sibcall_p)
+{
+ int interrupt_p;
+ enum epiphany_function_type fn_type;
+ rtx mem, addr, reg, off;
+ HOST_WIDE_INT restore_offset;
+
+ fn_type = epiphany_compute_function_type( current_function_decl);
+ interrupt_p = EPIPHANY_INTERRUPT_P (fn_type);
+
+ /* For variable frames, deallocate bulk of frame. */
+ if (current_frame_info.need_fp)
+ {
+ mem = gen_frame_mem (BLKmode, stack_pointer_rtx);
+ emit_insn (gen_stack_adjust_mov (mem));
+ }
+ /* Else for large static frames, deallocate bulk of frame. */
+ else if (current_frame_info.last_slot_offset)
+ {
+ mem = gen_frame_mem (BLKmode, stack_pointer_rtx);
+ reg = gen_rtx_REG (Pmode, GPR_IP);
+ emit_move_insn (reg, GEN_INT (current_frame_info.last_slot_offset));
+ emit_insn (gen_stack_adjust_add (reg, mem));
+ }
+ restore_offset = (interrupt_p
+ ? - 3 * UNITS_PER_WORD
+ : epiphany_stack_offset - (HOST_WIDE_INT) UNITS_PER_WORD);
+ addr = plus_constant (stack_pointer_rtx,
+ (current_frame_info.first_slot_offset
+ + restore_offset));
+ epiphany_emit_save_restore (current_frame_info.small_threshold,
+ FIRST_PSEUDO_REGISTER, addr, 1);
+
+ if (interrupt_p && !epiphany_uninterruptible_p (current_function_decl))
+ emit_insn (gen_gid ());
+
+ off = GEN_INT (current_frame_info.first_slot_offset);
+ mem = gen_frame_mem (BLKmode, stack_pointer_rtx);
+ /* For large / variable size frames, deallocating the register save area is
+ joint with one register restore; for medium size frames, we use a
+ dummy post-increment load to dealloacte the whole frame. */
+ if (!SIMM11 (INTVAL (off)) || current_frame_info.last_slot >= 0)
+ {
+ emit_insn (gen_stack_adjust_ldr
+ (gen_rtx_REG (word_mode,
+ (current_frame_info.last_slot >= 0
+ ? current_frame_info.last_slot : GPR_IP)),
+ gen_frame_mem (word_mode, stack_pointer_rtx),
+ off,
+ mem));
+ }
+ /* While for small frames, we deallocate the entire frame with one add. */
+ else if (INTVAL (off))
+ {
+ emit_insn (gen_stack_adjust_add (off, mem));
+ }
+ if (interrupt_p)
+ {
+ frame_move_insn (gen_rtx_REG (word_mode, STATUS_REGNUM),
+ gen_rtx_REG (SImode, GPR_0));
+ frame_move_insn (gen_rtx_REG (word_mode, IRET_REGNUM),
+ gen_rtx_REG (SImode, GPR_0+1));
+ addr = plus_constant (stack_pointer_rtx,
+ - (HOST_WIDE_INT) 2 * UNITS_PER_WORD);
+ frame_move_insn (gen_rtx_REG (DImode, GPR_0),
+ gen_frame_mem (DImode, addr));
+ }
+ addr = plus_constant (stack_pointer_rtx,
+ epiphany_stack_offset - (HOST_WIDE_INT) UNITS_PER_WORD);
+ epiphany_emit_save_restore (0, current_frame_info.small_threshold, addr, 1);
+ if (!sibcall_p)
+ {
+ if (interrupt_p)
+ emit_jump_insn (gen_return_internal_interrupt());
+ else
+ emit_jump_insn (gen_return_i ());
+ }
+}
+
+int
+epiphany_initial_elimination_offset (int from, int to)
+{
+ epiphany_compute_frame_size (get_frame_size ());
+ if (from == FRAME_POINTER_REGNUM && to == STACK_POINTER_REGNUM)
+ return current_frame_info.total_size - current_frame_info.reg_size;
+ if (from == FRAME_POINTER_REGNUM && to == HARD_FRAME_POINTER_REGNUM)
+ return current_frame_info.first_slot_offset - current_frame_info.reg_size;
+ if (from == ARG_POINTER_REGNUM && to == STACK_POINTER_REGNUM)
+ return (current_frame_info.total_size
+ - ((current_frame_info.pretend_size + 4) & -8));
+ if (from == ARG_POINTER_REGNUM && to == HARD_FRAME_POINTER_REGNUM)
+ return (current_frame_info.first_slot_offset
+ - ((current_frame_info.pretend_size + 4) & -8));
+ gcc_unreachable ();
+}
+
+static int
+epiphany_issue_rate (void)
+{
+ return 2;
+}
+
+/* Function to update the integer COST
+ based on the relationship between INSN that is dependent on
+ DEP_INSN through the dependence LINK. The default is to make no
+ adjustment to COST. This can be used for example to specify to
+ the scheduler that an output- or anti-dependence does not incur
+ the same cost as a data-dependence. The return value should be
+ the new value for COST. */
+static int
+epiphany_adjust_cost (rtx insn, rtx link, rtx dep_insn, int cost)
+{
+ if (REG_NOTE_KIND (link) == 0)
+ {
+ rtx dep_set;
+
+ if (recog_memoized (insn) < 0
+ || recog_memoized (dep_insn) < 0)
+ return cost;
+
+ dep_set = single_set (dep_insn);
+
+ /* The latency that we specify in the scheduling description refers
+ to the actual output, not to an auto-increment register; for that,
+ the latency is one. */
+ if (dep_set && MEM_P (SET_SRC (dep_set)) && cost > 1)
+ {
+ rtx set = single_set (insn);
+
+ if (set
+ && !reg_mentioned_p (SET_DEST (dep_set), SET_SRC (set))
+ && (!MEM_P (SET_DEST (set))
+ || !reg_mentioned_p (SET_DEST (dep_set),
+ XEXP (SET_DEST (set), 0))))
+ cost = 1;
+ }
+ }
+ return cost;
+}
+
+#define REG_OK_FOR_INDEX_P(X) REG_OK_FOR_BASE_P (X)
+
+#define RTX_OK_FOR_BASE_P(X) \
+ (REG_P (X) && REG_OK_FOR_BASE_P (X))
+
+#define RTX_OK_FOR_INDEX_P(MODE, X) \
+ ((GET_MODE_CLASS (MODE) != MODE_VECTOR_INT \
+ || epiphany_vect_align >= GET_MODE_SIZE (MODE)) \
+ && (REG_P (X) && REG_OK_FOR_INDEX_P (X)))
+
+#define LEGITIMATE_OFFSET_ADDRESS_P(MODE, X) \
+(GET_CODE (X) == PLUS \
+ && RTX_OK_FOR_BASE_P (XEXP (X, 0)) \
+ && (RTX_OK_FOR_INDEX_P (MODE, XEXP (X, 1)) \
+ || RTX_OK_FOR_OFFSET_P (MODE, XEXP (X, 1))))
+
+static bool
+epiphany_legitimate_address_p (enum machine_mode mode, rtx x, bool strict)
+{
+#define REG_OK_FOR_BASE_P(X) \
+ (strict ? GPR_P (REGNO (X)) : GPR_AP_OR_PSEUDO_P (REGNO (X)))
+ if (RTX_OK_FOR_BASE_P (x))
+ return true;
+ if (RTX_FRAME_OFFSET_P (x))
+ return true;
+ if (LEGITIMATE_OFFSET_ADDRESS_P (mode, x))
+ return true;
+ if (TARGET_POST_INC
+ && (GET_CODE (x) == POST_DEC || GET_CODE (x) == POST_INC)
+ && RTX_OK_FOR_BASE_P (XEXP ((x), 0)))
+ return true;
+ if ((TARGET_POST_MODIFY || reload_completed)
+ && GET_CODE (x) == POST_MODIFY
+ && GET_CODE (XEXP ((x), 1)) == PLUS
+ && rtx_equal_p (XEXP ((x), 0), XEXP (XEXP ((x), 1), 0))
+ && LEGITIMATE_OFFSET_ADDRESS_P (mode, XEXP ((x), 1)))
+ return true;
+ if (mode == BLKmode)
+ return true;
+ return false;
+}
+
+static reg_class_t
+epiphany_secondary_reload (bool in_p, rtx x, reg_class_t rclass,
+ enum machine_mode mode ATTRIBUTE_UNUSED,
+ secondary_reload_info *sri)
+{
+ /* This could give more reload inheritance, but we are missing some
+ reload infrastructure. */
+ if (0)
+ if (in_p && GET_CODE (x) == UNSPEC
+ && satisfies_constraint_Sra (x) && !satisfies_constraint_Rra (x))
+ {
+ gcc_assert (rclass == GENERAL_REGS);
+ sri->icode = CODE_FOR_reload_insi_ra;
+ return NO_REGS;
+ }
+ return NO_REGS;
+}
+
+bool
+epiphany_is_long_call_p (rtx x)
+{
+ tree decl = SYMBOL_REF_DECL (x);
+ bool ret_val = !TARGET_SHORT_CALLS;
+ tree attrs;
+
+ /* ??? Is it safe to default to ret_val if decl is NULL? We should
+ probably encode information via encode_section_info, and also
+ have (an) option(s) to take SYMBOL_FLAG_LOCAL and/or SYMBOL_FLAG_EXTERNAL
+ into account. */
+ if (decl)
+ {
+ attrs = TYPE_ATTRIBUTES (TREE_TYPE (decl));
+ if (lookup_attribute ("long_call", attrs))
+ ret_val = true;
+ else if (lookup_attribute ("short_call", attrs))
+ ret_val = false;
+ }
+ return ret_val;
+}
+
+bool
+epiphany_small16 (rtx x)
+{
+ rtx base = x;
+ rtx offs ATTRIBUTE_UNUSED = const0_rtx;
+
+ if (GET_CODE (x) == CONST && GET_CODE (XEXP (x, 0)) == PLUS)
+ {
+ base = XEXP (XEXP (x, 0), 0);
+ offs = XEXP (XEXP (x, 0), 1);
+ }
+ if (GET_CODE (base) == SYMBOL_REF && SYMBOL_REF_FUNCTION_P (base)
+ && epiphany_is_long_call_p (base))
+ return false;
+ return TARGET_SMALL16 != 0;
+}
+
+/* Return nonzero if it is ok to make a tail-call to DECL. */
+static bool
+epiphany_function_ok_for_sibcall (tree decl, tree exp)
+{
+ bool cfun_interrupt_p, call_interrupt_p;
+
+ cfun_interrupt_p = EPIPHANY_INTERRUPT_P (epiphany_compute_function_type
+ (current_function_decl));
+ if (decl)
+ call_interrupt_p = EPIPHANY_INTERRUPT_P (epiphany_compute_function_type (decl));
+ else
+ {
+ tree fn_type = TREE_TYPE (CALL_EXPR_FN (exp));
+
+ gcc_assert (POINTER_TYPE_P (fn_type));
+ fn_type = TREE_TYPE (fn_type);
+ gcc_assert (TREE_CODE (fn_type) == FUNCTION_TYPE
+ || TREE_CODE (fn_type) == METHOD_TYPE);
+ call_interrupt_p
+ = lookup_attribute ("interrupt", TYPE_ATTRIBUTES (fn_type)) != NULL;
+ }
+
+ /* Don't tailcall from or to an ISR routine - although we could in
+ principle tailcall from one ISR routine to another, we'd need to
+ handle this in sibcall_epilogue to make it work. */
+ if (cfun_interrupt_p || call_interrupt_p)
+ return false;
+
+ /* Everything else is ok. */
+ return true;
+}
+
+/* T is a function declaration or the MEM_EXPR of a MEM passed to a call
+ expander.
+ Return true iff the type of T has the uninterruptible attribute.
+ If T is NULL, return false. */
+bool
+epiphany_uninterruptible_p (tree t)
+{
+ tree attrs;
+
+ if (t)
+ {
+ attrs = TYPE_ATTRIBUTES (TREE_TYPE (t));
+ if (lookup_attribute ("disinterrupt", attrs))
+ return true;
+ }
+ return false;
+}
+
+bool
+epiphany_call_uninterruptible_p (rtx mem)
+{
+ rtx addr = XEXP (mem, 0);
+ tree t = NULL_TREE;
+
+ if (GET_CODE (addr) == SYMBOL_REF)
+ t = SYMBOL_REF_DECL (addr);
+ if (!t)
+ t = MEM_EXPR (mem);
+ return epiphany_uninterruptible_p (t);
+}
+
+static enum machine_mode
+epiphany_promote_function_mode (const_tree type, enum machine_mode mode,
+ int *punsignedp ATTRIBUTE_UNUSED,
+ const_tree funtype ATTRIBUTE_UNUSED,
+ int for_return ATTRIBUTE_UNUSED)
+{
+ int dummy;
+
+ return promote_mode (type, mode, &dummy);
+}
+
+static void
+epiphany_conditional_register_usage (void)
+{
+ int i;
+
+ if (PIC_OFFSET_TABLE_REGNUM != INVALID_REGNUM)
+ {
+ fixed_regs[PIC_OFFSET_TABLE_REGNUM] = 1;
+ call_used_regs[PIC_OFFSET_TABLE_REGNUM] = 1;
+ }
+ if (TARGET_HALF_REG_FILE)
+ {
+ for (i = 32; i <= 63; i++)
+ {
+ fixed_regs[i] = 1;
+ call_used_regs[i] = 1;
+ }
+ }
+ if (epiphany_m1reg >= 0)
+ {
+ fixed_regs[epiphany_m1reg] = 1;
+ call_used_regs[epiphany_m1reg] = 1;
+ }
+ if (!TARGET_PREFER_SHORT_INSN_REGS)
+ CLEAR_HARD_REG_SET (reg_class_contents[SHORT_INSN_REGS]);
+ COPY_HARD_REG_SET (reg_class_contents[SIBCALL_REGS],
+ reg_class_contents[GENERAL_REGS]);
+ /* It would be simpler and quicker if we could just use
+ AND_COMPL_HARD_REG_SET, alas, call_used_reg_set is yet uninitialized;
+ it is set up later by our caller. */
+ for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
+ if (!call_used_regs[i])
+ CLEAR_HARD_REG_BIT (reg_class_contents[SIBCALL_REGS], i);
+}
+
+/* Determine where to put an argument to a function.
+ Value is zero to push the argument on the stack,
+ or a hard register in which to store the argument.
+
+ MODE is the argument's machine mode.
+ TYPE is the data type of the argument (as a tree).
+ This is null for libcalls where that information may
+ not be available.
+ CUM is a variable of type CUMULATIVE_ARGS which gives info about
+ the preceding args and about the function being called.
+ NAMED is nonzero if this argument is a named parameter
+ (otherwise it is an extra parameter matching an ellipsis). */
+/* On the EPIPHANY the first MAX_EPIPHANY_PARM_REGS args are normally in
+ registers and the rest are pushed. */
+static rtx
+epiphany_function_arg (cumulative_args_t cum_v, enum machine_mode mode,
+ const_tree type, bool named ATTRIBUTE_UNUSED)
+{
+ CUMULATIVE_ARGS cum = *get_cumulative_args (cum_v);
+
+ if (PASS_IN_REG_P (cum, mode, type))
+ return gen_rtx_REG (mode, ROUND_ADVANCE_CUM (cum, mode, type));
+ return 0;
+}
+
+/* Update the data in CUM to advance over an argument
+ of mode MODE and data type TYPE.
+ (TYPE is null for libcalls where that information may not be available.) */
+static void
+epiphany_function_arg_advance (cumulative_args_t cum_v, enum machine_mode mode,
+ const_tree type, bool named ATTRIBUTE_UNUSED)
+{
+ CUMULATIVE_ARGS *cum = get_cumulative_args (cum_v);
+
+ *cum = ROUND_ADVANCE_CUM (*cum, mode, type) + ROUND_ADVANCE_ARG (mode, type);
+}
+
+/* Nested function support.
+ An epiphany trampoline looks like this:
+ mov r16,%low(fnaddr)
+ movt r16,%high(fnaddr)
+ mov ip,%low(cxt)
+ movt ip,%high(cxt)
+ jr r16 */
+
+#define EPIPHANY_LOW_RTX(X) \
+ (gen_rtx_IOR (SImode, \
+ gen_rtx_ASHIFT (SImode, \
+ gen_rtx_AND (SImode, (X), GEN_INT (0xff)), GEN_INT (5)), \
+ gen_rtx_ASHIFT (SImode, \
+ gen_rtx_AND (SImode, (X), GEN_INT (0xff00)), GEN_INT (12))))
+#define EPIPHANY_HIGH_RTX(X) \
+ EPIPHANY_LOW_RTX (gen_rtx_LSHIFTRT (SImode, (X), GEN_INT (16)))
+
+/* Emit RTL insns to initialize the variable parts of a trampoline.
+ FNADDR is an RTX for the address of the function's pure code.
+ CXT is an RTX for the static chain value for the function. */
+static void
+epiphany_trampoline_init (rtx tramp_mem, tree fndecl, rtx cxt)
+{
+ rtx fnaddr = XEXP (DECL_RTL (fndecl), 0);
+ rtx tramp = force_reg (Pmode, XEXP (tramp_mem, 0));
+
+ emit_move_insn (gen_rtx_MEM (SImode, plus_constant (tramp, 0)),
+ gen_rtx_IOR (SImode, GEN_INT (0x4002000b),
+ EPIPHANY_LOW_RTX (fnaddr)));
+ emit_move_insn (gen_rtx_MEM (SImode, plus_constant (tramp, 4)),
+ gen_rtx_IOR (SImode, GEN_INT (0x5002000b),
+ EPIPHANY_HIGH_RTX (fnaddr)));
+ emit_move_insn (gen_rtx_MEM (SImode, plus_constant (tramp, 8)),
+ gen_rtx_IOR (SImode, GEN_INT (0x2002800b),
+ EPIPHANY_LOW_RTX (cxt)));
+ emit_move_insn (gen_rtx_MEM (SImode, plus_constant (tramp, 12)),
+ gen_rtx_IOR (SImode, GEN_INT (0x3002800b),
+ EPIPHANY_HIGH_RTX (cxt)));
+ emit_move_insn (gen_rtx_MEM (SImode, plus_constant (tramp, 16)),
+ GEN_INT (0x0802014f));
+}
+
+bool
+epiphany_optimize_mode_switching (int entity)
+{
+ if (MACHINE_FUNCTION (cfun)->sw_entities_processed & (1 << entity))
+ return false;
+ switch (entity)
+ {
+ case EPIPHANY_MSW_ENTITY_AND:
+ case EPIPHANY_MSW_ENTITY_OR:
+ return true;
+ case EPIPHANY_MSW_ENTITY_NEAREST:
+ case EPIPHANY_MSW_ENTITY_TRUNC:
+ return optimize > 0;
+ case EPIPHANY_MSW_ENTITY_ROUND_UNKNOWN:
+ return MACHINE_FUNCTION (cfun)->unknown_mode_uses != 0;
+ case EPIPHANY_MSW_ENTITY_ROUND_KNOWN:
+ return (MACHINE_FUNCTION (cfun)->sw_entities_processed
+ & (1 << EPIPHANY_MSW_ENTITY_ROUND_UNKNOWN)) != 0;
+ case EPIPHANY_MSW_ENTITY_FPU_OMNIBUS:
+ return optimize == 0 || current_pass == &pass_mode_switch_use.pass;
+ }
+ gcc_unreachable ();
+}
+
+int
+epiphany_mode_priority_to_mode (int entity, unsigned priority)
+{
+ if (entity == EPIPHANY_MSW_ENTITY_AND || entity == EPIPHANY_MSW_ENTITY_OR)
+ return priority;
+ if (priority > 3)
+ switch (priority)
+ {
+ case 4: return FP_MODE_ROUND_UNKNOWN;
+ case 5: return FP_MODE_NONE;
+ default: gcc_unreachable ();
+ }
+ switch ((enum attr_fp_mode) epiphany_normal_fp_mode)
+ {
+ case FP_MODE_INT:
+ switch (priority)
+ {
+ case 0: return FP_MODE_INT;
+ case 1: return epiphany_normal_fp_rounding;
+ case 2: return (epiphany_normal_fp_rounding == FP_MODE_ROUND_NEAREST
+ ? FP_MODE_ROUND_TRUNC : FP_MODE_ROUND_NEAREST);
+ case 3: return FP_MODE_CALLER;
+ }
+ case FP_MODE_ROUND_NEAREST:
+ case FP_MODE_CALLER:
+ switch (priority)
+ {
+ case 0: return FP_MODE_ROUND_NEAREST;
+ case 1: return FP_MODE_ROUND_TRUNC;
+ case 2: return FP_MODE_INT;
+ case 3: return FP_MODE_CALLER;
+ }
+ case FP_MODE_ROUND_TRUNC:
+ switch (priority)
+ {
+ case 0: return FP_MODE_ROUND_TRUNC;
+ case 1: return FP_MODE_ROUND_NEAREST;
+ case 2: return FP_MODE_INT;
+ case 3: return FP_MODE_CALLER;
+ }
+ case FP_MODE_ROUND_UNKNOWN:
+ case FP_MODE_NONE:
+ gcc_unreachable ();
+ }
+ gcc_unreachable ();
+}
+
+int
+epiphany_mode_needed (int entity, rtx insn)
+{
+ enum attr_fp_mode mode;
+
+ if (recog_memoized (insn) < 0)
+ {
+ if (entity == EPIPHANY_MSW_ENTITY_AND
+ || entity == EPIPHANY_MSW_ENTITY_OR)
+ return 2;
+ return FP_MODE_NONE;
+ }
+ mode = get_attr_fp_mode (insn);
+
+ switch (entity)
+ {
+ case EPIPHANY_MSW_ENTITY_AND:
+ return mode != FP_MODE_INT ? 1 : 2;
+ case EPIPHANY_MSW_ENTITY_OR:
+ return mode == FP_MODE_INT ? 1 : 2;
+ case EPIPHANY_MSW_ENTITY_ROUND_KNOWN:
+ if (recog_memoized (insn) == CODE_FOR_set_fp_mode)
+ mode = (enum attr_fp_mode) epiphany_mode_after (entity, mode, insn);
+ /* Fall through. */
+ case EPIPHANY_MSW_ENTITY_NEAREST:
+ case EPIPHANY_MSW_ENTITY_TRUNC:
+ if (mode == FP_MODE_ROUND_UNKNOWN)
+ {
+ MACHINE_FUNCTION (cfun)->unknown_mode_uses++;
+ return FP_MODE_NONE;
+ }
+ return mode;
+ case EPIPHANY_MSW_ENTITY_ROUND_UNKNOWN:
+ if (mode == FP_MODE_ROUND_NEAREST || mode == FP_MODE_ROUND_TRUNC)
+ return FP_MODE_ROUND_UNKNOWN;
+ return mode;
+ case EPIPHANY_MSW_ENTITY_FPU_OMNIBUS:
+ if (mode == FP_MODE_ROUND_UNKNOWN)
+ return epiphany_normal_fp_rounding;
+ return mode;
+ default:
+ gcc_unreachable ();
+ }
+}
+
+int
+epiphany_mode_entry_exit (int entity, bool exit)
+{
+ int normal_mode = epiphany_normal_fp_mode ;
+
+ MACHINE_FUNCTION (cfun)->sw_entities_processed |= (1 << entity);
+ if (epiphany_is_interrupt_p (current_function_decl))
+ normal_mode = FP_MODE_CALLER;
+ switch (entity)
+ {
+ case EPIPHANY_MSW_ENTITY_AND:
+ if (exit)
+ return normal_mode != FP_MODE_INT ? 1 : 2;
+ return 0;
+ case EPIPHANY_MSW_ENTITY_OR:
+ if (exit)
+ return normal_mode == FP_MODE_INT ? 1 : 2;
+ return 0;
+ case EPIPHANY_MSW_ENTITY_ROUND_UNKNOWN:
+ if (normal_mode == FP_MODE_ROUND_NEAREST
+ || normal_mode == FP_MODE_ROUND_TRUNC)
+ return FP_MODE_ROUND_UNKNOWN;
+ /* Fall through. */
+ case EPIPHANY_MSW_ENTITY_NEAREST:
+ case EPIPHANY_MSW_ENTITY_TRUNC:
+ case EPIPHANY_MSW_ENTITY_ROUND_KNOWN:
+ case EPIPHANY_MSW_ENTITY_FPU_OMNIBUS:
+ return normal_mode;
+ default:
+ gcc_unreachable ();
+ }
+}
+
+int
+epiphany_mode_after (int entity, int last_mode, rtx insn)
+{
+ /* We have too few call-saved registers to hope to keep the masks across
+ calls. */
+ if (entity == EPIPHANY_MSW_ENTITY_AND || entity == EPIPHANY_MSW_ENTITY_OR)
+ {
+ if (GET_CODE (insn) == CALL_INSN)
+ return 0;
+ return last_mode;
+ }
+ if (recog_memoized (insn) < 0)
+ return last_mode;
+ if (get_attr_fp_mode (insn) == FP_MODE_ROUND_UNKNOWN
+ && last_mode != FP_MODE_ROUND_NEAREST && last_mode != FP_MODE_ROUND_TRUNC)
+ {
+ if (entity == EPIPHANY_MSW_ENTITY_NEAREST)
+ return FP_MODE_ROUND_NEAREST;
+ if (entity == EPIPHANY_MSW_ENTITY_TRUNC)
+ return FP_MODE_ROUND_TRUNC;
+ }
+ if (recog_memoized (insn) == CODE_FOR_set_fp_mode)
+ {
+ rtx src = SET_SRC (XVECEXP (PATTERN (insn), 0, 0));
+ int fp_mode;
+
+ if (REG_P (src))
+ return FP_MODE_CALLER;
+ fp_mode = INTVAL (XVECEXP (XEXP (src, 0), 0, 0));
+ if (entity == EPIPHANY_MSW_ENTITY_ROUND_UNKNOWN
+ && (fp_mode == FP_MODE_ROUND_NEAREST
+ || fp_mode == EPIPHANY_MSW_ENTITY_TRUNC))
+ return FP_MODE_ROUND_UNKNOWN;
+ return fp_mode;
+ }
+ return last_mode;
+}
+
+void
+emit_set_fp_mode (int entity, int mode, HARD_REG_SET regs_live ATTRIBUTE_UNUSED)
+{
+ rtx save_cc, cc_reg, mask, src, src2;
+ enum attr_fp_mode fp_mode;
+
+ if (!MACHINE_FUNCTION (cfun)->and_mask)
+ {
+ MACHINE_FUNCTION (cfun)->and_mask = gen_reg_rtx (SImode);
+ MACHINE_FUNCTION (cfun)->or_mask = gen_reg_rtx (SImode);
+ }
+ if (entity == EPIPHANY_MSW_ENTITY_AND)
+ {
+ gcc_assert (mode >= 0 && mode <= 2);
+ if (mode == 1)
+ emit_move_insn (MACHINE_FUNCTION (cfun)->and_mask,
+ gen_int_mode (0xfff1fffe, SImode));
+ return;
+ }
+ else if (entity == EPIPHANY_MSW_ENTITY_OR)
+ {
+ gcc_assert (mode >= 0 && mode <= 2);
+ if (mode == 1)
+ emit_move_insn (MACHINE_FUNCTION (cfun)->or_mask, GEN_INT(0x00080000));
+ return;
+ }
+ fp_mode = (enum attr_fp_mode) mode;
+ src = NULL_RTX;
+
+ switch (fp_mode)
+ {
+ case FP_MODE_CALLER:
+ src = get_hard_reg_initial_val (SImode, CONFIG_REGNUM);
+ mask = MACHINE_FUNCTION (cfun)->and_mask;
+ break;
+ case FP_MODE_ROUND_UNKNOWN:
+ MACHINE_FUNCTION (cfun)->unknown_mode_sets++;
+ mask = MACHINE_FUNCTION (cfun)->and_mask;
+ break;
+ case FP_MODE_ROUND_NEAREST:
+ if (entity == EPIPHANY_MSW_ENTITY_TRUNC)
+ return;
+ mask = MACHINE_FUNCTION (cfun)->and_mask;
+ break;
+ case FP_MODE_ROUND_TRUNC:
+ if (entity == EPIPHANY_MSW_ENTITY_NEAREST)
+ return;
+ mask = MACHINE_FUNCTION (cfun)->and_mask;
+ break;
+ case FP_MODE_INT:
+ mask = MACHINE_FUNCTION (cfun)->or_mask;
+ break;
+ case FP_MODE_NONE:
+ default:
+ gcc_unreachable ();
+ }
+ save_cc = gen_reg_rtx (CCmode);
+ cc_reg = gen_rtx_REG (CCmode, CC_REGNUM);
+ emit_move_insn (save_cc, cc_reg);
+ mask = force_reg (SImode, mask);
+ if (!src)
+ {
+ rtvec v = gen_rtvec (1, GEN_INT (fp_mode));
+
+ src = gen_rtx_CONST (SImode, gen_rtx_UNSPEC (SImode, v, UNSPEC_FP_MODE));
+ }
+ if (entity == EPIPHANY_MSW_ENTITY_ROUND_KNOWN
+ || entity == EPIPHANY_MSW_ENTITY_FPU_OMNIBUS)
+ src2 = copy_rtx (src);
+ else
+ {
+ rtvec v = gen_rtvec (1, GEN_INT (FP_MODE_ROUND_UNKNOWN));
+
+ src2 = gen_rtx_CONST (SImode, gen_rtx_UNSPEC (SImode, v, UNSPEC_FP_MODE));
+ }
+ emit_insn (gen_set_fp_mode (src, src2, mask));
+ emit_move_insn (cc_reg, save_cc);
+}
+
+void
+epiphany_expand_set_fp_mode (rtx *operands)
+{
+ rtx ctrl = gen_rtx_REG (SImode, CONFIG_REGNUM);
+ rtx src = operands[0];
+ rtx mask_reg = operands[2];
+ rtx scratch = operands[3];
+ enum attr_fp_mode fp_mode;
+
+
+ gcc_assert (rtx_equal_p (src, operands[1])
+ /* Sometimes reload gets silly and reloads the same pseudo
+ into different registers. */
+ || (REG_P (src) && REG_P (operands[1])));
+
+ if (!epiphany_uninterruptible_p (current_function_decl))
+ emit_insn (gen_gid ());
+ emit_move_insn (scratch, ctrl);
+
+ if (GET_CODE (src) == REG)
+ {
+ /* FP_MODE_CALLER */
+ emit_insn (gen_xorsi3 (scratch, scratch, src));
+ emit_insn (gen_andsi3 (scratch, scratch, mask_reg));
+ emit_insn (gen_xorsi3 (scratch, scratch, src));
+ }
+ else
+ {
+ gcc_assert (GET_CODE (src) == CONST);
+ src = XEXP (src, 0);
+ fp_mode = (enum attr_fp_mode) INTVAL (XVECEXP (src, 0, 0));
+ switch (fp_mode)
+ {
+ case FP_MODE_ROUND_NEAREST:
+ emit_insn (gen_andsi3 (scratch, scratch, mask_reg));
+ break;
+ case FP_MODE_ROUND_TRUNC:
+ emit_insn (gen_andsi3 (scratch, scratch, mask_reg));
+ emit_insn (gen_add2_insn (scratch, const1_rtx));
+ break;
+ case FP_MODE_INT:
+ emit_insn (gen_iorsi3 (scratch, scratch, mask_reg));
+ break;
+ case FP_MODE_CALLER:
+ case FP_MODE_ROUND_UNKNOWN:
+ case FP_MODE_NONE:
+ gcc_unreachable ();
+ }
+ }
+ emit_move_insn (ctrl, scratch);
+ if (!epiphany_uninterruptible_p (current_function_decl))
+ emit_insn (gen_gie ());
+}
+
+void
+epiphany_insert_mode_switch_use (rtx insn,
+ int entity ATTRIBUTE_UNUSED,
+ int mode ATTRIBUTE_UNUSED)
+{
+ rtx pat = PATTERN (insn);
+ rtvec v;
+ int len, i;
+ rtx near = gen_rtx_REG (SImode, FP_NEAREST_REGNUM);
+ rtx trunc = gen_rtx_REG (SImode, FP_TRUNCATE_REGNUM);
+
+ if (entity != EPIPHANY_MSW_ENTITY_FPU_OMNIBUS)
+ return;
+ switch ((enum attr_fp_mode) get_attr_fp_mode (insn))
+ {
+ case FP_MODE_ROUND_NEAREST:
+ near = gen_rtx_USE (VOIDmode, near);
+ trunc = gen_rtx_CLOBBER (VOIDmode, trunc);
+ break;
+ case FP_MODE_ROUND_TRUNC:
+ near = gen_rtx_CLOBBER (VOIDmode, near);
+ trunc = gen_rtx_USE (VOIDmode, trunc);
+ break;
+ case FP_MODE_ROUND_UNKNOWN:
+ near = gen_rtx_USE (VOIDmode, gen_rtx_REG (SImode, FP_ANYFP_REGNUM));
+ trunc = copy_rtx (near);
+ /* Fall through. */
+ case FP_MODE_INT:
+ case FP_MODE_CALLER:
+ near = gen_rtx_USE (VOIDmode, near);
+ trunc = gen_rtx_USE (VOIDmode, trunc);
+ break;
+ case FP_MODE_NONE:
+ gcc_unreachable ();
+ }
+ gcc_assert (GET_CODE (pat) == PARALLEL);
+ len = XVECLEN (pat, 0);
+ v = rtvec_alloc (len + 2);
+ for (i = 0; i < len; i++)
+ RTVEC_ELT (v, i) = XVECEXP (pat, 0, i);
+ RTVEC_ELT (v, len) = near;
+ RTVEC_ELT (v, len + 1) = trunc;
+ pat = gen_rtx_PARALLEL (VOIDmode, v);
+ PATTERN (insn) = pat;
+ MACHINE_FUNCTION (cfun)->control_use_inserted = true;
+}
+
+bool
+epiphany_epilogue_uses (int regno)
+{
+ if (regno == GPR_LR)
+ return true;
+ if (reload_completed && epiphany_is_interrupt_p (current_function_decl))
+ {
+ if (fixed_regs[regno]
+ && regno != STATUS_REGNUM && regno != IRET_REGNUM
+ && regno != FP_NEAREST_REGNUM && regno != FP_TRUNCATE_REGNUM)
+ return false;
+ return true;
+ }
+ if (regno == FP_NEAREST_REGNUM
+ && epiphany_normal_fp_mode != FP_MODE_ROUND_TRUNC)
+ return true;
+ if (regno == FP_TRUNCATE_REGNUM
+ && epiphany_normal_fp_mode != FP_MODE_ROUND_NEAREST)
+ return true;
+ return false;
+}
+
+static unsigned int
+epiphany_min_divisions_for_recip_mul (enum machine_mode mode)
+{
+ if (flag_reciprocal_math && mode == SFmode)
+ /* We'll expand into a multiply-by-reciprocal anyway, so we might a well do
+ it already at the tree level and expose it to further optimizations. */
+ return 1;
+ return default_min_divisions_for_recip_mul (mode);
+}
+
+static enum machine_mode
+epiphany_preferred_simd_mode (enum machine_mode mode ATTRIBUTE_UNUSED)
+{
+ return TARGET_VECT_DOUBLE ? DImode : SImode;
+}
+
+static bool
+epiphany_vector_mode_supported_p (enum machine_mode mode)
+{
+ if (mode == V2SFmode)
+ return true;
+ if (GET_MODE_CLASS (mode) == MODE_VECTOR_INT
+ && (GET_MODE_SIZE (mode) == 4 || GET_MODE_SIZE (mode) == 8))
+ return true;
+ return false;
+}
+
+static bool
+epiphany_vector_alignment_reachable (const_tree type, bool is_packed)
+{
+ /* Vectors which aren't in packed structures will not be less aligned than
+ the natural alignment of their element type, so this is safe. */
+ if (TYPE_ALIGN_UNIT (type) == 4)
+ return !is_packed;
+
+ return default_builtin_vector_alignment_reachable (type, is_packed);
+}
+
+static bool
+epiphany_support_vector_misalignment (enum machine_mode mode, const_tree type,
+ int misalignment, bool is_packed)
+{
+ if (GET_MODE_SIZE (mode) == 8 && misalignment % 4 == 0)
+ return true;
+ return default_builtin_support_vector_misalignment (mode, type, misalignment,
+ is_packed);
+}
+
+/* STRUCTURE_SIZE_BOUNDARY seems a bit crude in how it enlarges small
+ structs. Make structs double-word-aligned it they are a double word or
+ (potentially) larger; failing that, do the same for a size of 32 bits. */
+unsigned
+epiphany_special_round_type_align (tree type, unsigned computed,
+ unsigned specified)
+{
+ unsigned align = MAX (computed, specified);
+ tree field;
+ HOST_WIDE_INT total, max;
+ unsigned try_align = FASTEST_ALIGNMENT;
+
+ if (maximum_field_alignment && try_align > maximum_field_alignment)
+ try_align = maximum_field_alignment;
+ if (align >= try_align)
+ return align;
+ for (max = 0, field = TYPE_FIELDS (type); field; field = DECL_CHAIN (field))
+ {
+ tree offset, size;
+
+ if (TREE_CODE (field) != FIELD_DECL
+ || TREE_TYPE (field) == error_mark_node)
+ continue;
+ offset = bit_position (field);
+ size = DECL_SIZE (field);
+ if (!host_integerp (offset, 1) || !host_integerp (size, 1)
+ || TREE_INT_CST_LOW (offset) >= try_align
+ || TREE_INT_CST_LOW (size) >= try_align)
+ return try_align;
+ total = TREE_INT_CST_LOW (offset) + TREE_INT_CST_LOW (size);
+ if (total > max)
+ max = total;
+ }
+ if (max >= (HOST_WIDE_INT) try_align)
+ align = try_align;
+ else if (try_align > 32 && max >= 32)
+ align = max > 32 ? 64 : 32;
+ return align;
+}
+
+/* Upping the alignment of arrays in structs is not only a performance
+ enhancement, it also helps preserve assumptions about how
+ arrays-at-the-end-of-structs work, like for struct gcov_fn_info in
+ libgcov.c . */
+unsigned
+epiphany_adjust_field_align (tree field, unsigned computed)
+{
+ if (computed == 32
+ && TREE_CODE (TREE_TYPE (field)) == ARRAY_TYPE)
+ {
+ tree elmsz = TYPE_SIZE (TREE_TYPE (TREE_TYPE (field)));
+
+ if (!host_integerp (elmsz, 1) || tree_low_cst (elmsz, 1) >= 32)
+ return 64;
+ }
+ return computed;
+}
+
+/* Output code to add DELTA to the first argument, and then jump
+ to FUNCTION. Used for C++ multiple inheritance. */
+static void
+epiphany_output_mi_thunk (FILE *file, tree thunk ATTRIBUTE_UNUSED,
+ HOST_WIDE_INT delta,
+ HOST_WIDE_INT vcall_offset,
+ tree function)
+{
+ int this_regno
+ = aggregate_value_p (TREE_TYPE (TREE_TYPE (function)), function) ? 1 : 0;
+ const char *this_name = reg_names[this_regno];
+ const char *fname;
+
+ /* We use IP and R16 as a scratch registers. */
+ gcc_assert (call_used_regs [GPR_IP]);
+ gcc_assert (call_used_regs [GPR_16]);
+
+ /* Add DELTA. When possible use a plain add, otherwise load it into
+ a register first. */
+ if (delta == 0)
+ ; /* Done. */
+ else if (SIMM11 (delta))
+ asm_fprintf (file, "\tadd\t%s,%s,%d\n", this_name, this_name, (int) delta);
+ else if (delta < 0 && delta >= -0xffff)
+ {
+ asm_fprintf (file, "\tmov\tip,%d\n", (int) -delta);
+ asm_fprintf (file, "\tsub\t%s,%s,ip\n", this_name, this_name);
+ }
+ else
+ {
+ asm_fprintf (file, "\tmov\tip,%%low(%ld)\n", (long) delta);
+ if (delta & ~0xffff)
+ asm_fprintf (file, "\tmovt\tip,%%high(%ld)\n", (long) delta);
+ asm_fprintf (file, "\tadd\t%s,%s,ip\n", this_name, this_name);
+ }
+
+ /* If needed, add *(*THIS + VCALL_OFFSET) to THIS. */
+ if (vcall_offset != 0)
+ {
+ /* ldr ip,[this] --> temp = *this
+ ldr ip,[ip,vcall_offset] > temp = *(*this + vcall_offset)
+ add this,this,ip --> this+ = *(*this + vcall_offset) */
+ asm_fprintf (file, "\tldr\tip, [%s]\n", this_name);
+ if (vcall_offset < -0x7ff * 4 || vcall_offset > 0x7ff * 4
+ || (vcall_offset & 3) != 0)
+ {
+ asm_fprintf (file, "\tmov\tr16, %%low(%ld)\n", (long) vcall_offset);
+ asm_fprintf (file, "\tmovt\tr16, %%high(%ld)\n", (long) vcall_offset);
+ asm_fprintf (file, "\tldr\tip, [ip,r16]\n");
+ }
+ else
+ asm_fprintf (file, "\tldr\tip, [ip,%d]\n", (int) vcall_offset / 4);
+ asm_fprintf (file, "\tadd\t%s, %s, ip\n", this_name, this_name);
+ }
+
+ fname = XSTR (XEXP (DECL_RTL (function), 0), 0);
+ if (epiphany_is_long_call_p (XEXP (DECL_RTL (function), 0)))
+ {
+ fputs ("\tmov\tip,%low(", file);
+ assemble_name (file, fname);
+ fputs (")\n\tmovt\tip,%high(", file);
+ assemble_name (file, fname);
+ fputs (")\n\tjr ip\n", file);
+ }
+ else
+ {
+ fputs ("\tb\t", file);
+ assemble_name (file, fname);
+ fputc ('\n', file);
+ }
+}
+
+struct gcc_target targetm = TARGET_INITIALIZER;
diff --git a/gcc/config/epiphany/epiphany.h b/gcc/config/epiphany/epiphany.h
new file mode 100644
index 00000000000..9d03ee909b8
--- /dev/null
+++ b/gcc/config/epiphany/epiphany.h
@@ -0,0 +1,881 @@
+/* Definitions of target machine for GNU compiler, Argonaut EPIPHANY cpu.
+ Copyright (C) 1994, 1995, 1997, 1998, 1999, 2000, 2001, 2002, 2004, 2005,
+ 2007, 2009, 2011 Free Software Foundation, Inc.
+ Contributed by Embecosm on behalf of Adapteva, 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/>. */
+
+#ifndef GCC_EPIPHANY_H
+#define GCC_EPIPHANY_H
+
+#undef LINK_SPEC
+#undef STARTFILE_SPEC
+#undef ENDFILE_SPEC
+#undef SIZE_TYPE
+#undef PTRDIFF_TYPE
+#undef WCHAR_TYPE
+#undef WCHAR_TYPE_SIZE
+
+/* Names to predefine in the preprocessor for this target machine. */
+#define TARGET_CPU_CPP_BUILTINS() \
+ do \
+ { \
+ builtin_define ("__epiphany__"); \
+ builtin_define ("__little_endian__"); \
+ builtin_define_with_int_value ("__EPIPHANY_STACK_OFFSET__", \
+ epiphany_stack_offset); \
+ builtin_assert ("cpu=epiphany"); \
+ builtin_assert ("machine=epiphany"); \
+ } while (0)
+
+/* Pick up the libgloss library. One day we may do this by linker script, but
+ for now its static. */
+#undef LIB_SPEC
+#define LIB_SPEC "%{!shared:%{g*:-lg} %{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}} -lepiphany"
+
+#define LINK_SPEC "%{v}"
+
+#define STARTFILE_SPEC "%{!shared:crt0.o%s} crti.o%s " \
+ "%{mfp-mode=int:crtint.o%s} %{mfp-mode=truncate:crtrunc.o%s} " \
+ "%{m1reg-r43:crtm1reg-r43.o%s} %{m1reg-r63:crtm1reg-r63.o%s} " \
+ "crtbegin.o%s"
+
+#define ENDFILE_SPEC "crtend.o%s crtn.o%s"
+
+#undef USER_LABEL_PREFIX
+#define USER_LABEL_PREFIX "_"
+
+#define CRT_CALL_STATIC_FUNCTION(SECTION_OP, FUNC) \
+ asm (SECTION_OP "\n\
+ mov r0,%low(" USER_LABEL_PREFIX #FUNC")\n\
+ movt r0,%high(" USER_LABEL_PREFIX #FUNC")\n\
+ jalr r0\n\
+ .text");
+
+#if 0 /* We would like to use Posix for profiling, but the simulator
+ interface still lacks mkdir. */
+#define TARGET_POSIX_IO
+#endif
+
+/* Target machine storage layout. */
+
+/* Define this if most significant bit is lowest numbered
+ in instructions that operate on numbered bit-fields. */
+#define BITS_BIG_ENDIAN 0
+
+/* Define this if most significant byte of a word is the lowest numbered. */
+#define BYTES_BIG_ENDIAN 0
+
+/* Define this if most significant word of a multiword number is the lowest
+ numbered. */
+#define WORDS_BIG_ENDIAN 0
+
+/* Width of a word, in units (bytes). */
+#define UNITS_PER_WORD 4
+
+/* Define this macro if it is advisable to hold scalars in registers
+ in a wider mode than that declared by the program. In such cases,
+ the value is constrained to be within the bounds of the declared
+ type, but kept valid in the wider mode. The signedness of the
+ extension may differ from that of the type. */
+/* It is far faster to zero extend chars than to sign extend them */
+
+#define PROMOTE_MODE(MODE, UNSIGNEDP, TYPE) \
+ if (GET_MODE_CLASS (MODE) == MODE_INT \
+ && GET_MODE_SIZE (MODE) < 4) \
+ { \
+ if (MODE == QImode) \
+ UNSIGNEDP = 1; \
+ else if (MODE == HImode) \
+ UNSIGNEDP = 1; \
+ (MODE) = SImode; \
+ }
+
+/* Allocation boundary (in *bits*) for storing arguments in argument list. */
+#define PARM_BOUNDARY 32
+
+/* Boundary (in *bits*) on which stack pointer should be aligned. */
+#define STACK_BOUNDARY 64
+
+/* ALIGN FRAMES on word boundaries */
+#define EPIPHANY_STACK_ALIGN(LOC) (((LOC)+7) & ~7)
+
+/* Allocation boundary (in *bits*) for the code of a function. */
+#define FUNCTION_BOUNDARY 32
+
+/* Every structure's size must be a multiple of this. */
+#define STRUCTURE_SIZE_BOUNDARY 8
+
+/* A bit-field declared as `int' forces `int' alignment for the struct. */
+#define PCC_BITFIELD_TYPE_MATTERS 1
+
+/* No data type wants to be aligned rounder than this. */
+/* This is bigger than currently necessary for the EPIPHANY. If 8 byte floats are
+ ever added it's not clear whether they'll need such alignment or not. For
+ now we assume they will. We can always relax it if necessary but the
+ reverse isn't true. */
+#define BIGGEST_ALIGNMENT 64
+
+/* The best alignment to use in cases where we have a choice. */
+#define FASTEST_ALIGNMENT 64
+
+#define MALLOC_ABI_ALIGNMENT BIGGEST_ALIGNMENT
+
+/* Make strings dword-aligned so strcpy from constants will be faster. */
+#define CONSTANT_ALIGNMENT(EXP, ALIGN) \
+ ((TREE_CODE (EXP) == STRING_CST \
+ && (ALIGN) < FASTEST_ALIGNMENT) \
+ ? FASTEST_ALIGNMENT : (ALIGN))
+
+/* Make arrays of chars dword-aligned for the same reasons.
+ Also, align arrays of SImode items. */
+#define DATA_ALIGNMENT(TYPE, ALIGN) \
+ (TREE_CODE (TYPE) == ARRAY_TYPE \
+ && TYPE_MODE (TREE_TYPE (TYPE)) == QImode \
+ && (ALIGN) < FASTEST_ALIGNMENT \
+ ? FASTEST_ALIGNMENT \
+ : (TREE_CODE (TYPE) == ARRAY_TYPE \
+ && TYPE_MODE (TREE_TYPE (TYPE)) == SImode \
+ && (ALIGN) < FASTEST_ALIGNMENT) \
+ ? FASTEST_ALIGNMENT \
+ : (ALIGN))
+
+/* Set this nonzero if move instructions will actually fail to work
+ when given unaligned data. */
+/* On the EPIPHANY the lower address bits are masked to 0 as necessary. The chip
+ won't croak when given an unaligned address, but the insn will still fail
+ to produce the correct result. */
+#define STRICT_ALIGNMENT 1
+
+/* layout_type overrides our ADJUST_ALIGNMENT settings from epiphany-modes.def
+ for vector modes, so we have to override it back. */
+#define ROUND_TYPE_ALIGN(TYPE, MANGLED_ALIGN, SPECIFIED_ALIGN) \
+ (TREE_CODE (TYPE) == VECTOR_TYPE && !TYPE_USER_ALIGN (TYPE) \
+ && SPECIFIED_ALIGN <= GET_MODE_ALIGNMENT (TYPE_MODE (TYPE)) \
+ ? GET_MODE_ALIGNMENT (TYPE_MODE (TYPE)) \
+ : ((TREE_CODE (TYPE) == RECORD_TYPE \
+ || TREE_CODE (TYPE) == UNION_TYPE \
+ || TREE_CODE (TYPE) == QUAL_UNION_TYPE) \
+ && !TYPE_PACKED (TYPE)) \
+ ? epiphany_special_round_type_align ((TYPE), (MANGLED_ALIGN), \
+ (SPECIFIED_ALIGN)) \
+ : MAX ((MANGLED_ALIGN), (SPECIFIED_ALIGN)))
+
+#define ADJUST_FIELD_ALIGN(FIELD, COMPUTED) \
+ epiphany_adjust_field_align((FIELD), (COMPUTED))
+
+/* Layout of source language data types. */
+
+#define SHORT_TYPE_SIZE 16
+#define INT_TYPE_SIZE 32
+#define LONG_TYPE_SIZE 32
+#define LONG_LONG_TYPE_SIZE 64
+#define FLOAT_TYPE_SIZE 32
+#define DOUBLE_TYPE_SIZE 64
+#define LONG_DOUBLE_TYPE_SIZE 64
+
+/* Define this as 1 if `char' should by default be signed; else as 0. */
+#define DEFAULT_SIGNED_CHAR 0
+
+#define SIZE_TYPE "long unsigned int"
+#define PTRDIFF_TYPE "long int"
+#define WCHAR_TYPE "unsigned int"
+#define WCHAR_TYPE_SIZE BITS_PER_WORD
+
+/* Standard register usage. */
+
+/* Number of actual hardware registers.
+ The hardware registers are assigned numbers for the compiler
+ from 0 to just below FIRST_PSEUDO_REGISTER.
+ All registers that the compiler knows about must be given numbers,
+ even those that are not normally considered general registers. */
+
+#define FIRST_PSEUDO_REGISTER 78
+
+
+/* General purpose registers. */
+#define GPR_FIRST 0 /* First gpr */
+
+#define PIC_REGNO (GPR_FIRST + 28) /* PIC register. */
+#define GPR_LAST (GPR_FIRST + 63) /* Last gpr */
+#define CORE_CONTROL_FIRST CONFIG_REGNUM
+#define CORE_CONTROL_LAST IRET_REGNUM
+
+#define GPR_P(R) IN_RANGE (R, GPR_FIRST, GPR_LAST)
+#define GPR_OR_AP_P(R) (GPR_P (R) || (R) == ARG_POINTER_REGNUM)
+
+#define GPR_OR_PSEUDO_P(R) (GPR_P (R) || (R) >= FIRST_PSEUDO_REGISTER)
+#define GPR_AP_OR_PSEUDO_P(R) (GPR_OR_AP_P (R) || (R) >= FIRST_PSEUDO_REGISTER)
+
+#define FIXED_REGISTERS \
+{ /* Integer Registers */ \
+ 0, 0, 0, 0, 0, 0, 0, 0, /* 000-007, gr0 - gr7 */ \
+ 0, 0, 0, 0, 0, 1, 0, 0, /* 008-015, gr8 - gr15 */ \
+ 0, 0, 0, 0, 0, 0, 0, 0, /* 016-023, gr16 - gr23 */ \
+ 0, 0, 0, 0, 1, 1, 1, 1, /* 024-031, gr24 - gr31 */ \
+ 0, 0, 0, 0, 0, 0, 0, 0, /* 032-039, gr32 - gr39 */ \
+ 1, 1, 1, 1, 0, 0, 0, 0, /* 040-047, gr40 - gr47 */ \
+ 0, 0, 0, 0, 0, 0, 0, 0, /* 048-055, gr48 - gr55 */ \
+ 0, 0, 0, 0, 0, 0, 0, 0, /* 056-063, gr56 - gr63 */ \
+ /* Other registers */ \
+ 1, /* 64 AP - fake arg ptr */ \
+ 1, /* soft frame pointer */ \
+ 1, /* CC_REGNUM - integer conditions */\
+ 1, /* CCFP_REGNUM - fp conditions */\
+ 1, 1, 1, 1, 1, 1, /* Core Control Registers. */ \
+ 1, 1, 1, /* FP_{NEAREST,...}_REGNUM */\
+ 1, /* UNKNOWN_REGNUM - placeholder. */\
+}
+
+/* Like `FIXED_REGISTERS' but has 1 for each register that is clobbered (in
+ general) by function calls as well as for fixed registers. This macro
+ therefore identifies the registers that are not available for general
+ allocation of values that must live across function calls.
+
+ If a register has 0 in `CALL_USED_REGISTERS', the compiler automatically
+ saves it on function entry and restores it on function exit, if the register
+ is used within the function. */
+
+#define CALL_USED_REGISTERS \
+{ /* Integer Registers */ \
+ 1, 1, 1, 1, 0, 0, 0, 0, /* 000-007, gr0 - gr7 */ \
+ 0, 0, 0, 0, 1, 1, 1, 0, /* 008-015, gr8 - gr15 */ \
+ 1, 1, 1, 1, 1, 1, 1, 1, /* 016-023, gr16 - gr23 */ \
+ 1, 1, 1, 1, 1, 1, 1, 1, /* 024-031, gr24 - gr31 */ \
+ 0, 0, 0, 0, 0, 0, 0, 0, /* 032-039, gr32 - gr38 */ \
+ 1, 1, 1, 1, 1, 1, 1, 1, /* 040-047, gr40 - gr47 */ \
+ 1, 1, 1, 1, 1, 1, 1, 1, /* 048-055, gr48 - gr55 */ \
+ 1, 1, 1, 1, 1, 1, 1, 1, /* 056-063, gr56 - gr63 */ \
+ 1, /* 64 AP - fake arg ptr */ \
+ 1, /* soft frame pointer */ \
+ 1, /* 66 CC_REGNUM */ \
+ 1, /* 67 CCFP_REGNUM */ \
+ 1, 1, 1, 1, 1, 1, /* Core Control Registers. */ \
+ 1, 1, 1, /* FP_{NEAREST,...}_REGNUM */\
+ 1, /* UNKNOWN_REGNUM - placeholder. */\
+}
+
+#define REG_ALLOC_ORDER \
+ { \
+ 0, 1, 2, 3, /* Caller-saved 'small' registers. */ \
+ 12, /* Caller-saved unpaired register. */ \
+ /* Caller-saved registers. */ \
+ 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, \
+ 44, 45, 46, 47, \
+ 48, 49, 50, 51, 52, 53, 54, 55, \
+ 56, 57, 58, 59, 60, 61, 62, 63, \
+ 4, 5, 6, 7, /* Calle-saved 'small' registers. */ \
+ 15, /* Calle-saved unpaired register. */ \
+ 8, 9, 10, 11, /* Calle-saved registers. */ \
+ 32, 33, 34, 35, 36, 37, 38, 39, \
+ 14, 13, /* Link register, stack pointer. */ \
+ 40, 41, 42, 43, /* Usually constant, but might be made callee-saved. */ \
+ /* Can't allocate, but must name these... */ \
+ 28, 29, 30, 31, \
+ 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77 \
+ }
+
+/* Return number of consecutive hard regs needed starting at reg REGNO
+ to hold something of mode MODE.
+ This is ordinarily the length in words of a value of mode MODE
+ but can be less for certain modes in special long registers. */
+#define HARD_REGNO_NREGS(REGNO, MODE) \
+((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
+
+/* Value is 1 if hard register REGNO can hold a value of machine-mode MODE. */
+extern const unsigned int epiphany_hard_regno_mode_ok[];
+extern unsigned int epiphany_mode_class[];
+#define HARD_REGNO_MODE_OK(REGNO, MODE) hard_regno_mode_ok((REGNO), (MODE))
+
+/* A C expression that is nonzero if it is desirable to choose
+ register allocation so as to avoid move instructions between a
+ value of mode MODE1 and a value of mode MODE2.
+
+ If `HARD_REGNO_MODE_OK (R, MODE1)' and `HARD_REGNO_MODE_OK (R,
+ MODE2)' are ever different for any R, then `MODES_TIEABLE_P (MODE1,
+ MODE2)' must be zero. */
+
+#define MODES_TIEABLE_P(MODE1, MODE2) 1
+
+/* Register classes and constants. */
+
+/* Define the classes of registers for register constraints in the
+ machine description. Also define ranges of constants.
+
+ One of the classes must always be named ALL_REGS and include all hard regs.
+ If there is more than one class, another class must be named NO_REGS
+ and contain no registers.
+
+ The name GENERAL_REGS must be the name of a class (or an alias for
+ another name such as ALL_REGS). This is the class of registers
+ that is allowed by "g" or "r" in a register constraint.
+ Also, registers outside this class are allocated only when
+ instructions express preferences for them.
+
+ The classes must be numbered in nondecreasing order; that is,
+ a larger-numbered class must never be contained completely
+ in a smaller-numbered class.
+
+ For any two classes, it is very desirable that there be another
+ class that represents their union.
+
+ It is important that any condition codes have class NO_REGS.
+ See `register_operand'. */
+
+enum reg_class {
+ NO_REGS,
+ LR_REGS,
+ SHORT_INSN_REGS,
+ SIBCALL_REGS,
+ GENERAL_REGS,
+ CORE_CONTROL_REGS,
+ ALL_REGS,
+ LIM_REG_CLASSES
+};
+
+#define N_REG_CLASSES ((int) LIM_REG_CLASSES)
+
+/* Give names of register classes as strings for dump file. */
+#define REG_CLASS_NAMES \
+{ \
+ "NO_REGS", \
+ "LR_REGS", \
+ "SHORT_INSN_REGS", \
+ "SIBCALL_REGS", \
+ "GENERAL_REGS", \
+ "CORE_CONTROL_REGS", \
+ "ALL_REGS" \
+}
+
+/* Define which registers fit in which classes.
+ This is an initializer for a vector of HARD_REG_SET
+ of length N_REG_CLASSES. */
+
+#define REG_CLASS_CONTENTS \
+{ /* r0-r31 r32-r63 ap/sfp/cc1/cc2/iret/status */ \
+ { 0x00000000,0x00000000,0x0}, /* NO_REGS */ \
+ { 0x00004000,0x00000000,0x0}, /* LR_REGS */ \
+ { 0x000000ff,0x00000000,0x0}, /* SHORT_INSN_REGS */ \
+ { 0xffff100f,0xffffff00,0x0}, /* SIBCALL_REGS */ \
+ { 0xffffffff,0xffffffff,0x0003}, /* GENERAL_REGS */ \
+ { 0x00000000,0x00000000,0x03f0}, /* CORE_CONTROL_REGS */ \
+ { 0xffffffff,0xffffffff,0x3fff}, /* ALL_REGS */ \
+}
+
+
+/* The same information, inverted:
+ Return the class number of the smallest class containing
+ reg number REGNO. This could be a conditional expression
+ or could index an array. */
+extern enum reg_class epiphany_regno_reg_class[FIRST_PSEUDO_REGISTER];
+#define REGNO_REG_CLASS(REGNO) \
+(epiphany_regno_reg_class[REGNO])
+
+/* The class value for index registers, and the one for base regs. */
+#define BASE_REG_CLASS GENERAL_REGS
+#define INDEX_REG_CLASS GENERAL_REGS
+
+/* These assume that REGNO is a hard or pseudo reg number.
+ They give nonzero only if REGNO is a hard reg of the suitable class
+ or a pseudo reg currently allocated to a suitable hard reg.
+ Since they use reg_renumber, they are safe only once reg_renumber
+ has been allocated, which happens in local-alloc.c. */
+#define REGNO_OK_FOR_BASE_P(REGNO) \
+((REGNO) < FIRST_PSEUDO_REGISTER || (unsigned) reg_renumber[REGNO] < FIRST_PSEUDO_REGISTER)
+#define REGNO_OK_FOR_INDEX_P(REGNO) \
+((REGNO) < FIRST_PSEUDO_REGISTER || (unsigned) reg_renumber[REGNO] < FIRST_PSEUDO_REGISTER)
+
+
+
+/* Given an rtx X being reloaded into a reg required to be
+ in class CLASS, return the class of reg to actually use.
+ In general this is just CLASS; but on some machines
+ in some cases it is preferable to use a more restrictive class. */
+#define PREFERRED_RELOAD_CLASS(X,CLASS) \
+(CLASS)
+
+/* Return the maximum number of consecutive registers
+ needed to represent mode MODE in a register of class CLASS. */
+#define CLASS_MAX_NREGS(CLASS, MODE) \
+((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
+
+/* The letters I, J, K, L, M, N, O, P in a register constraint string
+ can be used to stand for particular ranges of immediate operands.
+ This macro defines what the ranges are.
+ C is the letter, and VALUE is a constant value.
+ Return 1 if VALUE is in the range specified by C. */
+
+/* 'I' is used for 16 bit unsigned.
+ 'Cal' is used for long immediates (32 bits)
+ 'K' is used for any constant up to 5 bits.
+ 'L' is used for any 11 bit signed.
+*/
+
+#define IMM16(X) (IN_RANGE ((X), 0, 0xFFFF))
+#define SIMM16(X) (IN_RANGE ((X), -65536, 65535))
+#define SIMM11(X) (IN_RANGE ((X), -1024, 1023))
+#define IMM5(X) (IN_RANGE ((X), 0, 0x1F))
+
+typedef struct GTY (()) machine_function
+{
+ unsigned args_parsed : 1;
+ unsigned pretend_args_odd : 1;
+ unsigned lr_clobbered : 1;
+ unsigned control_use_inserted : 1;
+ unsigned sw_entities_processed : 6;
+ long lr_slot_offset;
+ rtx and_mask;
+ rtx or_mask;
+ unsigned unknown_mode_uses;
+ unsigned unknown_mode_sets;
+} machine_function_t;
+
+#define MACHINE_FUNCTION(fun) (fun)->machine
+
+#define INIT_EXPANDERS epiphany_init_expanders ()
+
+/* Stack layout and stack pointer usage. */
+
+/* Define this macro if pushing a word onto the stack moves the stack
+ pointer to a smaller address. */
+#define STACK_GROWS_DOWNWARD
+
+/* Define this to nonzero if the nominal address of the stack frame
+ is at the high-address end of the local variables;
+ that is, each additional local variable allocated
+ goes at a more negative offset in the frame. */
+#define FRAME_GROWS_DOWNWARD 1
+
+/* Offset within stack frame to start allocating local variables at.
+ If FRAME_GROWS_DOWNWARD, this is the offset to the END of the
+ first local allocated. Otherwise, it is the offset to the BEGINNING
+ of the first local allocated. */
+#define STARTING_FRAME_OFFSET epiphany_stack_offset
+
+/* Offset from the stack pointer register to the first location at which
+ outgoing arguments are placed. */
+#define STACK_POINTER_OFFSET epiphany_stack_offset
+
+/* Offset of first parameter from the argument pointer register value. */
+/* 4 bytes for each of previous fp, return address, and previous gp.
+ 4 byte reserved area for future considerations. */
+#define FIRST_PARM_OFFSET(FNDECL) \
+ (epiphany_stack_offset \
+ + (MACHINE_FUNCTION (DECL_STRUCT_FUNCTION (FNDECL))->pretend_args_odd \
+ ? 4 : 0))
+
+#define INCOMING_FRAME_SP_OFFSET epiphany_stack_offset
+
+/* Register to use for pushing function arguments. */
+#define STACK_POINTER_REGNUM GPR_SP
+
+/* Base register for access to local variables of the function. */
+#define HARD_FRAME_POINTER_REGNUM GPR_FP
+
+/* Register in which static-chain is passed to a function. This must
+ not be a register used by the prologue. */
+#define STATIC_CHAIN_REGNUM GPR_IP
+
+/* Define the offset between two registers, one to be eliminated, and the other
+ its replacement, at the start of a routine. */
+
+#define ELIMINABLE_REGS \
+{{ FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}, \
+ { FRAME_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM}, \
+ { ARG_POINTER_REGNUM, STACK_POINTER_REGNUM}, \
+ { ARG_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM}, \
+}
+
+/* Define the offset between two registers, one to be eliminated, and the other
+ its replacement, at the start of a routine. */
+
+#define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \
+ ((OFFSET) = epiphany_initial_elimination_offset ((FROM), (TO)))
+
+/* Function argument passing. */
+
+/* If defined, the maximum amount of space required for outgoing
+ arguments will be computed and placed into the variable
+ `current_function_outgoing_args_size'. No space will be pushed
+ onto the stack for each call; instead, the function prologue should
+ increase the stack frame size by this amount. */
+#define ACCUMULATE_OUTGOING_ARGS 1
+
+/* Define a data type for recording info about an argument list
+ during the scan of that argument list. This data type should
+ hold all necessary information about the function itself
+ and about the args processed so far, enough to enable macros
+ such as FUNCTION_ARG to determine where the next arg should go. */
+#define CUMULATIVE_ARGS int
+
+/* Initialize a variable CUM of type CUMULATIVE_ARGS
+ for a call to a function whose data type is FNTYPE.
+ For a library call, FNTYPE is 0. */
+#define INIT_CUMULATIVE_ARGS(CUM, FNTYPE, LIBNAME, INDIRECT, N_NAMED_ARGS) \
+((CUM) = 0)
+
+/* The number of registers used for parameter passing. Local to this file. */
+#define MAX_EPIPHANY_PARM_REGS 4
+
+/* 1 if N is a possible register number for function argument passing. */
+#define FUNCTION_ARG_REGNO_P(N) \
+((unsigned) (N) < MAX_EPIPHANY_PARM_REGS)
+
+/* Return boolean indicating arg of type TYPE and mode MODE will be passed in
+ a reg. This includes arguments that have to be passed by reference as the
+ pointer to them is passed in a reg if one is available (and that is what
+ we're given).
+ This macro is only used in this file. */
+/* We must use partial argument passing because of the chosen mode
+ of varargs handling. */
+#define PASS_IN_REG_P(CUM, MODE, TYPE) \
+ (ROUND_ADVANCE_CUM ((CUM), (MODE), (TYPE)) < MAX_EPIPHANY_PARM_REGS)
+
+/* Tell GCC to use TARGET_RETURN_IN_MEMORY. */
+#define DEFAULT_PCC_STRUCT_RETURN 0
+
+/* EXIT_IGNORE_STACK should be nonzero if, when returning from a function,
+ the stack pointer does not matter. The value is tested only in
+ functions that have frame pointers.
+ No definition is equivalent to always zero. */
+#define EXIT_IGNORE_STACK 1
+
+#define EPILOGUE_USES(REGNO) epiphany_epilogue_uses (REGNO)
+
+/* Output assembler code to FILE to increment profiler label # LABELNO
+ for profiling a function entry. */
+#define FUNCTION_PROFILER(FILE, LABELNO)
+
+/* Given an rtx for the frame pointer,
+ return an rtx for the address of the frame. */
+#define FRAME_ADDR_RTX(frame) \
+ ((frame) == hard_frame_pointer_rtx ? arg_pointer_rtx : NULL)
+
+/* This is not only for dwarf unwind info, but also for the benefit of
+ df-scan.c to tell it that LR is live at the function start. */
+#define INCOMING_RETURN_ADDR_RTX \
+ gen_rtx_REG (Pmode, \
+ (current_function_decl != NULL \
+ && epiphany_is_interrupt_p (current_function_decl) \
+ ? IRET_REGNUM : GPR_LR))
+
+/* However, we haven't implemented the rest needed for dwarf2 unwind info. */
+#define DWARF2_UNWIND_INFO 0
+
+#define RETURN_ADDR_RTX(count, frame) \
+ (count ? NULL_RTX \
+ : gen_rtx_UNSPEC (SImode, gen_rtvec (1, const0_rtx), UNSPEC_RETURN_ADDR))
+
+/* Trampolines.
+ An epiphany trampoline looks like this:
+ mov r16,%low(fnaddr)
+ movt r16,%high(fnaddr)
+ mov ip,%low(cxt)
+ movt ip,%high(cxt)
+ jr r16 */
+
+/* Length in units of the trampoline for entering a nested function. */
+#define TRAMPOLINE_SIZE 20
+
+/* Addressing modes, and classification of registers for them. */
+
+/* Maximum number of registers that can appear in a valid memory address. */
+#define MAX_REGS_PER_ADDRESS 2
+
+/* We have post_modify (load/store with update). */
+#define HAVE_POST_INCREMENT TARGET_POST_INC
+#define HAVE_POST_DECREMENT TARGET_POST_INC
+#define HAVE_POST_MODIFY_DISP TARGET_POST_MODIFY
+#define HAVE_POST_MODIFY_REG TARGET_POST_MODIFY
+
+/* Recognize any constant value that is a valid address. */
+#define CONSTANT_ADDRESS_P(X) \
+(GET_CODE (X) == LABEL_REF || GET_CODE (X) == SYMBOL_REF \
+ || GET_CODE (X) == CONST_INT || GET_CODE (X) == CONST)
+
+#define RTX_OK_FOR_OFFSET_P(MODE, X) \
+ RTX_OK_FOR_OFFSET_1 (GET_MODE_CLASS (MODE) == MODE_VECTOR_INT \
+ && epiphany_vect_align == 4 ? SImode : (MODE), X)
+#define RTX_OK_FOR_OFFSET_1(MODE, X) \
+ (GET_CODE (X) == CONST_INT \
+ && !(INTVAL (X) & (GET_MODE_SIZE (MODE) - 1)) \
+ && INTVAL (X) >= -2047 * (int) GET_MODE_SIZE (MODE) \
+ && INTVAL (X) <= 2047 * (int) GET_MODE_SIZE (MODE))
+
+/* Frame offsets cannot be evaluated till the frame pointer is eliminated. */
+#define RTX_FRAME_OFFSET_P(X) \
+ ((X) == frame_pointer_rtx \
+ || (GET_CODE (X) == PLUS && XEXP ((X), 0) == frame_pointer_rtx \
+ && CONST_INT_P (XEXP ((X), 1))))
+
+/* Given a comparison code (EQ, NE, etc.) and the first operand of a COMPARE,
+ return the mode to be used for the comparison. */
+#define SELECT_CC_MODE(OP, X, Y) \
+ epiphany_select_cc_mode (OP, X, Y)
+
+/* Return nonzero if SELECT_CC_MODE will never return MODE for a
+ floating point inequality comparison. */
+
+#define REVERSE_CONDITION(CODE, MODE) \
+ ((MODE) == CC_FPmode || (MODE) == CC_FP_EQmode || (MODE) == CC_FP_GTEmode \
+ || (MODE) == CC_FP_ORDmode || (MODE) == CC_FP_UNEQmode \
+ ? reverse_condition_maybe_unordered (CODE) \
+ : (MODE) == CCmode ? reverse_condition (CODE) \
+ : UNKNOWN)
+
+/* We can reverse all CCmodes with REVERSE_CONDITION. */
+#define REVERSIBLE_CC_MODE(MODE) \
+ ((MODE) == CCmode || (MODE) == CC_FPmode || (MODE) == CC_FP_EQmode \
+ || (MODE) == CC_FP_GTEmode || (MODE) == CC_FP_ORDmode \
+ || (MODE) == CC_FP_UNEQmode)
+
+/* Costs. */
+
+/* The cost of a branch insn. */
+/* ??? What's the right value here? Branches are certainly more
+ expensive than reg->reg moves. */
+#define BRANCH_COST(speed_p, predictable_p) \
+ (speed_p ? epiphany_branch_cost : 1)
+
+/* Nonzero if access to memory by bytes is slow and undesirable.
+ For RISC chips, it means that access to memory by bytes is no
+ better than access by words when possible, so grab a whole word
+ and maybe make use of that. */
+#define SLOW_BYTE_ACCESS 1
+
+/* Define this macro if it is as good or better to call a constant
+ function address than to call an address kept in a register. */
+/* On the EPIPHANY, calling through registers is slow. */
+#define NO_FUNCTION_CSE
+
+/* Section selection. */
+/* WARNING: These section names also appear in dwarf2out.c. */
+
+#define TEXT_SECTION_ASM_OP "\t.section .text"
+#define DATA_SECTION_ASM_OP "\t.section .data"
+
+#undef READONLY_DATA_SECTION_ASM_OP
+#define READONLY_DATA_SECTION_ASM_OP "\t.section .rodata"
+
+#define BSS_SECTION_ASM_OP "\t.section .bss"
+
+/* Define this macro if jump tables (for tablejump insns) should be
+ output in the text section, along with the assembler instructions.
+ Otherwise, the readonly data section is used.
+ This macro is irrelevant if there is no separate readonly data section. */
+#define JUMP_TABLES_IN_TEXT_SECTION (flag_pic)
+
+/* PIC */
+
+/* The register number of the register used to address a table of static
+ data addresses in memory. In some cases this register is defined by a
+ processor's ``application binary interface'' (ABI). When this macro
+ is defined, RTL is generated for this register once, as with the stack
+ pointer and frame pointer registers. If this macro is not defined, it
+ is up to the machine-dependent files to allocate such a register (if
+ necessary). */
+#define PIC_OFFSET_TABLE_REGNUM (flag_pic ? PIC_REGNO : INVALID_REGNUM)
+
+/* Control the assembler format that we output. */
+
+/* A C string constant describing how to begin a comment in the target
+ assembler language. The compiler assumes that the comment will
+ end at the end of the line. */
+#define ASM_COMMENT_START ";"
+
+/* Output to assembler file text saying following lines
+ may contain character constants, extra white space, comments, etc. */
+#define ASM_APP_ON ""
+
+/* Output to assembler file text saying following lines
+ no longer contain unusual constructs. */
+#define ASM_APP_OFF ""
+
+/* Globalizing directive for a label. */
+#define GLOBAL_ASM_OP "\t.global\t"
+
+/* How to refer to registers in assembler output.
+ This sequence is indexed by compiler's hard-register-number (see above). */
+
+#define REGISTER_NAMES \
+{ \
+ "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", \
+ "r8", "r9", "r10", "fp", "ip", "sp", "lr", "r15", \
+ "r16", "r17","r18", "r19", "r20", "r21", "r22", "r23", \
+ "r24", "r25", "r26", "r27", "r28", "r29", "r30", "r31", \
+ "r32", "r33", "r34", "r35", "r36", "r37", "r38", "r39", \
+ "r40", "r41", "r42", "r43", "r44", "r45", "r46", "r47", \
+ "r48", "r49", "r50", "r51", "r52", "r53", "r54", "r55", \
+ "r56", "r57", "r58", "r59", "r60", "r61", "r62", "r63", \
+ "ap", "sfp", "cc1", "cc2", \
+ "config", "status", "lc", "ls", "le", "iret", \
+ "fp_near", "fp_trunc", "fp_anyfp", "unknown" \
+}
+
+#define FINAL_PRESCAN_INSN(INSN, OPVEC, NOPERANDS) \
+ epiphany_final_prescan_insn (INSN, OPVEC, NOPERANDS)
+
+#define LOCAL_LABEL_PREFIX "."
+
+/* A C expression which evaluates to true if CODE is a valid
+ punctuation character for use in the `PRINT_OPERAND' macro. */
+extern char epiphany_punct_chars[256];
+#define PRINT_OPERAND_PUNCT_VALID_P(CHAR) \
+ epiphany_punct_chars[(unsigned char) (CHAR)]
+
+/* This is how to output an element of a case-vector that is absolute. */
+#define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
+do { \
+ if (CASE_VECTOR_MODE == Pmode) \
+ asm_fprintf ((FILE), "\t.word %LL%d\n", (VALUE)); \
+ else \
+ asm_fprintf ((FILE), "\t.short %LL%d\n", (VALUE)); \
+} while (0)
+
+/* This is how to output an element of a case-vector that is relative. */
+#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \
+do { \
+ if (CASE_VECTOR_MODE == Pmode) \
+ asm_fprintf ((FILE), "\t.word"); \
+ else \
+ asm_fprintf ((FILE), "\t.short"); \
+ asm_fprintf ((FILE), " %LL%d-%LL%d\n", (VALUE), (REL)); \
+} while (0)
+
+/* This is how to output an assembler line
+ that says to advance the location counter
+ to a multiple of 2**LOG bytes. */
+#define ASM_OUTPUT_ALIGN(FILE,LOG) \
+do { if ((LOG) != 0) fprintf (FILE, "\t.balign %d\n", 1 << (LOG)); } while (0)
+
+/* Debugging information. */
+
+/* Generate DBX and DWARF debugging information. */
+#define DBX_DEBUGGING_INFO 1
+
+#undef PREFERRED_DEBUGGING_TYPE
+#define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
+
+/* Turn off splitting of long stabs. */
+#define DBX_CONTIN_LENGTH 0
+
+/* Miscellaneous. */
+
+/* Specify the machine mode that this machine uses
+ for the index in the tablejump instruction. */
+#define CASE_VECTOR_MODE (TARGET_SMALL16 && optimize_size ? HImode : Pmode)
+
+/* Define if operations between registers always perform the operation
+ on the full register even if a narrower mode is specified. */
+#define WORD_REGISTER_OPERATIONS
+
+/* Define if loading in MODE, an integral mode narrower than BITS_PER_WORD
+ will either zero-extend or sign-extend. The value of this macro should
+ be the code that says which one of the two operations is implicitly
+ done, UNKNOWN if none. */
+#define LOAD_EXTEND_OP(MODE) ZERO_EXTEND
+
+/* Max number of bytes we can move from memory to memory
+ in one reasonably fast instruction. */
+#define MOVE_MAX 8
+
+/* Define this to be nonzero if shift instructions ignore all but the low-order
+ few bits. */
+#define SHIFT_COUNT_TRUNCATED 1
+
+/* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits
+ is done just by pretending it is already truncated. */
+#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
+
+/* Specify the machine mode that pointers have.
+ After generation of rtl, the compiler makes no further distinction
+ between pointers and any other objects of this machine mode. */
+
+#define Pmode SImode
+
+/* A function address in a call instruction. */
+#define FUNCTION_MODE SImode
+
+/* EPIPHANY function types. */
+enum epiphany_function_type
+{
+ EPIPHANY_FUNCTION_UNKNOWN, EPIPHANY_FUNCTION_NORMAL,
+ /* These are interrupt handlers. The name corresponds to the register
+ name that contains the return address. */
+ EPIPHANY_FUNCTION_ILINK1, EPIPHANY_FUNCTION_ILINK2,
+ /* These are interrupt handlers. The name corresponds to which type
+ of interrupt handler we're dealing with. */
+ EPIPHANY_FUNCTION_RESET, EPIPHANY_FUNCTION_SOFTWARE_EXCEPTION,
+ EPIPHANY_FUNCTION_TIMER, EPIPHANY_FUNCTION_DMA0,
+ EPIPHANY_FUNCTION_DMA1, EPIPHANY_FUNCTION_STATIC_FLAG,
+ EPIPHANY_FUNCTION_SWI
+};
+
+#define EPIPHANY_INTERRUPT_P(TYPE) \
+ ((TYPE) >= EPIPHANY_FUNCTION_RESET && (TYPE) <= EPIPHANY_FUNCTION_SWI)
+
+/* Compute the type of a function from its DECL. */
+
+#define IMMEDIATE_PREFIX "#"
+
+#define OPTIMIZE_MODE_SWITCHING(ENTITY) \
+ (epiphany_optimize_mode_switching (ENTITY))
+
+/* We have two fake entities for lazy code motion of the mask constants,
+ one entity each for round-to-nearest / truncating
+ with a different idea what FP_MODE_ROUND_UNKNOWN will be, and
+ finally an entity that runs in a second mode switching pass to
+ resolve FP_MODE_ROUND_UNKNOWN. */
+#define NUM_MODES_FOR_MODE_SWITCHING \
+ { 2, 2, FP_MODE_NONE, FP_MODE_NONE, FP_MODE_NONE, FP_MODE_NONE, FP_MODE_NONE }
+
+#define MODE_NEEDED(ENTITY, INSN) epiphany_mode_needed((ENTITY), (INSN))
+
+#define MODE_PRIORITY_TO_MODE(ENTITY, N) \
+ (epiphany_mode_priority_to_mode ((ENTITY), (N)))
+
+#define EMIT_MODE_SET(ENTITY, MODE, HARD_REGS_LIVE) \
+ emit_set_fp_mode ((ENTITY), (MODE), (HARD_REGS_LIVE))
+
+#define MODE_ENTRY(ENTITY) (epiphany_mode_entry_exit ((ENTITY), false))
+#define MODE_EXIT(ENTITY) (epiphany_mode_entry_exit ((ENTITY), true))
+#define MODE_AFTER(LAST_MODE, INSN) \
+ (epiphany_mode_after (e, (LAST_MODE), (INSN)))
+
+#define TARGET_INSERT_MODE_SWITCH_USE epiphany_insert_mode_switch_use
+
+/* Mode switching entities. */
+enum
+{
+ EPIPHANY_MSW_ENTITY_AND,
+ EPIPHANY_MSW_ENTITY_OR,
+ EPIPHANY_MSW_ENTITY_NEAREST,
+ EPIPHANY_MSW_ENTITY_TRUNC,
+ EPIPHANY_MSW_ENTITY_ROUND_UNKNOWN,
+ EPIPHANY_MSW_ENTITY_ROUND_KNOWN,
+ EPIPHANY_MSW_ENTITY_FPU_OMNIBUS
+};
+
+extern int epiphany_normal_fp_rounding;
+extern struct rtl_opt_pass pass_mode_switch_use;
+extern struct rtl_opt_pass pass_resolve_sw_modes;
+
+/* This will need to be adjusted when FP_CONTRACT_ON is properly
+ implemented. */
+#define TARGET_FUSED_MADD (flag_fp_contract_mode == FP_CONTRACT_FAST)
+
+#endif /* !GCC_EPIPHANY_H */
diff --git a/gcc/config/epiphany/epiphany.md b/gcc/config/epiphany/epiphany.md
new file mode 100644
index 00000000000..c8354e8eddb
--- /dev/null
+++ b/gcc/config/epiphany/epiphany.md
@@ -0,0 +1,2447 @@
+;; Machine description of the Adaptiva epiphany cpu for GNU C compiler
+;; Copyright (C) 1994, 1997, 1998, 1999, 2000, 2004, 2005, 2007, 2009, 2010,
+;; 2011 Free Software Foundation, Inc.
+;; Contributed by Embecosm on behalf of Adapteva, 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/>.
+
+;; See file "rtl.def" for documentation on define_insn, match_*, et. al.
+
+(define_constants
+ [(GPR_0 0)
+ (GPR_FP 11)
+ (GPR_IP 12)
+ (GPR_SP 13)
+ (GPR_LR 14)
+ (GPR_16 16)
+ (GPR_18 18)
+ (GPR_20 20)
+ (ARG_POINTER_REGNUM 64)
+ (FRAME_POINTER_REGNUM 65)
+ (CC_REGNUM 66) ;; 66 or 17
+ (CCFP_REGNUM 67) ;; 67 or 18
+ (CONFIG_REGNUM 68)
+ (STATUS_REGNUM 69)
+ (LC_REGNUM 70)
+ (LS_REGNUM 71)
+ (LE_REGNUM 72)
+ (IRET_REGNUM 73)
+ (FP_NEAREST_REGNUM 74)
+ (FP_TRUNCATE_REGNUM 75)
+ (FP_ANYFP_REGNUM 76)
+ (UNKNOWN_REGNUM 77) ; used for addsi3_r and friends
+ ; We represent the return address as an unspec rather than a reg.
+ ; If we used a reg, we could use register elimination, but eliminating
+ ; to GPR_LR would make the latter visible to dataflow, thus making it
+ ; harder to determine when it must be saved.
+ (UNSPEC_RETURN_ADDR 0)
+ (UNSPEC_FP_MODE 1)
+
+ (UNSPECV_GID 0)
+ (UNSPECV_GIE 1)])
+
+;; Insn type. Used to default other attribute values.
+
+(define_attr "type"
+ "move,load,store,cmove,unary,compare,shift,mul,uncond_branch,branch,call,fp,fp_int,misc,sfunc,fp_sfunc,flow"
+ (const_string "misc"))
+
+;; Length (in # bytes)
+
+(define_attr "length" "" (const_int 4))
+
+;; The length here is the length of a single asm.
+
+(define_asm_attributes
+ [(set_attr "length" "4")
+ (set_attr "type" "misc")])
+
+;; pipeline model; so far we have only one.
+(define_attr "pipe_model" "epiphany" (const_string "epiphany"))
+
+(define_attr "rounding" "trunc,nearest"
+ (cond [(ne (symbol_ref "TARGET_ROUND_NEAREST") (const_int 0))
+ (const_string "nearest")]
+ (const_string "trunc")))
+
+(define_attr "fp_mode" "round_unknown,round_nearest,round_trunc,int,caller,none"
+ (cond [(eq_attr "type" "fp,fp_sfunc")
+ (symbol_ref "(enum attr_fp_mode) epiphany_normal_fp_rounding")
+ (eq_attr "type" "call")
+ (symbol_ref "(enum attr_fp_mode) epiphany_normal_fp_mode")
+ (eq_attr "type" "fp_int")
+ (const_string "int")]
+ (const_string "none")))
+
+(include "epiphany-sched.md")
+
+(include "predicates.md")
+(include "constraints.md")
+
+;; modes that are held in a single register, and hence, a word.
+(define_mode_iterator WMODE [SI SF HI QI V2HI V4QI])
+(define_mode_iterator WMODE2 [SI SF HI QI V2HI V4QI])
+
+;; modes that are held in a two single registers
+(define_mode_iterator DWMODE [DI DF V2SI V2SF V4HI V8QI])
+
+;; Double-word mode made up of two single-word mode values.
+(define_mode_iterator DWV2MODE [V2SI V2SF])
+(define_mode_attr vmode_part [(V2SI "si") (V2SF "sf")])
+(define_mode_attr vmode_PART [(V2SI "SI") (V2SF "SF")])
+(define_mode_attr vmode_fp_type [(V2SI "fp_int") (V2SF "fp")])
+(define_mode_attr vmode_ccmode [(V2SI "CC") (V2SF "CC_FP")])
+(define_mode_attr vmode_cc [(V2SI "CC_REGNUM") (V2SF "CCFP_REGNUM")])
+
+;; Move instructions.
+
+(define_expand "mov<mode>"
+ [(set (match_operand:WMODE 0 "general_operand" "")
+ (match_operand:WMODE 1 "general_operand" ""))]
+ ""
+{
+ if (<MODE>mode == V4QImode || <MODE>mode == V2HImode)
+ {
+ operands[0] = simplify_gen_subreg (SImode, operands[0], <MODE>mode, 0);
+ operands[1] = simplify_gen_subreg (SImode, operands[1], <MODE>mode, 0);
+ emit_insn (gen_movsi (operands[0], operands[1]));
+ DONE;
+ }
+ if (GET_CODE (operands[0]) == MEM)
+ operands[1] = force_reg (<MODE>mode, operands[1]);
+ if (<MODE>mode == SImode
+ && (operands[1] == frame_pointer_rtx || operands[1] == arg_pointer_rtx))
+ {
+ rtx reg = operands[0];
+
+ if (!REG_P (reg))
+ reg = gen_reg_rtx (SImode);
+ emit_insn (gen_move_frame (reg, operands[1]));
+ operands[1] = reg;
+ if (operands[0] == reg)
+ DONE;
+ }
+})
+
+(define_insn "*movqi_insn"
+ [(set (match_operand:QI 0 "move_dest_operand" "=Rcs, r, r,r,m")
+ (match_operand:QI 1 "move_src_operand" "Rcs,rU16,Cal,m,r"))]
+;; ??? Needed?
+ "gpr_operand (operands[0], QImode)
+ || gpr_operand (operands[1], QImode)"
+ "@
+ mov %0,%1
+ mov %0,%1
+ mov %0,%1
+ ldrb %0,%1
+ strb %1,%0"
+ [(set_attr "type" "move,move,move,load,store")])
+
+(define_insn_and_split "*movhi_insn"
+ [(set (match_operand:HI 0 "move_dest_operand" "=r, r,r,m")
+ (match_operand:HI 1 "move_src_operand""rU16,Cal,m,r"))]
+ "gpr_operand (operands[0], HImode)
+ || gpr_operand (operands[1], HImode)"
+ "@
+ mov %0,%1
+ mov %0,%%low(%1); %1
+ ldrh %0,%c1
+ strh %1,%c0"
+ "reload_completed && CONSTANT_P (operands[1])
+ && !satisfies_constraint_U16 (operands[1]) && TARGET_SPLIT_LOHI"
+ [(set (match_dup 2) (match_dup 3))]
+ "operands[2] = simplify_gen_subreg (SImode, operands[0], HImode, 0);
+ operands[3] = simplify_gen_subreg (SImode, operands[1], HImode, 0);"
+ [(set_attr "type" "move,move,load,store")])
+
+;; We use a special pattern for a move from the frame pointer to
+;; show the flag clobber that is needed when this move is changed
+;; to an add by register elimination.
+;; ??? A pseudo register might be equivalent to a function invariant,
+;; and thus placed by reload into reg_equiv_invariant; if the pseudo
+;; does not get a hard register, we then end up with the function
+;; invariant in its place, i.e. an unexpected clobber of the flags
+;; register.
+;;
+;; N.B. operand 1 is an operand so that reload will perform elimination.
+;;
+;; The post-reload pattern recognition and splitting is done in frame_move_1.
+(define_insn "move_frame"
+ [(set (match_operand:SI 0 "gpr_operand" "=r")
+ (match_operand:SI 1 "register_operand" "r"))
+ (clobber (reg:CC CC_REGNUM))]
+ "operands[1] == frame_pointer_rtx || operands[1] == arg_pointer_rtx"
+ "#")
+
+(define_insn "movsi_high"
+ [(set (match_operand:SI 0 "gpr_operand" "+r")
+ (ior:SI (and:SI (match_dup 0) (const_int 65535))
+ (high:SI (match_operand:SI 1 "move_src_operand" "i"))))]
+ ""
+ "movt %0, %%high(%1)"
+ [(set_attr "type" "move")
+ (set_attr "length" "4")])
+
+(define_insn "movsi_lo_sum"
+ [(set (match_operand:SI 0 "gpr_operand" "=r")
+ (lo_sum:SI (const_int 0)
+ (match_operand:SI 1 "move_src_operand" "i")))]
+ ""
+ "mov %0, %%low(%1)"
+ [(set_attr "type" "move")
+ (set_attr "length" "4")])
+
+(define_insn_and_split "*movsi_insn"
+ [(set (match_operand:SI 0 "move_dest_operand"
+ "= r, r, r, r, r, r, m, r, Rct")
+ (match_operand:SI 1 "move_src_operand"
+ "rU16Rra,Cm1,Cl1,Cr1,Cal,mSra,rRra,Rct,r"))]
+ "gpr_operand (operands[0], SImode)
+ || gpr_operand (operands[1], SImode)
+ || satisfies_constraint_Sra (operands[1])"
+{
+ switch (which_alternative)
+ {
+ case 0: return "mov %0,%1";
+ case 1: return "add %0,%-,(1+%1)";
+ case 2: operands[1] = GEN_INT (exact_log2 (-INTVAL (operands[1])));
+ return "lsl %0,%-,%1";
+ case 3: operands[1] = GEN_INT (32 - exact_log2 (INTVAL (operands[1]) + 1));
+ return "lsr %0,%-,%1";
+ case 4: return "mov %0,%%low(%1)\;movt %0,%%high(%1) ; %1";
+ case 5: return "ldr %0,%C1";
+ case 6: return "str %1,%C0";
+ case 7: return "movfs %0,%1";
+ case 8: return "movts %0,%1";
+ default: gcc_unreachable ();
+ }
+}
+ "reload_completed && CONSTANT_P (operands[1])
+ && !satisfies_constraint_U16 (operands[1])
+ && !satisfies_constraint_Cm1 (operands[1])
+ && !satisfies_constraint_Cl1 (operands[1])
+ && !satisfies_constraint_Cr1 (operands[1])
+ && TARGET_SPLIT_LOHI"
+ [(match_dup 2) (match_dup 3)]
+ "operands[2] = gen_movsi_lo_sum (operands[0], operands[1]);
+ operands[3] = gen_movsi_high (operands[0], operands[1]);"
+ [(set_attr "type" "move,misc,misc,misc,move,load,store,flow,flow")
+ (set_attr "length" "4,4,4,4,8,4,4,4,4")])
+
+(define_split
+ [(set (match_operand:SI 0 "nonimmediate_operand")
+ (unspec:SI [(const_int 0)] UNSPEC_RETURN_ADDR))]
+ "reload_completed && !MACHINE_FUNCTION (cfun)->lr_clobbered"
+ [(set (match_dup 0) (reg:SI GPR_LR))])
+
+(define_split
+ [(set (match_operand:SI 0 "gpr_operand")
+ (unspec:SI [(const_int 0)] UNSPEC_RETURN_ADDR))]
+ "reload_completed"
+ [(set (match_dup 0) (match_dup 1))]
+{
+ emit_insn (gen_reload_insi_ra (operands[0], operands[1]));
+ DONE;
+})
+
+(define_expand "reload_insi_ra"
+ [(set (match_operand:SI 0 "gpr_operand" "r") (match_operand:SI 1 "" "Sra"))]
+ ""
+{
+ rtx addr
+ = (frame_pointer_needed ? hard_frame_pointer_rtx : stack_pointer_rtx);
+
+ addr = plus_constant (addr, MACHINE_FUNCTION (cfun)->lr_slot_offset);
+ operands[1] = gen_frame_mem (SImode, addr);
+})
+
+;; If the frame pointer elimination offset is zero, we'll use this pattern.
+;; Note that the splitter can accept any gpr in operands[1]; this is
+;; necessary, (e.g. for compile/20021015-1.c -O0,)
+;; because when register elimination cannot be done with the constant
+;; as an immediate operand of the add instruction, reload will resort to
+;; loading the constant into a reload register, using gen_add2_insn to add
+;; the stack pointer, and then use the reload register as new source in
+;; the move_frame pattern.
+(define_insn_and_split "*move_frame_1"
+ [(set (match_operand:SI 0 "gpr_operand" "=r")
+ (match_operand:SI 1 "gpr_operand" "r"))
+ (clobber (reg:CC CC_REGNUM))]
+ "(reload_in_progress || reload_completed)
+ && (operands[1] == stack_pointer_rtx
+ || operands[1] == hard_frame_pointer_rtx)"
+ "#"
+ "reload_in_progress || reload_completed"
+ [(set (match_dup 0) (match_dup 1))])
+
+(define_expand "mov<mode>"
+ [(set (match_operand:DWMODE 0 "general_operand" "")
+ (match_operand:DWMODE 1 "general_operand" ""))]
+ ""
+ "
+{
+ if (GET_MODE_CLASS (<MODE>mode) == MODE_VECTOR_INT
+ || GET_MODE_CLASS (<MODE>mode) == MODE_VECTOR_FLOAT)
+ {
+ if (epiphany_vect_align == 4 && TARGET_SPLIT_VECMOVE_EARLY)
+ {
+ rtx o0l, o0h, o1l, o1h;
+
+ o0l = simplify_gen_subreg (SImode, operands[0], <MODE>mode, 0);
+ o0h = simplify_gen_subreg (SImode, operands[0], <MODE>mode,
+ UNITS_PER_WORD);
+ o1l = simplify_gen_subreg (SImode, operands[1], <MODE>mode, 0);
+ o1h = simplify_gen_subreg (SImode, operands[1], <MODE>mode,
+ UNITS_PER_WORD);
+ if (reg_overlap_mentioned_p (o0l, o1h))
+ {
+ emit_move_insn (o0h, o1h);
+ emit_move_insn (o0l, o1l);
+ }
+ else
+ {
+ emit_move_insn (o0l, o1l);
+ emit_move_insn (o0h, o1h);
+ }
+ DONE;
+ }
+ /* lower_subreg has a tendency to muck up vectorized code.
+ To protect the wide memory accesses, we must use same-size
+ subregs. */
+ if (epiphany_vect_align != 4 /* == 8 */
+ && !reload_in_progress
+ && (GET_CODE (operands[0]) == MEM || GET_CODE (operands[1]) == MEM)
+ && (GET_CODE (operands[0]) != SUBREG
+ || (GET_MODE_SIZE (GET_MODE (SUBREG_REG (operands[0])))
+ != GET_MODE_SIZE (<MODE>mode)
+ && GET_CODE (operands[1]) != SUBREG)))
+ {
+ operands[0]
+ = simplify_gen_subreg (DImode, operands[0], <MODE>mode, 0);
+ operands[1]
+ = simplify_gen_subreg (DImode, operands[1], <MODE>mode, 0);
+ emit_insn (gen_movdi (operands[0], operands[1]));
+ DONE;
+ }
+ }
+ /* Everything except mem = const or mem = mem can be done easily. */
+
+ if (GET_CODE (operands[0]) == MEM)
+ operands[1] = force_reg (<MODE>mode, operands[1]);
+}")
+
+(define_insn_and_split "*mov<mode>_insn"
+ [(set (match_operand:DWMODE 0 "move_dest_operand" "=r, r,r,m")
+ (match_operand:DWMODE 1 "move_double_src_operand" "r,CalE,m,r"))]
+ "(gpr_operand (operands[0], <MODE>mode)
+ || gpr_operand (operands[1], <MODE>mode))"
+ "@
+ #
+ #
+ ldrd %0,%X1
+ strd %1,%X0"
+ "reload_completed
+ && ((!MEM_P (operands[0]) && !MEM_P (operands[1]))
+ || epiphany_vect_align == 4)"
+ [(set (match_dup 2) (match_dup 3))
+ (set (match_dup 4) (match_dup 5))]
+{
+ int word0 = 0, word1 = UNITS_PER_WORD;
+
+ if (post_modify_operand (operands[0], <MODE>mode)
+ || post_modify_operand (operands[1], <MODE>mode))
+ word0 = UNITS_PER_WORD, word1 = 0;
+
+ operands[2] = simplify_gen_subreg (SImode, operands[0], <MODE>mode, word0);
+ operands[3] = simplify_gen_subreg (SImode, operands[1], <MODE>mode, word0);
+ operands[4] = simplify_gen_subreg (SImode, operands[0], <MODE>mode, word1);
+ operands[5] = simplify_gen_subreg (SImode, operands[1], <MODE>mode, word1);
+ if (post_modify_operand (operands[0], <MODE>mode))
+ operands[2]
+ = change_address (operands[2], VOIDmode,
+ plus_constant (XEXP (XEXP (operands[0], 0), 0),
+ UNITS_PER_WORD));
+ if (post_modify_operand (operands[1], <MODE>mode))
+ operands[3]
+ = change_address (operands[3], VOIDmode,
+ plus_constant (XEXP (XEXP (operands[1], 0), 0),
+ UNITS_PER_WORD));
+}
+ [(set_attr "type" "move,move,load,store")
+ (set_attr "length" "8,16,4,4")])
+
+
+(define_insn_and_split "*movsf_insn"
+ [(set (match_operand:SF 0 "move_dest_operand" "=r,r,r,m")
+ (match_operand:SF 1 "move_src_operand" "r,E,m,r"))]
+ "gpr_operand (operands[0], SFmode)
+ || gpr_operand (operands[1], SFmode)"
+ "@
+ mov %0,%1
+ mov %0,%%low(%1)\;movt %0,%%high(%1) ; %1
+ ldr %0,%C1
+ str %1,%C0"
+ "reload_completed && CONSTANT_P (operands[1]) && TARGET_SPLIT_LOHI"
+ [(set (match_dup 2) (match_dup 3))]
+ "operands[2] = simplify_gen_subreg (SImode, operands[0], SFmode, 0);
+ operands[3] = simplify_gen_subreg (SImode, operands[1], SFmode, 0);"
+ [(set_attr "type" "move,move,load,store")
+ (set_attr "length" "4,8,4,4")])
+
+(define_expand "addsi3"
+ [(set (match_operand:SI 0 "add_reg_operand" "")
+ (plus:SI (match_operand:SI 1 "add_reg_operand" "")
+ (match_operand:SI 2 "add_operand" "")))]
+ ""
+ "
+{
+ if (reload_in_progress || reload_completed)
+ emit_insn (gen_addsi3_r (operands[0], operands[1], operands[2]));
+ else
+ emit_insn (gen_addsi3_i (operands[0], operands[1], operands[2]));
+ DONE;
+}")
+
+(define_insn "addsi3_i"
+ [(set (match_operand:SI 0 "add_reg_operand" "=r")
+ (plus:SI (match_operand:SI 1 "add_reg_operand" "%r")
+ (match_operand:SI 2 "add_operand" "rL")))
+ (clobber (reg:CC CC_REGNUM))]
+ ""
+ "add %0,%1,%2"
+[(set_attr "type" "misc")])
+
+; We use a clobber of UNKNOWN_REGNUM here so that the peephole optimizers
+; can identify the unresolved flags clobber problem, and also to
+; avoid unwanted matches.
+;
+; At -O0 / -O1 we don't peephole all instances away. We could get better
+; debug unwinding through the emitted code if we added a splitter.
+(define_insn "addsi3_r"
+ [(set (match_operand:SI 0 "gpr_operand" "=r")
+ (plus:SI (match_operand:SI 1 "gpr_operand" "%r")
+ (match_operand:SI 2 "nonmemory_operand" "rCar")))
+ (clobber (reg:CC UNKNOWN_REGNUM))]
+ "reload_in_progress || reload_completed"
+{
+ int scratch = (0x17
+ ^ (true_regnum (operands[0]) & 1)
+ ^ (true_regnum (operands[1]) & 2)
+ ^ (true_regnum (operands[2]) & 4));
+ asm_fprintf (asm_out_file, "\tstr r%d,[sp,#0]\n", scratch);
+ asm_fprintf (asm_out_file, "\tmovfs r%d,status\n", scratch);
+ output_asm_insn ("add %0,%1,%2", operands);
+ asm_fprintf (asm_out_file, "\tmovts status,r%d\n", scratch);
+ asm_fprintf (asm_out_file, "\tldr r%d,[sp,#0]\n", scratch);
+ return "";
+}
+ [(set_attr "length" "20")
+ (set_attr "type" "misc")])
+
+;; reload uses gen_addsi2 because it doesn't understand the need for
+;; the clobber.
+(define_peephole2
+ [(set (match_operand:SI 0 "gpr_operand" "")
+ (match_operand:SI 1 "const_int_operand" ""))
+ (parallel [(set (match_dup 0)
+ (plus:SI (match_dup 0)
+ (match_operand:SI 2 "gpr_operand")))
+ (clobber (reg:CC UNKNOWN_REGNUM))])]
+ "satisfies_constraint_L (operands[1])
+ || ((operands[2] == stack_pointer_rtx
+ || (operands[2] == hard_frame_pointer_rtx && frame_pointer_needed))
+ && !peep2_regno_dead_p (2, CC_REGNUM)
+ && satisfies_constraint_Car (operands[1]))"
+ [(parallel [(set (match_dup 0)
+ (plus:SI (match_dup 2) (match_dup 1)))
+ (clobber (reg:CC UNKNOWN_REGNUM))])]
+ ;; FIXME:
+ ;; need this patch: http://gcc.gnu.org/ml/gcc-patches/2011-10/msg02819.html
+ ;; "peep2_rescan = true;"
+)
+
+(define_peephole2
+ [(match_parallel 5 ""
+ [(set (match_operand 3 "cc_operand" "") (match_operand 4 "" ""))])
+ (parallel [(set (match_operand:SI 0 "gpr_operand" "")
+ (plus:SI (match_operand:SI 1 "gpr_operand" "")
+ (match_operand:SI 2 "nonmemory_operand" "")))
+ (clobber (reg:CC UNKNOWN_REGNUM))])]
+ "REGNO (operands[3]) == CC_REGNUM
+ && (gpr_operand (operands[2], SImode)
+ || satisfies_constraint_L (operands[2]))
+ && !reg_overlap_mentioned_p (operands[0], operands[5])
+ && !reg_set_p (operands[1], operands[5])
+ && !reg_set_p (operands[2], operands[5])"
+ [(parallel [(set (match_operand:SI 0 "gpr_operand" "")
+ (plus:SI (match_operand:SI 1 "gpr_operand" "")
+ (match_operand:SI 2 "nonmemory_operand" "")))
+ (clobber (reg:CC CC_REGNUM))])
+ (match_dup 5)]
+ "")
+
+(define_peephole2
+ [(parallel [(set (match_operand:SI 0 "gpr_operand" "")
+ (plus:SI (match_operand:SI 1 "gpr_operand" "")
+ (match_operand:SI 2 "nonmemory_operand" "")))
+ (clobber (reg:CC UNKNOWN_REGNUM))])]
+ "peep2_regno_dead_p (1, CC_REGNUM)
+ && (gpr_operand (operands[2], SImode)
+ || satisfies_constraint_L (operands[2]))"
+ [(parallel [(set (match_operand:SI 0 "gpr_operand" "")
+ (plus:SI (match_operand:SI 1 "gpr_operand" "")
+ (match_operand:SI 2 "nonmemory_operand" "")))
+ (clobber (reg:CC CC_REGNUM))])]
+ "")
+
+(define_peephole2
+ [(parallel [(set (match_operand:SI 0 "gpr_operand" "")
+ (plus:SI (reg:SI GPR_SP)
+ (match_operand:SI 1 "nonmemory_operand" "")))
+ (clobber (reg:CC UNKNOWN_REGNUM))])]
+ "(REG_P (operands[1]) && !reg_overlap_mentioned_p (operands[0], operands[1]))
+ || RTX_OK_FOR_OFFSET_P (<MODE>mode, operands[1])"
+ [(set (match_dup 0) (reg:SI GPR_SP))
+ (set (mem:WMODE (post_modify (match_dup 0)
+ (plus:SI (match_dup 0) (match_dup 1))))
+ (reg:WMODE GPR_SP))]
+ "")
+
+
+
+(define_peephole2
+ [(parallel [(set (match_operand:SI 0 "gpr_operand" "")
+ (plus:SI (reg:SI GPR_FP)
+ (match_operand:SI 1 "nonmemory_operand" "")))
+ (clobber (reg:CC UNKNOWN_REGNUM))])
+ (match_scratch:WMODE 2 "r")]
+ "frame_pointer_needed
+ && ((REG_P (operands[1])
+ && !reg_overlap_mentioned_p (operands[0], operands[1]))
+ || RTX_OK_FOR_OFFSET_P (<MODE>mode, operands[1]))"
+ [(set (match_dup 0) (reg:SI GPR_FP))
+ (set (match_dup 2)
+ (mem:WMODE (post_modify (match_dup 0)
+ (plus:SI (match_dup 0) (match_dup 1)))))]
+ "")
+
+(define_insn "subsi3"
+ [(set (match_operand:SI 0 "gpr_operand" "=r")
+ (minus:SI (match_operand:SI 1 "add_reg_operand" "r")
+ (match_operand:SI 2 "arith_operand" "rL")))
+ (clobber (reg:CC CC_REGNUM))]
+ ""
+ "sub %0,%1,%2"
+ [(set_attr "type" "misc")])
+
+; After mode-switching, floating point operations, fp_sfuncs and calls
+; must exhibit the use of the control register, lest the setting of the
+; control register could be deleted or moved. OTOH a use of a hard register
+; greatly coundounds optimizers like the rtl loop optimizers or combine.
+; Therefore, we put an extra pass immediately after the mode switching pass
+; that inserts the USEs of the control registers, and sets a flag in struct
+; machine_function that float_operation can henceforth only match with that
+; USE.
+
+;; Addition
+(define_expand "addsf3"
+ [(parallel
+ [(set (match_operand:SF 0 "gpr_operand" "")
+ (plus:SF (match_operand:SF 1 "gpr_operand" "")
+ (match_operand:SF 2 "gpr_operand" "")))
+ (clobber (reg:CC_FP CCFP_REGNUM))])])
+
+(define_insn "*addsf3_i"
+ [(match_parallel 3 "float_operation"
+ [(set (match_operand:SF 0 "gpr_operand" "=r")
+ (plus:SF (match_operand:SF 1 "gpr_operand" "%r")
+ (match_operand:SF 2 "gpr_operand" "r")))
+ (clobber (reg:CC_FP CCFP_REGNUM))])]
+ ""
+ "fadd %0,%1,%2"
+ [(set_attr "type" "fp")])
+
+;; Subtraction
+(define_expand "subsf3"
+ [(parallel
+ [(set (match_operand:SF 0 "gpr_operand" "")
+ (minus:SF (match_operand:SF 1 "gpr_operand" "")
+ (match_operand:SF 2 "gpr_operand" "")))
+ (clobber (reg:CC_FP CCFP_REGNUM))])])
+
+(define_insn "*subsf3_i"
+ [(match_parallel 3 "float_operation"
+ [(set (match_operand:SF 0 "gpr_operand" "=r")
+ (minus:SF (match_operand:SF 1 "gpr_operand" "r")
+ (match_operand:SF 2 "gpr_operand" "r")))
+ (clobber (reg:CC_FP CCFP_REGNUM))])]
+ ""
+ "fsub %0,%1,%2"
+ [(set_attr "type" "fp")])
+
+(define_expand "subsf3_f"
+ [(parallel
+ [(set (reg:CC_FP CCFP_REGNUM)
+ (compare:CC_FP (match_operand:SF 1 "gpr_operand" "r")
+ (match_operand:SF 2 "gpr_operand" "r")))
+ (set (match_operand:SF 0 "gpr_operand" "=r")
+ (minus:SF (match_dup 1) (match_dup 2)))])]
+ "!TARGET_SOFT_CMPSF")
+
+(define_insn "*subsf3_f_i"
+ [(match_parallel 3 "float_operation"
+ [(set (reg:CC_FP CCFP_REGNUM)
+ (compare:CC_FP (match_operand:SF 1 "gpr_operand" "r")
+ (match_operand:SF 2 "gpr_operand" "r")))
+ (set (match_operand:SF 0 "gpr_operand" "=r")
+ (minus:SF (match_dup 1) (match_dup 2)))])]
+ "!TARGET_SOFT_CMPSF"
+ "fsub %0,%1,%2"
+ [(set_attr "type" "fp")])
+
+; There is an fabs instruction, but it has longer latency.
+(define_expand "abssf2"
+ [(set (match_operand:SF 0 "gpr_operand" "")
+ (abs:SF (match_operand:SF 1 "gpr_operand" "")))]
+ ""
+ "
+{
+ rtx op1 = copy_to_mode_reg (SImode, simplify_gen_subreg (SImode, operands[1],
+ SFmode, 0));
+ rtx op0 = simplify_gen_subreg (SImode, operands[0], SFmode, 0);
+
+ emit_insn (gen_ashlsi3 (op1, op1, const1_rtx));
+ emit_insn (gen_lshrsi3 (op0, op1, const1_rtx));
+ DONE;
+}")
+
+;; Multiplication
+(define_expand "mulsf3"
+ [(parallel
+ [(set (match_operand:SF 0 "gpr_operand" "")
+ (mult:SF (match_operand:SF 1 "gpr_operand" "")
+ (match_operand:SF 2 "gpr_operand" "")))
+ (clobber (reg:CC_FP CCFP_REGNUM))])])
+
+(define_insn "*mulsf3_i"
+ [(match_parallel 3 "float_operation"
+ [(set (match_operand:SF 0 "gpr_operand" "=r")
+ (mult:SF (match_operand:SF 1 "gpr_operand" "%r")
+ (match_operand:SF 2 "gpr_operand" "r")))
+ (clobber (reg:CC_FP CCFP_REGNUM))])]
+ ""
+ "fmul %0,%1,%2"
+ [(set_attr "type" "fp")])
+
+;; Division
+(define_expand "divsf3"
+ [(set (match_operand:SF 0 "gpr_operand" "")
+ (div:SF (match_operand:SF 1 "gpr_operand" "")
+ (match_operand:SF 2 "gpr_operand" "")))]
+ "flag_reciprocal_math"
+{
+ rtx one = CONST1_RTX (SFmode);
+ rtx dst = operands[0];
+
+ if (rtx_equal_p (dst, operands[1]))
+ {
+ emit_move_insn (dst, one);
+ DONE;
+ }
+ else if (!register_operand (dst, SFmode) && can_create_pseudo_p ())
+ dst = gen_reg_rtx (SFmode);
+ emit_insn (gen_recipsf2 (dst, one, operands[2],
+ sfunc_symbol (\"__fast_recipsf2\")));
+ emit_insn (gen_mulsf3 (operands[0], operands[1], dst));
+ DONE;
+})
+
+;; Before reload, keep the hard reg usage to clobbers so that the loop
+;; optimizers can more easily move this insn.
+;; It would be nicer to use a constraint for a GPR_0 - only register class,
+;; but sched1 can still cause trouble then, and there is no guarantee of
+;; better register allocations.
+;; Neither is there when using the opposite strategy - putting explicit
+;; hard register references into pre-reload rtl.
+(define_expand "recipsf2"
+ [(parallel
+ [(set (match_operand:SF 0 "gpr_operand" "")
+ (div:SF (match_operand:SF 1 "const_float_1_operand" "")
+ (match_operand:SF 2 "move_src_operand" "")))
+ (use (match_operand:SI 3 "move_src_operand" ""))
+ (clobber (reg:SF 0))
+ (clobber (reg:SI 1))
+ (clobber (reg:SF GPR_IP))
+ (clobber (reg:DI GPR_16))
+ (clobber (reg:DI GPR_18))
+ (clobber (reg:SI GPR_20))
+ (clobber (reg:SI GPR_LR))
+ (clobber (reg:CC CC_REGNUM))
+ (clobber (reg:CC_FP CCFP_REGNUM))])])
+
+(define_insn_and_split "*recipsf2_1"
+ [(match_parallel 4 "float_operation"
+ [(set (match_operand:SF 0 "gpr_operand" "=r,r")
+ (div:SF (match_operand:SF 1 "const_float_1_operand" "")
+ (match_operand:SF 2 "move_src_operand" "rU16m,rU16mCal")))
+ (use (match_operand:SI 3 "move_src_operand" "rU16m,rU16mCal"))
+ (clobber (reg:SF 0))
+ (clobber (reg:SI 1))
+ (clobber (reg:SF GPR_IP))
+ (clobber (reg:DI GPR_16))
+ (clobber (reg:DI GPR_18))
+ (clobber (reg:SI GPR_20))
+ (clobber (reg:SI GPR_LR))
+ (clobber (reg:CC CC_REGNUM))
+ (clobber (reg:CC_FP CCFP_REGNUM))])]
+ "flag_reciprocal_math"
+ "#"
+ "&& reload_completed"
+ [(set (reg:SI 1) (match_dup 3))
+ (set (reg:SF 0) (match_dup 2))
+ (parallel
+ [(set (reg:SF 0)
+ (div:SF (match_dup 1)
+ (reg:SF 0)))
+ (use (reg:SI 1))
+ (clobber (reg:SI GPR_IP))
+ (clobber (reg:DI GPR_16))
+ (clobber (reg:DI GPR_18))
+ (clobber (reg:SI GPR_20))
+ (clobber (reg:SI GPR_LR))
+ (clobber (reg:CC CC_REGNUM))
+ (clobber (reg:CC_FP CCFP_REGNUM))
+ (match_dup 5)
+ (match_dup 6)])
+ (set (match_dup 0) (reg:SF 0))]
+ "operands[5] = XVECEXP (operands[4], 0, XVECLEN (operands[4], 0) - 2);
+ operands[6] = XVECEXP (operands[4], 0, XVECLEN (operands[4], 0) - 1);"
+ [(set_attr "type" "fp_sfunc")
+ (set_attr "length" "16,24")])
+
+(define_insn "*recipsf2_2"
+ [(match_parallel 1 "float_operation"
+ [(set (reg:SF 0)
+ (div:SF (match_operand:SF 0 "const_float_1_operand" "")
+ (reg:SF 0)))
+ (use (reg:SI 1))
+ (clobber (reg:SI GPR_IP))
+ (clobber (reg:DI GPR_16))
+ (clobber (reg:DI GPR_18))
+ (clobber (reg:SI GPR_20))
+ (clobber (reg:SI GPR_LR))
+ (clobber (reg:CC CC_REGNUM))
+ (clobber (reg:CC_FP CCFP_REGNUM))])]
+ "flag_reciprocal_math"
+ "jalr r1"
+ [(set_attr "type" "fp_sfunc")])
+
+
+;; Fused multiply-add
+(define_expand "fmasf4"
+ [(parallel
+ [(set (match_operand:SF 0 "gpr_operand" "")
+ (fma:SF (match_operand:SF 1 "gpr_operand" "")
+ (match_operand:SF 2 "gpr_operand" "")
+ (match_operand:SF 3 "gpr_operand" "")))
+ (clobber (reg:CC_FP CCFP_REGNUM))])]
+ "")
+
+; The multiply operands are commutative, but since they have the
+; same constraints, there is no point in telling reload about this.
+(define_insn "*fmadd"
+ [(match_parallel 4 "float_operation"
+ [(set (match_operand:SF 0 "gpr_operand" "=r")
+ (fma:SF (match_operand:SF 1 "gpr_operand" "r")
+ (match_operand:SF 2 "gpr_operand" "r")
+ (match_operand:SF 3 "gpr_operand" "0")))
+ (clobber (reg:CC_FP CCFP_REGNUM))])]
+ ""
+ "fmadd %0,%1,%2"
+ [(set_attr "type" "fp")])
+
+; Once vetorization consistently works for this port, should check
+; if the fmadd / fmsub patterns still serve a purpose. With the
+; introduction of fma / fnma handling by the SSA optimizers,
+; at least scalars should be handled by these optimizers, would
+; have to see how well they do on vectors from auto-vectorization.
+;
+; combiner pattern, also used by vector combiner pattern
+(define_expand "maddsf"
+ [(parallel
+ [(set (match_operand:SF 0 "gpr_operand" "=r")
+ (plus:SF (mult:SF (match_operand:SF 1 "gpr_operand" "r")
+ (match_operand:SF 2 "gpr_operand" "r"))
+ (match_operand:SF 3 "gpr_operand" "0")))
+ (clobber (reg:CC_FP CCFP_REGNUM))])]
+ "TARGET_FUSED_MADD")
+
+(define_insn "*maddsf_combine"
+ [(match_parallel 4 "float_operation"
+ [(set (match_operand:SF 0 "gpr_operand" "=r")
+ (plus:SF (mult:SF (match_operand:SF 1 "gpr_operand" "r")
+ (match_operand:SF 2 "gpr_operand" "r"))
+ (match_operand:SF 3 "gpr_operand" "0")))
+ (clobber (reg:CC_FP CCFP_REGNUM))])]
+ "TARGET_FUSED_MADD"
+ "fmadd %0,%1,%2"
+ [(set_attr "type" "fp")])
+
+;; Fused multiply-sub
+(define_expand "fnmasf4"
+ [(parallel
+ [(set (match_operand:SF 0 "gpr_operand" "")
+ (fma:SF (neg:SF (match_operand:SF 1 "gpr_operand" ""))
+ (match_operand:SF 2 "gpr_operand" "")
+ (match_operand:SF 3 "gpr_operand" "")))
+ (clobber (reg:CC_FP CCFP_REGNUM))])]
+ "")
+
+(define_insn "*fmsub"
+ [(match_parallel 4 "float_operation"
+ [(set (match_operand:SF 0 "gpr_operand" "=r")
+ (fma:SF (neg:SF (match_operand:SF 1 "gpr_operand" "r"))
+ (match_operand:SF 2 "gpr_operand" "r")
+ (match_operand:SF 3 "gpr_operand" "0")))
+ (clobber (reg:CC_FP CCFP_REGNUM))])]
+ ""
+ "fmsub %0,%1,%2"
+ [(set_attr "type" "fp")])
+
+(define_insn "*fmsub_combine"
+ [(match_parallel 4 "float_operation"
+ [(set (match_operand:SF 0 "gpr_operand" "=r")
+ (minus:SF (match_operand:SF 3 "gpr_operand" "0")
+ (mult:SF (match_operand:SF 1 "gpr_operand" "r")
+ (match_operand:SF 2 "gpr_operand" "r"))))
+ (clobber (reg:CC_FP CCFP_REGNUM))])]
+ "TARGET_FUSED_MADD"
+ "fmsub %0,%1,%2"
+ [(set_attr "type" "fp")])
+
+;; float / integer conversions
+
+(define_expand "floatsisf2"
+ [(parallel
+ [(set (match_operand:SF 0 "gpr_operand" "")
+ (float:SF (match_operand:SI 1 "gpr_operand" "")))
+ (clobber (reg:CC_FP CCFP_REGNUM))])])
+
+(define_insn "*floatsisf2_i"
+ [(match_parallel 2 "float_operation"
+ [(set (match_operand:SF 0 "gpr_operand" "=r")
+ (float:SF (match_operand:SI 1 "gpr_operand" "r")))
+ (clobber (reg:CC_FP CCFP_REGNUM))])]
+ ""
+ "float %0, %1"
+ [(set_attr "type" "fp")])
+
+(define_expand "floatsisf2_cmp"
+ [(parallel
+ [(set (reg:CC_FP CCFP_REGNUM)
+ (compare:CC_FP (float:SF (match_operand:SF 1 "gpr_operand" "r"))
+ (match_dup 2)))
+ (set (match_operand:SF 0 "gpr_operand" "=r")
+ (float:SF (match_dup 1)))])]
+ ""
+ "operands[2] = CONST0_RTX (SFmode);")
+
+(define_insn "*floatsisf2_cmp_i"
+ [(match_parallel 3 "float_operation"
+ [(set (reg:CC_FP CCFP_REGNUM)
+ (compare:CC_FP (float:SF (match_operand:SF 1 "gpr_operand" "r"))
+ (match_operand:SF 2 "const0_operand" "")))
+ (set (match_operand:SF 0 "gpr_operand" "=r")
+ (float:SF (match_dup 1)))])]
+ ""
+ "float %0, %1"
+ [(set_attr "type" "fp")])
+
+(define_expand "floatunssisf2"
+ [(set (match_operand:SF 0 "gpr_operand" "")
+ (float:SF (match_operand:SI 1 "gpr_operand" "")))]
+ "epiphany_normal_fp_rounding == /*FP_MODE_ROUND_TRUNC*/ 2"
+{
+ rtx cst = force_reg (SImode, gen_int_mode (0xb0800000, SImode));
+ rtx tmp = gen_reg_rtx (SImode);
+ rtx cmp = gen_rtx_GTU (VOIDmode, gen_rtx_REG (CCmode, CC_REGNUM), const0_rtx);
+
+ if (reg_overlap_mentioned_p (operands[0], operands[1]))
+ operands[1] = copy_to_mode_reg (SImode, operands[1]);
+ emit_insn (gen_floatsisf2 (operands[0], operands[1]));
+ emit_insn (gen_ashrsi3 (tmp, operands[1], GEN_INT (8)));
+ emit_insn (gen_sub_f (tmp, tmp, cst));
+ emit_insn (gen_movsfcc (operands[0], cmp,
+ simplify_gen_subreg (SFmode, tmp, SImode, 0),
+ operands[0]));
+ DONE;
+})
+
+(define_expand "fix_truncsfsi2"
+ [(parallel
+ [(set (match_operand:SI 0 "gpr_operand" "")
+ (fix:SI (match_operand:SF 1 "gpr_operand" "")))
+ (clobber (reg:CC_FP CCFP_REGNUM))])])
+
+(define_insn "*fix_truncsfsi2_i"
+ [(match_parallel 2 "float_operation"
+ [(set (match_operand:SI 0 "gpr_operand" "=r")
+ (fix:SI (match_operand:SF 1 "gpr_operand" "r")))
+ (clobber (reg:CC_FP CCFP_REGNUM))])]
+ ""
+ "fix %0, %1"
+ [(set_attr "type" "fp")
+ (set_attr "fp_mode" "round_trunc")])
+
+(define_expand "fixuns_truncsfsi2"
+ [(set (match_operand:SI 0 "gpr_operand" "")
+ (unsigned_fix:SI (match_operand:SF 1 "gpr_operand" "")))]
+ ""
+{
+ if (reg_overlap_mentioned_p (operands[0], operands[1]))
+ operands[1] = copy_to_mode_reg (SImode, operands[1]);
+ if (TARGET_SOFT_CMPSF || optimize_function_for_speed_p (cfun))
+ {
+ rtx op1si;
+ /* By toggling what it to be bit31 before the shift, we get a chance to
+ use a short movt insn. */
+ rtx bit31 = force_reg (SImode, GEN_INT (0x800000));
+ rtx tmp = gen_reg_rtx (SImode);
+ rtx limit = force_reg (SImode, gen_int_mode (0x4f000000, SImode));
+ rtx cmp
+ = gen_rtx_GE (VOIDmode, gen_rtx_REG (CCmode, CC_REGNUM), const0_rtx);
+
+ op1si = simplify_gen_subreg (SImode, operands[1], SFmode, 0);
+ emit_insn (gen_fix_truncsfsi2 (operands[0], operands[1]));
+ emit_insn (gen_subsi3 (tmp, op1si, bit31));
+ emit_insn (gen_ashlsi3 (tmp, tmp, GEN_INT (8)));
+ emit_insn (gen_cmpsi_cc_insn (op1si, limit));
+ emit_insn (gen_movsicc (operands[0], cmp, tmp, operands[0]));
+ }
+ else
+ {
+ REAL_VALUE_TYPE offset;
+ rtx limit;
+ rtx tmp = gen_reg_rtx (SFmode);
+ rtx label = gen_label_rtx ();
+ rtx bit31;
+ rtx cc1 = gen_rtx_REG (CC_FPmode, CCFP_REGNUM);
+ rtx cmp = gen_rtx_LT (VOIDmode, cc1, CONST0_RTX (SFmode));
+
+ real_2expN (&offset, 31, SFmode);
+ limit = CONST_DOUBLE_FROM_REAL_VALUE (offset, SFmode);
+ limit = force_reg (SFmode, limit);
+ emit_insn (gen_fix_truncsfsi2 (operands[0], operands[1]));
+ emit_insn (gen_subsf3_f (tmp, operands[1], limit));
+ emit_jump_insn (gen_branch_insn (label, cmp, cc1));
+ bit31 = force_reg (SImode, gen_int_mode (0x80000000, SImode));
+ emit_insn (gen_fix_truncsfsi2 (operands[0], tmp));
+ emit_insn (gen_xorsi3 (operands[0], operands[0], bit31));
+ emit_label (label);
+ }
+ DONE;
+})
+
+(define_insn "*iadd"
+ [(match_parallel 3 "float_operation"
+ [(set (match_operand:SI 0 "gpr_operand" "=r")
+ (plus:SI (match_operand:SI 1 "gpr_operand" "%r")
+ (match_operand:SI 2 "gpr_operand" "r")))
+ (clobber (reg:CC_FP CCFP_REGNUM))])]
+ ""
+ "iadd %0, %1, %2"
+ [(set_attr "type" "fp_int")])
+
+(define_insn "*isub"
+ [(match_parallel 3 "float_operation"
+ [(set (match_operand:SI 0 "gpr_operand" "=r")
+ (minus:SI (match_operand:SI 1 "gpr_operand" "r")
+ (match_operand:SI 2 "gpr_operand" "r")))
+ (clobber (reg:CC_FP CCFP_REGNUM))])]
+ ""
+ "isub %0, %1, %2"
+ [(set_attr "type" "fp_int")])
+
+(define_expand "mulsi3"
+ [(parallel
+ [(set (match_operand:SI 0 "gpr_operand" "")
+ (mult:SI (match_operand:SI 1 "gpr_operand" "")
+ (match_operand:SI 2 "gpr_operand" "")))
+ (clobber (reg:CC_FP CCFP_REGNUM))])])
+
+(define_insn "*imul"
+ [(match_parallel 3 "float_operation"
+ [(set (match_operand:SI 0 "gpr_operand" "=r")
+ (mult:SI (match_operand:SI 1 "gpr_operand" "%r")
+ (match_operand:SI 2 "gpr_operand" "r")))
+ (clobber (reg:CC_FP CCFP_REGNUM))])]
+ ""
+ "imul %0, %1, %2"
+ [(set_attr "type" "fp_int")])
+
+; combiner pattern, also used by vector combiner pattern
+(define_expand "maddsi"
+ [(parallel
+ [(set (match_operand:SI 0 "gpr_operand" "=r")
+ (plus:SI (mult:SI (match_operand:SI 1 "gpr_operand" "r")
+ (match_operand:SI 2 "gpr_operand" "r"))
+ (match_operand:SI 3 "gpr_operand" "0")))
+ (clobber (reg:CC_FP CCFP_REGNUM))])]
+ "")
+
+(define_insn "*maddsi_combine"
+ [(match_parallel 4 "float_operation"
+ [(set (match_operand:SI 0 "gpr_operand" "=r")
+ (plus:SI (mult:SI (match_operand:SI 1 "gpr_operand" "r")
+ (match_operand:SI 2 "gpr_operand" "r"))
+ (match_operand:SI 3 "gpr_operand" "0")))
+ (clobber (reg:CC_FP CCFP_REGNUM))])]
+ ""
+ "imsub %0, %1, %2"
+ [(set_attr "type" "fp_int")])
+
+(define_insn "*imsub"
+ [(match_parallel 4 "float_operation"
+ [(set (match_operand:SI 0 "gpr_operand" "=r")
+ (minus:SI (match_operand:SI 3 "gpr_operand" "0")
+ (mult:SI (match_operand:SI 1 "gpr_operand" "r")
+ (match_operand:SI 2 "gpr_operand" "r"))))
+ (clobber (reg:CC_FP CCFP_REGNUM))])]
+ ""
+ "imsub %0, %1, %2"
+ [(set_attr "type" "fp_int")])
+
+(define_expand "divsi3"
+ [(parallel
+ [(set (match_operand:SI 0 "move_dest_operand" "")
+ (div:SI (match_operand:SI 1 "move_src_operand" "")
+ (match_operand:SI 2 "move_src_operand" "")))
+ (use (match_dup 3))
+ (clobber (reg:SI 0))
+ (clobber (reg:SI 1))
+ (clobber (reg:SI GPR_IP))
+ (clobber (reg:DI GPR_16))
+ (clobber (reg:DI GPR_18))
+ (clobber (reg:SI GPR_20))
+ (clobber (reg:SI GPR_LR))
+ (clobber (reg:CC CC_REGNUM))
+ (clobber (reg:CC_FP CCFP_REGNUM))])]
+ ""
+ "operands[3] = sfunc_symbol (\"__divsi3\");")
+
+;; Before reload, keep the hard reg usage to clobbers so that the loop
+;; optimizers can more easily move this insn.
+(define_insn_and_split "*divsi3_1"
+ [(match_parallel 4 "float_operation"
+ [(set (match_operand:SI 0 "move_dest_operand" "=r,r")
+ (div:SI (match_operand:SI 1 "move_src_operand" "rU16m,rU16mCal")
+ (match_operand:SI 2 "move_src_operand" "rU16m,rU16mCal")))
+ (use (match_operand:SI 3 "call_address_operand" "Csy,r"))
+ (clobber (reg:SI 0))
+ (clobber (reg:SI 1))
+ (clobber (reg:SI GPR_IP))
+ (clobber (reg:DI GPR_16))
+ (clobber (reg:DI GPR_18))
+ (clobber (reg:SI GPR_20))
+ (clobber (reg:SI GPR_LR))
+ (clobber (reg:CC CC_REGNUM))
+ (clobber (reg:CC_FP CCFP_REGNUM))])]
+ ""
+ "#"
+ "&& reload_completed"
+ [(set (reg:SI 0) (match_dup 1))
+ (set (reg:SI 1) (match_dup 2))
+ (parallel
+ [(set (reg:SI 0) (div:SI (reg:SI 0) (reg:SI 1)))
+ (use (match_dup 3))
+ (clobber (reg:SI 1))
+ (clobber (reg:SI GPR_IP))
+ (clobber (reg:DI GPR_16))
+ (clobber (reg:DI GPR_18))
+ (clobber (reg:SI GPR_20))
+ (clobber (reg:SI GPR_LR))
+ (clobber (reg:CC CC_REGNUM))
+ (clobber (reg:CC_FP CCFP_REGNUM))
+ (match_dup 5)
+ (match_dup 6)])
+ (set (match_dup 0) (reg:SI 0))]
+ "operands[5] = XVECEXP (operands[4], 0, XVECLEN (operands[4], 0) - 2);
+ operands[6] = XVECEXP (operands[4], 0, XVECLEN (operands[4], 0) - 1);"
+ [(set_attr "type" "fp_sfunc")
+ (set_attr "length" "16,24")])
+
+(define_insn "*divsi3_2"
+ [(match_parallel 1 "float_operation"
+ [(set (reg:SI 0) (div:SI (reg:SI 0) (reg:SI 1)))
+ (use (match_operand:SI 0 "call_address_operand" "Csy,r"))
+ (clobber (reg:SI 1))
+ (clobber (reg:SI GPR_IP))
+ (clobber (reg:DI GPR_16))
+ (clobber (reg:DI GPR_18))
+ (clobber (reg:SI GPR_20))
+ (clobber (reg:SI GPR_LR))
+ (clobber (reg:CC CC_REGNUM))
+ (clobber (reg:CC_FP CCFP_REGNUM))])]
+ ""
+ "%f0"
+ [(set_attr "type" "fp_sfunc")])
+
+(define_expand "udivsi3"
+ [(parallel
+ [(set (match_operand:SI 0 "move_dest_operand" "")
+ (udiv:SI (match_operand:SI 1 "move_src_operand" "")
+ (match_operand:SI 2 "move_src_operand" "")))
+ (use (match_dup 3))
+ (clobber (reg:SI 0))
+ (clobber (reg:SI 1))
+ (clobber (reg:SI GPR_IP))
+ (clobber (reg:DI GPR_16))
+ (clobber (reg:SI GPR_18))
+ (clobber (reg:SI GPR_LR))
+ (clobber (reg:CC CC_REGNUM))
+ (clobber (reg:CC_FP CCFP_REGNUM))])]
+ ""
+ "operands[3] = sfunc_symbol (\"__udivsi3\");")
+
+;; Before reload, keep the hard reg usage to clobbers so that the loop
+;; optimizers can more easily move this insn.
+(define_insn_and_split "*udivsi3_1"
+ [(match_parallel 4 "float_operation"
+ [(set (match_operand:SI 0 "move_dest_operand" "=r,r")
+ (udiv:SI (match_operand:SI 1 "move_src_operand" "rU16m,rU16mCal")
+ (match_operand:SI 2 "move_src_operand" "rU16m,rU16mCal")))
+ (use (match_operand:SI 3 "call_address_operand" "Csy,r"))
+ (clobber (reg:SI 0))
+ (clobber (reg:SI 1))
+ (clobber (reg:SI GPR_IP))
+ (clobber (reg:DI GPR_16))
+ (clobber (reg:SI GPR_18))
+ (clobber (reg:SI GPR_LR))
+ (clobber (reg:CC CC_REGNUM))
+ (clobber (reg:CC_FP CCFP_REGNUM))])]
+ ""
+ "#"
+ "&& reload_completed"
+ [(set (reg:SI 0) (match_dup 1))
+ (set (reg:SI 1) (match_dup 2))
+ (parallel
+ [(set (reg:SI 0) (udiv:SI (reg:SI 0) (reg:SI 1)))
+ (use (match_dup 3))
+ (clobber (reg:SI 1))
+ (clobber (reg:SI GPR_IP))
+ (clobber (reg:DI GPR_16))
+ (clobber (reg:SI GPR_18))
+ (clobber (reg:SI GPR_LR))
+ (clobber (reg:CC CC_REGNUM))
+ (clobber (reg:CC_FP CCFP_REGNUM))
+ (match_dup 5)
+ (match_dup 6)])
+ (set (match_dup 0) (reg:SI 0))]
+ "operands[5] = XVECEXP (operands[4], 0, XVECLEN (operands[4], 0) - 2);
+ operands[6] = XVECEXP (operands[4], 0, XVECLEN (operands[4], 0) - 1);"
+ [(set_attr "type" "fp_sfunc")
+ (set_attr "length" "16,24")])
+
+(define_insn "*udivsi3_2"
+ [(match_parallel 1 "float_operation"
+ [(set (reg:SI 0) (udiv:SI (reg:SI 0) (reg:SI 1)))
+ (use (match_operand:SI 0 "call_address_operand" "Csy,r"))
+ (clobber (reg:SI 1))
+ (clobber (reg:SI GPR_IP))
+ (clobber (reg:DI GPR_16))
+ (clobber (reg:SI GPR_18))
+ (clobber (reg:SI GPR_LR))
+ (clobber (reg:CC CC_REGNUM))
+ (clobber (reg:CC_FP CCFP_REGNUM))])]
+ ""
+ "%f0"
+ [(set_attr "type" "fp_sfunc")])
+
+(define_expand "modsi3"
+ [(parallel
+ [(set (match_operand:SI 0 "move_dest_operand" "")
+ (mod:SI (match_operand:SI 1 "move_src_operand" "")
+ (match_operand:SI 2 "move_src_operand" "")))
+ (use (match_dup 3))
+ (clobber (reg:SI 0))
+ (clobber (reg:SI 1))
+ (clobber (reg:SI 2))
+ (clobber (reg:SI GPR_IP))
+ (clobber (reg:DI GPR_16))
+ (clobber (reg:DI GPR_18))
+ (clobber (reg:SI GPR_LR))
+ (clobber (reg:CC CC_REGNUM))
+ (clobber (reg:CC_FP CCFP_REGNUM))])]
+ ""
+ "operands[3] = sfunc_symbol (\"__modsi3\");")
+
+;; Before reload, keep the hard reg usage to clobbers so that the loop
+;; optimizers can more easily move this insn.
+(define_insn_and_split "*modsi3_1"
+ [(match_parallel 4 "float_operation"
+ [(set (match_operand:SI 0 "move_dest_operand" "=r,r")
+ (mod:SI (match_operand:SI 1 "move_src_operand" "rU16m,rU16mCal")
+ (match_operand:SI 2 "move_src_operand" "rU16m,rU16mCal")))
+ (use (match_operand:SI 3 "call_address_operand" "Csy,r"))
+ (clobber (reg:SI 0))
+ (clobber (reg:SI 1))
+ (clobber (reg:SI 2))
+ (clobber (reg:SI GPR_IP))
+ (clobber (reg:DI GPR_16))
+ (clobber (reg:DI GPR_18))
+ (clobber (reg:SI GPR_LR))
+ (clobber (reg:CC CC_REGNUM))
+ (clobber (reg:CC_FP CCFP_REGNUM))])]
+ ""
+ "#"
+ "&& reload_completed"
+ [(set (reg:SI 0) (match_dup 1))
+ (set (reg:SI 1) (match_dup 2))
+ (parallel
+ [(set (reg:SI 0) (mod:SI (reg:SI 0) (reg:SI 1)))
+ (use (match_dup 3))
+ (clobber (reg:SI 2))
+ (clobber (reg:SI GPR_IP))
+ (clobber (reg:DI GPR_16))
+ (clobber (reg:DI GPR_18))
+ (clobber (reg:SI GPR_LR))
+ (clobber (reg:CC CC_REGNUM))
+ (clobber (reg:CC_FP CCFP_REGNUM))
+ (match_dup 5)
+ (match_dup 6)])
+ (set (match_dup 0) (reg:SI 0))]
+ "operands[5] = XVECEXP (operands[4], 0, XVECLEN (operands[4], 0) - 2);
+ operands[6] = XVECEXP (operands[4], 0, XVECLEN (operands[4], 0) - 1);"
+ [(set_attr "type" "fp_sfunc")
+ (set_attr "length" "16,24")])
+
+(define_insn "*modsi3_2"
+ [(match_parallel 1 "float_operation"
+ [(set (reg:SI 0) (mod:SI (reg:SI 0) (reg:SI 1)))
+ (use (match_operand:SI 0 "call_address_operand" "Csy,r"))
+ (clobber (reg:SI 2))
+ (clobber (reg:SI GPR_IP))
+ (clobber (reg:DI GPR_16))
+ (clobber (reg:DI GPR_18))
+ (clobber (reg:SI GPR_LR))
+ (clobber (reg:CC CC_REGNUM))
+ (clobber (reg:CC_FP CCFP_REGNUM))])]
+ ""
+ "%f0"
+ [(set_attr "type" "fp_sfunc")])
+
+(define_expand "umodsi3"
+ [(parallel
+ [(set (match_operand:SI 0 "move_dest_operand" "")
+ (umod:SI (match_operand:SI 1 "move_src_operand" "")
+ (match_operand:SI 2 "move_src_operand" "")))
+ (use (match_dup 3))
+ (clobber (reg:SI 0))
+ (clobber (reg:SI 1))
+ (clobber (reg:SI 2))
+ (clobber (reg:SI GPR_IP))
+ (clobber (reg:DI GPR_16))
+ (clobber (reg:SI GPR_LR))
+ (clobber (reg:CC CC_REGNUM))
+ (clobber (reg:CC_FP CCFP_REGNUM))])]
+ ""
+ "operands[3] = sfunc_symbol (\"__umodsi3\");")
+
+;; Before reload, keep the hard reg usage to clobbers so that the loop
+;; optimizers can more easily move this insn.
+(define_insn_and_split "*umodsi3_1"
+ [(match_parallel 4 "float_operation"
+ [(set (match_operand:SI 0 "move_dest_operand" "=r,r")
+ (umod:SI (match_operand:SI 1 "move_src_operand" "rU16m,rU16mCal")
+ (match_operand:SI 2 "move_src_operand" "rU16m,rU16mCal")))
+ (use (match_operand:SI 3 "call_address_operand" "Csy,r"))
+ (clobber (reg:SI 0))
+ (clobber (reg:SI 1))
+ (clobber (reg:SI 2))
+ (clobber (reg:SI GPR_IP))
+ (clobber (reg:DI GPR_16))
+ (clobber (reg:SI GPR_LR))
+ (clobber (reg:CC CC_REGNUM))
+ (clobber (reg:CC_FP CCFP_REGNUM))])]
+ ""
+ "#"
+ "&& reload_completed"
+ [(set (reg:SI 0) (match_dup 1))
+ (set (reg:SI 1) (match_dup 2))
+ (parallel
+ [(set (reg:SI 0) (umod:SI (reg:SI 0) (reg:SI 1)))
+ (use (match_dup 3))
+ (clobber (reg:SI 2))
+ (clobber (reg:SI GPR_IP))
+ (clobber (reg:DI GPR_16))
+ (clobber (reg:SI GPR_LR))
+ (clobber (reg:CC CC_REGNUM))
+ (clobber (reg:CC_FP CCFP_REGNUM))
+ (match_dup 5)
+ (match_dup 6)])
+ (set (match_dup 0) (reg:SI 0))]
+ "operands[5] = XVECEXP (operands[4], 0, XVECLEN (operands[4], 0) - 2);
+ operands[6] = XVECEXP (operands[4], 0, XVECLEN (operands[4], 0) - 1);"
+ [(set_attr "type" "fp_sfunc")
+ (set_attr "length" "16,24")])
+
+(define_insn "*umodsi3_2"
+ [(match_parallel 1 "float_operation"
+ [(set (reg:SI 0) (umod:SI (reg:SI 0) (reg:SI 1)))
+ (use (match_operand:SI 0 "call_address_operand" "Csy,r"))
+ (clobber (reg:SI 2))
+ (clobber (reg:SI GPR_IP))
+ (clobber (reg:DI GPR_16))
+ (clobber (reg:SI GPR_LR))
+ (clobber (reg:CC CC_REGNUM))
+ (clobber (reg:CC_FP CCFP_REGNUM))])]
+ ""
+ "%f0"
+ [(set_attr "type" "fp_sfunc")])
+
+; Disable interrupts.
+; Any earlier values read from CONFIG_REGNUM are out of date, since interrupts
+; might have changed settings that we do not want to mess with.
+(define_insn "gid"
+ [(set (reg:SI CONFIG_REGNUM)
+ (unspec_volatile:SI [(const_int 0)] UNSPECV_GID))]
+ ""
+ "gid"
+ [(set_attr "type" "flow")])
+
+; Enable interrupts.
+; Present CONTROL_REGNUM here to make sure it is live before the
+; actual uses in floating point insns / calls are inserted.
+; FWIW, interrupts also do mind what is in the control register.
+(define_insn "gie"
+ [(unspec_volatile [(reg:SI CONFIG_REGNUM)] UNSPECV_GIE)]
+ ""
+ "gie"
+ [(set_attr "type" "flow")])
+
+; Floating point instructions require manipulating the control register.
+; Manipulating the control register needs aritmetic.
+; Arithmetic clobbers flags.
+; The flags are in the status register, which also contains the alternate
+; flag and the interrupt enable/disable bits.
+; saving/restoring status and mixing up the order with gid/gie could
+; lead to disaster.
+; Usually, saving/restoring the status is unnecessary, and will be optimized
+; away. But when we really need it, we must make sure that we don't change
+; anything but the flags.
+; N.B.: We could make the constant easier to load by inverting it, but
+; then we'd need to clobber the saved value - and that would make optimizing
+; away unneeded saves/restores harder / less likely.
+(define_expand "movcc"
+ [(parallel [(set (match_operand:CC 0 "cc_move_operand" "")
+ (match_operand:CC 1 "cc_move_operand" ""))
+ (use (match_dup 2))
+ (clobber (match_scratch:SI 3 "=X, &r"))])]
+ ""
+ "operands[2] = gen_int_mode (~0x10f0, SImode);")
+
+(define_insn "*movcc_i"
+ [(set (match_operand:CC 0 "cc_move_operand" "=r,Rcc")
+ (match_operand:CC 1 "cc_move_operand" "Rcc, r"))
+ (use (match_operand:SI 2 "nonmemory_operand" "X, r"))
+ (clobber (match_scratch:SI 3 "=X, &r"))]
+ ""
+ "@
+ movfs %0,status
+ movfs %3,status\;eor %3,%3,%1\;and %3,%3,%2\;eor %3,%3,%1\;movts status,%3"
+ [(set_attr "type" "flow")
+ (set_attr "length" "20,4")])
+
+(define_insn_and_split "set_fp_mode"
+ [(set (reg:SI FP_NEAREST_REGNUM)
+ (match_operand:SI 0 "set_fp_mode_operand" "rCfm"))
+ (set (reg:SI FP_TRUNCATE_REGNUM) (match_dup 0))
+ (set (reg:SI FP_ANYFP_REGNUM)
+ (match_operand:SI 1 "set_fp_mode_operand" "rCfm"))
+ (use (match_operand:SI 2 "gpr_operand" "r"))
+ (clobber (reg:CC CC_REGNUM))
+ (clobber (match_scratch:SI 3 "=&r"))]
+ ""
+ "#"
+ "reload_completed || !rtx_equal_p (operands[0], operands[1])"
+ [(const_int 0)]
+{
+ if (!reload_completed)
+ emit_note (NOTE_INSN_DELETED);
+ else
+ epiphany_expand_set_fp_mode (operands);
+ DONE;
+})
+
+
+;; Boolean instructions.
+;;
+;; We don't define the DImode versions as expand_binop does a good enough job.
+
+(define_insn "andsi3"
+ [(set (match_operand:SI 0 "gpr_operand" "=r")
+ (and:SI (match_operand:SI 1 "gpr_operand" "r")
+ (match_operand:SI 2 "gpr_operand" "r")))
+ (clobber (reg:CC CC_REGNUM))]
+ ""
+ "and %0,%1,%2")
+
+(define_insn "iorsi3"
+ [(set (match_operand:SI 0 "gpr_operand" "=r")
+ (ior:SI (match_operand:SI 1 "gpr_operand" "r")
+ (match_operand:SI 2 "gpr_operand" "r")))
+ (clobber (reg:CC CC_REGNUM))]
+ ""
+ "orr %0,%1,%2")
+
+(define_insn "xorsi3"
+ [(set (match_operand:SI 0 "gpr_operand" "=r")
+ (xor:SI (match_operand:SI 1 "gpr_operand" "r")
+ (match_operand:SI 2 "gpr_operand" "r")))
+ (clobber (reg:CC CC_REGNUM))]
+ ""
+ "eor %0,%1,%2")
+
+(define_expand "one_cmplsi2"
+ [(set (match_operand:SI 0 "gpr_operand" "")
+ (xor:SI (match_operand:SI 1 "gpr_operand" "")
+ (match_dup 2)))]
+ ""
+{
+ if (epiphany_m1reg >= 0)
+ emit_insn (gen_one_cmplsi2_i (operands[0], operands[1]));
+ else
+ emit_insn (gen_xorsi3 (operands[0], operands[1],
+ force_reg (SImode, GEN_INT (-1))));
+ DONE;
+})
+
+; Note that folding this pattern into the xorsi3 pattern would make combine
+; less effective.
+(define_insn "one_cmplsi2_i"
+ [(set (match_operand:SI 0 "gpr_operand" "=r")
+ (not:SI (match_operand:SI 1 "gpr_operand" "r")))
+ (clobber (reg:CC CC_REGNUM))]
+ "epiphany_m1reg >= 0"
+ "eor %0,%1,%-")
+
+;; Shift instructions.
+;; In principle we could support arbitrary symbolic values as shift constant
+;; (truncating the value appropriately), but that would require a suitable
+;; relocation and assembler & linker support.
+(define_insn "ashrsi3"
+ [(set (match_operand:SI 0 "gpr_operand" "=r,r")
+ (ashiftrt:SI (match_operand:SI 1 "gpr_operand" "r,r")
+ (match_operand:SI 2 "arith_operand" "r,K")))
+ (clobber (reg:CC CC_REGNUM))]
+ ""
+ "asr %0,%1,%2"
+ [(set_attr "length" "4")
+ (set_attr "type" "shift")])
+
+(define_insn "ashrsi3_tst"
+ [(set (reg:CC CC_REGNUM)
+ (compare:CC
+ (ashiftrt:SI (match_operand:SI 1 "gpr_operand" "r,r")
+ (match_operand:SI 2 "arith_operand" "r,K"))
+ (const_int 0)))
+ (set (match_operand:SI 0 "gpr_operand" "=r,r")
+ (ashiftrt:SI (match_dup 1) (match_dup 2)))]
+ ""
+ "asr %0,%1,%2"
+ [(set_attr "length" "4")
+ (set_attr "type" "shift")])
+
+;; Logical Shift Right
+(define_insn "lshrsi3"
+ [(set (match_operand:SI 0 "gpr_operand" "=r,r")
+ (lshiftrt:SI (match_operand:SI 1 "gpr_operand" "r,r")
+ (match_operand:SI 2 "arith_operand" "r,K")))
+ (clobber (reg:CC CC_REGNUM))]
+ ""
+ "lsr %0,%1,%2"
+ [(set_attr "length" "4")
+ (set_attr "type" "shift")])
+
+(define_insn "lshrsi3_tst"
+ [(set (reg:CC CC_REGNUM)
+ (compare:CC
+ (lshiftrt:SI (match_operand:SI 1 "gpr_operand" "r,r")
+ (match_operand:SI 2 "arith_operand" "r,K"))
+ (const_int 0)))
+ (set (match_operand:SI 0 "gpr_operand" "=r,r")
+ (lshiftrt:SI (match_dup 1) (match_dup 2)))]
+ ""
+ "lsr %0,%1,%2"
+ [(set_attr "length" "4")
+ (set_attr "type" "shift")])
+
+;; Logical/Arithmetic Shift Left
+(define_insn "ashlsi3"
+ [(set (match_operand:SI 0 "gpr_operand" "=r,r")
+ (ashift:SI (match_operand:SI 1 "gpr_operand" "r,r")
+ (match_operand:SI 2 "arith_operand" "r,K")))
+ (clobber (reg:CC CC_REGNUM))]
+ ""
+ "lsl %0,%1,%2"
+ [(set_attr "length" "4")
+ (set_attr "type" "shift")])
+
+(define_insn "*ashlsi_btst"
+ [(set (reg:CC_N_NE CC_REGNUM)
+ (compare:CC_N_NE
+ (zero_extract:SI (match_operand:SI 1 "gpr_operand" "r")
+ (const_int 1)
+ (match_operand 2 "const_int_operand" "K"))
+ (const_int 0)))
+ (clobber (match_scratch:SI 0 "=r"))]
+ ""
+{
+ rtx xop[3];
+
+ xop[0] = operands[0];
+ xop[1] = operands[1];
+ xop[2] = GEN_INT (31-INTVAL (operands[2]));
+ output_asm_insn ("lsl %0,%1,%2", xop);
+ return "";
+})
+
+;; zero extensions
+(define_insn_and_split "zero_extendqisi2"
+ [(set (match_operand:SI 0 "register_operand" "=r,r")
+ (zero_extend:SI (match_operand:QI 1 "nonimmediate_operand" "r,m")))
+ (clobber (reg:CC CC_REGNUM))]
+ ""
+ "@
+ #
+ ldrb %0,%1"
+ "reload_completed
+ ? true_regnum (operands[1]) >= 0
+ : REG_P (operands[1]) && REGNO (operands[1]) < FIRST_PSEUDO_REGISTER"
+ [(parallel [(set (match_dup 0) (ashift:SI (match_dup 2) (const_int 24)))
+ (clobber (reg:CC CC_REGNUM))])
+ (parallel [(set (match_dup 0) (lshiftrt:SI (match_dup 0) (const_int 24)))
+ (clobber (reg:CC CC_REGNUM))])]
+ "operands[2] = simplify_gen_subreg (SImode, operands[1], QImode, 0);")
+
+(define_insn "zero_extendhisi2"
+ [(set (match_operand:SI 0 "register_operand" "=r,r")
+ (zero_extend:SI (match_operand:HI 1 "nonimmediate_operand" "0,m")))]
+ ""
+ "@
+ movt %0, 0
+ ldrh %0,%c1")
+
+
+;; Compare instructions.
+
+(define_insn "cmpsi_cc_insn"
+ [(set (reg:CC CC_REGNUM)
+ (compare:CC (match_operand:SI 0 "add_reg_operand" "r,r")
+ (match_operand:SI 1 "arith_operand" "r,L")))
+ (clobber (match_scratch:SI 2 "=r,r"))]
+ ""
+ "sub %2,%0,%1"
+ [(set_attr "type" "compare")])
+
+(define_insn "sub_f"
+ [(set (reg:CC CC_REGNUM)
+ (compare:CC (match_operand:SI 1 "gpr_operand" "r,r")
+ (match_operand:SI 2 "arith_operand" "r,L")))
+ (set (match_operand:SI 0 "gpr_operand" "=r,r")
+ (minus:SI (match_dup 1) (match_dup 2)))]
+ ""
+ "sub %0,%1,%2"
+ [(set_attr "type" "compare")])
+
+(define_insn "*sub_f_add_imm"
+ [(set (reg:CC CC_REGNUM)
+ (compare:CC (match_operand:SI 1 "gpr_operand" "r")
+ (match_operand:SI 2 "arith_int_operand" "L")))
+ (set (match_operand:SI 0 "gpr_operand" "=r")
+ (plus:SI (match_dup 1) (match_operand:SI 3 "const_int_operand" "L")))]
+ "INTVAL (operands[2]) == -INTVAL (operands[3])"
+ "sub %0,%1,%2"
+ [(set_attr "type" "compare")])
+
+(define_expand "abssi2"
+ [(set (match_dup 2) (const_int 0))
+ (parallel [(set (reg:CC CC_REGNUM)
+ (compare:CC (match_dup 2)
+ (match_operand:SI 1 "nonmemory_operand" "")))
+ (set (match_dup 3)
+ (minus:SI (match_dup 2) (match_dup 1)))])
+ (set (match_operand:SI 0 "gpr_operand" "=r")
+ (if_then_else:SI (gt:SI (reg:CC CC_REGNUM) (const_int 0))
+ (match_dup 3)
+ (match_dup 1)))]
+ "TARGET_CMOVE"
+ "operands[2] = gen_reg_rtx (SImode); operands[3] = gen_reg_rtx (SImode);")
+
+(define_insn "*add_c"
+ [(set (reg:CC_C_LTU CC_REGNUM)
+ (compare:CC_C_LTU
+ (plus:SI (match_operand:SI 1 "gpr_operand" "%r,r")
+ (match_operand:SI 2 "arith_operand" "r,L"))
+ (match_dup 1)))
+ (set (match_operand:SI 0 "gpr_operand" "=r,r")
+ (plus:SI (match_dup 1) (match_dup 2)))]
+ ""
+ "add %0,%1,%2"
+ [(set_attr "type" "compare")])
+
+(define_insn "*add_c_rev"
+ [(set (reg:CC_C_LTU CC_REGNUM)
+ (compare:CC_C_LTU
+ (plus:SI (match_operand:SI 1 "gpr_operand" "%r,r")
+ (match_operand:SI 2 "arith_operand" "r,L"))
+ (match_dup 1)))
+ (set (match_operand:SI 0 "gpr_operand" "=r,r")
+ (plus:SI (match_dup 2) (match_dup 1)))]
+ ""
+ "add %0,%1,%2"
+ [(set_attr "type" "compare")])
+
+(define_insn "*sub_c"
+ [(set (reg:CC_C_GTU CC_REGNUM)
+ (compare:CC_C_GTU
+ (minus:SI (match_operand:SI 1 "gpr_operand" "r,r")
+ (match_operand:SI 2 "arith_operand" "r,L"))
+ (match_dup 1)))
+ (set (match_operand:SI 0 "gpr_operand" "=r,r")
+ (minus:SI (match_dup 1) (match_dup 2)))]
+ ""
+ "sub %0,%1,%2"
+ [(set_attr "type" "compare")])
+
+(define_insn "*sub_c_void"
+ [(set (reg:CC_C_GTU CC_REGNUM)
+ (compare:CC_C_GTU
+ (minus:SI (match_operand:SI 1 "gpr_operand" "r,r")
+ (match_operand:SI 2 "arith_operand" "r,L"))
+ (match_dup 1)))
+ (clobber (match_scratch:SI 0 "=r,r"))]
+ ""
+ "sub %0,%1,%2"
+ [(set_attr "type" "compare")])
+
+; floating point comparisons
+
+(define_insn "*cmpsf_cc_insn"
+ [(match_parallel 3 "float_operation"
+ [(set (reg:CC_FP CCFP_REGNUM)
+ (compare:CC_FP (match_operand:SF 0 "gpr_operand" "r")
+ (match_operand:SF 1 "gpr_operand" "r")))
+ (clobber (match_scratch:SF 2 "=r"))])]
+ "!TARGET_SOFT_CMPSF"
+ "fsub %2,%0,%1"
+ [(set_attr "type" "fp")
+ (set_attr "fp_mode" "round_unknown")])
+
+;; ??? do we have to relax the operand0 predicate to immediate_operand
+;; to allow the rtl loop optimizer to generate comparisons? OTOH
+;; we want call_address_operand to enforce valid operands so that
+;; combine won't do silly things, allowing instruction scheduling to do
+;; a proper job.
+(define_insn "*cmpsf_eq"
+ [(set (reg:CC_FP_EQ CC_REGNUM) (compare:CC_FP_EQ (reg:SF 0) (reg:SF 1)))
+ (use (match_operand:SI 0 "call_address_operand" "Csy,r"))
+ (clobber (reg:SI GPR_IP))
+ (clobber (reg:SI GPR_LR))]
+ "TARGET_SOFT_CMPSF"
+ "%f0"
+ [(set_attr "type" "sfunc")])
+
+(define_insn "*cmpsf_gte"
+ [(set (reg:CC_FP_GTE CC_REGNUM) (compare:CC_FP_GTE (reg:SF 0) (reg:SF 1)))
+ (use (match_operand:SI 0 "call_address_operand" "Csy,r"))
+ (clobber (reg:SI GPR_IP))
+ (clobber (reg:SI GPR_LR))]
+ "TARGET_SOFT_CMPSF"
+ "%f0"
+ [(set_attr "type" "sfunc")])
+
+(define_insn "*cmpsf_ord"
+ [(set (reg:CC_FP_ORD CC_REGNUM) (compare:CC_FP_ORD (reg:SF 0) (reg:SF 1)))
+ (use (match_operand:SI 0 "call_address_operand" "Csy,r"))
+ (clobber (reg:SI GPR_IP))
+ (clobber (reg:SI GPR_16))
+ (clobber (reg:SI GPR_LR))]
+ "TARGET_SOFT_CMPSF"
+ "%f0"
+ [(set_attr "type" "sfunc")])
+
+(define_insn "*cmpsf_uneq"
+ [(set (reg:CC_FP_UNEQ CC_REGNUM) (compare:CC_FP_UNEQ (reg:SF 0) (reg:SF 1)))
+ (use (match_operand:SI 0 "call_address_operand" "Csy,r"))
+ (clobber (reg:SI GPR_IP))
+ (clobber (reg:SI GPR_16))
+ (clobber (reg:SI GPR_LR))]
+ "TARGET_SOFT_CMPSF"
+ "%f0"
+ [(set_attr "type" "sfunc")])
+
+;; conditional moves
+
+(define_expand "mov<mode>cc"
+ [(set (match_operand:WMODE 0 "gpr_operand" "")
+ (if_then_else:WMODE (match_operand 1 "comparison_operator" "")
+ (match_operand:WMODE 2 "gpr_operand" "")
+ (match_operand:WMODE 3 "gpr_operand" "")))]
+ "TARGET_CMOVE"
+{
+ rtx cmp_op0 = XEXP (operands[1], 0);
+ rtx cmp_op1 = XEXP (operands[1], 1);
+ enum machine_mode cmp_in_mode;
+ enum rtx_code code = GET_CODE (operands[1]);
+
+ cmp_in_mode = GET_MODE (cmp_op0);
+ if (cmp_in_mode == VOIDmode)
+ cmp_in_mode = GET_MODE (cmp_op0);
+ if (cmp_in_mode == VOIDmode)
+ cmp_in_mode = SImode;
+ /* If the operands are a better match when reversed, swap them now.
+ This allows combine to see the proper comparison codes. */
+ if (rtx_equal_p (operands[0], operands[2])
+ && !rtx_equal_p (operands[0], operands[3]))
+ {
+ rtx tmp = operands[2]; operands[2] = operands[3]; operands[3] = tmp;
+ code = (FLOAT_MODE_P (GET_MODE (cmp_op0))
+ ? reverse_condition_maybe_unordered (code)
+ : reverse_condition (code));
+ }
+
+ if (proper_comparison_operator (operands[1], VOIDmode))
+ operands[1] = gen_rtx_fmt_ee (code, cmp_in_mode, cmp_op0, cmp_op1);
+ else
+ {
+ if (!currently_expanding_to_rtl)
+ {
+ /* ??? It would seem safest to FAIL here, but that would defeat
+ the purpose of having an if-conversion pass; its logic currently
+ assumes that the backend should be safe to insert condition code
+ setting instructions, as the same condition codes were presumably
+ set by the if-conversion input code. */
+ }
+ /* What mode to give as first operand to gen_compare_reg here is
+ debatable. VOIDmode would be minimalist; telling gen_compare_reg
+ to use the mode of CC_REGNUM (or putting it on the comparison
+ operator afterwards) is also a logical choice. OTOH, by using
+ <MODE>mode, we have mode combine opportunities with flag setting
+ operations - if we get some. */
+ operands[1]
+ = gen_compare_reg (<MODE>mode, code, cmp_in_mode, cmp_op0, cmp_op1);
+ }
+})
+
+(define_insn "*mov<mode>cc_insn"
+ [(set (match_operand:WMODE 0 "gpr_operand" "=r")
+ (if_then_else:WMODE (match_operator 3 "proper_comparison_operator"
+ [(match_operand 4 "cc_operand") (const_int 0)])
+ (match_operand:WMODE 1 "gpr_operand" "r")
+ (match_operand:WMODE 2 "gpr_operand" "0")))]
+ "TARGET_CMOVE"
+ "mov%d3 %0,%1"
+ [(set_attr "type" "cmove")])
+
+(define_peephole2
+ [(parallel [(set (match_operand:WMODE 0 "gpr_operand" "")
+ (match_operand:WMODE 1 "" ""))
+ (clobber (match_operand 8 "cc_operand"))])
+ (match_operand 2 "" "")
+ (set (match_operand:WMODE2 3 "gpr_operand" "")
+ (match_operand:WMODE2 9 "gpr_operand" ""))
+ (set (match_dup 3)
+ (if_then_else:WMODE2 (match_operator 5 "proper_comparison_operator"
+ [(match_operand 6 "cc_operand")
+ (match_operand 7 "const0_operand")])
+ (match_operand:WMODE2 4 "nonmemory_operand" "")
+ (match_dup 3)))]
+ "REGNO (operands[0]) == REGNO (operands[9])
+ && peep2_reg_dead_p (3, operands[0])
+ && !reg_set_p (operands[0], operands[2])
+ && !reg_set_p (operands[3], operands[2])
+ && !reg_overlap_mentioned_p (operands[3], operands[2])"
+ [(parallel [(set (match_dup 10) (match_dup 1))
+ (clobber (match_dup 8))])
+ (match_dup 2)
+ (set (match_dup 3)
+ (if_then_else:WMODE2 (match_dup 5) (match_dup 4) (match_dup 3)))]
+{
+ operands[10] = simplify_gen_subreg (<WMODE:MODE>mode, operands[3],
+ <WMODE2:MODE>mode, 0);
+ replace_rtx (operands[2], operands[9], operands[3]);
+ replace_rtx (operands[2], operands[0], operands[10]);
+ gcc_assert (!reg_overlap_mentioned_p (operands[0], operands[2]));
+})
+
+(define_peephole2
+ [(parallel [(set (match_operand 6 "cc_operand") (match_operand 2 "" ""))
+ (set (match_operand:WMODE 0 "gpr_operand" "")
+ (match_operand:WMODE 1 "" ""))])
+ (set (match_operand:WMODE2 3 "gpr_operand" "")
+ (match_operand:WMODE2 4 "gpr_operand"))
+ (set (match_dup 3)
+ (if_then_else:WMODE2 (match_operator 5 "proper_comparison_operator"
+ [(match_dup 6)
+ (match_operand:WMODE 7 "const0_operand")])
+ (match_operand:WMODE2 8 "gpr_operand")
+ (match_dup 3)))]
+ "REGNO (operands[0]) == REGNO (operands[8])
+ && REVERSIBLE_CC_MODE (GET_MODE (operands[6]))
+ && peep2_reg_dead_p (3, operands[6])
+ && peep2_reg_dead_p (3, operands[0])
+ && !reg_overlap_mentioned_p (operands[4], operands[3])"
+ [(parallel [(set (match_dup 6) (match_dup 2))
+ (set (match_dup 9) (match_dup 1))])
+ (set (match_dup 3)
+ (if_then_else:WMODE2 (match_dup 5) (match_dup 4) (match_dup 3)))]
+ "
+{
+ operands[5]
+ = gen_rtx_fmt_ee (REVERSE_CONDITION (GET_CODE (operands[5]),
+ GET_MODE (operands[6])),
+ GET_MODE (operands[5]), operands[6], operands[7]);
+ operands[9] = simplify_gen_subreg (<WMODE:MODE>mode, operands[3],
+ <WMODE2:MODE>mode, 0);
+}")
+
+;; These control RTL generation for conditional jump insns
+
+;; To signal to can_compare_p that the cbranchs?4 patterns work,
+;; they must allow const0_rtx for both comparison operands
+(define_expand "cbranchsi4"
+ [(set (reg CC_REGNUM)
+ (compare (match_operand:SI 1 "add_operand" "")
+ (match_operand:SI 2 "arith_operand" "")))
+ (set (pc)
+ (if_then_else
+ (match_operator 0 "ordered_comparison_operator" [(reg CC_REGNUM)
+ (const_int 0)])
+ (label_ref (match_operand 3 "" ""))
+ (pc)))]
+ ""
+{
+ rtx cmp = gen_compare_reg (VOIDmode, GET_CODE (operands[0]), SImode,
+ operands[1], operands[2]);
+ emit_jump_insn (gen_branch_insn (operands[3], cmp, XEXP (cmp, 0)));
+ DONE;
+})
+
+(define_expand "cbranchsf4"
+ [(set (reg CC_REGNUM)
+ (compare (match_operand:SF 1 "arith_operand" "")
+ (match_operand:SF 2 "arith_operand" "")))
+ (set (pc)
+ (if_then_else
+ (match_operator 0 "comparison_operator" [(reg CC_REGNUM)
+ (const_int 0)])
+ (label_ref (match_operand 3 "" ""))
+ (pc)))]
+ ""
+{
+ rtx cmp = gen_compare_reg (VOIDmode, GET_CODE (operands[0]), SFmode,
+ operands[1], operands[2]);
+ emit_jump_insn (gen_branch_insn (operands[3], cmp, XEXP (cmp, 0)));
+ DONE;
+})
+
+;; Now match both normal and inverted jump.
+
+(define_insn "branch_insn"
+ [(set (pc)
+ (if_then_else (match_operator 1 "proper_comparison_operator"
+ [(match_operand 2 "cc_operand")
+ (const_int 0)])
+ (label_ref (match_operand 0 "" ""))
+ (pc)))]
+ ""
+ "b%d1 %l0"
+ [(set_attr "type" "branch")])
+
+(define_insn "*rev_branch_insn"
+ [(set (pc)
+ (if_then_else (match_operator 1 "proper_comparison_operator"
+ [(reg CC_REGNUM) (const_int 0)])
+ (pc)
+ (label_ref (match_operand 0 "" ""))))]
+ ""
+ "b%D1 %l0"
+ [(set_attr "type" "branch")])
+
+;; Unconditional and other jump instructions.
+
+(define_insn "jump"
+ [(set (pc) (label_ref (match_operand 0 "" "")))]
+ ""
+ "b %l0"
+ [(set_attr "type" "uncond_branch")])
+
+(define_insn "indirect_jump"
+ [(set (pc) (match_operand:SI 0 "gpr_operand" "r"))]
+ ""
+ "jr %0"
+ [(set_attr "type" "uncond_branch")])
+
+(define_expand "tablejump"
+ [(parallel [(set (pc) (match_operand:SI 0 "gpr_operand" ""))
+ (use (label_ref (match_operand 1 "" "")))])]
+ ""
+{
+ /* In PIC mode, the table entries are stored PC relative.
+ Convert the relative address to an absolute address. */
+ if (flag_pic)
+ {
+ rtx op1 = gen_rtx_LABEL_REF (Pmode, operands[1]);
+
+ operands[0] = expand_simple_binop (Pmode, PLUS, operands[0],
+ op1, NULL_RTX, 0, OPTAB_DIRECT);
+ }
+})
+
+(define_insn "*tablejump_internal"
+ [(set (pc) (match_operand:SI 0 "gpr_operand" "r"))
+ (use (label_ref (match_operand 1 "" "")))]
+ ""
+ "jr %0;"
+ [(set_attr "type" "uncond_branch")])
+
+(define_insn "*tablejump_hi_internal"
+ [(set (pc) (match_operand:HI 0 "gpr_operand" "r"))
+ (use (label_ref (match_operand 1 "" "")))]
+ "optimize_size && TARGET_SMALL16"
+ "jr %0;"
+ [(set_attr "type" "uncond_branch")])
+
+
+(define_expand "call"
+ ;; operands[1] is stack_size_rtx
+ ;; operands[2] is next_arg_register
+ [(parallel [(call (match_operand:SI 0 "call_operand" "")
+ (match_operand 1 "" ""))
+ (clobber (reg:SI GPR_LR))])]
+ ""
+{
+ bool target_uninterruptible = epiphany_call_uninterruptible_p (operands[0]);
+
+ if (!call_operand (operands[1], VOIDmode))
+ operands[0]
+ = change_address (operands[0], VOIDmode,
+ copy_to_mode_reg (Pmode, XEXP (operands[0], 0)));
+ if (epiphany_uninterruptible_p (current_function_decl)
+ != target_uninterruptible)
+ {
+ emit_insn (target_uninterruptible ? gen_gid (): gen_gie ());
+ emit_call_insn
+ (gen_rtx_PARALLEL
+ (VOIDmode,
+ gen_rtvec (2, gen_rtx_CALL (VOIDmode, operands[0], operands[1]),
+ gen_rtx_CLOBBER (VOIDmode,
+ gen_rtx_REG (SImode, GPR_LR)))));
+ emit_insn (target_uninterruptible ? gen_gie (): gen_gid ());
+ DONE;
+ }
+})
+
+(define_insn "*call_i"
+ [(match_parallel 2 "float_operation"
+ [(call (mem:SI (match_operand:SI 0 "call_address_operand" "Csy,r"))
+ (match_operand 1 "" ""))
+ (clobber (reg:SI GPR_LR))])]
+ ""
+ "%f0"
+ [(set_attr "type" "call")])
+
+(define_expand "sibcall"
+ ;; operands[1] is stack_size_rtx
+ ;; operands[2] is next_arg_register
+ [(parallel [(call (match_operand:SI 0 "call_operand" "")
+ (match_operand 1 "" ""))
+ (return)])]
+ ""
+{
+ bool target_uninterruptible = epiphany_call_uninterruptible_p (operands[0]);
+
+ if (!call_operand (operands[1], VOIDmode))
+ operands[0]
+ = change_address (operands[0], VOIDmode,
+ copy_to_mode_reg (Pmode, XEXP (operands[0], 0)));
+ if (epiphany_uninterruptible_p (current_function_decl)
+ != target_uninterruptible)
+ {
+ emit_insn (target_uninterruptible ? gen_gid (): gen_gie ());
+ emit_call_insn
+ (gen_rtx_PARALLEL
+ (VOIDmode,
+ gen_rtvec (2, gen_rtx_CALL (VOIDmode, operands[0], operands[1]),
+ ret_rtx)));
+ emit_insn (target_uninterruptible ? gen_gie (): gen_gid ());
+ DONE;
+ }
+})
+
+(define_insn "*sibcall_i"
+ [(call (mem:SI (match_operand:SI 0 "call_address_operand" "Csy,Rsc"))
+ (match_operand 1 "" ""))
+ (return)]
+ ""
+ "@
+ b %0
+ jr %0"
+ [(set_attr "type" "call")])
+
+(define_expand "call_value"
+ ;; operand 2 is stack_size_rtx
+ ;; operand 3 is next_arg_register
+ [(parallel [(set (match_operand 0 "gpr_operand" "=r")
+ (call (match_operand:SI 1 "call_operand" "")
+ (match_operand 2 "" "")))
+ (clobber (reg:SI GPR_LR))])]
+ ""
+{
+ bool target_uninterruptible = epiphany_call_uninterruptible_p (operands[1]);
+
+ if (!call_operand (operands[1], VOIDmode))
+ operands[1]
+ = change_address (operands[1], VOIDmode,
+ copy_to_mode_reg (Pmode, XEXP (operands[1], 0)));
+ if (epiphany_uninterruptible_p (current_function_decl)
+ != target_uninterruptible)
+ {
+ emit_insn (target_uninterruptible ? gen_gid (): gen_gie ());
+ emit_call_insn
+ (gen_rtx_PARALLEL
+ (VOIDmode,
+ gen_rtvec (2, gen_rtx_SET
+ (VOIDmode, operands[0],
+ gen_rtx_CALL (VOIDmode, operands[1], operands[2])),
+ gen_rtx_CLOBBER (VOIDmode,
+ gen_rtx_REG (SImode, GPR_LR)))));
+ emit_insn (target_uninterruptible ? gen_gie (): gen_gid ());
+ DONE;
+ }
+})
+
+(define_insn "*call_value_i"
+ [(match_parallel 3 "float_operation"
+ [(set (match_operand 0 "gpr_operand" "=r,r")
+ (call (mem:SI (match_operand:SI 1 "call_address_operand" "Csy,r"))
+ (match_operand 2 "" "")))
+ (clobber (reg:SI GPR_LR))])]
+ ""
+ "%f1"
+ [(set_attr "type" "call")
+ (set_attr "length" "4")])
+
+(define_expand "sibcall_value"
+ ;; operand 2 is stack_size_rtx
+ ;; operand 3 is next_arg_register
+ [(parallel [(set (match_operand 0 "gpr_operand" "=r")
+ (call (match_operand:SI 1 "call_operand" "")
+ (match_operand 2 "" "")))
+ (return)])]
+ ""
+{
+ bool target_uninterruptible = epiphany_call_uninterruptible_p (operands[1]);
+
+ if (!call_operand (operands[1], VOIDmode))
+ operands[1]
+ = change_address (operands[1], VOIDmode,
+ copy_to_mode_reg (Pmode, XEXP (operands[1], 0)));
+ if (epiphany_uninterruptible_p (current_function_decl)
+ != target_uninterruptible)
+ {
+ emit_insn (target_uninterruptible ? gen_gid (): gen_gie ());
+ emit_call_insn
+ (gen_rtx_PARALLEL
+ (VOIDmode,
+ gen_rtvec (2, gen_rtx_SET
+ (VOIDmode, operands[0],
+ gen_rtx_CALL (VOIDmode, operands[1], operands[2])),
+ ret_rtx)));
+ emit_insn (target_uninterruptible ? gen_gie (): gen_gid ());
+ DONE;
+ }
+})
+
+(define_insn "*sibcall_value_i"
+ [(set (match_operand 0 "gpr_operand" "=r,r")
+ (call (mem:SI (match_operand:SI 1 "call_address_operand" "Csy,Rsc"))
+ (match_operand 2 "" "")))
+ (return)]
+ ""
+ "@
+ b %1
+ jr %1"
+ [(set_attr "type" "call")
+ (set_attr "length" "4")])
+
+(define_expand "prologue"
+ [(pc)]
+ ""
+{
+ epiphany_expand_prologue ();
+ DONE;
+})
+
+(define_expand "epilogue"
+ [(pc)]
+ ""
+{
+ epiphany_expand_epilogue (0);
+ DONE;
+})
+
+(define_expand "sibcall_epilogue"
+ [(pc)]
+ ""
+{
+ epiphany_expand_epilogue (1);
+ DONE;
+})
+
+; Since the demise of REG_N_SETS, it is no longer possible to find out
+; in the prologue / epilogue expanders how many times lr is set.
+; Using df_regs_ever_live_p to decide if lr needs saving means that
+; any explicit use of lr will cause it to be saved; hence we cannot
+; represent the blink use in return / sibcall instructions themselves, and
+; instead have to show it in EPILOGUE_USES.
+(define_insn "return_i"
+ [(return)]
+ "reload_completed"
+ "rts"
+ [(set_attr "type" "uncond_branch")])
+
+(define_insn "return_internal_interrupt"
+ [(return)
+ (unspec_volatile [(const_int 0)] 1)]
+ ""
+ "rti"
+ [(set_attr "type" "uncond_branch")])
+
+(define_insn "stack_adjust_add"
+ [(set (reg:SI GPR_SP)
+ (plus:SI (reg:SI GPR_SP) (match_operand:SI 0 "arith_operand" "rL")))
+ (clobber (reg:CC CC_REGNUM))
+ (clobber (reg:SI STATUS_REGNUM))
+ (clobber (match_operand:BLK 1 "memory_operand" "=m"))]
+ "reload_completed"
+ "add sp,sp,%0")
+
+(define_insn "stack_adjust_mov"
+ [(set (reg:SI GPR_SP) (reg:SI GPR_FP))
+ (clobber (match_operand:BLK 0 "memory_operand" "=m"))]
+ "reload_completed"
+ "mov sp,fp"
+ [(set_attr "type" "move")])
+
+(define_insn "stack_adjust_str"
+ [(set (match_operand 0 "stacktop_operand" "=m")
+ (match_operand 1 "any_gpr_operand" "r"))
+ (set (reg:SI GPR_SP)
+ (plus:SI (reg:SI GPR_SP) (match_operand:SI 2 "nonmemory_operand" "rn")))
+ (clobber (match_operand:BLK 3 "memory_operand" "=m"))]
+ "reload_completed"
+{
+ return (GET_MODE_SIZE (GET_MODE (operands[0])) <= 4
+ ? \"str %1,%0,%C2\" : \"strd %1,%0,%X2\");
+}
+ [(set_attr "type" "store")])
+
+(define_insn "stack_adjust_ldr"
+ [(set (match_operand:SI 0 "gpr_operand" "=r")
+ (match_operand:SI 1 "stacktop_operand" "m"))
+ (set (reg:SI GPR_SP)
+ (plus:SI (reg:SI GPR_SP) (match_operand:SI 2 "nonmemory_operand" "rn")))
+ (clobber (match_operand:BLK 3 "memory_operand" "=m"))]
+ "reload_completed"
+ "ldr %0,%1,%C2"
+ [(set_attr "type" "load")])
+
+;; Define some fake vector operations so that the vectorizer is happy to use
+;; 64 bit loads/stores.
+(define_expand "vec_unpacks_lo_v4hi"
+ [(match_operand:V2SI 0 "gpr_operand")
+ (match_operand:V4HI 1 "gpr_operand")]
+ ""
+{
+ rtx in = simplify_gen_subreg (SImode, operands[1], V4HImode, 0);
+ rtx outl = simplify_gen_subreg (SImode, operands[0], V2SImode, 0);
+ rtx outh
+ = simplify_gen_subreg (SImode, operands[0], V2SImode, UNITS_PER_WORD);
+
+ if (reg_overlap_mentioned_p (outl, in))
+ in = copy_to_mode_reg (SImode, in);
+ emit_insn (gen_ashlsi3 (outl, in, GEN_INT (16)));
+ emit_insn (gen_ashrsi3 (outl, outl, GEN_INT (16)));
+ emit_insn (gen_ashrsi3 (outh, in, GEN_INT (16)));
+ DONE;
+})
+
+(define_expand "vec_unpacks_hi_v4hi"
+ [(match_operand:V2SI 0 "gpr_operand")
+ (match_operand:V4HI 1 "gpr_operand")]
+ ""
+{
+ rtx in = simplify_gen_subreg (SImode, operands[1], V4HImode, UNITS_PER_WORD);
+ rtx outl = simplify_gen_subreg (SImode, operands[0], V2SImode, 0);
+ rtx outh
+ = simplify_gen_subreg (SImode, operands[0], V2SImode, UNITS_PER_WORD);
+
+ if (reg_overlap_mentioned_p (outl, in))
+ in = copy_to_mode_reg (SImode, in);
+ emit_insn (gen_ashlsi3 (outl, in, GEN_INT (16)));
+ emit_insn (gen_ashrsi3 (outl, outl, GEN_INT (16)));
+ emit_insn (gen_ashrsi3 (outh, in, GEN_INT (16)));
+ DONE;
+})
+
+(define_code_iterator addsub [plus minus])
+
+(define_code_iterator alu_binop
+ [plus minus and ior xor])
+
+(define_code_attr insn_opname
+ [(plus "add") (minus "sub") (mult "mul") (div "div")
+ (and "and") (ior "ior") (xor "xor")])
+
+; You might think that this would work better as a define_expand, but
+; again lower_subreg pessimizes the code if it sees indiviudual operations.
+; We need to keep inputs and outputs as register pairs if we want to
+; get sensible register allocation for double-word load and store operations.
+(define_insn_and_split "<insn_opname>v2si3"
+ [(set (match_operand:V2SI 0 "gpr_operand" "=r")
+ (alu_binop:V2SI (match_operand:V2SI 1 "gpr_operand" "r")
+ (match_operand:V2SI 2 "gpr_operand" "r")))
+ (clobber (reg:CC CC_REGNUM))]
+ ""
+ "#"
+ "reload_completed || (epiphany_vect_align == 4 && TARGET_SPLIT_VECMOVE_EARLY)"
+ [(const_int 0)]
+{
+ rtx o0l, o0h, o1l, o1h, o2l, o2h;
+
+ o0l = simplify_gen_subreg (SImode, operands[0], V2SImode, 0);
+ o0h = simplify_gen_subreg (SImode, operands[0], V2SImode, UNITS_PER_WORD);
+ o1l = simplify_gen_subreg (SImode, operands[1], V2SImode, 0);
+ o1h = simplify_gen_subreg (SImode, operands[1], V2SImode, UNITS_PER_WORD);
+ o2l = simplify_gen_subreg (SImode, operands[2], V2SImode, 0);
+ o2h = simplify_gen_subreg (SImode, operands[2], V2SImode, UNITS_PER_WORD);
+ if (reg_overlap_mentioned_p (o0l, o1h))
+ o1h = copy_to_mode_reg (SImode, o1h);
+ if (reg_overlap_mentioned_p (o0l, o2h))
+ o2h = copy_to_mode_reg (SImode, o2h);
+ emit_insn (gen_<insn_opname>si3 (o0l, o1l, o2l));
+ emit_insn (gen_<insn_opname>si3 (o0h, o1h, o2h));
+ DONE;
+}
+ [(set_attr "length" "8")])
+
+(define_expand "<insn_opname>v2sf3"
+ [(parallel
+ [(set (match_operand:V2SF 0 "gpr_operand" "")
+ (addsub:V2SF (match_operand:V2SF 1 "gpr_operand" "")
+ (match_operand:V2SF 2 "gpr_operand" "")))
+ (clobber (reg:CC_FP CCFP_REGNUM))])])
+
+(define_insn_and_split "<insn_opname>v2sf3_i"
+ [(match_parallel 3 "float_operation"
+ [(set (match_operand:V2SF 0 "gpr_operand" "=r")
+ (addsub:V2SF (match_operand:V2SF 1 "gpr_operand" "r")
+ (match_operand:V2SF 2 "gpr_operand" "r")))
+ (clobber (reg:CC_FP CCFP_REGNUM))])]
+ ""
+ "#"
+ "reload_completed || (epiphany_vect_align == 4 && TARGET_SPLIT_VECMOVE_EARLY)"
+ [(parallel
+ [(set (match_dup 4) (addsub:SF (match_dup 5) (match_dup 6)))
+ (clobber (reg:CC_FP CCFP_REGNUM))
+ (match_dup 10)
+ (match_dup 11)])
+ (parallel
+ [(set (match_dup 7) (addsub:SF (match_dup 8) (match_dup 9)))
+ (clobber (reg:CC_FP CCFP_REGNUM))
+ (match_dup 10)
+ (match_dup 11)])]
+{
+ operands[4] = simplify_gen_subreg (SFmode, operands[0], V2SFmode, 0);
+ operands[5] = simplify_gen_subreg (SFmode, operands[1], V2SFmode, 0);
+ operands[6] = simplify_gen_subreg (SFmode, operands[2], V2SFmode, 0);
+ operands[7]
+ = simplify_gen_subreg (SFmode, operands[0], V2SFmode, UNITS_PER_WORD);
+ operands[8]
+ = simplify_gen_subreg (SFmode, operands[1], V2SFmode, UNITS_PER_WORD);
+ operands[9]
+ = simplify_gen_subreg (SFmode, operands[2], V2SFmode, UNITS_PER_WORD);
+ if (!reload_completed)
+ {
+ if (reg_overlap_mentioned_p (operands[4], operands[8]))
+ operands[8] = copy_to_mode_reg (SFmode, operands[8]);
+ if (reg_overlap_mentioned_p (operands[4], operands[9]))
+ operands[9] = copy_to_mode_reg (SFmode, operands[9]);
+ emit_insn (gen_<insn_opname>sf3 (operands[4], operands[5], operands[6]));
+ emit_insn (gen_<insn_opname>sf3 (operands[7], operands[8], operands[9]));
+ DONE;
+ }
+ gcc_assert (!reg_overlap_mentioned_p (operands[4], operands[8]));
+ gcc_assert (!reg_overlap_mentioned_p (operands[4], operands[9]));
+ operands[10] = XVECEXP (operands[3], 0, XVECLEN (operands[3], 0) - 2);
+ operands[11] = XVECEXP (operands[3], 0, XVECLEN (operands[3], 0) - 1);
+}
+ [(set_attr "length" "8")
+ (set_attr "type" "fp")])
+
+(define_expand "mul<mode>3"
+ [(parallel
+ [(set (match_operand:DWV2MODE 0 "gpr_operand" "")
+ (mult:DWV2MODE (match_operand:DWV2MODE 1 "gpr_operand" "")
+ (match_operand:DWV2MODE 2 "gpr_operand" "")))
+ (clobber (reg:CC_FP CCFP_REGNUM))])])
+
+(define_insn_and_split "mul<mode>3_i"
+ [(match_parallel 3 "float_operation"
+ [(set (match_operand:DWV2MODE 0 "gpr_operand" "=r")
+ (mult:DWV2MODE (match_operand:DWV2MODE 1 "gpr_operand" "r")
+ (match_operand:DWV2MODE 2 "gpr_operand" "r")))
+ (clobber (reg:CC_FP CCFP_REGNUM))])]
+ ""
+ "#"
+ "reload_completed || (epiphany_vect_align == 4 && TARGET_SPLIT_VECMOVE_EARLY)"
+ [(parallel
+ [(set (match_dup 4) (mult:<vmode_PART> (match_dup 5) (match_dup 6)))
+ (clobber (reg:CC_FP CCFP_REGNUM))
+ (match_dup 10)
+ (match_dup 11)])
+ (parallel
+ [(set (match_dup 7) (mult:<vmode_PART> (match_dup 8) (match_dup 9)))
+ (clobber (reg:CC_FP CCFP_REGNUM))
+ (match_dup 10)
+ (match_dup 11)])]
+{
+ operands[4]
+ = simplify_gen_subreg (<vmode_PART>mode, operands[0], <MODE>mode, 0);
+ operands[5]
+ = simplify_gen_subreg (<vmode_PART>mode, operands[1], <MODE>mode, 0);
+ operands[6]
+ = simplify_gen_subreg (<vmode_PART>mode, operands[2], <MODE>mode, 0);
+ operands[7] = simplify_gen_subreg (<vmode_PART>mode, operands[0],
+ <MODE>mode, UNITS_PER_WORD);
+ operands[8] = simplify_gen_subreg (<vmode_PART>mode, operands[1],
+ <MODE>mode, UNITS_PER_WORD);
+ operands[9] = simplify_gen_subreg (<vmode_PART>mode, operands[2],
+ <MODE>mode, UNITS_PER_WORD);
+ if (!reload_completed)
+ {
+ if (reg_overlap_mentioned_p (operands[4], operands[8]))
+ operands[8] = copy_to_mode_reg (<vmode_PART>mode, operands[8]);
+ if (reg_overlap_mentioned_p (operands[4], operands[9]))
+ operands[9] = copy_to_mode_reg (<vmode_PART>mode, operands[9]);
+ emit_insn (gen_mul<vmode_part>3 (operands[4], operands[5], operands[6]));
+ emit_insn (gen_mul<vmode_part>3 (operands[7], operands[8], operands[9]));
+ DONE;
+ }
+ gcc_assert (!reg_overlap_mentioned_p (operands[4], operands[8]));
+ gcc_assert (!reg_overlap_mentioned_p (operands[4], operands[9]));
+ operands[10] = XVECEXP (operands[3], 0, XVECLEN (operands[3], 0) - 2);
+ operands[11] = XVECEXP (operands[3], 0, XVECLEN (operands[3], 0) - 1);
+}
+ [(set_attr "length" "8")
+ (set_attr "type" "<vmode_fp_type>")])
+
+(define_insn_and_split "*fmadd<mode>_combine"
+ [(match_parallel 4 "float_operation"
+ [(set (match_operand:DWV2MODE 0 "gpr_operand" "=r")
+ (plus:DWV2MODE (mult:<MODE>
+ (match_operand:<MODE> 1 "gpr_operand" "r")
+ (match_operand:<MODE> 2 "gpr_operand" "r"))
+ (match_operand:<MODE> 3 "gpr_operand" "0")))
+ (clobber (reg:CC_FP CCFP_REGNUM))])]
+ "TARGET_FUSED_MADD || <MODE>mode == V2SImode"
+ "#"
+ "reload_completed || (epiphany_vect_align == 4 && TARGET_SPLIT_VECMOVE_EARLY)"
+ [(parallel
+ [(set (match_dup 5)
+ (plus:<vmode_PART> (mult:<vmode_PART> (match_dup 6) (match_dup 7))
+ (match_dup 8)))
+ (clobber (reg:CC_FP CCFP_REGNUM))
+ (match_dup 13)
+ (match_dup 14)])
+ (parallel
+ [(set (match_dup 9)
+ (plus:<vmode_PART> (mult:<vmode_PART> (match_dup 10) (match_dup 11))
+ (match_dup 12)))
+ (clobber (reg:CC_FP CCFP_REGNUM))
+ (match_dup 13)
+ (match_dup 14)])]
+{
+ operands[5]
+ = simplify_gen_subreg (<vmode_PART>mode, operands[0], <MODE>mode, 0);
+ operands[6]
+ = simplify_gen_subreg (<vmode_PART>mode, operands[1], <MODE>mode, 0);
+ operands[7]
+ = simplify_gen_subreg (<vmode_PART>mode, operands[2], <MODE>mode, 0);
+ operands[8]
+ = simplify_gen_subreg (<vmode_PART>mode, operands[3], <MODE>mode, 0);
+ operands[9] = simplify_gen_subreg (<vmode_PART>mode, operands[0],
+ <MODE>mode, UNITS_PER_WORD);
+ operands[10] = simplify_gen_subreg (<vmode_PART>mode, operands[1],
+ <MODE>mode, UNITS_PER_WORD);
+ operands[11] = simplify_gen_subreg (<vmode_PART>mode, operands[2],
+ <MODE>mode, UNITS_PER_WORD);
+ operands[12] = simplify_gen_subreg (<vmode_PART>mode, operands[3],
+ <MODE>mode, UNITS_PER_WORD);
+ if (!reload_completed)
+ {
+ if (reg_overlap_mentioned_p (operands[5], operands[10]))
+ operands[10] = copy_to_mode_reg (<vmode_PART>mode, operands[10]);
+ if (reg_overlap_mentioned_p (operands[5], operands[11]))
+ operands[11] = copy_to_mode_reg (<vmode_PART>mode, operands[11]);
+ if (reg_overlap_mentioned_p (operands[5], operands[12]))
+ operands[12] = copy_to_mode_reg (<vmode_PART>mode, operands[12]);
+ emit_insn (gen_madd<vmode_part> (operands[5], operands[6], operands[7],
+ operands[8]));
+ emit_insn (gen_madd<vmode_part> (operands[9], operands[10], operands[11],
+ operands[12]));
+ DONE;
+ }
+ gcc_assert (!reg_overlap_mentioned_p (operands[5], operands[10]));
+ gcc_assert (!reg_overlap_mentioned_p (operands[5], operands[11]));
+ gcc_assert (!reg_overlap_mentioned_p (operands[5], operands[12]));
+ operands[13] = XVECEXP (operands[4], 0, XVECLEN (operands[4], 0) - 2);
+ operands[14] = XVECEXP (operands[4], 0, XVECLEN (operands[4], 0) - 1);
+}
+ [(set_attr "length" "8")
+ (set_attr "type" "<vmode_fp_type>")])
+
+(define_expand "vec_set<mode>"
+ [(match_operand:DWV2MODE 0 "register_operand")
+ (match_operand:<vmode_PART> 1 "register_operand")
+ (match_operand 2 "const_int_operand" "")]
+ ""
+{
+ operands[0]
+ = simplify_gen_subreg (<vmode_PART>mode, operands[0], <MODE>mode,
+ UNITS_PER_WORD * INTVAL (operands[2]));
+ emit_move_insn (operands[0], operands[1]);
+ DONE;
+})
+
+(define_insn "nop"
+ [(const_int 0)]
+ ""
+ "nop"
+ [(set_attr "type" "flow")])
diff --git a/gcc/config/epiphany/epiphany.opt b/gcc/config/epiphany/epiphany.opt
new file mode 100644
index 00000000000..374018260d4
--- /dev/null
+++ b/gcc/config/epiphany/epiphany.opt
@@ -0,0 +1,140 @@
+; Options for the Adapteva EPIPHANY port of the compiler
+;
+; Copyright (C) 2005, 2007, 2009, 2011 Free Software Foundation, Inc.
+; Contributed by Embecosm on behalf of Adapteva, 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/>.
+
+mhalf-reg-file
+Target Mask(HALF_REG_FILE)
+Don't use any of r32..r63.
+
+mprefer-short-insn-regs
+Target Mask(PREFER_SHORT_INSN_REGS)
+preferentially allocate registers that allow short instruction generation.
+
+mbranch-cost=
+Target RejectNegative Joined UInteger Var(epiphany_branch_cost) Init(3)
+Set branch cost
+
+mcmove
+Target Mask(CMOVE)
+enable conditional move instruction usage.
+
+mnops=
+Target RejectNegative Joined UInteger Var(epiphany_n_nops) Init(0)
+set number of nops to emit before each insn pattern
+
+; Problems with using the flags from fsub for comparison are:
+; - Because of underflow (lack of subnormal numbers), different small numbers
+; can compare as equal.
+; - the set of comparisons is limited, and reversing comparisons doesn't work
+; in the presence of NaNs.
+; The latter problem might be tolerated with -ffinite-math-only , but nothing
+; in -funsafe-math-optimizations says different small numbers may be considered
+; equal.
+msoft-cmpsf
+Target Mask(SOFT_CMPSF)
+Use software floating point comparisons
+
+msplit-lohi
+Target Mask(SPLIT_LOHI)
+Enable split of 32 bit immediate loads into low / high part
+
+mpost-inc
+Target Mask(POST_INC)
+Enable use of POST_INC / POST_DEC
+
+mpost-modify
+Target Mask(POST_MODIFY)
+Enable use of POST_MODIFY
+
+mstack-offset=
+Target RejectNegative Joined UInteger Var(epiphany_stack_offset) Init(EPIPHANY_STACK_OFFSET)
+Set number of bytes on the stack preallocated for use by the callee.
+
+mround-nearest
+target Mask(ROUND_NEAREST)
+Assume round to nearest is selected for purposes of scheduling.
+
+mlong-calls
+Target Mask(LONG_CALLS)
+Generate call insns as indirect calls
+
+mshort-calls
+Target Mask(SHORT_CALLS)
+Generate call insns as direct calls
+
+msmall16
+Target Mask(SMALL16)
+Assume labels and symbols can be addressed using 16 bit absolute addresses.
+
+mfp-mode=
+Target RejectNegative Joined Var(epiphany_normal_fp_mode) Enum(attr_fp_mode) Init(FP_MODE_CALLER)
+
+; The values are from enum attr_fp_mode, but using that enum would bring
+; problems with enum forward declarations.
+Enum
+Name(attr_fp_mode) Type(int)
+
+EnumValue
+Enum(attr_fp_mode) String(caller) Value(FP_MODE_CALLER)
+
+EnumValue
+Enum(attr_fp_mode) String(round-nearest) Value(FP_MODE_ROUND_NEAREST)
+
+EnumValue
+Enum(attr_fp_mode) String(truncate) Value(FP_MODE_ROUND_TRUNC)
+
+EnumValue
+Enum(attr_fp_mode) String(int) Value(FP_MODE_INT)
+
+mvect-double
+Target Mask(VECT_DOUBLE)
+Vectorize for double-word operations.
+
+max-vect-align=
+Target RejectNegative Joined Var(epiphany_vect_align) Enum(vect_align) Init(8)
+
+Enum
+Name(vect_align) Type(int)
+
+EnumValue
+Enum(vect_align) String(4) Value(4)
+
+EnumValue
+Enum(vect_align) String(8) Value(8)
+
+msplit-vecmove-early
+Target Mask(SPLIT_VECMOVE_EARLY)
+Split unaligned 8 byte vector moves before post-modify address generation.
+
+m1reg-
+Target RejectNegative Joined Var(epiphany_m1reg) Enum(m1reg) Init(-1)
+Set register to hold -1.
+
+Enum
+Name(m1reg) Type(int)
+
+EnumValue
+Enum(m1reg) String(none) Value(-1)
+
+EnumValue
+Enum(m1reg) String(r43) Value(43)
+
+EnumValue
+Enum(m1reg) String(r63) Value(63)
diff --git a/gcc/config/c6x/crtn.s b/gcc/config/epiphany/epiphany_intrinsics.h
index 5900a4b14c4..2c06b0c2504 100644
--- a/gcc/config/c6x/crtn.s
+++ b/gcc/config/epiphany/epiphany_intrinsics.h
@@ -1,5 +1,8 @@
-/* Copyright 2010, 2011 Free Software Foundation, Inc.
- Contributed by Bernd Schmidt <bernds@codesourcery.com>.
+/* Epiphany intrinsic functions
+ Copyright (C) 2011 Free Software Foundation, Inc.
+ Contributed by Embecosm on behalf of Adapteva, Inc.
+
+This file is part of GCC.
This file is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
@@ -20,22 +23,5 @@ a copy of the GCC Runtime Library Exception along with this program;
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
-/*
- * This file supplies function epilogues for the .init and .fini sections.
- * It is linked in after all other files.
- */
-
- .section .init
- ldw .d2t2 *+B15(4), B3
- add .d2 B15, 8, B15
- nop 3
- ret .s2 B3
- nop 5
-
- .section .fini
- ldw .d2t2 *+B15(4), B3
- add .d2 B15, 8, B15
- nop 3
- ret .s2 B3
- nop 5
-
+#define __builtin_epiphany_fmadd(a, b, c) __builtin_fmaf (b, c, a)
+#define __builtin_epiphany_fmsub(a, b, c) __builtin_fmaf (-(b), c, a)
diff --git a/gcc/config/epiphany/mode-switch-use.c b/gcc/config/epiphany/mode-switch-use.c
new file mode 100644
index 00000000000..a7020f4393b
--- /dev/null
+++ b/gcc/config/epiphany/mode-switch-use.c
@@ -0,0 +1,91 @@
+/* Insert USEs in instructions that require mode switching.
+ This should probably be merged into mode-switching.c .
+ Copyright (C) 2011 Free Software Foundation, Inc.
+ Contributed by Embecosm on behalf of Adapteva, 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/>. */
+
+#include "config.h"
+#include "system.h"
+#include "coretypes.h"
+#include "tm.h"
+#include "rtl.h"
+#include "function.h"
+#include "emit-rtl.h"
+#include "tree-pass.h"
+#include "insn-attr.h"
+#include "insn-config.h"
+#include "recog.h"
+#include "tm_p.h"
+#include "df.h"
+
+#ifndef TARGET_INSERT_MODE_SWITCH_USE
+#define TARGET_INSERT_MODE_SWITCH_USE NULL
+#endif
+
+static unsigned int
+insert_uses (void)
+{
+ static const int num_modes[] = NUM_MODES_FOR_MODE_SWITCHING;
+#define N_ENTITIES ARRAY_SIZE (num_modes)
+ int e;
+ void (*target_insert_mode_switch_use) (rtx insn, int, int)
+ = TARGET_INSERT_MODE_SWITCH_USE;
+
+ for (e = N_ENTITIES - 1; e >= 0; e--)
+ {
+ int no_mode = num_modes[e];
+ rtx insn;
+ int mode;
+
+ if (!OPTIMIZE_MODE_SWITCHING (e))
+ continue;
+ for (insn = get_insns (); insn; insn = NEXT_INSN (insn))
+ {
+ if (!INSN_P (insn))
+ continue;
+ mode = MODE_NEEDED (e, insn);
+ if (mode == no_mode)
+ continue;
+ if (target_insert_mode_switch_use)
+ {
+ target_insert_mode_switch_use (insn, e, mode);
+ df_insn_rescan (insn);
+ }
+ }
+ }
+ return 0;
+}
+
+struct rtl_opt_pass pass_mode_switch_use =
+{
+ {
+ RTL_PASS,
+ "mode_switch_use", /* name */
+ NULL, /* gate */
+ insert_uses, /* execute */
+ NULL, /* sub */
+ NULL, /* next */
+ 0, /* static_pass_number */
+ TV_NONE, /* tv_id */
+ 0, /* properties_required */
+ 0, /* properties_provided */
+ 0, /* properties_destroyed */
+ 0, /* todo_flags_start */
+ 0, /* todo_flags_finish */
+ }
+};
diff --git a/gcc/config/epiphany/predicates.md b/gcc/config/epiphany/predicates.md
new file mode 100644
index 00000000000..6e96af9fed4
--- /dev/null
+++ b/gcc/config/epiphany/predicates.md
@@ -0,0 +1,352 @@
+;; Predicate definitions for code generation on the EPIPHANY cpu.
+;; Copyright (C) 1994, 1995, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
+;; 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
+;; Free Software Foundation, Inc.
+;; Contributed by Embecosm on behalf of Adapteva, 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/>.
+
+;; Returns true iff OP is a symbol reference that is a valid operand
+;; in a jump or call instruction.
+
+(define_predicate "symbolic_operand"
+ (match_code "symbol_ref,label_ref,const")
+{
+ if (GET_CODE (op) == SYMBOL_REF)
+ return (!epiphany_is_long_call_p (op)
+ && (!flag_pic || SYMBOL_REF_LOCAL_P (op)));
+ if (GET_CODE (op) == LABEL_REF)
+ return true;
+ if (GET_CODE (op) == CONST)
+ {
+ op = XEXP (op, 0);
+ if (GET_CODE (op) != PLUS || !symbolic_operand (XEXP (op, 0), mode))
+ return false;
+ /* The idea here is that a 'small' constant offset should be OK.
+ What exactly is considered 'small' is a bit arbitrary. */
+ return satisfies_constraint_L (XEXP (op, 1));
+ }
+ gcc_unreachable ();
+})
+
+;; Acceptable arguments to the call insn.
+
+(define_predicate "call_address_operand"
+ (ior (match_code "reg")
+ (match_operand 0 "symbolic_operand")))
+
+(define_predicate "call_operand"
+ (match_code "mem")
+{
+ op = XEXP (op, 0);
+ return call_address_operand (op, mode);
+})
+
+;; general purpose register.
+(define_predicate "gpr_operand"
+ (match_code "reg,subreg")
+{
+ int regno;
+
+ if (!register_operand (op, mode))
+ return 0;
+ if (GET_CODE (op) == SUBREG)
+ op = XEXP (op, 0);
+ regno = REGNO (op);
+ return regno >= FIRST_PSEUDO_REGISTER || regno <= 63;
+})
+
+(define_special_predicate "any_gpr_operand"
+ (match_code "subreg,reg")
+{
+ return gpr_operand (op, mode);
+})
+
+;; register suitable for integer add / sub operations; besides general purpose
+;; registers we allow fake hard registers that are eliminated to a real
+;; hard register via an offset.
+(define_predicate "add_reg_operand"
+ (match_code "reg,subreg")
+{
+ int regno;
+
+ if (!register_operand (op, mode))
+ return 0;
+ if (GET_CODE (op) == SUBREG)
+ op = XEXP (op, 0);
+ regno = REGNO (op);
+ return (regno >= FIRST_PSEUDO_REGISTER || regno <= 63
+ || regno == FRAME_POINTER_REGNUM
+ || regno == ARG_POINTER_REGNUM);
+})
+
+;; Also allows suitable constants
+(define_predicate "add_operand"
+ (match_code "reg,subreg,const_int,symbol_ref,label_ref,const")
+{
+ if (GET_CODE (op) == REG || GET_CODE (op) == SUBREG)
+ return add_reg_operand (op, mode);
+ return satisfies_constraint_L (op);
+})
+
+;; Ordinary 3rd operand for arithmetic operations
+(define_predicate "arith_operand"
+ (match_code "reg,subreg,const_int,symbol_ref,label_ref,const")
+{
+ if (GET_CODE (op) == REG || GET_CODE (op) == SUBREG)
+ return register_operand (op, mode);
+ return satisfies_constraint_L (op);
+})
+
+;; Constant integer 3rd operand for arithmetic operations
+(define_predicate "arith_int_operand"
+ (match_code "const_int,symbol_ref,label_ref,const")
+{
+ return satisfies_constraint_L (op);
+})
+
+;; Return true if OP is an acceptable argument for a single word move source.
+
+(define_predicate "move_src_operand"
+ (match_code
+ "symbol_ref,label_ref,const,const_int,const_double,reg,subreg,mem,unspec")
+{
+ switch (GET_CODE (op))
+ {
+ case SYMBOL_REF :
+ case LABEL_REF :
+ case CONST :
+ return 1;
+ case CONST_INT :
+ return immediate_operand (op, mode);
+ case CONST_DOUBLE :
+ /* SImode constants should always fit into a CONST_INT. Large
+ unsigned 32-bit constants are represented as negative CONST_INTs. */
+ gcc_assert (GET_MODE (op) != SImode);
+ /* We can handle 32-bit floating point constants. */
+ if (mode == SFmode)
+ return GET_MODE (op) == SFmode;
+ return 0;
+ case REG :
+ return op != frame_pointer_rtx && register_operand (op, mode);
+ case SUBREG :
+ /* (subreg (mem ...) ...) can occur here if the inner part was once a
+ pseudo-reg and is now a stack slot. */
+ if (GET_CODE (SUBREG_REG (op)) == MEM)
+ return address_operand (XEXP (SUBREG_REG (op), 0), mode);
+ else
+ return register_operand (op, mode);
+ case MEM :
+ return address_operand (XEXP (op, 0), mode);
+ case UNSPEC:
+ return satisfies_constraint_Sra (op);
+ default :
+ return 0;
+ }
+})
+
+;; Return true if OP is an acceptable argument for a double word move source.
+
+(define_predicate "move_double_src_operand"
+ (match_code "reg,subreg,mem,const_int,const_double,const_vector")
+{
+ return general_operand (op, mode);
+})
+
+;; Return true if OP is an acceptable argument for a move destination.
+
+(define_predicate "move_dest_operand"
+ (match_code "reg,subreg,mem")
+{
+ switch (GET_CODE (op))
+ {
+ case REG :
+ return register_operand (op, mode);
+ case SUBREG :
+ /* (subreg (mem ...) ...) can occur here if the inner part was once a
+ pseudo-reg and is now a stack slot. */
+ if (GET_CODE (SUBREG_REG (op)) == MEM)
+ {
+ return address_operand (XEXP (SUBREG_REG (op), 0), mode);
+ }
+ else
+ {
+ return register_operand (op, mode);
+ }
+ case MEM :
+ return address_operand (XEXP (op, 0), mode);
+ default :
+ return 0;
+ }
+})
+
+(define_special_predicate "stacktop_operand"
+ (match_code "mem")
+{
+ if (mode != VOIDmode && GET_MODE (op) != mode)
+ return false;
+ return rtx_equal_p (XEXP (op, 0), stack_pointer_rtx);
+})
+
+;; Return 1 if OP is a comparison operator valid for the mode of CC.
+;; This allows the use of MATCH_OPERATOR to recognize all the branch insns.
+;;
+;; Some insns only set a few bits in the condition code. So only allow those
+;; comparisons that use the bits that are valid.
+
+(define_predicate "proper_comparison_operator"
+ (match_code "eq, ne, le, lt, ge, gt, leu, ltu, geu, gtu, unordered, ordered, uneq, unge, ungt, unle, unlt, ltgt")
+{
+ enum rtx_code code = GET_CODE (op);
+ rtx cc = XEXP (op, 0);
+
+ /* combine can try strange things. */
+ if (!REG_P (cc))
+ return 0;
+ switch (GET_MODE (cc))
+ {
+ case CC_Zmode:
+ case CC_N_NEmode:
+ case CC_FP_EQmode:
+ return REGNO (cc) == CC_REGNUM && (code == EQ || code == NE);
+ case CC_C_LTUmode:
+ return REGNO (cc) == CC_REGNUM && (code == LTU || code == GEU);
+ case CC_C_GTUmode:
+ return REGNO (cc) == CC_REGNUM && (code == GTU || code == LEU);
+ case CC_FPmode:
+ return (REGNO (cc) == CCFP_REGNUM
+ && (code == EQ || code == NE || code == LT || code == LE));
+ case CC_FP_GTEmode:
+ return (REGNO (cc) == CC_REGNUM
+ && (code == EQ || code == NE || code == GT || code == GE
+ || code == UNLE || code == UNLT));
+ case CC_FP_ORDmode:
+ return REGNO (cc) == CC_REGNUM && (code == ORDERED || code == UNORDERED);
+ case CC_FP_UNEQmode:
+ return REGNO (cc) == CC_REGNUM && (code == UNEQ || code == LTGT);
+ case CCmode:
+ return REGNO (cc) == CC_REGNUM;
+ /* From combiner. */
+ case QImode: case SImode: case SFmode: case HImode:
+ /* From cse.c:dead_libcall_p. */
+ case DFmode:
+ return 0;
+ default:
+ gcc_unreachable ();
+ }
+})
+
+(define_predicate "cc_operand"
+ (and (match_code "reg")
+ (match_test "REGNO (op) == CC_REGNUM || REGNO (op) == CCFP_REGNUM")))
+
+(define_predicate "const0_operand"
+ (match_code "const_int, const_double")
+{
+ if (mode == VOIDmode)
+ mode = GET_MODE (op);
+ return op == CONST0_RTX (mode);
+})
+
+(define_predicate "const_float_1_operand"
+ (match_code "const_double")
+{
+ return op == CONST1_RTX (mode);
+})
+
+(define_predicate "cc_move_operand"
+ (and (match_code "reg")
+ (ior (match_test "REGNO (op) == CC_REGNUM")
+ (match_test "gpr_operand (op, mode)"))))
+
+(define_predicate "float_operation"
+ (match_code "parallel")
+{
+ /* Most patterns start out with one SET and one CLOBBER, and gain a USE
+ or two of FP_NEAREST_REGNUM / FP_TRUNCATE_REGNUM / FP_ANYFP_REGNUM
+ after mode switching. The longer patterns are
+ all beyond length 4, and before mode switching, end with a
+ CLOBBER of CCFP_REGNUM. */
+ int count = XVECLEN (op, 0);
+ bool inserted = MACHINE_FUNCTION (cfun)->control_use_inserted;
+ int i;
+
+ if (count == 2)
+ return !inserted;
+
+ /* combine / recog will pass any old garbage here before checking the
+ rest of the insn. */
+ if (count <= 3)
+ return false;
+
+ i = 1;
+ if (count > 4)
+ for (i = 4; i < count; i++)
+ {
+ rtx x = XVECEXP (op, 0, i);
+
+ if (GET_CODE (x) == CLOBBER)
+ {
+ if (!REG_P (XEXP (x, 0)))
+ return false;
+ if (REGNO (XEXP (x, 0)) == CCFP_REGNUM)
+ {
+ if (count == i + 1)
+ return !inserted;
+ break;
+ }
+ /* Just an ordinary clobber, keep looking. */
+ }
+ else if (GET_CODE (x) == USE
+ || (GET_CODE (x) == SET && i == 2))
+ continue;
+ else
+ return false;
+ }
+ if (count != i + 3 || !inserted)
+ return false;
+ for (i = i+1; i < count; i++)
+ {
+ rtx x = XVECEXP (op, 0, i);
+
+ if (GET_CODE (x) != USE && GET_CODE (x) != CLOBBER)
+ return false;
+ x = XEXP (x, 0);
+ if (!REG_P (x)
+ || (REGNO (x) != FP_NEAREST_REGNUM
+ && REGNO (x) != FP_TRUNCATE_REGNUM
+ && REGNO (x) != FP_ANYFP_REGNUM))
+ return false;
+ }
+ return true;
+})
+
+(define_predicate "set_fp_mode_operand"
+ (ior (match_test "gpr_operand (op, mode)")
+ (and (match_code "const")
+ (match_test "satisfies_constraint_Cfm (op)"))))
+
+(define_predicate "post_modify_address"
+ (match_code "post_modify,post_inc,post_dec"))
+
+(define_predicate "post_modify_operand"
+ (and (match_code "mem")
+ (match_test "post_modify_address (XEXP (op, 0), Pmode)")))
+
+(define_predicate "nonsymbolic_immediate_operand"
+ (ior (match_test "immediate_operand (op, mode)")
+ (match_code "const_vector"))) /* Is this specific enough? */
diff --git a/gcc/config/epiphany/resolve-sw-modes.c b/gcc/config/epiphany/resolve-sw-modes.c
new file mode 100644
index 00000000000..9564d752c4f
--- /dev/null
+++ b/gcc/config/epiphany/resolve-sw-modes.c
@@ -0,0 +1,182 @@
+/* Mode switching cleanup pass for the EPIPHANY cpu.
+ Copyright (C) 2000, 2011 Free Software Foundation, Inc.
+ Contributed by Embecosm on behalf of Adapteva, 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/>. */
+
+#include "config.h"
+#include "system.h"
+#include "coretypes.h"
+#include "machmode.h"
+#include "tm.h"
+#include "hard-reg-set.h"
+#include "tm_p.h"
+#include "vec.h"
+#include "sbitmap.h"
+#include "basic-block.h"
+#include "df.h"
+#include "rtl.h"
+#include "insn-config.h"
+#include "insn-codes.h"
+#include "emit-rtl.h"
+#include "recog.h"
+#include "function.h"
+#include "insn-attr-common.h"
+#include "tree-pass.h"
+
+/* Clean-up after mode switching:
+ Check for mode setting insns that have FP_MODE_ROUND_UNKNOWN.
+ If only one rounding mode is required, select that one.
+ Else we have to choose one to use in this mode setting insn and
+ insert new mode setting insns on the edges where the other mode
+ becomes unambigous. */
+
+static bool
+gate_resolve_sw_modes (void)
+{
+ return optimize;
+}
+
+static unsigned
+resolve_sw_modes (void)
+{
+ basic_block bb;
+ rtx insn, src;
+ VEC (basic_block, heap) *todo;
+ sbitmap pushed;
+ bool need_commit = false;
+ bool finalize_fp_sets = (MACHINE_FUNCTION (cfun)->unknown_mode_sets == 0);
+
+ todo = VEC_alloc (basic_block, heap, last_basic_block);
+ pushed = sbitmap_alloc (last_basic_block);
+ sbitmap_zero (pushed);
+ if (!finalize_fp_sets)
+ {
+ df_note_add_problem ();
+ df_analyze ();
+ }
+ FOR_EACH_BB (bb)
+ FOR_BB_INSNS (bb, insn)
+ {
+ enum attr_fp_mode selected_mode;
+
+ if (!NONJUMP_INSN_P (insn)
+ || recog_memoized (insn) != CODE_FOR_set_fp_mode)
+ continue;
+ src = SET_SRC (XVECEXP (PATTERN (insn), 0, 0));
+ if (finalize_fp_sets)
+ {
+ SET_SRC (XVECEXP (PATTERN (insn), 0, 2)) = copy_rtx (src);
+ if (REG_P (src))
+ df_insn_rescan (insn);
+ continue;
+ }
+ if (REG_P (src)
+ || XINT (XVECEXP (XEXP (src, 0), 0, 0), 0) != FP_MODE_ROUND_UNKNOWN)
+ continue;
+ if (find_regno_note (insn, REG_UNUSED, FP_TRUNCATE_REGNUM))
+ selected_mode = FP_MODE_ROUND_NEAREST;
+ else if (find_regno_note (insn, REG_UNUSED, FP_NEAREST_REGNUM))
+ selected_mode = FP_MODE_ROUND_TRUNC;
+ else
+ {
+ /* We could get more fancy in the selection of the mode by
+ checking the total frequency of the affected edges. */
+ selected_mode = (enum attr_fp_mode) epiphany_normal_fp_rounding;
+
+ VEC_quick_push (basic_block, todo, bb);
+ SET_BIT (pushed, bb->index);
+ }
+ XVECEXP (XEXP (src, 0), 0, 0) = GEN_INT (selected_mode);
+ SET_SRC (XVECEXP (PATTERN (insn), 0, 1)) = copy_rtx (src);
+ SET_SRC (XVECEXP (PATTERN (insn), 0, 2)) = copy_rtx (src);
+ df_insn_rescan (insn);
+ }
+ while (VEC_length (basic_block, todo))
+ {
+ basic_block bb = VEC_pop (basic_block, todo);
+ int selected_reg, jilted_reg;
+ enum attr_fp_mode jilted_mode;
+ edge e;
+ edge_iterator ei;
+
+ SET_BIT (pushed, bb->index);
+ SET_BIT (pushed, bb->index);
+
+ if (epiphany_normal_fp_rounding == FP_MODE_ROUND_NEAREST)
+ {
+ selected_reg = FP_NEAREST_REGNUM;
+ jilted_reg = FP_TRUNCATE_REGNUM;
+ jilted_mode = FP_MODE_ROUND_TRUNC;
+ }
+ else
+ {
+ selected_reg = FP_TRUNCATE_REGNUM;
+ jilted_reg = FP_NEAREST_REGNUM;
+ jilted_mode = FP_MODE_ROUND_NEAREST;
+ }
+
+ FOR_EACH_EDGE (e, ei, bb->succs)
+ {
+ basic_block succ = e->dest;
+ rtx seq;
+
+ if (!REGNO_REG_SET_P (DF_LIVE_IN (succ), jilted_reg))
+ continue;
+ if (REGNO_REG_SET_P (DF_LIVE_IN (succ), selected_reg))
+ {
+ if (TEST_BIT (pushed, succ->index))
+ continue;
+ VEC_quick_push (basic_block, todo, succ);
+ SET_BIT (pushed, bb->index);
+ continue;
+ }
+ start_sequence ();
+ emit_set_fp_mode (EPIPHANY_MSW_ENTITY_ROUND_UNKNOWN,
+ jilted_mode, NULL);
+ seq = get_insns ();
+ end_sequence ();
+ need_commit = true;
+ insert_insn_on_edge (seq, e);
+ }
+ }
+ VEC_free (basic_block, heap, todo);
+ sbitmap_free (pushed);
+ if (need_commit)
+ commit_edge_insertions ();
+ return 0;
+}
+
+struct rtl_opt_pass pass_resolve_sw_modes =
+{
+ {
+ RTL_PASS,
+ "resolve_sw_modes", /* name */
+ gate_resolve_sw_modes, /* gate */
+ resolve_sw_modes, /* execute */
+ NULL, /* sub */
+ NULL, /* next */
+ 0, /* static_pass_number */
+ TV_MODE_SWITCH, /* tv_id */
+ 0, /* properties_required */
+ 0, /* properties_provided */
+ 0, /* properties_destroyed */
+ 0, /* todo_flags_start */
+ TODO_df_finish | TODO_verify_rtl_sharing |
+ 0 /* todo_flags_finish */
+ }
+};
diff --git a/gcc/config/epiphany/t-epiphany b/gcc/config/epiphany/t-epiphany
new file mode 100644
index 00000000000..33db4acef13
--- /dev/null
+++ b/gcc/config/epiphany/t-epiphany
@@ -0,0 +1,32 @@
+# Copyright (C) 1997, 1998, 1999, 2001, 2002, 2003,
+# 2004, 2009, 2010, 2011 Free Software Foundation, Inc.
+# Contributed by Embecosm on behalf of Adapteva, 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/>.
+
+mode-switch-use.o : $(srcdir)/config/epiphany/mode-switch-use.c \
+ $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TM_P_H) $(RTL_H) \
+ $(TREE_PASS_H) $(INSN_ATTR_H) $(EMIT_RTL_H) $(FUNCTION_H) $(RECOG_H) \
+ insn-config.h $(DF_H)
+ $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $<
+
+resolve-sw-modes.o : $(srcdir)/config/epiphany/resolve-sw-modes.c \
+ $(CONFIG_H) $(SYSTEM_H) coretypes.h $(MACHMODE_H) $(TM_H) hard-reg-set.h \
+ $(TM_P_H) $(VEC_H) sbitmap.h $(BASIC_BLOCK_H) $(DF_H) $(RTL_H) \
+ insn-config.h insn-codes.h $(EMIT_RTL_H) $(RECOG_H) $(FUNCTION_H) \
+ insn-attr-common.h $(TREE_PASS_H)
+ $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $<
diff --git a/gcc/config/floatunsidf.c b/gcc/config/floatunsidf.c
deleted file mode 100644
index ff28112502b..00000000000
--- a/gcc/config/floatunsidf.c
+++ /dev/null
@@ -1,15 +0,0 @@
-/* Public domain. */
-typedef int SItype __attribute__ ((mode (SI)));
-typedef unsigned int USItype __attribute__ ((mode (SI)));
-typedef float DFtype __attribute__ ((mode (DF)));
-
-DFtype
-__floatunsidf (USItype u)
-{
- SItype s = (SItype) u;
- DFtype r = (DFtype) s;
- if (s < 0)
- r += (DFtype)2.0 * (DFtype) ((USItype) 1
- << (sizeof (USItype) * __CHAR_BIT__ - 1));
- return r;
-}
diff --git a/gcc/config/floatunsisf.c b/gcc/config/floatunsisf.c
deleted file mode 100644
index 11d4aa78cbe..00000000000
--- a/gcc/config/floatunsisf.c
+++ /dev/null
@@ -1,18 +0,0 @@
-/* Public domain. */
-typedef int SItype __attribute__ ((mode (SI)));
-typedef unsigned int USItype __attribute__ ((mode (SI)));
-typedef float SFtype __attribute__ ((mode (SF)));
-
-SFtype
-__floatunsisf (USItype u)
-{
- SItype s = (SItype) u;
- if (s < 0)
- {
- /* As in expand_float, compute (u & 1) | (u >> 1) to ensure
- correct rounding if a nonzero bit is shifted out. */
- return (SFtype) 2.0 * (SFtype) (SItype) ((u & 1) | (u >> 1));
- }
- else
- return (SFtype) s;
-}
diff --git a/gcc/config/floatunsitf.c b/gcc/config/floatunsitf.c
deleted file mode 100644
index 955d67666c5..00000000000
--- a/gcc/config/floatunsitf.c
+++ /dev/null
@@ -1,15 +0,0 @@
-/* Public domain. */
-typedef int SItype __attribute__ ((mode (SI)));
-typedef unsigned int USItype __attribute__ ((mode (SI)));
-typedef float TFtype __attribute__ ((mode (TF)));
-
-TFtype
-__floatunsitf (USItype u)
-{
- SItype s = (SItype) u;
- TFtype r = (TFtype) s;
- if (s < 0)
- r += (TFtype)2.0 * (TFtype) ((USItype) 1
- << (sizeof (USItype) * __CHAR_BIT__ - 1));
- return r;
-}
diff --git a/gcc/config/floatunsixf.c b/gcc/config/floatunsixf.c
deleted file mode 100644
index 52511688dad..00000000000
--- a/gcc/config/floatunsixf.c
+++ /dev/null
@@ -1,15 +0,0 @@
-/* Public domain. */
-typedef int SItype __attribute__ ((mode (SI)));
-typedef unsigned int USItype __attribute__ ((mode (SI)));
-typedef float XFtype __attribute__ ((mode (XF)));
-
-XFtype
-__floatunsixf (USItype u)
-{
- SItype s = (SItype) u;
- XFtype r = (XFtype) s;
- if (s < 0)
- r += (XFtype)2.0 * (XFtype) ((USItype) 1
- << (sizeof (USItype) * __CHAR_BIT__ - 1));
- return r;
-}
diff --git a/gcc/config/fr30/crti.asm b/gcc/config/fr30/crti.asm
deleted file mode 100644
index 4ce61231bd7..00000000000
--- a/gcc/config/fr30/crti.asm
+++ /dev/null
@@ -1,61 +0,0 @@
-# crti.s for ELF
-
-# Copyright (C) 1992, 1998, 1999, 2008, 2009 Free Software Foundation, Inc.
-# Written By David Vinayak Henkel-Wallace, June 1992
-#
-# This file is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the
-# Free Software Foundation; either version 3, or (at your option) any
-# later version.
-#
-# This file 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/>.
-
-# This file just make a stack frame for the contents of the .fini and
-# .init sections. Users may put any desired instructions in those
-# sections.
-
- .section ".init"
- .global _init
- .type _init,#function
- .align 4
-_init:
- st rp, @-r15
- enter #4
-
- # These nops are here to align the end of this code with a 16 byte
- # boundary. The linker will start inserting code into the .init
- # section at such a boundary.
-
- nop
- nop
- nop
- nop
- nop
- nop
-
-
- .section ".fini"
- .global _fini
- .type _fini,#function
- .align 4
-_fini:
- st rp, @-r15
- enter #4
- nop
- nop
- nop
- nop
- nop
- nop
diff --git a/gcc/config/fr30/crtn.asm b/gcc/config/fr30/crtn.asm
deleted file mode 100644
index ac2712186c3..00000000000
--- a/gcc/config/fr30/crtn.asm
+++ /dev/null
@@ -1,44 +0,0 @@
-# crtn.asm for ELF
-
-# Copyright (C) 1992, 1999, 2008, 2009 Free Software Foundation, Inc.
-# Written By David Vinayak Henkel-Wallace, June 1992
-#
-# This file is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the
-# Free Software Foundation; either version 3, or (at your option) any
-# later version.
-#
-# This file 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/>.
-
-# This file just makes sure that the .fini and .init sections do in
-# fact return. Users may put any desired instructions in those sections.
-# This file is the last thing linked into any executable.
-
- .section ".init"
- .align 4
-
- leave
- ld @r15+,rp
- ret
-
-
- .section ".fini"
- .align 4
-
- leave
- ld @r15+,rp
- ret
-
-# Th-th-th-that is all folks!
diff --git a/gcc/config/fr30/lib1funcs.asm b/gcc/config/fr30/lib1funcs.asm
deleted file mode 100644
index 7c63453123a..00000000000
--- a/gcc/config/fr30/lib1funcs.asm
+++ /dev/null
@@ -1,115 +0,0 @@
-/* libgcc routines for the FR30.
- Copyright (C) 1998, 1999, 2009 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.
-
-This file 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/>. */
-
- .macro FUNC_START name
- .text
- .globl __\name
- .type __\name, @function
-__\name:
- .endm
-
- .macro FUNC_END name
- .size __\name, . - __\name
- .endm
-
- .macro DIV_BODY reg number
- .if \number
- DIV_BODY \reg, "\number - 1"
- div1 \reg
- .endif
- .endm
-
-#ifdef L_udivsi3
-FUNC_START udivsi3
- ;; Perform an unsiged division of r4 / r5 and place the result in r4.
- ;; Does not handle overflow yet...
- mov r4, mdl
- div0u r5
- DIV_BODY r5 32
- mov mdl, r4
- ret
-FUNC_END udivsi3
-#endif /* L_udivsi3 */
-
-#ifdef L_divsi3
-FUNC_START divsi3
- ;; Perform a siged division of r4 / r5 and place the result in r4.
- ;; Does not handle overflow yet...
- mov r4, mdl
- div0s r5
- DIV_BODY r5 32
- div2 r5
- div3
- div4s
- mov mdl, r4
- ret
-FUNC_END divsi3
-#endif /* L_divsi3 */
-
-#ifdef L_umodsi3
-FUNC_START umodsi3
- ;; Perform an unsiged division of r4 / r5 and places the remainder in r4.
- ;; Does not handle overflow yet...
- mov r4, mdl
- div0u r5
- DIV_BODY r5 32
- mov mdh, r4
- ret
-FUNC_END umodsi3
-#endif /* L_umodsi3 */
-
-#ifdef L_modsi3
-FUNC_START modsi3
- ;; Perform a siged division of r4 / r5 and place the remainder in r4.
- ;; Does not handle overflow yet...
- mov r4, mdl
- div0s r5
- DIV_BODY r5 32
- div2 r5
- div3
- div4s
- mov mdh, r4
- ret
-FUNC_END modsi3
-#endif /* L_modsi3 */
-
-#ifdef L_negsi2
-FUNC_START negsi2
- ldi:8 #0, r0
- sub r4, r0
- mov r0, r4
- ret
-FUNC_END negsi2
-#endif /* L_negsi2 */
-
-#ifdef L_one_cmplsi2
-FUNC_START one_cmplsi2
- ldi:8 #0xff, r0
- extsb r0
- eor r0, r4
- ret
-FUNC_END one_cmplsi2
-#endif /* L_one_cmplsi2 */
-
-
diff --git a/gcc/config/fr30/t-fr30 b/gcc/config/fr30/t-fr30
deleted file mode 100644
index fa786d6e50a..00000000000
--- a/gcc/config/fr30/t-fr30
+++ /dev/null
@@ -1,44 +0,0 @@
-# Copyright (C) 1999, 2001, 2007, 2011 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/>.
-
-LIB1ASMSRC = fr30/lib1funcs.asm
-LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3
-
-# Assemble startup files.
-$(T)crti.o: $(srcdir)/config/fr30/crti.asm $(GCC_PASSES)
- $(GCC_FOR_TARGET) -c -o $(T)crti.o -x assembler $(srcdir)/config/fr30/crti.asm
-
-$(T)crtn.o: $(srcdir)/config/fr30/crtn.asm $(GCC_PASSES)
- $(GCC_FOR_TARGET) -c -o $(T)crtn.o -x assembler $(srcdir)/config/fr30/crtn.asm
-
-# If any special flags are necessary when building libgcc2 put them here.
-#
-# TARGET_LIBGCC2_CFLAGS
-
-# Enable the following if multilibs are needed.
-# See gcc/genmultilib, gcc/gcc.texi and gcc/tm.texi for a
-# description of the options and their values.
-#
-# MULTILIB_OPTIONS =
-# MULTILIB_DIRNAMES =
-# MULTILIB_MATCHES =
-# MULTILIB_EXCEPTIONS =
-# MULTILIB_EXTRA_OPTS =
-#
-# LIBGCC = stmp-multilib
-# INSTALL_LIBGCC = install-multilib
diff --git a/gcc/config/frv/cmovd.c b/gcc/config/frv/cmovd.c
deleted file mode 100644
index e46070aac04..00000000000
--- a/gcc/config/frv/cmovd.c
+++ /dev/null
@@ -1,51 +0,0 @@
-/* Move double-word library function.
- Copyright (C) 2000, 2003, 2009 Free Software Foundation, Inc.
- Contributed by Red Hat, 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/>. */
-
-void
-__cmovd (long long *dest, const long long *src, unsigned len)
-{
- unsigned i;
- unsigned num = len >> 3;
- unsigned xlen = len & ~7;
- char *dest_byte = (char *)dest;
- const char *src_byte = (const char *)src;
-
- if (dest_byte < src_byte || dest_byte > src_byte+len)
- {
- for (i = 0; i < num; i++)
- dest[i] = src[i];
-
- while (len > xlen)
- {
- dest_byte[xlen] = src_byte[xlen];
- xlen++;
- }
- }
- else
- {
- while (len-- > 0)
- dest_byte[len] = src_byte[len];
- }
-}
diff --git a/gcc/config/frv/cmovh.c b/gcc/config/frv/cmovh.c
deleted file mode 100644
index 6b0901d95a7..00000000000
--- a/gcc/config/frv/cmovh.c
+++ /dev/null
@@ -1,47 +0,0 @@
-/* Move half-word library function.
- Copyright (C) 2000, 2003, 2009 Free Software Foundation, Inc.
- Contributed by Red Hat, 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/>. */
-
-void
-__cmovh (short *dest, const short *src, unsigned len)
-{
- unsigned i;
- unsigned num = len >> 1;
- char *dest_byte = (char *)dest;
- const char *src_byte = (const char *)src;
-
- if (dest_byte < src_byte || dest_byte > src_byte+len)
- {
- for (i = 0; i < num; i++)
- dest[i] = src[i];
-
- if ((len & 1) != 0)
- dest_byte[len-1] = src_byte[len-1];
- }
- else
- {
- while (len-- > 0)
- dest_byte[len] = src_byte[len];
- }
-}
diff --git a/gcc/config/frv/cmovw.c b/gcc/config/frv/cmovw.c
deleted file mode 100644
index f27db75aaf6..00000000000
--- a/gcc/config/frv/cmovw.c
+++ /dev/null
@@ -1,51 +0,0 @@
-/* Move word library function.
- Copyright (C) 2000, 2003, 2009 Free Software Foundation, Inc.
- Contributed by Red Hat, 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/>. */
-
-void
-__cmovw (int *dest, const int *src, unsigned len)
-{
- unsigned i;
- unsigned num = len >> 2;
- unsigned xlen = len & ~3;
- char *dest_byte = (char *)dest;
- const char *src_byte = (const char *)src;
-
- if (dest_byte < src_byte || dest_byte > src_byte+len)
- {
- for (i = 0; i < num; i++)
- dest[i] = src[i];
-
- while (len > xlen)
- {
- dest_byte[xlen] = src_byte[xlen];
- xlen++;
- }
- }
- else
- {
- while (len-- > 0)
- dest_byte[len] = src_byte[len];
- }
-}
diff --git a/gcc/config/frv/frvbegin.c b/gcc/config/frv/frvbegin.c
deleted file mode 100644
index 23cbf1ecc93..00000000000
--- a/gcc/config/frv/frvbegin.c
+++ /dev/null
@@ -1,157 +0,0 @@
-/* Frv initialization file linked before all user modules
- Copyright (C) 1999, 2000, 2003, 2004, 2009 Free Software Foundation, Inc.
- Contributed by Red Hat, 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/>.
-
- This file was originally taken from the file crtstuff.c in the
- main compiler directory, and simplified. */
-
-#include "defaults.h"
-#include <stddef.h>
-#include "../libgcc/unwind-dw2-fde.h"
-#include "gbl-ctors.h"
-
-/* Declare a pointer to void function type. */
-#define STATIC static
-
-#ifdef __FRV_UNDERSCORE__
-#define UNDERSCORE "_"
-#else
-#define UNDERSCORE ""
-#endif
-
-#define INIT_SECTION_NEG_ONE(SECTION, FLAGS, NAME) \
-__asm__ (".section " SECTION "," FLAGS "\n\t" \
- ".globl " UNDERSCORE NAME "\n\t" \
- ".type " UNDERSCORE NAME ",@object\n\t" \
- ".p2align 2\n" \
- UNDERSCORE NAME ":\n\t" \
- ".word -1\n\t" \
- ".previous")
-
-#define INIT_SECTION(SECTION, FLAGS, NAME) \
-__asm__ (".section " SECTION "," FLAGS "\n\t" \
- ".globl " UNDERSCORE NAME "\n\t" \
- ".type " UNDERSCORE NAME ",@object\n\t" \
- ".p2align 2\n" \
- UNDERSCORE NAME ":\n\t" \
- ".previous")
-
-/* Beginning of .ctor/.dtor sections that provides a list of constructors and
- destructors to run. */
-
-INIT_SECTION_NEG_ONE (".ctors", "\"aw\"", "__CTOR_LIST__");
-INIT_SECTION_NEG_ONE (".dtors", "\"aw\"", "__DTOR_LIST__");
-
-/* Beginning of .eh_frame section that provides all of the exception handling
- tables. */
-
-INIT_SECTION (".eh_frame", "\"aw\"", "__EH_FRAME_BEGIN__");
-
-#if ! __FRV_FDPIC__
-/* In FDPIC, the linker itself generates this. */
-/* Beginning of .rofixup section that provides a list of pointers that we
- need to adjust. */
-
-INIT_SECTION (".rofixup", "\"a\"", "__ROFIXUP_LIST__");
-#endif /* __FRV_FDPIC__ */
-
-extern void __frv_register_eh(void) __attribute__((__constructor__));
-extern void __frv_deregister_eh(void) __attribute__((__destructor__));
-
-extern func_ptr __EH_FRAME_BEGIN__[];
-
-/* Register the exception handling table as the first constructor. */
-void
-__frv_register_eh (void)
-{
- static struct object object;
- if (__register_frame_info)
- __register_frame_info (__EH_FRAME_BEGIN__, &object);
-}
-
-/* Note, do not declare __{,de}register_frame_info weak as it seems
- to interfere with the pic support. */
-
-/* Unregister the exception handling table as a deconstructor. */
-void
-__frv_deregister_eh (void)
-{
- static int completed = 0;
-
- if (completed)
- return;
-
- if (__deregister_frame_info)
- __deregister_frame_info (__EH_FRAME_BEGIN__);
-
- completed = 1;
-}
-
-/* Run the global destructors. */
-void
-__do_global_dtors (void)
-{
- static func_ptr *p = __DTOR_LIST__ + 1;
- while (*p)
- {
- p++;
- (*(p-1)) ();
- }
-}
-
-/* Run the global constructors. */
-void
-__do_global_ctors (void)
-{
- unsigned long nptrs = (unsigned long) __CTOR_LIST__[0];
- unsigned i;
-
- if (nptrs == (unsigned long)-1)
- for (nptrs = 0; __CTOR_LIST__[nptrs + 1] != 0; nptrs++);
-
- for (i = nptrs; i >= 1; i--)
- __CTOR_LIST__[i] ();
-
- atexit (__do_global_dtors);
-}
-
-/* Subroutine called automatically by `main'.
- Compiling a global function named `main'
- produces an automatic call to this function at the beginning.
-
- For many systems, this routine calls __do_global_ctors.
- For systems which support a .init section we use the .init section
- to run __do_global_ctors, so we need not do anything here. */
-
-void
-__main (void)
-{
- /* Support recursive calls to `main': run initializers just once. */
- static int initialized;
- if (! initialized)
- {
- initialized = 1;
- __do_global_ctors ();
- }
-}
diff --git a/gcc/config/frv/frvend.c b/gcc/config/frv/frvend.c
deleted file mode 100644
index 0bb07b56b4a..00000000000
--- a/gcc/config/frv/frvend.c
+++ /dev/null
@@ -1,70 +0,0 @@
-/* Frv initialization file linked after all user modules
- Copyright (C) 1999, 2000, 2003, 2004, 2009 Free Software Foundation, Inc.
- Contributed by Red Hat, 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/>. */
-
-#include "defaults.h"
-#include <stddef.h>
-#include "../libgcc/unwind-dw2-fde.h"
-
-#ifdef __FRV_UNDERSCORE__
-#define UNDERSCORE "_"
-#else
-#define UNDERSCORE ""
-#endif
-
-#define FINI_SECTION_ZERO(SECTION, FLAGS, NAME) \
-__asm__ (".section " SECTION "," FLAGS "\n\t" \
- ".globl " UNDERSCORE NAME "\n\t" \
- ".type " UNDERSCORE NAME ",@object\n\t" \
- ".p2align 2\n" \
- UNDERSCORE NAME ":\n\t" \
- ".word 0\n\t" \
- ".previous")
-
-#define FINI_SECTION(SECTION, FLAGS, NAME) \
-__asm__ (".section " SECTION "," FLAGS "\n\t" \
- ".globl " UNDERSCORE NAME "\n\t" \
- ".type " UNDERSCORE NAME ",@object\n\t" \
- ".p2align 2\n" \
- UNDERSCORE NAME ":\n\t" \
- ".previous")
-
-/* End of .ctor/.dtor sections that provides a list of constructors and
- destructors to run. */
-
-FINI_SECTION_ZERO (".ctors", "\"aw\"", "__CTOR_END__");
-FINI_SECTION_ZERO (".dtors", "\"aw\"", "__DTOR_END__");
-
-/* End of .eh_frame section that provides all of the exception handling
- tables. */
-
-FINI_SECTION_ZERO (".eh_frame", "\"aw\"", "__FRAME_END__");
-
-#if ! __FRV_FDPIC__
-/* In FDPIC, the linker itself generates this. */
-/* End of .rofixup section that provides a list of pointers that we
- need to adjust. */
-
-FINI_SECTION (".rofixup", "\"a\"", "__ROFIXUP_END__");
-#endif /* __FRV_FDPIC__ */
diff --git a/gcc/config/frv/lib1funcs.asm b/gcc/config/frv/lib1funcs.asm
deleted file mode 100644
index d1ffcab6133..00000000000
--- a/gcc/config/frv/lib1funcs.asm
+++ /dev/null
@@ -1,269 +0,0 @@
-/* Library functions.
- Copyright (C) 2000, 2003, 2008, 2009 Free Software Foundation, Inc.
- Contributed by Red Hat, 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/>. */
-
-#include <frv-asm.h>
-
-
-#ifdef L_cmpll
-/* icc0 = __cmpll (long long a, long long b) */
-
- .globl EXT(__cmpll)
- .type EXT(__cmpll),@function
- .text
- .p2align 4
-EXT(__cmpll):
- cmp gr8, gr10, icc0
- ckeq icc0, cc4
- P(ccmp) gr9, gr11, cc4, 1
- ret
-.Lend:
- .size EXT(__cmpll),.Lend-EXT(__cmpll)
-#endif /* L_cmpll */
-
-#ifdef L_cmpf
-/* icc0 = __cmpf (float a, float b) */
-/* Note, because this function returns the result in ICC0, it means it can't
- handle NaNs. */
-
- .globl EXT(__cmpf)
- .type EXT(__cmpf),@function
- .text
- .p2align 4
-EXT(__cmpf):
-#ifdef __FRV_HARD_FLOAT__ /* floating point instructions available */
- movgf gr8, fr0
- P(movgf) gr9, fr1
- setlos #1, gr8
- fcmps fr0, fr1, fcc0
- P(fcklt) fcc0, cc0
- fckeq fcc0, cc1
- csub gr0, gr8, gr8, cc0, 1
- cmov gr0, gr8, cc1, 1
- cmpi gr8, 0, icc0
- ret
-#else /* no floating point instructions available */
- movsg lr, gr4
- addi sp, #-16, sp
- sti gr4, @(sp, 8)
- st fp, @(sp, gr0)
- mov sp, fp
- call EXT(__cmpsf2)
- cmpi gr8, #0, icc0
- ldi @(sp, 8), gr4
- movgs gr4, lr
- ld @(sp,gr0), fp
- addi sp, #16, sp
- ret
-#endif
-.Lend:
- .size EXT(__cmpf),.Lend-EXT(__cmpf)
-#endif
-
-#ifdef L_cmpd
-/* icc0 = __cmpd (double a, double b) */
-/* Note, because this function returns the result in ICC0, it means it can't
- handle NaNs. */
-
- .globl EXT(__cmpd)
- .type EXT(__cmpd),@function
- .text
- .p2align 4
-EXT(__cmpd):
- movsg lr, gr4
- addi sp, #-16, sp
- sti gr4, @(sp, 8)
- st fp, @(sp, gr0)
- mov sp, fp
- call EXT(__cmpdf2)
- cmpi gr8, #0, icc0
- ldi @(sp, 8), gr4
- movgs gr4, lr
- ld @(sp,gr0), fp
- addi sp, #16, sp
- ret
-.Lend:
- .size EXT(__cmpd),.Lend-EXT(__cmpd)
-#endif
-
-#ifdef L_addll
-/* gr8,gr9 = __addll (long long a, long long b) */
-/* Note, gcc will never call this function, but it is present in case an
- ABI program calls it. */
-
- .globl EXT(__addll)
- .type EXT(__addll),@function
- .text
- .p2align
-EXT(__addll):
- addcc gr9, gr11, gr9, icc0
- addx gr8, gr10, gr8, icc0
- ret
-.Lend:
- .size EXT(__addll),.Lend-EXT(__addll)
-#endif
-
-#ifdef L_subll
-/* gr8,gr9 = __subll (long long a, long long b) */
-/* Note, gcc will never call this function, but it is present in case an
- ABI program calls it. */
-
- .globl EXT(__subll)
- .type EXT(__subll),@function
- .text
- .p2align 4
-EXT(__subll):
- subcc gr9, gr11, gr9, icc0
- subx gr8, gr10, gr8, icc0
- ret
-.Lend:
- .size EXT(__subll),.Lend-EXT(__subll)
-#endif
-
-#ifdef L_andll
-/* gr8,gr9 = __andll (long long a, long long b) */
-/* Note, gcc will never call this function, but it is present in case an
- ABI program calls it. */
-
- .globl EXT(__andll)
- .type EXT(__andll),@function
- .text
- .p2align 4
-EXT(__andll):
- P(and) gr9, gr11, gr9
- P2(and) gr8, gr10, gr8
- ret
-.Lend:
- .size EXT(__andll),.Lend-EXT(__andll)
-#endif
-
-#ifdef L_orll
-/* gr8,gr9 = __orll (long long a, long long b) */
-/* Note, gcc will never call this function, but it is present in case an
- ABI program calls it. */
-
- .globl EXT(__orll)
- .type EXT(__orll),@function
- .text
- .p2align 4
-EXT(__orll):
- P(or) gr9, gr11, gr9
- P2(or) gr8, gr10, gr8
- ret
-.Lend:
- .size EXT(__orll),.Lend-EXT(__orll)
-#endif
-
-#ifdef L_xorll
-/* gr8,gr9 = __xorll (long long a, long long b) */
-/* Note, gcc will never call this function, but it is present in case an
- ABI program calls it. */
-
- .globl EXT(__xorll)
- .type EXT(__xorll),@function
- .text
- .p2align 4
-EXT(__xorll):
- P(xor) gr9, gr11, gr9
- P2(xor) gr8, gr10, gr8
- ret
-.Lend:
- .size EXT(__xorll),.Lend-EXT(__xorll)
-#endif
-
-#ifdef L_notll
-/* gr8,gr9 = __notll (long long a) */
-/* Note, gcc will never call this function, but it is present in case an
- ABI program calls it. */
-
- .globl EXT(__notll)
- .type EXT(__notll),@function
- .text
- .p2align 4
-EXT(__notll):
- P(not) gr9, gr9
- P2(not) gr8, gr8
- ret
-.Lend:
- .size EXT(__notll),.Lend-EXT(__notll)
-#endif
-
-#ifdef L_cmov
-/* (void) __cmov (char *dest, const char *src, size_t len) */
-/*
- * void __cmov (char *dest, const char *src, size_t len)
- * {
- * size_t i;
- *
- * if (dest < src || dest > src+len)
- * {
- * for (i = 0; i < len; i++)
- * dest[i] = src[i];
- * }
- * else
- * {
- * while (len-- > 0)
- * dest[len] = src[len];
- * }
- * }
- */
-
- .globl EXT(__cmov)
- .type EXT(__cmov),@function
- .text
- .p2align 4
-EXT(__cmov):
- P(cmp) gr8, gr9, icc0
- add gr9, gr10, gr4
- P(cmp) gr8, gr4, icc1
- bc icc0, 0, .Lfwd
- bls icc1, 0, .Lback
-.Lfwd:
- /* move bytes in a forward direction */
- P(setlos) #0, gr5
- cmp gr0, gr10, icc0
- P(subi) gr9, #1, gr9
- P2(subi) gr8, #1, gr8
- bnc icc0, 0, .Lret
-.Lfloop:
- /* forward byte move loop */
- addi gr5, #1, gr5
- P(ldsb) @(gr9, gr5), gr4
- cmp gr5, gr10, icc0
- P(stb) gr4, @(gr8, gr5)
- bc icc0, 0, .Lfloop
- ret
-.Lbloop:
- /* backward byte move loop body */
- ldsb @(gr9,gr10),gr4
- stb gr4,@(gr8,gr10)
-.Lback:
- P(cmpi) gr10, #0, icc0
- addi gr10, #-1, gr10
- bne icc0, 0, .Lbloop
-.Lret:
- ret
-.Lend:
- .size EXT(__cmov),.Lend-EXT(__cmov)
-#endif
diff --git a/gcc/config/frv/libgcc-frv.ver b/gcc/config/frv/libgcc-frv.ver
deleted file mode 100644
index 6e27b4f9b85..00000000000
--- a/gcc/config/frv/libgcc-frv.ver
+++ /dev/null
@@ -1,73 +0,0 @@
-# Copyright (C) 2004 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_3.4 {
- # frv abi symbol names
- __ftod
- __ftoi
- __ftoui
- __dtoi
- __ftoui
- __dtoui
- __ftoll
- __dtoll
- __ftoull
- __dtoull
- __itof
- __lltof
- __dtof
- __itod
- __lltof
- __lltod
- __addd
- __subd
- __muld
- __divd
- __addf
- __subf
- __mulf
- __divf
- __sllll
- __srlll
- __srall
- __addll
- __subll
- __mulll
- __umulll
- __divll
- __udivll
- __modll
- __umodll
- __cmpll
- __cmpf
- __cmpd
- __andll
- __orll
- __xorll
- __notll
- __cmov
- __cmovd
- __cmovh
- __cmovw
- __modi
- __uitod
- __uitof
- __ulltod
- __ulltof
- __umodi
-}
diff --git a/gcc/config/frv/modi.c b/gcc/config/frv/modi.c
deleted file mode 100644
index d5a91fc0f55..00000000000
--- a/gcc/config/frv/modi.c
+++ /dev/null
@@ -1,4 +0,0 @@
-int __modi (int a, int b)
-{
- return a % b;
-}
diff --git a/gcc/config/frv/t-frv b/gcc/config/frv/t-frv
index 395a679747a..c5c7bdc237c 100644
--- a/gcc/config/frv/t-frv
+++ b/gcc/config/frv/t-frv
@@ -16,66 +16,6 @@
# along with GCC; see the file COPYING3. If not see
# <http://www.gnu.org/licenses/>.
-# Name of assembly file containing libgcc1 functions.
-# This entry must be present, but it can be empty if the target does
-# not need any assembler functions to support its code generation.
-#
-# Alternatively if assembler functions *are* needed then define the
-# entries below:
-CROSS_LIBGCC1 = libgcc1-asm.a
-LIB1ASMSRC = frv/lib1funcs.asm
-LIB1ASMFUNCS = _cmpll _cmpf _cmpd _addll _subll _andll _orll _xorll _notll _cmov
-LIB2FUNCS_EXTRA = cmovh.c cmovw.c cmovd.c modi.c umodi.c uitof.c uitod.c ulltof.c ulltod.c
-
-# If any special flags are necessary when building libgcc2 put them here.
-TARGET_LIBGCC2_CFLAGS =
-
-cmovh.c: $(srcdir)/config/frv/cmovh.c
- $(LN_S) $(srcdir)/config/frv/cmovh.c .
-
-cmovw.c: $(srcdir)/config/frv/cmovw.c
- $(LN_S) $(srcdir)/config/frv/cmovw.c .
-
-cmovd.c: $(srcdir)/config/frv/cmovd.c
- $(LN_S) $(srcdir)/config/frv/cmovd.c .
-
-modi.c: $(srcdir)/config/frv/modi.c
- $(LN_S) $(srcdir)/config/frv/modi.c .
-
-umodi.c: $(srcdir)/config/frv/umodi.c
- $(LN_S) $(srcdir)/config/frv/umodi.c .
-
-uitof.c: $(srcdir)/config/frv/uitof.c
- $(LN_S) $(srcdir)/config/frv/uitof.c .
-
-uitod.c: $(srcdir)/config/frv/uitod.c
- $(LN_S) $(srcdir)/config/frv/uitod.c .
-
-ulltof.c: $(srcdir)/config/frv/ulltof.c
- $(LN_S) $(srcdir)/config/frv/ulltof.c .
-
-ulltod.c: $(srcdir)/config/frv/ulltod.c
- $(LN_S) $(srcdir)/config/frv/ulltod.c .
-
-# Build frvbegin.o and frvend.o
-EXTRA_MULTILIB_PARTS=frvbegin.o frvend.o
-
-# Compile two additional files that are linked with every program
-# linked using GCC on systems using COFF or ELF, for the sake of C++
-# constructors.
-
-FRVSTUFF_CFLAGS = $(TARGET_LIBGCC2_CFLAGS)
-
-$(T)frvbegin$(objext): $(srcdir)/config/frv/frvbegin.c $(GCC_PASSES) \
- $(CONFIG_H) defaults.h $(srcdir)/../libgcc/unwind-dw2-fde.h gbl-ctors.h
- $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) $(FRVSTUFF_CFLAGS) \
- -c $(srcdir)/config/frv/frvbegin.c -o $(T)frvbegin$(objext)
-
-$(T)frvend$(objext): $(srcdir)/config/frv/frvend.c $(GCC_PASSES) \
- $(CONFIG_H) defaults.h $(srcdir)/../libgcc/unwind-dw2-fde.h gbl-ctors.h
- $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) $(FRVSTUFF_CFLAGS) \
- -c $(srcdir)/config/frv/frvend.c -o $(T)frvend$(objext)
-
# Enable the following if multilibs are needed.
# See gcc/genmultilib, gcc/gcc.texi and gcc/tm.texi for a
# description of the options and their values.
@@ -93,7 +33,4 @@ MULTILIB_MATCHES = mcpu?simple=mcpu?fr300 \
mcpu?fr400=mcpu?fr405 mcpu?fr400=mcpu?fr450
MULTILIB_EXCEPTIONS = mcpu=frv/mno-pack* mcpu=simple/mno-pack*
-LIBGCC = stmp-multilib
-INSTALL_LIBGCC = install-multilib
-
EXTRA_HEADERS = $(srcdir)/config/frv/frv-asm.h
diff --git a/gcc/config/frv/t-linux b/gcc/config/frv/t-linux
index 5b094518a1d..4f18e4baf9a 100644
--- a/gcc/config/frv/t-linux
+++ b/gcc/config/frv/t-linux
@@ -1,4 +1,4 @@
-# Copyright (C) 2004, 2007 Free Software Foundation, Inc.
+# Copyright (C) 2004, 2007, 2011 Free Software Foundation, Inc.
#
# This file is part of GCC.
#
@@ -22,12 +22,3 @@ MULTILIB_DIRNAMES=
MULTILIB_MATCHES=
MULTILIB_EXCEPTIONS=
MULTILIB_EXTRA_OPTS=
-
-# We don't use frvbegin.o or frvend.o.
-EXTRA_MULTILIB_PARTS =
-
-CRTSTUFF_T_CFLAGS = -fPIC
-TARGET_LIBGCC2_CFLAGS = -fPIC
-
-SHLIB_MAPFILES = $$(libgcc_objdir)/libgcc-std.ver \
- $(srcdir)/config/frv/libgcc-frv.ver
diff --git a/gcc/config/frv/uitod.c b/gcc/config/frv/uitod.c
deleted file mode 100644
index 14290ab6b04..00000000000
--- a/gcc/config/frv/uitod.c
+++ /dev/null
@@ -1,4 +0,0 @@
-double __uitod (unsigned int a)
-{
- return a;
-}
diff --git a/gcc/config/frv/uitof.c b/gcc/config/frv/uitof.c
deleted file mode 100644
index 059bc7c7417..00000000000
--- a/gcc/config/frv/uitof.c
+++ /dev/null
@@ -1,4 +0,0 @@
-float __uitof (unsigned int a)
-{
- return a;
-}
diff --git a/gcc/config/frv/ulltod.c b/gcc/config/frv/ulltod.c
deleted file mode 100644
index e6bee12081f..00000000000
--- a/gcc/config/frv/ulltod.c
+++ /dev/null
@@ -1,4 +0,0 @@
-double __ulltod (unsigned long long a)
-{
- return a;
-}
diff --git a/gcc/config/frv/ulltof.c b/gcc/config/frv/ulltof.c
deleted file mode 100644
index 29cdfd4d2a1..00000000000
--- a/gcc/config/frv/ulltof.c
+++ /dev/null
@@ -1,4 +0,0 @@
-float __ulltof (unsigned long long a)
-{
- return a;
-}
diff --git a/gcc/config/frv/umodi.c b/gcc/config/frv/umodi.c
deleted file mode 100644
index 4ffe5ad8132..00000000000
--- a/gcc/config/frv/umodi.c
+++ /dev/null
@@ -1,4 +0,0 @@
-unsigned int __umodi (unsigned int a, unsigned int b)
-{
- return a % b;
-}
diff --git a/gcc/config/h8300/clzhi2.c b/gcc/config/h8300/clzhi2.c
deleted file mode 100644
index 54db7b9c56b..00000000000
--- a/gcc/config/h8300/clzhi2.c
+++ /dev/null
@@ -1,35 +0,0 @@
-/* The implementation of __clzhi2.
- Copyright (C) 2003, 2009 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/>. */
-
-int __clzhi2 (unsigned short x);
-
-int
-__clzhi2 (unsigned short x)
-{
- int i;
- for (i = 0; i < 16; i++)
- if (x & ((unsigned short) 1 << (15 - i)))
- break;
- return i;
-}
diff --git a/gcc/config/h8300/crti.asm b/gcc/config/h8300/crti.asm
deleted file mode 100644
index 7ee3ae74503..00000000000
--- a/gcc/config/h8300/crti.asm
+++ /dev/null
@@ -1,63 +0,0 @@
-/* Copyright (C) 2001, 2002, 2009 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/>. */
-
-/* The code in sections .init and .fini is supposed to be a single
- regular function. The function in .init is called directly from
- start in crt0.asm. The function in .fini is atexit()ed in crt0.asm
- too.
-
- crti.asm contributes the prologue of a function to these sections,
- and crtn.asm comes up the epilogue. STARTFILE_SPEC should list
- crti.o before any other object files that might add code to .init
- or .fini sections, and ENDFILE_SPEC should list crtn.o after any
- such object files. */
-
-#ifdef __H8300H__
-#ifdef __NORMAL_MODE__
- .h8300hn
-#else
- .h8300h
-#endif
-#endif
-
-#ifdef __H8300S__
-#ifdef __NORMAL_MODE__
- .h8300sn
-#else
- .h8300s
-#endif
-#endif
-#ifdef __H8300SX__
-#ifdef __NORMAL_MODE__
- .h8300sxn
-#else
- .h8300sx
-#endif
-#endif
-
- .section .init, "ax", @progbits
- .global __init
-__init:
- .section .fini, "ax", @progbits
- .global __fini
-__fini:
diff --git a/gcc/config/h8300/crtn.asm b/gcc/config/h8300/crtn.asm
deleted file mode 100644
index 173fde13b5b..00000000000
--- a/gcc/config/h8300/crtn.asm
+++ /dev/null
@@ -1,53 +0,0 @@
-/* Copyright (C) 2001, 2009 Free Software Foundation, Inc.
- This file was adapted from glibc sources.
-
-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/>. */
-
-/* See an explanation about .init and .fini in crti.asm. */
-
-#ifdef __H8300H__
-#ifdef __NORMAL_MODE__
- .h8300hn
-#else
- .h8300h
-#endif
-#endif
-
-#ifdef __H8300S__
-#ifdef __NORMAL_MODE__
- .h8300sn
-#else
- .h8300s
-#endif
-#endif
-#ifdef __H8300SX__
-#ifdef __NORMAL_MODE__
- .h8300sxn
-#else
- .h8300sx
-#endif
-#endif
- .section .init, "ax", @progbits
- rts
-
- .section .fini, "ax", @progbits
- rts
diff --git a/gcc/config/h8300/ctzhi2.c b/gcc/config/h8300/ctzhi2.c
deleted file mode 100644
index ba6f8e9086f..00000000000
--- a/gcc/config/h8300/ctzhi2.c
+++ /dev/null
@@ -1,35 +0,0 @@
-/* The implementation of __ctzhi2.
- Copyright (C) 2003, 2009 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/>. */
-
-int __ctzhi2 (unsigned short x);
-
-int
-__ctzhi2 (unsigned short x)
-{
- int i;
- for (i = 0; i < 16; i++)
- if (x & ((unsigned short) 1 << i))
- break;
- return i;
-}
diff --git a/gcc/config/h8300/fixunssfsi.c b/gcc/config/h8300/fixunssfsi.c
deleted file mode 100644
index 2fe62b7a1a8..00000000000
--- a/gcc/config/h8300/fixunssfsi.c
+++ /dev/null
@@ -1,41 +0,0 @@
-/* More subroutines needed by GCC output code on some machines. */
-/* Compile this one with gcc. */
-/* Copyright (C) 1989, 1992, 2001, 2002, 2003, 2004, 2009
- 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/>. */
-
-/* The libgcc2.c implementation gets confused by our type setup and creates
- a directly recursive call, so we do our own implementation. For
- the H8/300, that's in lib1funcs.asm, for H8/300H and H8S, it's here. */
-
-#ifndef __H8300__
-long __fixunssfsi (float a);
-
-long
-__fixunssfsi (float a)
-{
- if (a >= (float) 32768L)
- return (long) (a - 32768L) + 32768L;
- return (long) a;
-}
-#endif
diff --git a/gcc/config/h8300/lib1funcs.asm b/gcc/config/h8300/lib1funcs.asm
deleted file mode 100644
index 1b75b73269d..00000000000
--- a/gcc/config/h8300/lib1funcs.asm
+++ /dev/null
@@ -1,838 +0,0 @@
-;; libgcc routines for the Renesas H8/300 CPU.
-;; Contributed by Steve Chamberlain <sac@cygnus.com>
-;; Optimizations by Toshiyasu Morita <toshiyasu.morita@renesas.com>
-
-/* Copyright (C) 1994, 2000, 2001, 2002, 2003, 2004, 2009
- Free Software Foundation, Inc.
-
-This file is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3, or (at your option) any
-later version.
-
-This file 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/>. */
-
-/* Assembler register definitions. */
-
-#define A0 r0
-#define A0L r0l
-#define A0H r0h
-
-#define A1 r1
-#define A1L r1l
-#define A1H r1h
-
-#define A2 r2
-#define A2L r2l
-#define A2H r2h
-
-#define A3 r3
-#define A3L r3l
-#define A3H r3h
-
-#define S0 r4
-#define S0L r4l
-#define S0H r4h
-
-#define S1 r5
-#define S1L r5l
-#define S1H r5h
-
-#define S2 r6
-#define S2L r6l
-#define S2H r6h
-
-#ifdef __H8300__
-#define PUSHP push
-#define POPP pop
-
-#define A0P r0
-#define A1P r1
-#define A2P r2
-#define A3P r3
-#define S0P r4
-#define S1P r5
-#define S2P r6
-#endif
-
-#if defined (__H8300H__) || defined (__H8300S__) || defined (__H8300SX__)
-#define PUSHP push.l
-#define POPP pop.l
-
-#define A0P er0
-#define A1P er1
-#define A2P er2
-#define A3P er3
-#define S0P er4
-#define S1P er5
-#define S2P er6
-
-#define A0E e0
-#define A1E e1
-#define A2E e2
-#define A3E e3
-#endif
-
-#ifdef __H8300H__
-#ifdef __NORMAL_MODE__
- .h8300hn
-#else
- .h8300h
-#endif
-#endif
-
-#ifdef __H8300S__
-#ifdef __NORMAL_MODE__
- .h8300sn
-#else
- .h8300s
-#endif
-#endif
-#ifdef __H8300SX__
-#ifdef __NORMAL_MODE__
- .h8300sxn
-#else
- .h8300sx
-#endif
-#endif
-
-#ifdef L_cmpsi2
-#ifdef __H8300__
- .section .text
- .align 2
- .global ___cmpsi2
-___cmpsi2:
- cmp.w A0,A2
- bne .L2
- cmp.w A1,A3
- bne .L4
- mov.w #1,A0
- rts
-.L2:
- bgt .L5
-.L3:
- mov.w #2,A0
- rts
-.L4:
- bls .L3
-.L5:
- sub.w A0,A0
- rts
- .end
-#endif
-#endif /* L_cmpsi2 */
-
-#ifdef L_ucmpsi2
-#ifdef __H8300__
- .section .text
- .align 2
- .global ___ucmpsi2
-___ucmpsi2:
- cmp.w A0,A2
- bne .L2
- cmp.w A1,A3
- bne .L4
- mov.w #1,A0
- rts
-.L2:
- bhi .L5
-.L3:
- mov.w #2,A0
- rts
-.L4:
- bls .L3
-.L5:
- sub.w A0,A0
- rts
- .end
-#endif
-#endif /* L_ucmpsi2 */
-
-#ifdef L_divhi3
-
-;; HImode divides for the H8/300.
-;; We bunch all of this into one object file since there are several
-;; "supporting routines".
-
-; general purpose normalize routine
-;
-; divisor in A0
-; dividend in A1
-; turns both into +ve numbers, and leaves what the answer sign
-; should be in A2L
-
-#ifdef __H8300__
- .section .text
- .align 2
-divnorm:
- or A0H,A0H ; is divisor > 0
- stc ccr,A2L
- bge _lab1
- not A0H ; no - then make it +ve
- not A0L
- adds #1,A0
-_lab1: or A1H,A1H ; look at dividend
- bge _lab2
- not A1H ; it is -ve, make it positive
- not A1L
- adds #1,A1
- xor #0x8,A2L; and toggle sign of result
-_lab2: rts
-;; Basically the same, except that the sign of the divisor determines
-;; the sign.
-modnorm:
- or A0H,A0H ; is divisor > 0
- stc ccr,A2L
- bge _lab7
- not A0H ; no - then make it +ve
- not A0L
- adds #1,A0
-_lab7: or A1H,A1H ; look at dividend
- bge _lab8
- not A1H ; it is -ve, make it positive
- not A1L
- adds #1,A1
-_lab8: rts
-
-; A0=A0/A1 signed
-
- .global ___divhi3
-___divhi3:
- bsr divnorm
- bsr ___udivhi3
-negans: btst #3,A2L ; should answer be negative ?
- beq _lab4
- not A0H ; yes, so make it so
- not A0L
- adds #1,A0
-_lab4: rts
-
-; A0=A0%A1 signed
-
- .global ___modhi3
-___modhi3:
- bsr modnorm
- bsr ___udivhi3
- mov A3,A0
- bra negans
-
-; A0=A0%A1 unsigned
-
- .global ___umodhi3
-___umodhi3:
- bsr ___udivhi3
- mov A3,A0
- rts
-
-; A0=A0/A1 unsigned
-; A3=A0%A1 unsigned
-; A2H trashed
-; D high 8 bits of denom
-; d low 8 bits of denom
-; N high 8 bits of num
-; n low 8 bits of num
-; M high 8 bits of mod
-; m low 8 bits of mod
-; Q high 8 bits of quot
-; q low 8 bits of quot
-; P preserve
-
-; The H8/300 only has a 16/8 bit divide, so we look at the incoming and
-; see how to partition up the expression.
-
- .global ___udivhi3
-___udivhi3:
- ; A0 A1 A2 A3
- ; Nn Dd P
- sub.w A3,A3 ; Nn Dd xP 00
- or A1H,A1H
- bne divlongway
- or A0H,A0H
- beq _lab6
-
-; we know that D == 0 and N is != 0
- mov.b A0H,A3L ; Nn Dd xP 0N
- divxu A1L,A3 ; MQ
- mov.b A3L,A0H ; Q
-; dealt with N, do n
-_lab6: mov.b A0L,A3L ; n
- divxu A1L,A3 ; mq
- mov.b A3L,A0L ; Qq
- mov.b A3H,A3L ; m
- mov.b #0x0,A3H ; Qq 0m
- rts
-
-; D != 0 - which means the denominator is
-; loop around to get the result.
-
-divlongway:
- mov.b A0H,A3L ; Nn Dd xP 0N
- mov.b #0x0,A0H ; high byte of answer has to be zero
- mov.b #0x8,A2H ; 8
-div8: add.b A0L,A0L ; n*=2
- rotxl A3L ; Make remainder bigger
- rotxl A3H
- sub.w A1,A3 ; Q-=N
- bhs setbit ; set a bit ?
- add.w A1,A3 ; no : too far , Q+=N
-
- dec A2H
- bne div8 ; next bit
- rts
-
-setbit: inc A0L ; do insert bit
- dec A2H
- bne div8 ; next bit
- rts
-
-#endif /* __H8300__ */
-#endif /* L_divhi3 */
-
-#ifdef L_divsi3
-
-;; 4 byte integer divides for the H8/300.
-;;
-;; We have one routine which does all the work and lots of
-;; little ones which prepare the args and massage the sign.
-;; We bunch all of this into one object file since there are several
-;; "supporting routines".
-
- .section .text
- .align 2
-
-; Put abs SIs into r0/r1 and r2/r3, and leave a 1 in r6l with sign of rest.
-; This function is here to keep branch displacements small.
-
-#ifdef __H8300__
-
-divnorm:
- mov.b A0H,A0H ; is the numerator -ve
- stc ccr,S2L ; keep the sign in bit 3 of S2L
- bge postive
-
- ; negate arg
- not A0H
- not A1H
- not A0L
- not A1L
-
- add #1,A1L
- addx #0,A1H
- addx #0,A0L
- addx #0,A0H
-postive:
- mov.b A2H,A2H ; is the denominator -ve
- bge postive2
- not A2L
- not A2H
- not A3L
- not A3H
- add.b #1,A3L
- addx #0,A3H
- addx #0,A2L
- addx #0,A2H
- xor.b #0x08,S2L ; toggle the result sign
-postive2:
- rts
-
-;; Basically the same, except that the sign of the divisor determines
-;; the sign.
-modnorm:
- mov.b A0H,A0H ; is the numerator -ve
- stc ccr,S2L ; keep the sign in bit 3 of S2L
- bge mpostive
-
- ; negate arg
- not A0H
- not A1H
- not A0L
- not A1L
-
- add #1,A1L
- addx #0,A1H
- addx #0,A0L
- addx #0,A0H
-mpostive:
- mov.b A2H,A2H ; is the denominator -ve
- bge mpostive2
- not A2L
- not A2H
- not A3L
- not A3H
- add.b #1,A3L
- addx #0,A3H
- addx #0,A2L
- addx #0,A2H
-mpostive2:
- rts
-
-#else /* __H8300H__ */
-
-divnorm:
- mov.l A0P,A0P ; is the numerator -ve
- stc ccr,S2L ; keep the sign in bit 3 of S2L
- bge postive
-
- neg.l A0P ; negate arg
-
-postive:
- mov.l A1P,A1P ; is the denominator -ve
- bge postive2
-
- neg.l A1P ; negate arg
- xor.b #0x08,S2L ; toggle the result sign
-
-postive2:
- rts
-
-;; Basically the same, except that the sign of the divisor determines
-;; the sign.
-modnorm:
- mov.l A0P,A0P ; is the numerator -ve
- stc ccr,S2L ; keep the sign in bit 3 of S2L
- bge mpostive
-
- neg.l A0P ; negate arg
-
-mpostive:
- mov.l A1P,A1P ; is the denominator -ve
- bge mpostive2
-
- neg.l A1P ; negate arg
-
-mpostive2:
- rts
-
-#endif
-
-; numerator in A0/A1
-; denominator in A2/A3
- .global ___modsi3
-___modsi3:
-#ifdef __H8300__
- PUSHP S2P
- PUSHP S0P
- PUSHP S1P
- bsr modnorm
- bsr divmodsi4
- mov S0,A0
- mov S1,A1
- bra exitdiv
-#else
- PUSHP S2P
- bsr modnorm
- bsr ___udivsi3
- mov.l er3,er0
- bra exitdiv
-#endif
-
- ;; H8/300H and H8S version of ___udivsi3 is defined later in
- ;; the file.
-#ifdef __H8300__
- .global ___udivsi3
-___udivsi3:
- PUSHP S2P
- PUSHP S0P
- PUSHP S1P
- bsr divmodsi4
- bra reti
-#endif
-
- .global ___umodsi3
-___umodsi3:
-#ifdef __H8300__
- PUSHP S2P
- PUSHP S0P
- PUSHP S1P
- bsr divmodsi4
- mov S0,A0
- mov S1,A1
- bra reti
-#else
- bsr ___udivsi3
- mov.l er3,er0
- rts
-#endif
-
- .global ___divsi3
-___divsi3:
-#ifdef __H8300__
- PUSHP S2P
- PUSHP S0P
- PUSHP S1P
- jsr divnorm
- jsr divmodsi4
-#else
- PUSHP S2P
- jsr divnorm
- bsr ___udivsi3
-#endif
-
- ; examine what the sign should be
-exitdiv:
- btst #3,S2L
- beq reti
-
- ; should be -ve
-#ifdef __H8300__
- not A0H
- not A1H
- not A0L
- not A1L
-
- add #1,A1L
- addx #0,A1H
- addx #0,A0L
- addx #0,A0H
-#else /* __H8300H__ */
- neg.l A0P
-#endif
-
-reti:
-#ifdef __H8300__
- POPP S1P
- POPP S0P
-#endif
- POPP S2P
- rts
-
- ; takes A0/A1 numerator (A0P for H8/300H)
- ; A2/A3 denominator (A1P for H8/300H)
- ; returns A0/A1 quotient (A0P for H8/300H)
- ; S0/S1 remainder (S0P for H8/300H)
- ; trashes S2H
-
-#ifdef __H8300__
-
-divmodsi4:
- sub.w S0,S0 ; zero play area
- mov.w S0,S1
- mov.b A2H,S2H
- or A2L,S2H
- or A3H,S2H
- bne DenHighNonZero
- mov.b A0H,A0H
- bne NumByte0Zero
- mov.b A0L,A0L
- bne NumByte1Zero
- mov.b A1H,A1H
- bne NumByte2Zero
- bra NumByte3Zero
-NumByte0Zero:
- mov.b A0H,S1L
- divxu A3L,S1
- mov.b S1L,A0H
-NumByte1Zero:
- mov.b A0L,S1L
- divxu A3L,S1
- mov.b S1L,A0L
-NumByte2Zero:
- mov.b A1H,S1L
- divxu A3L,S1
- mov.b S1L,A1H
-NumByte3Zero:
- mov.b A1L,S1L
- divxu A3L,S1
- mov.b S1L,A1L
-
- mov.b S1H,S1L
- mov.b #0x0,S1H
- rts
-
-; have to do the divide by shift and test
-DenHighNonZero:
- mov.b A0H,S1L
- mov.b A0L,A0H
- mov.b A1H,A0L
- mov.b A1L,A1H
-
- mov.b #0,A1L
- mov.b #24,S2H ; only do 24 iterations
-
-nextbit:
- add.w A1,A1 ; double the answer guess
- rotxl A0L
- rotxl A0H
-
- rotxl S1L ; double remainder
- rotxl S1H
- rotxl S0L
- rotxl S0H
- sub.w A3,S1 ; does it all fit
- subx A2L,S0L
- subx A2H,S0H
- bhs setone
-
- add.w A3,S1 ; no, restore mistake
- addx A2L,S0L
- addx A2H,S0H
-
- dec S2H
- bne nextbit
- rts
-
-setone:
- inc A1L
- dec S2H
- bne nextbit
- rts
-
-#else /* __H8300H__ */
-
- ;; This function also computes the remainder and stores it in er3.
- .global ___udivsi3
-___udivsi3:
- mov.w A1E,A1E ; denominator top word 0?
- bne DenHighNonZero
-
- ; do it the easy way, see page 107 in manual
- mov.w A0E,A2
- extu.l A2P
- divxu.w A1,A2P
- mov.w A2E,A0E
- divxu.w A1,A0P
- mov.w A0E,A3
- mov.w A2,A0E
- extu.l A3P
- rts
-
- ; er0 = er0 / er1
- ; er3 = er0 % er1
- ; trashes er1 er2
- ; expects er1 >= 2^16
-DenHighNonZero:
- mov.l er0,er3
- mov.l er1,er2
-#ifdef __H8300H__
-divmod_L21:
- shlr.l er0
- shlr.l er2 ; make divisor < 2^16
- mov.w e2,e2
- bne divmod_L21
-#else
- shlr.l #2,er2 ; make divisor < 2^16
- mov.w e2,e2
- beq divmod_L22A
-divmod_L21:
- shlr.l #2,er0
-divmod_L22:
- shlr.l #2,er2 ; make divisor < 2^16
- mov.w e2,e2
- bne divmod_L21
-divmod_L22A:
- rotxl.w r2
- bcs divmod_L23
- shlr.l er0
- bra divmod_L24
-divmod_L23:
- rotxr.w r2
- shlr.l #2,er0
-divmod_L24:
-#endif
- ;; At this point,
- ;; er0 contains shifted dividend
- ;; er1 contains divisor
- ;; er2 contains shifted divisor
- ;; er3 contains dividend, later remainder
- divxu.w r2,er0 ; r0 now contains the approximate quotient (AQ)
- extu.l er0
- beq divmod_L25
- subs #1,er0 ; er0 = AQ - 1
- mov.w e1,r2
- mulxu.w r0,er2 ; er2 = upper (AQ - 1) * divisor
- sub.w r2,e3 ; dividend - 65536 * er2
- mov.w r1,r2
- mulxu.w r0,er2 ; compute er3 = remainder (tentative)
- sub.l er2,er3 ; er3 = dividend - (AQ - 1) * divisor
-divmod_L25:
- cmp.l er1,er3 ; is divisor < remainder?
- blo divmod_L26
- adds #1,er0
- sub.l er1,er3 ; correct the remainder
-divmod_L26:
- rts
-
-#endif
-#endif /* L_divsi3 */
-
-#ifdef L_mulhi3
-
-;; HImode multiply.
-; The H8/300 only has an 8*8->16 multiply.
-; The answer is the same as:
-;
-; product = (srca.l * srcb.l) + ((srca.h * srcb.l) + (srcb.h * srca.l)) * 256
-; (we can ignore A1.h * A0.h cause that will all off the top)
-; A0 in
-; A1 in
-; A0 answer
-
-#ifdef __H8300__
- .section .text
- .align 2
- .global ___mulhi3
-___mulhi3:
- mov.b A1L,A2L ; A2l gets srcb.l
- mulxu A0L,A2 ; A2 gets first sub product
-
- mov.b A0H,A3L ; prepare for
- mulxu A1L,A3 ; second sub product
-
- add.b A3L,A2H ; sum first two terms
-
- mov.b A1H,A3L ; third sub product
- mulxu A0L,A3
-
- add.b A3L,A2H ; almost there
- mov.w A2,A0 ; that is
- rts
-
-#endif
-#endif /* L_mulhi3 */
-
-#ifdef L_mulsi3
-
-;; SImode multiply.
-;;
-;; I think that shift and add may be sufficient for this. Using the
-;; supplied 8x8->16 would need 10 ops of 14 cycles each + overhead. This way
-;; the inner loop uses maybe 20 cycles + overhead, but terminates
-;; quickly on small args.
-;;
-;; A0/A1 src_a
-;; A2/A3 src_b
-;;
-;; while (a)
-;; {
-;; if (a & 1)
-;; r += b;
-;; a >>= 1;
-;; b <<= 1;
-;; }
-
- .section .text
- .align 2
-
-#ifdef __H8300__
-
- .global ___mulsi3
-___mulsi3:
- PUSHP S0P
- PUSHP S1P
-
- sub.w S0,S0
- sub.w S1,S1
-
- ; while (a)
-_top: mov.w A0,A0
- bne _more
- mov.w A1,A1
- beq _done
-_more: ; if (a & 1)
- bld #0,A1L
- bcc _nobit
- ; r += b
- add.w A3,S1
- addx A2L,S0L
- addx A2H,S0H
-_nobit:
- ; a >>= 1
- shlr A0H
- rotxr A0L
- rotxr A1H
- rotxr A1L
-
- ; b <<= 1
- add.w A3,A3
- addx A2L,A2L
- addx A2H,A2H
- bra _top
-
-_done:
- mov.w S0,A0
- mov.w S1,A1
- POPP S1P
- POPP S0P
- rts
-
-#else /* __H8300H__ */
-
-;
-; mulsi3 for H8/300H - based on Renesas SH implementation
-;
-; by Toshiyasu Morita
-;
-; Old code:
-;
-; 16b * 16b = 372 states (worst case)
-; 32b * 32b = 724 states (worst case)
-;
-; New code:
-;
-; 16b * 16b = 48 states
-; 16b * 32b = 72 states
-; 32b * 32b = 92 states
-;
-
- .global ___mulsi3
-___mulsi3:
- mov.w r1,r2 ; ( 2 states) b * d
- mulxu r0,er2 ; (22 states)
-
- mov.w e0,r3 ; ( 2 states) a * d
- beq L_skip1 ; ( 4 states)
- mulxu r1,er3 ; (22 states)
- add.w r3,e2 ; ( 2 states)
-
-L_skip1:
- mov.w e1,r3 ; ( 2 states) c * b
- beq L_skip2 ; ( 4 states)
- mulxu r0,er3 ; (22 states)
- add.w r3,e2 ; ( 2 states)
-
-L_skip2:
- mov.l er2,er0 ; ( 2 states)
- rts ; (10 states)
-
-#endif
-#endif /* L_mulsi3 */
-#ifdef L_fixunssfsi_asm
-/* For the h8300 we use asm to save some bytes, to
- allow more programs to fit into the tiny address
- space. For the H8/300H and H8S, the C version is good enough. */
-#ifdef __H8300__
-/* We still treat NANs different than libgcc2.c, but then, the
- behavior is undefined anyways. */
- .global ___fixunssfsi
-___fixunssfsi:
- cmp.b #0x4f,r0h
- bge Large_num
- jmp @___fixsfsi
-Large_num:
- bhi L_huge_num
- xor.b #0x80,A0L
- bmi L_shift8
-L_huge_num:
- mov.w #65535,A0
- mov.w A0,A1
- rts
-L_shift8:
- mov.b A0L,A0H
- mov.b A1H,A0L
- mov.b A1L,A1H
- mov.b #0,A1L
- rts
-#endif
-#endif /* L_fixunssfsi_asm */
diff --git a/gcc/config/h8300/parityhi2.c b/gcc/config/h8300/parityhi2.c
deleted file mode 100644
index d58cb89b5c7..00000000000
--- a/gcc/config/h8300/parityhi2.c
+++ /dev/null
@@ -1,36 +0,0 @@
-/* The implementation of __parityhi2.
- Copyright (C) 2003, 2009 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/>. */
-
-int __parityhi2 (unsigned short x);
-
-int
-__parityhi2 (unsigned short x)
-{
- int i;
- int count = 0;
- for (i = 0; i < 16; i++)
- if (x & ((unsigned short) 1 << i))
- count++;
- return count & 1;
-}
diff --git a/gcc/config/h8300/popcounthi2.c b/gcc/config/h8300/popcounthi2.c
deleted file mode 100644
index 47be193b38d..00000000000
--- a/gcc/config/h8300/popcounthi2.c
+++ /dev/null
@@ -1,36 +0,0 @@
-/* The implementation of __popcounthi2.
- Copyright (C) 2003, 2009 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/>. */
-
-int __popcounthi2 (unsigned short x);
-
-int
-__popcounthi2 (unsigned short x)
-{
- int i;
- int count = 0;
- for (i = 0; i < 16; i++)
- if (x & ((unsigned short) 1 << i))
- count++;
- return count;
-}
diff --git a/gcc/config/h8300/t-elf b/gcc/config/h8300/t-elf
deleted file mode 100644
index c1f1dac32c7..00000000000
--- a/gcc/config/h8300/t-elf
+++ /dev/null
@@ -1,6 +0,0 @@
-EXTRA_MULTILIB_PARTS= crti.o crtn.o crtbegin.o crtend.o
-
-$(T)crti.o: $(srcdir)/config/h8300/crti.asm $(GCC_PASSES)
- $(GCC_FOR_TARGET) $(MULTILIB_CFLAGS) -c -o $(T)crti.o -x assembler-with-cpp $(srcdir)/config/h8300/crti.asm
-$(T)crtn.o: $(srcdir)/config/h8300/crtn.asm $(GCC_PASSES)
- $(GCC_FOR_TARGET) $(MULTILIB_CFLAGS) -c -o $(T)crtn.o -x assembler-with-cpp $(srcdir)/config/h8300/crtn.asm
diff --git a/gcc/config/h8300/t-h8300 b/gcc/config/h8300/t-h8300
index 616849007b4..e29cd2d335c 100644
--- a/gcc/config/h8300/t-h8300
+++ b/gcc/config/h8300/t-h8300
@@ -17,27 +17,10 @@
# along with GCC; see the file COPYING3. If not see
# <http://www.gnu.org/licenses/>.
-LIB1ASMSRC = h8300/lib1funcs.asm
-LIB1ASMFUNCS = _cmpsi2 _ucmpsi2 _divhi3 _divsi3 _mulhi3 _mulsi3 \
- _fixunssfsi_asm
-
-LIB2FUNCS_EXTRA = \
- $(srcdir)/config/h8300/clzhi2.c \
- $(srcdir)/config/h8300/ctzhi2.c \
- $(srcdir)/config/h8300/parityhi2.c \
- $(srcdir)/config/h8300/popcounthi2.c \
- $(srcdir)/config/h8300/fixunssfsi.c
-
-# We do not have DF type, so fake out the libgcc2 compilation.
-TARGET_LIBGCC2_CFLAGS = -DDF=SF
-
MULTILIB_OPTIONS = mh/ms/msx mn mint32
MULTILIB_DIRNAMES = h8300h h8300s h8sx normal int32
MULTILIB_EXCEPTIONS = mint32 mn mn/mint32
-LIBGCC = stmp-multilib
-INSTALL_LIBGCC = install-multilib
-
s-config s-conditions s-flags s-codes s-constants s-emit s-recog \
s-opinit s-extract s-peep s-attr s-attrtab s-output: \
$(srcdir)/config/h8300/mova.md
diff --git a/gcc/config/i386/avx2intrin.h b/gcc/config/i386/avx2intrin.h
index 3c8f3600d68..12ed05fe029 100644
--- a/gcc/config/i386/avx2intrin.h
+++ b/gcc/config/i386/avx2intrin.h
@@ -1252,7 +1252,7 @@ __attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
_mm256_i32gather_pd (double const *base, __m128i index, const int scale)
{
__v4df src = _mm256_setzero_pd ();
- __v4df mask = _mm256_set1_pd((double)(long long int) -1);
+ __v4df mask = _mm256_cmp_pd (src, src, _CMP_EQ_OQ);
return (__m256d) __builtin_ia32_gathersiv4df (src,
base,
@@ -1304,7 +1304,7 @@ __attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
_mm256_i64gather_pd (double const *base, __m256i index, const int scale)
{
__v4df src = _mm256_setzero_pd ();
- __v4df mask = _mm256_set1_pd((double)(long long int) -1);
+ __v4df mask = _mm256_cmp_pd (src, src, _CMP_EQ_OQ);
return (__m256d) __builtin_ia32_gatherdiv4df (src,
base,
@@ -1356,7 +1356,7 @@ __attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
_mm256_i32gather_ps (float const *base, __m256i index, const int scale)
{
__v8sf src = _mm256_setzero_ps ();
- __v8sf mask = _mm256_set1_ps((float)(int) -1);
+ __v8sf mask = _mm256_cmp_ps (src, src, _CMP_EQ_OQ);
return (__m256) __builtin_ia32_gathersiv8sf (src,
base,
diff --git a/gcc/config/i386/cygming-crtbegin.c b/gcc/config/i386/cygming-crtbegin.c
deleted file mode 100644
index fc36cce257d..00000000000
--- a/gcc/config/i386/cygming-crtbegin.c
+++ /dev/null
@@ -1,135 +0,0 @@
-/* crtbegin object for windows32 targets.
- Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc.
-
- Contributed by Danny Smith <dannysmith@users.sourceforge.net>
-
-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/>. */
-
-/* Target machine header files require this define. */
-#define IN_LIBGCC2
-
-#include "auto-host.h"
-#include "tconfig.h"
-#include "tsystem.h"
-#include "coretypes.h"
-#include "tm.h"
-#include "unwind-dw2-fde.h"
-
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
-
-#ifndef LIBGCC_SONAME
-#define LIBGCC_SONAME "libgcc_s.dll"
-#endif
-
-#ifndef LIBGCJ_SONAME
-#define LIBGCJ_SONAME "libgcj_s.dll"
-#endif
-
-
-/* Make the declarations weak. This is critical for
- _Jv_RegisterClasses because it lives in libgcj.a */
-extern void __register_frame_info (const void *, struct object *)
- TARGET_ATTRIBUTE_WEAK;
-extern void *__deregister_frame_info (const void *)
- TARGET_ATTRIBUTE_WEAK;
-extern void _Jv_RegisterClasses (const void *) TARGET_ATTRIBUTE_WEAK;
-
-#if defined(HAVE_LD_RO_RW_SECTION_MIXING)
-# define EH_FRAME_SECTION_CONST const
-#else
-# define EH_FRAME_SECTION_CONST
-#endif
-
-/* Stick a label at the beginning of the frame unwind info so we can
- register/deregister it with the exception handling library code. */
-#if DWARF2_UNWIND_INFO
-static EH_FRAME_SECTION_CONST char __EH_FRAME_BEGIN__[]
- __attribute__((used, section(EH_FRAME_SECTION_NAME), aligned(4)))
- = { };
-
-static struct object obj;
-#endif
-
-#if TARGET_USE_JCR_SECTION
-static void *__JCR_LIST__[]
- __attribute__ ((used, section(JCR_SECTION_NAME), aligned(4)))
- = { };
-#endif
-
-/* Pull in references from libgcc.a(unwind-dw2-fde.o) in the
- startfile. These are referenced by a ctor and dtor in crtend.o. */
-extern void __gcc_register_frame (void);
-extern void __gcc_deregister_frame (void);
-
-void
-__gcc_register_frame (void)
-{
-#if DWARF2_UNWIND_INFO
-/* Weak undefined symbols won't be pulled in from dlls; hence
- we first test if the dll is already loaded and, if so,
- get the symbol's address at run-time. If the dll is not loaded,
- fallback to weak linkage to static archive. */
-
- void (*register_frame_fn) (const void *, struct object *);
- HANDLE h = GetModuleHandle (LIBGCC_SONAME);
- if (h)
- register_frame_fn = (void (*) (const void *, struct object *))
- GetProcAddress (h, "__register_frame_info");
- else
- register_frame_fn = __register_frame_info;
- if (register_frame_fn)
- register_frame_fn (__EH_FRAME_BEGIN__, &obj);
-#endif
-
-#if TARGET_USE_JCR_SECTION
- if (__JCR_LIST__[0])
- {
- void (*register_class_fn) (const void *);
- HANDLE h = GetModuleHandle (LIBGCJ_SONAME);
- if (h)
- register_class_fn = (void (*) (const void *))
- GetProcAddress (h, "_Jv_RegisterClasses");
- else
- register_class_fn = _Jv_RegisterClasses;
-
- if (register_class_fn)
- register_class_fn (__JCR_LIST__);
- }
-#endif
-}
-
-void
-__gcc_deregister_frame (void)
-{
-#if DWARF2_UNWIND_INFO
- void * (*deregister_frame_fn) (const void *);
- HANDLE h = GetModuleHandle (LIBGCC_SONAME);
- if (h)
- deregister_frame_fn = (void* (*) (const void *))
- GetProcAddress (h, "__deregister_frame_info");
- else
- deregister_frame_fn = __deregister_frame_info;
- if (deregister_frame_fn)
- deregister_frame_fn (__EH_FRAME_BEGIN__);
-#endif
-}
diff --git a/gcc/config/i386/cygming-crtend.c b/gcc/config/i386/cygming-crtend.c
deleted file mode 100644
index 8545420b271..00000000000
--- a/gcc/config/i386/cygming-crtend.c
+++ /dev/null
@@ -1,88 +0,0 @@
-/* crtend object for windows32 targets.
- Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
-
- Contributed by Danny Smith <dannysmith@users.sourceforge.net>
-
-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/>. */
-
-/* Target machine header files require this define. */
-#define IN_LIBGCC2
-
-/* auto-host.h is needed by cygming.h for HAVE_GAS_WEAK and here
- for HAVE_LD_RO_RW_SECTION_MIXING. */
-#include "auto-host.h"
-#include "tconfig.h"
-#include "tsystem.h"
-#include "coretypes.h"
-#include "tm.h"
-#include "unwind-dw2-fde.h"
-
-#if defined(HAVE_LD_RO_RW_SECTION_MIXING)
-# define EH_FRAME_SECTION_CONST const
-#else
-# define EH_FRAME_SECTION_CONST
-#endif
-
-#if DWARF2_UNWIND_INFO
-/* Terminate the frame unwind info section with a 0 as a sentinel;
- this would be the 'length' field in a real FDE. */
-
-static EH_FRAME_SECTION_CONST int __FRAME_END__[]
- __attribute__ ((used, section(EH_FRAME_SECTION_NAME),
- aligned(4)))
- = { 0 };
-#endif
-
-#if TARGET_USE_JCR_SECTION
-/* Null terminate the .jcr section array. */
-static void *__JCR_END__[1]
- __attribute__ ((used, section(JCR_SECTION_NAME),
- aligned(sizeof(void *))))
- = { 0 };
-#endif
-
-extern void __gcc_register_frame (void);
-extern void __gcc_deregister_frame (void);
-
-static void register_frame_ctor (void) __attribute__ ((constructor (0)));
-
-static void
-register_frame_ctor (void)
-{
- __gcc_register_frame ();
-#if DEFAULT_USE_CXA_ATEXIT
- /* If we use the __cxa_atexit method to register C++ dtors
- at object construction, also use atexit to register eh frame
- info cleanup. */
- atexit (__gcc_deregister_frame);
-#endif
-}
-
-#if !DEFAULT_USE_CXA_ATEXIT
-static void deregister_frame_dtor (void) __attribute__ ((destructor (0)));
-
-static void
-deregister_frame_dtor (void)
-{
- __gcc_deregister_frame ();
-}
-#endif
diff --git a/gcc/config/i386/cygwin.asm b/gcc/config/i386/cygwin.asm
deleted file mode 100644
index 8f9c486850e..00000000000
--- a/gcc/config/i386/cygwin.asm
+++ /dev/null
@@ -1,188 +0,0 @@
-/* stuff needed for libgcc on win32.
- *
- * Copyright (C) 1996, 1998, 2001, 2003, 2008, 2009, 2010
- * Free Software Foundation, Inc.
- * Written By Steve Chamberlain
- *
- * This file is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 3, or (at your option) any
- * later version.
- *
- * This file is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * Under Section 7 of GPL version 3, you are granted additional
- * permissions described in the GCC Runtime Library Exception, version
- * 3.1, as published by the Free Software Foundation.
- *
- * You should have received a copy of the GNU General Public License and
- * a copy of the GCC Runtime Library Exception along with this program;
- * see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
- * <http://www.gnu.org/licenses/>.
- */
-
-#include "auto-host.h"
-
-#ifdef HAVE_GAS_CFI_SECTIONS_DIRECTIVE
- .cfi_sections .debug_frame
-# define cfi_startproc() .cfi_startproc
-# define cfi_endproc() .cfi_endproc
-# define cfi_adjust_cfa_offset(X) .cfi_adjust_cfa_offset X
-# define cfi_def_cfa_register(X) .cfi_def_cfa_register X
-# define cfi_register(D,S) .cfi_register D, S
-# ifdef _WIN64
-# define cfi_push(X) .cfi_adjust_cfa_offset 8; .cfi_rel_offset X, 0
-# define cfi_pop(X) .cfi_adjust_cfa_offset -8; .cfi_restore X
-# else
-# define cfi_push(X) .cfi_adjust_cfa_offset 4; .cfi_rel_offset X, 0
-# define cfi_pop(X) .cfi_adjust_cfa_offset -4; .cfi_restore X
-# endif
-#else
-# define cfi_startproc()
-# define cfi_endproc()
-# define cfi_adjust_cfa_offset(X)
-# define cfi_def_cfa_register(X)
-# define cfi_register(D,S)
-# define cfi_push(X)
-# define cfi_pop(X)
-#endif /* HAVE_GAS_CFI_SECTIONS_DIRECTIVE */
-
-#ifdef L_chkstk
-/* Function prologue calls __chkstk to probe the stack when allocating more
- than CHECK_STACK_LIMIT bytes in one go. Touching the stack at 4K
- increments is necessary to ensure that the guard pages used
- by the OS virtual memory manger are allocated in correct sequence. */
-
- .global ___chkstk
- .global __alloca
-#ifdef _WIN64
-/* __alloca is a normal function call, which uses %rcx as the argument. */
- cfi_startproc()
-__alloca:
- movq %rcx, %rax
- /* FALLTHRU */
-
-/* ___chkstk is a *special* function call, which uses %rax as the argument.
- We avoid clobbering the 4 integer argument registers, %rcx, %rdx,
- %r8 and %r9, which leaves us with %rax, %r10, and %r11 to use. */
- .align 4
-___chkstk:
- popq %r11 /* pop return address */
- cfi_adjust_cfa_offset(-8) /* indicate return address in r11 */
- cfi_register(%rip, %r11)
- movq %rsp, %r10
- cmpq $0x1000, %rax /* > 4k ?*/
- jb 2f
-
-1: subq $0x1000, %r10 /* yes, move pointer down 4k*/
- orl $0x0, (%r10) /* probe there */
- subq $0x1000, %rax /* decrement count */
- cmpq $0x1000, %rax
- ja 1b /* and do it again */
-
-2: subq %rax, %r10
- movq %rsp, %rax /* hold CFA until return */
- cfi_def_cfa_register(%rax)
- orl $0x0, (%r10) /* less than 4k, just peek here */
- movq %r10, %rsp /* decrement stack */
-
- /* Push the return value back. Doing this instead of just
- jumping to %r11 preserves the cached call-return stack
- used by most modern processors. */
- pushq %r11
- ret
- cfi_endproc()
-#else
- cfi_startproc()
-___chkstk:
-__alloca:
- pushl %ecx /* save temp */
- cfi_push(%eax)
- leal 8(%esp), %ecx /* point past return addr */
- cmpl $0x1000, %eax /* > 4k ?*/
- jb 2f
-
-1: subl $0x1000, %ecx /* yes, move pointer down 4k*/
- orl $0x0, (%ecx) /* probe there */
- subl $0x1000, %eax /* decrement count */
- cmpl $0x1000, %eax
- ja 1b /* and do it again */
-
-2: subl %eax, %ecx
- orl $0x0, (%ecx) /* less than 4k, just peek here */
- movl %esp, %eax /* save current stack pointer */
- cfi_def_cfa_register(%eax)
- movl %ecx, %esp /* decrement stack */
- movl (%eax), %ecx /* recover saved temp */
-
- /* Copy the return register. Doing this instead of just jumping to
- the address preserves the cached call-return stack used by most
- modern processors. */
- pushl 4(%eax)
- ret
- cfi_endproc()
-#endif /* _WIN64 */
-#endif /* L_chkstk */
-
-#ifdef L_chkstk_ms
-/* ___chkstk_ms is a *special* function call, which uses %rax as the argument.
- We avoid clobbering any registers. Unlike ___chkstk, it just probes the
- stack and does no stack allocation. */
- .global ___chkstk_ms
-#ifdef _WIN64
- cfi_startproc()
-___chkstk_ms:
- pushq %rcx /* save temps */
- cfi_push(%rcx)
- pushq %rax
- cfi_push(%rax)
- cmpq $0x1000, %rax /* > 4k ?*/
- leaq 24(%rsp), %rcx /* point past return addr */
- jb 2f
-
-1: subq $0x1000, %rcx /* yes, move pointer down 4k */
- orq $0x0, (%rcx) /* probe there */
- subq $0x1000, %rax /* decrement count */
- cmpq $0x1000, %rax
- ja 1b /* and do it again */
-
-2: subq %rax, %rcx
- orq $0x0, (%rcx) /* less than 4k, just peek here */
-
- popq %rax
- cfi_pop(%rax)
- popq %rcx
- cfi_pop(%rcx)
- ret
- cfi_endproc()
-#else
- cfi_startproc()
-___chkstk_ms:
- pushl %ecx /* save temp */
- cfi_push(%ecx)
- pushl %eax
- cfi_push(%eax)
- cmpl $0x1000, %eax /* > 4k ?*/
- leal 12(%esp), %ecx /* point past return addr */
- jb 2f
-
-1: subl $0x1000, %ecx /* yes, move pointer down 4k*/
- orl $0x0, (%ecx) /* probe there */
- subl $0x1000, %eax /* decrement count */
- cmpl $0x1000, %eax
- ja 1b /* and do it again */
-
-2: subl %eax, %ecx
- orl $0x0, (%ecx) /* less than 4k, just peek here */
-
- popl %eax
- cfi_pop(%eax)
- popl %ecx
- cfi_pop(%ecx)
- ret
- cfi_endproc()
-#endif /* _WIN64 */
-#endif /* L_chkstk_ms */
diff --git a/gcc/config/i386/cygwin.h b/gcc/config/i386/cygwin.h
index cf17e1e1d89..d84c5c3aed8 100644
--- a/gcc/config/i386/cygwin.h
+++ b/gcc/config/i386/cygwin.h
@@ -136,5 +136,5 @@ along with GCC; see the file COPYING3. If not see
#define LIBGCC_SONAME "cyggcc_s" LIBGCC_EH_EXTN "-1.dll"
/* We should find a way to not have to update this manually. */
-#define LIBGCJ_SONAME "cyggcj" /*LIBGCC_EH_EXTN*/ "-12.dll"
+#define LIBGCJ_SONAME "cyggcj" /*LIBGCC_EH_EXTN*/ "-13.dll"
diff --git a/gcc/config/i386/darwin-libgcc.10.4.ver b/gcc/config/i386/darwin-libgcc.10.4.ver
deleted file mode 100644
index 67f5e239ca1..00000000000
--- a/gcc/config/i386/darwin-libgcc.10.4.ver
+++ /dev/null
@@ -1,98 +0,0 @@
-# Copyright (C) 2005 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/>.
-__Unwind_Backtrace
-__Unwind_DeleteException
-__Unwind_FindEnclosingFunction
-__Unwind_Find_FDE
-__Unwind_ForcedUnwind
-__Unwind_GetCFA
-__Unwind_GetDataRelBase
-__Unwind_GetGR
-__Unwind_GetIP
-__Unwind_GetLanguageSpecificData
-__Unwind_GetRegionStart
-__Unwind_GetTextRelBase
-__Unwind_RaiseException
-__Unwind_Resume
-__Unwind_Resume_or_Rethrow
-__Unwind_SetGR
-__Unwind_SetIP
-___absvdi2
-___absvsi2
-___addvdi3
-___addvsi3
-___ashldi3
-___ashrdi3
-___clear_cache
-___clzdi2
-___clzsi2
-___cmpdi2
-___ctzdi2
-___ctzsi2
-___deregister_frame
-___deregister_frame_info
-___deregister_frame_info_bases
-___divdc3
-___divdi3
-___divsc3
-___divxc3
-___enable_execute_stack
-___ffsdi2
-___fixdfdi
-___fixsfdi
-___fixunsdfdi
-___fixunsdfsi
-___fixunssfdi
-___fixunssfsi
-___fixunsxfdi
-___fixunsxfsi
-___fixxfdi
-___floatdidf
-___floatdisf
-___floatdixf
-___gcc_personality_v0
-___lshrdi3
-___moddi3
-___muldc3
-___muldi3
-___mulsc3
-___mulvdi3
-___mulvsi3
-___mulxc3
-___negdi2
-___negvdi2
-___negvsi2
-___paritydi2
-___paritysi2
-___popcountdi2
-___popcountsi2
-___powidf2
-___powisf2
-___powixf2
-___register_frame
-___register_frame_info
-___register_frame_info_bases
-___register_frame_info_table
-___register_frame_info_table_bases
-___register_frame_table
-___subvdi3
-___subvsi3
-___ucmpdi2
-___udivdi3
-___udivmoddi4
-___umoddi3
diff --git a/gcc/config/i386/darwin-libgcc.10.5.ver b/gcc/config/i386/darwin-libgcc.10.5.ver
deleted file mode 100644
index eeec9fbfcdf..00000000000
--- a/gcc/config/i386/darwin-libgcc.10.5.ver
+++ /dev/null
@@ -1,102 +0,0 @@
-# Copyright (C) 2005, 2006 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/>.
-__Unwind_Backtrace
-__Unwind_DeleteException
-__Unwind_FindEnclosingFunction
-__Unwind_Find_FDE
-__Unwind_ForcedUnwind
-__Unwind_GetCFA
-__Unwind_GetDataRelBase
-__Unwind_GetGR
-__Unwind_GetIP
-__Unwind_GetIPInfo
-__Unwind_GetLanguageSpecificData
-__Unwind_GetRegionStart
-__Unwind_GetTextRelBase
-__Unwind_RaiseException
-__Unwind_Resume
-__Unwind_Resume_or_Rethrow
-__Unwind_SetGR
-__Unwind_SetIP
-___absvdi2
-___absvsi2
-___addvdi3
-___addvsi3
-___ashldi3
-___ashrdi3
-___clear_cache
-___clzdi2
-___clzsi2
-___cmpdi2
-___ctzdi2
-___ctzsi2
-___deregister_frame
-___deregister_frame_info
-___deregister_frame_info_bases
-___divdc3
-___divdi3
-___divsc3
-___divxc3
-___enable_execute_stack
-___ffsdi2
-___fixdfdi
-___fixsfdi
-___fixunsdfdi
-___fixunsdfsi
-___fixunssfdi
-___fixunssfsi
-___fixunsxfdi
-___fixunsxfsi
-___fixxfdi
-___floatdidf
-___floatdisf
-___floatdixf
-___floatundidf
-___floatundisf
-___floatundixf
-___gcc_personality_v0
-___lshrdi3
-___moddi3
-___muldc3
-___muldi3
-___mulsc3
-___mulvdi3
-___mulvsi3
-___mulxc3
-___negdi2
-___negvdi2
-___negvsi2
-___paritydi2
-___paritysi2
-___popcountdi2
-___popcountsi2
-___powidf2
-___powisf2
-___powixf2
-___register_frame
-___register_frame_info
-___register_frame_info_bases
-___register_frame_info_table
-___register_frame_info_table_bases
-___register_frame_table
-___subvdi3
-___subvsi3
-___ucmpdi2
-___udivdi3
-___udivmoddi4
-___umoddi3
diff --git a/gcc/config/i386/f16cintrin.h b/gcc/config/i386/f16cintrin.h
new file mode 100644
index 00000000000..ac827ca0e12
--- /dev/null
+++ b/gcc/config/i386/f16cintrin.h
@@ -0,0 +1,92 @@
+/* Copyright (C) 2011 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 _X86INTRIN_H_INCLUDED && !defined _IMMINTRIN_H_INCLUDED
+# error "Never use <f16intrin.h> directly; include <x86intrin.h> or <immintrin.h> instead."
+#endif
+
+#ifndef __F16C__
+# error "F16C instruction set not enabled"
+#else
+
+#ifndef _F16CINTRIN_H_INCLUDED
+#define _F16CINTRIN_H_INCLUDED
+
+extern __inline float __attribute__((__gnu_inline__, __always_inline__, __artificial__))
+_cvtsh_ss (unsigned short __S)
+{
+ __v8hi __H = __extension__ (__v8hi){ __S, 0, 0, 0, 0, 0, 0, 0 };
+ __v4sf __A = __builtin_ia32_vcvtph2ps (__H);
+ return __builtin_ia32_vec_ext_v4sf (__A, 0);
+}
+
+extern __inline __m128 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
+_mm_cvtph_ps (__m128i __A)
+{
+ return (__m128) __builtin_ia32_vcvtph2ps ((__v8hi) __A);
+}
+
+extern __inline __m256 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
+_mm256_cvtph_ps (__m128i __A)
+{
+ return (__m256) __builtin_ia32_vcvtph2ps256 ((__v8hi) __A);
+}
+
+#ifdef __OPTIMIZE__
+extern __inline unsigned short __attribute__((__gnu_inline__, __always_inline__, __artificial__))
+_cvtss_sh (float __F, const int __I)
+{
+ __v4sf __A = __extension__ (__v4sf){ __F, 0, 0, 0 };
+ __v8hi __H = __builtin_ia32_vcvtps2ph (__A, __I);
+ return (unsigned short) __builtin_ia32_vec_ext_v8hi (__H, 0);
+}
+
+extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
+_mm_cvtps_ph (__m128 __A, const int __I)
+{
+ return (__m128i) __builtin_ia32_vcvtps2ph ((__v4sf) __A, __I);
+}
+
+extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
+_mm256_cvtps_ph (__m256 __A, const int __I)
+{
+ return (__m128i) __builtin_ia32_vcvtps2ph256 ((__v8sf) __A, __I);
+}
+#else
+#define _cvtss_sh(__F, __I) \
+ (__extension__ \
+ ({ \
+ __v4sf __A = __extension__ (__v4sf){ __F, 0, 0, 0 }; \
+ __v8hi __H = __builtin_ia32_vcvtps2ph (__A, __I); \
+ (unsigned short) __builtin_ia32_vec_ext_v8hi (__H, 0); \
+ }))
+
+#define _mm_cvtps_ph(A, I) \
+ ((__m128i) __builtin_ia32_vcvtps2ph ((__v4sf)(__m128) A, (int) (I)))
+
+#define _mm256_cvtps_ph(A, I) \
+ ((__m128i) __builtin_ia32_vcvtps2ph256 ((__v8sf)(__m256) A, (int) (I)))
+#endif /* __OPTIMIZE */
+
+#endif /* _F16CINTRIN_H_INCLUDED */
+#endif /* __F16C__ */
diff --git a/gcc/config/i386/gthr-win32.c b/gcc/config/i386/gthr-win32.c
deleted file mode 100644
index 46ecb0d4b26..00000000000
--- a/gcc/config/i386/gthr-win32.c
+++ /dev/null
@@ -1,260 +0,0 @@
-/* Implementation of W32-specific threads compatibility routines for
- libgcc2. */
-
-/* Copyright (C) 1999, 2000, 2002, 2004, 2008, 2009 Free Software Foundation, Inc.
- Contributed by Mumit Khan <khan@xraylith.wisc.edu>.
- Modified and moved to separate file by Danny Smith
- <dannysmith@users.sourceforge.net>.
-
-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/>. */
-
-#include <windows.h>
-#ifndef __GTHREAD_HIDE_WIN32API
-# define __GTHREAD_HIDE_WIN32API 1
-#endif
-#undef __GTHREAD_I486_INLINE_LOCK_PRIMITIVES
-#define __GTHREAD_I486_INLINE_LOCK_PRIMITIVES
-#include <gthr-win32.h>
-
-/* Windows32 threads specific definitions. The windows32 threading model
- does not map well into pthread-inspired gcc's threading model, and so
- there are caveats one needs to be aware of.
-
- 1. The destructor supplied to __gthread_key_create is ignored for
- generic x86-win32 ports. This will certainly cause memory leaks
- due to unreclaimed eh contexts (sizeof (eh_context) is at least
- 24 bytes for x86 currently).
-
- This memory leak may be significant for long-running applications
- that make heavy use of C++ EH.
-
- However, Mingw runtime (version 0.3 or newer) provides a mechanism
- to emulate pthreads key dtors; the runtime provides a special DLL,
- linked in if -mthreads option is specified, that runs the dtors in
- the reverse order of registration when each thread exits. If
- -mthreads option is not given, a stub is linked in instead of the
- DLL, which results in memory leak. Other x86-win32 ports can use
- the same technique of course to avoid the leak.
-
- 2. The error codes returned are non-POSIX like, and cast into ints.
- This may cause incorrect error return due to truncation values on
- hw where sizeof (DWORD) > sizeof (int).
-
- 3. We are currently using a special mutex instead of the Critical
- Sections, since Win9x does not support TryEnterCriticalSection
- (while NT does).
-
- The basic framework should work well enough. In the long term, GCC
- needs to use Structured Exception Handling on Windows32. */
-
-int
-__gthr_win32_once (__gthread_once_t *once, void (*func) (void))
-{
- if (once == NULL || func == NULL)
- return EINVAL;
-
- if (! once->done)
- {
- if (InterlockedIncrement (&(once->started)) == 0)
- {
- (*func) ();
- once->done = TRUE;
- }
- else
- {
- /* Another thread is currently executing the code, so wait for it
- to finish; yield the CPU in the meantime. If performance
- does become an issue, the solution is to use an Event that
- we wait on here (and set above), but that implies a place to
- create the event before this routine is called. */
- while (! once->done)
- Sleep (0);
- }
- }
- return 0;
-}
-
-/* Windows32 thread local keys don't support destructors; this leads to
- leaks, especially in threaded applications making extensive use of
- C++ EH. Mingw uses a thread-support DLL to work-around this problem. */
-
-int
-__gthr_win32_key_create (__gthread_key_t *key,
- void (*dtor) (void *) __attribute__((unused)))
-{
- int status = 0;
- DWORD tls_index = TlsAlloc ();
- if (tls_index != 0xFFFFFFFF)
- {
- *key = tls_index;
-#ifdef MINGW32_SUPPORTS_MT_EH
- /* Mingw runtime will run the dtors in reverse order for each thread
- when the thread exits. */
- status = __mingwthr_key_dtor (*key, dtor);
-#endif
- }
- else
- status = (int) GetLastError ();
- return status;
-}
-
-int
-__gthr_win32_key_delete (__gthread_key_t key)
-{
- return (TlsFree (key) != 0) ? 0 : (int) GetLastError ();
-}
-
-void *
-__gthr_win32_getspecific (__gthread_key_t key)
-{
- DWORD lasterror;
- void *ptr;
- lasterror = GetLastError();
- ptr = TlsGetValue(key);
- SetLastError( lasterror );
- return ptr;
-}
-
-int
-__gthr_win32_setspecific (__gthread_key_t key, const void *ptr)
-{
- if (TlsSetValue (key, CONST_CAST2(void *, const void *, ptr)) != 0)
- return 0;
- else
- return GetLastError ();
-}
-
-void
-__gthr_win32_mutex_init_function (__gthread_mutex_t *mutex)
-{
- mutex->counter = -1;
- mutex->sema = CreateSemaphore (NULL, 0, 65535, NULL);
-}
-
-void
-__gthr_win32_mutex_destroy (__gthread_mutex_t *mutex)
-{
- CloseHandle ((HANDLE) mutex->sema);
-}
-
-int
-__gthr_win32_mutex_lock (__gthread_mutex_t *mutex)
-{
- if (InterlockedIncrement (&mutex->counter) == 0 ||
- WaitForSingleObject (mutex->sema, INFINITE) == WAIT_OBJECT_0)
- return 0;
- else
- {
- /* WaitForSingleObject returns WAIT_FAILED, and we can only do
- some best-effort cleanup here. */
- InterlockedDecrement (&mutex->counter);
- return 1;
- }
-}
-
-int
-__gthr_win32_mutex_trylock (__gthread_mutex_t *mutex)
-{
- if (__GTHR_W32_InterlockedCompareExchange (&mutex->counter, 0, -1) < 0)
- return 0;
- else
- return 1;
-}
-
-int
-__gthr_win32_mutex_unlock (__gthread_mutex_t *mutex)
-{
- if (InterlockedDecrement (&mutex->counter) >= 0)
- return ReleaseSemaphore (mutex->sema, 1, NULL) ? 0 : 1;
- else
- return 0;
-}
-
-void
-__gthr_win32_recursive_mutex_init_function (__gthread_recursive_mutex_t *mutex)
-{
- mutex->counter = -1;
- mutex->depth = 0;
- mutex->owner = 0;
- mutex->sema = CreateSemaphore (NULL, 0, 65535, NULL);
-}
-
-int
-__gthr_win32_recursive_mutex_lock (__gthread_recursive_mutex_t *mutex)
-{
- DWORD me = GetCurrentThreadId();
- if (InterlockedIncrement (&mutex->counter) == 0)
- {
- mutex->depth = 1;
- mutex->owner = me;
- }
- else if (mutex->owner == me)
- {
- InterlockedDecrement (&mutex->counter);
- ++(mutex->depth);
- }
- else if (WaitForSingleObject (mutex->sema, INFINITE) == WAIT_OBJECT_0)
- {
- mutex->depth = 1;
- mutex->owner = me;
- }
- else
- {
- /* WaitForSingleObject returns WAIT_FAILED, and we can only do
- some best-effort cleanup here. */
- InterlockedDecrement (&mutex->counter);
- return 1;
- }
- return 0;
-}
-
-int
-__gthr_win32_recursive_mutex_trylock (__gthread_recursive_mutex_t *mutex)
-{
- DWORD me = GetCurrentThreadId();
- if (__GTHR_W32_InterlockedCompareExchange (&mutex->counter, 0, -1) < 0)
- {
- mutex->depth = 1;
- mutex->owner = me;
- }
- else if (mutex->owner == me)
- ++(mutex->depth);
- else
- return 1;
-
- return 0;
-}
-
-int
-__gthr_win32_recursive_mutex_unlock (__gthread_recursive_mutex_t *mutex)
-{
- --(mutex->depth);
- if (mutex->depth == 0)
- {
- mutex->owner = 0;
-
- if (InterlockedDecrement (&mutex->counter) >= 0)
- return ReleaseSemaphore (mutex->sema, 1, NULL) ? 0 : 1;
- }
-
- return 0;
-}
diff --git a/gcc/config/i386/i386-builtin-types.def b/gcc/config/i386/i386-builtin-types.def
index 9a3db0725db..5dcb68c2d43 100644
--- a/gcc/config/i386/i386-builtin-types.def
+++ b/gcc/config/i386/i386-builtin-types.def
@@ -337,6 +337,7 @@ DEF_FUNCTION_TYPE (V16HI, V16HI, INT)
DEF_FUNCTION_TYPE (V16HI, V16HI, SI)
DEF_FUNCTION_TYPE (V16HI, V16HI, V16HI, INT)
DEF_FUNCTION_TYPE (V32QI, V32QI, V32QI, INT)
+DEF_FUNCTION_TYPE (V8SI, V4DF, V4DF)
DEF_FUNCTION_TYPE (V8SI, V8SI, V4SI)
DEF_FUNCTION_TYPE (V8SI, V8SI, V8SI)
DEF_FUNCTION_TYPE (V8SI, V16HI, V16HI)
@@ -440,20 +441,24 @@ DEF_FUNCTION_TYPE (V8QI, QI, QI, QI, QI, QI, QI, QI, QI)
DEF_FUNCTION_TYPE (V2DF, V2DF, PCDOUBLE, V4SI, V2DF, INT)
DEF_FUNCTION_TYPE (V4DF, V4DF, PCDOUBLE, V4SI, V4DF, INT)
+DEF_FUNCTION_TYPE (V4DF, V4DF, PCDOUBLE, V8SI, V4DF, INT)
DEF_FUNCTION_TYPE (V2DF, V2DF, PCDOUBLE, V2DI, V2DF, INT)
DEF_FUNCTION_TYPE (V4DF, V4DF, PCDOUBLE, V4DI, V4DF, INT)
DEF_FUNCTION_TYPE (V4SF, V4SF, PCFLOAT, V4SI, V4SF, INT)
DEF_FUNCTION_TYPE (V8SF, V8SF, PCFLOAT, V8SI, V8SF, INT)
DEF_FUNCTION_TYPE (V4SF, V4SF, PCFLOAT, V2DI, V4SF, INT)
DEF_FUNCTION_TYPE (V4SF, V4SF, PCFLOAT, V4DI, V4SF, INT)
+DEF_FUNCTION_TYPE (V8SF, V8SF, PCFLOAT, V4DI, V8SF, INT)
DEF_FUNCTION_TYPE (V2DI, V2DI, PCINT64, V4SI, V2DI, INT)
DEF_FUNCTION_TYPE (V4DI, V4DI, PCINT64, V4SI, V4DI, INT)
+DEF_FUNCTION_TYPE (V4DI, V4DI, PCINT64, V8SI, V4DI, INT)
DEF_FUNCTION_TYPE (V2DI, V2DI, PCINT64, V2DI, V2DI, INT)
DEF_FUNCTION_TYPE (V4DI, V4DI, PCINT64, V4DI, V4DI, INT)
DEF_FUNCTION_TYPE (V4SI, V4SI, PCINT, V4SI, V4SI, INT)
DEF_FUNCTION_TYPE (V8SI, V8SI, PCINT, V8SI, V8SI, INT)
DEF_FUNCTION_TYPE (V4SI, V4SI, PCINT, V2DI, V4SI, INT)
DEF_FUNCTION_TYPE (V4SI, V4SI, PCINT, V4DI, V4SI, INT)
+DEF_FUNCTION_TYPE (V8SI, V8SI, PCINT, V4DI, V8SI, INT)
DEF_FUNCTION_TYPE_ALIAS (V2DF_FTYPE_V2DF, ROUND)
DEF_FUNCTION_TYPE_ALIAS (V4DF_FTYPE_V4DF, ROUND)
diff --git a/gcc/config/i386/i386-protos.h b/gcc/config/i386/i386-protos.h
index 5486e618dc8..6bfe13d47d6 100644
--- a/gcc/config/i386/i386-protos.h
+++ b/gcc/config/i386/i386-protos.h
@@ -93,6 +93,7 @@ extern bool ix86_binary_operator_ok (enum rtx_code, enum machine_mode, rtx[]);
extern bool ix86_lea_outperforms (rtx, unsigned int, unsigned int,
unsigned int, unsigned int);
extern bool ix86_avoid_lea_for_add (rtx, rtx[]);
+extern bool ix86_use_lea_for_mov (rtx, rtx[]);
extern bool ix86_avoid_lea_for_addr (rtx, rtx[]);
extern void ix86_split_lea_for_addr (rtx[], enum machine_mode);
extern bool ix86_lea_for_add_ok (rtx, rtx[]);
@@ -109,7 +110,8 @@ extern void ix86_expand_convert_uns_sixf_sse (rtx, rtx);
extern void ix86_expand_convert_uns_sidf_sse (rtx, rtx);
extern void ix86_expand_convert_uns_sisf_sse (rtx, rtx);
extern void ix86_expand_convert_sign_didf_sse (rtx, rtx);
-extern rtx ix86_expand_adjust_ufix_to_sfix_si (rtx);
+extern void ix86_expand_vector_convert_uns_vsivsf (rtx, rtx);
+extern rtx ix86_expand_adjust_ufix_to_sfix_si (rtx, rtx *);
extern enum ix86_fpcmp_strategy ix86_fp_comparison_strategy (enum rtx_code);
extern void ix86_expand_fp_absneg_operator (enum rtx_code, enum machine_mode,
rtx[]);
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 47ee8e154df..799e12b2b14 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -10913,15 +10913,28 @@ ix86_output_function_epilogue (FILE *file ATTRIBUTE_UNUSED,
it looks like we might want one, insert a NOP. */
{
rtx insn = get_last_insn ();
+ rtx deleted_debug_label = NULL_RTX;
while (insn
&& NOTE_P (insn)
&& NOTE_KIND (insn) != NOTE_INSN_DELETED_LABEL)
- insn = PREV_INSN (insn);
+ {
+ /* Don't insert a nop for NOTE_INSN_DELETED_DEBUG_LABEL
+ notes only, instead set their CODE_LABEL_NUMBER to -1,
+ otherwise there would be code generation differences
+ in between -g and -g0. */
+ if (NOTE_P (insn) && NOTE_KIND (insn) == NOTE_INSN_DELETED_DEBUG_LABEL)
+ deleted_debug_label = insn;
+ insn = PREV_INSN (insn);
+ }
if (insn
&& (LABEL_P (insn)
|| (NOTE_P (insn)
&& NOTE_KIND (insn) == NOTE_INSN_DELETED_LABEL)))
fputs ("\tnop\n", file);
+ else if (deleted_debug_label)
+ for (insn = deleted_debug_label; insn; insn = NEXT_INSN (insn))
+ if (NOTE_KIND (insn) == NOTE_INSN_DELETED_DEBUG_LABEL)
+ CODE_LABEL_NUMBER (insn) = -1;
}
#endif
@@ -16530,6 +16543,29 @@ ix86_avoid_lea_for_add (rtx insn, rtx operands[])
return !ix86_lea_outperforms (insn, regno0, regno1, regno2, 1);
}
+/* Return true if we should emit lea instruction instead of mov
+ instruction. */
+
+bool
+ix86_use_lea_for_mov (rtx insn, rtx operands[])
+{
+ unsigned int regno0;
+ unsigned int regno1;
+
+ /* Check if we need to optimize. */
+ if (!TARGET_OPT_AGU || optimize_function_for_size_p (cfun))
+ return false;
+
+ /* Use lea for reg to reg moves only. */
+ if (!REG_P (operands[0]) || !REG_P (operands[1]))
+ return false;
+
+ regno0 = true_regnum (operands[0]);
+ regno1 = true_regnum (operands[1]);
+
+ return ix86_lea_outperforms (insn, regno0, regno1, -1, 0);
+}
+
/* Return true if we need to split lea into a sequence of
instructions to avoid AGU stalls. */
@@ -17050,18 +17086,56 @@ ix86_expand_convert_uns_sisf_sse (rtx target, rtx input)
emit_move_insn (target, fp_hi);
}
+/* floatunsv{4,8}siv{4,8}sf2 expander. Expand code to convert
+ a vector of unsigned ints VAL to vector of floats TARGET. */
+
+void
+ix86_expand_vector_convert_uns_vsivsf (rtx target, rtx val)
+{
+ rtx tmp[8];
+ REAL_VALUE_TYPE TWO16r;
+ enum machine_mode intmode = GET_MODE (val);
+ enum machine_mode fltmode = GET_MODE (target);
+ rtx (*cvt) (rtx, rtx);
+
+ if (intmode == V4SImode)
+ cvt = gen_floatv4siv4sf2;
+ else
+ cvt = gen_floatv8siv8sf2;
+ tmp[0] = ix86_build_const_vector (intmode, 1, GEN_INT (0xffff));
+ tmp[0] = force_reg (intmode, tmp[0]);
+ tmp[1] = expand_simple_binop (intmode, AND, val, tmp[0], NULL_RTX, 1,
+ OPTAB_DIRECT);
+ tmp[2] = expand_simple_binop (intmode, LSHIFTRT, val, GEN_INT (16),
+ NULL_RTX, 1, OPTAB_DIRECT);
+ tmp[3] = gen_reg_rtx (fltmode);
+ emit_insn (cvt (tmp[3], tmp[1]));
+ tmp[4] = gen_reg_rtx (fltmode);
+ emit_insn (cvt (tmp[4], tmp[2]));
+ real_ldexp (&TWO16r, &dconst1, 16);
+ tmp[5] = const_double_from_real_value (TWO16r, SFmode);
+ tmp[5] = force_reg (fltmode, ix86_build_const_vector (fltmode, 1, tmp[5]));
+ tmp[6] = expand_simple_binop (fltmode, MULT, tmp[4], tmp[5], NULL_RTX, 1,
+ OPTAB_DIRECT);
+ tmp[7] = expand_simple_binop (fltmode, PLUS, tmp[3], tmp[6], target, 1,
+ OPTAB_DIRECT);
+ if (tmp[7] != target)
+ emit_move_insn (target, tmp[7]);
+}
+
/* Adjust a V*SFmode/V*DFmode value VAL so that *sfix_trunc* resp. fix_trunc*
pattern can be used on it instead of *ufix_trunc* resp. fixuns_trunc*.
- This is done by subtracting 0x1p32 from VAL if VAL is greater or equal
- (non-signalling) than 0x1p31. */
+ This is done by doing just signed conversion if < 0x1p31, and otherwise by
+ subtracting 0x1p31 first and xoring in 0x80000000 from *XORP afterwards. */
rtx
-ix86_expand_adjust_ufix_to_sfix_si (rtx val)
+ix86_expand_adjust_ufix_to_sfix_si (rtx val, rtx *xorp)
{
- REAL_VALUE_TYPE MTWO32r, TWO31r;
- rtx two31r, mtwo32r, tmp[3];
+ REAL_VALUE_TYPE TWO31r;
+ rtx two31r, tmp[4];
enum machine_mode mode = GET_MODE (val);
enum machine_mode scalarmode = GET_MODE_INNER (mode);
+ enum machine_mode intmode = GET_MODE_SIZE (mode) == 32 ? V8SImode : V4SImode;
rtx (*cmp) (rtx, rtx, rtx, rtx);
int i;
@@ -17071,22 +17145,33 @@ ix86_expand_adjust_ufix_to_sfix_si (rtx val)
two31r = const_double_from_real_value (TWO31r, scalarmode);
two31r = ix86_build_const_vector (mode, 1, two31r);
two31r = force_reg (mode, two31r);
- real_ldexp (&MTWO32r, &dconstm1, 32);
- mtwo32r = const_double_from_real_value (MTWO32r, scalarmode);
- mtwo32r = ix86_build_const_vector (mode, 1, mtwo32r);
- mtwo32r = force_reg (mode, mtwo32r);
switch (mode)
{
- case V8SFmode: cmp = gen_avx_cmpv8sf3; break;
- case V4SFmode: cmp = gen_avx_cmpv4sf3; break;
- case V4DFmode: cmp = gen_avx_cmpv4df3; break;
- case V2DFmode: cmp = gen_avx_cmpv2df3; break;
+ case V8SFmode: cmp = gen_avx_maskcmpv8sf3; break;
+ case V4SFmode: cmp = gen_sse_maskcmpv4sf3; break;
+ case V4DFmode: cmp = gen_avx_maskcmpv4df3; break;
+ case V2DFmode: cmp = gen_sse2_maskcmpv2df3; break;
default: gcc_unreachable ();
}
- emit_insn (cmp (tmp[0], val, two31r, GEN_INT (29)));
- tmp[1] = expand_simple_binop (mode, AND, tmp[0], mtwo32r, tmp[1],
+ tmp[3] = gen_rtx_LE (mode, two31r, val);
+ emit_insn (cmp (tmp[0], two31r, val, tmp[3]));
+ tmp[1] = expand_simple_binop (mode, AND, tmp[0], two31r, tmp[1],
0, OPTAB_DIRECT);
- return expand_simple_binop (mode, PLUS, val, tmp[1], tmp[2],
+ if (intmode == V4SImode || TARGET_AVX2)
+ *xorp = expand_simple_binop (intmode, ASHIFT,
+ gen_lowpart (intmode, tmp[0]),
+ GEN_INT (31), NULL_RTX, 0,
+ OPTAB_DIRECT);
+ else
+ {
+ rtx two31 = GEN_INT ((unsigned HOST_WIDE_INT) 1 << 31);
+ two31 = ix86_build_const_vector (intmode, 1, two31);
+ *xorp = expand_simple_binop (intmode, AND,
+ gen_lowpart (intmode, tmp[0]),
+ two31, NULL_RTX, 0,
+ OPTAB_DIRECT);
+ }
+ return expand_simple_binop (mode, MINUS, val, tmp[1], tmp[2],
0, OPTAB_DIRECT);
}
@@ -24779,6 +24864,7 @@ enum ix86_builtins
IX86_BUILTIN_VEC_SET_V16QI,
IX86_BUILTIN_VEC_PACK_SFIX,
+ IX86_BUILTIN_VEC_PACK_SFIX256,
/* SSE4.2. */
IX86_BUILTIN_CRC32QI,
@@ -25139,6 +25225,13 @@ enum ix86_builtins
IX86_BUILTIN_GATHERDIV4SI,
IX86_BUILTIN_GATHERDIV8SI,
+ /* Alternate 4 element gather for the vectorizer where
+ all operands are 32-byte wide. */
+ IX86_BUILTIN_GATHERALTSIV4DF,
+ IX86_BUILTIN_GATHERALTDIV8SF,
+ IX86_BUILTIN_GATHERALTSIV4DI,
+ IX86_BUILTIN_GATHERALTDIV8SI,
+
/* TFmode support builtins. */
IX86_BUILTIN_INFQ,
IX86_BUILTIN_HUGE_VALQ,
@@ -26223,7 +26316,7 @@ static const struct builtin_description bdesc_args[] =
{ OPTION_MASK_ISA_AVX, CODE_FOR_avx_cvtpd2ps256, "__builtin_ia32_cvtpd2ps256", IX86_BUILTIN_CVTPD2PS256, UNKNOWN, (int) V4SF_FTYPE_V4DF },
{ OPTION_MASK_ISA_AVX, CODE_FOR_avx_cvtps2dq256, "__builtin_ia32_cvtps2dq256", IX86_BUILTIN_CVTPS2DQ256, UNKNOWN, (int) V8SI_FTYPE_V8SF },
{ OPTION_MASK_ISA_AVX, CODE_FOR_avx_cvtps2pd256, "__builtin_ia32_cvtps2pd256", IX86_BUILTIN_CVTPS2PD256, UNKNOWN, (int) V4DF_FTYPE_V4SF },
- { OPTION_MASK_ISA_AVX, CODE_FOR_fix_truncv4sfv4si2, "__builtin_ia32_cvttpd2dq256", IX86_BUILTIN_CVTTPD2DQ256, UNKNOWN, (int) V4SI_FTYPE_V4DF },
+ { OPTION_MASK_ISA_AVX, CODE_FOR_fix_truncv4dfv4si2, "__builtin_ia32_cvttpd2dq256", IX86_BUILTIN_CVTTPD2DQ256, UNKNOWN, (int) V4SI_FTYPE_V4DF },
{ OPTION_MASK_ISA_AVX, CODE_FOR_avx_cvtpd2dq256, "__builtin_ia32_cvtpd2dq256", IX86_BUILTIN_CVTPD2DQ256, UNKNOWN, (int) V4SI_FTYPE_V4DF },
{ OPTION_MASK_ISA_AVX, CODE_FOR_fix_truncv8sfv8si2, "__builtin_ia32_cvttps2dq256", IX86_BUILTIN_CVTTPS2DQ256, UNKNOWN, (int) V8SI_FTYPE_V8SF },
{ OPTION_MASK_ISA_AVX, CODE_FOR_avx_vperm2f128v4df3, "__builtin_ia32_vperm2f128_pd256", IX86_BUILTIN_VPERM2F128PD256, UNKNOWN, (int) V4DF_FTYPE_V4DF_V4DF_INT },
@@ -26300,6 +26393,8 @@ static const struct builtin_description bdesc_args[] =
{ OPTION_MASK_ISA_AVX, CODE_FOR_copysignv8sf3, "__builtin_ia32_copysignps256", IX86_BUILTIN_CPYSGNPS256, UNKNOWN, (int) V8SF_FTYPE_V8SF_V8SF },
{ OPTION_MASK_ISA_AVX, CODE_FOR_copysignv4df3, "__builtin_ia32_copysignpd256", IX86_BUILTIN_CPYSGNPD256, UNKNOWN, (int) V4DF_FTYPE_V4DF_V4DF },
+ { OPTION_MASK_ISA_AVX, CODE_FOR_vec_pack_sfix_v4df, "__builtin_ia32_vec_pack_sfix256 ", IX86_BUILTIN_VEC_PACK_SFIX256, UNKNOWN, (int) V8SI_FTYPE_V4DF_V4DF },
+
/* AVX2 */
{ OPTION_MASK_ISA_AVX2, CODE_FOR_avx2_mpsadbw, "__builtin_ia32_mpsadbw256", IX86_BUILTIN_MPSADBW256, UNKNOWN, (int) V32QI_FTYPE_V32QI_V32QI_INT },
{ OPTION_MASK_ISA_AVX2, CODE_FOR_absv32qi2, "__builtin_ia32_pabsb256", IX86_BUILTIN_PABSB256, UNKNOWN, (int) V32QI_FTYPE_V32QI },
@@ -27065,6 +27160,22 @@ ix86_init_mmx_sse_builtins (void)
V4SI_FTYPE_V4SI_PCINT_V4DI_V4SI_INT,
IX86_BUILTIN_GATHERDIV8SI);
+ def_builtin (OPTION_MASK_ISA_AVX2, "__builtin_ia32_gatheraltsiv4df ",
+ V4DF_FTYPE_V4DF_PCDOUBLE_V8SI_V4DF_INT,
+ IX86_BUILTIN_GATHERALTSIV4DF);
+
+ def_builtin (OPTION_MASK_ISA_AVX2, "__builtin_ia32_gatheraltdiv4sf256 ",
+ V8SF_FTYPE_V8SF_PCFLOAT_V4DI_V8SF_INT,
+ IX86_BUILTIN_GATHERALTDIV8SF);
+
+ def_builtin (OPTION_MASK_ISA_AVX2, "__builtin_ia32_gatheraltsiv4di ",
+ V4DI_FTYPE_V4DI_PCINT64_V8SI_V4DI_INT,
+ IX86_BUILTIN_GATHERALTSIV4DI);
+
+ def_builtin (OPTION_MASK_ISA_AVX2, "__builtin_ia32_gatheraltdiv4si256 ",
+ V8SI_FTYPE_V8SI_PCINT_V4DI_V8SI_INT,
+ IX86_BUILTIN_GATHERALTDIV8SI);
+
/* MMX access to the vec_init patterns. */
def_builtin_const (OPTION_MASK_ISA_MMX, "__builtin_ia32_vec_init_v2si",
V2SI_FTYPE_INT_INT, IX86_BUILTIN_VEC_INIT_V2SI);
@@ -28123,6 +28234,7 @@ ix86_expand_args_builtin (const struct builtin_description *d,
case V32QI_FTYPE_V32QI_V32QI:
case V16HI_FTYPE_V32QI_V32QI:
case V16HI_FTYPE_V16HI_V16HI:
+ case V8SI_FTYPE_V4DF_V4DF:
case V8SI_FTYPE_V8SI_V8SI:
case V8SI_FTYPE_V16HI_V16HI:
case V4DI_FTYPE_V4DI_V4DI:
@@ -29052,7 +29164,7 @@ rdrand_step:
icode = CODE_FOR_avx2_gatherdiv4sf;
goto gather_gen;
case IX86_BUILTIN_GATHERDIV8SF:
- icode = CODE_FOR_avx2_gatherdiv4sf256;
+ icode = CODE_FOR_avx2_gatherdiv8sf;
goto gather_gen;
case IX86_BUILTIN_GATHERSIV2DI:
icode = CODE_FOR_avx2_gathersiv2di;
@@ -29076,7 +29188,20 @@ rdrand_step:
icode = CODE_FOR_avx2_gatherdiv4si;
goto gather_gen;
case IX86_BUILTIN_GATHERDIV8SI:
- icode = CODE_FOR_avx2_gatherdiv4si256;
+ icode = CODE_FOR_avx2_gatherdiv8si;
+ goto gather_gen;
+ case IX86_BUILTIN_GATHERALTSIV4DF:
+ icode = CODE_FOR_avx2_gathersiv4df;
+ goto gather_gen;
+ case IX86_BUILTIN_GATHERALTDIV8SF:
+ icode = CODE_FOR_avx2_gatherdiv8sf;
+ goto gather_gen;
+ case IX86_BUILTIN_GATHERALTSIV4DI:
+ icode = CODE_FOR_avx2_gathersiv4df;
+ goto gather_gen;
+ case IX86_BUILTIN_GATHERALTDIV8SI:
+ icode = CODE_FOR_avx2_gatherdiv8si;
+ goto gather_gen;
gather_gen:
arg0 = CALL_EXPR_ARG (exp, 0);
@@ -29095,8 +29220,39 @@ rdrand_step:
mode3 = insn_data[icode].operand[4].mode;
mode4 = insn_data[icode].operand[5].mode;
- if (target == NULL_RTX)
- target = gen_reg_rtx (insn_data[icode].operand[0].mode);
+ if (target == NULL_RTX
+ || GET_MODE (target) != insn_data[icode].operand[0].mode)
+ subtarget = gen_reg_rtx (insn_data[icode].operand[0].mode);
+ else
+ subtarget = target;
+
+ if (fcode == IX86_BUILTIN_GATHERALTSIV4DF
+ || fcode == IX86_BUILTIN_GATHERALTSIV4DI)
+ {
+ rtx half = gen_reg_rtx (V4SImode);
+ if (!nonimmediate_operand (op2, V8SImode))
+ op2 = copy_to_mode_reg (V8SImode, op2);
+ emit_insn (gen_vec_extract_lo_v8si (half, op2));
+ op2 = half;
+ }
+ else if (fcode == IX86_BUILTIN_GATHERALTDIV8SF
+ || fcode == IX86_BUILTIN_GATHERALTDIV8SI)
+ {
+ rtx (*gen) (rtx, rtx);
+ rtx half = gen_reg_rtx (mode0);
+ if (mode0 == V4SFmode)
+ gen = gen_vec_extract_lo_v8sf;
+ else
+ gen = gen_vec_extract_lo_v8si;
+ if (!nonimmediate_operand (op0, GET_MODE (op0)))
+ op0 = copy_to_mode_reg (GET_MODE (op0), op0);
+ emit_insn (gen (half, op0));
+ op0 = half;
+ if (!nonimmediate_operand (op3, GET_MODE (op3)))
+ op3 = copy_to_mode_reg (GET_MODE (op3), op3);
+ emit_insn (gen (half, op3));
+ op3 = half;
+ }
/* Force memory operand only with base register here. But we
don't want to do it on memory operand for other builtin
@@ -29118,10 +29274,91 @@ rdrand_step:
error ("last argument must be scale 1, 2, 4, 8");
return const0_rtx;
}
- pat = GEN_FCN (icode) (target, op0, op1, op2, op3, op4);
+
+ /* Optimize. If mask is known to have all high bits set,
+ replace op0 with pc_rtx to signal that the instruction
+ overwrites the whole destination and doesn't use its
+ previous contents. */
+ if (optimize)
+ {
+ if (TREE_CODE (arg3) == VECTOR_CST)
+ {
+ tree elt;
+ unsigned int negative = 0;
+ for (elt = TREE_VECTOR_CST_ELTS (arg3);
+ elt; elt = TREE_CHAIN (elt))
+ {
+ tree cst = TREE_VALUE (elt);
+ if (TREE_CODE (cst) == INTEGER_CST
+ && tree_int_cst_sign_bit (cst))
+ negative++;
+ else if (TREE_CODE (cst) == REAL_CST
+ && REAL_VALUE_NEGATIVE (TREE_REAL_CST (cst)))
+ negative++;
+ }
+ if (negative == TYPE_VECTOR_SUBPARTS (TREE_TYPE (arg3)))
+ op0 = pc_rtx;
+ }
+ else if (TREE_CODE (arg3) == SSA_NAME)
+ {
+ /* Recognize also when mask is like:
+ __v2df src = _mm_setzero_pd ();
+ __v2df mask = _mm_cmpeq_pd (src, src);
+ or
+ __v8sf src = _mm256_setzero_ps ();
+ __v8sf mask = _mm256_cmp_ps (src, src, _CMP_EQ_OQ);
+ as that is a cheaper way to load all ones into
+ a register than having to load a constant from
+ memory. */
+ gimple def_stmt = SSA_NAME_DEF_STMT (arg3);
+ if (is_gimple_call (def_stmt))
+ {
+ tree fndecl = gimple_call_fndecl (def_stmt);
+ if (fndecl
+ && DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_MD)
+ switch ((unsigned int) DECL_FUNCTION_CODE (fndecl))
+ {
+ case IX86_BUILTIN_CMPPD:
+ case IX86_BUILTIN_CMPPS:
+ case IX86_BUILTIN_CMPPD256:
+ case IX86_BUILTIN_CMPPS256:
+ if (!integer_zerop (gimple_call_arg (def_stmt, 2)))
+ break;
+ /* FALLTHRU */
+ case IX86_BUILTIN_CMPEQPD:
+ case IX86_BUILTIN_CMPEQPS:
+ if (initializer_zerop (gimple_call_arg (def_stmt, 0))
+ && initializer_zerop (gimple_call_arg (def_stmt,
+ 1)))
+ op0 = pc_rtx;
+ break;
+ default:
+ break;
+ }
+ }
+ }
+ }
+
+ pat = GEN_FCN (icode) (subtarget, op0, op1, op2, op3, op4);
if (! pat)
return const0_rtx;
emit_insn (pat);
+
+ if (fcode == IX86_BUILTIN_GATHERDIV8SF
+ || fcode == IX86_BUILTIN_GATHERDIV8SI)
+ {
+ enum machine_mode tmode = GET_MODE (subtarget) == V8SFmode
+ ? V4SFmode : V4SImode;
+ if (target == NULL_RTX)
+ target = gen_reg_rtx (tmode);
+ if (tmode == V4SFmode)
+ emit_insn (gen_vec_extract_lo_v8sf (target, subtarget));
+ else
+ emit_insn (gen_vec_extract_lo_v8si (target, subtarget));
+ }
+ else
+ target = subtarget;
+
return target;
default:
@@ -29218,13 +29455,21 @@ ix86_builtin_vectorized_function (tree fndecl, tree type_out,
}
break;
+ case BUILT_IN_IRINT:
case BUILT_IN_LRINT:
- if (out_mode == SImode && out_n == 4
- && in_mode == DFmode && in_n == 2)
- return ix86_builtins[IX86_BUILTIN_VEC_PACK_SFIX];
+ case BUILT_IN_LLRINT:
+ if (out_mode == SImode && in_mode == DFmode)
+ {
+ if (out_n == 4 && in_n == 2)
+ return ix86_builtins[IX86_BUILTIN_VEC_PACK_SFIX];
+ else if (out_n == 8 && in_n == 4)
+ return ix86_builtins[IX86_BUILTIN_VEC_PACK_SFIX256];
+ }
break;
+ case BUILT_IN_IRINTF:
case BUILT_IN_LRINTF:
+ case BUILT_IN_LLRINTF:
if (out_mode == SImode && in_mode == SFmode)
{
if (out_n == 4 && in_n == 4)
@@ -29626,6 +29871,73 @@ ix86_veclibabi_acml (enum built_in_function fn, tree type_out, tree type_in)
return new_fndecl;
}
+/* Returns a decl of a function that implements gather load with
+ memory type MEM_VECTYPE and index type INDEX_VECTYPE and SCALE.
+ Return NULL_TREE if it is not available. */
+
+static tree
+ix86_vectorize_builtin_gather (const_tree mem_vectype,
+ const_tree index_type, int scale)
+{
+ bool si;
+ enum ix86_builtins code;
+
+ if (! TARGET_AVX2)
+ return NULL_TREE;
+
+ if ((TREE_CODE (index_type) != INTEGER_TYPE
+ && !POINTER_TYPE_P (index_type))
+ || (TYPE_MODE (index_type) != SImode
+ && TYPE_MODE (index_type) != DImode))
+ return NULL_TREE;
+
+ if (TYPE_PRECISION (index_type) > POINTER_SIZE)
+ return NULL_TREE;
+
+ /* v*gather* insn sign extends index to pointer mode. */
+ if (TYPE_PRECISION (index_type) < POINTER_SIZE
+ && TYPE_UNSIGNED (index_type))
+ return NULL_TREE;
+
+ if (scale <= 0
+ || scale > 8
+ || (scale & (scale - 1)) != 0)
+ return NULL_TREE;
+
+ si = TYPE_MODE (index_type) == SImode;
+ switch (TYPE_MODE (mem_vectype))
+ {
+ case V2DFmode:
+ code = si ? IX86_BUILTIN_GATHERSIV2DF : IX86_BUILTIN_GATHERDIV2DF;
+ break;
+ case V4DFmode:
+ code = si ? IX86_BUILTIN_GATHERALTSIV4DF : IX86_BUILTIN_GATHERDIV4DF;
+ break;
+ case V2DImode:
+ code = si ? IX86_BUILTIN_GATHERSIV2DI : IX86_BUILTIN_GATHERDIV2DI;
+ break;
+ case V4DImode:
+ code = si ? IX86_BUILTIN_GATHERALTSIV4DI : IX86_BUILTIN_GATHERDIV4DI;
+ break;
+ case V4SFmode:
+ code = si ? IX86_BUILTIN_GATHERSIV4SF : IX86_BUILTIN_GATHERDIV4SF;
+ break;
+ case V8SFmode:
+ code = si ? IX86_BUILTIN_GATHERSIV8SF : IX86_BUILTIN_GATHERALTDIV8SF;
+ break;
+ case V4SImode:
+ code = si ? IX86_BUILTIN_GATHERSIV4SI : IX86_BUILTIN_GATHERDIV4SI;
+ break;
+ case V8SImode:
+ code = si ? IX86_BUILTIN_GATHERSIV8SI : IX86_BUILTIN_GATHERALTDIV8SI;
+ break;
+ default:
+ return NULL_TREE;
+ }
+
+ return ix86_builtins[code];
+}
+
/* Returns a code for a target-specific builtin that implements
reciprocal of the function, or NULL_TREE if not available. */
@@ -37835,6 +38147,9 @@ ix86_autovectorize_vector_sizes (void)
#undef TARGET_VECTORIZE_BUILTIN_TM_STORE
#define TARGET_VECTORIZE_BUILTIN_TM_STORE ix86_builtin_tm_store
+#undef TARGET_VECTORIZE_BUILTIN_GATHER
+#define TARGET_VECTORIZE_BUILTIN_GATHER ix86_vectorize_builtin_gather
+
#undef TARGET_BUILTIN_RECIPROCAL
#define TARGET_BUILTIN_RECIPROCAL ix86_builtin_reciprocal
diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md
index a8ebfa48000..35273d95683 100644
--- a/gcc/config/i386/i386.md
+++ b/gcc/config/i386/i386.md
@@ -248,6 +248,9 @@
;; For BMI2 support
UNSPEC_PDEP
UNSPEC_PEXT
+
+ ;; For __atomic support
+ UNSPEC_MOVA
])
(define_c_enum "unspecv" [
@@ -262,7 +265,10 @@
UNSPECV_ALIGN
UNSPECV_MONITOR
UNSPECV_MWAIT
- UNSPECV_CMPXCHG
+ UNSPECV_CMPXCHG_1
+ UNSPECV_CMPXCHG_2
+ UNSPECV_CMPXCHG_3
+ UNSPECV_CMPXCHG_4
UNSPECV_XCHG
UNSPECV_LOCK
UNSPECV_PROLOGUE_USE
@@ -2047,6 +2053,8 @@
return "mov{l}\t{%k1, %k0|%k0, %k1}";
else if (which_alternative == 2)
return "movabs{q}\t{%1, %0|%0, %1}";
+ else if (ix86_use_lea_for_mov (insn, operands))
+ return "lea{q}\t{%a1, %0|%0, %a1}";
else
return "mov{q}\t{%1, %0|%0, %1}";
}
@@ -2282,7 +2290,10 @@
default:
gcc_assert (!flag_pic || LEGITIMATE_PIC_OPERAND_P (operands[1]));
- return "mov{l}\t{%1, %0|%0, %1}";
+ if (ix86_use_lea_for_mov (insn, operands))
+ return "lea{l}\t{%a1, %0|%0, %a1}";
+ else
+ return "mov{l}\t{%1, %0|%0, %1}";
}
}
[(set (attr "type")
@@ -4922,7 +4933,7 @@
&& reload_completed
&& (SSE_REG_P (operands[0])
|| (GET_CODE (operands[0]) == SUBREG
- && SSE_REG_P (operands[0])))"
+ && SSE_REG_P (SUBREG_REG (operands[0]))))"
[(set (match_dup 0) (float:MODEF (match_dup 1)))])
(define_split
@@ -4935,7 +4946,7 @@
&& reload_completed
&& (SSE_REG_P (operands[0])
|| (GET_CODE (operands[0]) == SUBREG
- && SSE_REG_P (operands[0])))"
+ && SSE_REG_P (SUBREG_REG (operands[0]))))"
[(set (match_dup 2) (match_dup 1))
(set (match_dup 0) (float:MODEF (match_dup 2)))])
@@ -5026,7 +5037,7 @@
&& reload_completed
&& (SSE_REG_P (operands[0])
|| (GET_CODE (operands[0]) == SUBREG
- && SSE_REG_P (operands[0])))"
+ && SSE_REG_P (SUBREG_REG (operands[0]))))"
[(const_int 0)]
{
rtx op1 = operands[1];
@@ -5069,7 +5080,7 @@
&& reload_completed
&& (SSE_REG_P (operands[0])
|| (GET_CODE (operands[0]) == SUBREG
- && SSE_REG_P (operands[0])))"
+ && SSE_REG_P (SUBREG_REG (operands[0]))))"
[(const_int 0)]
{
operands[3] = simplify_gen_subreg (<ssevecmode>mode, operands[0],
@@ -5093,7 +5104,7 @@
&& reload_completed
&& (SSE_REG_P (operands[0])
|| (GET_CODE (operands[0]) == SUBREG
- && SSE_REG_P (operands[0])))"
+ && SSE_REG_P (SUBREG_REG (operands[0]))))"
[(const_int 0)]
{
rtx op1 = operands[1];
@@ -5139,7 +5150,7 @@
&& reload_completed
&& (SSE_REG_P (operands[0])
|| (GET_CODE (operands[0]) == SUBREG
- && SSE_REG_P (operands[0])))"
+ && SSE_REG_P (SUBREG_REG (operands[0]))))"
[(const_int 0)]
{
operands[3] = simplify_gen_subreg (<ssevecmode>mode, operands[0],
@@ -5202,7 +5213,7 @@
&& reload_completed
&& (SSE_REG_P (operands[0])
|| (GET_CODE (operands[0]) == SUBREG
- && SSE_REG_P (operands[0])))"
+ && SSE_REG_P (SUBREG_REG (operands[0]))))"
[(set (match_dup 0) (float:MODEF (match_dup 1)))])
(define_insn "*float<SWI48x:mode><MODEF:mode>2_sse_nointerunit"
@@ -5237,7 +5248,7 @@
&& reload_completed
&& (SSE_REG_P (operands[0])
|| (GET_CODE (operands[0]) == SUBREG
- && SSE_REG_P (operands[0])))"
+ && SSE_REG_P (SUBREG_REG (operands[0]))))"
[(set (match_dup 2) (match_dup 1))
(set (match_dup 0) (float:MODEF (match_dup 2)))])
@@ -5250,7 +5261,7 @@
&& reload_completed
&& (SSE_REG_P (operands[0])
|| (GET_CODE (operands[0]) == SUBREG
- && SSE_REG_P (operands[0])))"
+ && SSE_REG_P (SUBREG_REG (operands[0]))))"
[(set (match_dup 0) (float:MODEF (match_dup 1)))])
(define_insn "*float<SWI48x:mode><X87MODEF:mode>2_i387_with_temp"
@@ -7702,8 +7713,10 @@
[(and:SI (zero_extract:SI (match_dup 2) (const_int 8) (const_int 8))
(match_dup 3))
(const_int 0)]))]
- "operands[2] = gen_lowpart (SImode, operands[2]);
- operands[3] = gen_int_mode (INTVAL (operands[3]) >> 8, SImode);")
+{
+ operands[2] = gen_lowpart (SImode, operands[2]);
+ operands[3] = gen_int_mode (INTVAL (operands[3]) >> 8, SImode);
+})
(define_split
[(set (match_operand 0 "flags_reg_operand" "")
@@ -7721,8 +7734,10 @@
[(set (match_dup 0)
(match_op_dup 1 [(and:QI (match_dup 2) (match_dup 3))
(const_int 0)]))]
- "operands[2] = gen_lowpart (QImode, operands[2]);
- operands[3] = gen_lowpart (QImode, operands[3]);")
+{
+ operands[2] = gen_lowpart (QImode, operands[2]);
+ operands[3] = gen_lowpart (QImode, operands[3]);
+})
;; %%% This used to optimize known byte-wide and operations to memory,
;; and sometimes to QImode registers. If this is considered useful,
@@ -8147,9 +8162,11 @@
(const_int 8) (const_int 8))
(match_dup 2)))
(clobber (reg:CC FLAGS_REG))])]
- "operands[0] = gen_lowpart (SImode, operands[0]);
- operands[1] = gen_lowpart (SImode, operands[1]);
- operands[2] = gen_int_mode ((INTVAL (operands[2]) >> 8) & 0xff, SImode);")
+{
+ operands[0] = gen_lowpart (SImode, operands[0]);
+ operands[1] = gen_lowpart (SImode, operands[1]);
+ operands[2] = gen_int_mode ((INTVAL (operands[2]) >> 8) & 0xff, SImode);
+})
;; Since AND can be encoded with sign extended immediate, this is only
;; profitable when 7th bit is not set.
@@ -8168,9 +8185,11 @@
(and:QI (match_dup 1)
(match_dup 2)))
(clobber (reg:CC FLAGS_REG))])]
- "operands[0] = gen_lowpart (QImode, operands[0]);
- operands[1] = gen_lowpart (QImode, operands[1]);
- operands[2] = gen_lowpart (QImode, operands[2]);")
+{
+ operands[0] = gen_lowpart (QImode, operands[0]);
+ operands[1] = gen_lowpart (QImode, operands[1]);
+ operands[2] = gen_lowpart (QImode, operands[2]);
+})
;; Logical inclusive and exclusive OR instructions
@@ -8402,9 +8421,11 @@
(const_int 8) (const_int 8))
(match_dup 2)))
(clobber (reg:CC FLAGS_REG))])]
- "operands[0] = gen_lowpart (SImode, operands[0]);
- operands[1] = gen_lowpart (SImode, operands[1]);
- operands[2] = gen_int_mode ((INTVAL (operands[2]) >> 8) & 0xff, SImode);")
+{
+ operands[0] = gen_lowpart (SImode, operands[0]);
+ operands[1] = gen_lowpart (SImode, operands[1]);
+ operands[2] = gen_int_mode ((INTVAL (operands[2]) >> 8) & 0xff, SImode);
+})
;; Since OR can be encoded with sign extended immediate, this is only
;; profitable when 7th bit is set.
@@ -8423,9 +8444,11 @@
(any_or:QI (match_dup 1)
(match_dup 2)))
(clobber (reg:CC FLAGS_REG))])]
- "operands[0] = gen_lowpart (QImode, operands[0]);
- operands[1] = gen_lowpart (QImode, operands[1]);
- operands[2] = gen_lowpart (QImode, operands[2]);")
+{
+ operands[0] = gen_lowpart (QImode, operands[0]);
+ operands[1] = gen_lowpart (QImode, operands[1]);
+ operands[2] = gen_lowpart (QImode, operands[2]);
+})
(define_expand "xorqi_cc_ext_1"
[(parallel [
@@ -14651,7 +14674,7 @@
else if (optimize_insn_for_size_p ())
FAIL;
else
- ix86_expand_rint (operand0, operand1);
+ ix86_expand_rint (operands[0], operands[1]);
}
else
{
@@ -14851,7 +14874,7 @@
&& <SWI248x:MODE>mode != HImode
&& ((<SWI248x:MODE>mode != DImode) || TARGET_64BIT)
&& !flag_trapping_math && !flag_rounding_math)
- ix86_expand_lround (operand0, operand1);
+ ix86_expand_lround (operands[0], operands[1]);
else
ix86_emit_i387_round (operands[0], operands[1]);
DONE;
@@ -14927,9 +14950,9 @@
else if (optimize_insn_for_size_p ())
FAIL;
else if (TARGET_64BIT || (<MODE>mode != DFmode))
- ix86_expand_floorceil (operand0, operand1, true);
+ ix86_expand_floorceil (operands[0], operands[1], true);
else
- ix86_expand_floorceildf_32 (operand0, operand1, true);
+ ix86_expand_floorceildf_32 (operands[0], operands[1], true);
}
else
{
@@ -15111,7 +15134,7 @@
{
if (TARGET_64BIT && optimize_insn_for_size_p ())
FAIL;
- ix86_expand_lfloorceil (operand0, operand1, true);
+ ix86_expand_lfloorceil (operands[0], operands[1], true);
DONE;
})
@@ -15185,9 +15208,9 @@
else if (optimize_insn_for_size_p ())
FAIL;
else if (TARGET_64BIT || (<MODE>mode != DFmode))
- ix86_expand_floorceil (operand0, operand1, false);
+ ix86_expand_floorceil (operands[0], operands[1], false);
else
- ix86_expand_floorceildf_32 (operand0, operand1, false);
+ ix86_expand_floorceildf_32 (operands[0], operands[1], false);
}
else
{
@@ -15367,7 +15390,7 @@
"SSE_FLOAT_MODE_P (<MODEF:MODE>mode) && TARGET_SSE_MATH
&& !flag_trapping_math"
{
- ix86_expand_lfloorceil (operand0, operand1, false);
+ ix86_expand_lfloorceil (operands[0], operands[1], false);
DONE;
})
@@ -15441,9 +15464,9 @@
else if (optimize_insn_for_size_p ())
FAIL;
else if (TARGET_64BIT || (<MODE>mode != DFmode))
- ix86_expand_trunc (operand0, operand1);
+ ix86_expand_trunc (operands[0], operands[1]);
else
- ix86_expand_truncdf_32 (operand0, operand1);
+ ix86_expand_truncdf_32 (operands[0], operands[1]);
}
else
{
@@ -16631,14 +16654,18 @@
;; The % modifier is not operational anymore in peephole2's, so we have to
;; swap the operands manually in the case of addition and multiplication.
- "if (COMMUTATIVE_ARITH_P (operands[2]))
- operands[4] = gen_rtx_fmt_ee (GET_CODE (operands[2]),
- GET_MODE (operands[2]),
- operands[0], operands[1]);
- else
- operands[4] = gen_rtx_fmt_ee (GET_CODE (operands[2]),
- GET_MODE (operands[2]),
- operands[1], operands[0]);")
+{
+ rtx op0, op1;
+
+ if (COMMUTATIVE_ARITH_P (operands[2]))
+ op0 = operands[0], op1 = operands[1];
+ else
+ op0 = operands[1], op1 = operands[0];
+
+ operands[4] = gen_rtx_fmt_ee (GET_CODE (operands[2]),
+ GET_MODE (operands[2]),
+ op0, op1);
+})
;; Conditional addition patterns
(define_expand "add<mode>cc"
@@ -16837,11 +16864,13 @@
[(parallel [(set (match_dup 0)
(match_op_dup 3 [(match_dup 1) (match_dup 2)]))
(clobber (reg:CC FLAGS_REG))])]
- "operands[0] = gen_lowpart (SImode, operands[0]);
- operands[1] = gen_lowpart (SImode, operands[1]);
- if (GET_CODE (operands[3]) != ASHIFT)
- operands[2] = gen_lowpart (SImode, operands[2]);
- PUT_MODE (operands[3], SImode);")
+{
+ operands[0] = gen_lowpart (SImode, operands[0]);
+ operands[1] = gen_lowpart (SImode, operands[1]);
+ if (GET_CODE (operands[3]) != ASHIFT)
+ operands[2] = gen_lowpart (SImode, operands[2]);
+ PUT_MODE (operands[3], SImode);
+})
; Promote the QImode tests, as i386 has encoding of the AND
; instruction with 32-bit sign-extended immediate and thus the
@@ -16911,8 +16940,10 @@
[(parallel [(set (match_dup 0)
(neg:SI (match_dup 1)))
(clobber (reg:CC FLAGS_REG))])]
- "operands[0] = gen_lowpart (SImode, operands[0]);
- operands[1] = gen_lowpart (SImode, operands[1]);")
+{
+ operands[0] = gen_lowpart (SImode, operands[0]);
+ operands[1] = gen_lowpart (SImode, operands[1]);
+})
(define_split
[(set (match_operand 0 "register_operand" "")
@@ -16924,8 +16955,10 @@
|| optimize_insn_for_size_p ())))"
[(set (match_dup 0)
(not:SI (match_dup 1)))]
- "operands[0] = gen_lowpart (SImode, operands[0]);
- operands[1] = gen_lowpart (SImode, operands[1]);")
+{
+ operands[0] = gen_lowpart (SImode, operands[0]);
+ operands[1] = gen_lowpart (SImode, operands[1]);
+})
(define_split
[(set (match_operand 0 "register_operand" "")
@@ -16940,9 +16973,11 @@
|| optimize_insn_for_size_p ())))"
[(set (match_dup 0)
(if_then_else:SI (match_dup 1) (match_dup 2) (match_dup 3)))]
- "operands[0] = gen_lowpart (SImode, operands[0]);
- operands[2] = gen_lowpart (SImode, operands[2]);
- operands[3] = gen_lowpart (SImode, operands[3]);")
+{
+ operands[0] = gen_lowpart (SImode, operands[0]);
+ operands[2] = gen_lowpart (SImode, operands[2]);
+ operands[3] = gen_lowpart (SImode, operands[3]);
+})
;; RTL Peephole optimizations, run before sched2. These primarily look to
;; transform a complex memory operation into two memory to register operations.
@@ -17228,12 +17263,14 @@
[(parallel [(set (match_dup 4) (match_dup 5))
(set (match_dup 1) (match_op_dup 3 [(match_dup 1)
(match_dup 2)]))])]
- "operands[4] = SET_DEST (PATTERN (peep2_next_insn (3)));
- operands[5] = gen_rtx_fmt_ee (GET_CODE (operands[3]), <MODE>mode,
- copy_rtx (operands[1]),
- copy_rtx (operands[2]));
- operands[5] = gen_rtx_COMPARE (GET_MODE (operands[4]),
- operands[5], const0_rtx);")
+{
+ operands[4] = SET_DEST (PATTERN (peep2_next_insn (3)));
+ operands[5] = gen_rtx_fmt_ee (GET_CODE (operands[3]), <MODE>mode,
+ copy_rtx (operands[1]),
+ copy_rtx (operands[2]));
+ operands[5] = gen_rtx_COMPARE (GET_MODE (operands[4]),
+ operands[5], const0_rtx);
+})
(define_peephole2
[(parallel [(set (match_operand:SWI 0 "register_operand" "")
@@ -17253,12 +17290,14 @@
[(parallel [(set (match_dup 3) (match_dup 4))
(set (match_dup 1) (match_op_dup 2 [(match_dup 1)
(match_dup 0)]))])]
- "operands[3] = SET_DEST (PATTERN (peep2_next_insn (2)));
- operands[4] = gen_rtx_fmt_ee (GET_CODE (operands[2]), <MODE>mode,
- copy_rtx (operands[1]),
- copy_rtx (operands[0]));
- operands[4] = gen_rtx_COMPARE (GET_MODE (operands[3]),
- operands[4], const0_rtx);")
+{
+ operands[3] = SET_DEST (PATTERN (peep2_next_insn (2)));
+ operands[4] = gen_rtx_fmt_ee (GET_CODE (operands[2]), <MODE>mode,
+ copy_rtx (operands[1]),
+ copy_rtx (operands[0]));
+ operands[4] = gen_rtx_COMPARE (GET_MODE (operands[3]),
+ operands[4], const0_rtx);
+})
(define_peephole2
[(set (match_operand:SWI12 0 "register_operand" "")
@@ -17281,15 +17320,17 @@
? CCGOCmode : CCNOmode)"
[(parallel [(set (match_dup 4) (match_dup 5))
(set (match_dup 1) (match_dup 6))])]
- "operands[2] = gen_lowpart (<MODE>mode, operands[2]);
- operands[4] = SET_DEST (PATTERN (peep2_next_insn (3)));
- operands[5] = gen_rtx_fmt_ee (GET_CODE (operands[3]), <MODE>mode,
- copy_rtx (operands[1]), operands[2]);
- operands[5] = gen_rtx_COMPARE (GET_MODE (operands[4]),
- operands[5], const0_rtx);
- operands[6] = gen_rtx_fmt_ee (GET_CODE (operands[3]), <MODE>mode,
- copy_rtx (operands[1]),
- copy_rtx (operands[2]));")
+{
+ operands[2] = gen_lowpart (<MODE>mode, operands[2]);
+ operands[4] = SET_DEST (PATTERN (peep2_next_insn (3)));
+ operands[5] = gen_rtx_fmt_ee (GET_CODE (operands[3]), <MODE>mode,
+ copy_rtx (operands[1]), operands[2]);
+ operands[5] = gen_rtx_COMPARE (GET_MODE (operands[4]),
+ operands[5], const0_rtx);
+ operands[6] = gen_rtx_fmt_ee (GET_CODE (operands[3]), <MODE>mode,
+ copy_rtx (operands[1]),
+ copy_rtx (operands[2]));
+})
;; Attempt to always use XOR for zeroing registers.
(define_peephole2
@@ -18075,8 +18116,8 @@
(match_operand:SI 3 "const_int_operand" "i")]
UNSPECV_LWPVAL_INTRINSIC)]
"TARGET_LWP"
- "/* Avoid unused variable warning. */
- (void) operand0;")
+ ;; Avoid unused variable warning.
+ "(void) operands[0];")
(define_insn "*lwp_lwpval<mode>3_1"
[(unspec_volatile [(match_operand:SWI48 0 "register_operand" "r")
diff --git a/gcc/config/i386/immintrin.h b/gcc/config/i386/immintrin.h
index 102814e2b90..986a573dbea 100644
--- a/gcc/config/i386/immintrin.h
+++ b/gcc/config/i386/immintrin.h
@@ -76,6 +76,10 @@
#include <fmaintrin.h>
#endif
+#ifdef __F16C__
+#include <f16cintrin.h>
+#endif
+
#ifdef __RDRND__
extern __inline int
__attribute__((__gnu_inline__, __always_inline__, __artificial__))
@@ -161,63 +165,4 @@ _rdrand64_step (unsigned long long *__P)
#endif /* __RDRND__ */
#endif /* __x86_64__ */
-#ifdef __F16C__
-extern __inline float __attribute__((__gnu_inline__, __always_inline__, __artificial__))
-_cvtsh_ss (unsigned short __S)
-{
- __v8hi __H = __extension__ (__v8hi){ __S, 0, 0, 0, 0, 0, 0, 0 };
- __v4sf __A = __builtin_ia32_vcvtph2ps (__H);
- return __builtin_ia32_vec_ext_v4sf (__A, 0);
-}
-
-extern __inline __m128 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
-_mm_cvtph_ps (__m128i __A)
-{
- return (__m128) __builtin_ia32_vcvtph2ps ((__v8hi) __A);
-}
-
-extern __inline __m256 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
-_mm256_cvtph_ps (__m128i __A)
-{
- return (__m256) __builtin_ia32_vcvtph2ps256 ((__v8hi) __A);
-}
-
-#ifdef __OPTIMIZE__
-extern __inline unsigned short __attribute__((__gnu_inline__, __always_inline__, __artificial__))
-_cvtss_sh (float __F, const int __I)
-{
- __v4sf __A = __extension__ (__v4sf){ __F, 0, 0, 0 };
- __v8hi __H = __builtin_ia32_vcvtps2ph (__A, __I);
- return (unsigned short) __builtin_ia32_vec_ext_v8hi (__H, 0);
-}
-
-extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
-_mm_cvtps_ph (__m128 __A, const int __I)
-{
- return (__m128i) __builtin_ia32_vcvtps2ph ((__v4sf) __A, __I);
-}
-
-extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
-_mm256_cvtps_ph (__m256 __A, const int __I)
-{
- return (__m128i) __builtin_ia32_vcvtps2ph256 ((__v8sf) __A, __I);
-}
-#else
-#define _cvtss_sh(__F, __I) \
- (__extension__ \
- ({ \
- __v4sf __A = __extension__ (__v4sf){ __F, 0, 0, 0 }; \
- __v8hi __H = __builtin_ia32_vcvtps2ph (__A, __I); \
- (unsigned short) __builtin_ia32_vec_ext_v8hi (__H, 0); \
- }))
-
-#define _mm_cvtps_ph(A, I) \
- ((__m128i) __builtin_ia32_vcvtps2ph ((__v4sf)(__m128) A, (int) (I)))
-
-#define _mm256_cvtps_ph(A, I) \
- ((__m128i) __builtin_ia32_vcvtps2ph256 ((__v8sf)(__m256) A, (int) (I)))
-#endif
-
-#endif /* __F16C__ */
-
#endif /* _IMMINTRIN_H_INCLUDED */
diff --git a/gcc/config/i386/libgcc-glibc.ver b/gcc/config/i386/libgcc-glibc.ver
deleted file mode 100644
index e79d3267f6f..00000000000
--- a/gcc/config/i386/libgcc-glibc.ver
+++ /dev/null
@@ -1,186 +0,0 @@
-# Copyright (C) 2008, 2010 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/>.
-
-# In order to work around the very problems that force us to now generally
-# create a libgcc.so, glibc reexported a number of routines from libgcc.a.
-# By now choosing the same version tags for these specific routines, we
-# maintain enough binary compatibility to allow future versions of glibc
-# to defer implementation of these routines to libgcc.so via DT_AUXILIARY.
-
-%ifndef __x86_64__
-%exclude {
- __divdi3
- __moddi3
- __udivdi3
- __umoddi3
- __register_frame
- __register_frame_table
- __deregister_frame
- __register_frame_info
- __deregister_frame_info
- __frame_state_for
- __register_frame_info_table
-}
-
-%inherit GCC_3.0 GLIBC_2.0
-GLIBC_2.0 {
- # Sampling of DImode arithmetic used by (at least) i386 and m68k.
- __divdi3
- __moddi3
- __udivdi3
- __umoddi3
-
- # Exception handling support functions used by most everyone.
- __register_frame
- __register_frame_table
- __deregister_frame
- __register_frame_info
- __deregister_frame_info
- __frame_state_for
- __register_frame_info_table
-}
-%endif
-
-# 128 bit long double support was introduced with GCC 4.3.0 to 64bit
-# and with GCC 4.4.0 to 32bit. These lines make the symbols to get
-# a @@GCC_4.3.0 or @@GCC_4.4.0 attached.
-
-%exclude {
- __addtf3
- __divtc3
- __divtf3
- __eqtf2
- __extenddftf2
- __extendsftf2
- __extendxftf2
- __fixtfdi
- __fixtfsi
- __fixtfti
- __fixunstfdi
- __fixunstfsi
- __fixunstfti
- __floatditf
- __floatsitf
- __floattitf
- __floatunditf
- __floatunsitf
- __floatuntitf
- __getf2
- __gttf2
- __letf2
- __lttf2
- __multc3
- __multf3
- __negtf2
- __netf2
- __powitf2
- __subtf3
- __trunctfdf2
- __trunctfsf2
- __trunctfxf2
- __unordtf2
-}
-
-%ifdef __x86_64__
-# Those symbols had improper versions when they were added to gcc 4.3.0.
-# We corrected the default version to GCC_4.3.0. But we keep the old
-# version for backward binary compatibility.
-GCC_3.0 {
- __gttf2
- __lttf2
- __netf2
-}
-
-GCC_4.0.0 {
- __divtc3
- __multc3
- __powitf2
-}
-
-GCC_4.3.0 {
- __addtf3
- __divtc3
- __divtf3
- __eqtf2
- __extenddftf2
- __extendsftf2
- __extendxftf2
- __fixtfdi
- __fixtfsi
- __fixtfti
- __fixunstfdi
- __fixunstfsi
- __fixunstfti
- __floatditf
- __floatsitf
- __floattitf
- __floatunditf
- __floatunsitf
- __floatuntitf
- __getf2
- __gttf2
- __letf2
- __lttf2
- __multc3
- __multf3
- __negtf2
- __netf2
- __powitf2
- __subtf3
- __trunctfdf2
- __trunctfsf2
- __trunctfxf2
- __unordtf2
-}
-%else
-GCC_4.4.0 {
- __addtf3
- __copysigntf3
- __divtc3
- __divtf3
- __eqtf2
- __extenddftf2
- __extendsftf2
- __fabstf2
- __fixtfdi
- __fixtfsi
- __fixunstfdi
- __fixunstfsi
- __floatditf
- __floatsitf
- __floatunditf
- __floatunsitf
- __getf2
- __gttf2
- __letf2
- __lttf2
- __multc3
- __multf3
- __negtf2
- __netf2
- __powitf2
- __subtf3
- __trunctfdf2
- __trunctfsf2
- __trunctfxf2
- __unordtf2
-}
-GCC_4.5.0 {
- __extendxftf2
-}
-%endif
diff --git a/gcc/config/i386/mingw32.h b/gcc/config/i386/mingw32.h
index d9f10c834af..00dcca60bb0 100644
--- a/gcc/config/i386/mingw32.h
+++ b/gcc/config/i386/mingw32.h
@@ -230,4 +230,4 @@ do { \
#define LIBGCC_SONAME "libgcc_s" LIBGCC_EH_EXTN "-1.dll"
/* We should find a way to not have to update this manually. */
-#define LIBGCJ_SONAME "libgcj" /*LIBGCC_EH_EXTN*/ "-12.dll"
+#define LIBGCJ_SONAME "libgcj" /*LIBGCC_EH_EXTN*/ "-13.dll"
diff --git a/gcc/config/i386/predicates.md b/gcc/config/i386/predicates.md
index 48e110ad164..3745b497c19 100644
--- a/gcc/config/i386/predicates.md
+++ b/gcc/config/i386/predicates.md
@@ -1162,7 +1162,7 @@
;; Return true if OP is a binary operator that can be promoted to wider mode.
(define_predicate "promotable_binary_operator"
- (ior (match_code "plus,and,ior,xor,ashift")
+ (ior (match_code "plus,minus,and,ior,xor,ashift")
(and (match_code "mult")
(match_test "TARGET_TUNE_PROMOTE_HIMODE_IMUL"))))
diff --git a/gcc/config/i386/sse.md b/gcc/config/i386/sse.md
index 33c2e94b369..688b5be9648 100644
--- a/gcc/config/i386/sse.md
+++ b/gcc/config/i386/sse.md
@@ -316,14 +316,6 @@
;; Mix-n-match
(define_mode_iterator AVX256MODE2P [V8SI V8SF V4DF])
-(define_mode_iterator AVXMODE48P_DI
- [V2DI V2DF V4DI V4DF V4SF V4SI])
-(define_mode_attr AVXMODE48P_DI
- [(V2DI "V2DI") (V2DF "V2DI")
- (V4DI "V4DI") (V4DF "V4DI")
- (V4SI "V2DI") (V4SF "V2DI")
- (V8SI "V4DI") (V8SF "V4DI")])
-
(define_mode_iterator FMAMODE [SF DF V4SF V2DF V8SF V4DF])
;; Mapping of immediate bits for blend instructions
@@ -2242,30 +2234,12 @@
(set_attr "mode" "<sseinsnmode>")])
(define_expand "floatuns<sseintvecmodelower><mode>2"
- [(set (match_dup 5)
- (float:VF1
- (match_operand:<sseintvecmode> 1 "nonimmediate_operand" "")))
- (set (match_dup 6)
- (lt:VF1 (match_dup 5) (match_dup 3)))
- (set (match_dup 7)
- (and:VF1 (match_dup 6) (match_dup 4)))
- (set (match_operand:VF1 0 "register_operand" "")
- (plus:VF1 (match_dup 5) (match_dup 7)))]
- "TARGET_SSE2"
+ [(match_operand:VF1 0 "register_operand" "")
+ (match_operand:<sseintvecmode> 1 "register_operand" "")]
+ "TARGET_SSE2 && (<MODE>mode == V4SFmode || TARGET_AVX2)"
{
- REAL_VALUE_TYPE TWO32r;
- rtx x;
- int i;
-
- real_ldexp (&TWO32r, &dconst1, 32);
- x = const_double_from_real_value (TWO32r, SFmode);
-
- operands[3] = force_reg (<MODE>mode, CONST0_RTX (<MODE>mode));
- operands[4] = force_reg (<MODE>mode,
- ix86_build_const_vector (<MODE>mode, 1, x));
-
- for (i = 5; i < 8; i++)
- operands[i] = gen_reg_rtx (<MODE>mode);
+ ix86_expand_vector_convert_uns_vsivsf (operands[0], operands[1]);
+ DONE;
})
(define_insn "avx_cvtps2dq256"
@@ -2325,10 +2299,13 @@
(define_expand "fixuns_trunc<mode><sseintvecmodelower>2"
[(match_operand:<sseintvecmode> 0 "register_operand" "")
(match_operand:VF1 1 "register_operand" "")]
- "TARGET_AVX"
+ "TARGET_SSE2"
{
- rtx tmp = ix86_expand_adjust_ufix_to_sfix_si (operands[1]);
- emit_insn (gen_fix_trunc<mode><sseintvecmodelower>2 (operands[0], tmp));
+ rtx tmp[3];
+ tmp[0] = ix86_expand_adjust_ufix_to_sfix_si (operands[1], &tmp[2]);
+ tmp[1] = gen_reg_rtx (<sseintvecmode>mode);
+ emit_insn (gen_fix_trunc<mode><sseintvecmodelower>2 (tmp[1], tmp[0]));
+ emit_insn (gen_xor<sseintvecmodelower>3 (operands[0], tmp[1], tmp[2]));
DONE;
})
@@ -3115,12 +3092,29 @@
[(match_operand:<ssepackfltmode> 0 "register_operand" "")
(match_operand:VF2 1 "register_operand" "")
(match_operand:VF2 2 "register_operand" "")]
- "TARGET_AVX"
+ "TARGET_SSE2"
{
- rtx tmp[2];
- tmp[0] = ix86_expand_adjust_ufix_to_sfix_si (operands[1]);
- tmp[1] = ix86_expand_adjust_ufix_to_sfix_si (operands[2]);
- emit_insn (gen_vec_pack_sfix_trunc_<mode> (operands[0], tmp[0], tmp[1]));
+ rtx tmp[7];
+ tmp[0] = ix86_expand_adjust_ufix_to_sfix_si (operands[1], &tmp[2]);
+ tmp[1] = ix86_expand_adjust_ufix_to_sfix_si (operands[2], &tmp[3]);
+ tmp[4] = gen_reg_rtx (<ssepackfltmode>mode);
+ emit_insn (gen_vec_pack_sfix_trunc_<mode> (tmp[4], tmp[0], tmp[1]));
+ if (<ssepackfltmode>mode == V4SImode || TARGET_AVX2)
+ {
+ tmp[5] = gen_reg_rtx (<ssepackfltmode>mode);
+ ix86_expand_vec_extract_even_odd (tmp[5], tmp[2], tmp[3], 0);
+ }
+ else
+ {
+ tmp[5] = gen_reg_rtx (V8SFmode);
+ ix86_expand_vec_extract_even_odd (tmp[5], gen_lowpart (V8SFmode, tmp[2]),
+ gen_lowpart (V8SFmode, tmp[3]), 0);
+ tmp[5] = gen_lowpart (V8SImode, tmp[5]);
+ }
+ tmp[6] = expand_simple_binop (<ssepackfltmode>mode, XOR, tmp[4], tmp[5],
+ operands[0], 0, OPTAB_DIRECT);
+ if (tmp[6] != operands[0])
+ emit_move_insn (operands[0], tmp[6]);
DONE;
})
@@ -12516,11 +12510,21 @@
;; For gather* insn patterns
(define_mode_iterator VEC_GATHER_MODE
[V2DI V2DF V4DI V4DF V4SI V4SF V8SI V8SF])
-(define_mode_attr VEC_GATHER_MODE
+(define_mode_attr VEC_GATHER_IDXSI
[(V2DI "V4SI") (V2DF "V4SI")
(V4DI "V4SI") (V4DF "V4SI")
(V4SI "V4SI") (V4SF "V4SI")
(V8SI "V8SI") (V8SF "V8SI")])
+(define_mode_attr VEC_GATHER_IDXDI
+ [(V2DI "V2DI") (V2DF "V2DI")
+ (V4DI "V4DI") (V4DF "V4DI")
+ (V4SI "V2DI") (V4SF "V2DI")
+ (V8SI "V4DI") (V8SF "V4DI")])
+(define_mode_attr VEC_GATHER_SRCDI
+ [(V2DI "V2DI") (V2DF "V2DF")
+ (V4DI "V4DI") (V4DF "V4DF")
+ (V4SI "V4SI") (V4SF "V4SF")
+ (V8SI "V4SI") (V8SF "V4SF")])
(define_expand "avx2_gathersi<mode>"
[(parallel [(set (match_operand:VEC_GATHER_MODE 0 "register_operand" "")
@@ -12529,7 +12533,8 @@
(mem:<ssescalarmode>
(match_par_dup 7
[(match_operand 2 "vsib_address_operand" "")
- (match_operand:<VEC_GATHER_MODE> 3 "register_operand" "")
+ (match_operand:<VEC_GATHER_IDXSI>
+ 3 "register_operand" "")
(match_operand:SI 5 "const1248_operand " "")]))
(mem:BLK (scratch))
(match_operand:VEC_GATHER_MODE 4 "register_operand" "")]
@@ -12549,7 +12554,7 @@
(match_operator:<ssescalarmode> 7 "vsib_mem_operator"
[(unspec:P
[(match_operand:P 3 "vsib_address_operand" "p")
- (match_operand:<VEC_GATHER_MODE> 4 "register_operand" "x")
+ (match_operand:<VEC_GATHER_IDXSI> 4 "register_operand" "x")
(match_operand:SI 6 "const1248_operand" "n")]
UNSPEC_VSIBADDR)])
(mem:BLK (scratch))
@@ -12562,17 +12567,39 @@
(set_attr "prefix" "vex")
(set_attr "mode" "<sseinsnmode>")])
+(define_insn "*avx2_gathersi<mode>_2"
+ [(set (match_operand:VEC_GATHER_MODE 0 "register_operand" "=&x")
+ (unspec:VEC_GATHER_MODE
+ [(pc)
+ (match_operator:<ssescalarmode> 6 "vsib_mem_operator"
+ [(unspec:P
+ [(match_operand:P 2 "vsib_address_operand" "p")
+ (match_operand:<VEC_GATHER_IDXSI> 3 "register_operand" "x")
+ (match_operand:SI 5 "const1248_operand" "n")]
+ UNSPEC_VSIBADDR)])
+ (mem:BLK (scratch))
+ (match_operand:VEC_GATHER_MODE 4 "register_operand" "1")]
+ UNSPEC_GATHER))
+ (clobber (match_scratch:VEC_GATHER_MODE 1 "=&x"))]
+ "TARGET_AVX2"
+ "v<sseintprefix>gatherd<ssemodesuffix>\t{%1, %6, %0|%0, %6, %1}"
+ [(set_attr "type" "ssemov")
+ (set_attr "prefix" "vex")
+ (set_attr "mode" "<sseinsnmode>")])
+
(define_expand "avx2_gatherdi<mode>"
[(parallel [(set (match_operand:VEC_GATHER_MODE 0 "register_operand" "")
(unspec:VEC_GATHER_MODE
- [(match_operand:VEC_GATHER_MODE 1 "register_operand" "")
+ [(match_operand:<VEC_GATHER_SRCDI> 1 "register_operand" "")
(mem:<ssescalarmode>
(match_par_dup 7
[(match_operand 2 "vsib_address_operand" "")
- (match_operand:<AVXMODE48P_DI> 3 "register_operand" "")
+ (match_operand:<VEC_GATHER_IDXDI>
+ 3 "register_operand" "")
(match_operand:SI 5 "const1248_operand " "")]))
(mem:BLK (scratch))
- (match_operand:VEC_GATHER_MODE 4 "register_operand" "")]
+ (match_operand:<VEC_GATHER_SRCDI>
+ 4 "register_operand" "")]
UNSPEC_GATHER))
(clobber (match_scratch:VEC_GATHER_MODE 6 ""))])]
"TARGET_AVX2"
@@ -12583,63 +12610,45 @@
})
(define_insn "*avx2_gatherdi<mode>"
- [(set (match_operand:AVXMODE48P_DI 0 "register_operand" "=&x")
- (unspec:AVXMODE48P_DI
- [(match_operand:AVXMODE48P_DI 2 "register_operand" "0")
+ [(set (match_operand:VEC_GATHER_MODE 0 "register_operand" "=&x")
+ (unspec:VEC_GATHER_MODE
+ [(match_operand:<VEC_GATHER_SRCDI> 2 "register_operand" "0")
(match_operator:<ssescalarmode> 7 "vsib_mem_operator"
[(unspec:P
[(match_operand:P 3 "vsib_address_operand" "p")
- (match_operand:<AVXMODE48P_DI> 4 "register_operand" "x")
+ (match_operand:<VEC_GATHER_IDXDI> 4 "register_operand" "x")
(match_operand:SI 6 "const1248_operand" "n")]
UNSPEC_VSIBADDR)])
(mem:BLK (scratch))
- (match_operand:AVXMODE48P_DI 5 "register_operand" "1")]
+ (match_operand:<VEC_GATHER_SRCDI> 5 "register_operand" "1")]
UNSPEC_GATHER))
- (clobber (match_scratch:AVXMODE48P_DI 1 "=&x"))]
+ (clobber (match_scratch:VEC_GATHER_MODE 1 "=&x"))]
"TARGET_AVX2"
- "v<sseintprefix>gatherq<ssemodesuffix>\t{%1, %7, %0|%0, %7, %1}"
+ "v<sseintprefix>gatherq<ssemodesuffix>\t{%5, %7, %2|%2, %7, %5}"
[(set_attr "type" "ssemov")
(set_attr "prefix" "vex")
(set_attr "mode" "<sseinsnmode>")])
-;; Special handling for VEX.256 with float arguments
-;; since there're still xmms as operands
-(define_expand "avx2_gatherdi<mode>256"
- [(parallel [(set (match_operand:VI4F_128 0 "register_operand" "")
- (unspec:VI4F_128
- [(match_operand:VI4F_128 1 "register_operand" "")
- (mem:<ssescalarmode>
- (match_par_dup 7
- [(match_operand 2 "vsib_address_operand" "")
- (match_operand:V4DI 3 "register_operand" "")
- (match_operand:SI 5 "const1248_operand " "")]))
- (mem:BLK (scratch))
- (match_operand:VI4F_128 4 "register_operand" "")]
- UNSPEC_GATHER))
- (clobber (match_scratch:VI4F_128 6 ""))])]
- "TARGET_AVX2"
-{
- operands[7]
- = gen_rtx_UNSPEC (Pmode, gen_rtvec (3, operands[2], operands[3],
- operands[5]), UNSPEC_VSIBADDR);
-})
-
-(define_insn "*avx2_gatherdi<mode>256"
- [(set (match_operand:VI4F_128 0 "register_operand" "=x")
- (unspec:VI4F_128
- [(match_operand:VI4F_128 2 "register_operand" "0")
- (match_operator:<ssescalarmode> 7 "vsib_mem_operator"
+(define_insn "*avx2_gatherdi<mode>_2"
+ [(set (match_operand:VEC_GATHER_MODE 0 "register_operand" "=&x")
+ (unspec:VEC_GATHER_MODE
+ [(pc)
+ (match_operator:<ssescalarmode> 6 "vsib_mem_operator"
[(unspec:P
- [(match_operand:P 3 "vsib_address_operand" "p")
- (match_operand:V4DI 4 "register_operand" "x")
- (match_operand:SI 6 "const1248_operand" "n")]
+ [(match_operand:P 2 "vsib_address_operand" "p")
+ (match_operand:<VEC_GATHER_IDXDI> 3 "register_operand" "x")
+ (match_operand:SI 5 "const1248_operand" "n")]
UNSPEC_VSIBADDR)])
(mem:BLK (scratch))
- (match_operand:VI4F_128 5 "register_operand" "1")]
- UNSPEC_GATHER))
- (clobber (match_scratch:VI4F_128 1 "=&x"))]
+ (match_operand:<VEC_GATHER_SRCDI> 4 "register_operand" "1")]
+ UNSPEC_GATHER))
+ (clobber (match_scratch:VEC_GATHER_MODE 1 "=&x"))]
"TARGET_AVX2"
- "v<sseintprefix>gatherq<ssemodesuffix>\t{%1, %7, %0|%0, %7, %1}"
+{
+ if (<MODE>mode != <VEC_GATHER_SRCDI>mode)
+ return "v<sseintprefix>gatherq<ssemodesuffix>\t{%4, %6, %x0|%x0, %6, %4}";
+ return "v<sseintprefix>gatherq<ssemodesuffix>\t{%4, %6, %0|%0, %6, %4}";
+}
[(set_attr "type" "ssemov")
(set_attr "prefix" "vex")
(set_attr "mode" "<sseinsnmode>")])
diff --git a/gcc/config/i386/sync.md b/gcc/config/i386/sync.md
index 20378d090bf..0ff17123f27 100644
--- a/gcc/config/i386/sync.md
+++ b/gcc/config/i386/sync.md
@@ -18,31 +18,27 @@
;; along with GCC; see the file COPYING3. If not see
;; <http://www.gnu.org/licenses/>.
-(define_mode_iterator CASMODE
- [QI HI SI (DI "TARGET_64BIT || TARGET_CMPXCHG8B")
- (TI "TARGET_64BIT && TARGET_CMPXCHG16B")])
-(define_mode_iterator DCASMODE
- [(DI "!TARGET_64BIT && TARGET_CMPXCHG8B && !flag_pic")
- (TI "TARGET_64BIT && TARGET_CMPXCHG16B")])
-(define_mode_attr doublemodesuffix [(DI "8") (TI "16")])
-(define_mode_attr DCASHMODE [(DI "SI") (TI "DI")])
-
-(define_expand "memory_barrier"
- [(set (match_dup 0)
- (unspec:BLK [(match_dup 0)] UNSPEC_MFENCE))]
+(define_expand "mem_thread_fence"
+ [(match_operand:SI 0 "const_int_operand" "")] ;; model
""
{
- operands[0] = gen_rtx_MEM (BLKmode, gen_rtx_SCRATCH (Pmode));
- MEM_VOLATILE_P (operands[0]) = 1;
+ /* Unless this is a SEQ_CST fence, the i386 memory model is strong
+ enough not to require barriers of any kind. */
+ if (INTVAL (operands[0]) != MEMMODEL_SEQ_CST)
+ DONE;
- if (!(TARGET_64BIT || TARGET_SSE2))
+ if (TARGET_64BIT || TARGET_SSE2)
+ emit_insn (gen_sse2_mfence ());
+ else
{
- emit_insn (gen_memory_barrier_nosse (operands[0]));
- DONE;
+ rtx mem = gen_rtx_MEM (BLKmode, gen_rtx_SCRATCH (Pmode));
+ MEM_VOLATILE_P (mem) = 1;
+ emit_insn (gen_mfence_nosse (mem));
}
+ DONE;
})
-(define_insn "memory_barrier_nosse"
+(define_insn "mfence_nosse"
[(set (match_operand:BLK 0 "" "")
(unspec:BLK [(match_dup 0)] UNSPEC_MFENCE))
(clobber (reg:CC FLAGS_REG))]
@@ -50,127 +46,315 @@
"lock{%;} or{l}\t{$0, (%%esp)|DWORD PTR [esp], 0}"
[(set_attr "memory" "unknown")])
-;; ??? It would be possible to use cmpxchg8b on pentium for DImode
-;; changes. It's complicated because the insn uses ecx:ebx as the
-;; new value; note that the registers are reversed from the order
-;; that they'd be in with (reg:DI 2 ecx). Similarly for TImode
-;; data in 64-bit mode.
-
-(define_expand "sync_compare_and_swap<mode>"
- [(parallel
- [(set (match_operand:CASMODE 0 "register_operand" "")
- (match_operand:CASMODE 1 "memory_operand" ""))
- (set (match_dup 1)
- (unspec_volatile:CASMODE
- [(match_dup 1)
- (match_operand:CASMODE 2 "register_operand" "")
- (match_operand:CASMODE 3 "register_operand" "")]
- UNSPECV_CMPXCHG))
- (set (reg:CCZ FLAGS_REG)
- (compare:CCZ
- (unspec_volatile:CASMODE
- [(match_dup 1) (match_dup 2) (match_dup 3)] UNSPECV_CMPXCHG)
- (match_dup 2)))])]
- "TARGET_CMPXCHG"
+;; ??? From volume 3 section 7.1.1 Guaranteed Atomic Operations,
+;; Only beginning at Pentium family processors do we get any guarantee of
+;; atomicity in aligned 64-bit quantities. Beginning at P6, we get a
+;; guarantee for 64-bit accesses that do not cross a cacheline boundary.
+;;
+;; Note that the TARGET_CMPXCHG8B test below is a stand-in for "Pentium".
+;;
+;; Importantly, *no* processor makes atomicity guarantees for larger
+;; accesses. In particular, there's no way to perform an atomic TImode
+;; move, despite the apparent applicability of MOVDQA et al.
+
+(define_mode_iterator ATOMIC
+ [QI HI SI
+ (DI "TARGET_64BIT || (TARGET_CMPXCHG8B && (TARGET_80387 || TARGET_SSE))")
+ ])
+
+(define_expand "atomic_load<mode>"
+ [(set (match_operand:ATOMIC 0 "register_operand" "")
+ (unspec:ATOMIC [(match_operand:ATOMIC 1 "memory_operand" "")
+ (match_operand:SI 2 "const_int_operand" "")]
+ UNSPEC_MOVA))]
+ ""
+{
+ /* For DImode on 32-bit, we can use the FPU to perform the load. */
+ if (<MODE>mode == DImode && !TARGET_64BIT)
+ emit_insn (gen_atomic_loaddi_fpu
+ (operands[0], operands[1],
+ assign_386_stack_local (DImode,
+ (virtuals_instantiated
+ ? SLOT_TEMP : SLOT_VIRTUAL))));
+ else
+ emit_move_insn (operands[0], operands[1]);
+ DONE;
+})
+
+(define_insn_and_split "atomic_loaddi_fpu"
+ [(set (match_operand:DI 0 "nonimmediate_operand" "=x,m,?r")
+ (unspec:DI [(match_operand:DI 1 "memory_operand" "m,m,m")]
+ UNSPEC_MOVA))
+ (clobber (match_operand:DI 2 "memory_operand" "=X,X,m"))
+ (clobber (match_scratch:DF 3 "=X,xf,xf"))]
+ "!TARGET_64BIT && (TARGET_80387 || TARGET_SSE)"
+ "#"
+ "&& reload_completed"
+ [(const_int 0)]
+{
+ rtx dst = operands[0], src = operands[1];
+ rtx mem = operands[2], tmp = operands[3];
+
+ if (SSE_REG_P (dst))
+ emit_move_insn (dst, src);
+ else
+ {
+ if (MEM_P (dst))
+ mem = dst;
+
+ if (FP_REG_P (tmp))
+ emit_insn (gen_movdi_via_fpu (mem, src, tmp));
+ else
+ {
+ adjust_reg_mode (tmp, DImode);
+ emit_move_insn (tmp, src);
+ emit_move_insn (mem, tmp);
+ }
+
+ if (mem != dst)
+ emit_move_insn (dst, mem);
+ }
+ DONE;
+})
+
+(define_expand "atomic_store<mode>"
+ [(set (match_operand:ATOMIC 0 "memory_operand" "")
+ (unspec:ATOMIC [(match_operand:ATOMIC 1 "register_operand" "")
+ (match_operand:SI 2 "const_int_operand" "")]
+ UNSPEC_MOVA))]
+ ""
+{
+ enum memmodel model = (enum memmodel) INTVAL (operands[2]);
+
+ if (<MODE>mode == DImode && !TARGET_64BIT)
+ {
+ /* For DImode on 32-bit, we can use the FPU to perform the store. */
+ /* Note that while we could perform a cmpxchg8b loop, that turns
+ out to be significantly larger than this plus a barrier. */
+ emit_insn (gen_atomic_storedi_fpu
+ (operands[0], operands[1],
+ assign_386_stack_local (DImode,
+ (virtuals_instantiated
+ ? SLOT_TEMP : SLOT_VIRTUAL))));
+ }
+ else
+ {
+ /* For seq-cst stores, when we lack MFENCE, use XCHG. */
+ if (model == MEMMODEL_SEQ_CST && !(TARGET_64BIT || TARGET_SSE2))
+ {
+ emit_insn (gen_atomic_exchange<mode> (gen_reg_rtx (<MODE>mode),
+ operands[0], operands[1],
+ operands[2]));
+ DONE;
+ }
+
+ /* Otherwise use a normal store. */
+ emit_move_insn (operands[0], operands[1]);
+ }
+ /* ... followed by an MFENCE, if required. */
+ if (model == MEMMODEL_SEQ_CST)
+ emit_insn (gen_mem_thread_fence (operands[2]));
+ DONE;
+})
+
+(define_insn_and_split "atomic_storedi_fpu"
+ [(set (match_operand:DI 0 "memory_operand" "=m,m,m")
+ (unspec:DI [(match_operand:DI 1 "register_operand" "x,m,?r")]
+ UNSPEC_MOVA))
+ (clobber (match_operand:DI 2 "memory_operand" "=X,X,m"))
+ (clobber (match_scratch:DF 3 "=X,xf,xf"))]
+ "!TARGET_64BIT && (TARGET_80387 || TARGET_SSE)"
+ "#"
+ "&& reload_completed"
+ [(const_int 0)]
{
- if ((<MODE>mode == DImode && !TARGET_64BIT) || <MODE>mode == TImode)
+ rtx dst = operands[0], src = operands[1];
+ rtx mem = operands[2], tmp = operands[3];
+
+ if (!SSE_REG_P (src))
{
- enum machine_mode hmode = <MODE>mode == DImode ? SImode : DImode;
- rtx low = simplify_gen_subreg (hmode, operands[3], <MODE>mode, 0);
- rtx high = simplify_gen_subreg (hmode, operands[3], <MODE>mode,
- GET_MODE_SIZE (hmode));
- low = force_reg (hmode, low);
- high = force_reg (hmode, high);
- if (<MODE>mode == DImode)
+ if (REG_P (src))
+ {
+ emit_move_insn (mem, src);
+ src = mem;
+ }
+
+ if (FP_REG_P (tmp))
{
- if (flag_pic && !cmpxchg8b_pic_memory_operand (operands[1], DImode))
- operands[1] = replace_equiv_address (operands[1],
- force_reg (Pmode,
- XEXP (operands[1],
- 0)));
- emit_insn (gen_sync_double_compare_and_swapdi
- (operands[0], operands[1], operands[2], low, high));
+ emit_insn (gen_movdi_via_fpu (dst, src, tmp));
+ DONE;
}
- else if (<MODE>mode == TImode)
- emit_insn (gen_sync_double_compare_and_swapti
- (operands[0], operands[1], operands[2], low, high));
else
- gcc_unreachable ();
- DONE;
+ {
+ adjust_reg_mode (tmp, DImode);
+ emit_move_insn (tmp, mem);
+ src = tmp;
+ }
}
+ emit_move_insn (dst, src);
+ DONE;
+})
+
+;; ??? You'd think that we'd be able to perform this via FLOAT + FIX_TRUNC
+;; operations. But the fix_trunc patterns want way more setup than we want
+;; to provide. Note that the scratch is DFmode instead of XFmode in order
+;; to make it easy to allocate a scratch in either SSE or FP_REGs above.
+(define_insn "movdi_via_fpu"
+ [(set (match_operand:DI 0 "memory_operand" "=m")
+ (unspec:DI [(match_operand:DI 1 "memory_operand" "m")] UNSPEC_MOVA))
+ (clobber (match_operand:DF 2 "register_operand" "=f"))]
+ "TARGET_80387"
+ "fild\t%1\;fistp\t%0"
+ [(set_attr "type" "multi")
+ ;; Worst case based on full sib+offset32 addressing modes
+ (set_attr "length" "14")])
+
+(define_expand "atomic_compare_and_swap<mode>"
+ [(match_operand:QI 0 "register_operand" "") ;; bool success output
+ (match_operand:SWI124 1 "register_operand" "") ;; oldval output
+ (match_operand:SWI124 2 "memory_operand" "") ;; memory
+ (match_operand:SWI124 3 "register_operand" "") ;; expected input
+ (match_operand:SWI124 4 "register_operand" "") ;; newval input
+ (match_operand:SI 5 "const_int_operand" "") ;; is_weak
+ (match_operand:SI 6 "const_int_operand" "") ;; success model
+ (match_operand:SI 7 "const_int_operand" "")] ;; failure model
+ "TARGET_CMPXCHG"
+{
+ emit_insn (gen_atomic_compare_and_swap_single<mode>
+ (operands[1], operands[2], operands[3], operands[4]));
+ ix86_expand_setcc (operands[0], EQ, gen_rtx_REG (CCZmode, FLAGS_REG),
+ const0_rtx);
+ DONE;
})
-(define_insn "*sync_compare_and_swap<mode>"
+(define_mode_iterator CASMODE
+ [(DI "TARGET_64BIT || TARGET_CMPXCHG8B")
+ (TI "TARGET_64BIT && TARGET_CMPXCHG16B")])
+(define_mode_iterator DCASMODE
+ [(DI "!TARGET_64BIT && TARGET_CMPXCHG8B && !flag_pic")
+ (TI "TARGET_64BIT && TARGET_CMPXCHG16B")])
+(define_mode_attr doublemodesuffix [(DI "8") (TI "16")])
+(define_mode_attr DCASHMODE [(DI "SI") (TI "DI")])
+
+(define_expand "atomic_compare_and_swap<mode>"
+ [(match_operand:QI 0 "register_operand" "") ;; bool success output
+ (match_operand:CASMODE 1 "register_operand" "") ;; oldval output
+ (match_operand:CASMODE 2 "memory_operand" "") ;; memory
+ (match_operand:CASMODE 3 "register_operand" "") ;; expected input
+ (match_operand:CASMODE 4 "register_operand" "") ;; newval input
+ (match_operand:SI 5 "const_int_operand" "") ;; is_weak
+ (match_operand:SI 6 "const_int_operand" "") ;; success model
+ (match_operand:SI 7 "const_int_operand" "")] ;; failure model
+ "TARGET_CMPXCHG"
+{
+ if (<MODE>mode == DImode && TARGET_64BIT)
+ {
+ emit_insn (gen_atomic_compare_and_swap_singledi
+ (operands[1], operands[2], operands[3], operands[4]));
+ }
+ else
+ {
+ enum machine_mode hmode = <DCASHMODE>mode;
+ rtx lo_o, lo_e, lo_n, hi_o, hi_e, hi_n, mem;
+
+ lo_o = operands[1];
+ mem = operands[2];
+ lo_e = operands[3];
+ lo_n = operands[4];
+ hi_o = gen_highpart (hmode, lo_o);
+ hi_e = gen_highpart (hmode, lo_e);
+ hi_n = gen_highpart (hmode, lo_n);
+ lo_o = gen_lowpart (hmode, lo_o);
+ lo_e = gen_lowpart (hmode, lo_e);
+ lo_n = gen_lowpart (hmode, lo_n);
+
+ if (<MODE>mode == DImode
+ && !TARGET_64BIT
+ && flag_pic
+ && !cmpxchg8b_pic_memory_operand (mem, DImode))
+ mem = replace_equiv_address (mem, force_reg (Pmode, XEXP (mem, 0)));
+
+ emit_insn (gen_atomic_compare_and_swap_double<mode>
+ (lo_o, hi_o, mem, lo_e, hi_e, lo_n, hi_n));
+ }
+ ix86_expand_setcc (operands[0], EQ, gen_rtx_REG (CCZmode, FLAGS_REG),
+ const0_rtx);
+ DONE;
+})
+
+(define_insn "atomic_compare_and_swap_single<mode>"
[(set (match_operand:SWI 0 "register_operand" "=a")
- (match_operand:SWI 1 "memory_operand" "+m"))
- (set (match_dup 1)
(unspec_volatile:SWI
- [(match_dup 1)
- (match_operand:SWI 2 "register_operand" "a")
+ [(match_operand:SWI 1 "memory_operand" "+m")
+ (match_operand:SWI 2 "register_operand" "0")
(match_operand:SWI 3 "register_operand" "<r>")]
- UNSPECV_CMPXCHG))
+ UNSPECV_CMPXCHG_1))
+ (set (match_dup 1)
+ (unspec_volatile:SWI [(const_int 0)] UNSPECV_CMPXCHG_2))
(set (reg:CCZ FLAGS_REG)
- (compare:CCZ
- (unspec_volatile:SWI
- [(match_dup 1) (match_dup 2) (match_dup 3)] UNSPECV_CMPXCHG)
- (match_dup 2)))]
+ (unspec_volatile:CCZ [(const_int 0)] UNSPECV_CMPXCHG_3))]
"TARGET_CMPXCHG"
"lock{%;} cmpxchg{<imodesuffix>}\t{%3, %1|%1, %3}")
-(define_insn "sync_double_compare_and_swap<mode>"
- [(set (match_operand:DCASMODE 0 "register_operand" "=A")
- (match_operand:DCASMODE 1 "memory_operand" "+m"))
- (set (match_dup 1)
- (unspec_volatile:DCASMODE
- [(match_dup 1)
- (match_operand:DCASMODE 2 "register_operand" "A")
- (match_operand:<DCASHMODE> 3 "register_operand" "b")
- (match_operand:<DCASHMODE> 4 "register_operand" "c")]
- UNSPECV_CMPXCHG))
+;; For double-word compare and swap, we are obliged to play tricks with
+;; the input newval (op5:op6) because the Intel register numbering does
+;; not match the gcc register numbering, so the pair must be CX:BX.
+;; That said, in order to take advantage of possible lower-subreg opts,
+;; treat all of the integral operands in the same way.
+(define_insn "atomic_compare_and_swap_double<mode>"
+ [(set (match_operand:<DCASHMODE> 0 "register_operand" "=a")
+ (unspec_volatile:<DCASHMODE>
+ [(match_operand:DCASMODE 2 "memory_operand" "+m")
+ (match_operand:<DCASHMODE> 3 "register_operand" "0")
+ (match_operand:<DCASHMODE> 4 "register_operand" "1")
+ (match_operand:<DCASHMODE> 5 "register_operand" "b")
+ (match_operand:<DCASHMODE> 6 "register_operand" "c")]
+ UNSPECV_CMPXCHG_1))
+ (set (match_operand:<DCASHMODE> 1 "register_operand" "=d")
+ (unspec_volatile:<DCASHMODE> [(const_int 0)] UNSPECV_CMPXCHG_2))
+ (set (match_dup 2)
+ (unspec_volatile:DCASMODE [(const_int 0)] UNSPECV_CMPXCHG_3))
(set (reg:CCZ FLAGS_REG)
- (compare:CCZ
- (unspec_volatile:DCASMODE
- [(match_dup 1) (match_dup 2) (match_dup 3) (match_dup 4)]
- UNSPECV_CMPXCHG)
- (match_dup 2)))]
+ (unspec_volatile:CCZ [(const_int 0)] UNSPECV_CMPXCHG_4))]
""
- "lock{%;} cmpxchg<doublemodesuffix>b\t%1")
-
-;; Theoretically we'd like to use constraint "r" (any reg) for operand
-;; 3, but that includes ecx. If operand 3 and 4 are the same (like when
-;; the input is -1LL) GCC might chose to allocate operand 3 to ecx, like
-;; operand 4. This breaks, as the xchg will move the PIC register contents
-;; to %ecx then --> boom. Operands 3 and 4 really need to be different
-;; registers, which in this case means operand 3 must not be ecx.
-;; Instead of playing tricks with fake early clobbers or the like we
-;; just enumerate all regs possible here, which (as this is !TARGET_64BIT)
+ "lock{%;} cmpxchg<doublemodesuffix>b\t%2")
+
+;; Theoretically we'd like to use constraint "r" (any reg) for op5,
+;; but that includes ecx. If op5 and op6 are the same (like when
+;; the input is -1LL) GCC might chose to allocate op5 to ecx, like
+;; op6. This breaks, as the xchg will move the PIC register contents
+;; to %ecx then --> boom. Operands 5 and 6 really need to be different
+;; registers, which in this case means op5 must not be ecx. Instead
+;; of playing tricks with fake early clobbers or the like we just
+;; enumerate all regs possible here, which (as this is !TARGET_64BIT)
;; are just esi and edi.
-(define_insn "*sync_double_compare_and_swapdi_pic"
- [(set (match_operand:DI 0 "register_operand" "=A")
- (match_operand:DI 1 "cmpxchg8b_pic_memory_operand" "+m"))
- (set (match_dup 1)
- (unspec_volatile:DI
- [(match_dup 1)
- (match_operand:DI 2 "register_operand" "A")
- (match_operand:SI 3 "register_operand" "SD")
- (match_operand:SI 4 "register_operand" "c")]
- UNSPECV_CMPXCHG))
+(define_insn "*atomic_compare_and_swap_doubledi_pic"
+ [(set (match_operand:SI 0 "register_operand" "=a")
+ (unspec_volatile:SI
+ [(match_operand:DI 2 "cmpxchg8b_pic_memory_operand" "+m")
+ (match_operand:SI 3 "register_operand" "0")
+ (match_operand:SI 4 "register_operand" "1")
+ (match_operand:SI 5 "register_operand" "SD")
+ (match_operand:SI 6 "register_operand" "c")]
+ UNSPECV_CMPXCHG_1))
+ (set (match_operand:SI 1 "register_operand" "=d")
+ (unspec_volatile:SI [(const_int 0)] UNSPECV_CMPXCHG_2))
+ (set (match_dup 2)
+ (unspec_volatile:DI [(const_int 0)] UNSPECV_CMPXCHG_3))
(set (reg:CCZ FLAGS_REG)
- (compare:CCZ
- (unspec_volatile:DI
- [(match_dup 1) (match_dup 2) (match_dup 3) (match_dup 4)]
- UNSPECV_CMPXCHG)
- (match_dup 2)))]
+ (unspec_volatile:CCZ [(const_int 0)] UNSPECV_CMPXCHG_4))]
"!TARGET_64BIT && TARGET_CMPXCHG8B && flag_pic"
- "xchg{l}\t%%ebx, %3\;lock{%;} cmpxchg8b\t%1\;xchg{l}\t%%ebx, %3")
+ "xchg{l}\t%%ebx, %5\;lock{%;} cmpxchg8b\t%2\;xchg{l}\t%%ebx, %5")
;; For operand 2 nonmemory_operand predicate is used instead of
;; register_operand to allow combiner to better optimize atomic
;; additions of constants.
-(define_insn "sync_old_add<mode>"
+(define_insn "atomic_fetch_add<mode>"
[(set (match_operand:SWI 0 "register_operand" "=<r>")
(unspec_volatile:SWI
- [(match_operand:SWI 1 "memory_operand" "+m")] UNSPECV_XCHG))
+ [(match_operand:SWI 1 "memory_operand" "+m")
+ (match_operand:SI 3 "const_int_operand" "")] ;; model
+ UNSPECV_XCHG))
(set (match_dup 1)
(plus:SWI (match_dup 1)
(match_operand:SWI 2 "nonmemory_operand" "0")))
@@ -186,7 +370,9 @@
(match_operand:SWI 2 "const_int_operand" ""))
(parallel [(set (match_dup 0)
(unspec_volatile:SWI
- [(match_operand:SWI 1 "memory_operand" "")] UNSPECV_XCHG))
+ [(match_operand:SWI 1 "memory_operand" "")
+ (match_operand:SI 4 "const_int_operand" "")]
+ UNSPECV_XCHG))
(set (match_dup 1)
(plus:SWI (match_dup 1)
(match_dup 0)))
@@ -199,17 +385,19 @@
== -(unsigned HOST_WIDE_INT) INTVAL (operands[3])
&& !reg_overlap_mentioned_p (operands[0], operands[1])"
[(parallel [(set (reg:CCZ FLAGS_REG)
- (compare:CCZ (unspec_volatile:SWI [(match_dup 1)]
- UNSPECV_XCHG)
- (match_dup 3)))
+ (compare:CCZ
+ (unspec_volatile:SWI [(match_dup 1) (match_dup 4)]
+ UNSPECV_XCHG)
+ (match_dup 3)))
(set (match_dup 1)
(plus:SWI (match_dup 1)
(match_dup 2)))])])
-(define_insn "*sync_old_add_cmp<mode>"
+(define_insn "*atomic_fetch_add_cmp<mode>"
[(set (reg:CCZ FLAGS_REG)
(compare:CCZ (unspec_volatile:SWI
- [(match_operand:SWI 0 "memory_operand" "+m")]
+ [(match_operand:SWI 0 "memory_operand" "+m")
+ (match_operand:SI 3 "const_int_operand" "")]
UNSPECV_XCHG)
(match_operand:SWI 2 "const_int_operand" "i")))
(set (match_dup 0)
@@ -233,20 +421,24 @@
})
;; Recall that xchg implicitly sets LOCK#, so adding it again wastes space.
-(define_insn "sync_lock_test_and_set<mode>"
- [(set (match_operand:SWI 0 "register_operand" "=<r>")
+;; In addition, it is always a full barrier, so we can ignore the memory model.
+(define_insn "atomic_exchange<mode>"
+ [(set (match_operand:SWI 0 "register_operand" "=<r>") ;; output
(unspec_volatile:SWI
- [(match_operand:SWI 1 "memory_operand" "+m")] UNSPECV_XCHG))
+ [(match_operand:SWI 1 "memory_operand" "+m") ;; memory
+ (match_operand:SI 3 "const_int_operand" "")] ;; model
+ UNSPECV_XCHG))
(set (match_dup 1)
- (match_operand:SWI 2 "register_operand" "0"))]
+ (match_operand:SWI 2 "register_operand" "0"))] ;; input
""
"xchg{<imodesuffix>}\t{%1, %0|%0, %1}")
-(define_insn "sync_add<mode>"
+(define_insn "atomic_add<mode>"
[(set (match_operand:SWI 0 "memory_operand" "+m")
(unspec_volatile:SWI
[(plus:SWI (match_dup 0)
- (match_operand:SWI 1 "nonmemory_operand" "<r><i>"))]
+ (match_operand:SWI 1 "nonmemory_operand" "<r><i>"))
+ (match_operand:SI 2 "const_int_operand" "")] ;; model
UNSPECV_LOCK))
(clobber (reg:CC FLAGS_REG))]
""
@@ -265,11 +457,12 @@
return "lock{%;} add{<imodesuffix>}\t{%1, %0|%0, %1}";
})
-(define_insn "sync_sub<mode>"
+(define_insn "atomic_sub<mode>"
[(set (match_operand:SWI 0 "memory_operand" "+m")
(unspec_volatile:SWI
[(minus:SWI (match_dup 0)
- (match_operand:SWI 1 "nonmemory_operand" "<r><i>"))]
+ (match_operand:SWI 1 "nonmemory_operand" "<r><i>"))
+ (match_operand:SI 2 "const_int_operand" "")] ;; model
UNSPECV_LOCK))
(clobber (reg:CC FLAGS_REG))]
""
@@ -282,14 +475,18 @@
return "lock{%;} inc{<imodesuffix>}\t%0";
}
+ if (x86_maybe_negate_const_int (&operands[1], <MODE>mode))
+ return "lock{%;} add{<imodesuffix>}\t{%1, %0|%0, %1}";
+
return "lock{%;} sub{<imodesuffix>}\t{%1, %0|%0, %1}";
})
-(define_insn "sync_<code><mode>"
+(define_insn "atomic_<code><mode>"
[(set (match_operand:SWI 0 "memory_operand" "+m")
(unspec_volatile:SWI
[(any_logic:SWI (match_dup 0)
- (match_operand:SWI 1 "nonmemory_operand" "<r><i>"))]
+ (match_operand:SWI 1 "nonmemory_operand" "<r><i>"))
+ (match_operand:SI 2 "const_int_operand" "")] ;; model
UNSPECV_LOCK))
(clobber (reg:CC FLAGS_REG))]
""
diff --git a/gcc/config/i386/t-crtstuff b/gcc/config/i386/t-crtstuff
deleted file mode 100644
index c14dd9411ae..00000000000
--- a/gcc/config/i386/t-crtstuff
+++ /dev/null
@@ -1,7 +0,0 @@
-# The pushl in CTOR initialization interferes with frame pointer elimination.
-# crtend*.o cannot be compiled without -fno-asynchronous-unwind-tables,
-# because then __FRAME_END__ might not be the last thing in .eh_frame
-# section. -fno-asynchronous-unwind-tables is off by default for i386
-# and is on by default for x86-64. We turn it off for both i386 and
-# x86-64.
-CRTSTUFF_T_CFLAGS += -fno-omit-frame-pointer -fno-asynchronous-unwind-tables
diff --git a/gcc/config/i386/t-cygming b/gcc/config/i386/t-cygming
index af2c9e41c4d..18b57c4152a 100644
--- a/gcc/config/i386/t-cygming
+++ b/gcc/config/i386/t-cygming
@@ -1,4 +1,5 @@
-# Copyright (C) 2003, 2005, 2008, 2009, 2010 Free Software Foundation, Inc.
+# Copyright (C) 2003, 2005, 2008, 2009, 2010, 2011
+# Free Software Foundation, Inc.
#
# This file is part of GCC.
#
@@ -16,18 +17,10 @@
# along with GCC; see the file COPYING3. If not see
# <http://www.gnu.org/licenses/>.
-LIB1ASMSRC = i386/cygwin.asm
-LIB1ASMFUNCS = _chkstk _chkstk_ms
-
# cygwin and mingw always have a limits.h, but, depending upon how we are
# doing the build, it may not be installed yet.
LIMITS_H_TEST = true
-# If we are building next to winsup, this will let us find the real
-# limits.h when building libgcc2. Otherwise, winsup must be installed
-# first.
-LIBGCC2_INCLUDES = -I$(srcdir)/../winsup/w32api/include
-
winnt.o: $(srcdir)/config/i386/winnt.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
$(TM_H) $(RTL_H) $(REGS_H) hard-reg-set.h output.h $(TREE_H) flags.h \
$(TM_P_H) $(HASHTAB_H) $(GGC_H) $(LTO_STREAMER_H)
@@ -54,63 +47,3 @@ msformat-c.o: $(srcdir)/config/i386/msformat-c.c $(CONFIG_H) $(SYSTEM_H) coretyp
$(srcdir)/config/i386/msformat-c.c
STMP_FIXINC=stmp-fixinc
-
-# Build a shared libgcc library for PECOFF with a DEF file
-# with the GNU linker.
-#
-# mkmap-flat.awk is used with the pe_dll option to produce a DEF instead
-# of an ELF map file.
-#
-# Warning: If SHLIB_SOVERSION or SHLIB_SONAME are updated, LIBGCC_SONAME
-# in mingw32.h and SHLIB_MKMAP_OPTS below must be updated also.
-
-SHLIB_EXT = .dll
-SHLIB_IMPLIB = @shlib_base_name@.a
-SHLIB_SOVERSION = 1
-SHLIB_SONAME = @shlib_base_name@_$(EH_MODEL)-$(SHLIB_SOVERSION)$(SHLIB_EXT)
-SHLIB_MAP = @shlib_map_file@
-SHLIB_OBJS = @shlib_objs@
-SHLIB_DIR = @multilib_dir@/shlib
-SHLIB_SLIBDIR_QUAL = @shlib_slibdir_qual@
-# SHLIB_DLLDIR is defined by including one of either t-dlldir or t-dlldir-x
-# (native/cross build respectively) in the tmake_file list in gcc/config.gcc.
-ifndef SHLIB_DLLDIR
-$(error SHLIB_DLLDIR must be defined)
-endif
-ifndef SHLIB_PTHREAD_CFLAG
-SHLIB_PTHREAD_CFLAG =
-endif
-ifndef SHLIB_PTHREAD_LDFLAG
-SHLIB_PTHREAD_LDFLAG =
-endif
-
-SHLIB_LINK = $(LN_S) -f $(SHLIB_MAP) $(SHLIB_MAP).def && \
- if [ ! -d $(SHLIB_DIR) ]; then \
- mkdir $(SHLIB_DIR); \
- else true; fi && \
- $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(SHLIB_PTHREAD_CFLAG) \
- -shared -nodefaultlibs \
- $(SHLIB_MAP).def \
- -Wl,--out-implib,$(SHLIB_DIR)/$(SHLIB_IMPLIB).tmp \
- -o $(SHLIB_DIR)/$(SHLIB_SONAME).tmp @multilib_flags@ \
- $(SHLIB_OBJS) ${SHLIB_PTHREAD_LDFLAG} $(SHLIB_LC) && \
- if [ -f $(SHLIB_DIR)/$(SHLIB_SONAME) ]; then \
- mv -f $(SHLIB_DIR)/$(SHLIB_SONAME) \
- $(SHLIB_DIR)/$(SHLIB_SONAME).backup; \
- else true; fi && \
- mv $(SHLIB_DIR)/$(SHLIB_SONAME).tmp $(SHLIB_DIR)/$(SHLIB_SONAME) && \
- mv $(SHLIB_DIR)/$(SHLIB_IMPLIB).tmp $(SHLIB_DIR)/$(SHLIB_IMPLIB)
-# $(slibdir) double quoted to protect it from expansion while building
-# libgcc.mk. We want this delayed until actual install time.
-SHLIB_INSTALL = \
- $$(mkinstalldirs) $$(DESTDIR)$$(SHLIB_DLLDIR) \
- $$(DESTDIR)$$(slibdir)$(SHLIB_SLIBDIR_QUAL); \
- $(INSTALL) $(SHLIB_DIR)/$(SHLIB_SONAME) \
- $$(DESTDIR)$$(SHLIB_DLLDIR)/$(SHLIB_SONAME); \
- $(INSTALL_DATA) $(SHLIB_DIR)/$(SHLIB_IMPLIB) \
- $$(DESTDIR)$$(slibdir)$(SHLIB_SLIBDIR_QUAL)/$(SHLIB_IMPLIB)
-SHLIB_MKMAP = $(srcdir)/mkmap-flat.awk
-# We'd like to use SHLIB_SONAME here too, but shlib_base_name
-# does not get substituted before mkmap-flat.awk is run.
-SHLIB_MKMAP_OPTS = -v pe_dll=libgcc_s_$(EH_MODEL)-$(SHLIB_SOVERSION)$(SHLIB_EXT)
-SHLIB_MAPFILES = $$(libgcc_objdir)/libgcc-std.ver
diff --git a/gcc/config/i386/t-cygwin b/gcc/config/i386/t-cygwin
deleted file mode 100644
index f5eda91c0ef..00000000000
--- a/gcc/config/i386/t-cygwin
+++ /dev/null
@@ -1,39 +0,0 @@
-# Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2008, 2009, 2010
-# 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/>.
-
-# If we are building next to winsup, this will let us find the real
-# limits.h when building libgcc2. Otherwise, winsup must be installed
-# first.
-LIBGCC2_INCLUDES += -I$(srcdir)/../winsup/include \
- -I$(srcdir)/../winsup/cygwin/include
-
-# Cygwin-specific parts of LIB_SPEC
-SHLIB_LC = -lcygwin -ladvapi32 -lshell32 -luser32 -lkernel32
-
-# We have already included one of the t-{dw2,sjlj}-eh fragments for EH_MODEL
-SHLIB_EH_EXTENSION = $(subst -dw2,,-$(EH_MODEL))
-
-# Cygwin uses different conventions than MinGW; override generic SHLIB_ def'ns here.
-SHLIB_IMPLIB = @shlib_base_name@$(SHLIB_EXT).a
-SHLIB_SONAME = cyggcc_s$(SHLIB_EH_EXTENSION)-$(SHLIB_SOVERSION)$(SHLIB_EXT)
-# This must match the definitions of SHLIB_SONAME/SHLIB_SOVERSION and LIBGCC_SONAME.
-# We'd like to use SHLIB_SONAME here too, and we can, since
-# we don't rely on shlib_base_name substitution for it.
-SHLIB_MKMAP_OPTS = -v pe_dll=$(SHLIB_SONAME)
-
diff --git a/gcc/config/i386/t-darwin b/gcc/config/i386/t-darwin
index 22323e4abee..bf44504d4fd 100644
--- a/gcc/config/i386/t-darwin
+++ b/gcc/config/i386/t-darwin
@@ -1,5 +1,2 @@
MULTILIB_OPTIONS = m64
MULTILIB_DIRNAMES = x86_64
-LIB2_SIDITI_CONV_FUNCS=yes
-LIB2FUNCS_EXTRA = $(srcdir)/config/darwin-64.c
-LIB2FUNCS_EXCLUDE = _fixtfdi _fixunstfdi _floatditf _floatunditf
diff --git a/gcc/config/i386/t-darwin64 b/gcc/config/i386/t-darwin64
index 81b4565ac72..6a6b22f1ee5 100644
--- a/gcc/config/i386/t-darwin64
+++ b/gcc/config/i386/t-darwin64
@@ -1,8 +1,2 @@
-LIB2_SIDITI_CONV_FUNCS=yes
-LIB2FUNCS_EXTRA = $(srcdir)/config/darwin-64.c
-
MULTILIB_OPTIONS = m32
MULTILIB_DIRNAMES = i386
-
-LIBGCC = stmp-multilib
-INSTALL_LIBGCC = install-multilib
diff --git a/gcc/config/i386/t-dlldir b/gcc/config/i386/t-dlldir
deleted file mode 100644
index a3e03317a04..00000000000
--- a/gcc/config/i386/t-dlldir
+++ /dev/null
@@ -1,6 +0,0 @@
-
-# In a native build, target DLLs go in bindir, where they can be executed.
-# Note double quoting to prevent variables from being evaluated until install
-# time; we don't want to expand them during libgcc.mvars generation.
-
-SHLIB_DLLDIR = $$(bindir)
diff --git a/gcc/config/i386/t-dlldir-x b/gcc/config/i386/t-dlldir-x
deleted file mode 100644
index 07dd845f0a6..00000000000
--- a/gcc/config/i386/t-dlldir-x
+++ /dev/null
@@ -1,9 +0,0 @@
-
-# In a cross build, bindir contains host not target binaries, so target DLLs
-# instead go in toolexeclibdir, alongside other target binaries and static libs.
-# Note double quoting to prevent variables from being evaluated until install
-# time; we don't want to expand them during libgcc.mvars generation, and in
-# any case, $toolexeclibdir is not defined in the gcc/ subdirectory, only in
-# target lib directories.
-
-SHLIB_DLLDIR = $$(toolexeclibdir)
diff --git a/gcc/config/i386/t-dw2-eh b/gcc/config/i386/t-dw2-eh
deleted file mode 100644
index ffcc39aea33..00000000000
--- a/gcc/config/i386/t-dw2-eh
+++ /dev/null
@@ -1,3 +0,0 @@
-
-# We are using Dwarf-2 EH.
-EH_MODEL = dw2
diff --git a/gcc/config/i386/t-gthr-win32 b/gcc/config/i386/t-gthr-win32
deleted file mode 100644
index f67fa1e25a8..00000000000
--- a/gcc/config/i386/t-gthr-win32
+++ /dev/null
@@ -1,2 +0,0 @@
-# We hide calls to w32api needed for w32 thread support here:
-LIB2FUNCS_EXTRA = $(srcdir)/config/i386/gthr-win32.c
diff --git a/gcc/config/i386/t-i386elf b/gcc/config/i386/t-i386elf
deleted file mode 100644
index 9560d905521..00000000000
--- a/gcc/config/i386/t-i386elf
+++ /dev/null
@@ -1,4 +0,0 @@
-# For svr4 we build crtbegin.o and crtend.o which serve to add begin and
-# end labels to the .ctors and .dtors section when we link using gcc.
-
-EXTRA_PARTS=crtbegin.o crtend.o
diff --git a/gcc/config/i386/t-interix b/gcc/config/i386/t-interix
index e7b016f1e7a..09c9127f6af 100644
--- a/gcc/config/i386/t-interix
+++ b/gcc/config/i386/t-interix
@@ -1,6 +1,3 @@
-LIB1ASMSRC = i386/cygwin.asm
-LIB1ASMFUNCS = _chkstk _chkstk_ms
-
winnt.o: $(srcdir)/config/i386/winnt.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
$(TM_H) $(RTL_H) $(REGS_H) hard-reg-set.h output.h $(TREE_H) flags.h \
$(TM_P_H) $(HASHTAB_H) $(GGC_H)
diff --git a/gcc/config/i386/t-linux b/gcc/config/i386/t-linux
deleted file mode 100644
index 500d932fec8..00000000000
--- a/gcc/config/i386/t-linux
+++ /dev/null
@@ -1,5 +0,0 @@
-# On 64bit we do not need any exports for glibc for 64-bit libgcc_s.
-# Need to support TImode for x86. Override the settings from
-# t-slibgcc-elf-ver and t-linux
-SHLIB_MAPFILES = $$(libgcc_objdir)/libgcc-std.ver \
- $(srcdir)/config/i386/libgcc-glibc.ver
diff --git a/gcc/config/i386/t-linux64 b/gcc/config/i386/t-linux64
index ea8f5e9d7ae..b5d39855a70 100644
--- a/gcc/config/i386/t-linux64
+++ b/gcc/config/i386/t-linux64
@@ -37,10 +37,3 @@ MULTILIB_DIRNAMES = $(patsubst m%, %, $(subst /, ,$(MULTILIB_OPTIONS)))
MULTILIB_OSDIRNAMES = m64=../lib64
MULTILIB_OSDIRNAMES+= m32=$(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib)
MULTILIB_OSDIRNAMES+= mx32=../libx32
-
-LIBGCC = stmp-multilib
-INSTALL_LIBGCC = install-multilib
-
-EXTRA_MULTILIB_PARTS=crtbegin.o crtend.o crtbeginS.o crtendS.o \
- crtbeginT.o crtprec32.o crtprec64.o crtprec80.o \
- crtfastmath.o
diff --git a/gcc/config/i386/t-mingw-pthread b/gcc/config/i386/t-mingw-pthread
deleted file mode 100644
index 622ef82be6e..00000000000
--- a/gcc/config/i386/t-mingw-pthread
+++ /dev/null
@@ -1,2 +0,0 @@
-SHLIB_PTHREAD_CFLAG = -pthread
-SHLIB_PTHREAD_LDFLAG = -Wl,-lpthread
diff --git a/gcc/config/i386/t-mingw-w32 b/gcc/config/i386/t-mingw-w32
index 83cee71f1c1..4fc8582cf5e 100644
--- a/gcc/config/i386/t-mingw-w32
+++ b/gcc/config/i386/t-mingw-w32
@@ -1,9 +1,3 @@
MULTILIB_OPTIONS = m64/m32
MULTILIB_DIRNAMES = 64 32
MULTILIB_OSDIRNAMES = ../lib64 ../lib
-
-# MinGW-specific parts of LIB_SPEC
-SHLIB_LC = -lmingwthrd -lmingw32 -lmingwex -lmoldname -lmsvcrt -ladvapi32 -lshell32 -luser32 -lkernel32
-
-LIBGCC = stmp-multilib
-INSTALL_LIBGCC = install-multilib
diff --git a/gcc/config/i386/t-mingw-w64 b/gcc/config/i386/t-mingw-w64
index 041a02f1018..c809ebd7d1d 100644
--- a/gcc/config/i386/t-mingw-w64
+++ b/gcc/config/i386/t-mingw-w64
@@ -1,9 +1,3 @@
MULTILIB_OPTIONS = m64/m32
MULTILIB_DIRNAMES = 64 32
MULTILIB_OSDIRNAMES = ../lib ../lib32
-
-# MinGW-specific parts of LIB_SPEC
-SHLIB_LC = -lmingwthrd -lmingw32 -lmingwex -lmoldname -lmsvcrt -ladvapi32 -lshell32 -luser32 -lkernel32
-
-LIBGCC = stmp-multilib
-INSTALL_LIBGCC = install-multilib
diff --git a/gcc/config/i386/t-mingw32 b/gcc/config/i386/t-mingw32
deleted file mode 100644
index bfdef6723ce..00000000000
--- a/gcc/config/i386/t-mingw32
+++ /dev/null
@@ -1,2 +0,0 @@
-# MinGW-specific parts of LIB_SPEC
-SHLIB_LC = -lmingwthrd -lmingw32 -lmingwex -lmoldname -lmsvcrt -ladvapi32 -lshell32 -luser32 -lkernel32
diff --git a/gcc/config/i386/t-nto b/gcc/config/i386/t-nto
deleted file mode 100644
index b80ff802927..00000000000
--- a/gcc/config/i386/t-nto
+++ /dev/null
@@ -1,4 +0,0 @@
-CRTSTUFF_T_CFLAGS = -fno-omit-frame-pointer -fPIC
-TARGET_LIBGCC2_CFLAGS = -fPIC -fexceptions
-
-EXTRA_PARTS = crtbegin.o
diff --git a/gcc/config/i386/t-openbsd b/gcc/config/i386/t-openbsd
index 18304634000..4f8ff657a93 100644
--- a/gcc/config/i386/t-openbsd
+++ b/gcc/config/i386/t-openbsd
@@ -2,5 +2,3 @@
# We cope by building variants of libgcc.
MULTILIB_OPTIONS = fpic
MULTILIB_MATCHES=fpic=fPIC
-LIBGCC = stmp-multilib
-INSTALL_LIBGCC = install-multilib
diff --git a/gcc/config/i386/t-sjlj-eh b/gcc/config/i386/t-sjlj-eh
deleted file mode 100644
index c9085f43216..00000000000
--- a/gcc/config/i386/t-sjlj-eh
+++ /dev/null
@@ -1,3 +0,0 @@
-
-# We are using SjLj EH.
-EH_MODEL = sjlj
diff --git a/gcc/config/ia64/crtbegin.asm b/gcc/config/ia64/crtbegin.asm
deleted file mode 100644
index 638489990d5..00000000000
--- a/gcc/config/ia64/crtbegin.asm
+++ /dev/null
@@ -1,254 +0,0 @@
-/* Copyright (C) 2000, 2001, 2003, 2005, 2009 Free Software Foundation, Inc.
- Contributed by Jes Sorensen, <Jes.Sorensen@cern.ch>
-
- 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/>. */
-
-#include "auto-host.h"
-
-.section .ctors,"aw","progbits"
- .align 8
-__CTOR_LIST__:
- data8 -1
-
-.section .dtors,"aw","progbits"
- .align 8
-__DTOR_LIST__:
- data8 -1
-
-.section .jcr,"aw","progbits"
- .align 8
-__JCR_LIST__:
-
-.section .sdata
- .type dtor_ptr,@object
- .size dtor_ptr,8
-dtor_ptr:
- data8 @gprel(__DTOR_LIST__ + 8)
-
- /* A handle for __cxa_finalize to manage c++ local destructors. */
- .global __dso_handle
- .type __dso_handle,@object
- .size __dso_handle,8
-#ifdef SHARED
- .section .data
-__dso_handle:
- data8 __dso_handle
-#else
- .section .bss
- .align 8
-__dso_handle:
- .skip 8
-#endif
- .hidden __dso_handle
-
-
-#ifdef HAVE_INITFINI_ARRAY
-
-.section .fini_array, "a"
- data8 @fptr(__do_global_dtors_aux)
-
-.section .init_array, "a"
- data8 @fptr(__do_jv_register_classes)
- data8 @fptr(__do_global_ctors_aux)
-
-#else /* !HAVE_INITFINI_ARRAY */
-/*
- * Fragment of the ELF _fini routine that invokes our dtor cleanup.
- *
- * We make the call by indirection, because in large programs the
- * .fini and .init sections are not in range of the destination, and
- * we cannot allow the linker to insert a stub at the end of this
- * fragment of the _fini function. Further, Itanium does not implement
- * the long branch instructions, and we do not wish every program to
- * trap to the kernel for emulation.
- *
- * Note that we require __do_global_dtors_aux to preserve the GP,
- * so that the next fragment in .fini gets the right value.
- */
-.section .fini,"ax","progbits"
- { .mlx
- movl r2 = @pcrel(__do_global_dtors_aux - 16)
- }
- { .mii
- mov r3 = ip
- ;;
- add r2 = r2, r3
- ;;
- }
- { .mib
- nop 0
- mov b6 = r2
- br.call.sptk.many b0 = b6
- }
-
-/* Likewise for _init. */
-
-.section .init,"ax","progbits"
- { .mlx
- movl r2 = @pcrel(__do_jv_register_classes - 16)
- }
- { .mii
- mov r3 = ip
- ;;
- add r2 = r2, r3
- ;;
- }
- { .mib
- nop 0
- mov b6 = r2
- br.call.sptk.many b0 = b6
- }
-#endif /* !HAVE_INITFINI_ARRAY */
-
-.section .text
- .align 32
- .proc __do_global_dtors_aux
-__do_global_dtors_aux:
- .prologue
-#ifndef SHARED
- .save ar.pfs, r35
- alloc loc3 = ar.pfs, 0, 4, 1, 0
- addl loc0 = @gprel(dtor_ptr), gp
- .save rp, loc1
- mov loc1 = rp
- .body
-
- mov loc2 = gp
- nop 0
- br.sptk.many .entry
-#else
- /*
- if (__cxa_finalize)
- __cxa_finalize(__dso_handle)
- */
- .save ar.pfs, r35
- alloc loc3 = ar.pfs, 0, 4, 1, 0
- addl loc0 = @gprel(dtor_ptr), gp
- addl r16 = @ltoff(@fptr(__cxa_finalize)), gp
- ;;
-
- ld8 r16 = [r16]
- ;;
- addl out0 = @ltoff(__dso_handle), gp
- cmp.ne p7, p0 = r0, r16
- ;;
-
- ld8 out0 = [out0]
-(p7) ld8 r18 = [r16], 8
- .save rp, loc1
- mov loc1 = rp
- .body
- ;;
-
- mov loc2 = gp
-(p7) ld8 gp = [r16]
-(p7) mov b6 = r18
-
- nop 0
- nop 0
-(p7) br.call.sptk.many rp = b6
- ;;
-
- nop 0
- nop 0
- br.sptk.many .entry
-#endif
- /*
- do {
- dtor_ptr++;
- (*(dtor_ptr-1)) ();
- } while (dtor_ptr);
- */
-.loop:
- st8 [loc0] = r15 // update dtor_ptr (in memory)
- ld8 r17 = [r16], 8 // r17 <- dtor's entry-point
- nop 0
- ;;
-
- ld8 gp = [r16] // gp <- dtor's gp
- mov b6 = r17
- br.call.sptk.many rp = b6
-
-.entry: ld8 r15 = [loc0] // r15 <- dtor_ptr (gp-relative)
- ;;
- add r16 = r15, loc2 // r16 <- dtor_ptr (absolute)
- adds r15 = 8, r15
- ;;
-
- ld8 r16 = [r16] // r16 <- pointer to dtor's fdesc
- mov rp = loc1
- mov ar.pfs = loc3
- ;;
-
- cmp.ne p6, p0 = r0, r16
-(p6) br.cond.sptk.few .loop
- br.ret.sptk.many rp
- .endp __do_global_dtors_aux
-
- .align 32
- .proc __do_jv_register_classes
-__do_jv_register_classes:
- .prologue
- .save ar.pfs, r33
- alloc loc1 = ar.pfs, 0, 3, 1, 0
- movl out0 = @gprel(__JCR_LIST__)
- ;;
-
- addl r14 = @ltoff(@fptr(_Jv_RegisterClasses)), gp
- add out0 = out0, gp
- .save rp, loc0
- mov loc0 = rp
- .body
- ;;
-
- ld8 r14 = [r14]
- ld8 r15 = [out0]
- cmp.ne p6, p0 = r0, r0
- ;;
-
- cmp.eq.or p6, p0 = r0, r14
- cmp.eq.or p6, p0 = r0, r15
-(p6) br.ret.sptk.many rp
-
- ld8 r15 = [r14], 8
- ;;
- nop 0
- mov b6 = r15
-
- mov loc2 = gp
- ld8 gp = [r14]
- br.call.sptk.many rp = b6
- ;;
-
- mov gp = loc2
- mov rp = loc0
- mov ar.pfs = loc1
-
- nop 0
- nop 0
- br.ret.sptk.many rp
- .endp __do_jv_register_classes
-
-#ifdef SHARED
-.weak __cxa_finalize
-#endif
-.weak _Jv_RegisterClasses
diff --git a/gcc/config/ia64/crtend.asm b/gcc/config/ia64/crtend.asm
deleted file mode 100644
index a904af9cfd9..00000000000
--- a/gcc/config/ia64/crtend.asm
+++ /dev/null
@@ -1,121 +0,0 @@
-/* Copyright (C) 2000, 2001, 2003, 2005, 2009 Free Software Foundation, Inc.
- Contributed by Jes Sorensen, <Jes.Sorensen@cern.ch>
-
- 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/>. */
-
-#include "auto-host.h"
-
-.section .ctors,"aw","progbits"
- .align 8
-__CTOR_END__:
- data8 0
-
-.section .dtors,"aw","progbits"
- .align 8
-__DTOR_END__:
- data8 0
-
-.section .jcr,"aw","progbits"
- .align 8
-__JCR_END__:
- data8 0
-
-#ifdef HAVE_INITFINI_ARRAY
- .global __do_global_ctors_aux
- .hidden __do_global_ctors_aux
-#else /* !HAVE_INITFINI_ARRAY */
-/*
- * Fragment of the ELF _init routine that invokes our dtor cleanup.
- *
- * We make the call by indirection, because in large programs the
- * .fini and .init sections are not in range of the destination, and
- * we cannot allow the linker to insert a stub at the end of this
- * fragment of the _fini function. Further, Itanium does not implement
- * the long branch instructions, and we do not wish every program to
- * trap to the kernel for emulation.
- *
- * Note that we require __do_global_ctors_aux to preserve the GP,
- * so that the next fragment in .fini gets the right value.
- */
-.section .init,"ax","progbits"
- { .mlx
- movl r2 = @pcrel(__do_global_ctors_aux - 16)
- }
- { .mii
- mov r3 = ip
- ;;
- add r2 = r2, r3
- ;;
- }
- { .mib
- mov b6 = r2
- br.call.sptk.many b0 = b6
- ;;
- }
-#endif /* !HAVE_INITFINI_ARRAY */
-
-.text
- .align 32
- .proc __do_global_ctors_aux
-__do_global_ctors_aux:
- .prologue
- /*
- for (loc0 = __CTOR_END__-1; *p != -1; --p)
- (*p) ();
- */
- .save ar.pfs, r34
- alloc loc2 = ar.pfs, 0, 5, 0, 0
- movl loc0 = @gprel(__CTOR_END__ - 8)
- ;;
-
- add loc0 = loc0, gp
- ;;
- ld8 loc3 = [loc0], -8
- .save rp, loc1
- mov loc1 = rp
- .body
- ;;
-
- cmp.eq p6, p0 = -1, loc3
- mov loc4 = gp
-(p6) br.cond.spnt.few .exit
-
-.loop: ld8 r15 = [loc3], 8
- ;;
- ld8 gp = [loc3]
- mov b6 = r15
-
- ld8 loc3 = [loc0], -8
- nop 0
- br.call.sptk.many rp = b6
- ;;
-
- cmp.ne p6, p0 = -1, loc3
- nop 0
-(p6) br.cond.sptk.few .loop
-
-.exit: mov gp = loc3
- mov rp = loc1
- mov ar.pfs = loc2
-
- br.ret.sptk.many rp
- .endp __do_global_ctors_aux
diff --git a/gcc/config/ia64/crti.asm b/gcc/config/ia64/crti.asm
deleted file mode 100644
index a9d51509782..00000000000
--- a/gcc/config/ia64/crti.asm
+++ /dev/null
@@ -1,53 +0,0 @@
-# Copyright (C) 2000, 2001, 2008, 2009 Free Software Foundation, Inc.
-# Written By Timothy Wall
-#
-# This file is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the
-# Free Software Foundation; either version 3, or (at your option) any
-# later version.
-#
-# This file 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/>.
-
-# This file just make a stack frame for the contents of the .fini and
-# .init sections. Users may put any desired instructions in those
-# sections.
-
- .section ".init"
- .align 16
- .global _init
-_init:
- .prologue 14, 33
- .save ar.pfs, r34
- alloc r34 = ar.pfs, 0, 4, 0, 0
- .vframe r35
- mov r35 = r12
- .save rp, r33
- mov r33 = b0
- .body
-
- .section ".fini"
- .align 16
- .global _fini
-_fini:
- .prologue 14, 33
- .save ar.pfs, r34
- alloc r34 = ar.pfs, 0, 4, 0, 0
- .vframe r35
- mov r35 = r12
- .save rp, r33
- mov r33 = b0
- .body
-
-# end of crti.asm
diff --git a/gcc/config/ia64/crtn.asm b/gcc/config/ia64/crtn.asm
deleted file mode 100644
index e1a18795f79..00000000000
--- a/gcc/config/ia64/crtn.asm
+++ /dev/null
@@ -1,43 +0,0 @@
-# Copyright (C) 2000, 2001, 2008, 2009 Free Software Foundation, Inc.
-# Written By Timothy Wall
-#
-# This file is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the
-# Free Software Foundation; either version 3, or (at your option) any
-# later version.
-#
-# This file 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/>.
-
-# This file just makes sure that the .fini and .init sections do in
-# fact return. Users may put any desired instructions in those sections.
-# This file is the last thing linked into any executable.
-
- .section ".init"
- ;;
- mov ar.pfs = r34
- mov b0 = r33
- .restore sp
- mov r12 = r35
- br.ret.sptk.many b0
-
- .section ".fini"
- ;;
- mov ar.pfs = r34
- mov b0 = r33
- .restore sp
- mov r12 = r35
- br.ret.sptk.many b0
-
-# end of crtn.asm
diff --git a/gcc/config/ia64/lib1funcs.asm b/gcc/config/ia64/lib1funcs.asm
deleted file mode 100644
index b7eaa6eca3c..00000000000
--- a/gcc/config/ia64/lib1funcs.asm
+++ /dev/null
@@ -1,795 +0,0 @@
-/* Copyright (C) 2000, 2001, 2003, 2005, 2009 Free Software Foundation, Inc.
- Contributed by James E. Wilson <wilson@cygnus.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.
-
- Under Section 7 of GPL version 3, you are granted additional
- permissions described in the GCC Runtime Library Exception, version
- 3.1, as published by the Free Software Foundation.
-
- You should have received a copy of the GNU General Public License and
- a copy of the GCC Runtime Library Exception along with this program;
- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
- <http://www.gnu.org/licenses/>. */
-
-#ifdef L__divxf3
-// Compute a 80-bit IEEE double-extended quotient.
-//
-// From the Intel IA-64 Optimization Guide, choose the minimum latency
-// alternative.
-//
-// farg0 holds the dividend. farg1 holds the divisor.
-//
-// __divtf3 is an alternate symbol name for backward compatibility.
-
- .text
- .align 16
- .global __divxf3
- .proc __divxf3
-__divxf3:
-#ifdef SHARED
- .global __divtf3
-__divtf3:
-#endif
- cmp.eq p7, p0 = r0, r0
- frcpa.s0 f10, p6 = farg0, farg1
- ;;
-(p6) cmp.ne p7, p0 = r0, r0
- .pred.rel.mutex p6, p7
-(p6) fnma.s1 f11 = farg1, f10, f1
-(p6) fma.s1 f12 = farg0, f10, f0
- ;;
-(p6) fma.s1 f13 = f11, f11, f0
-(p6) fma.s1 f14 = f11, f11, f11
- ;;
-(p6) fma.s1 f11 = f13, f13, f11
-(p6) fma.s1 f13 = f14, f10, f10
- ;;
-(p6) fma.s1 f10 = f13, f11, f10
-(p6) fnma.s1 f11 = farg1, f12, farg0
- ;;
-(p6) fma.s1 f11 = f11, f10, f12
-(p6) fnma.s1 f12 = farg1, f10, f1
- ;;
-(p6) fma.s1 f10 = f12, f10, f10
-(p6) fnma.s1 f12 = farg1, f11, farg0
- ;;
-(p6) fma.s0 fret0 = f12, f10, f11
-(p7) mov fret0 = f10
- br.ret.sptk rp
- .endp __divxf3
-#endif
-
-#ifdef L__divdf3
-// Compute a 64-bit IEEE double quotient.
-//
-// From the Intel IA-64 Optimization Guide, choose the minimum latency
-// alternative.
-//
-// farg0 holds the dividend. farg1 holds the divisor.
-
- .text
- .align 16
- .global __divdf3
- .proc __divdf3
-__divdf3:
- cmp.eq p7, p0 = r0, r0
- frcpa.s0 f10, p6 = farg0, farg1
- ;;
-(p6) cmp.ne p7, p0 = r0, r0
- .pred.rel.mutex p6, p7
-(p6) fmpy.s1 f11 = farg0, f10
-(p6) fnma.s1 f12 = farg1, f10, f1
- ;;
-(p6) fma.s1 f11 = f12, f11, f11
-(p6) fmpy.s1 f13 = f12, f12
- ;;
-(p6) fma.s1 f10 = f12, f10, f10
-(p6) fma.s1 f11 = f13, f11, f11
- ;;
-(p6) fmpy.s1 f12 = f13, f13
-(p6) fma.s1 f10 = f13, f10, f10
- ;;
-(p6) fma.d.s1 f11 = f12, f11, f11
-(p6) fma.s1 f10 = f12, f10, f10
- ;;
-(p6) fnma.d.s1 f8 = farg1, f11, farg0
- ;;
-(p6) fma.d fret0 = f8, f10, f11
-(p7) mov fret0 = f10
- br.ret.sptk rp
- ;;
- .endp __divdf3
-#endif
-
-#ifdef L__divsf3
-// Compute a 32-bit IEEE float quotient.
-//
-// From the Intel IA-64 Optimization Guide, choose the minimum latency
-// alternative.
-//
-// farg0 holds the dividend. farg1 holds the divisor.
-
- .text
- .align 16
- .global __divsf3
- .proc __divsf3
-__divsf3:
- cmp.eq p7, p0 = r0, r0
- frcpa.s0 f10, p6 = farg0, farg1
- ;;
-(p6) cmp.ne p7, p0 = r0, r0
- .pred.rel.mutex p6, p7
-(p6) fmpy.s1 f8 = farg0, f10
-(p6) fnma.s1 f9 = farg1, f10, f1
- ;;
-(p6) fma.s1 f8 = f9, f8, f8
-(p6) fmpy.s1 f9 = f9, f9
- ;;
-(p6) fma.s1 f8 = f9, f8, f8
-(p6) fmpy.s1 f9 = f9, f9
- ;;
-(p6) fma.d.s1 f10 = f9, f8, f8
- ;;
-(p6) fnorm.s.s0 fret0 = f10
-(p7) mov fret0 = f10
- br.ret.sptk rp
- ;;
- .endp __divsf3
-#endif
-
-#ifdef L__divdi3
-// Compute a 64-bit integer quotient.
-//
-// From the Intel IA-64 Optimization Guide, choose the minimum latency
-// alternative.
-//
-// in0 holds the dividend. in1 holds the divisor.
-
- .text
- .align 16
- .global __divdi3
- .proc __divdi3
-__divdi3:
- .regstk 2,0,0,0
- // Transfer inputs to FP registers.
- setf.sig f8 = in0
- setf.sig f9 = in1
- // Check divide by zero.
- cmp.ne.unc p0,p7=0,in1
- ;;
- // Convert the inputs to FP, so that they won't be treated as unsigned.
- fcvt.xf f8 = f8
- fcvt.xf f9 = f9
-(p7) break 1
- ;;
- // Compute the reciprocal approximation.
- frcpa.s1 f10, p6 = f8, f9
- ;;
- // 3 Newton-Raphson iterations.
-(p6) fnma.s1 f11 = f9, f10, f1
-(p6) fmpy.s1 f12 = f8, f10
- ;;
-(p6) fmpy.s1 f13 = f11, f11
-(p6) fma.s1 f12 = f11, f12, f12
- ;;
-(p6) fma.s1 f10 = f11, f10, f10
-(p6) fma.s1 f11 = f13, f12, f12
- ;;
-(p6) fma.s1 f10 = f13, f10, f10
-(p6) fnma.s1 f12 = f9, f11, f8
- ;;
-(p6) fma.s1 f10 = f12, f10, f11
- ;;
- // Round quotient to an integer.
- fcvt.fx.trunc.s1 f10 = f10
- ;;
- // Transfer result to GP registers.
- getf.sig ret0 = f10
- br.ret.sptk rp
- ;;
- .endp __divdi3
-#endif
-
-#ifdef L__moddi3
-// Compute a 64-bit integer modulus.
-//
-// From the Intel IA-64 Optimization Guide, choose the minimum latency
-// alternative.
-//
-// in0 holds the dividend (a). in1 holds the divisor (b).
-
- .text
- .align 16
- .global __moddi3
- .proc __moddi3
-__moddi3:
- .regstk 2,0,0,0
- // Transfer inputs to FP registers.
- setf.sig f14 = in0
- setf.sig f9 = in1
- // Check divide by zero.
- cmp.ne.unc p0,p7=0,in1
- ;;
- // Convert the inputs to FP, so that they won't be treated as unsigned.
- fcvt.xf f8 = f14
- fcvt.xf f9 = f9
-(p7) break 1
- ;;
- // Compute the reciprocal approximation.
- frcpa.s1 f10, p6 = f8, f9
- ;;
- // 3 Newton-Raphson iterations.
-(p6) fmpy.s1 f12 = f8, f10
-(p6) fnma.s1 f11 = f9, f10, f1
- ;;
-(p6) fma.s1 f12 = f11, f12, f12
-(p6) fmpy.s1 f13 = f11, f11
- ;;
-(p6) fma.s1 f10 = f11, f10, f10
-(p6) fma.s1 f11 = f13, f12, f12
- ;;
- sub in1 = r0, in1
-(p6) fma.s1 f10 = f13, f10, f10
-(p6) fnma.s1 f12 = f9, f11, f8
- ;;
- setf.sig f9 = in1
-(p6) fma.s1 f10 = f12, f10, f11
- ;;
- fcvt.fx.trunc.s1 f10 = f10
- ;;
- // r = q * (-b) + a
- xma.l f10 = f10, f9, f14
- ;;
- // Transfer result to GP registers.
- getf.sig ret0 = f10
- br.ret.sptk rp
- ;;
- .endp __moddi3
-#endif
-
-#ifdef L__udivdi3
-// Compute a 64-bit unsigned integer quotient.
-//
-// From the Intel IA-64 Optimization Guide, choose the minimum latency
-// alternative.
-//
-// in0 holds the dividend. in1 holds the divisor.
-
- .text
- .align 16
- .global __udivdi3
- .proc __udivdi3
-__udivdi3:
- .regstk 2,0,0,0
- // Transfer inputs to FP registers.
- setf.sig f8 = in0
- setf.sig f9 = in1
- // Check divide by zero.
- cmp.ne.unc p0,p7=0,in1
- ;;
- // Convert the inputs to FP, to avoid FP software-assist faults.
- fcvt.xuf.s1 f8 = f8
- fcvt.xuf.s1 f9 = f9
-(p7) break 1
- ;;
- // Compute the reciprocal approximation.
- frcpa.s1 f10, p6 = f8, f9
- ;;
- // 3 Newton-Raphson iterations.
-(p6) fnma.s1 f11 = f9, f10, f1
-(p6) fmpy.s1 f12 = f8, f10
- ;;
-(p6) fmpy.s1 f13 = f11, f11
-(p6) fma.s1 f12 = f11, f12, f12
- ;;
-(p6) fma.s1 f10 = f11, f10, f10
-(p6) fma.s1 f11 = f13, f12, f12
- ;;
-(p6) fma.s1 f10 = f13, f10, f10
-(p6) fnma.s1 f12 = f9, f11, f8
- ;;
-(p6) fma.s1 f10 = f12, f10, f11
- ;;
- // Round quotient to an unsigned integer.
- fcvt.fxu.trunc.s1 f10 = f10
- ;;
- // Transfer result to GP registers.
- getf.sig ret0 = f10
- br.ret.sptk rp
- ;;
- .endp __udivdi3
-#endif
-
-#ifdef L__umoddi3
-// Compute a 64-bit unsigned integer modulus.
-//
-// From the Intel IA-64 Optimization Guide, choose the minimum latency
-// alternative.
-//
-// in0 holds the dividend (a). in1 holds the divisor (b).
-
- .text
- .align 16
- .global __umoddi3
- .proc __umoddi3
-__umoddi3:
- .regstk 2,0,0,0
- // Transfer inputs to FP registers.
- setf.sig f14 = in0
- setf.sig f9 = in1
- // Check divide by zero.
- cmp.ne.unc p0,p7=0,in1
- ;;
- // Convert the inputs to FP, to avoid FP software assist faults.
- fcvt.xuf.s1 f8 = f14
- fcvt.xuf.s1 f9 = f9
-(p7) break 1;
- ;;
- // Compute the reciprocal approximation.
- frcpa.s1 f10, p6 = f8, f9
- ;;
- // 3 Newton-Raphson iterations.
-(p6) fmpy.s1 f12 = f8, f10
-(p6) fnma.s1 f11 = f9, f10, f1
- ;;
-(p6) fma.s1 f12 = f11, f12, f12
-(p6) fmpy.s1 f13 = f11, f11
- ;;
-(p6) fma.s1 f10 = f11, f10, f10
-(p6) fma.s1 f11 = f13, f12, f12
- ;;
- sub in1 = r0, in1
-(p6) fma.s1 f10 = f13, f10, f10
-(p6) fnma.s1 f12 = f9, f11, f8
- ;;
- setf.sig f9 = in1
-(p6) fma.s1 f10 = f12, f10, f11
- ;;
- // Round quotient to an unsigned integer.
- fcvt.fxu.trunc.s1 f10 = f10
- ;;
- // r = q * (-b) + a
- xma.l f10 = f10, f9, f14
- ;;
- // Transfer result to GP registers.
- getf.sig ret0 = f10
- br.ret.sptk rp
- ;;
- .endp __umoddi3
-#endif
-
-#ifdef L__divsi3
-// Compute a 32-bit integer quotient.
-//
-// From the Intel IA-64 Optimization Guide, choose the minimum latency
-// alternative.
-//
-// in0 holds the dividend. in1 holds the divisor.
-
- .text
- .align 16
- .global __divsi3
- .proc __divsi3
-__divsi3:
- .regstk 2,0,0,0
- // Check divide by zero.
- cmp.ne.unc p0,p7=0,in1
- sxt4 in0 = in0
- sxt4 in1 = in1
- ;;
- setf.sig f8 = in0
- setf.sig f9 = in1
-(p7) break 1
- ;;
- mov r2 = 0x0ffdd
- fcvt.xf f8 = f8
- fcvt.xf f9 = f9
- ;;
- setf.exp f11 = r2
- frcpa.s1 f10, p6 = f8, f9
- ;;
-(p6) fmpy.s1 f8 = f8, f10
-(p6) fnma.s1 f9 = f9, f10, f1
- ;;
-(p6) fma.s1 f8 = f9, f8, f8
-(p6) fma.s1 f9 = f9, f9, f11
- ;;
-(p6) fma.s1 f10 = f9, f8, f8
- ;;
- fcvt.fx.trunc.s1 f10 = f10
- ;;
- getf.sig ret0 = f10
- br.ret.sptk rp
- ;;
- .endp __divsi3
-#endif
-
-#ifdef L__modsi3
-// Compute a 32-bit integer modulus.
-//
-// From the Intel IA-64 Optimization Guide, choose the minimum latency
-// alternative.
-//
-// in0 holds the dividend. in1 holds the divisor.
-
- .text
- .align 16
- .global __modsi3
- .proc __modsi3
-__modsi3:
- .regstk 2,0,0,0
- mov r2 = 0x0ffdd
- sxt4 in0 = in0
- sxt4 in1 = in1
- ;;
- setf.sig f13 = r32
- setf.sig f9 = r33
- // Check divide by zero.
- cmp.ne.unc p0,p7=0,in1
- ;;
- sub in1 = r0, in1
- fcvt.xf f8 = f13
- fcvt.xf f9 = f9
- ;;
- setf.exp f11 = r2
- frcpa.s1 f10, p6 = f8, f9
-(p7) break 1
- ;;
-(p6) fmpy.s1 f12 = f8, f10
-(p6) fnma.s1 f10 = f9, f10, f1
- ;;
- setf.sig f9 = in1
-(p6) fma.s1 f12 = f10, f12, f12
-(p6) fma.s1 f10 = f10, f10, f11
- ;;
-(p6) fma.s1 f10 = f10, f12, f12
- ;;
- fcvt.fx.trunc.s1 f10 = f10
- ;;
- xma.l f10 = f10, f9, f13
- ;;
- getf.sig ret0 = f10
- br.ret.sptk rp
- ;;
- .endp __modsi3
-#endif
-
-#ifdef L__udivsi3
-// Compute a 32-bit unsigned integer quotient.
-//
-// From the Intel IA-64 Optimization Guide, choose the minimum latency
-// alternative.
-//
-// in0 holds the dividend. in1 holds the divisor.
-
- .text
- .align 16
- .global __udivsi3
- .proc __udivsi3
-__udivsi3:
- .regstk 2,0,0,0
- mov r2 = 0x0ffdd
- zxt4 in0 = in0
- zxt4 in1 = in1
- ;;
- setf.sig f8 = in0
- setf.sig f9 = in1
- // Check divide by zero.
- cmp.ne.unc p0,p7=0,in1
- ;;
- fcvt.xf f8 = f8
- fcvt.xf f9 = f9
-(p7) break 1
- ;;
- setf.exp f11 = r2
- frcpa.s1 f10, p6 = f8, f9
- ;;
-(p6) fmpy.s1 f8 = f8, f10
-(p6) fnma.s1 f9 = f9, f10, f1
- ;;
-(p6) fma.s1 f8 = f9, f8, f8
-(p6) fma.s1 f9 = f9, f9, f11
- ;;
-(p6) fma.s1 f10 = f9, f8, f8
- ;;
- fcvt.fxu.trunc.s1 f10 = f10
- ;;
- getf.sig ret0 = f10
- br.ret.sptk rp
- ;;
- .endp __udivsi3
-#endif
-
-#ifdef L__umodsi3
-// Compute a 32-bit unsigned integer modulus.
-//
-// From the Intel IA-64 Optimization Guide, choose the minimum latency
-// alternative.
-//
-// in0 holds the dividend. in1 holds the divisor.
-
- .text
- .align 16
- .global __umodsi3
- .proc __umodsi3
-__umodsi3:
- .regstk 2,0,0,0
- mov r2 = 0x0ffdd
- zxt4 in0 = in0
- zxt4 in1 = in1
- ;;
- setf.sig f13 = in0
- setf.sig f9 = in1
- // Check divide by zero.
- cmp.ne.unc p0,p7=0,in1
- ;;
- sub in1 = r0, in1
- fcvt.xf f8 = f13
- fcvt.xf f9 = f9
- ;;
- setf.exp f11 = r2
- frcpa.s1 f10, p6 = f8, f9
-(p7) break 1;
- ;;
-(p6) fmpy.s1 f12 = f8, f10
-(p6) fnma.s1 f10 = f9, f10, f1
- ;;
- setf.sig f9 = in1
-(p6) fma.s1 f12 = f10, f12, f12
-(p6) fma.s1 f10 = f10, f10, f11
- ;;
-(p6) fma.s1 f10 = f10, f12, f12
- ;;
- fcvt.fxu.trunc.s1 f10 = f10
- ;;
- xma.l f10 = f10, f9, f13
- ;;
- getf.sig ret0 = f10
- br.ret.sptk rp
- ;;
- .endp __umodsi3
-#endif
-
-#ifdef L__save_stack_nonlocal
-// Notes on save/restore stack nonlocal: We read ar.bsp but write
-// ar.bspstore. This is because ar.bsp can be read at all times
-// (independent of the RSE mode) but since it's read-only we need to
-// restore the value via ar.bspstore. This is OK because
-// ar.bsp==ar.bspstore after executing "flushrs".
-
-// void __ia64_save_stack_nonlocal(void *save_area, void *stack_pointer)
-
- .text
- .align 16
- .global __ia64_save_stack_nonlocal
- .proc __ia64_save_stack_nonlocal
-__ia64_save_stack_nonlocal:
- { .mmf
- alloc r18 = ar.pfs, 2, 0, 0, 0
- mov r19 = ar.rsc
- ;;
- }
- { .mmi
- flushrs
- st8 [in0] = in1, 24
- and r19 = 0x1c, r19
- ;;
- }
- { .mmi
- st8 [in0] = r18, -16
- mov ar.rsc = r19
- or r19 = 0x3, r19
- ;;
- }
- { .mmi
- mov r16 = ar.bsp
- mov r17 = ar.rnat
- adds r2 = 8, in0
- ;;
- }
- { .mmi
- st8 [in0] = r16
- st8 [r2] = r17
- }
- { .mib
- mov ar.rsc = r19
- br.ret.sptk.few rp
- ;;
- }
- .endp __ia64_save_stack_nonlocal
-#endif
-
-#ifdef L__nonlocal_goto
-// void __ia64_nonlocal_goto(void *target_label, void *save_area,
-// void *static_chain);
-
- .text
- .align 16
- .global __ia64_nonlocal_goto
- .proc __ia64_nonlocal_goto
-__ia64_nonlocal_goto:
- { .mmi
- alloc r20 = ar.pfs, 3, 0, 0, 0
- ld8 r12 = [in1], 8
- mov.ret.sptk rp = in0, .L0
- ;;
- }
- { .mmf
- ld8 r16 = [in1], 8
- mov r19 = ar.rsc
- ;;
- }
- { .mmi
- flushrs
- ld8 r17 = [in1], 8
- and r19 = 0x1c, r19
- ;;
- }
- { .mmi
- ld8 r18 = [in1]
- mov ar.rsc = r19
- or r19 = 0x3, r19
- ;;
- }
- { .mmi
- mov ar.bspstore = r16
- ;;
- mov ar.rnat = r17
- ;;
- }
- { .mmi
- loadrs
- invala
- mov r15 = in2
- ;;
- }
-.L0: { .mib
- mov ar.rsc = r19
- mov ar.pfs = r18
- br.ret.sptk.few rp
- ;;
- }
- .endp __ia64_nonlocal_goto
-#endif
-
-#ifdef L__restore_stack_nonlocal
-// This is mostly the same as nonlocal_goto above.
-// ??? This has not been tested yet.
-
-// void __ia64_restore_stack_nonlocal(void *save_area)
-
- .text
- .align 16
- .global __ia64_restore_stack_nonlocal
- .proc __ia64_restore_stack_nonlocal
-__ia64_restore_stack_nonlocal:
- { .mmf
- alloc r20 = ar.pfs, 4, 0, 0, 0
- ld8 r12 = [in0], 8
- ;;
- }
- { .mmb
- ld8 r16=[in0], 8
- mov r19 = ar.rsc
- ;;
- }
- { .mmi
- flushrs
- ld8 r17 = [in0], 8
- and r19 = 0x1c, r19
- ;;
- }
- { .mmf
- ld8 r18 = [in0]
- mov ar.rsc = r19
- ;;
- }
- { .mmi
- mov ar.bspstore = r16
- ;;
- mov ar.rnat = r17
- or r19 = 0x3, r19
- ;;
- }
- { .mmf
- loadrs
- invala
- ;;
- }
-.L0: { .mib
- mov ar.rsc = r19
- mov ar.pfs = r18
- br.ret.sptk.few rp
- ;;
- }
- .endp __ia64_restore_stack_nonlocal
-#endif
-
-#ifdef L__trampoline
-// Implement the nested function trampoline. This is out of line
-// so that we don't have to bother with flushing the icache, as
-// well as making the on-stack trampoline smaller.
-//
-// The trampoline has the following form:
-//
-// +-------------------+ >
-// TRAMP: | __ia64_trampoline | |
-// +-------------------+ > fake function descriptor
-// | TRAMP+16 | |
-// +-------------------+ >
-// | target descriptor |
-// +-------------------+
-// | static link |
-// +-------------------+
-
- .text
- .align 16
- .global __ia64_trampoline
- .proc __ia64_trampoline
-__ia64_trampoline:
- { .mmi
- ld8 r2 = [r1], 8
- ;;
- ld8 r15 = [r1]
- }
- { .mmi
- ld8 r3 = [r2], 8
- ;;
- ld8 r1 = [r2]
- mov b6 = r3
- }
- { .bbb
- br.sptk.many b6
- ;;
- }
- .endp __ia64_trampoline
-#endif
-
-#ifdef SHARED
-// Thunks for backward compatibility.
-#ifdef L_fixtfdi
- .text
- .align 16
- .global __fixtfti
- .proc __fixtfti
-__fixtfti:
- { .bbb
- br.sptk.many __fixxfti
- ;;
- }
- .endp __fixtfti
-#endif
-#ifdef L_fixunstfdi
- .align 16
- .global __fixunstfti
- .proc __fixunstfti
-__fixunstfti:
- { .bbb
- br.sptk.many __fixunsxfti
- ;;
- }
- .endp __fixunstfti
-#endif
-#ifdef L_floatditf
- .align 16
- .global __floattitf
- .proc __floattitf
-__floattitf:
- { .bbb
- br.sptk.many __floattixf
- ;;
- }
- .endp __floattitf
-#endif
-#endif
diff --git a/gcc/config/ia64/libgcc-glibc.ver b/gcc/config/ia64/libgcc-glibc.ver
deleted file mode 100644
index 34a69618d1b..00000000000
--- a/gcc/config/ia64/libgcc-glibc.ver
+++ /dev/null
@@ -1,97 +0,0 @@
-# Copyright (C) 2009 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/>.
-
-# 128 bit long double support was introduced with GCC 4.4.0. These lines
-# make the symbols to get @@GCC_4.4.0 attached.
-
-%exclude {
- __addtf3
- __divtc3
- __divtf3
- __eqtf2
- __extenddftf2
- __extendsftf2
- __extendxftf2
- __fixtfdi
- __fixtfsi
- __fixtfti
- __fixunstfdi
- __fixunstfsi
- __fixunstfti
- __floatditf
- __floatsitf
- __floattitf
- __floatunditf
- __floatunsitf
- __floatuntitf
- __getf2
- __gttf2
- __letf2
- __lttf2
- __multc3
- __multf3
- __negtf2
- __netf2
- __powitf2
- __subtf3
- __trunctfdf2
- __trunctfsf2
- __trunctfxf2
- __unordtf2
-}
-
-# Those TF functions are the aliases of the XF functions before gcc 3.4.
-GCC_3.0 {
- __divtf3
- __fixtfti
- __fixunstfti
- __floattitf
-}
-
-GCC_4.4.0 {
- __addtf3
- __copysigntf3
- __divtc3
- __divtf3
- __eqtf2
- __extenddftf2
- __extendsftf2
- __fabstf2
- __fixtfdi
- __fixtfsi
- __fixunstfdi
- __fixunstfsi
- __floatditf
- __floatsitf
- __floatunditf
- __floatunsitf
- __getf2
- __gttf2
- __letf2
- __lttf2
- __multc3
- __multf3
- __negtf2
- __netf2
- __powitf2
- __subtf3
- __trunctfdf2
- __trunctfsf2
- __trunctfxf2
- __unordtf2
-}
diff --git a/gcc/config/ia64/libgcc-ia64.ver b/gcc/config/ia64/libgcc-ia64.ver
deleted file mode 100644
index 11c1fe629bd..00000000000
--- a/gcc/config/ia64/libgcc-ia64.ver
+++ /dev/null
@@ -1,30 +0,0 @@
-# Copyright (C) 2000, 2001, 2003 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_3.0 {
- # IA-64 symbols
- __ia64_nonlocal_goto
- __ia64_personality_v1
- __ia64_restore_stack_nonlocal
- __ia64_save_stack_nonlocal
- __ia64_trampoline
- __ia64_backtrace
-}
-GCC_3.3.2 {
- _Unwind_GetBSP
-}
diff --git a/gcc/config/ia64/quadlib.c b/gcc/config/ia64/quadlib.c
deleted file mode 100644
index f9ee30b587c..00000000000
--- a/gcc/config/ia64/quadlib.c
+++ /dev/null
@@ -1,78 +0,0 @@
-/* Subroutines for long double support.
- Copyright (C) 2000, 2001, 2002, 2009 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/>. */
-
-extern int _U_Qfcmp (long double a, long double b, int);
-
-int _U_Qfeq (long double, long double);
-int _U_Qfne (long double, long double);
-int _U_Qfgt (long double, long double);
-int _U_Qfge (long double, long double);
-int _U_Qflt (long double, long double);
-int _U_Qfle (long double, long double);
-int _U_Qfcomp (long double, long double);
-
-int
-_U_Qfeq (long double a, long double b)
-{
- return (_U_Qfcmp (a, b, 4) != 0);
-}
-
-int
-_U_Qfne (long double a, long double b)
-{
- return (_U_Qfcmp (a, b, 4) == 0);
-}
-
-int
-_U_Qfgt (long double a, long double b)
-{
- return (_U_Qfcmp (a, b, 17) != 0);
-}
-
-int
-_U_Qfge (long double a, long double b)
-{
- return (_U_Qfcmp (a, b, 21) != 0);
-}
-
-int
-_U_Qflt (long double a, long double b)
-{
- return (_U_Qfcmp (a, b, 9) != 0);
-}
-
-int
-_U_Qfle (long double a, long double b)
-{
- return (_U_Qfcmp (a, b, 13) != 0);
-}
-
-int
-_U_Qfcomp (long double a, long double b)
-{
- if (_U_Qfcmp (a, b, 4) == 0)
- return 0;
-
- return (_U_Qfcmp (a, b, 22) != 0 ? 1 : -1);
-}
diff --git a/gcc/config/ia64/t-glibc b/gcc/config/ia64/t-glibc
deleted file mode 100644
index ce18a92e275..00000000000
--- a/gcc/config/ia64/t-glibc
+++ /dev/null
@@ -1 +0,0 @@
-SHLIB_MAPFILES += $(srcdir)/config/ia64/libgcc-glibc.ver
diff --git a/gcc/config/ia64/t-hpux b/gcc/config/ia64/t-hpux
index 4aa661441b2..a1b681a3a25 100644
--- a/gcc/config/ia64/t-hpux
+++ b/gcc/config/ia64/t-hpux
@@ -19,55 +19,11 @@
# We need multilib support for HPUX's ILP32 & LP64 modes.
-LIBGCC = stmp-multilib
-INSTALL_LIBGCC = install-multilib
-
MULTILIB_OPTIONS = milp32/mlp64
MULTILIB_DIRNAMES = hpux32 hpux64
MULTILIB_MATCHES =
-# On HP-UX we do not want _fixtfdi, _fixunstfdi, or _floatditf from
-# LIB1ASMSRC. These functions map the 128 bit conversion function names
-# to 80 bit conversions and were done for Linux backwards compatibility.
-
-LIB1ASMFUNCS := $(filter-out _fixtfdi _fixunstfdi _floatditf,$(LIB1ASMFUNCS))
-
-# Support routines for HP-UX 128 bit floats.
-
-LIB2FUNCS_EXTRA=quadlib.c $(srcdir)/config/floatunsitf.c
-
-quadlib.c: $(srcdir)/config/ia64/quadlib.c
- cat $(srcdir)/config/ia64/quadlib.c > quadlib.c
-
-# We get an undefined main when building a cross compiler because our
-# linkspec has "-u main" and we want that for linking but it makes
-# LIBGCC1_TEST fail because it uses -nostdlib -nostartup.
-
-LIBGCC1_TEST =
-
# We do not want to include the EH stuff that linux uses, we want to use
# the HP-UX libunwind library.
T_CFLAGS += -DUSE_LIBUNWIND_EXCEPTIONS
-
-SHLIB_EXT = .so
-# Must include -lunwind in the link, so that libgcc_s.so has the necessary
-# DT_NEEDED entry for libunwind.
-SHLIB_LINK = $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) -shared -nodefaultlibs \
- -Wl,+h,@shlib_base_name@.so.0 \
- -o @multilib_dir@/@shlib_base_name@.so @multilib_flags@ \
- @shlib_objs@ -lunwind -lc && \
- rm -f @multilib_dir@/@shlib_base_name@.so.0 && \
- $(LN_S) @shlib_base_name@.so @multilib_dir@/@shlib_base_name@.so.0
-# $(slibdir) double quoted to protect it from expansion while building
-# libgcc.mk. We want this delayed until actual install time.
-SHLIB_INSTALL = \
- $$(mkinstalldirs) $$(DESTDIR)$$(slibdir)@shlib_slibdir_qual@; \
- $(INSTALL_DATA) @multilib_dir@/@shlib_base_name@.so \
- $$(DESTDIR)$$(slibdir)@shlib_slibdir_qual@/@shlib_base_name@.so.0; \
- rm -f $$(DESTDIR)$$(slibdir)@shlib_slibdir_qual@/@shlib_base_name@.so; \
- $(LN_S) @shlib_base_name@.so.0 \
- $$(DESTDIR)$$(slibdir)@shlib_slibdir_qual@/@shlib_base_name@.so; \
- chmod +x $$(DESTDIR)$$(slibdir)@shlib_slibdir_qual@/@shlib_base_name@.so
-
-SHLIB_MKMAP = $(srcdir)/mkmap-flat.awk
diff --git a/gcc/config/ia64/t-ia64 b/gcc/config/ia64/t-ia64
index f130f7c09d1..398aba1019f 100644
--- a/gcc/config/ia64/t-ia64
+++ b/gcc/config/ia64/t-ia64
@@ -18,31 +18,6 @@
# along with GCC; see the file COPYING3. If not see
# <http://www.gnu.org/licenses/>.
-LIB1ASMSRC = ia64/lib1funcs.asm
-
-# We use different names for the DImode div/mod files so that they won't
-# conflict with libgcc2.c files. We used to use __ia64 as a prefix, now
-# we use __ as the prefix. Note that L_divdi3 in libgcc2.c actually defines
-# a TImode divide function, so there is no actual overlap here between
-# libgcc2.c and lib1funcs.asm.
-LIB1ASMFUNCS = __divxf3 __divdf3 __divsf3 \
- __divdi3 __moddi3 __udivdi3 __umoddi3 \
- __divsi3 __modsi3 __udivsi3 __umodsi3 __save_stack_nonlocal \
- __nonlocal_goto __restore_stack_nonlocal __trampoline \
- _fixtfdi _fixunstfdi _floatditf
-
-# ??? Hack to get -P option used when compiling lib1funcs.asm, because Intel
-# assembler does not accept # line number as a comment.
-# ??? This breaks C++ pragma interface/implementation, which is used in the
-# C++ part of libgcc2, hence it had to be disabled. Must find some other way
-# to support the Intel assembler.
-#LIBGCC2_DEBUG_CFLAGS = -g1 -P
-
-SHLIB_MAPFILES += $(srcdir)/config/ia64/libgcc-ia64.ver
-
-# Effectively disable the crtbegin/end rules using crtstuff.c
-T = disable
-
ia64-c.o: $(srcdir)/config/ia64/ia64-c.c $(CONFIG_H) $(SYSTEM_H) \
coretypes.h $(TM_H) $(TREE_H) $(CPPLIB_H) $(C_COMMON_H) $(C_PRAGMA_H)
$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
diff --git a/gcc/config/ia64/t-vms b/gcc/config/ia64/t-vms
deleted file mode 100644
index 094d53483ee..00000000000
--- a/gcc/config/ia64/t-vms
+++ /dev/null
@@ -1,47 +0,0 @@
-# Copyright (C) 2009, 2011
-# 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/>.
-
-# Enable the crtbegin/end rules disabled in t-ia64
-T =
-
-# VMS_EXTRA_PARTS is defined in x-vms and represent object files that
-# are only needed for VMS targets, but can only be compiled on a VMS host
-# (because they need DEC C).
-EXTRA_PARTS = $(VMS_EXTRA_PARTS) crtbegin.o crtbeginS.o crtend.o crtendS.o crtinitS.o
-
-CRTSTUFF_T_CFLAGS = -O0
-CRTSTUFF_T_CFLAGS_S = -O0
-
-$(T)crtinitS.o: $(srcdir)/config/ia64/vms-crtinit.asm $(GCC_PASSES)
- $(GCC_FOR_TARGET) -I. -c -o $(T)crtinitS.o -x assembler-with-cpp \
- $(srcdir)/config/ia64/vms-crtinit.asm
-
-# Shared library macros
-shlib_version:=$(shell echo $(BASEVER_c) | sed -e 's/\./,/' -e 's/\.//g')
-SHLIB_EXT = .exe
-SHLIB_OBJS = @shlib_objs@
-SHLIB_NAME = @shlib_base_name@.exe
-SHLIB_MULTILIB =
-SHLIB_INSTALL = $(INSTALL_DATA) $(SHLIB_NAME) $$(DESTDIR)$$(libsubdir)/$(SHLIB_ NAME)
-SHLIB_LINK = \
- $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) -nodefaultlibs \
- -shared --for-linker=/noinform -o $(SHLIB_NAME) $(SHLIB_OBJS) \
- --for-linker=$(srcdir)/config/ia64/VMS_SYMVEC_@shlib_base_name@.opt \
- --for-linker=gsmatch=equal,$(shlib_version)
-
diff --git a/gcc/config/ia64/vms-crtinit.asm b/gcc/config/ia64/vms-crtinit.asm
deleted file mode 100644
index 322b2927347..00000000000
--- a/gcc/config/ia64/vms-crtinit.asm
+++ /dev/null
@@ -1,24 +0,0 @@
-/* Copyright (C) 2009 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/>. */
-
- .global LIB$INITIALIZE#
diff --git a/gcc/config/ia64/vms.h b/gcc/config/ia64/vms.h
index 853e0239d3b..75ea4ad430e 100644
--- a/gcc/config/ia64/vms.h
+++ b/gcc/config/ia64/vms.h
@@ -18,42 +18,24 @@ You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. */
-#define TARGET_OBJECT_SUFFIX ".obj"
-#define TARGET_EXECUTABLE_SUFFIX ".exe"
-
#define OBJECT_FORMAT_ELF
-#define TARGET_OS_CPP_BUILTINS() \
+#define SUBTARGET_OS_CPP_BUILTINS() \
do { \
- builtin_define_std ("vms"); \
- builtin_define_std ("VMS"); \
builtin_define ("__IA64"); \
- builtin_assert ("system=vms"); \
builtin_define ("__IEEE_FLOAT"); \
} while (0)
-/* By default, allow $ to be part of an identifier. */
-#define DOLLARS_IN_IDENTIFIERS 2
-
-#undef TARGET_ABI_OPEN_VMS
-#define TARGET_ABI_OPEN_VMS 1
-
/* Need .debug_line info generated from gcc and gas. */
#undef TARGET_DEFAULT
+#if POINTER_SIZE == 64
+#define TARGET_DEFAULT (MASK_DWARF2_ASM | MASK_GNU_AS | MASK_MALLOC64)
+#else
#define TARGET_DEFAULT (MASK_DWARF2_ASM | MASK_GNU_AS)
+#endif
#define VMS_DEBUG_MAIN_POINTER "TRANSFER$BREAK$GO"
-/* "long" is 32 bits, but 64 bits for Ada. */
-#undef LONG_TYPE_SIZE
-#define LONG_TYPE_SIZE 32
-#define ADA_LONG_TYPE_SIZE 64
-
-/* Pointer is 32 bits but the hardware has 64-bit addresses, sign extended. */
-#undef POINTER_SIZE
-#define POINTER_SIZE 32
-#define POINTERS_EXTEND_UNSIGNED 0
-
#undef MAX_OFILE_ALIGNMENT
#define MAX_OFILE_ALIGNMENT 524288 /* 8 x 2^16 by DEC Ada Test CD40VRA */
diff --git a/gcc/config/ia64/vms_symvec_libgcc_s.opt b/gcc/config/ia64/vms_symvec_libgcc_s.opt
deleted file mode 100644
index 88b46dfda6c..00000000000
--- a/gcc/config/ia64/vms_symvec_libgcc_s.opt
+++ /dev/null
@@ -1,89 +0,0 @@
-! Symbol vector listing all the universal symbols to be exported when
-! building libgcc_s.exe shareable image on IVMS for Gcc 3.4.5.
-! It would be better to auto-generate this file.
-
-case_sensitive=yes
-SYMBOL_VECTOR=(__divdf3=PROCEDURE)
-SYMBOL_VECTOR=(__divdi3=PROCEDURE)
-SYMBOL_VECTOR=(__divsf3=PROCEDURE)
-SYMBOL_VECTOR=(__divsi3=PROCEDURE)
-SYMBOL_VECTOR=(__divxf3=PROCEDURE)
-SYMBOL_VECTOR=(__moddi3=PROCEDURE)
-SYMBOL_VECTOR=(__modsi3=PROCEDURE)
-SYMBOL_VECTOR=(__ia64_nonlocal_goto=PROCEDURE)
-SYMBOL_VECTOR=(__ia64_restore_stack_nonlocal=PROCEDURE)
-SYMBOL_VECTOR=(__ia64_save_stack_nonlocal=PROCEDURE)
-SYMBOL_VECTOR=(__ia64_trampoline=PROCEDURE)
-SYMBOL_VECTOR=(__udivdi3=PROCEDURE)
-SYMBOL_VECTOR=(__udivsi3=PROCEDURE)
-SYMBOL_VECTOR=(__umoddi3=PROCEDURE)
-SYMBOL_VECTOR=(__umodsi3=PROCEDURE)
-SYMBOL_VECTOR=(__absvti2=PROCEDURE)
-SYMBOL_VECTOR=(__absvdi2=PROCEDURE)
-SYMBOL_VECTOR=(__absvsi2=PROCEDURE)
-SYMBOL_VECTOR=(__addvti3=PROCEDURE)
-SYMBOL_VECTOR=(__addvdi3=PROCEDURE)
-SYMBOL_VECTOR=(__addvsi3=PROCEDURE)
-SYMBOL_VECTOR=(__ashlti3=PROCEDURE)
-SYMBOL_VECTOR=(__ashrti3=PROCEDURE)
-SYMBOL_VECTOR=(__clear_cache=PROCEDURE)
-SYMBOL_VECTOR=(__clzti2=PROCEDURE)
-SYMBOL_VECTOR=(__clzdi2=PROCEDURE)
-SYMBOL_VECTOR=(__cmpti2=PROCEDURE)
-SYMBOL_VECTOR=(__ctzti2=PROCEDURE)
-SYMBOL_VECTOR=(__ctzdi2=PROCEDURE)
-SYMBOL_VECTOR=(__divti3=PROCEDURE)
-SYMBOL_VECTOR=(__enable_execute_stack=PROCEDURE)
-SYMBOL_VECTOR=(__ffsti2=PROCEDURE)
-SYMBOL_VECTOR=(__ffsdi2=PROCEDURE)
-SYMBOL_VECTOR=(__fixdfti=PROCEDURE)
-SYMBOL_VECTOR=(__fixsfti=PROCEDURE)
-SYMBOL_VECTOR=(__fixunsdfti=PROCEDURE)
-SYMBOL_VECTOR=(__fixunsdfdi=PROCEDURE)
-SYMBOL_VECTOR=(__fixunssfti=PROCEDURE)
-SYMBOL_VECTOR=(__fixunssfdi=PROCEDURE)
-SYMBOL_VECTOR=(__floattidf=PROCEDURE)
-SYMBOL_VECTOR=(__floattisf=PROCEDURE)
-SYMBOL_VECTOR=(__lshrti3=PROCEDURE)
-SYMBOL_VECTOR=(__modti3=PROCEDURE)
-SYMBOL_VECTOR=(__multi3=PROCEDURE)
-SYMBOL_VECTOR=(__mulvti3=PROCEDURE)
-SYMBOL_VECTOR=(__mulvdi3=PROCEDURE)
-SYMBOL_VECTOR=(__mulvsi3=PROCEDURE)
-SYMBOL_VECTOR=(__negti2=PROCEDURE)
-SYMBOL_VECTOR=(__negvti2=PROCEDURE)
-SYMBOL_VECTOR=(__negvdi2=PROCEDURE)
-SYMBOL_VECTOR=(__negvsi2=PROCEDURE)
-SYMBOL_VECTOR=(__parityti2=PROCEDURE)
-SYMBOL_VECTOR=(__paritydi2=PROCEDURE)
-SYMBOL_VECTOR=(__popcountti2=PROCEDURE)
-SYMBOL_VECTOR=(__popcountdi2=PROCEDURE)
-SYMBOL_VECTOR=(__subvti3=PROCEDURE)
-SYMBOL_VECTOR=(__subvdi3=PROCEDURE)
-SYMBOL_VECTOR=(__subvsi3=PROCEDURE)
-SYMBOL_VECTOR=(__ucmpti2=PROCEDURE)
-SYMBOL_VECTOR=(__udiv_w_sdiv=PROCEDURE)
-SYMBOL_VECTOR=(__udivti3=PROCEDURE)
-SYMBOL_VECTOR=(__udivmodti4=PROCEDURE)
-SYMBOL_VECTOR=(__umodti3=PROCEDURE)
-SYMBOL_VECTOR=(__gthread_active_p=PROCEDURE)
-SYMBOL_VECTOR=(__gthread_mutex_lock=PROCEDURE)
-SYMBOL_VECTOR=(__gthread_mutex_unlock=PROCEDURE)
-SYMBOL_VECTOR=(__gcc_personality_v0=PROCEDURE)
-SYMBOL_VECTOR=(_Unwind_GetGR=PROCEDURE)
-SYMBOL_VECTOR=(_Unwind_SetGR=PROCEDURE)
-SYMBOL_VECTOR=(_Unwind_GetIP=PROCEDURE)
-SYMBOL_VECTOR=(_Unwind_GetIPInfo=PROCEDURE)
-SYMBOL_VECTOR=(_Unwind_SetIP=PROCEDURE)
-SYMBOL_VECTOR=(_Unwind_GetLanguageSpecificData=PROCEDURE)
-SYMBOL_VECTOR=(_Unwind_GetRegionStart=PROCEDURE)
-SYMBOL_VECTOR=(_Unwind_FindEnclosingFunction=PROCEDURE)
-SYMBOL_VECTOR=(_Unwind_GetCFA=PROCEDURE)
-SYMBOL_VECTOR=(_Unwind_GetBSP=PROCEDURE)
-SYMBOL_VECTOR=(_Unwind_RaiseException=PROCEDURE)
-SYMBOL_VECTOR=(_Unwind_ForcedUnwind=PROCEDURE)
-SYMBOL_VECTOR=(_Unwind_Resume=PROCEDURE)
-SYMBOL_VECTOR=(_Unwind_Resume_or_Rethrow=PROCEDURE)
-SYMBOL_VECTOR=(_Unwind_DeleteException=PROCEDURE)
-SYMBOL_VECTOR=(_Unwind_Backtrace=PROCEDURE)
-case_sensitive=NO
diff --git a/gcc/config/iq2000/lib2extra-funcs.c b/gcc/config/iq2000/lib2extra-funcs.c
deleted file mode 100644
index d53786c8c7d..00000000000
--- a/gcc/config/iq2000/lib2extra-funcs.c
+++ /dev/null
@@ -1,40 +0,0 @@
-/* Copyright (C) 2003 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/>. */
-
-typedef unsigned int USItype __attribute__ ((mode (SI)));
-
-USItype
-__mulsi3 (USItype a, USItype b)
-{
- USItype c = 0;
-
- while (a != 0)
- {
- if (a & 1)
- c += b;
- a >>= 1;
- b <<= 1;
- }
-
- return c;
-}
diff --git a/gcc/config/iq2000/t-iq2000 b/gcc/config/iq2000/t-iq2000
deleted file mode 100644
index 03d8c703f86..00000000000
--- a/gcc/config/iq2000/t-iq2000
+++ /dev/null
@@ -1,38 +0,0 @@
-# Copyright (C) 2003, 2010, 2011 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/>.
-
-# Suppress building libgcc1.a, since the MIPS compiler port is complete
-# and does not need anything from libgcc1.a.
-LIBGCC1 =
-CROSS_LIBGCC1 =
-
-LIB2FUNCS_EXTRA = $(srcdir)/config/udivmod.c $(srcdir)/config/divmod.c $(srcdir)/config/udivmodsi4.c $(srcdir)/config/iq2000/lib2extra-funcs.c
-
-# Enable the following if multilibs are needed.
-# See gcc/genmultilib, gcc/gcc.texi and gcc/tm.texi for a
-# description of the options and their values.
-#
-# MULTILIB_OPTIONS =
-# MULTILIB_DIRNAMES =
-# MULTILIB_MATCHES =
-# MULTILIB_EXCEPTIONS =
-# MULTILIB_EXTRA_OPTS =
-#
-# LIBGCC = stmp-multilib
-# INSTALL_LIBGCC = install-multilib
-
diff --git a/gcc/config/libgcc-glibc.ver b/gcc/config/libgcc-glibc.ver
deleted file mode 100644
index 7824ad5a268..00000000000
--- a/gcc/config/libgcc-glibc.ver
+++ /dev/null
@@ -1,55 +0,0 @@
-# Copyright (C) 2000, 2008 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/>.
-
-# In order to work around the very problems that force us to now generally
-# create a libgcc.so, glibc reexported a number of routines from libgcc.a.
-# By now choosing the same version tags for these specific routines, we
-# maintain enough binary compatibility to allow future versions of glibc
-# to defer implementation of these routines to libgcc.so via DT_AUXILIARY.
-
-%exclude {
- __divdi3
- __moddi3
- __udivdi3
- __umoddi3
- __register_frame
- __register_frame_table
- __deregister_frame
- __register_frame_info
- __deregister_frame_info
- __frame_state_for
- __register_frame_info_table
-}
-
-%inherit GCC_3.0 GLIBC_2.0
-GLIBC_2.0 {
- # Sampling of DImode arithmetic used by (at least) i386 and m68k.
- __divdi3
- __moddi3
- __udivdi3
- __umoddi3
-
- # Exception handling support functions used by most everyone.
- __register_frame
- __register_frame_table
- __deregister_frame
- __register_frame_info
- __deregister_frame_info
- __frame_state_for
- __register_frame_info_table
-}
diff --git a/gcc/config/lm32/t-rtems b/gcc/config/lm32/t-rtems
new file mode 100644
index 00000000000..e47245009df
--- /dev/null
+++ b/gcc/config/lm32/t-rtems
@@ -0,0 +1,21 @@
+# Custom RTEMS multilibs
+
+MULTILIB_OPTIONS = mmultiply-enabled mbarrel-shift-enabled
+MULTILIB_OPTIONS += mdivide-enabled msign-extend-enabled
+
+MULTILIB_EXCEPTIONS =
+# MULTILIB_EXCEPTIONS += mmultiply-enabled/mbarrel-shift-enabled/mdivide-enabled/msign-extend-enabled
+MULTILIB_EXCEPTIONS += mmultiply-enabled/mbarrel-shift-enabled/mdivide-enabled
+MULTILIB_EXCEPTIONS += mmultiply-enabled/mbarrel-shift-enabled/msign-extend-enabled
+# MULTILIB_EXCEPTIONS += mmultiply-enabled/mbarrel-shift-enabled
+MULTILIB_EXCEPTIONS += mmultiply-enabled/mdivide-enabled/msign-extend-enabled
+MULTILIB_EXCEPTIONS += mmultiply-enabled/mdivide-enabled
+MULTILIB_EXCEPTIONS += mmultiply-enabled/msign-extend-enabled
+# MULTILIB_EXCEPTIONS += mmultiply-enabled
+MULTILIB_EXCEPTIONS += mbarrel-shift-enabled/mdivide-enabled/msign-extend-enabled
+MULTILIB_EXCEPTIONS += mbarrel-shift-enabled/mdivide-enabled
+MULTILIB_EXCEPTIONS += mbarrel-shift-enabled/msign-extend-enabled
+# MULTILIB_EXCEPTIONS += mbarrel-shift-enabled
+MULTILIB_EXCEPTIONS += mdivide-enabled/msign-extend-enabled
+MULTILIB_EXCEPTIONS += mdivide-enabled
+MULTILIB_EXCEPTIONS += msign-extend-enabled
diff --git a/gcc/config/m32c/m32c-lib1.S b/gcc/config/m32c/m32c-lib1.S
deleted file mode 100644
index 9b657787187..00000000000
--- a/gcc/config/m32c/m32c-lib1.S
+++ /dev/null
@@ -1,231 +0,0 @@
-/* libgcc routines for R8C/M16C/M32C
- Copyright (C) 2005, 2009, 2010
- Free Software Foundation, Inc.
- Contributed by Red Hat.
-
- 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(__r8c_cpu__) || defined(__m16c_cpu__)
-#define A16
-#define A(n,w) n
-#define W w
-#else
-#define A24
-#define A(n,w) w
-#define W l
-#endif
-
-
-#ifdef L__m32c_memregs
-
-/* Warning: these memory locations are used as a register bank. They
- *must* end up consecutive in any final executable, so you may *not*
- use the otherwise obvious ".comm" directive to allocate space for
- them. */
-
- .bss
- .global mem0
-mem0: .space 1
- .global mem1
-mem1: .space 1
- .global mem2
-mem2: .space 1
- .global mem3
-mem3: .space 1
- .global mem4
-mem4: .space 1
- .global mem5
-mem5: .space 1
- .global mem6
-mem6: .space 1
- .global mem7
-mem7: .space 1
- .global mem8
-mem8: .space 1
- .global mem9
-mem9: .space 1
- .global mem10
-mem10: .space 1
- .global mem11
-mem11: .space 1
- .global mem12
-mem12: .space 1
- .global mem13
-mem13: .space 1
- .global mem14
-mem14: .space 1
- .global mem15
-mem15: .space 1
-
-#endif
-
-#ifdef L__m32c_eh_return
- .text
- .global __m32c_eh_return
-__m32c_eh_return:
-
- /* At this point, r0 has the stack adjustment, r1r3 has the
- address to return to. The stack looks like this:
-
- old_ra
- old_fp
- <- unwound sp
- ...
- fb
- through
- r0
- <- sp
-
- What we need to do is restore all the registers, update the
- stack, and return to the right place.
- */
-
- stc sp,a0
-
- add.W A(#16,#24),a0
- /* a0 points to the current stack, just above the register
- save areas */
-
- mov.w a0,a1
- exts.w r0
- sub.W A(r0,r2r0),a1
- sub.W A(#3,#4),a1
- /* a1 points to the new stack. */
-
- /* This is for the "rts" below. */
- mov.w r1,[a1]
-#ifdef A16
- mov.w r2,r1
- mov.b r1l,2[a1]
-#else
- mov.w r2,2[a1]
-#endif
-
- /* This is for the "popc sp" below. */
- mov.W a1,[a0]
-
- popm r0,r1,r2,r3,a0,a1,sb,fb
- popc sp
- rts
-#endif
-
-/* SImode arguments for SI foo(SI,SI) functions. */
-#ifdef A16
-#define SAL 5[fb]
-#define SAH 7[fb]
-#define SBL 9[fb]
-#define SBH 11[fb]
-#else
-#define SAL 8[fb]
-#define SAH 10[fb]
-#define SBL 12[fb]
-#define SBH 14[fb]
-#endif
-
-#ifdef L__m32c_mulsi3
- .text
- .global ___mulsi3
-___mulsi3:
- enter #0
- push.w r2
- mov.w SAL,r0
- mulu.w SBL,r0 /* writes to r2r0 */
- mov.w r0,mem0
- mov.w r2,mem2
- mov.w SAL,r0
- mulu.w SBH,r0 /* writes to r2r0 */
- add.w r0,mem2
- mov.w SAH,r0
- mulu.w SBL,r0 /* writes to r2r0 */
- add.w r0,mem2
- pop.w r2
- exitd
-#endif
-
-#ifdef L__m32c_cmpsi2
- .text
- .global ___cmpsi2
-___cmpsi2:
- enter #0
- cmp.w SBH,SAH
- jgt cmpsi_gt
- jlt cmpsi_lt
- cmp.w SBL,SAL
- jgt cmpsi_gt
- jlt cmpsi_lt
- mov.w #1,r0
- exitd
-cmpsi_gt:
- mov.w #2,r0
- exitd
-cmpsi_lt:
- mov.w #0,r0
- exitd
-#endif
-
-#ifdef L__m32c_ucmpsi2
- .text
- .global ___ucmpsi2
-___ucmpsi2:
- enter #0
- cmp.w SBH,SAH
- jgtu cmpsi_gt
- jltu cmpsi_lt
- cmp.w SBL,SAL
- jgtu cmpsi_gt
- jltu cmpsi_lt
- mov.w #1,r0
- exitd
-cmpsi_gt:
- mov.w #2,r0
- exitd
-cmpsi_lt:
- mov.w #0,r0
- exitd
-#endif
-
-#ifdef L__m32c_jsri16
- .text
-#ifdef A16
- .global m32c_jsri16
-m32c_jsri16:
- add.w #-1, sp
-
- /* Read the address (16 bits) and return address (24 bits) off
- the stack. */
- mov.w 4[sp], r0
- mov.w 1[sp], r3
- mov.b 3[sp], a0 /* This zero-extends, so the high byte has
- zero in it. */
-
- /* Write the return address, then new address, to the stack. */
- mov.w a0, 1[sp] /* Just to get the zero in 2[sp]. */
- mov.w r0, 0[sp]
- mov.w r3, 3[sp]
- mov.b a0, 5[sp]
-
- /* This "returns" to the target address, leaving the pending
- return address on the stack. */
- rts
-#endif
-
-#endif
diff --git a/gcc/config/m32c/m32c-lib2-trapv.c b/gcc/config/m32c/m32c-lib2-trapv.c
deleted file mode 100644
index bb61ceaf0f4..00000000000
--- a/gcc/config/m32c/m32c-lib2-trapv.c
+++ /dev/null
@@ -1,43 +0,0 @@
-/* 16-bit trapping arithmetic routines for R8C/M16C/M32C
- Copyright (C) 2009
- Free Software Foundation, Inc.
- Contributed by Red Hat.
-
- 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/>. */
-
-/* See the comment by the definition of LIBGCC2_UNITS_PER_WORD in
- m32c.h for why we are creating extra versions of some of the
- functions defined in libgcc2.c.
-
- Note - this file is separate from m32c-lib2.c so that the following
- functions will appear in the their object file. This is necessary
- because they call abort() which is defined in the C library whereas
- the functions in m32c-lib2.c are completely self sufficieent. */
-
-#define LIBGCC2_UNITS_PER_WORD 2
-
-#define L_mulvsi3
-#define L_negvsi2
-#define L_addvsi3
-#define L_subvsi3
-
-#include "libgcc2.c"
diff --git a/gcc/config/m32c/m32c-lib2.c b/gcc/config/m32c/m32c-lib2.c
deleted file mode 100644
index 274affc4ab0..00000000000
--- a/gcc/config/m32c/m32c-lib2.c
+++ /dev/null
@@ -1,134 +0,0 @@
-/* libgcc routines for R8C/M16C/M32C
- Copyright (C) 2005, 2009
- Free Software Foundation, Inc.
- Contributed by Red Hat.
-
- 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/>. */
-
-typedef int sint32_type __attribute__ ((mode (SI)));
-typedef unsigned int uint32_type __attribute__ ((mode (SI)));
-typedef int word_type __attribute__ ((mode (__word__)));
-
-uint32_type udivmodsi4 (uint32_type, uint32_type, word_type);
-sint32_type __divsi3 (sint32_type, sint32_type);
-sint32_type __modsi3 (sint32_type, sint32_type);
-
-uint32_type
-udivmodsi4 (uint32_type num, uint32_type den, word_type modwanted)
-{
- uint32_type bit = 1;
- uint32_type res = 0;
-
- while (den < num && bit && !(den & (1L << 31)))
- {
- den <<= 1;
- bit <<= 1;
- }
- while (bit)
- {
- if (num >= den)
- {
- num -= den;
- res |= bit;
- }
- bit >>= 1;
- den >>= 1;
- }
- if (modwanted)
- return num;
- return res;
-}
-
-sint32_type
-__divsi3 (sint32_type a, sint32_type b)
-{
- word_type neg = 0;
- sint32_type res;
-
- if (a < 0)
- {
- a = -a;
- neg = !neg;
- }
-
- if (b < 0)
- {
- b = -b;
- neg = !neg;
- }
-
- res = udivmodsi4 (a, b, 0);
-
- if (neg)
- res = -res;
-
- return res;
-}
-
-sint32_type
-__modsi3 (sint32_type a, sint32_type b)
-{
- word_type neg = 0;
- sint32_type res;
-
- if (a < 0)
- {
- a = -a;
- neg = 1;
- }
-
- if (b < 0)
- b = -b;
-
- res = udivmodsi4 (a, b, 1);
-
- if (neg)
- res = -res;
-
- return res;
-}
-
-/* See the comment by the definition of LIBGCC2_UNITS_PER_WORD in
- m32c.h for why we are creating extra versions of some of the
- functions defined in libgcc2.c. */
-
-#define LIBGCC2_UNITS_PER_WORD 2
-
-#define L_clzsi2
-#define L_ctzsi2
-#define L_ffssi2
-#define L_paritysi2
-#define L_popcountsi2
-
-#include "libgcc2.c"
-
-uint32_type
-__udivsi3 (uint32_type a, uint32_type b)
-{
- return udivmodsi4 (a, b, 0);
-}
-
-uint32_type
-__umoddi3 (uint32_type a, uint32_type b)
-{
- return udivmodsi4 (a, b, 1);
-}
diff --git a/gcc/config/m32c/m32c.c b/gcc/config/m32c/m32c.c
index 7040df69fcf..04f69050609 100644
--- a/gcc/config/m32c/m32c.c
+++ b/gcc/config/m32c/m32c.c
@@ -391,7 +391,7 @@ class_can_hold_mode (reg_class_t rclass, enum machine_mode mode)
we allow the user to limit the number of memregs available, in
order to try to persuade gcc to try harder to use real registers.
- Memregs are provided by m32c-lib1.S.
+ Memregs are provided by lib1funcs.S.
*/
int ok_to_change_target_memregs = TRUE;
diff --git a/gcc/config/m32c/t-m32c b/gcc/config/m32c/t-m32c
index e39fdf3a0aa..1e4ed6b7113 100644
--- a/gcc/config/m32c/t-m32c
+++ b/gcc/config/m32c/t-m32c
@@ -19,18 +19,6 @@
# along with GCC; see the file COPYING3. If not see
# <http://www.gnu.org/licenses/>.
-LIB1ASMSRC = m32c/m32c-lib1.S
-
-LIB1ASMFUNCS = \
- __m32c_memregs \
- __m32c_eh_return \
- __m32c_mulsi3 \
- __m32c_cmpsi2 \
- __m32c_ucmpsi2 \
- __m32c_jsri16
-
-LIB2FUNCS_EXTRA = $(srcdir)/config/m32c/m32c-lib2.c $(srcdir)/config/m32c/m32c-lib2-trapv.c
-
# target-specific files
md_file = md
@@ -53,5 +41,3 @@ m32c-pragma.o: $(srcdir)/config/m32c/m32c-pragma.c $(RTL_H) $(TREE_H) $(CONFIG_H
MULTILIB_OPTIONS = mcpu=m32cm
MULTILIB_DIRNAMES = m32cm
MULTILIB_MATCHES = mcpu?m32cm=mcpu?m32c mcpu?r8c=mcpu?m16c
-
-EXTRA_MULTILIB_PARTS = crtbegin.o crtend.o
diff --git a/gcc/config/m32r/initfini.c b/gcc/config/m32r/initfini.c
deleted file mode 100644
index 6e7d58614c7..00000000000
--- a/gcc/config/m32r/initfini.c
+++ /dev/null
@@ -1,168 +0,0 @@
-/* .init/.fini section handling + C++ global constructor/destructor handling.
- This file is based on crtstuff.c, sol2-crti.asm, sol2-crtn.asm.
-
- Copyright (C) 1996, 1997, 1998, 2006, 2009 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/>. */
-
-/* Declare a pointer to void function type. */
-typedef void (*func_ptr) (void);
-
-#ifdef CRT_INIT
-
-/* NOTE: In order to be able to support SVR4 shared libraries, we arrange
- to have one set of symbols { __CTOR_LIST__, __DTOR_LIST__, __CTOR_END__,
- __DTOR_END__ } per root executable and also one set of these symbols
- per shared library. So in any given whole process image, we may have
- multiple definitions of each of these symbols. In order to prevent
- these definitions from conflicting with one another, and in order to
- ensure that the proper lists are used for the initialization/finalization
- of each individual shared library (respectively), we give these symbols
- only internal (i.e. `static') linkage, and we also make it a point to
- refer to only the __CTOR_END__ symbol in crtfini.o and the __DTOR_LIST__
- symbol in crtinit.o, where they are defined. */
-
-static func_ptr __CTOR_LIST__[1]
- __attribute__ ((used, section (".ctors")))
- = { (func_ptr) (-1) };
-
-static func_ptr __DTOR_LIST__[1]
- __attribute__ ((used, section (".dtors")))
- = { (func_ptr) (-1) };
-
-/* Run all the global destructors on exit from the program. */
-
-/* Some systems place the number of pointers in the first word of the
- table. On SVR4 however, that word is -1. In all cases, the table is
- null-terminated. On SVR4, we start from the beginning of the list and
- invoke each per-compilation-unit destructor routine in order
- until we find that null.
-
- Note that this function MUST be static. There will be one of these
- functions in each root executable and one in each shared library, but
- although they all have the same code, each one is unique in that it
- refers to one particular associated `__DTOR_LIST__' which belongs to the
- same particular root executable or shared library file. */
-
-static void __do_global_dtors (void)
-asm ("__do_global_dtors") __attribute__ ((used, section (".text")));
-
-static void
-__do_global_dtors (void)
-{
- func_ptr *p;
-
- for (p = __DTOR_LIST__ + 1; *p; p++)
- (*p) ();
-}
-
-/* .init section start.
- This must appear at the start of the .init section. */
-
-asm ("\n\
- .section .init,\"ax\",@progbits\n\
- .balign 4\n\
- .global __init\n\
-__init:\n\
- push fp\n\
- push lr\n\
- mv fp,sp\n\
- seth r0, #shigh(__fini)\n\
- add3 r0, r0, #low(__fini)\n\
- bl atexit\n\
- .fillinsn\n\
-");
-
-/* .fini section start.
- This must appear at the start of the .init section. */
-
-asm ("\n\
- .section .fini,\"ax\",@progbits\n\
- .balign 4\n\
- .global __fini\n\
-__fini:\n\
- push fp\n\
- push lr\n\
- mv fp,sp\n\
- bl __do_global_dtors\n\
- .fillinsn\n\
-");
-
-#endif /* CRT_INIT */
-
-#ifdef CRT_FINI
-
-/* Put a word containing zero at the end of each of our two lists of function
- addresses. Note that the words defined here go into the .ctors and .dtors
- sections of the crtend.o file, and since that file is always linked in
- last, these words naturally end up at the very ends of the two lists
- contained in these two sections. */
-
-static func_ptr __CTOR_END__[1]
- __attribute__ ((used, section (".ctors")))
- = { (func_ptr) 0 };
-
-static func_ptr __DTOR_END__[1]
- __attribute__ ((used, section (".dtors")))
- = { (func_ptr) 0 };
-
-/* Run all global constructors for the program.
- Note that they are run in reverse order. */
-
-static void __do_global_ctors (void)
-asm ("__do_global_ctors") __attribute__ ((used, section (".text")));
-
-static void
-__do_global_ctors (void)
-{
- func_ptr *p;
-
- for (p = __CTOR_END__ - 1; *p != (func_ptr) -1; p--)
- (*p) ();
-}
-
-/* .init section end.
- This must live at the end of the .init section. */
-
-asm ("\n\
- .section .init,\"ax\",@progbits\n\
- bl __do_global_ctors\n\
- mv sp,fp\n\
- pop lr\n\
- pop fp\n\
- jmp lr\n\
- .fillinsn\n\
-");
-
-/* .fini section end.
- This must live at the end of the .fini section. */
-
-asm ("\n\
- .section .fini,\"ax\",@progbits\n\
- mv sp,fp\n\
- pop lr\n\
- pop fp\n\
- jmp lr\n\
- .fillinsn\n\
-");
-
-#endif /* CRT_FINI */
diff --git a/gcc/config/m32r/libgcc-glibc.ver b/gcc/config/m32r/libgcc-glibc.ver
deleted file mode 100644
index 0e1304b2a3a..00000000000
--- a/gcc/config/m32r/libgcc-glibc.ver
+++ /dev/null
@@ -1,48 +0,0 @@
-# Copyright (C) 2004, 2008 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/>.
-
-# In order to work around the very problems that force us to now generally
-# create a libgcc.so, glibc reexported a number of routines from libgcc.a.
-# By now choosing the same version tags for these specific routines, we
-# maintain enough binary compatibility to allow future versions of glibc
-# to defer implementation of these routines to libgcc.so via DT_AUXILIARY.
-
-# Note that we cannot use the default libgcc-glibc.ver file on sh,
-# because GLIBC_2.0 does not exist on this architecture, as the first
-# ever glibc release on the platform was GLIBC_2.3.
-
-%exclude {
- __register_frame
- __register_frame_table
- __deregister_frame
- __register_frame_info
- __deregister_frame_info
- __frame_state_for
- __register_frame_info_table
-}
-
-%inherit GCC_3.0 GLIBC_2.3
-GLIBC_2.3 {
- __register_frame
- __register_frame_table
- __deregister_frame
- __register_frame_info
- __deregister_frame_info
- __frame_state_for
- __register_frame_info_table
-}
diff --git a/gcc/config/m32r/t-linux b/gcc/config/m32r/t-linux
index 6de9c781a67..c4f7dcc0bd6 100644
--- a/gcc/config/m32r/t-linux
+++ b/gcc/config/m32r/t-linux
@@ -16,30 +16,5 @@
# along with GCC; see the file COPYING3. If not see
# <http://www.gnu.org/licenses/>.
-# lib1funcs.asm is currently empty.
-CROSS_LIBGCC1 =
-
-# Turn off the SDA while compiling libgcc2. There are no headers for it
-# and we want maximal upward compatibility here.
-
-TARGET_LIBGCC2_CFLAGS = -G 0 -fPIC
-
-# We need to use -fpic when we are using gcc to compile the routines in
-# initfini.c. This is only really needed when we are going to use gcc/g++
-# to produce a shared library, but since we don't know ahead of time when
-# we will be doing that, we just always use -fpic when compiling the
-# routines in initfini.c.
-# -fpic currently isn't supported for the m32r.
-
-CRTSTUFF_T_CFLAGS_S = -fPIC
-
# Don't install "assert.h" in gcc. We use the one in glibc.
INSTALL_ASSERT_H =
-
-# Do not build libgcc1. Let gcc generate those functions. The GNU/Linux
-# C library can handle them.
-LIBGCC1 =
-CROSS_LIBGCC1 =
-LIBGCC1_TEST =
-
-SHLIB_MAPFILES += $(srcdir)/config/m32r/libgcc-glibc.ver
diff --git a/gcc/config/m32r/t-m32r b/gcc/config/m32r/t-m32r
index 44090658838..e048fbf04f2 100644
--- a/gcc/config/m32r/t-m32r
+++ b/gcc/config/m32r/t-m32r
@@ -17,40 +17,6 @@
# along with GCC; see the file COPYING3. If not see
# <http://www.gnu.org/licenses/>.
-# Turn off the SDA while compiling libgcc2. There are no headers for it
-# and we want maximal upward compatibility here.
-
-TARGET_LIBGCC2_CFLAGS = -G 0
-
-# We need to use -fpic when we are using gcc to compile the routines in
-# initfini.c. This is only really needed when we are going to use gcc/g++
-# to produce a shared library, but since we don't know ahead of time when
-# we will be doing that, we just always use -fpic when compiling the
-# routines in initfini.c.
-# -fpic currently isn't supported for the m32r.
-
-CRTSTUFF_T_CFLAGS =
-
-# .init/.fini section routines
-
-$(T)crtinit.o: $(srcdir)/config/m32r/initfini.c $(GCC_PASSES) $(CONFIG_H)
- $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(MULTILIB_CFLAGS) \
- $(CRTSTUFF_T_CFLAGS) $(INCLUDES) -DCRT_INIT \
- -finhibit-size-directive -fno-inline-functions -g0 \
- -mmodel=medium -c $(srcdir)/config/m32r/initfini.c \
- -o $(T)crtinit.o
-
-$(T)crtfini.o: $(srcdir)/config/m32r/initfini.c $(GCC_PASSES) $(CONFIG_H)
- $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(MULTILIB_CFLAGS) \
- $(CRTSTUFF_T_CFLAGS) $(INCLUDES) -DCRT_FINI \
- -finhibit-size-directive -fno-inline-functions -g0 \
- -mmodel=medium -c $(srcdir)/config/m32r/initfini.c \
- -o $(T)crtfini.o
-m32rx:
- mkdir $@
-m32r2:
- mkdir $@
-
# -mmodel={small,medium} requires separate libraries.
# We don't build libraries for the large model, instead we use the medium
# libraries. The only difference is that the large model can handle jumps
@@ -64,8 +30,3 @@ MULTILIB_MATCHES = mmodel?medium=mmodel?large
# SHN_M32R_SCOMMON.
# This is important for objects referenced in system header files.
MULTILIB_EXTRA_OPTS = msdata=sdata
-
-EXTRA_MULTILIB_PARTS = crtinit.o crtfini.o
-
-LIBGCC = stmp-multilib
-INSTALL_LIBGCC = install-multilib
diff --git a/gcc/config/m68k/crti.s b/gcc/config/m68k/crti.s
deleted file mode 100644
index 12fb59f4130..00000000000
--- a/gcc/config/m68k/crti.s
+++ /dev/null
@@ -1,44 +0,0 @@
-/* Specialized code needed to support construction and destruction of
- file-scope objects in C++ and Java code, and to support exception handling.
- Copyright (C) 1999, 2008, 2009 Free Software Foundation, Inc.
- Contributed by Charles-Antoine Gauthier (charles.gauthier@iit.nrc.ca).
-
-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/>. */
-
-/*
- * This file just supplies function prologues for the .init and .fini
- * sections. It is linked in before crtbegin.o.
- */
-
- .ident "GNU C crti.o"
-
- .section .init
- .globl _init
- .type _init,@function
-_init:
- linkw %fp,#0
-
- .section .fini
- .globl _fini
- .type _fini,@function
-_fini:
- linkw %fp,#0
diff --git a/gcc/config/m68k/crtn.s b/gcc/config/m68k/crtn.s
deleted file mode 100644
index b7d70f02ed5..00000000000
--- a/gcc/config/m68k/crtn.s
+++ /dev/null
@@ -1,40 +0,0 @@
-/* Specialized code needed to support construction and destruction of
- file-scope objects in C++ and Java code, and to support exception handling.
- Copyright (C) 1999, 2008, 2009 Free Software Foundation, Inc.
- Contributed by Charles-Antoine Gauthier (charles.gauthier@iit.nrc.ca).
-
-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/>. */
-
-/*
- * This file supplies function epilogues for the .init and .fini sections.
- * It is linked in after all other files.
- */
-
- .ident "GNU C crtn.o"
-
- .section .init
- unlk %fp
- rts
-
- .section .fini
- unlk %fp
- rts
diff --git a/gcc/config/m68k/fpgnulib.c b/gcc/config/m68k/fpgnulib.c
deleted file mode 100644
index 2a7f6c75d11..00000000000
--- a/gcc/config/m68k/fpgnulib.c
+++ /dev/null
@@ -1,595 +0,0 @@
-/* This is a stripped down version of floatlib.c. It supplies only those
- functions which exist in libgcc, but for which there is not assembly
- language versions in m68k/lb1sf68.asm.
-
- It also includes simplistic support for extended floats (by working in
- double precision). You must compile this file again with -DEXTFLOAT
- to get this support. */
-
-/*
-** gnulib support for software floating point.
-** Copyright (C) 1991 by Pipeline Associates, Inc. All rights reserved.
-** Permission is granted to do *anything* you want with this file,
-** commercial or otherwise, provided this message remains intact. So there!
-** I would appreciate receiving any updates/patches/changes that anyone
-** makes, and am willing to be the repository for said changes (am I
-** making a big mistake?).
-**
-** Pat Wood
-** Pipeline Associates, Inc.
-** pipeline!phw@motown.com or
-** sun!pipeline!phw or
-** uunet!motown!pipeline!phw
-**
-** 05/01/91 -- V1.0 -- first release to gcc mailing lists
-** 05/04/91 -- V1.1 -- added float and double prototypes and return values
-** -- fixed problems with adding and subtracting zero
-** -- fixed rounding in truncdfsf2
-** -- fixed SWAP define and tested on 386
-*/
-
-/*
-** The following are routines that replace the gnulib soft floating point
-** routines that are called automatically when -msoft-float is selected.
-** The support single and double precision IEEE format, with provisions
-** for byte-swapped machines (tested on 386). Some of the double-precision
-** routines work at full precision, but most of the hard ones simply punt
-** and call the single precision routines, producing a loss of accuracy.
-** long long support is not assumed or included.
-** Overall accuracy is close to IEEE (actually 68882) for single-precision
-** arithmetic. I think there may still be a 1 in 1000 chance of a bit
-** being rounded the wrong way during a multiply. I'm not fussy enough to
-** bother with it, but if anyone is, knock yourself out.
-**
-** Efficiency has only been addressed where it was obvious that something
-** would make a big difference. Anyone who wants to do this right for
-** best speed should go in and rewrite in assembler.
-**
-** I have tested this only on a 68030 workstation and 386/ix integrated
-** in with -msoft-float.
-*/
-
-/* the following deal with IEEE single-precision numbers */
-#define EXCESS 126L
-#define SIGNBIT 0x80000000L
-#define HIDDEN (1L << 23L)
-#define SIGN(fp) ((fp) & SIGNBIT)
-#define EXP(fp) (((fp) >> 23L) & 0xFF)
-#define MANT(fp) (((fp) & 0x7FFFFFL) | HIDDEN)
-#define PACK(s,e,m) ((s) | ((e) << 23L) | (m))
-
-/* the following deal with IEEE double-precision numbers */
-#define EXCESSD 1022L
-#define HIDDEND (1L << 20L)
-#define EXPDBITS 11
-#define EXPDMASK 0x7FFL
-#define EXPD(fp) (((fp.l.upper) >> 20L) & 0x7FFL)
-#define SIGND(fp) ((fp.l.upper) & SIGNBIT)
-#define MANTD(fp) (((((fp.l.upper) & 0xFFFFF) | HIDDEND) << 10) | \
- (fp.l.lower >> 22))
-#define MANTDMASK 0xFFFFFL /* mask of upper part */
-
-/* the following deal with IEEE extended-precision numbers */
-#define EXCESSX 16382L
-#define HIDDENX (1L << 31L)
-#define EXPXBITS 15
-#define EXPXMASK 0x7FFF
-#define EXPX(fp) (((fp.l.upper) >> 16) & EXPXMASK)
-#define SIGNX(fp) ((fp.l.upper) & SIGNBIT)
-#define MANTXMASK 0x7FFFFFFFL /* mask of upper part */
-
-union double_long
-{
- double d;
- struct {
- long upper;
- unsigned long lower;
- } l;
-};
-
-union float_long {
- float f;
- long l;
-};
-
-union long_double_long
-{
- long double ld;
- struct
- {
- long upper;
- unsigned long middle;
- unsigned long lower;
- } l;
-};
-
-#ifndef EXTFLOAT
-
-int
-__unordsf2(float a, float b)
-{
- union float_long fl;
-
- fl.f = a;
- if (EXP(fl.l) == EXP(~0u) && (MANT(fl.l) & ~HIDDEN) != 0)
- return 1;
- fl.f = b;
- if (EXP(fl.l) == EXP(~0u) && (MANT(fl.l) & ~HIDDEN) != 0)
- return 1;
- return 0;
-}
-
-int
-__unorddf2(double a, double b)
-{
- union double_long dl;
-
- dl.d = a;
- if (EXPD(dl) == EXPDMASK
- && ((dl.l.upper & MANTDMASK) != 0 || dl.l.lower != 0))
- return 1;
- dl.d = b;
- if (EXPD(dl) == EXPDMASK
- && ((dl.l.upper & MANTDMASK) != 0 || dl.l.lower != 0))
- return 1;
- return 0;
-}
-
-/* convert unsigned int to double */
-double
-__floatunsidf (unsigned long a1)
-{
- long exp = 32 + EXCESSD;
- union double_long dl;
-
- if (!a1)
- {
- dl.l.upper = dl.l.lower = 0;
- return dl.d;
- }
-
- while (a1 < 0x2000000L)
- {
- a1 <<= 4;
- exp -= 4;
- }
-
- while (a1 < 0x80000000L)
- {
- a1 <<= 1;
- exp--;
- }
-
- /* pack up and go home */
- dl.l.upper = exp << 20L;
- dl.l.upper |= (a1 >> 11L) & ~HIDDEND;
- dl.l.lower = a1 << 21L;
-
- return dl.d;
-}
-
-/* convert int to double */
-double
-__floatsidf (long a1)
-{
- long sign = 0, exp = 31 + EXCESSD;
- union double_long dl;
-
- if (!a1)
- {
- dl.l.upper = dl.l.lower = 0;
- return dl.d;
- }
-
- if (a1 < 0)
- {
- sign = SIGNBIT;
- a1 = (long)-(unsigned long)a1;
- if (a1 < 0)
- {
- dl.l.upper = SIGNBIT | ((32 + EXCESSD) << 20L);
- dl.l.lower = 0;
- return dl.d;
- }
- }
-
- while (a1 < 0x1000000L)
- {
- a1 <<= 4;
- exp -= 4;
- }
-
- while (a1 < 0x40000000L)
- {
- a1 <<= 1;
- exp--;
- }
-
- /* pack up and go home */
- dl.l.upper = sign;
- dl.l.upper |= exp << 20L;
- dl.l.upper |= (a1 >> 10L) & ~HIDDEND;
- dl.l.lower = a1 << 22L;
-
- return dl.d;
-}
-
-/* convert unsigned int to float */
-float
-__floatunsisf (unsigned long l)
-{
- double foo = __floatunsidf (l);
- return foo;
-}
-
-/* convert int to float */
-float
-__floatsisf (long l)
-{
- double foo = __floatsidf (l);
- return foo;
-}
-
-/* convert float to double */
-double
-__extendsfdf2 (float a1)
-{
- register union float_long fl1;
- register union double_long dl;
- register long exp;
- register long mant;
-
- fl1.f = a1;
-
- dl.l.upper = SIGN (fl1.l);
- if ((fl1.l & ~SIGNBIT) == 0)
- {
- dl.l.lower = 0;
- return dl.d;
- }
-
- exp = EXP(fl1.l);
- mant = MANT (fl1.l) & ~HIDDEN;
- if (exp == 0)
- {
- /* Denormal. */
- exp = 1;
- while (!(mant & HIDDEN))
- {
- mant <<= 1;
- exp--;
- }
- mant &= ~HIDDEN;
- }
- exp = exp - EXCESS + EXCESSD;
- dl.l.upper |= exp << 20;
- dl.l.upper |= mant >> 3;
- dl.l.lower = mant << 29;
-
- return dl.d;
-}
-
-/* convert double to float */
-float
-__truncdfsf2 (double a1)
-{
- register long exp;
- register long mant;
- register union float_long fl;
- register union double_long dl1;
- int sticky;
- int shift;
-
- dl1.d = a1;
-
- if ((dl1.l.upper & ~SIGNBIT) == 0 && !dl1.l.lower)
- {
- fl.l = SIGND(dl1);
- return fl.f;
- }
-
- exp = EXPD (dl1) - EXCESSD + EXCESS;
-
- sticky = dl1.l.lower & ((1 << 22) - 1);
- mant = MANTD (dl1);
- /* shift double mantissa 6 bits so we can round */
- sticky |= mant & ((1 << 6) - 1);
- mant >>= 6;
-
- /* Check for underflow and denormals. */
- if (exp <= 0)
- {
- if (exp < -24)
- {
- sticky |= mant;
- mant = 0;
- }
- else
- {
- sticky |= mant & ((1 << (1 - exp)) - 1);
- mant >>= 1 - exp;
- }
- exp = 0;
- }
-
- /* now round */
- shift = 1;
- if ((mant & 1) && (sticky || (mant & 2)))
- {
- int rounding = exp ? 2 : 1;
-
- mant += 1;
-
- /* did the round overflow? */
- if (mant >= (HIDDEN << rounding))
- {
- exp++;
- shift = rounding;
- }
- }
- /* shift down */
- mant >>= shift;
-
- mant &= ~HIDDEN;
-
- /* pack up and go home */
- fl.l = PACK (SIGND (dl1), exp, mant);
- return (fl.f);
-}
-
-/* convert double to int */
-long
-__fixdfsi (double a1)
-{
- register union double_long dl1;
- register long exp;
- register long l;
-
- dl1.d = a1;
-
- if (!dl1.l.upper && !dl1.l.lower)
- return 0;
-
- exp = EXPD (dl1) - EXCESSD - 31;
- l = MANTD (dl1);
-
- if (exp > 0)
- {
- /* Return largest integer. */
- return SIGND (dl1) ? 0x80000000L : 0x7fffffffL;
- }
-
- if (exp <= -32)
- return 0;
-
- /* shift down until exp = 0 */
- if (exp < 0)
- l >>= -exp;
-
- return (SIGND (dl1) ? -l : l);
-}
-
-/* convert float to int */
-long
-__fixsfsi (float a1)
-{
- double foo = a1;
- return __fixdfsi (foo);
-}
-
-#else /* EXTFLOAT */
-
-/* We do not need these routines for coldfire, as it has no extended
- float format. */
-#if !defined (__mcoldfire__)
-
-/* Primitive extended precision floating point support.
-
- We assume all numbers are normalized, don't do any rounding, etc. */
-
-/* Prototypes for the above in case we use them. */
-double __floatunsidf (unsigned long);
-double __floatsidf (long);
-float __floatsisf (long);
-double __extendsfdf2 (float);
-float __truncdfsf2 (double);
-long __fixdfsi (double);
-long __fixsfsi (float);
-
-int
-__unordxf2(long double a, long double b)
-{
- union long_double_long ldl;
-
- ldl.ld = a;
- if (EXPX(ldl) == EXPXMASK
- && ((ldl.l.middle & MANTXMASK) != 0 || ldl.l.lower != 0))
- return 1;
- ldl.ld = b;
- if (EXPX(ldl) == EXPXMASK
- && ((ldl.l.middle & MANTXMASK) != 0 || ldl.l.lower != 0))
- return 1;
- return 0;
-}
-
-/* convert double to long double */
-long double
-__extenddfxf2 (double d)
-{
- register union double_long dl;
- register union long_double_long ldl;
- register long exp;
-
- dl.d = d;
- /*printf ("dfxf in: %g\n", d);*/
-
- ldl.l.upper = SIGND (dl);
- if ((dl.l.upper & ~SIGNBIT) == 0 && !dl.l.lower)
- {
- ldl.l.middle = 0;
- ldl.l.lower = 0;
- return ldl.ld;
- }
-
- exp = EXPD (dl) - EXCESSD + EXCESSX;
- ldl.l.upper |= exp << 16;
- ldl.l.middle = HIDDENX;
- /* 31-20: # mantissa bits in ldl.l.middle - # mantissa bits in dl.l.upper */
- ldl.l.middle |= (dl.l.upper & MANTDMASK) << (31 - 20);
- /* 1+20: explicit-integer-bit + # mantissa bits in dl.l.upper */
- ldl.l.middle |= dl.l.lower >> (1 + 20);
- /* 32 - 21: # bits of dl.l.lower in ldl.l.middle */
- ldl.l.lower = dl.l.lower << (32 - 21);
-
- /*printf ("dfxf out: %s\n", dumpxf (ldl.ld));*/
- return ldl.ld;
-}
-
-/* convert long double to double */
-double
-__truncxfdf2 (long double ld)
-{
- register long exp;
- register union double_long dl;
- register union long_double_long ldl;
-
- ldl.ld = ld;
- /*printf ("xfdf in: %s\n", dumpxf (ld));*/
-
- dl.l.upper = SIGNX (ldl);
- if ((ldl.l.upper & ~SIGNBIT) == 0 && !ldl.l.middle && !ldl.l.lower)
- {
- dl.l.lower = 0;
- return dl.d;
- }
-
- exp = EXPX (ldl) - EXCESSX + EXCESSD;
- /* ??? quick and dirty: keep `exp' sane */
- if (exp >= EXPDMASK)
- exp = EXPDMASK - 1;
- dl.l.upper |= exp << (32 - (EXPDBITS + 1));
- /* +1-1: add one for sign bit, but take one off for explicit-integer-bit */
- dl.l.upper |= (ldl.l.middle & MANTXMASK) >> (EXPDBITS + 1 - 1);
- dl.l.lower = (ldl.l.middle & MANTXMASK) << (32 - (EXPDBITS + 1 - 1));
- dl.l.lower |= ldl.l.lower >> (EXPDBITS + 1 - 1);
-
- /*printf ("xfdf out: %g\n", dl.d);*/
- return dl.d;
-}
-
-/* convert a float to a long double */
-long double
-__extendsfxf2 (float f)
-{
- long double foo = __extenddfxf2 (__extendsfdf2 (f));
- return foo;
-}
-
-/* convert a long double to a float */
-float
-__truncxfsf2 (long double ld)
-{
- float foo = __truncdfsf2 (__truncxfdf2 (ld));
- return foo;
-}
-
-/* convert an int to a long double */
-long double
-__floatsixf (long l)
-{
- double foo = __floatsidf (l);
- return foo;
-}
-
-/* convert an unsigned int to a long double */
-long double
-__floatunsixf (unsigned long l)
-{
- double foo = __floatunsidf (l);
- return foo;
-}
-
-/* convert a long double to an int */
-long
-__fixxfsi (long double ld)
-{
- long foo = __fixdfsi ((double) ld);
- return foo;
-}
-
-/* The remaining provide crude math support by working in double precision. */
-
-long double
-__addxf3 (long double x1, long double x2)
-{
- return (double) x1 + (double) x2;
-}
-
-long double
-__subxf3 (long double x1, long double x2)
-{
- return (double) x1 - (double) x2;
-}
-
-long double
-__mulxf3 (long double x1, long double x2)
-{
- return (double) x1 * (double) x2;
-}
-
-long double
-__divxf3 (long double x1, long double x2)
-{
- return (double) x1 / (double) x2;
-}
-
-long double
-__negxf2 (long double x1)
-{
- return - (double) x1;
-}
-
-long
-__cmpxf2 (long double x1, long double x2)
-{
- return __cmpdf2 ((double) x1, (double) x2);
-}
-
-long
-__eqxf2 (long double x1, long double x2)
-{
- return __cmpdf2 ((double) x1, (double) x2);
-}
-
-long
-__nexf2 (long double x1, long double x2)
-{
- return __cmpdf2 ((double) x1, (double) x2);
-}
-
-long
-__ltxf2 (long double x1, long double x2)
-{
- return __cmpdf2 ((double) x1, (double) x2);
-}
-
-long
-__lexf2 (long double x1, long double x2)
-{
- return __cmpdf2 ((double) x1, (double) x2);
-}
-
-long
-__gtxf2 (long double x1, long double x2)
-{
- return __cmpdf2 ((double) x1, (double) x2);
-}
-
-long
-__gexf2 (long double x1, long double x2)
-{
- return __cmpdf2 ((double) x1, (double) x2);
-}
-
-#endif /* !__mcoldfire__ */
-#endif /* EXTFLOAT */
diff --git a/gcc/config/m68k/lb1sf68.asm b/gcc/config/m68k/lb1sf68.asm
deleted file mode 100644
index 0339a092c4f..00000000000
--- a/gcc/config/m68k/lb1sf68.asm
+++ /dev/null
@@ -1,4116 +0,0 @@
-/* libgcc routines for 68000 w/o floating-point hardware.
- Copyright (C) 1994, 1996, 1997, 1998, 2008, 2009 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.
-
-This file 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/>. */
-
-/* Use this one for any 680x0; assumes no floating point hardware.
- The trailing " '" appearing on some lines is for ANSI preprocessors. Yuk.
- Some of this code comes from MINIX, via the folks at ericsson.
- D. V. Henkel-Wallace (gumby@cygnus.com) Fete Bastille, 1992
-*/
-
-/* These are predefined by new versions of GNU cpp. */
-
-#ifndef __USER_LABEL_PREFIX__
-#define __USER_LABEL_PREFIX__ _
-#endif
-
-#ifndef __REGISTER_PREFIX__
-#define __REGISTER_PREFIX__
-#endif
-
-#ifndef __IMMEDIATE_PREFIX__
-#define __IMMEDIATE_PREFIX__ #
-#endif
-
-/* ANSI concatenation macros. */
-
-#define CONCAT1(a, b) CONCAT2(a, b)
-#define CONCAT2(a, b) a ## b
-
-/* Use the right prefix for global labels. */
-
-#define SYM(x) CONCAT1 (__USER_LABEL_PREFIX__, x)
-
-/* Note that X is a function. */
-
-#ifdef __ELF__
-#define FUNC(x) .type SYM(x),function
-#else
-/* The .proc pseudo-op is accepted, but ignored, by GAS. We could just
- define this to the empty string for non-ELF systems, but defining it
- to .proc means that the information is available to the assembler if
- the need arises. */
-#define FUNC(x) .proc
-#endif
-
-/* Use the right prefix for registers. */
-
-#define REG(x) CONCAT1 (__REGISTER_PREFIX__, x)
-
-/* Use the right prefix for immediate values. */
-
-#define IMM(x) CONCAT1 (__IMMEDIATE_PREFIX__, x)
-
-#define d0 REG (d0)
-#define d1 REG (d1)
-#define d2 REG (d2)
-#define d3 REG (d3)
-#define d4 REG (d4)
-#define d5 REG (d5)
-#define d6 REG (d6)
-#define d7 REG (d7)
-#define a0 REG (a0)
-#define a1 REG (a1)
-#define a2 REG (a2)
-#define a3 REG (a3)
-#define a4 REG (a4)
-#define a5 REG (a5)
-#define a6 REG (a6)
-#define fp REG (fp)
-#define sp REG (sp)
-#define pc REG (pc)
-
-/* Provide a few macros to allow for PIC code support.
- * With PIC, data is stored A5 relative so we've got to take a bit of special
- * care to ensure that all loads of global data is via A5. PIC also requires
- * jumps and subroutine calls to be PC relative rather than absolute. We cheat
- * a little on this and in the PIC case, we use short offset branches and
- * hope that the final object code is within range (which it should be).
- */
-#ifndef __PIC__
-
- /* Non PIC (absolute/relocatable) versions */
-
- .macro PICCALL addr
- jbsr \addr
- .endm
-
- .macro PICJUMP addr
- jmp \addr
- .endm
-
- .macro PICLEA sym, reg
- lea \sym, \reg
- .endm
-
- .macro PICPEA sym, areg
- pea \sym
- .endm
-
-#else /* __PIC__ */
-
-# if defined (__uClinux__)
-
- /* Versions for uClinux */
-
-# if defined(__ID_SHARED_LIBRARY__)
-
- /* -mid-shared-library versions */
-
- .macro PICLEA sym, reg
- movel a5@(_current_shared_library_a5_offset_), \reg
- movel \sym@GOT(\reg), \reg
- .endm
-
- .macro PICPEA sym, areg
- movel a5@(_current_shared_library_a5_offset_), \areg
- movel \sym@GOT(\areg), sp@-
- .endm
-
- .macro PICCALL addr
- PICLEA \addr,a0
- jsr a0@
- .endm
-
- .macro PICJUMP addr
- PICLEA \addr,a0
- jmp a0@
- .endm
-
-# else /* !__ID_SHARED_LIBRARY__ */
-
- /* Versions for -msep-data */
-
- .macro PICLEA sym, reg
- movel \sym@GOT(a5), \reg
- .endm
-
- .macro PICPEA sym, areg
- movel \sym@GOT(a5), sp@-
- .endm
-
- .macro PICCALL addr
-#if defined (__mcoldfire__) && !defined (__mcfisab__) && !defined (__mcfisac__)
- lea \addr-.-8,a0
- jsr pc@(a0)
-#else
- jbsr \addr
-#endif
- .endm
-
- .macro PICJUMP addr
- /* ISA C has no bra.l instruction, and since this assembly file
- gets assembled into multiple object files, we avoid the
- bra instruction entirely. */
-#if defined (__mcoldfire__) && !defined (__mcfisab__)
- lea \addr-.-8,a0
- jmp pc@(a0)
-#else
- bra \addr
-#endif
- .endm
-
-# endif
-
-# else /* !__uClinux__ */
-
- /* Versions for Linux */
-
- .macro PICLEA sym, reg
- movel #_GLOBAL_OFFSET_TABLE_@GOTPC, \reg
- lea (-6, pc, \reg), \reg
- movel \sym@GOT(\reg), \reg
- .endm
-
- .macro PICPEA sym, areg
- movel #_GLOBAL_OFFSET_TABLE_@GOTPC, \areg
- lea (-6, pc, \areg), \areg
- movel \sym@GOT(\areg), sp@-
- .endm
-
- .macro PICCALL addr
-#if defined (__mcoldfire__) && !defined (__mcfisab__) && !defined (__mcfisac__)
- lea \addr-.-8,a0
- jsr pc@(a0)
-#else
- jbsr \addr
-#endif
- .endm
-
- .macro PICJUMP addr
- /* ISA C has no bra.l instruction, and since this assembly file
- gets assembled into multiple object files, we avoid the
- bra instruction entirely. */
-#if defined (__mcoldfire__) && !defined (__mcfisab__)
- lea \addr-.-8,a0
- jmp pc@(a0)
-#else
- bra \addr
-#endif
- .endm
-
-# endif
-#endif /* __PIC__ */
-
-
-#ifdef L_floatex
-
-| This is an attempt at a decent floating point (single, double and
-| extended double) code for the GNU C compiler. It should be easy to
-| adapt to other compilers (but beware of the local labels!).
-
-| Starting date: 21 October, 1990
-
-| It is convenient to introduce the notation (s,e,f) for a floating point
-| number, where s=sign, e=exponent, f=fraction. We will call a floating
-| point number fpn to abbreviate, independently of the precision.
-| Let MAX_EXP be in each case the maximum exponent (255 for floats, 1023
-| for doubles and 16383 for long doubles). We then have the following
-| different cases:
-| 1. Normalized fpns have 0 < e < MAX_EXP. They correspond to
-| (-1)^s x 1.f x 2^(e-bias-1).
-| 2. Denormalized fpns have e=0. They correspond to numbers of the form
-| (-1)^s x 0.f x 2^(-bias).
-| 3. +/-INFINITY have e=MAX_EXP, f=0.
-| 4. Quiet NaN (Not a Number) have all bits set.
-| 5. Signaling NaN (Not a Number) have s=0, e=MAX_EXP, f=1.
-
-|=============================================================================
-| exceptions
-|=============================================================================
-
-| This is the floating point condition code register (_fpCCR):
-|
-| struct {
-| short _exception_bits;
-| short _trap_enable_bits;
-| short _sticky_bits;
-| short _rounding_mode;
-| short _format;
-| short _last_operation;
-| union {
-| float sf;
-| double df;
-| } _operand1;
-| union {
-| float sf;
-| double df;
-| } _operand2;
-| } _fpCCR;
-
- .data
- .even
-
- .globl SYM (_fpCCR)
-
-SYM (_fpCCR):
-__exception_bits:
- .word 0
-__trap_enable_bits:
- .word 0
-__sticky_bits:
- .word 0
-__rounding_mode:
- .word ROUND_TO_NEAREST
-__format:
- .word NIL
-__last_operation:
- .word NOOP
-__operand1:
- .long 0
- .long 0
-__operand2:
- .long 0
- .long 0
-
-| Offsets:
-EBITS = __exception_bits - SYM (_fpCCR)
-TRAPE = __trap_enable_bits - SYM (_fpCCR)
-STICK = __sticky_bits - SYM (_fpCCR)
-ROUND = __rounding_mode - SYM (_fpCCR)
-FORMT = __format - SYM (_fpCCR)
-LASTO = __last_operation - SYM (_fpCCR)
-OPER1 = __operand1 - SYM (_fpCCR)
-OPER2 = __operand2 - SYM (_fpCCR)
-
-| The following exception types are supported:
-INEXACT_RESULT = 0x0001
-UNDERFLOW = 0x0002
-OVERFLOW = 0x0004
-DIVIDE_BY_ZERO = 0x0008
-INVALID_OPERATION = 0x0010
-
-| The allowed rounding modes are:
-UNKNOWN = -1
-ROUND_TO_NEAREST = 0 | round result to nearest representable value
-ROUND_TO_ZERO = 1 | round result towards zero
-ROUND_TO_PLUS = 2 | round result towards plus infinity
-ROUND_TO_MINUS = 3 | round result towards minus infinity
-
-| The allowed values of format are:
-NIL = 0
-SINGLE_FLOAT = 1
-DOUBLE_FLOAT = 2
-LONG_FLOAT = 3
-
-| The allowed values for the last operation are:
-NOOP = 0
-ADD = 1
-MULTIPLY = 2
-DIVIDE = 3
-NEGATE = 4
-COMPARE = 5
-EXTENDSFDF = 6
-TRUNCDFSF = 7
-
-|=============================================================================
-| __clear_sticky_bits
-|=============================================================================
-
-| The sticky bits are normally not cleared (thus the name), whereas the
-| exception type and exception value reflect the last computation.
-| This routine is provided to clear them (you can also write to _fpCCR,
-| since it is globally visible).
-
- .globl SYM (__clear_sticky_bit)
-
- .text
- .even
-
-| void __clear_sticky_bits(void);
-SYM (__clear_sticky_bit):
- PICLEA SYM (_fpCCR),a0
-#ifndef __mcoldfire__
- movew IMM (0),a0@(STICK)
-#else
- clr.w a0@(STICK)
-#endif
- rts
-
-|=============================================================================
-| $_exception_handler
-|=============================================================================
-
- .globl $_exception_handler
-
- .text
- .even
-
-| This is the common exit point if an exception occurs.
-| NOTE: it is NOT callable from C!
-| It expects the exception type in d7, the format (SINGLE_FLOAT,
-| DOUBLE_FLOAT or LONG_FLOAT) in d6, and the last operation code in d5.
-| It sets the corresponding exception and sticky bits, and the format.
-| Depending on the format if fills the corresponding slots for the
-| operands which produced the exception (all this information is provided
-| so if you write your own exception handlers you have enough information
-| to deal with the problem).
-| Then checks to see if the corresponding exception is trap-enabled,
-| in which case it pushes the address of _fpCCR and traps through
-| trap FPTRAP (15 for the moment).
-
-FPTRAP = 15
-
-$_exception_handler:
- PICLEA SYM (_fpCCR),a0
- movew d7,a0@(EBITS) | set __exception_bits
-#ifndef __mcoldfire__
- orw d7,a0@(STICK) | and __sticky_bits
-#else
- movew a0@(STICK),d4
- orl d7,d4
- movew d4,a0@(STICK)
-#endif
- movew d6,a0@(FORMT) | and __format
- movew d5,a0@(LASTO) | and __last_operation
-
-| Now put the operands in place:
-#ifndef __mcoldfire__
- cmpw IMM (SINGLE_FLOAT),d6
-#else
- cmpl IMM (SINGLE_FLOAT),d6
-#endif
- beq 1f
- movel a6@(8),a0@(OPER1)
- movel a6@(12),a0@(OPER1+4)
- movel a6@(16),a0@(OPER2)
- movel a6@(20),a0@(OPER2+4)
- bra 2f
-1: movel a6@(8),a0@(OPER1)
- movel a6@(12),a0@(OPER2)
-2:
-| And check whether the exception is trap-enabled:
-#ifndef __mcoldfire__
- andw a0@(TRAPE),d7 | is exception trap-enabled?
-#else
- clrl d6
- movew a0@(TRAPE),d6
- andl d6,d7
-#endif
- beq 1f | no, exit
- PICPEA SYM (_fpCCR),a1 | yes, push address of _fpCCR
- trap IMM (FPTRAP) | and trap
-#ifndef __mcoldfire__
-1: moveml sp@+,d2-d7 | restore data registers
-#else
-1: moveml sp@,d2-d7
- | XXX if frame pointer is ever removed, stack pointer must
- | be adjusted here.
-#endif
- unlk a6 | and return
- rts
-#endif /* L_floatex */
-
-#ifdef L_mulsi3
- .text
- FUNC(__mulsi3)
- .globl SYM (__mulsi3)
-SYM (__mulsi3):
- movew sp@(4), d0 /* x0 -> d0 */
- muluw sp@(10), d0 /* x0*y1 */
- movew sp@(6), d1 /* x1 -> d1 */
- muluw sp@(8), d1 /* x1*y0 */
-#ifndef __mcoldfire__
- addw d1, d0
-#else
- addl d1, d0
-#endif
- swap d0
- clrw d0
- movew sp@(6), d1 /* x1 -> d1 */
- muluw sp@(10), d1 /* x1*y1 */
- addl d1, d0
-
- rts
-#endif /* L_mulsi3 */
-
-#ifdef L_udivsi3
- .text
- FUNC(__udivsi3)
- .globl SYM (__udivsi3)
-SYM (__udivsi3):
-#ifndef __mcoldfire__
- movel d2, sp@-
- movel sp@(12), d1 /* d1 = divisor */
- movel sp@(8), d0 /* d0 = dividend */
-
- cmpl IMM (0x10000), d1 /* divisor >= 2 ^ 16 ? */
- jcc L3 /* then try next algorithm */
- movel d0, d2
- clrw d2
- swap d2
- divu d1, d2 /* high quotient in lower word */
- movew d2, d0 /* save high quotient */
- swap d0
- movew sp@(10), d2 /* get low dividend + high rest */
- divu d1, d2 /* low quotient */
- movew d2, d0
- jra L6
-
-L3: movel d1, d2 /* use d2 as divisor backup */
-L4: lsrl IMM (1), d1 /* shift divisor */
- lsrl IMM (1), d0 /* shift dividend */
- cmpl IMM (0x10000), d1 /* still divisor >= 2 ^ 16 ? */
- jcc L4
- divu d1, d0 /* now we have 16-bit divisor */
- andl IMM (0xffff), d0 /* mask out divisor, ignore remainder */
-
-/* Multiply the 16-bit tentative quotient with the 32-bit divisor. Because of
- the operand ranges, this might give a 33-bit product. If this product is
- greater than the dividend, the tentative quotient was too large. */
- movel d2, d1
- mulu d0, d1 /* low part, 32 bits */
- swap d2
- mulu d0, d2 /* high part, at most 17 bits */
- swap d2 /* align high part with low part */
- tstw d2 /* high part 17 bits? */
- jne L5 /* if 17 bits, quotient was too large */
- addl d2, d1 /* add parts */
- jcs L5 /* if sum is 33 bits, quotient was too large */
- cmpl sp@(8), d1 /* compare the sum with the dividend */
- jls L6 /* if sum > dividend, quotient was too large */
-L5: subql IMM (1), d0 /* adjust quotient */
-
-L6: movel sp@+, d2
- rts
-
-#else /* __mcoldfire__ */
-
-/* ColdFire implementation of non-restoring division algorithm from
- Hennessy & Patterson, Appendix A. */
- link a6,IMM (-12)
- moveml d2-d4,sp@
- movel a6@(8),d0
- movel a6@(12),d1
- clrl d2 | clear p
- moveq IMM (31),d4
-L1: addl d0,d0 | shift reg pair (p,a) one bit left
- addxl d2,d2
- movl d2,d3 | subtract b from p, store in tmp.
- subl d1,d3
- jcs L2 | if no carry,
- bset IMM (0),d0 | set the low order bit of a to 1,
- movl d3,d2 | and store tmp in p.
-L2: subql IMM (1),d4
- jcc L1
- moveml sp@,d2-d4 | restore data registers
- unlk a6 | and return
- rts
-#endif /* __mcoldfire__ */
-
-#endif /* L_udivsi3 */
-
-#ifdef L_divsi3
- .text
- FUNC(__divsi3)
- .globl SYM (__divsi3)
-SYM (__divsi3):
- movel d2, sp@-
-
- moveq IMM (1), d2 /* sign of result stored in d2 (=1 or =-1) */
- movel sp@(12), d1 /* d1 = divisor */
- jpl L1
- negl d1
-#ifndef __mcoldfire__
- negb d2 /* change sign because divisor <0 */
-#else
- negl d2 /* change sign because divisor <0 */
-#endif
-L1: movel sp@(8), d0 /* d0 = dividend */
- jpl L2
- negl d0
-#ifndef __mcoldfire__
- negb d2
-#else
- negl d2
-#endif
-
-L2: movel d1, sp@-
- movel d0, sp@-
- PICCALL SYM (__udivsi3) /* divide abs(dividend) by abs(divisor) */
- addql IMM (8), sp
-
- tstb d2
- jpl L3
- negl d0
-
-L3: movel sp@+, d2
- rts
-#endif /* L_divsi3 */
-
-#ifdef L_umodsi3
- .text
- FUNC(__umodsi3)
- .globl SYM (__umodsi3)
-SYM (__umodsi3):
- movel sp@(8), d1 /* d1 = divisor */
- movel sp@(4), d0 /* d0 = dividend */
- movel d1, sp@-
- movel d0, sp@-
- PICCALL SYM (__udivsi3)
- addql IMM (8), sp
- movel sp@(8), d1 /* d1 = divisor */
-#ifndef __mcoldfire__
- movel d1, sp@-
- movel d0, sp@-
- PICCALL SYM (__mulsi3) /* d0 = (a/b)*b */
- addql IMM (8), sp
-#else
- mulsl d1,d0
-#endif
- movel sp@(4), d1 /* d1 = dividend */
- subl d0, d1 /* d1 = a - (a/b)*b */
- movel d1, d0
- rts
-#endif /* L_umodsi3 */
-
-#ifdef L_modsi3
- .text
- FUNC(__modsi3)
- .globl SYM (__modsi3)
-SYM (__modsi3):
- movel sp@(8), d1 /* d1 = divisor */
- movel sp@(4), d0 /* d0 = dividend */
- movel d1, sp@-
- movel d0, sp@-
- PICCALL SYM (__divsi3)
- addql IMM (8), sp
- movel sp@(8), d1 /* d1 = divisor */
-#ifndef __mcoldfire__
- movel d1, sp@-
- movel d0, sp@-
- PICCALL SYM (__mulsi3) /* d0 = (a/b)*b */
- addql IMM (8), sp
-#else
- mulsl d1,d0
-#endif
- movel sp@(4), d1 /* d1 = dividend */
- subl d0, d1 /* d1 = a - (a/b)*b */
- movel d1, d0
- rts
-#endif /* L_modsi3 */
-
-
-#ifdef L_double
-
- .globl SYM (_fpCCR)
- .globl $_exception_handler
-
-QUIET_NaN = 0xffffffff
-
-D_MAX_EXP = 0x07ff
-D_BIAS = 1022
-DBL_MAX_EXP = D_MAX_EXP - D_BIAS
-DBL_MIN_EXP = 1 - D_BIAS
-DBL_MANT_DIG = 53
-
-INEXACT_RESULT = 0x0001
-UNDERFLOW = 0x0002
-OVERFLOW = 0x0004
-DIVIDE_BY_ZERO = 0x0008
-INVALID_OPERATION = 0x0010
-
-DOUBLE_FLOAT = 2
-
-NOOP = 0
-ADD = 1
-MULTIPLY = 2
-DIVIDE = 3
-NEGATE = 4
-COMPARE = 5
-EXTENDSFDF = 6
-TRUNCDFSF = 7
-
-UNKNOWN = -1
-ROUND_TO_NEAREST = 0 | round result to nearest representable value
-ROUND_TO_ZERO = 1 | round result towards zero
-ROUND_TO_PLUS = 2 | round result towards plus infinity
-ROUND_TO_MINUS = 3 | round result towards minus infinity
-
-| Entry points:
-
- .globl SYM (__adddf3)
- .globl SYM (__subdf3)
- .globl SYM (__muldf3)
- .globl SYM (__divdf3)
- .globl SYM (__negdf2)
- .globl SYM (__cmpdf2)
- .globl SYM (__cmpdf2_internal)
- .hidden SYM (__cmpdf2_internal)
-
- .text
- .even
-
-| These are common routines to return and signal exceptions.
-
-Ld$den:
-| Return and signal a denormalized number
- orl d7,d0
- movew IMM (INEXACT_RESULT+UNDERFLOW),d7
- moveq IMM (DOUBLE_FLOAT),d6
- PICJUMP $_exception_handler
-
-Ld$infty:
-Ld$overflow:
-| Return a properly signed INFINITY and set the exception flags
- movel IMM (0x7ff00000),d0
- movel IMM (0),d1
- orl d7,d0
- movew IMM (INEXACT_RESULT+OVERFLOW),d7
- moveq IMM (DOUBLE_FLOAT),d6
- PICJUMP $_exception_handler
-
-Ld$underflow:
-| Return 0 and set the exception flags
- movel IMM (0),d0
- movel d0,d1
- movew IMM (INEXACT_RESULT+UNDERFLOW),d7
- moveq IMM (DOUBLE_FLOAT),d6
- PICJUMP $_exception_handler
-
-Ld$inop:
-| Return a quiet NaN and set the exception flags
- movel IMM (QUIET_NaN),d0
- movel d0,d1
- movew IMM (INEXACT_RESULT+INVALID_OPERATION),d7
- moveq IMM (DOUBLE_FLOAT),d6
- PICJUMP $_exception_handler
-
-Ld$div$0:
-| Return a properly signed INFINITY and set the exception flags
- movel IMM (0x7ff00000),d0
- movel IMM (0),d1
- orl d7,d0
- movew IMM (INEXACT_RESULT+DIVIDE_BY_ZERO),d7
- moveq IMM (DOUBLE_FLOAT),d6
- PICJUMP $_exception_handler
-
-|=============================================================================
-|=============================================================================
-| double precision routines
-|=============================================================================
-|=============================================================================
-
-| A double precision floating point number (double) has the format:
-|
-| struct _double {
-| unsigned int sign : 1; /* sign bit */
-| unsigned int exponent : 11; /* exponent, shifted by 126 */
-| unsigned int fraction : 52; /* fraction */
-| } double;
-|
-| Thus sizeof(double) = 8 (64 bits).
-|
-| All the routines are callable from C programs, and return the result
-| in the register pair d0-d1. They also preserve all registers except
-| d0-d1 and a0-a1.
-
-|=============================================================================
-| __subdf3
-|=============================================================================
-
-| double __subdf3(double, double);
- FUNC(__subdf3)
-SYM (__subdf3):
- bchg IMM (31),sp@(12) | change sign of second operand
- | and fall through, so we always add
-|=============================================================================
-| __adddf3
-|=============================================================================
-
-| double __adddf3(double, double);
- FUNC(__adddf3)
-SYM (__adddf3):
-#ifndef __mcoldfire__
- link a6,IMM (0) | everything will be done in registers
- moveml d2-d7,sp@- | save all data registers and a2 (but d0-d1)
-#else
- link a6,IMM (-24)
- moveml d2-d7,sp@
-#endif
- movel a6@(8),d0 | get first operand
- movel a6@(12),d1 |
- movel a6@(16),d2 | get second operand
- movel a6@(20),d3 |
-
- movel d0,d7 | get d0's sign bit in d7 '
- addl d1,d1 | check and clear sign bit of a, and gain one
- addxl d0,d0 | bit of extra precision
- beq Ladddf$b | if zero return second operand
-
- movel d2,d6 | save sign in d6
- addl d3,d3 | get rid of sign bit and gain one bit of
- addxl d2,d2 | extra precision
- beq Ladddf$a | if zero return first operand
-
- andl IMM (0x80000000),d7 | isolate a's sign bit '
- swap d6 | and also b's sign bit '
-#ifndef __mcoldfire__
- andw IMM (0x8000),d6 |
- orw d6,d7 | and combine them into d7, so that a's sign '
- | bit is in the high word and b's is in the '
- | low word, so d6 is free to be used
-#else
- andl IMM (0x8000),d6
- orl d6,d7
-#endif
- movel d7,a0 | now save d7 into a0, so d7 is free to
- | be used also
-
-| Get the exponents and check for denormalized and/or infinity.
-
- movel IMM (0x001fffff),d6 | mask for the fraction
- movel IMM (0x00200000),d7 | mask to put hidden bit back
-
- movel d0,d4 |
- andl d6,d0 | get fraction in d0
- notl d6 | make d6 into mask for the exponent
- andl d6,d4 | get exponent in d4
- beq Ladddf$a$den | branch if a is denormalized
- cmpl d6,d4 | check for INFINITY or NaN
- beq Ladddf$nf |
- orl d7,d0 | and put hidden bit back
-Ladddf$1:
- swap d4 | shift right exponent so that it starts
-#ifndef __mcoldfire__
- lsrw IMM (5),d4 | in bit 0 and not bit 20
-#else
- lsrl IMM (5),d4 | in bit 0 and not bit 20
-#endif
-| Now we have a's exponent in d4 and fraction in d0-d1 '
- movel d2,d5 | save b to get exponent
- andl d6,d5 | get exponent in d5
- beq Ladddf$b$den | branch if b is denormalized
- cmpl d6,d5 | check for INFINITY or NaN
- beq Ladddf$nf
- notl d6 | make d6 into mask for the fraction again
- andl d6,d2 | and get fraction in d2
- orl d7,d2 | and put hidden bit back
-Ladddf$2:
- swap d5 | shift right exponent so that it starts
-#ifndef __mcoldfire__
- lsrw IMM (5),d5 | in bit 0 and not bit 20
-#else
- lsrl IMM (5),d5 | in bit 0 and not bit 20
-#endif
-
-| Now we have b's exponent in d5 and fraction in d2-d3. '
-
-| The situation now is as follows: the signs are combined in a0, the
-| numbers are in d0-d1 (a) and d2-d3 (b), and the exponents in d4 (a)
-| and d5 (b). To do the rounding correctly we need to keep all the
-| bits until the end, so we need to use d0-d1-d2-d3 for the first number
-| and d4-d5-d6-d7 for the second. To do this we store (temporarily) the
-| exponents in a2-a3.
-
-#ifndef __mcoldfire__
- moveml a2-a3,sp@- | save the address registers
-#else
- movel a2,sp@-
- movel a3,sp@-
- movel a4,sp@-
-#endif
-
- movel d4,a2 | save the exponents
- movel d5,a3 |
-
- movel IMM (0),d7 | and move the numbers around
- movel d7,d6 |
- movel d3,d5 |
- movel d2,d4 |
- movel d7,d3 |
- movel d7,d2 |
-
-| Here we shift the numbers until the exponents are the same, and put
-| the largest exponent in a2.
-#ifndef __mcoldfire__
- exg d4,a2 | get exponents back
- exg d5,a3 |
- cmpw d4,d5 | compare the exponents
-#else
- movel d4,a4 | get exponents back
- movel a2,d4
- movel a4,a2
- movel d5,a4
- movel a3,d5
- movel a4,a3
- cmpl d4,d5 | compare the exponents
-#endif
- beq Ladddf$3 | if equal don't shift '
- bhi 9f | branch if second exponent is higher
-
-| Here we have a's exponent larger than b's, so we have to shift b. We do
-| this by using as counter d2:
-1: movew d4,d2 | move largest exponent to d2
-#ifndef __mcoldfire__
- subw d5,d2 | and subtract second exponent
- exg d4,a2 | get back the longs we saved
- exg d5,a3 |
-#else
- subl d5,d2 | and subtract second exponent
- movel d4,a4 | get back the longs we saved
- movel a2,d4
- movel a4,a2
- movel d5,a4
- movel a3,d5
- movel a4,a3
-#endif
-| if difference is too large we don't shift (actually, we can just exit) '
-#ifndef __mcoldfire__
- cmpw IMM (DBL_MANT_DIG+2),d2
-#else
- cmpl IMM (DBL_MANT_DIG+2),d2
-#endif
- bge Ladddf$b$small
-#ifndef __mcoldfire__
- cmpw IMM (32),d2 | if difference >= 32, shift by longs
-#else
- cmpl IMM (32),d2 | if difference >= 32, shift by longs
-#endif
- bge 5f
-2:
-#ifndef __mcoldfire__
- cmpw IMM (16),d2 | if difference >= 16, shift by words
-#else
- cmpl IMM (16),d2 | if difference >= 16, shift by words
-#endif
- bge 6f
- bra 3f | enter dbra loop
-
-4:
-#ifndef __mcoldfire__
- lsrl IMM (1),d4
- roxrl IMM (1),d5
- roxrl IMM (1),d6
- roxrl IMM (1),d7
-#else
- lsrl IMM (1),d7
- btst IMM (0),d6
- beq 10f
- bset IMM (31),d7
-10: lsrl IMM (1),d6
- btst IMM (0),d5
- beq 11f
- bset IMM (31),d6
-11: lsrl IMM (1),d5
- btst IMM (0),d4
- beq 12f
- bset IMM (31),d5
-12: lsrl IMM (1),d4
-#endif
-3:
-#ifndef __mcoldfire__
- dbra d2,4b
-#else
- subql IMM (1),d2
- bpl 4b
-#endif
- movel IMM (0),d2
- movel d2,d3
- bra Ladddf$4
-5:
- movel d6,d7
- movel d5,d6
- movel d4,d5
- movel IMM (0),d4
-#ifndef __mcoldfire__
- subw IMM (32),d2
-#else
- subl IMM (32),d2
-#endif
- bra 2b
-6:
- movew d6,d7
- swap d7
- movew d5,d6
- swap d6
- movew d4,d5
- swap d5
- movew IMM (0),d4
- swap d4
-#ifndef __mcoldfire__
- subw IMM (16),d2
-#else
- subl IMM (16),d2
-#endif
- bra 3b
-
-9:
-#ifndef __mcoldfire__
- exg d4,d5
- movew d4,d6
- subw d5,d6 | keep d5 (largest exponent) in d4
- exg d4,a2
- exg d5,a3
-#else
- movel d5,d6
- movel d4,d5
- movel d6,d4
- subl d5,d6
- movel d4,a4
- movel a2,d4
- movel a4,a2
- movel d5,a4
- movel a3,d5
- movel a4,a3
-#endif
-| if difference is too large we don't shift (actually, we can just exit) '
-#ifndef __mcoldfire__
- cmpw IMM (DBL_MANT_DIG+2),d6
-#else
- cmpl IMM (DBL_MANT_DIG+2),d6
-#endif
- bge Ladddf$a$small
-#ifndef __mcoldfire__
- cmpw IMM (32),d6 | if difference >= 32, shift by longs
-#else
- cmpl IMM (32),d6 | if difference >= 32, shift by longs
-#endif
- bge 5f
-2:
-#ifndef __mcoldfire__
- cmpw IMM (16),d6 | if difference >= 16, shift by words
-#else
- cmpl IMM (16),d6 | if difference >= 16, shift by words
-#endif
- bge 6f
- bra 3f | enter dbra loop
-
-4:
-#ifndef __mcoldfire__
- lsrl IMM (1),d0
- roxrl IMM (1),d1
- roxrl IMM (1),d2
- roxrl IMM (1),d3
-#else
- lsrl IMM (1),d3
- btst IMM (0),d2
- beq 10f
- bset IMM (31),d3
-10: lsrl IMM (1),d2
- btst IMM (0),d1
- beq 11f
- bset IMM (31),d2
-11: lsrl IMM (1),d1
- btst IMM (0),d0
- beq 12f
- bset IMM (31),d1
-12: lsrl IMM (1),d0
-#endif
-3:
-#ifndef __mcoldfire__
- dbra d6,4b
-#else
- subql IMM (1),d6
- bpl 4b
-#endif
- movel IMM (0),d7
- movel d7,d6
- bra Ladddf$4
-5:
- movel d2,d3
- movel d1,d2
- movel d0,d1
- movel IMM (0),d0
-#ifndef __mcoldfire__
- subw IMM (32),d6
-#else
- subl IMM (32),d6
-#endif
- bra 2b
-6:
- movew d2,d3
- swap d3
- movew d1,d2
- swap d2
- movew d0,d1
- swap d1
- movew IMM (0),d0
- swap d0
-#ifndef __mcoldfire__
- subw IMM (16),d6
-#else
- subl IMM (16),d6
-#endif
- bra 3b
-Ladddf$3:
-#ifndef __mcoldfire__
- exg d4,a2
- exg d5,a3
-#else
- movel d4,a4
- movel a2,d4
- movel a4,a2
- movel d5,a4
- movel a3,d5
- movel a4,a3
-#endif
-Ladddf$4:
-| Now we have the numbers in d0--d3 and d4--d7, the exponent in a2, and
-| the signs in a4.
-
-| Here we have to decide whether to add or subtract the numbers:
-#ifndef __mcoldfire__
- exg d7,a0 | get the signs
- exg d6,a3 | a3 is free to be used
-#else
- movel d7,a4
- movel a0,d7
- movel a4,a0
- movel d6,a4
- movel a3,d6
- movel a4,a3
-#endif
- movel d7,d6 |
- movew IMM (0),d7 | get a's sign in d7 '
- swap d6 |
- movew IMM (0),d6 | and b's sign in d6 '
- eorl d7,d6 | compare the signs
- bmi Lsubdf$0 | if the signs are different we have
- | to subtract
-#ifndef __mcoldfire__
- exg d7,a0 | else we add the numbers
- exg d6,a3 |
-#else
- movel d7,a4
- movel a0,d7
- movel a4,a0
- movel d6,a4
- movel a3,d6
- movel a4,a3
-#endif
- addl d7,d3 |
- addxl d6,d2 |
- addxl d5,d1 |
- addxl d4,d0 |
-
- movel a2,d4 | return exponent to d4
- movel a0,d7 |
- andl IMM (0x80000000),d7 | d7 now has the sign
-
-#ifndef __mcoldfire__
- moveml sp@+,a2-a3
-#else
- movel sp@+,a4
- movel sp@+,a3
- movel sp@+,a2
-#endif
-
-| Before rounding normalize so bit #DBL_MANT_DIG is set (we will consider
-| the case of denormalized numbers in the rounding routine itself).
-| As in the addition (not in the subtraction!) we could have set
-| one more bit we check this:
- btst IMM (DBL_MANT_DIG+1),d0
- beq 1f
-#ifndef __mcoldfire__
- lsrl IMM (1),d0
- roxrl IMM (1),d1
- roxrl IMM (1),d2
- roxrl IMM (1),d3
- addw IMM (1),d4
-#else
- lsrl IMM (1),d3
- btst IMM (0),d2
- beq 10f
- bset IMM (31),d3
-10: lsrl IMM (1),d2
- btst IMM (0),d1
- beq 11f
- bset IMM (31),d2
-11: lsrl IMM (1),d1
- btst IMM (0),d0
- beq 12f
- bset IMM (31),d1
-12: lsrl IMM (1),d0
- addl IMM (1),d4
-#endif
-1:
- lea pc@(Ladddf$5),a0 | to return from rounding routine
- PICLEA SYM (_fpCCR),a1 | check the rounding mode
-#ifdef __mcoldfire__
- clrl d6
-#endif
- movew a1@(6),d6 | rounding mode in d6
- beq Lround$to$nearest
-#ifndef __mcoldfire__
- cmpw IMM (ROUND_TO_PLUS),d6
-#else
- cmpl IMM (ROUND_TO_PLUS),d6
-#endif
- bhi Lround$to$minus
- blt Lround$to$zero
- bra Lround$to$plus
-Ladddf$5:
-| Put back the exponent and check for overflow
-#ifndef __mcoldfire__
- cmpw IMM (0x7ff),d4 | is the exponent big?
-#else
- cmpl IMM (0x7ff),d4 | is the exponent big?
-#endif
- bge 1f
- bclr IMM (DBL_MANT_DIG-1),d0
-#ifndef __mcoldfire__
- lslw IMM (4),d4 | put exponent back into position
-#else
- lsll IMM (4),d4 | put exponent back into position
-#endif
- swap d0 |
-#ifndef __mcoldfire__
- orw d4,d0 |
-#else
- orl d4,d0 |
-#endif
- swap d0 |
- bra Ladddf$ret
-1:
- moveq IMM (ADD),d5
- bra Ld$overflow
-
-Lsubdf$0:
-| Here we do the subtraction.
-#ifndef __mcoldfire__
- exg d7,a0 | put sign back in a0
- exg d6,a3 |
-#else
- movel d7,a4
- movel a0,d7
- movel a4,a0
- movel d6,a4
- movel a3,d6
- movel a4,a3
-#endif
- subl d7,d3 |
- subxl d6,d2 |
- subxl d5,d1 |
- subxl d4,d0 |
- beq Ladddf$ret$1 | if zero just exit
- bpl 1f | if positive skip the following
- movel a0,d7 |
- bchg IMM (31),d7 | change sign bit in d7
- movel d7,a0 |
- negl d3 |
- negxl d2 |
- negxl d1 | and negate result
- negxl d0 |
-1:
- movel a2,d4 | return exponent to d4
- movel a0,d7
- andl IMM (0x80000000),d7 | isolate sign bit
-#ifndef __mcoldfire__
- moveml sp@+,a2-a3 |
-#else
- movel sp@+,a4
- movel sp@+,a3
- movel sp@+,a2
-#endif
-
-| Before rounding normalize so bit #DBL_MANT_DIG is set (we will consider
-| the case of denormalized numbers in the rounding routine itself).
-| As in the addition (not in the subtraction!) we could have set
-| one more bit we check this:
- btst IMM (DBL_MANT_DIG+1),d0
- beq 1f
-#ifndef __mcoldfire__
- lsrl IMM (1),d0
- roxrl IMM (1),d1
- roxrl IMM (1),d2
- roxrl IMM (1),d3
- addw IMM (1),d4
-#else
- lsrl IMM (1),d3
- btst IMM (0),d2
- beq 10f
- bset IMM (31),d3
-10: lsrl IMM (1),d2
- btst IMM (0),d1
- beq 11f
- bset IMM (31),d2
-11: lsrl IMM (1),d1
- btst IMM (0),d0
- beq 12f
- bset IMM (31),d1
-12: lsrl IMM (1),d0
- addl IMM (1),d4
-#endif
-1:
- lea pc@(Lsubdf$1),a0 | to return from rounding routine
- PICLEA SYM (_fpCCR),a1 | check the rounding mode
-#ifdef __mcoldfire__
- clrl d6
-#endif
- movew a1@(6),d6 | rounding mode in d6
- beq Lround$to$nearest
-#ifndef __mcoldfire__
- cmpw IMM (ROUND_TO_PLUS),d6
-#else
- cmpl IMM (ROUND_TO_PLUS),d6
-#endif
- bhi Lround$to$minus
- blt Lround$to$zero
- bra Lround$to$plus
-Lsubdf$1:
-| Put back the exponent and sign (we don't have overflow). '
- bclr IMM (DBL_MANT_DIG-1),d0
-#ifndef __mcoldfire__
- lslw IMM (4),d4 | put exponent back into position
-#else
- lsll IMM (4),d4 | put exponent back into position
-#endif
- swap d0 |
-#ifndef __mcoldfire__
- orw d4,d0 |
-#else
- orl d4,d0 |
-#endif
- swap d0 |
- bra Ladddf$ret
-
-| If one of the numbers was too small (difference of exponents >=
-| DBL_MANT_DIG+1) we return the other (and now we don't have to '
-| check for finiteness or zero).
-Ladddf$a$small:
-#ifndef __mcoldfire__
- moveml sp@+,a2-a3
-#else
- movel sp@+,a4
- movel sp@+,a3
- movel sp@+,a2
-#endif
- movel a6@(16),d0
- movel a6@(20),d1
- PICLEA SYM (_fpCCR),a0
- movew IMM (0),a0@
-#ifndef __mcoldfire__
- moveml sp@+,d2-d7 | restore data registers
-#else
- moveml sp@,d2-d7
- | XXX if frame pointer is ever removed, stack pointer must
- | be adjusted here.
-#endif
- unlk a6 | and return
- rts
-
-Ladddf$b$small:
-#ifndef __mcoldfire__
- moveml sp@+,a2-a3
-#else
- movel sp@+,a4
- movel sp@+,a3
- movel sp@+,a2
-#endif
- movel a6@(8),d0
- movel a6@(12),d1
- PICLEA SYM (_fpCCR),a0
- movew IMM (0),a0@
-#ifndef __mcoldfire__
- moveml sp@+,d2-d7 | restore data registers
-#else
- moveml sp@,d2-d7
- | XXX if frame pointer is ever removed, stack pointer must
- | be adjusted here.
-#endif
- unlk a6 | and return
- rts
-
-Ladddf$a$den:
- movel d7,d4 | d7 contains 0x00200000
- bra Ladddf$1
-
-Ladddf$b$den:
- movel d7,d5 | d7 contains 0x00200000
- notl d6
- bra Ladddf$2
-
-Ladddf$b:
-| Return b (if a is zero)
- movel d2,d0
- movel d3,d1
- bne 1f | Check if b is -0
- cmpl IMM (0x80000000),d0
- bne 1f
- andl IMM (0x80000000),d7 | Use the sign of a
- clrl d0
- bra Ladddf$ret
-Ladddf$a:
- movel a6@(8),d0
- movel a6@(12),d1
-1:
- moveq IMM (ADD),d5
-| Check for NaN and +/-INFINITY.
- movel d0,d7 |
- andl IMM (0x80000000),d7 |
- bclr IMM (31),d0 |
- cmpl IMM (0x7ff00000),d0 |
- bge 2f |
- movel d0,d0 | check for zero, since we don't '
- bne Ladddf$ret | want to return -0 by mistake
- bclr IMM (31),d7 |
- bra Ladddf$ret |
-2:
- andl IMM (0x000fffff),d0 | check for NaN (nonzero fraction)
- orl d1,d0 |
- bne Ld$inop |
- bra Ld$infty |
-
-Ladddf$ret$1:
-#ifndef __mcoldfire__
- moveml sp@+,a2-a3 | restore regs and exit
-#else
- movel sp@+,a4
- movel sp@+,a3
- movel sp@+,a2
-#endif
-
-Ladddf$ret:
-| Normal exit.
- PICLEA SYM (_fpCCR),a0
- movew IMM (0),a0@
- orl d7,d0 | put sign bit back
-#ifndef __mcoldfire__
- moveml sp@+,d2-d7
-#else
- moveml sp@,d2-d7
- | XXX if frame pointer is ever removed, stack pointer must
- | be adjusted here.
-#endif
- unlk a6
- rts
-
-Ladddf$ret$den:
-| Return a denormalized number.
-#ifndef __mcoldfire__
- lsrl IMM (1),d0 | shift right once more
- roxrl IMM (1),d1 |
-#else
- lsrl IMM (1),d1
- btst IMM (0),d0
- beq 10f
- bset IMM (31),d1
-10: lsrl IMM (1),d0
-#endif
- bra Ladddf$ret
-
-Ladddf$nf:
- moveq IMM (ADD),d5
-| This could be faster but it is not worth the effort, since it is not
-| executed very often. We sacrifice speed for clarity here.
- movel a6@(8),d0 | get the numbers back (remember that we
- movel a6@(12),d1 | did some processing already)
- movel a6@(16),d2 |
- movel a6@(20),d3 |
- movel IMM (0x7ff00000),d4 | useful constant (INFINITY)
- movel d0,d7 | save sign bits
- movel d2,d6 |
- bclr IMM (31),d0 | clear sign bits
- bclr IMM (31),d2 |
-| We know that one of them is either NaN of +/-INFINITY
-| Check for NaN (if either one is NaN return NaN)
- cmpl d4,d0 | check first a (d0)
- bhi Ld$inop | if d0 > 0x7ff00000 or equal and
- bne 2f
- tstl d1 | d1 > 0, a is NaN
- bne Ld$inop |
-2: cmpl d4,d2 | check now b (d1)
- bhi Ld$inop |
- bne 3f
- tstl d3 |
- bne Ld$inop |
-3:
-| Now comes the check for +/-INFINITY. We know that both are (maybe not
-| finite) numbers, but we have to check if both are infinite whether we
-| are adding or subtracting them.
- eorl d7,d6 | to check sign bits
- bmi 1f
- andl IMM (0x80000000),d7 | get (common) sign bit
- bra Ld$infty
-1:
-| We know one (or both) are infinite, so we test for equality between the
-| two numbers (if they are equal they have to be infinite both, so we
-| return NaN).
- cmpl d2,d0 | are both infinite?
- bne 1f | if d0 <> d2 they are not equal
- cmpl d3,d1 | if d0 == d2 test d3 and d1
- beq Ld$inop | if equal return NaN
-1:
- andl IMM (0x80000000),d7 | get a's sign bit '
- cmpl d4,d0 | test now for infinity
- beq Ld$infty | if a is INFINITY return with this sign
- bchg IMM (31),d7 | else we know b is INFINITY and has
- bra Ld$infty | the opposite sign
-
-|=============================================================================
-| __muldf3
-|=============================================================================
-
-| double __muldf3(double, double);
- FUNC(__muldf3)
-SYM (__muldf3):
-#ifndef __mcoldfire__
- link a6,IMM (0)
- moveml d2-d7,sp@-
-#else
- link a6,IMM (-24)
- moveml d2-d7,sp@
-#endif
- movel a6@(8),d0 | get a into d0-d1
- movel a6@(12),d1 |
- movel a6@(16),d2 | and b into d2-d3
- movel a6@(20),d3 |
- movel d0,d7 | d7 will hold the sign of the product
- eorl d2,d7 |
- andl IMM (0x80000000),d7 |
- movel d7,a0 | save sign bit into a0
- movel IMM (0x7ff00000),d7 | useful constant (+INFINITY)
- movel d7,d6 | another (mask for fraction)
- notl d6 |
- bclr IMM (31),d0 | get rid of a's sign bit '
- movel d0,d4 |
- orl d1,d4 |
- beq Lmuldf$a$0 | branch if a is zero
- movel d0,d4 |
- bclr IMM (31),d2 | get rid of b's sign bit '
- movel d2,d5 |
- orl d3,d5 |
- beq Lmuldf$b$0 | branch if b is zero
- movel d2,d5 |
- cmpl d7,d0 | is a big?
- bhi Lmuldf$inop | if a is NaN return NaN
- beq Lmuldf$a$nf | we still have to check d1 and b ...
- cmpl d7,d2 | now compare b with INFINITY
- bhi Lmuldf$inop | is b NaN?
- beq Lmuldf$b$nf | we still have to check d3 ...
-| Here we have both numbers finite and nonzero (and with no sign bit).
-| Now we get the exponents into d4 and d5.
- andl d7,d4 | isolate exponent in d4
- beq Lmuldf$a$den | if exponent zero, have denormalized
- andl d6,d0 | isolate fraction
- orl IMM (0x00100000),d0 | and put hidden bit back
- swap d4 | I like exponents in the first byte
-#ifndef __mcoldfire__
- lsrw IMM (4),d4 |
-#else
- lsrl IMM (4),d4 |
-#endif
-Lmuldf$1:
- andl d7,d5 |
- beq Lmuldf$b$den |
- andl d6,d2 |
- orl IMM (0x00100000),d2 | and put hidden bit back
- swap d5 |
-#ifndef __mcoldfire__
- lsrw IMM (4),d5 |
-#else
- lsrl IMM (4),d5 |
-#endif
-Lmuldf$2: |
-#ifndef __mcoldfire__
- addw d5,d4 | add exponents
- subw IMM (D_BIAS+1),d4 | and subtract bias (plus one)
-#else
- addl d5,d4 | add exponents
- subl IMM (D_BIAS+1),d4 | and subtract bias (plus one)
-#endif
-
-| We are now ready to do the multiplication. The situation is as follows:
-| both a and b have bit 52 ( bit 20 of d0 and d2) set (even if they were
-| denormalized to start with!), which means that in the product bit 104
-| (which will correspond to bit 8 of the fourth long) is set.
-
-| Here we have to do the product.
-| To do it we have to juggle the registers back and forth, as there are not
-| enough to keep everything in them. So we use the address registers to keep
-| some intermediate data.
-
-#ifndef __mcoldfire__
- moveml a2-a3,sp@- | save a2 and a3 for temporary use
-#else
- movel a2,sp@-
- movel a3,sp@-
- movel a4,sp@-
-#endif
- movel IMM (0),a2 | a2 is a null register
- movel d4,a3 | and a3 will preserve the exponent
-
-| First, shift d2-d3 so bit 20 becomes bit 31:
-#ifndef __mcoldfire__
- rorl IMM (5),d2 | rotate d2 5 places right
- swap d2 | and swap it
- rorl IMM (5),d3 | do the same thing with d3
- swap d3 |
- movew d3,d6 | get the rightmost 11 bits of d3
- andw IMM (0x07ff),d6 |
- orw d6,d2 | and put them into d2
- andw IMM (0xf800),d3 | clear those bits in d3
-#else
- moveq IMM (11),d7 | left shift d2 11 bits
- lsll d7,d2
- movel d3,d6 | get a copy of d3
- lsll d7,d3 | left shift d3 11 bits
- andl IMM (0xffe00000),d6 | get the top 11 bits of d3
- moveq IMM (21),d7 | right shift them 21 bits
- lsrl d7,d6
- orl d6,d2 | stick them at the end of d2
-#endif
-
- movel d2,d6 | move b into d6-d7
- movel d3,d7 | move a into d4-d5
- movel d0,d4 | and clear d0-d1-d2-d3 (to put result)
- movel d1,d5 |
- movel IMM (0),d3 |
- movel d3,d2 |
- movel d3,d1 |
- movel d3,d0 |
-
-| We use a1 as counter:
- movel IMM (DBL_MANT_DIG-1),a1
-#ifndef __mcoldfire__
- exg d7,a1
-#else
- movel d7,a4
- movel a1,d7
- movel a4,a1
-#endif
-
-1:
-#ifndef __mcoldfire__
- exg d7,a1 | put counter back in a1
-#else
- movel d7,a4
- movel a1,d7
- movel a4,a1
-#endif
- addl d3,d3 | shift sum once left
- addxl d2,d2 |
- addxl d1,d1 |
- addxl d0,d0 |
- addl d7,d7 |
- addxl d6,d6 |
- bcc 2f | if bit clear skip the following
-#ifndef __mcoldfire__
- exg d7,a2 |
-#else
- movel d7,a4
- movel a2,d7
- movel a4,a2
-#endif
- addl d5,d3 | else add a to the sum
- addxl d4,d2 |
- addxl d7,d1 |
- addxl d7,d0 |
-#ifndef __mcoldfire__
- exg d7,a2 |
-#else
- movel d7,a4
- movel a2,d7
- movel a4,a2
-#endif
-2:
-#ifndef __mcoldfire__
- exg d7,a1 | put counter in d7
- dbf d7,1b | decrement and branch
-#else
- movel d7,a4
- movel a1,d7
- movel a4,a1
- subql IMM (1),d7
- bpl 1b
-#endif
-
- movel a3,d4 | restore exponent
-#ifndef __mcoldfire__
- moveml sp@+,a2-a3
-#else
- movel sp@+,a4
- movel sp@+,a3
- movel sp@+,a2
-#endif
-
-| Now we have the product in d0-d1-d2-d3, with bit 8 of d0 set. The
-| first thing to do now is to normalize it so bit 8 becomes bit
-| DBL_MANT_DIG-32 (to do the rounding); later we will shift right.
- swap d0
- swap d1
- movew d1,d0
- swap d2
- movew d2,d1
- swap d3
- movew d3,d2
- movew IMM (0),d3
-#ifndef __mcoldfire__
- lsrl IMM (1),d0
- roxrl IMM (1),d1
- roxrl IMM (1),d2
- roxrl IMM (1),d3
- lsrl IMM (1),d0
- roxrl IMM (1),d1
- roxrl IMM (1),d2
- roxrl IMM (1),d3
- lsrl IMM (1),d0
- roxrl IMM (1),d1
- roxrl IMM (1),d2
- roxrl IMM (1),d3
-#else
- moveq IMM (29),d6
- lsrl IMM (3),d3
- movel d2,d7
- lsll d6,d7
- orl d7,d3
- lsrl IMM (3),d2
- movel d1,d7
- lsll d6,d7
- orl d7,d2
- lsrl IMM (3),d1
- movel d0,d7
- lsll d6,d7
- orl d7,d1
- lsrl IMM (3),d0
-#endif
-
-| Now round, check for over- and underflow, and exit.
- movel a0,d7 | get sign bit back into d7
- moveq IMM (MULTIPLY),d5
-
- btst IMM (DBL_MANT_DIG+1-32),d0
- beq Lround$exit
-#ifndef __mcoldfire__
- lsrl IMM (1),d0
- roxrl IMM (1),d1
- addw IMM (1),d4
-#else
- lsrl IMM (1),d1
- btst IMM (0),d0
- beq 10f
- bset IMM (31),d1
-10: lsrl IMM (1),d0
- addl IMM (1),d4
-#endif
- bra Lround$exit
-
-Lmuldf$inop:
- moveq IMM (MULTIPLY),d5
- bra Ld$inop
-
-Lmuldf$b$nf:
- moveq IMM (MULTIPLY),d5
- movel a0,d7 | get sign bit back into d7
- tstl d3 | we know d2 == 0x7ff00000, so check d3
- bne Ld$inop | if d3 <> 0 b is NaN
- bra Ld$overflow | else we have overflow (since a is finite)
-
-Lmuldf$a$nf:
- moveq IMM (MULTIPLY),d5
- movel a0,d7 | get sign bit back into d7
- tstl d1 | we know d0 == 0x7ff00000, so check d1
- bne Ld$inop | if d1 <> 0 a is NaN
- bra Ld$overflow | else signal overflow
-
-| If either number is zero return zero, unless the other is +/-INFINITY or
-| NaN, in which case we return NaN.
-Lmuldf$b$0:
- moveq IMM (MULTIPLY),d5
-#ifndef __mcoldfire__
- exg d2,d0 | put b (==0) into d0-d1
- exg d3,d1 | and a (with sign bit cleared) into d2-d3
- movel a0,d0 | set result sign
-#else
- movel d0,d2 | put a into d2-d3
- movel d1,d3
- movel a0,d0 | put result zero into d0-d1
- movq IMM(0),d1
-#endif
- bra 1f
-Lmuldf$a$0:
- movel a0,d0 | set result sign
- movel a6@(16),d2 | put b into d2-d3 again
- movel a6@(20),d3 |
- bclr IMM (31),d2 | clear sign bit
-1: cmpl IMM (0x7ff00000),d2 | check for non-finiteness
- bge Ld$inop | in case NaN or +/-INFINITY return NaN
- PICLEA SYM (_fpCCR),a0
- movew IMM (0),a0@
-#ifndef __mcoldfire__
- moveml sp@+,d2-d7
-#else
- moveml sp@,d2-d7
- | XXX if frame pointer is ever removed, stack pointer must
- | be adjusted here.
-#endif
- unlk a6
- rts
-
-| If a number is denormalized we put an exponent of 1 but do not put the
-| hidden bit back into the fraction; instead we shift left until bit 21
-| (the hidden bit) is set, adjusting the exponent accordingly. We do this
-| to ensure that the product of the fractions is close to 1.
-Lmuldf$a$den:
- movel IMM (1),d4
- andl d6,d0
-1: addl d1,d1 | shift a left until bit 20 is set
- addxl d0,d0 |
-#ifndef __mcoldfire__
- subw IMM (1),d4 | and adjust exponent
-#else
- subl IMM (1),d4 | and adjust exponent
-#endif
- btst IMM (20),d0 |
- bne Lmuldf$1 |
- bra 1b
-
-Lmuldf$b$den:
- movel IMM (1),d5
- andl d6,d2
-1: addl d3,d3 | shift b left until bit 20 is set
- addxl d2,d2 |
-#ifndef __mcoldfire__
- subw IMM (1),d5 | and adjust exponent
-#else
- subql IMM (1),d5 | and adjust exponent
-#endif
- btst IMM (20),d2 |
- bne Lmuldf$2 |
- bra 1b
-
-
-|=============================================================================
-| __divdf3
-|=============================================================================
-
-| double __divdf3(double, double);
- FUNC(__divdf3)
-SYM (__divdf3):
-#ifndef __mcoldfire__
- link a6,IMM (0)
- moveml d2-d7,sp@-
-#else
- link a6,IMM (-24)
- moveml d2-d7,sp@
-#endif
- movel a6@(8),d0 | get a into d0-d1
- movel a6@(12),d1 |
- movel a6@(16),d2 | and b into d2-d3
- movel a6@(20),d3 |
- movel d0,d7 | d7 will hold the sign of the result
- eorl d2,d7 |
- andl IMM (0x80000000),d7
- movel d7,a0 | save sign into a0
- movel IMM (0x7ff00000),d7 | useful constant (+INFINITY)
- movel d7,d6 | another (mask for fraction)
- notl d6 |
- bclr IMM (31),d0 | get rid of a's sign bit '
- movel d0,d4 |
- orl d1,d4 |
- beq Ldivdf$a$0 | branch if a is zero
- movel d0,d4 |
- bclr IMM (31),d2 | get rid of b's sign bit '
- movel d2,d5 |
- orl d3,d5 |
- beq Ldivdf$b$0 | branch if b is zero
- movel d2,d5
- cmpl d7,d0 | is a big?
- bhi Ldivdf$inop | if a is NaN return NaN
- beq Ldivdf$a$nf | if d0 == 0x7ff00000 we check d1
- cmpl d7,d2 | now compare b with INFINITY
- bhi Ldivdf$inop | if b is NaN return NaN
- beq Ldivdf$b$nf | if d2 == 0x7ff00000 we check d3
-| Here we have both numbers finite and nonzero (and with no sign bit).
-| Now we get the exponents into d4 and d5 and normalize the numbers to
-| ensure that the ratio of the fractions is around 1. We do this by
-| making sure that both numbers have bit #DBL_MANT_DIG-32-1 (hidden bit)
-| set, even if they were denormalized to start with.
-| Thus, the result will satisfy: 2 > result > 1/2.
- andl d7,d4 | and isolate exponent in d4
- beq Ldivdf$a$den | if exponent is zero we have a denormalized
- andl d6,d0 | and isolate fraction
- orl IMM (0x00100000),d0 | and put hidden bit back
- swap d4 | I like exponents in the first byte
-#ifndef __mcoldfire__
- lsrw IMM (4),d4 |
-#else
- lsrl IMM (4),d4 |
-#endif
-Ldivdf$1: |
- andl d7,d5 |
- beq Ldivdf$b$den |
- andl d6,d2 |
- orl IMM (0x00100000),d2
- swap d5 |
-#ifndef __mcoldfire__
- lsrw IMM (4),d5 |
-#else
- lsrl IMM (4),d5 |
-#endif
-Ldivdf$2: |
-#ifndef __mcoldfire__
- subw d5,d4 | subtract exponents
- addw IMM (D_BIAS),d4 | and add bias
-#else
- subl d5,d4 | subtract exponents
- addl IMM (D_BIAS),d4 | and add bias
-#endif
-
-| We are now ready to do the division. We have prepared things in such a way
-| that the ratio of the fractions will be less than 2 but greater than 1/2.
-| At this point the registers in use are:
-| d0-d1 hold a (first operand, bit DBL_MANT_DIG-32=0, bit
-| DBL_MANT_DIG-1-32=1)
-| d2-d3 hold b (second operand, bit DBL_MANT_DIG-32=1)
-| d4 holds the difference of the exponents, corrected by the bias
-| a0 holds the sign of the ratio
-
-| To do the rounding correctly we need to keep information about the
-| nonsignificant bits. One way to do this would be to do the division
-| using four registers; another is to use two registers (as originally
-| I did), but use a sticky bit to preserve information about the
-| fractional part. Note that we can keep that info in a1, which is not
-| used.
- movel IMM (0),d6 | d6-d7 will hold the result
- movel d6,d7 |
- movel IMM (0),a1 | and a1 will hold the sticky bit
-
- movel IMM (DBL_MANT_DIG-32+1),d5
-
-1: cmpl d0,d2 | is a < b?
- bhi 3f | if b > a skip the following
- beq 4f | if d0==d2 check d1 and d3
-2: subl d3,d1 |
- subxl d2,d0 | a <-- a - b
- bset d5,d6 | set the corresponding bit in d6
-3: addl d1,d1 | shift a by 1
- addxl d0,d0 |
-#ifndef __mcoldfire__
- dbra d5,1b | and branch back
-#else
- subql IMM (1), d5
- bpl 1b
-#endif
- bra 5f
-4: cmpl d1,d3 | here d0==d2, so check d1 and d3
- bhi 3b | if d1 > d2 skip the subtraction
- bra 2b | else go do it
-5:
-| Here we have to start setting the bits in the second long.
- movel IMM (31),d5 | again d5 is counter
-
-1: cmpl d0,d2 | is a < b?
- bhi 3f | if b > a skip the following
- beq 4f | if d0==d2 check d1 and d3
-2: subl d3,d1 |
- subxl d2,d0 | a <-- a - b
- bset d5,d7 | set the corresponding bit in d7
-3: addl d1,d1 | shift a by 1
- addxl d0,d0 |
-#ifndef __mcoldfire__
- dbra d5,1b | and branch back
-#else
- subql IMM (1), d5
- bpl 1b
-#endif
- bra 5f
-4: cmpl d1,d3 | here d0==d2, so check d1 and d3
- bhi 3b | if d1 > d2 skip the subtraction
- bra 2b | else go do it
-5:
-| Now go ahead checking until we hit a one, which we store in d2.
- movel IMM (DBL_MANT_DIG),d5
-1: cmpl d2,d0 | is a < b?
- bhi 4f | if b < a, exit
- beq 3f | if d0==d2 check d1 and d3
-2: addl d1,d1 | shift a by 1
- addxl d0,d0 |
-#ifndef __mcoldfire__
- dbra d5,1b | and branch back
-#else
- subql IMM (1), d5
- bpl 1b
-#endif
- movel IMM (0),d2 | here no sticky bit was found
- movel d2,d3
- bra 5f
-3: cmpl d1,d3 | here d0==d2, so check d1 and d3
- bhi 2b | if d1 > d2 go back
-4:
-| Here put the sticky bit in d2-d3 (in the position which actually corresponds
-| to it; if you don't do this the algorithm loses in some cases). '
- movel IMM (0),d2
- movel d2,d3
-#ifndef __mcoldfire__
- subw IMM (DBL_MANT_DIG),d5
- addw IMM (63),d5
- cmpw IMM (31),d5
-#else
- subl IMM (DBL_MANT_DIG),d5
- addl IMM (63),d5
- cmpl IMM (31),d5
-#endif
- bhi 2f
-1: bset d5,d3
- bra 5f
-#ifndef __mcoldfire__
- subw IMM (32),d5
-#else
- subl IMM (32),d5
-#endif
-2: bset d5,d2
-5:
-| Finally we are finished! Move the longs in the address registers to
-| their final destination:
- movel d6,d0
- movel d7,d1
- movel IMM (0),d3
-
-| Here we have finished the division, with the result in d0-d1-d2-d3, with
-| 2^21 <= d6 < 2^23. Thus bit 23 is not set, but bit 22 could be set.
-| If it is not, then definitely bit 21 is set. Normalize so bit 22 is
-| not set:
- btst IMM (DBL_MANT_DIG-32+1),d0
- beq 1f
-#ifndef __mcoldfire__
- lsrl IMM (1),d0
- roxrl IMM (1),d1
- roxrl IMM (1),d2
- roxrl IMM (1),d3
- addw IMM (1),d4
-#else
- lsrl IMM (1),d3
- btst IMM (0),d2
- beq 10f
- bset IMM (31),d3
-10: lsrl IMM (1),d2
- btst IMM (0),d1
- beq 11f
- bset IMM (31),d2
-11: lsrl IMM (1),d1
- btst IMM (0),d0
- beq 12f
- bset IMM (31),d1
-12: lsrl IMM (1),d0
- addl IMM (1),d4
-#endif
-1:
-| Now round, check for over- and underflow, and exit.
- movel a0,d7 | restore sign bit to d7
- moveq IMM (DIVIDE),d5
- bra Lround$exit
-
-Ldivdf$inop:
- moveq IMM (DIVIDE),d5
- bra Ld$inop
-
-Ldivdf$a$0:
-| If a is zero check to see whether b is zero also. In that case return
-| NaN; then check if b is NaN, and return NaN also in that case. Else
-| return a properly signed zero.
- moveq IMM (DIVIDE),d5
- bclr IMM (31),d2 |
- movel d2,d4 |
- orl d3,d4 |
- beq Ld$inop | if b is also zero return NaN
- cmpl IMM (0x7ff00000),d2 | check for NaN
- bhi Ld$inop |
- blt 1f |
- tstl d3 |
- bne Ld$inop |
-1: movel a0,d0 | else return signed zero
- moveq IMM(0),d1 |
- PICLEA SYM (_fpCCR),a0 | clear exception flags
- movew IMM (0),a0@ |
-#ifndef __mcoldfire__
- moveml sp@+,d2-d7 |
-#else
- moveml sp@,d2-d7 |
- | XXX if frame pointer is ever removed, stack pointer must
- | be adjusted here.
-#endif
- unlk a6 |
- rts |
-
-Ldivdf$b$0:
- moveq IMM (DIVIDE),d5
-| If we got here a is not zero. Check if a is NaN; in that case return NaN,
-| else return +/-INFINITY. Remember that a is in d0 with the sign bit
-| cleared already.
- movel a0,d7 | put a's sign bit back in d7 '
- cmpl IMM (0x7ff00000),d0 | compare d0 with INFINITY
- bhi Ld$inop | if larger it is NaN
- tstl d1 |
- bne Ld$inop |
- bra Ld$div$0 | else signal DIVIDE_BY_ZERO
-
-Ldivdf$b$nf:
- moveq IMM (DIVIDE),d5
-| If d2 == 0x7ff00000 we have to check d3.
- tstl d3 |
- bne Ld$inop | if d3 <> 0, b is NaN
- bra Ld$underflow | else b is +/-INFINITY, so signal underflow
-
-Ldivdf$a$nf:
- moveq IMM (DIVIDE),d5
-| If d0 == 0x7ff00000 we have to check d1.
- tstl d1 |
- bne Ld$inop | if d1 <> 0, a is NaN
-| If a is INFINITY we have to check b
- cmpl d7,d2 | compare b with INFINITY
- bge Ld$inop | if b is NaN or INFINITY return NaN
- tstl d3 |
- bne Ld$inop |
- bra Ld$overflow | else return overflow
-
-| If a number is denormalized we put an exponent of 1 but do not put the
-| bit back into the fraction.
-Ldivdf$a$den:
- movel IMM (1),d4
- andl d6,d0
-1: addl d1,d1 | shift a left until bit 20 is set
- addxl d0,d0
-#ifndef __mcoldfire__
- subw IMM (1),d4 | and adjust exponent
-#else
- subl IMM (1),d4 | and adjust exponent
-#endif
- btst IMM (DBL_MANT_DIG-32-1),d0
- bne Ldivdf$1
- bra 1b
-
-Ldivdf$b$den:
- movel IMM (1),d5
- andl d6,d2
-1: addl d3,d3 | shift b left until bit 20 is set
- addxl d2,d2
-#ifndef __mcoldfire__
- subw IMM (1),d5 | and adjust exponent
-#else
- subql IMM (1),d5 | and adjust exponent
-#endif
- btst IMM (DBL_MANT_DIG-32-1),d2
- bne Ldivdf$2
- bra 1b
-
-Lround$exit:
-| This is a common exit point for __muldf3 and __divdf3. When they enter
-| this point the sign of the result is in d7, the result in d0-d1, normalized
-| so that 2^21 <= d0 < 2^22, and the exponent is in the lower byte of d4.
-
-| First check for underlow in the exponent:
-#ifndef __mcoldfire__
- cmpw IMM (-DBL_MANT_DIG-1),d4
-#else
- cmpl IMM (-DBL_MANT_DIG-1),d4
-#endif
- blt Ld$underflow
-| It could happen that the exponent is less than 1, in which case the
-| number is denormalized. In this case we shift right and adjust the
-| exponent until it becomes 1 or the fraction is zero (in the latter case
-| we signal underflow and return zero).
- movel d7,a0 |
- movel IMM (0),d6 | use d6-d7 to collect bits flushed right
- movel d6,d7 | use d6-d7 to collect bits flushed right
-#ifndef __mcoldfire__
- cmpw IMM (1),d4 | if the exponent is less than 1 we
-#else
- cmpl IMM (1),d4 | if the exponent is less than 1 we
-#endif
- bge 2f | have to shift right (denormalize)
-1:
-#ifndef __mcoldfire__
- addw IMM (1),d4 | adjust the exponent
- lsrl IMM (1),d0 | shift right once
- roxrl IMM (1),d1 |
- roxrl IMM (1),d2 |
- roxrl IMM (1),d3 |
- roxrl IMM (1),d6 |
- roxrl IMM (1),d7 |
- cmpw IMM (1),d4 | is the exponent 1 already?
-#else
- addl IMM (1),d4 | adjust the exponent
- lsrl IMM (1),d7
- btst IMM (0),d6
- beq 13f
- bset IMM (31),d7
-13: lsrl IMM (1),d6
- btst IMM (0),d3
- beq 14f
- bset IMM (31),d6
-14: lsrl IMM (1),d3
- btst IMM (0),d2
- beq 10f
- bset IMM (31),d3
-10: lsrl IMM (1),d2
- btst IMM (0),d1
- beq 11f
- bset IMM (31),d2
-11: lsrl IMM (1),d1
- btst IMM (0),d0
- beq 12f
- bset IMM (31),d1
-12: lsrl IMM (1),d0
- cmpl IMM (1),d4 | is the exponent 1 already?
-#endif
- beq 2f | if not loop back
- bra 1b |
- bra Ld$underflow | safety check, shouldn't execute '
-2: orl d6,d2 | this is a trick so we don't lose '
- orl d7,d3 | the bits which were flushed right
- movel a0,d7 | get back sign bit into d7
-| Now call the rounding routine (which takes care of denormalized numbers):
- lea pc@(Lround$0),a0 | to return from rounding routine
- PICLEA SYM (_fpCCR),a1 | check the rounding mode
-#ifdef __mcoldfire__
- clrl d6
-#endif
- movew a1@(6),d6 | rounding mode in d6
- beq Lround$to$nearest
-#ifndef __mcoldfire__
- cmpw IMM (ROUND_TO_PLUS),d6
-#else
- cmpl IMM (ROUND_TO_PLUS),d6
-#endif
- bhi Lround$to$minus
- blt Lround$to$zero
- bra Lround$to$plus
-Lround$0:
-| Here we have a correctly rounded result (either normalized or denormalized).
-
-| Here we should have either a normalized number or a denormalized one, and
-| the exponent is necessarily larger or equal to 1 (so we don't have to '
-| check again for underflow!). We have to check for overflow or for a
-| denormalized number (which also signals underflow).
-| Check for overflow (i.e., exponent >= 0x7ff).
-#ifndef __mcoldfire__
- cmpw IMM (0x07ff),d4
-#else
- cmpl IMM (0x07ff),d4
-#endif
- bge Ld$overflow
-| Now check for a denormalized number (exponent==0):
- movew d4,d4
- beq Ld$den
-1:
-| Put back the exponents and sign and return.
-#ifndef __mcoldfire__
- lslw IMM (4),d4 | exponent back to fourth byte
-#else
- lsll IMM (4),d4 | exponent back to fourth byte
-#endif
- bclr IMM (DBL_MANT_DIG-32-1),d0
- swap d0 | and put back exponent
-#ifndef __mcoldfire__
- orw d4,d0 |
-#else
- orl d4,d0 |
-#endif
- swap d0 |
- orl d7,d0 | and sign also
-
- PICLEA SYM (_fpCCR),a0
- movew IMM (0),a0@
-#ifndef __mcoldfire__
- moveml sp@+,d2-d7
-#else
- moveml sp@,d2-d7
- | XXX if frame pointer is ever removed, stack pointer must
- | be adjusted here.
-#endif
- unlk a6
- rts
-
-|=============================================================================
-| __negdf2
-|=============================================================================
-
-| double __negdf2(double, double);
- FUNC(__negdf2)
-SYM (__negdf2):
-#ifndef __mcoldfire__
- link a6,IMM (0)
- moveml d2-d7,sp@-
-#else
- link a6,IMM (-24)
- moveml d2-d7,sp@
-#endif
- moveq IMM (NEGATE),d5
- movel a6@(8),d0 | get number to negate in d0-d1
- movel a6@(12),d1 |
- bchg IMM (31),d0 | negate
- movel d0,d2 | make a positive copy (for the tests)
- bclr IMM (31),d2 |
- movel d2,d4 | check for zero
- orl d1,d4 |
- beq 2f | if zero (either sign) return +zero
- cmpl IMM (0x7ff00000),d2 | compare to +INFINITY
- blt 1f | if finite, return
- bhi Ld$inop | if larger (fraction not zero) is NaN
- tstl d1 | if d2 == 0x7ff00000 check d1
- bne Ld$inop |
- movel d0,d7 | else get sign and return INFINITY
- andl IMM (0x80000000),d7
- bra Ld$infty
-1: PICLEA SYM (_fpCCR),a0
- movew IMM (0),a0@
-#ifndef __mcoldfire__
- moveml sp@+,d2-d7
-#else
- moveml sp@,d2-d7
- | XXX if frame pointer is ever removed, stack pointer must
- | be adjusted here.
-#endif
- unlk a6
- rts
-2: bclr IMM (31),d0
- bra 1b
-
-|=============================================================================
-| __cmpdf2
-|=============================================================================
-
-GREATER = 1
-LESS = -1
-EQUAL = 0
-
-| int __cmpdf2_internal(double, double, int);
-SYM (__cmpdf2_internal):
-#ifndef __mcoldfire__
- link a6,IMM (0)
- moveml d2-d7,sp@- | save registers
-#else
- link a6,IMM (-24)
- moveml d2-d7,sp@
-#endif
- moveq IMM (COMPARE),d5
- movel a6@(8),d0 | get first operand
- movel a6@(12),d1 |
- movel a6@(16),d2 | get second operand
- movel a6@(20),d3 |
-| First check if a and/or b are (+/-) zero and in that case clear
-| the sign bit.
- movel d0,d6 | copy signs into d6 (a) and d7(b)
- bclr IMM (31),d0 | and clear signs in d0 and d2
- movel d2,d7 |
- bclr IMM (31),d2 |
- cmpl IMM (0x7ff00000),d0 | check for a == NaN
- bhi Lcmpd$inop | if d0 > 0x7ff00000, a is NaN
- beq Lcmpdf$a$nf | if equal can be INFINITY, so check d1
- movel d0,d4 | copy into d4 to test for zero
- orl d1,d4 |
- beq Lcmpdf$a$0 |
-Lcmpdf$0:
- cmpl IMM (0x7ff00000),d2 | check for b == NaN
- bhi Lcmpd$inop | if d2 > 0x7ff00000, b is NaN
- beq Lcmpdf$b$nf | if equal can be INFINITY, so check d3
- movel d2,d4 |
- orl d3,d4 |
- beq Lcmpdf$b$0 |
-Lcmpdf$1:
-| Check the signs
- eorl d6,d7
- bpl 1f
-| If the signs are not equal check if a >= 0
- tstl d6
- bpl Lcmpdf$a$gt$b | if (a >= 0 && b < 0) => a > b
- bmi Lcmpdf$b$gt$a | if (a < 0 && b >= 0) => a < b
-1:
-| If the signs are equal check for < 0
- tstl d6
- bpl 1f
-| If both are negative exchange them
-#ifndef __mcoldfire__
- exg d0,d2
- exg d1,d3
-#else
- movel d0,d7
- movel d2,d0
- movel d7,d2
- movel d1,d7
- movel d3,d1
- movel d7,d3
-#endif
-1:
-| Now that they are positive we just compare them as longs (does this also
-| work for denormalized numbers?).
- cmpl d0,d2
- bhi Lcmpdf$b$gt$a | |b| > |a|
- bne Lcmpdf$a$gt$b | |b| < |a|
-| If we got here d0 == d2, so we compare d1 and d3.
- cmpl d1,d3
- bhi Lcmpdf$b$gt$a | |b| > |a|
- bne Lcmpdf$a$gt$b | |b| < |a|
-| If we got here a == b.
- movel IMM (EQUAL),d0
-#ifndef __mcoldfire__
- moveml sp@+,d2-d7 | put back the registers
-#else
- moveml sp@,d2-d7
- | XXX if frame pointer is ever removed, stack pointer must
- | be adjusted here.
-#endif
- unlk a6
- rts
-Lcmpdf$a$gt$b:
- movel IMM (GREATER),d0
-#ifndef __mcoldfire__
- moveml sp@+,d2-d7 | put back the registers
-#else
- moveml sp@,d2-d7
- | XXX if frame pointer is ever removed, stack pointer must
- | be adjusted here.
-#endif
- unlk a6
- rts
-Lcmpdf$b$gt$a:
- movel IMM (LESS),d0
-#ifndef __mcoldfire__
- moveml sp@+,d2-d7 | put back the registers
-#else
- moveml sp@,d2-d7
- | XXX if frame pointer is ever removed, stack pointer must
- | be adjusted here.
-#endif
- unlk a6
- rts
-
-Lcmpdf$a$0:
- bclr IMM (31),d6
- bra Lcmpdf$0
-Lcmpdf$b$0:
- bclr IMM (31),d7
- bra Lcmpdf$1
-
-Lcmpdf$a$nf:
- tstl d1
- bne Ld$inop
- bra Lcmpdf$0
-
-Lcmpdf$b$nf:
- tstl d3
- bne Ld$inop
- bra Lcmpdf$1
-
-Lcmpd$inop:
- movl a6@(24),d0
- moveq IMM (INEXACT_RESULT+INVALID_OPERATION),d7
- moveq IMM (DOUBLE_FLOAT),d6
- PICJUMP $_exception_handler
-
-| int __cmpdf2(double, double);
- FUNC(__cmpdf2)
-SYM (__cmpdf2):
- link a6,IMM (0)
- pea 1
- movl a6@(20),sp@-
- movl a6@(16),sp@-
- movl a6@(12),sp@-
- movl a6@(8),sp@-
- PICCALL SYM (__cmpdf2_internal)
- unlk a6
- rts
-
-|=============================================================================
-| rounding routines
-|=============================================================================
-
-| The rounding routines expect the number to be normalized in registers
-| d0-d1-d2-d3, with the exponent in register d4. They assume that the
-| exponent is larger or equal to 1. They return a properly normalized number
-| if possible, and a denormalized number otherwise. The exponent is returned
-| in d4.
-
-Lround$to$nearest:
-| We now normalize as suggested by D. Knuth ("Seminumerical Algorithms"):
-| Here we assume that the exponent is not too small (this should be checked
-| before entering the rounding routine), but the number could be denormalized.
-
-| Check for denormalized numbers:
-1: btst IMM (DBL_MANT_DIG-32),d0
- bne 2f | if set the number is normalized
-| Normalize shifting left until bit #DBL_MANT_DIG-32 is set or the exponent
-| is one (remember that a denormalized number corresponds to an
-| exponent of -D_BIAS+1).
-#ifndef __mcoldfire__
- cmpw IMM (1),d4 | remember that the exponent is at least one
-#else
- cmpl IMM (1),d4 | remember that the exponent is at least one
-#endif
- beq 2f | an exponent of one means denormalized
- addl d3,d3 | else shift and adjust the exponent
- addxl d2,d2 |
- addxl d1,d1 |
- addxl d0,d0 |
-#ifndef __mcoldfire__
- dbra d4,1b |
-#else
- subql IMM (1), d4
- bpl 1b
-#endif
-2:
-| Now round: we do it as follows: after the shifting we can write the
-| fraction part as f + delta, where 1 < f < 2^25, and 0 <= delta <= 2.
-| If delta < 1, do nothing. If delta > 1, add 1 to f.
-| If delta == 1, we make sure the rounded number will be even (odd?)
-| (after shifting).
- btst IMM (0),d1 | is delta < 1?
- beq 2f | if so, do not do anything
- orl d2,d3 | is delta == 1?
- bne 1f | if so round to even
- movel d1,d3 |
- andl IMM (2),d3 | bit 1 is the last significant bit
- movel IMM (0),d2 |
- addl d3,d1 |
- addxl d2,d0 |
- bra 2f |
-1: movel IMM (1),d3 | else add 1
- movel IMM (0),d2 |
- addl d3,d1 |
- addxl d2,d0
-| Shift right once (because we used bit #DBL_MANT_DIG-32!).
-2:
-#ifndef __mcoldfire__
- lsrl IMM (1),d0
- roxrl IMM (1),d1
-#else
- lsrl IMM (1),d1
- btst IMM (0),d0
- beq 10f
- bset IMM (31),d1
-10: lsrl IMM (1),d0
-#endif
-
-| Now check again bit #DBL_MANT_DIG-32 (rounding could have produced a
-| 'fraction overflow' ...).
- btst IMM (DBL_MANT_DIG-32),d0
- beq 1f
-#ifndef __mcoldfire__
- lsrl IMM (1),d0
- roxrl IMM (1),d1
- addw IMM (1),d4
-#else
- lsrl IMM (1),d1
- btst IMM (0),d0
- beq 10f
- bset IMM (31),d1
-10: lsrl IMM (1),d0
- addl IMM (1),d4
-#endif
-1:
-| If bit #DBL_MANT_DIG-32-1 is clear we have a denormalized number, so we
-| have to put the exponent to zero and return a denormalized number.
- btst IMM (DBL_MANT_DIG-32-1),d0
- beq 1f
- jmp a0@
-1: movel IMM (0),d4
- jmp a0@
-
-Lround$to$zero:
-Lround$to$plus:
-Lround$to$minus:
- jmp a0@
-#endif /* L_double */
-
-#ifdef L_float
-
- .globl SYM (_fpCCR)
- .globl $_exception_handler
-
-QUIET_NaN = 0xffffffff
-SIGNL_NaN = 0x7f800001
-INFINITY = 0x7f800000
-
-F_MAX_EXP = 0xff
-F_BIAS = 126
-FLT_MAX_EXP = F_MAX_EXP - F_BIAS
-FLT_MIN_EXP = 1 - F_BIAS
-FLT_MANT_DIG = 24
-
-INEXACT_RESULT = 0x0001
-UNDERFLOW = 0x0002
-OVERFLOW = 0x0004
-DIVIDE_BY_ZERO = 0x0008
-INVALID_OPERATION = 0x0010
-
-SINGLE_FLOAT = 1
-
-NOOP = 0
-ADD = 1
-MULTIPLY = 2
-DIVIDE = 3
-NEGATE = 4
-COMPARE = 5
-EXTENDSFDF = 6
-TRUNCDFSF = 7
-
-UNKNOWN = -1
-ROUND_TO_NEAREST = 0 | round result to nearest representable value
-ROUND_TO_ZERO = 1 | round result towards zero
-ROUND_TO_PLUS = 2 | round result towards plus infinity
-ROUND_TO_MINUS = 3 | round result towards minus infinity
-
-| Entry points:
-
- .globl SYM (__addsf3)
- .globl SYM (__subsf3)
- .globl SYM (__mulsf3)
- .globl SYM (__divsf3)
- .globl SYM (__negsf2)
- .globl SYM (__cmpsf2)
- .globl SYM (__cmpsf2_internal)
- .hidden SYM (__cmpsf2_internal)
-
-| These are common routines to return and signal exceptions.
-
- .text
- .even
-
-Lf$den:
-| Return and signal a denormalized number
- orl d7,d0
- moveq IMM (INEXACT_RESULT+UNDERFLOW),d7
- moveq IMM (SINGLE_FLOAT),d6
- PICJUMP $_exception_handler
-
-Lf$infty:
-Lf$overflow:
-| Return a properly signed INFINITY and set the exception flags
- movel IMM (INFINITY),d0
- orl d7,d0
- moveq IMM (INEXACT_RESULT+OVERFLOW),d7
- moveq IMM (SINGLE_FLOAT),d6
- PICJUMP $_exception_handler
-
-Lf$underflow:
-| Return 0 and set the exception flags
- moveq IMM (0),d0
- moveq IMM (INEXACT_RESULT+UNDERFLOW),d7
- moveq IMM (SINGLE_FLOAT),d6
- PICJUMP $_exception_handler
-
-Lf$inop:
-| Return a quiet NaN and set the exception flags
- movel IMM (QUIET_NaN),d0
- moveq IMM (INEXACT_RESULT+INVALID_OPERATION),d7
- moveq IMM (SINGLE_FLOAT),d6
- PICJUMP $_exception_handler
-
-Lf$div$0:
-| Return a properly signed INFINITY and set the exception flags
- movel IMM (INFINITY),d0
- orl d7,d0
- moveq IMM (INEXACT_RESULT+DIVIDE_BY_ZERO),d7
- moveq IMM (SINGLE_FLOAT),d6
- PICJUMP $_exception_handler
-
-|=============================================================================
-|=============================================================================
-| single precision routines
-|=============================================================================
-|=============================================================================
-
-| A single precision floating point number (float) has the format:
-|
-| struct _float {
-| unsigned int sign : 1; /* sign bit */
-| unsigned int exponent : 8; /* exponent, shifted by 126 */
-| unsigned int fraction : 23; /* fraction */
-| } float;
-|
-| Thus sizeof(float) = 4 (32 bits).
-|
-| All the routines are callable from C programs, and return the result
-| in the single register d0. They also preserve all registers except
-| d0-d1 and a0-a1.
-
-|=============================================================================
-| __subsf3
-|=============================================================================
-
-| float __subsf3(float, float);
- FUNC(__subsf3)
-SYM (__subsf3):
- bchg IMM (31),sp@(8) | change sign of second operand
- | and fall through
-|=============================================================================
-| __addsf3
-|=============================================================================
-
-| float __addsf3(float, float);
- FUNC(__addsf3)
-SYM (__addsf3):
-#ifndef __mcoldfire__
- link a6,IMM (0) | everything will be done in registers
- moveml d2-d7,sp@- | save all data registers but d0-d1
-#else
- link a6,IMM (-24)
- moveml d2-d7,sp@
-#endif
- movel a6@(8),d0 | get first operand
- movel a6@(12),d1 | get second operand
- movel d0,a0 | get d0's sign bit '
- addl d0,d0 | check and clear sign bit of a
- beq Laddsf$b | if zero return second operand
- movel d1,a1 | save b's sign bit '
- addl d1,d1 | get rid of sign bit
- beq Laddsf$a | if zero return first operand
-
-| Get the exponents and check for denormalized and/or infinity.
-
- movel IMM (0x00ffffff),d4 | mask to get fraction
- movel IMM (0x01000000),d5 | mask to put hidden bit back
-
- movel d0,d6 | save a to get exponent
- andl d4,d0 | get fraction in d0
- notl d4 | make d4 into a mask for the exponent
- andl d4,d6 | get exponent in d6
- beq Laddsf$a$den | branch if a is denormalized
- cmpl d4,d6 | check for INFINITY or NaN
- beq Laddsf$nf
- swap d6 | put exponent into first word
- orl d5,d0 | and put hidden bit back
-Laddsf$1:
-| Now we have a's exponent in d6 (second byte) and the mantissa in d0. '
- movel d1,d7 | get exponent in d7
- andl d4,d7 |
- beq Laddsf$b$den | branch if b is denormalized
- cmpl d4,d7 | check for INFINITY or NaN
- beq Laddsf$nf
- swap d7 | put exponent into first word
- notl d4 | make d4 into a mask for the fraction
- andl d4,d1 | get fraction in d1
- orl d5,d1 | and put hidden bit back
-Laddsf$2:
-| Now we have b's exponent in d7 (second byte) and the mantissa in d1. '
-
-| Note that the hidden bit corresponds to bit #FLT_MANT_DIG-1, and we
-| shifted right once, so bit #FLT_MANT_DIG is set (so we have one extra
-| bit).
-
- movel d1,d2 | move b to d2, since we want to use
- | two registers to do the sum
- movel IMM (0),d1 | and clear the new ones
- movel d1,d3 |
-
-| Here we shift the numbers in registers d0 and d1 so the exponents are the
-| same, and put the largest exponent in d6. Note that we are using two
-| registers for each number (see the discussion by D. Knuth in "Seminumerical
-| Algorithms").
-#ifndef __mcoldfire__
- cmpw d6,d7 | compare exponents
-#else
- cmpl d6,d7 | compare exponents
-#endif
- beq Laddsf$3 | if equal don't shift '
- bhi 5f | branch if second exponent largest
-1:
- subl d6,d7 | keep the largest exponent
- negl d7
-#ifndef __mcoldfire__
- lsrw IMM (8),d7 | put difference in lower byte
-#else
- lsrl IMM (8),d7 | put difference in lower byte
-#endif
-| if difference is too large we don't shift (actually, we can just exit) '
-#ifndef __mcoldfire__
- cmpw IMM (FLT_MANT_DIG+2),d7
-#else
- cmpl IMM (FLT_MANT_DIG+2),d7
-#endif
- bge Laddsf$b$small
-#ifndef __mcoldfire__
- cmpw IMM (16),d7 | if difference >= 16 swap
-#else
- cmpl IMM (16),d7 | if difference >= 16 swap
-#endif
- bge 4f
-2:
-#ifndef __mcoldfire__
- subw IMM (1),d7
-#else
- subql IMM (1), d7
-#endif
-3:
-#ifndef __mcoldfire__
- lsrl IMM (1),d2 | shift right second operand
- roxrl IMM (1),d3
- dbra d7,3b
-#else
- lsrl IMM (1),d3
- btst IMM (0),d2
- beq 10f
- bset IMM (31),d3
-10: lsrl IMM (1),d2
- subql IMM (1), d7
- bpl 3b
-#endif
- bra Laddsf$3
-4:
- movew d2,d3
- swap d3
- movew d3,d2
- swap d2
-#ifndef __mcoldfire__
- subw IMM (16),d7
-#else
- subl IMM (16),d7
-#endif
- bne 2b | if still more bits, go back to normal case
- bra Laddsf$3
-5:
-#ifndef __mcoldfire__
- exg d6,d7 | exchange the exponents
-#else
- eorl d6,d7
- eorl d7,d6
- eorl d6,d7
-#endif
- subl d6,d7 | keep the largest exponent
- negl d7 |
-#ifndef __mcoldfire__
- lsrw IMM (8),d7 | put difference in lower byte
-#else
- lsrl IMM (8),d7 | put difference in lower byte
-#endif
-| if difference is too large we don't shift (and exit!) '
-#ifndef __mcoldfire__
- cmpw IMM (FLT_MANT_DIG+2),d7
-#else
- cmpl IMM (FLT_MANT_DIG+2),d7
-#endif
- bge Laddsf$a$small
-#ifndef __mcoldfire__
- cmpw IMM (16),d7 | if difference >= 16 swap
-#else
- cmpl IMM (16),d7 | if difference >= 16 swap
-#endif
- bge 8f
-6:
-#ifndef __mcoldfire__
- subw IMM (1),d7
-#else
- subl IMM (1),d7
-#endif
-7:
-#ifndef __mcoldfire__
- lsrl IMM (1),d0 | shift right first operand
- roxrl IMM (1),d1
- dbra d7,7b
-#else
- lsrl IMM (1),d1
- btst IMM (0),d0
- beq 10f
- bset IMM (31),d1
-10: lsrl IMM (1),d0
- subql IMM (1),d7
- bpl 7b
-#endif
- bra Laddsf$3
-8:
- movew d0,d1
- swap d1
- movew d1,d0
- swap d0
-#ifndef __mcoldfire__
- subw IMM (16),d7
-#else
- subl IMM (16),d7
-#endif
- bne 6b | if still more bits, go back to normal case
- | otherwise we fall through
-
-| Now we have a in d0-d1, b in d2-d3, and the largest exponent in d6 (the
-| signs are stored in a0 and a1).
-
-Laddsf$3:
-| Here we have to decide whether to add or subtract the numbers
-#ifndef __mcoldfire__
- exg d6,a0 | get signs back
- exg d7,a1 | and save the exponents
-#else
- movel d6,d4
- movel a0,d6
- movel d4,a0
- movel d7,d4
- movel a1,d7
- movel d4,a1
-#endif
- eorl d6,d7 | combine sign bits
- bmi Lsubsf$0 | if negative a and b have opposite
- | sign so we actually subtract the
- | numbers
-
-| Here we have both positive or both negative
-#ifndef __mcoldfire__
- exg d6,a0 | now we have the exponent in d6
-#else
- movel d6,d4
- movel a0,d6
- movel d4,a0
-#endif
- movel a0,d7 | and sign in d7
- andl IMM (0x80000000),d7
-| Here we do the addition.
- addl d3,d1
- addxl d2,d0
-| Note: now we have d2, d3, d4 and d5 to play with!
-
-| Put the exponent, in the first byte, in d2, to use the "standard" rounding
-| routines:
- movel d6,d2
-#ifndef __mcoldfire__
- lsrw IMM (8),d2
-#else
- lsrl IMM (8),d2
-#endif
-
-| Before rounding normalize so bit #FLT_MANT_DIG is set (we will consider
-| the case of denormalized numbers in the rounding routine itself).
-| As in the addition (not in the subtraction!) we could have set
-| one more bit we check this:
- btst IMM (FLT_MANT_DIG+1),d0
- beq 1f
-#ifndef __mcoldfire__
- lsrl IMM (1),d0
- roxrl IMM (1),d1
-#else
- lsrl IMM (1),d1
- btst IMM (0),d0
- beq 10f
- bset IMM (31),d1
-10: lsrl IMM (1),d0
-#endif
- addl IMM (1),d2
-1:
- lea pc@(Laddsf$4),a0 | to return from rounding routine
- PICLEA SYM (_fpCCR),a1 | check the rounding mode
-#ifdef __mcoldfire__
- clrl d6
-#endif
- movew a1@(6),d6 | rounding mode in d6
- beq Lround$to$nearest
-#ifndef __mcoldfire__
- cmpw IMM (ROUND_TO_PLUS),d6
-#else
- cmpl IMM (ROUND_TO_PLUS),d6
-#endif
- bhi Lround$to$minus
- blt Lround$to$zero
- bra Lround$to$plus
-Laddsf$4:
-| Put back the exponent, but check for overflow.
-#ifndef __mcoldfire__
- cmpw IMM (0xff),d2
-#else
- cmpl IMM (0xff),d2
-#endif
- bhi 1f
- bclr IMM (FLT_MANT_DIG-1),d0
-#ifndef __mcoldfire__
- lslw IMM (7),d2
-#else
- lsll IMM (7),d2
-#endif
- swap d2
- orl d2,d0
- bra Laddsf$ret
-1:
- moveq IMM (ADD),d5
- bra Lf$overflow
-
-Lsubsf$0:
-| We are here if a > 0 and b < 0 (sign bits cleared).
-| Here we do the subtraction.
- movel d6,d7 | put sign in d7
- andl IMM (0x80000000),d7
-
- subl d3,d1 | result in d0-d1
- subxl d2,d0 |
- beq Laddsf$ret | if zero just exit
- bpl 1f | if positive skip the following
- bchg IMM (31),d7 | change sign bit in d7
- negl d1
- negxl d0
-1:
-#ifndef __mcoldfire__
- exg d2,a0 | now we have the exponent in d2
- lsrw IMM (8),d2 | put it in the first byte
-#else
- movel d2,d4
- movel a0,d2
- movel d4,a0
- lsrl IMM (8),d2 | put it in the first byte
-#endif
-
-| Now d0-d1 is positive and the sign bit is in d7.
-
-| Note that we do not have to normalize, since in the subtraction bit
-| #FLT_MANT_DIG+1 is never set, and denormalized numbers are handled by
-| the rounding routines themselves.
- lea pc@(Lsubsf$1),a0 | to return from rounding routine
- PICLEA SYM (_fpCCR),a1 | check the rounding mode
-#ifdef __mcoldfire__
- clrl d6
-#endif
- movew a1@(6),d6 | rounding mode in d6
- beq Lround$to$nearest
-#ifndef __mcoldfire__
- cmpw IMM (ROUND_TO_PLUS),d6
-#else
- cmpl IMM (ROUND_TO_PLUS),d6
-#endif
- bhi Lround$to$minus
- blt Lround$to$zero
- bra Lround$to$plus
-Lsubsf$1:
-| Put back the exponent (we can't have overflow!). '
- bclr IMM (FLT_MANT_DIG-1),d0
-#ifndef __mcoldfire__
- lslw IMM (7),d2
-#else
- lsll IMM (7),d2
-#endif
- swap d2
- orl d2,d0
- bra Laddsf$ret
-
-| If one of the numbers was too small (difference of exponents >=
-| FLT_MANT_DIG+2) we return the other (and now we don't have to '
-| check for finiteness or zero).
-Laddsf$a$small:
- movel a6@(12),d0
- PICLEA SYM (_fpCCR),a0
- movew IMM (0),a0@
-#ifndef __mcoldfire__
- moveml sp@+,d2-d7 | restore data registers
-#else
- moveml sp@,d2-d7
- | XXX if frame pointer is ever removed, stack pointer must
- | be adjusted here.
-#endif
- unlk a6 | and return
- rts
-
-Laddsf$b$small:
- movel a6@(8),d0
- PICLEA SYM (_fpCCR),a0
- movew IMM (0),a0@
-#ifndef __mcoldfire__
- moveml sp@+,d2-d7 | restore data registers
-#else
- moveml sp@,d2-d7
- | XXX if frame pointer is ever removed, stack pointer must
- | be adjusted here.
-#endif
- unlk a6 | and return
- rts
-
-| If the numbers are denormalized remember to put exponent equal to 1.
-
-Laddsf$a$den:
- movel d5,d6 | d5 contains 0x01000000
- swap d6
- bra Laddsf$1
-
-Laddsf$b$den:
- movel d5,d7
- swap d7
- notl d4 | make d4 into a mask for the fraction
- | (this was not executed after the jump)
- bra Laddsf$2
-
-| The rest is mainly code for the different results which can be
-| returned (checking always for +/-INFINITY and NaN).
-
-Laddsf$b:
-| Return b (if a is zero).
- movel a6@(12),d0
- cmpl IMM (0x80000000),d0 | Check if b is -0
- bne 1f
- movel a0,d7
- andl IMM (0x80000000),d7 | Use the sign of a
- clrl d0
- bra Laddsf$ret
-Laddsf$a:
-| Return a (if b is zero).
- movel a6@(8),d0
-1:
- moveq IMM (ADD),d5
-| We have to check for NaN and +/-infty.
- movel d0,d7
- andl IMM (0x80000000),d7 | put sign in d7
- bclr IMM (31),d0 | clear sign
- cmpl IMM (INFINITY),d0 | check for infty or NaN
- bge 2f
- movel d0,d0 | check for zero (we do this because we don't '
- bne Laddsf$ret | want to return -0 by mistake
- bclr IMM (31),d7 | if zero be sure to clear sign
- bra Laddsf$ret | if everything OK just return
-2:
-| The value to be returned is either +/-infty or NaN
- andl IMM (0x007fffff),d0 | check for NaN
- bne Lf$inop | if mantissa not zero is NaN
- bra Lf$infty
-
-Laddsf$ret:
-| Normal exit (a and b nonzero, result is not NaN nor +/-infty).
-| We have to clear the exception flags (just the exception type).
- PICLEA SYM (_fpCCR),a0
- movew IMM (0),a0@
- orl d7,d0 | put sign bit
-#ifndef __mcoldfire__
- moveml sp@+,d2-d7 | restore data registers
-#else
- moveml sp@,d2-d7
- | XXX if frame pointer is ever removed, stack pointer must
- | be adjusted here.
-#endif
- unlk a6 | and return
- rts
-
-Laddsf$ret$den:
-| Return a denormalized number (for addition we don't signal underflow) '
- lsrl IMM (1),d0 | remember to shift right back once
- bra Laddsf$ret | and return
-
-| Note: when adding two floats of the same sign if either one is
-| NaN we return NaN without regard to whether the other is finite or
-| not. When subtracting them (i.e., when adding two numbers of
-| opposite signs) things are more complicated: if both are INFINITY
-| we return NaN, if only one is INFINITY and the other is NaN we return
-| NaN, but if it is finite we return INFINITY with the corresponding sign.
-
-Laddsf$nf:
- moveq IMM (ADD),d5
-| This could be faster but it is not worth the effort, since it is not
-| executed very often. We sacrifice speed for clarity here.
- movel a6@(8),d0 | get the numbers back (remember that we
- movel a6@(12),d1 | did some processing already)
- movel IMM (INFINITY),d4 | useful constant (INFINITY)
- movel d0,d2 | save sign bits
- movel d1,d3
- bclr IMM (31),d0 | clear sign bits
- bclr IMM (31),d1
-| We know that one of them is either NaN of +/-INFINITY
-| Check for NaN (if either one is NaN return NaN)
- cmpl d4,d0 | check first a (d0)
- bhi Lf$inop
- cmpl d4,d1 | check now b (d1)
- bhi Lf$inop
-| Now comes the check for +/-INFINITY. We know that both are (maybe not
-| finite) numbers, but we have to check if both are infinite whether we
-| are adding or subtracting them.
- eorl d3,d2 | to check sign bits
- bmi 1f
- movel d0,d7
- andl IMM (0x80000000),d7 | get (common) sign bit
- bra Lf$infty
-1:
-| We know one (or both) are infinite, so we test for equality between the
-| two numbers (if they are equal they have to be infinite both, so we
-| return NaN).
- cmpl d1,d0 | are both infinite?
- beq Lf$inop | if so return NaN
-
- movel d0,d7
- andl IMM (0x80000000),d7 | get a's sign bit '
- cmpl d4,d0 | test now for infinity
- beq Lf$infty | if a is INFINITY return with this sign
- bchg IMM (31),d7 | else we know b is INFINITY and has
- bra Lf$infty | the opposite sign
-
-|=============================================================================
-| __mulsf3
-|=============================================================================
-
-| float __mulsf3(float, float);
- FUNC(__mulsf3)
-SYM (__mulsf3):
-#ifndef __mcoldfire__
- link a6,IMM (0)
- moveml d2-d7,sp@-
-#else
- link a6,IMM (-24)
- moveml d2-d7,sp@
-#endif
- movel a6@(8),d0 | get a into d0
- movel a6@(12),d1 | and b into d1
- movel d0,d7 | d7 will hold the sign of the product
- eorl d1,d7 |
- andl IMM (0x80000000),d7
- movel IMM (INFINITY),d6 | useful constant (+INFINITY)
- movel d6,d5 | another (mask for fraction)
- notl d5 |
- movel IMM (0x00800000),d4 | this is to put hidden bit back
- bclr IMM (31),d0 | get rid of a's sign bit '
- movel d0,d2 |
- beq Lmulsf$a$0 | branch if a is zero
- bclr IMM (31),d1 | get rid of b's sign bit '
- movel d1,d3 |
- beq Lmulsf$b$0 | branch if b is zero
- cmpl d6,d0 | is a big?
- bhi Lmulsf$inop | if a is NaN return NaN
- beq Lmulsf$inf | if a is INFINITY we have to check b
- cmpl d6,d1 | now compare b with INFINITY
- bhi Lmulsf$inop | is b NaN?
- beq Lmulsf$overflow | is b INFINITY?
-| Here we have both numbers finite and nonzero (and with no sign bit).
-| Now we get the exponents into d2 and d3.
- andl d6,d2 | and isolate exponent in d2
- beq Lmulsf$a$den | if exponent is zero we have a denormalized
- andl d5,d0 | and isolate fraction
- orl d4,d0 | and put hidden bit back
- swap d2 | I like exponents in the first byte
-#ifndef __mcoldfire__
- lsrw IMM (7),d2 |
-#else
- lsrl IMM (7),d2 |
-#endif
-Lmulsf$1: | number
- andl d6,d3 |
- beq Lmulsf$b$den |
- andl d5,d1 |
- orl d4,d1 |
- swap d3 |
-#ifndef __mcoldfire__
- lsrw IMM (7),d3 |
-#else
- lsrl IMM (7),d3 |
-#endif
-Lmulsf$2: |
-#ifndef __mcoldfire__
- addw d3,d2 | add exponents
- subw IMM (F_BIAS+1),d2 | and subtract bias (plus one)
-#else
- addl d3,d2 | add exponents
- subl IMM (F_BIAS+1),d2 | and subtract bias (plus one)
-#endif
-
-| We are now ready to do the multiplication. The situation is as follows:
-| both a and b have bit FLT_MANT_DIG-1 set (even if they were
-| denormalized to start with!), which means that in the product
-| bit 2*(FLT_MANT_DIG-1) (that is, bit 2*FLT_MANT_DIG-2-32 of the
-| high long) is set.
-
-| To do the multiplication let us move the number a little bit around ...
- movel d1,d6 | second operand in d6
- movel d0,d5 | first operand in d4-d5
- movel IMM (0),d4
- movel d4,d1 | the sums will go in d0-d1
- movel d4,d0
-
-| now bit FLT_MANT_DIG-1 becomes bit 31:
- lsll IMM (31-FLT_MANT_DIG+1),d6
-
-| Start the loop (we loop #FLT_MANT_DIG times):
- moveq IMM (FLT_MANT_DIG-1),d3
-1: addl d1,d1 | shift sum
- addxl d0,d0
- lsll IMM (1),d6 | get bit bn
- bcc 2f | if not set skip sum
- addl d5,d1 | add a
- addxl d4,d0
-2:
-#ifndef __mcoldfire__
- dbf d3,1b | loop back
-#else
- subql IMM (1),d3
- bpl 1b
-#endif
-
-| Now we have the product in d0-d1, with bit (FLT_MANT_DIG - 1) + FLT_MANT_DIG
-| (mod 32) of d0 set. The first thing to do now is to normalize it so bit
-| FLT_MANT_DIG is set (to do the rounding).
-#ifndef __mcoldfire__
- rorl IMM (6),d1
- swap d1
- movew d1,d3
- andw IMM (0x03ff),d3
- andw IMM (0xfd00),d1
-#else
- movel d1,d3
- lsll IMM (8),d1
- addl d1,d1
- addl d1,d1
- moveq IMM (22),d5
- lsrl d5,d3
- orl d3,d1
- andl IMM (0xfffffd00),d1
-#endif
- lsll IMM (8),d0
- addl d0,d0
- addl d0,d0
-#ifndef __mcoldfire__
- orw d3,d0
-#else
- orl d3,d0
-#endif
-
- moveq IMM (MULTIPLY),d5
-
- btst IMM (FLT_MANT_DIG+1),d0
- beq Lround$exit
-#ifndef __mcoldfire__
- lsrl IMM (1),d0
- roxrl IMM (1),d1
- addw IMM (1),d2
-#else
- lsrl IMM (1),d1
- btst IMM (0),d0
- beq 10f
- bset IMM (31),d1
-10: lsrl IMM (1),d0
- addql IMM (1),d2
-#endif
- bra Lround$exit
-
-Lmulsf$inop:
- moveq IMM (MULTIPLY),d5
- bra Lf$inop
-
-Lmulsf$overflow:
- moveq IMM (MULTIPLY),d5
- bra Lf$overflow
-
-Lmulsf$inf:
- moveq IMM (MULTIPLY),d5
-| If either is NaN return NaN; else both are (maybe infinite) numbers, so
-| return INFINITY with the correct sign (which is in d7).
- cmpl d6,d1 | is b NaN?
- bhi Lf$inop | if so return NaN
- bra Lf$overflow | else return +/-INFINITY
-
-| If either number is zero return zero, unless the other is +/-INFINITY,
-| or NaN, in which case we return NaN.
-Lmulsf$b$0:
-| Here d1 (==b) is zero.
- movel a6@(8),d1 | get a again to check for non-finiteness
- bra 1f
-Lmulsf$a$0:
- movel a6@(12),d1 | get b again to check for non-finiteness
-1: bclr IMM (31),d1 | clear sign bit
- cmpl IMM (INFINITY),d1 | and check for a large exponent
- bge Lf$inop | if b is +/-INFINITY or NaN return NaN
- movel d7,d0 | else return signed zero
- PICLEA SYM (_fpCCR),a0 |
- movew IMM (0),a0@ |
-#ifndef __mcoldfire__
- moveml sp@+,d2-d7 |
-#else
- moveml sp@,d2-d7
- | XXX if frame pointer is ever removed, stack pointer must
- | be adjusted here.
-#endif
- unlk a6 |
- rts |
-
-| If a number is denormalized we put an exponent of 1 but do not put the
-| hidden bit back into the fraction; instead we shift left until bit 23
-| (the hidden bit) is set, adjusting the exponent accordingly. We do this
-| to ensure that the product of the fractions is close to 1.
-Lmulsf$a$den:
- movel IMM (1),d2
- andl d5,d0
-1: addl d0,d0 | shift a left (until bit 23 is set)
-#ifndef __mcoldfire__
- subw IMM (1),d2 | and adjust exponent
-#else
- subql IMM (1),d2 | and adjust exponent
-#endif
- btst IMM (FLT_MANT_DIG-1),d0
- bne Lmulsf$1 |
- bra 1b | else loop back
-
-Lmulsf$b$den:
- movel IMM (1),d3
- andl d5,d1
-1: addl d1,d1 | shift b left until bit 23 is set
-#ifndef __mcoldfire__
- subw IMM (1),d3 | and adjust exponent
-#else
- subql IMM (1),d3 | and adjust exponent
-#endif
- btst IMM (FLT_MANT_DIG-1),d1
- bne Lmulsf$2 |
- bra 1b | else loop back
-
-|=============================================================================
-| __divsf3
-|=============================================================================
-
-| float __divsf3(float, float);
- FUNC(__divsf3)
-SYM (__divsf3):
-#ifndef __mcoldfire__
- link a6,IMM (0)
- moveml d2-d7,sp@-
-#else
- link a6,IMM (-24)
- moveml d2-d7,sp@
-#endif
- movel a6@(8),d0 | get a into d0
- movel a6@(12),d1 | and b into d1
- movel d0,d7 | d7 will hold the sign of the result
- eorl d1,d7 |
- andl IMM (0x80000000),d7 |
- movel IMM (INFINITY),d6 | useful constant (+INFINITY)
- movel d6,d5 | another (mask for fraction)
- notl d5 |
- movel IMM (0x00800000),d4 | this is to put hidden bit back
- bclr IMM (31),d0 | get rid of a's sign bit '
- movel d0,d2 |
- beq Ldivsf$a$0 | branch if a is zero
- bclr IMM (31),d1 | get rid of b's sign bit '
- movel d1,d3 |
- beq Ldivsf$b$0 | branch if b is zero
- cmpl d6,d0 | is a big?
- bhi Ldivsf$inop | if a is NaN return NaN
- beq Ldivsf$inf | if a is INFINITY we have to check b
- cmpl d6,d1 | now compare b with INFINITY
- bhi Ldivsf$inop | if b is NaN return NaN
- beq Ldivsf$underflow
-| Here we have both numbers finite and nonzero (and with no sign bit).
-| Now we get the exponents into d2 and d3 and normalize the numbers to
-| ensure that the ratio of the fractions is close to 1. We do this by
-| making sure that bit #FLT_MANT_DIG-1 (hidden bit) is set.
- andl d6,d2 | and isolate exponent in d2
- beq Ldivsf$a$den | if exponent is zero we have a denormalized
- andl d5,d0 | and isolate fraction
- orl d4,d0 | and put hidden bit back
- swap d2 | I like exponents in the first byte
-#ifndef __mcoldfire__
- lsrw IMM (7),d2 |
-#else
- lsrl IMM (7),d2 |
-#endif
-Ldivsf$1: |
- andl d6,d3 |
- beq Ldivsf$b$den |
- andl d5,d1 |
- orl d4,d1 |
- swap d3 |
-#ifndef __mcoldfire__
- lsrw IMM (7),d3 |
-#else
- lsrl IMM (7),d3 |
-#endif
-Ldivsf$2: |
-#ifndef __mcoldfire__
- subw d3,d2 | subtract exponents
- addw IMM (F_BIAS),d2 | and add bias
-#else
- subl d3,d2 | subtract exponents
- addl IMM (F_BIAS),d2 | and add bias
-#endif
-
-| We are now ready to do the division. We have prepared things in such a way
-| that the ratio of the fractions will be less than 2 but greater than 1/2.
-| At this point the registers in use are:
-| d0 holds a (first operand, bit FLT_MANT_DIG=0, bit FLT_MANT_DIG-1=1)
-| d1 holds b (second operand, bit FLT_MANT_DIG=1)
-| d2 holds the difference of the exponents, corrected by the bias
-| d7 holds the sign of the ratio
-| d4, d5, d6 hold some constants
- movel d7,a0 | d6-d7 will hold the ratio of the fractions
- movel IMM (0),d6 |
- movel d6,d7
-
- moveq IMM (FLT_MANT_DIG+1),d3
-1: cmpl d0,d1 | is a < b?
- bhi 2f |
- bset d3,d6 | set a bit in d6
- subl d1,d0 | if a >= b a <-- a-b
- beq 3f | if a is zero, exit
-2: addl d0,d0 | multiply a by 2
-#ifndef __mcoldfire__
- dbra d3,1b
-#else
- subql IMM (1),d3
- bpl 1b
-#endif
-
-| Now we keep going to set the sticky bit ...
- moveq IMM (FLT_MANT_DIG),d3
-1: cmpl d0,d1
- ble 2f
- addl d0,d0
-#ifndef __mcoldfire__
- dbra d3,1b
-#else
- subql IMM(1),d3
- bpl 1b
-#endif
- movel IMM (0),d1
- bra 3f
-2: movel IMM (0),d1
-#ifndef __mcoldfire__
- subw IMM (FLT_MANT_DIG),d3
- addw IMM (31),d3
-#else
- subl IMM (FLT_MANT_DIG),d3
- addl IMM (31),d3
-#endif
- bset d3,d1
-3:
- movel d6,d0 | put the ratio in d0-d1
- movel a0,d7 | get sign back
-
-| Because of the normalization we did before we are guaranteed that
-| d0 is smaller than 2^26 but larger than 2^24. Thus bit 26 is not set,
-| bit 25 could be set, and if it is not set then bit 24 is necessarily set.
- btst IMM (FLT_MANT_DIG+1),d0
- beq 1f | if it is not set, then bit 24 is set
- lsrl IMM (1),d0 |
-#ifndef __mcoldfire__
- addw IMM (1),d2 |
-#else
- addl IMM (1),d2 |
-#endif
-1:
-| Now round, check for over- and underflow, and exit.
- moveq IMM (DIVIDE),d5
- bra Lround$exit
-
-Ldivsf$inop:
- moveq IMM (DIVIDE),d5
- bra Lf$inop
-
-Ldivsf$overflow:
- moveq IMM (DIVIDE),d5
- bra Lf$overflow
-
-Ldivsf$underflow:
- moveq IMM (DIVIDE),d5
- bra Lf$underflow
-
-Ldivsf$a$0:
- moveq IMM (DIVIDE),d5
-| If a is zero check to see whether b is zero also. In that case return
-| NaN; then check if b is NaN, and return NaN also in that case. Else
-| return a properly signed zero.
- andl IMM (0x7fffffff),d1 | clear sign bit and test b
- beq Lf$inop | if b is also zero return NaN
- cmpl IMM (INFINITY),d1 | check for NaN
- bhi Lf$inop |
- movel d7,d0 | else return signed zero
- PICLEA SYM (_fpCCR),a0 |
- movew IMM (0),a0@ |
-#ifndef __mcoldfire__
- moveml sp@+,d2-d7 |
-#else
- moveml sp@,d2-d7 |
- | XXX if frame pointer is ever removed, stack pointer must
- | be adjusted here.
-#endif
- unlk a6 |
- rts |
-
-Ldivsf$b$0:
- moveq IMM (DIVIDE),d5
-| If we got here a is not zero. Check if a is NaN; in that case return NaN,
-| else return +/-INFINITY. Remember that a is in d0 with the sign bit
-| cleared already.
- cmpl IMM (INFINITY),d0 | compare d0 with INFINITY
- bhi Lf$inop | if larger it is NaN
- bra Lf$div$0 | else signal DIVIDE_BY_ZERO
-
-Ldivsf$inf:
- moveq IMM (DIVIDE),d5
-| If a is INFINITY we have to check b
- cmpl IMM (INFINITY),d1 | compare b with INFINITY
- bge Lf$inop | if b is NaN or INFINITY return NaN
- bra Lf$overflow | else return overflow
-
-| If a number is denormalized we put an exponent of 1 but do not put the
-| bit back into the fraction.
-Ldivsf$a$den:
- movel IMM (1),d2
- andl d5,d0
-1: addl d0,d0 | shift a left until bit FLT_MANT_DIG-1 is set
-#ifndef __mcoldfire__
- subw IMM (1),d2 | and adjust exponent
-#else
- subl IMM (1),d2 | and adjust exponent
-#endif
- btst IMM (FLT_MANT_DIG-1),d0
- bne Ldivsf$1
- bra 1b
-
-Ldivsf$b$den:
- movel IMM (1),d3
- andl d5,d1
-1: addl d1,d1 | shift b left until bit FLT_MANT_DIG is set
-#ifndef __mcoldfire__
- subw IMM (1),d3 | and adjust exponent
-#else
- subl IMM (1),d3 | and adjust exponent
-#endif
- btst IMM (FLT_MANT_DIG-1),d1
- bne Ldivsf$2
- bra 1b
-
-Lround$exit:
-| This is a common exit point for __mulsf3 and __divsf3.
-
-| First check for underlow in the exponent:
-#ifndef __mcoldfire__
- cmpw IMM (-FLT_MANT_DIG-1),d2
-#else
- cmpl IMM (-FLT_MANT_DIG-1),d2
-#endif
- blt Lf$underflow
-| It could happen that the exponent is less than 1, in which case the
-| number is denormalized. In this case we shift right and adjust the
-| exponent until it becomes 1 or the fraction is zero (in the latter case
-| we signal underflow and return zero).
- movel IMM (0),d6 | d6 is used temporarily
-#ifndef __mcoldfire__
- cmpw IMM (1),d2 | if the exponent is less than 1 we
-#else
- cmpl IMM (1),d2 | if the exponent is less than 1 we
-#endif
- bge 2f | have to shift right (denormalize)
-1:
-#ifndef __mcoldfire__
- addw IMM (1),d2 | adjust the exponent
- lsrl IMM (1),d0 | shift right once
- roxrl IMM (1),d1 |
- roxrl IMM (1),d6 | d6 collect bits we would lose otherwise
- cmpw IMM (1),d2 | is the exponent 1 already?
-#else
- addql IMM (1),d2 | adjust the exponent
- lsrl IMM (1),d6
- btst IMM (0),d1
- beq 11f
- bset IMM (31),d6
-11: lsrl IMM (1),d1
- btst IMM (0),d0
- beq 10f
- bset IMM (31),d1
-10: lsrl IMM (1),d0
- cmpl IMM (1),d2 | is the exponent 1 already?
-#endif
- beq 2f | if not loop back
- bra 1b |
- bra Lf$underflow | safety check, shouldn't execute '
-2: orl d6,d1 | this is a trick so we don't lose '
- | the extra bits which were flushed right
-| Now call the rounding routine (which takes care of denormalized numbers):
- lea pc@(Lround$0),a0 | to return from rounding routine
- PICLEA SYM (_fpCCR),a1 | check the rounding mode
-#ifdef __mcoldfire__
- clrl d6
-#endif
- movew a1@(6),d6 | rounding mode in d6
- beq Lround$to$nearest
-#ifndef __mcoldfire__
- cmpw IMM (ROUND_TO_PLUS),d6
-#else
- cmpl IMM (ROUND_TO_PLUS),d6
-#endif
- bhi Lround$to$minus
- blt Lround$to$zero
- bra Lround$to$plus
-Lround$0:
-| Here we have a correctly rounded result (either normalized or denormalized).
-
-| Here we should have either a normalized number or a denormalized one, and
-| the exponent is necessarily larger or equal to 1 (so we don't have to '
-| check again for underflow!). We have to check for overflow or for a
-| denormalized number (which also signals underflow).
-| Check for overflow (i.e., exponent >= 255).
-#ifndef __mcoldfire__
- cmpw IMM (0x00ff),d2
-#else
- cmpl IMM (0x00ff),d2
-#endif
- bge Lf$overflow
-| Now check for a denormalized number (exponent==0).
- movew d2,d2
- beq Lf$den
-1:
-| Put back the exponents and sign and return.
-#ifndef __mcoldfire__
- lslw IMM (7),d2 | exponent back to fourth byte
-#else
- lsll IMM (7),d2 | exponent back to fourth byte
-#endif
- bclr IMM (FLT_MANT_DIG-1),d0
- swap d0 | and put back exponent
-#ifndef __mcoldfire__
- orw d2,d0 |
-#else
- orl d2,d0
-#endif
- swap d0 |
- orl d7,d0 | and sign also
-
- PICLEA SYM (_fpCCR),a0
- movew IMM (0),a0@
-#ifndef __mcoldfire__
- moveml sp@+,d2-d7
-#else
- moveml sp@,d2-d7
- | XXX if frame pointer is ever removed, stack pointer must
- | be adjusted here.
-#endif
- unlk a6
- rts
-
-|=============================================================================
-| __negsf2
-|=============================================================================
-
-| This is trivial and could be shorter if we didn't bother checking for NaN '
-| and +/-INFINITY.
-
-| float __negsf2(float);
- FUNC(__negsf2)
-SYM (__negsf2):
-#ifndef __mcoldfire__
- link a6,IMM (0)
- moveml d2-d7,sp@-
-#else
- link a6,IMM (-24)
- moveml d2-d7,sp@
-#endif
- moveq IMM (NEGATE),d5
- movel a6@(8),d0 | get number to negate in d0
- bchg IMM (31),d0 | negate
- movel d0,d1 | make a positive copy
- bclr IMM (31),d1 |
- tstl d1 | check for zero
- beq 2f | if zero (either sign) return +zero
- cmpl IMM (INFINITY),d1 | compare to +INFINITY
- blt 1f |
- bhi Lf$inop | if larger (fraction not zero) is NaN
- movel d0,d7 | else get sign and return INFINITY
- andl IMM (0x80000000),d7
- bra Lf$infty
-1: PICLEA SYM (_fpCCR),a0
- movew IMM (0),a0@
-#ifndef __mcoldfire__
- moveml sp@+,d2-d7
-#else
- moveml sp@,d2-d7
- | XXX if frame pointer is ever removed, stack pointer must
- | be adjusted here.
-#endif
- unlk a6
- rts
-2: bclr IMM (31),d0
- bra 1b
-
-|=============================================================================
-| __cmpsf2
-|=============================================================================
-
-GREATER = 1
-LESS = -1
-EQUAL = 0
-
-| int __cmpsf2_internal(float, float, int);
-SYM (__cmpsf2_internal):
-#ifndef __mcoldfire__
- link a6,IMM (0)
- moveml d2-d7,sp@- | save registers
-#else
- link a6,IMM (-24)
- moveml d2-d7,sp@
-#endif
- moveq IMM (COMPARE),d5
- movel a6@(8),d0 | get first operand
- movel a6@(12),d1 | get second operand
-| Check if either is NaN, and in that case return garbage and signal
-| INVALID_OPERATION. Check also if either is zero, and clear the signs
-| if necessary.
- movel d0,d6
- andl IMM (0x7fffffff),d0
- beq Lcmpsf$a$0
- cmpl IMM (0x7f800000),d0
- bhi Lcmpf$inop
-Lcmpsf$1:
- movel d1,d7
- andl IMM (0x7fffffff),d1
- beq Lcmpsf$b$0
- cmpl IMM (0x7f800000),d1
- bhi Lcmpf$inop
-Lcmpsf$2:
-| Check the signs
- eorl d6,d7
- bpl 1f
-| If the signs are not equal check if a >= 0
- tstl d6
- bpl Lcmpsf$a$gt$b | if (a >= 0 && b < 0) => a > b
- bmi Lcmpsf$b$gt$a | if (a < 0 && b >= 0) => a < b
-1:
-| If the signs are equal check for < 0
- tstl d6
- bpl 1f
-| If both are negative exchange them
-#ifndef __mcoldfire__
- exg d0,d1
-#else
- movel d0,d7
- movel d1,d0
- movel d7,d1
-#endif
-1:
-| Now that they are positive we just compare them as longs (does this also
-| work for denormalized numbers?).
- cmpl d0,d1
- bhi Lcmpsf$b$gt$a | |b| > |a|
- bne Lcmpsf$a$gt$b | |b| < |a|
-| If we got here a == b.
- movel IMM (EQUAL),d0
-#ifndef __mcoldfire__
- moveml sp@+,d2-d7 | put back the registers
-#else
- moveml sp@,d2-d7
-#endif
- unlk a6
- rts
-Lcmpsf$a$gt$b:
- movel IMM (GREATER),d0
-#ifndef __mcoldfire__
- moveml sp@+,d2-d7 | put back the registers
-#else
- moveml sp@,d2-d7
- | XXX if frame pointer is ever removed, stack pointer must
- | be adjusted here.
-#endif
- unlk a6
- rts
-Lcmpsf$b$gt$a:
- movel IMM (LESS),d0
-#ifndef __mcoldfire__
- moveml sp@+,d2-d7 | put back the registers
-#else
- moveml sp@,d2-d7
- | XXX if frame pointer is ever removed, stack pointer must
- | be adjusted here.
-#endif
- unlk a6
- rts
-
-Lcmpsf$a$0:
- bclr IMM (31),d6
- bra Lcmpsf$1
-Lcmpsf$b$0:
- bclr IMM (31),d7
- bra Lcmpsf$2
-
-Lcmpf$inop:
- movl a6@(16),d0
- moveq IMM (INEXACT_RESULT+INVALID_OPERATION),d7
- moveq IMM (SINGLE_FLOAT),d6
- PICJUMP $_exception_handler
-
-| int __cmpsf2(float, float);
- FUNC(__cmpsf2)
-SYM (__cmpsf2):
- link a6,IMM (0)
- pea 1
- movl a6@(12),sp@-
- movl a6@(8),sp@-
- PICCALL SYM (__cmpsf2_internal)
- unlk a6
- rts
-
-|=============================================================================
-| rounding routines
-|=============================================================================
-
-| The rounding routines expect the number to be normalized in registers
-| d0-d1, with the exponent in register d2. They assume that the
-| exponent is larger or equal to 1. They return a properly normalized number
-| if possible, and a denormalized number otherwise. The exponent is returned
-| in d2.
-
-Lround$to$nearest:
-| We now normalize as suggested by D. Knuth ("Seminumerical Algorithms"):
-| Here we assume that the exponent is not too small (this should be checked
-| before entering the rounding routine), but the number could be denormalized.
-
-| Check for denormalized numbers:
-1: btst IMM (FLT_MANT_DIG),d0
- bne 2f | if set the number is normalized
-| Normalize shifting left until bit #FLT_MANT_DIG is set or the exponent
-| is one (remember that a denormalized number corresponds to an
-| exponent of -F_BIAS+1).
-#ifndef __mcoldfire__
- cmpw IMM (1),d2 | remember that the exponent is at least one
-#else
- cmpl IMM (1),d2 | remember that the exponent is at least one
-#endif
- beq 2f | an exponent of one means denormalized
- addl d1,d1 | else shift and adjust the exponent
- addxl d0,d0 |
-#ifndef __mcoldfire__
- dbra d2,1b |
-#else
- subql IMM (1),d2
- bpl 1b
-#endif
-2:
-| Now round: we do it as follows: after the shifting we can write the
-| fraction part as f + delta, where 1 < f < 2^25, and 0 <= delta <= 2.
-| If delta < 1, do nothing. If delta > 1, add 1 to f.
-| If delta == 1, we make sure the rounded number will be even (odd?)
-| (after shifting).
- btst IMM (0),d0 | is delta < 1?
- beq 2f | if so, do not do anything
- tstl d1 | is delta == 1?
- bne 1f | if so round to even
- movel d0,d1 |
- andl IMM (2),d1 | bit 1 is the last significant bit
- addl d1,d0 |
- bra 2f |
-1: movel IMM (1),d1 | else add 1
- addl d1,d0 |
-| Shift right once (because we used bit #FLT_MANT_DIG!).
-2: lsrl IMM (1),d0
-| Now check again bit #FLT_MANT_DIG (rounding could have produced a
-| 'fraction overflow' ...).
- btst IMM (FLT_MANT_DIG),d0
- beq 1f
- lsrl IMM (1),d0
-#ifndef __mcoldfire__
- addw IMM (1),d2
-#else
- addql IMM (1),d2
-#endif
-1:
-| If bit #FLT_MANT_DIG-1 is clear we have a denormalized number, so we
-| have to put the exponent to zero and return a denormalized number.
- btst IMM (FLT_MANT_DIG-1),d0
- beq 1f
- jmp a0@
-1: movel IMM (0),d2
- jmp a0@
-
-Lround$to$zero:
-Lround$to$plus:
-Lround$to$minus:
- jmp a0@
-#endif /* L_float */
-
-| gcc expects the routines __eqdf2, __nedf2, __gtdf2, __gedf2,
-| __ledf2, __ltdf2 to all return the same value as a direct call to
-| __cmpdf2 would. In this implementation, each of these routines
-| simply calls __cmpdf2. It would be more efficient to give the
-| __cmpdf2 routine several names, but separating them out will make it
-| easier to write efficient versions of these routines someday.
-| If the operands recompare unordered unordered __gtdf2 and __gedf2 return -1.
-| The other routines return 1.
-
-#ifdef L_eqdf2
- .text
- FUNC(__eqdf2)
- .globl SYM (__eqdf2)
-SYM (__eqdf2):
- link a6,IMM (0)
- pea 1
- movl a6@(20),sp@-
- movl a6@(16),sp@-
- movl a6@(12),sp@-
- movl a6@(8),sp@-
- PICCALL SYM (__cmpdf2_internal)
- unlk a6
- rts
-#endif /* L_eqdf2 */
-
-#ifdef L_nedf2
- .text
- FUNC(__nedf2)
- .globl SYM (__nedf2)
-SYM (__nedf2):
- link a6,IMM (0)
- pea 1
- movl a6@(20),sp@-
- movl a6@(16),sp@-
- movl a6@(12),sp@-
- movl a6@(8),sp@-
- PICCALL SYM (__cmpdf2_internal)
- unlk a6
- rts
-#endif /* L_nedf2 */
-
-#ifdef L_gtdf2
- .text
- FUNC(__gtdf2)
- .globl SYM (__gtdf2)
-SYM (__gtdf2):
- link a6,IMM (0)
- pea -1
- movl a6@(20),sp@-
- movl a6@(16),sp@-
- movl a6@(12),sp@-
- movl a6@(8),sp@-
- PICCALL SYM (__cmpdf2_internal)
- unlk a6
- rts
-#endif /* L_gtdf2 */
-
-#ifdef L_gedf2
- .text
- FUNC(__gedf2)
- .globl SYM (__gedf2)
-SYM (__gedf2):
- link a6,IMM (0)
- pea -1
- movl a6@(20),sp@-
- movl a6@(16),sp@-
- movl a6@(12),sp@-
- movl a6@(8),sp@-
- PICCALL SYM (__cmpdf2_internal)
- unlk a6
- rts
-#endif /* L_gedf2 */
-
-#ifdef L_ltdf2
- .text
- FUNC(__ltdf2)
- .globl SYM (__ltdf2)
-SYM (__ltdf2):
- link a6,IMM (0)
- pea 1
- movl a6@(20),sp@-
- movl a6@(16),sp@-
- movl a6@(12),sp@-
- movl a6@(8),sp@-
- PICCALL SYM (__cmpdf2_internal)
- unlk a6
- rts
-#endif /* L_ltdf2 */
-
-#ifdef L_ledf2
- .text
- FUNC(__ledf2)
- .globl SYM (__ledf2)
-SYM (__ledf2):
- link a6,IMM (0)
- pea 1
- movl a6@(20),sp@-
- movl a6@(16),sp@-
- movl a6@(12),sp@-
- movl a6@(8),sp@-
- PICCALL SYM (__cmpdf2_internal)
- unlk a6
- rts
-#endif /* L_ledf2 */
-
-| The comments above about __eqdf2, et. al., also apply to __eqsf2,
-| et. al., except that the latter call __cmpsf2 rather than __cmpdf2.
-
-#ifdef L_eqsf2
- .text
- FUNC(__eqsf2)
- .globl SYM (__eqsf2)
-SYM (__eqsf2):
- link a6,IMM (0)
- pea 1
- movl a6@(12),sp@-
- movl a6@(8),sp@-
- PICCALL SYM (__cmpsf2_internal)
- unlk a6
- rts
-#endif /* L_eqsf2 */
-
-#ifdef L_nesf2
- .text
- FUNC(__nesf2)
- .globl SYM (__nesf2)
-SYM (__nesf2):
- link a6,IMM (0)
- pea 1
- movl a6@(12),sp@-
- movl a6@(8),sp@-
- PICCALL SYM (__cmpsf2_internal)
- unlk a6
- rts
-#endif /* L_nesf2 */
-
-#ifdef L_gtsf2
- .text
- FUNC(__gtsf2)
- .globl SYM (__gtsf2)
-SYM (__gtsf2):
- link a6,IMM (0)
- pea -1
- movl a6@(12),sp@-
- movl a6@(8),sp@-
- PICCALL SYM (__cmpsf2_internal)
- unlk a6
- rts
-#endif /* L_gtsf2 */
-
-#ifdef L_gesf2
- .text
- FUNC(__gesf2)
- .globl SYM (__gesf2)
-SYM (__gesf2):
- link a6,IMM (0)
- pea -1
- movl a6@(12),sp@-
- movl a6@(8),sp@-
- PICCALL SYM (__cmpsf2_internal)
- unlk a6
- rts
-#endif /* L_gesf2 */
-
-#ifdef L_ltsf2
- .text
- FUNC(__ltsf2)
- .globl SYM (__ltsf2)
-SYM (__ltsf2):
- link a6,IMM (0)
- pea 1
- movl a6@(12),sp@-
- movl a6@(8),sp@-
- PICCALL SYM (__cmpsf2_internal)
- unlk a6
- rts
-#endif /* L_ltsf2 */
-
-#ifdef L_lesf2
- .text
- FUNC(__lesf2)
- .globl SYM (__lesf2)
-SYM (__lesf2):
- link a6,IMM (0)
- pea 1
- movl a6@(12),sp@-
- movl a6@(8),sp@-
- PICCALL SYM (__cmpsf2_internal)
- unlk a6
- rts
-#endif /* L_lesf2 */
-
-#if defined (__ELF__) && defined (__linux__)
- /* Make stack non-executable for ELF linux targets. */
- .section .note.GNU-stack,"",@progbits
-#endif
diff --git a/gcc/config/m68k/t-crtstuff b/gcc/config/m68k/t-crtstuff
deleted file mode 100644
index a8bdb502d66..00000000000
--- a/gcc/config/m68k/t-crtstuff
+++ /dev/null
@@ -1,10 +0,0 @@
-EXTRA_MULTILIB_PARTS=crtbegin.o crtend.o crti.o crtn.o
-
-# Add flags here as required.
-CRTSTUFF_T_CFLAGS =
-
-# Assemble startup files.
-$(T)crti.o: $(srcdir)/config/m68k/crti.s $(GCC_PASSES)
- $(GCC_FOR_TARGET) $(MULTILIB_CFLAGS) -c -o $(T)crti.o $(srcdir)/config/m68k/crti.s
-$(T)crtn.o: $(srcdir)/config/m68k/crtn.s $(GCC_PASSES)
- $(GCC_FOR_TARGET) $(MULTILIB_CFLAGS) -c -o $(T)crtn.o $(srcdir)/config/m68k/crtn.s
diff --git a/gcc/config/m68k/t-floatlib b/gcc/config/m68k/t-floatlib
deleted file mode 100644
index 2039d1d0dc4..00000000000
--- a/gcc/config/m68k/t-floatlib
+++ /dev/null
@@ -1,31 +0,0 @@
-# Copyright (C) 2007 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/>.
-
-LIB1ASMSRC = m68k/lb1sf68.asm
-LIB1ASMFUNCS = _mulsi3 _udivsi3 _divsi3 _umodsi3 _modsi3 \
- _double _float _floatex \
- _eqdf2 _nedf2 _gtdf2 _gedf2 _ltdf2 _ledf2 \
- _eqsf2 _nesf2 _gtsf2 _gesf2 _ltsf2 _lesf2
-
-LIB2FUNCS_EXTRA = fpgnulib.c xfgnulib.c
-
-fpgnulib.c: $(srcdir)/config/m68k/fpgnulib.c
- cp $(srcdir)/config/m68k/fpgnulib.c fpgnulib.c
-xfgnulib.c: $(srcdir)/config/m68k/fpgnulib.c
- echo '#define EXTFLOAT' > xfgnulib.c
- cat $(srcdir)/config/m68k/fpgnulib.c >> xfgnulib.c
diff --git a/gcc/config/m68k/t-linux b/gcc/config/m68k/t-linux
index a8cb563a2e2..3fa29474693 100644
--- a/gcc/config/m68k/t-linux
+++ b/gcc/config/m68k/t-linux
@@ -1,4 +1,4 @@
-# Copyright (C) 2008, 2010 Free Software Foundation, Inc.
+# Copyright (C) 2008, 2010, 2011 Free Software Foundation, Inc.
#
# This file is part of GCC.
#
@@ -16,8 +16,6 @@
# along with GCC; see the file COPYING3. If not see
# <http://www.gnu.org/licenses/>.
-EXTRA_MULTILIB_PARTS=crtbegin.o crtend.o crtbeginS.o crtendS.o crtbeginT.o
-
# Only include multilibs for 680x0 and ColdFire CPUs with an MMU.
M68K_MLIB_CPU += && ((CPU ~ "^m680") || (CPU ~ "^mcf")) && (FLAGS ~ "FL_MMU")
diff --git a/gcc/config/m68k/t-m68kelf b/gcc/config/m68k/t-m68kelf
deleted file mode 100644
index bea01dc4f49..00000000000
--- a/gcc/config/m68k/t-m68kelf
+++ /dev/null
@@ -1,4 +0,0 @@
-# from ../t-svr4
-EXTRA_MULTILIB_PARTS=crtbegin.o crtend.o
-# no pic for now
-#CRTSTUFF_T_CFLAGS=-fpic
diff --git a/gcc/config/m68k/t-mlibs b/gcc/config/m68k/t-mlibs
index 11df31f210e..7be0c9f4fd4 100644
--- a/gcc/config/m68k/t-mlibs
+++ b/gcc/config/m68k/t-mlibs
@@ -92,6 +92,3 @@ endif
# Remove the default CPU from the explicit exceptions.
MULTILIB_EXCEPTIONS := \
$(patsubst mcpu=$(M68K_MLIB_DEFAULT)/%,%,$(MULTILIB_EXCEPTIONS))
-
-LIBGCC = stmp-multilib
-INSTALL_LIBGCC = install-multilib
diff --git a/gcc/config/m68k/t-slibgcc-elf-ver b/gcc/config/m68k/t-slibgcc-elf-ver
deleted file mode 100644
index 6aac37cc08f..00000000000
--- a/gcc/config/m68k/t-slibgcc-elf-ver
+++ /dev/null
@@ -1,3 +0,0 @@
-# Bump the version number of the shared libgcc library
-
-SHLIB_SOVERSION = 2
diff --git a/gcc/config/m68k/t-uclinux b/gcc/config/m68k/t-uclinux
index e1711a3443e..6994359dcce 100644
--- a/gcc/config/m68k/t-uclinux
+++ b/gcc/config/m68k/t-uclinux
@@ -1,4 +1,4 @@
-# Copyright (C) 2003, 2005, 2007, 2008 Free Software Foundation, Inc.
+# Copyright (C) 2003, 2005, 2007, 2008, 2011 Free Software Foundation, Inc.
#
# This file is part of GCC.
#
@@ -16,9 +16,6 @@
# along with GCC; see the file COPYING3. If not see
# <http://www.gnu.org/licenses/>.
-# crti and crtn are provided by uClibc.
-EXTRA_MULTILIB_PARTS=crtbegin.o crtend.o
-
# Include multilibs for CPUs without an MMU or with FL_UCLINUX
M68K_MLIB_CPU += && (!match(FLAGS, "FL_MMU") || match(FLAGS, "FL_UCLINUX"))
diff --git a/gcc/config/mcore/crti.asm b/gcc/config/mcore/crti.asm
deleted file mode 100644
index 03f59292896..00000000000
--- a/gcc/config/mcore/crti.asm
+++ /dev/null
@@ -1,62 +0,0 @@
-# crti.asm for ELF based systems
-
-# Copyright (C) 1992, 1998, 1999, 2008, 2009 Free Software Foundation, Inc.
-# Written By David Vinayak Henkel-Wallace, June 1992
-#
-# This file is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the
-# Free Software Foundation; either version 3, or (at your option) any
-# later version.
-#
-# This file 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/>.
-
-
-# This file just makes a stack frame for the contents of the .fini and
-# .init sections. Users may put any desired instructions in those
-# sections.
-
- .section ".init"
- .global _init
- .type _init,@function
- .align 4
-_init:
- subi r0, 16
- st.w r15, (r0, 12)
-
- # These nops are here to align the end of this code with a 16 byte
- # boundary. The linker will start inserting code into the .init
- # section at such a boundary.
-
- nop
- nop
- nop
- nop
- nop
- nop
-
-
- .section ".fini"
- .global _fini
- .type _fini,@function
- .align 4
-_fini:
- subi r0, 16
- st.w r15, (r0, 12)
- nop
- nop
- nop
- nop
- nop
- nop
diff --git a/gcc/config/mcore/crtn.asm b/gcc/config/mcore/crtn.asm
deleted file mode 100644
index b764441e721..00000000000
--- a/gcc/config/mcore/crtn.asm
+++ /dev/null
@@ -1,44 +0,0 @@
-# crtn.asm for ELF based systems
-
-# Copyright (C) 1992, 1999, 2000, 2008, 2009 Free Software Foundation, Inc.
-# Written By David Vinayak Henkel-Wallace, June 1992
-#
-# This file is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the
-# Free Software Foundation; either version 3, or (at your option) any
-# later version.
-#
-# This file 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/>.
-
-# This file just makes sure that the .fini and .init sections do in
-# fact return. Users may put any desired instructions in those sections.
-# This file is the last thing linked into any executable.
-
- .section ".init"
- .align 4
-
- ldw r15,(r0, 12)
- addi r0,16
- jmp r15
-
- .section ".fini"
- .align 4
-
- ldw r15, (r0, 12)
- addi r0,16
- jmp r15
-
-# Th-th-th-that is all folks!
-
diff --git a/gcc/config/mcore/lib1.asm b/gcc/config/mcore/lib1.asm
deleted file mode 100644
index 701762f2a3c..00000000000
--- a/gcc/config/mcore/lib1.asm
+++ /dev/null
@@ -1,303 +0,0 @@
-/* libgcc routines for the MCore.
- Copyright (C) 1993, 1999, 2000, 2009 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.
-
-This file 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/>. */
-
-#define CONCAT1(a, b) CONCAT2(a, b)
-#define CONCAT2(a, b) a ## b
-
-/* Use the right prefix for global labels. */
-
-#define SYM(x) CONCAT1 (__, x)
-
-#ifdef __ELF__
-#define TYPE(x) .type SYM (x),@function
-#define SIZE(x) .size SYM (x), . - SYM (x)
-#else
-#define TYPE(x)
-#define SIZE(x)
-#endif
-
-.macro FUNC_START name
- .text
- .globl SYM (\name)
- TYPE (\name)
-SYM (\name):
-.endm
-
-.macro FUNC_END name
- SIZE (\name)
-.endm
-
-#ifdef L_udivsi3
-FUNC_START udiv32
-FUNC_START udivsi32
-
- movi r1,0 // r1-r2 form 64 bit dividend
- movi r4,1 // r4 is quotient (1 for a sentinel)
-
- cmpnei r3,0 // look for 0 divisor
- bt 9f
- trap 3 // divide by 0
-9:
- // control iterations; skip across high order 0 bits in dividend
- mov r7,r2
- cmpnei r7,0
- bt 8f
- movi r2,0 // 0 dividend
- jmp r15 // quick return
-8:
- ff1 r7 // figure distance to skip
- lsl r4,r7 // move the sentinel along (with 0's behind)
- lsl r2,r7 // and the low 32 bits of numerator
-
-// appears to be wrong...
-// tested out incorrectly in our OS work...
-// mov r7,r3 // looking at divisor
-// ff1 r7 // I can move 32-r7 more bits to left.
-// addi r7,1 // ok, one short of that...
-// mov r1,r2
-// lsr r1,r7 // bits that came from low order...
-// rsubi r7,31 // r7 == "32-n" == LEFT distance
-// addi r7,1 // this is (32-n)
-// lsl r4,r7 // fixes the high 32 (quotient)
-// lsl r2,r7
-// cmpnei r4,0
-// bf 4f // the sentinel went away...
-
- // run the remaining bits
-
-1: lslc r2,1 // 1 bit left shift of r1-r2
- addc r1,r1
- cmphs r1,r3 // upper 32 of dividend >= divisor?
- bf 2f
- sub r1,r3 // if yes, subtract divisor
-2: addc r4,r4 // shift by 1 and count subtracts
- bf 1b // if sentinel falls out of quotient, stop
-
-4: mov r2,r4 // return quotient
- mov r3,r1 // and piggyback the remainder
- jmp r15
-FUNC_END udiv32
-FUNC_END udivsi32
-#endif
-
-#ifdef L_umodsi3
-FUNC_START urem32
-FUNC_START umodsi3
- movi r1,0 // r1-r2 form 64 bit dividend
- movi r4,1 // r4 is quotient (1 for a sentinel)
- cmpnei r3,0 // look for 0 divisor
- bt 9f
- trap 3 // divide by 0
-9:
- // control iterations; skip across high order 0 bits in dividend
- mov r7,r2
- cmpnei r7,0
- bt 8f
- movi r2,0 // 0 dividend
- jmp r15 // quick return
-8:
- ff1 r7 // figure distance to skip
- lsl r4,r7 // move the sentinel along (with 0's behind)
- lsl r2,r7 // and the low 32 bits of numerator
-
-1: lslc r2,1 // 1 bit left shift of r1-r2
- addc r1,r1
- cmphs r1,r3 // upper 32 of dividend >= divisor?
- bf 2f
- sub r1,r3 // if yes, subtract divisor
-2: addc r4,r4 // shift by 1 and count subtracts
- bf 1b // if sentinel falls out of quotient, stop
- mov r2,r1 // return remainder
- jmp r15
-FUNC_END urem32
-FUNC_END umodsi3
-#endif
-
-#ifdef L_divsi3
-FUNC_START div32
-FUNC_START divsi3
- mov r5,r2 // calc sign of quotient
- xor r5,r3
- abs r2 // do unsigned divide
- abs r3
- movi r1,0 // r1-r2 form 64 bit dividend
- movi r4,1 // r4 is quotient (1 for a sentinel)
- cmpnei r3,0 // look for 0 divisor
- bt 9f
- trap 3 // divide by 0
-9:
- // control iterations; skip across high order 0 bits in dividend
- mov r7,r2
- cmpnei r7,0
- bt 8f
- movi r2,0 // 0 dividend
- jmp r15 // quick return
-8:
- ff1 r7 // figure distance to skip
- lsl r4,r7 // move the sentinel along (with 0's behind)
- lsl r2,r7 // and the low 32 bits of numerator
-
-// tested out incorrectly in our OS work...
-// mov r7,r3 // looking at divisor
-// ff1 r7 // I can move 32-r7 more bits to left.
-// addi r7,1 // ok, one short of that...
-// mov r1,r2
-// lsr r1,r7 // bits that came from low order...
-// rsubi r7,31 // r7 == "32-n" == LEFT distance
-// addi r7,1 // this is (32-n)
-// lsl r4,r7 // fixes the high 32 (quotient)
-// lsl r2,r7
-// cmpnei r4,0
-// bf 4f // the sentinel went away...
-
- // run the remaining bits
-1: lslc r2,1 // 1 bit left shift of r1-r2
- addc r1,r1
- cmphs r1,r3 // upper 32 of dividend >= divisor?
- bf 2f
- sub r1,r3 // if yes, subtract divisor
-2: addc r4,r4 // shift by 1 and count subtracts
- bf 1b // if sentinel falls out of quotient, stop
-
-4: mov r2,r4 // return quotient
- mov r3,r1 // piggyback the remainder
- btsti r5,31 // after adjusting for sign
- bf 3f
- rsubi r2,0
- rsubi r3,0
-3: jmp r15
-FUNC_END div32
-FUNC_END divsi3
-#endif
-
-#ifdef L_modsi3
-FUNC_START rem32
-FUNC_START modsi3
- mov r5,r2 // calc sign of remainder
- abs r2 // do unsigned divide
- abs r3
- movi r1,0 // r1-r2 form 64 bit dividend
- movi r4,1 // r4 is quotient (1 for a sentinel)
- cmpnei r3,0 // look for 0 divisor
- bt 9f
- trap 3 // divide by 0
-9:
- // control iterations; skip across high order 0 bits in dividend
- mov r7,r2
- cmpnei r7,0
- bt 8f
- movi r2,0 // 0 dividend
- jmp r15 // quick return
-8:
- ff1 r7 // figure distance to skip
- lsl r4,r7 // move the sentinel along (with 0's behind)
- lsl r2,r7 // and the low 32 bits of numerator
-
-1: lslc r2,1 // 1 bit left shift of r1-r2
- addc r1,r1
- cmphs r1,r3 // upper 32 of dividend >= divisor?
- bf 2f
- sub r1,r3 // if yes, subtract divisor
-2: addc r4,r4 // shift by 1 and count subtracts
- bf 1b // if sentinel falls out of quotient, stop
- mov r2,r1 // return remainder
- btsti r5,31 // after adjusting for sign
- bf 3f
- rsubi r2,0
-3: jmp r15
-FUNC_END rem32
-FUNC_END modsi3
-#endif
-
-
-/* GCC expects that {__eq,__ne,__gt,__ge,__le,__lt}{df2,sf2}
- will behave as __cmpdf2. So, we stub the implementations to
- jump on to __cmpdf2 and __cmpsf2.
-
- All of these shortcircuit the return path so that __cmp{sd}f2
- will go directly back to the caller. */
-
-.macro COMPARE_DF_JUMP name
- .import SYM (cmpdf2)
-FUNC_START \name
- jmpi SYM (cmpdf2)
-FUNC_END \name
-.endm
-
-#ifdef L_eqdf2
-COMPARE_DF_JUMP eqdf2
-#endif /* L_eqdf2 */
-
-#ifdef L_nedf2
-COMPARE_DF_JUMP nedf2
-#endif /* L_nedf2 */
-
-#ifdef L_gtdf2
-COMPARE_DF_JUMP gtdf2
-#endif /* L_gtdf2 */
-
-#ifdef L_gedf2
-COMPARE_DF_JUMP gedf2
-#endif /* L_gedf2 */
-
-#ifdef L_ltdf2
-COMPARE_DF_JUMP ltdf2
-#endif /* L_ltdf2 */
-
-#ifdef L_ledf2
-COMPARE_DF_JUMP ledf2
-#endif /* L_ledf2 */
-
-/* SINGLE PRECISION FLOATING POINT STUBS */
-
-.macro COMPARE_SF_JUMP name
- .import SYM (cmpsf2)
-FUNC_START \name
- jmpi SYM (cmpsf2)
-FUNC_END \name
-.endm
-
-#ifdef L_eqsf2
-COMPARE_SF_JUMP eqsf2
-#endif /* L_eqsf2 */
-
-#ifdef L_nesf2
-COMPARE_SF_JUMP nesf2
-#endif /* L_nesf2 */
-
-#ifdef L_gtsf2
-COMPARE_SF_JUMP gtsf2
-#endif /* L_gtsf2 */
-
-#ifdef L_gesf2
-COMPARE_SF_JUMP __gesf2
-#endif /* L_gesf2 */
-
-#ifdef L_ltsf2
-COMPARE_SF_JUMP __ltsf2
-#endif /* L_ltsf2 */
-
-#ifdef L_lesf2
-COMPARE_SF_JUMP lesf2
-#endif /* L_lesf2 */
diff --git a/gcc/config/mcore/t-mcore b/gcc/config/mcore/t-mcore
index 5533211a5d2..c848ceda3b3 100644
--- a/gcc/config/mcore/t-mcore
+++ b/gcc/config/mcore/t-mcore
@@ -16,42 +16,17 @@
# along with GCC; see the file COPYING3. If not see
# <http://www.gnu.org/licenses/>.
-LIB1ASMSRC = mcore/lib1.asm
-LIB1ASMFUNCS = _divsi3 _udivsi3 _modsi3 _umodsi3
-
-# Assemble startup files.
-$(T)crti.o: $(srcdir)/config/mcore/crti.asm $(GCC_PASSES)
- $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(MULTILIB_CFLAGS) $(INCLUDES) \
- -c -o $(T)crti.o -x assembler-with-cpp $(srcdir)/config/mcore/crti.asm
-
-$(T)crtn.o: $(srcdir)/config/mcore/crtn.asm $(GCC_PASSES)
- $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(MULTILIB_CFLAGS) $(INCLUDES) \
- -c -o $(T)crtn.o -x assembler-with-cpp $(srcdir)/config/mcore/crtn.asm
-
-# could use -msifilter to be safe from interrupt/jmp interactions and others.
-TARGET_LIBGCC2_CFLAGS=-O3 -DNO_FLOATLIB_FIXUNSDFSI #-msifilter
-
# We have values for float.h.
CROSS_FLOAT_H = $(srcdir)/config/mcore/gfloat.h
# If support for -m4align is ever re-enabled then comment out the
-# following line and uncomment the mutlilib lines below.
-
-EXTRA_PARTS = crtbegin.o crtend.o crti.o crtn.o
+# following line and uncomment the multilib lines below.
# MULTILIB_OPTIONS = m8align/m4align
# MULTILIB_DIRNAMES = align8 align4
# MULTILIB_MATCHES =
# MULTILIB_EXTRA_OPTS =
# MULTILIB_EXCEPTIONS =
-# EXTRA_MULTILIB_PARTS = crtbegin.o crtend.o crti.o crtn.o
-# LIBGCC = stmp-multilib
-# INSTALL_LIBGCC = install-multilib
MULTILIB_OPTIONS = mbig-endian/mlittle-endian m210/m340
MULTILIB_DIRNAMES = big little m210 m340
-
-EXTRA_PARTS =
-EXTRA_MULTILIB_PARTS = crtbegin.o crtend.o crti.o crtn.o
-LIBGCC = stmp-multilib
-INSTALL_LIBGCC = install-multilib
diff --git a/gcc/config/memcmp.c b/gcc/config/memcmp.c
deleted file mode 100644
index 2348afe1d27..00000000000
--- a/gcc/config/memcmp.c
+++ /dev/null
@@ -1,16 +0,0 @@
-/* Public domain. */
-#include <stddef.h>
-
-int
-memcmp (const void *str1, const void *str2, size_t count)
-{
- const unsigned char *s1 = str1;
- const unsigned char *s2 = str2;
-
- while (count-- > 0)
- {
- if (*s1++ != *s2++)
- return s1[-1] < s2[-1] ? -1 : 1;
- }
- return 0;
-}
diff --git a/gcc/config/memcpy.c b/gcc/config/memcpy.c
deleted file mode 100644
index 58b1e405627..00000000000
--- a/gcc/config/memcpy.c
+++ /dev/null
@@ -1,12 +0,0 @@
-/* Public domain. */
-#include <stddef.h>
-
-void *
-memcpy (void *dest, const void *src, size_t len)
-{
- char *d = dest;
- const char *s = src;
- while (len--)
- *d++ = *s++;
- return dest;
-}
diff --git a/gcc/config/memmove.c b/gcc/config/memmove.c
deleted file mode 100644
index 13b340af6a0..00000000000
--- a/gcc/config/memmove.c
+++ /dev/null
@@ -1,20 +0,0 @@
-/* Public domain. */
-#include <stddef.h>
-
-void *
-memmove (void *dest, const void *src, size_t len)
-{
- char *d = dest;
- const char *s = src;
- if (d < s)
- while (len--)
- *d++ = *s++;
- else
- {
- char *lasts = s + (len-1);
- char *lastd = d + (len-1);
- while (len--)
- *lastd-- = *lasts--;
- }
- return dest;
-}
diff --git a/gcc/config/memset.c b/gcc/config/memset.c
deleted file mode 100644
index 3e7025ee394..00000000000
--- a/gcc/config/memset.c
+++ /dev/null
@@ -1,11 +0,0 @@
-/* Public domain. */
-#include <stddef.h>
-
-void *
-memset (void *dest, int val, size_t len)
-{
- unsigned char *ptr = dest;
- while (len-- > 0)
- *ptr++ = val;
- return dest;
-}
diff --git a/gcc/config/mep/mep-lib1.asm b/gcc/config/mep/mep-lib1.asm
deleted file mode 100644
index 0a18913f927..00000000000
--- a/gcc/config/mep/mep-lib1.asm
+++ /dev/null
@@ -1,125 +0,0 @@
-/* libgcc routines for Toshiba Media Processor.
- Copyright (C) 2001, 2002, 2005, 2009 Free Software Foundation, Inc.
-
-This file is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-This file 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/>. */
-
-#define SAVEALL \
- add3 $sp, $sp, -16*4 ; \
- sw $0, ($sp) ; \
- sw $1, 4($sp) ; \
- sw $2, 8($sp) ; \
- sw $3, 12($sp) ; \
- sw $4, 16($sp) ; \
- sw $5, 20($sp) ; \
- sw $6, 24($sp) ; \
- sw $7, 28($sp) ; \
- sw $8, 32($sp) ; \
- sw $9, 36($sp) ; \
- sw $10, 40($sp) ; \
- sw $11, 44($sp) ; \
- sw $12, 48($sp) ; \
- sw $13, 52($sp) ; \
- sw $14, 56($sp) ; \
- ldc $5, $lp ; \
- add $5, 3 ; \
- mov $6, -4 ; \
- and $5, $6
-
-#define RESTOREALL \
- stc $5, $lp ; \
- lw $14, 56($sp) ; \
- lw $13, 52($sp) ; \
- lw $12, 48($sp) ; \
- lw $11, 44($sp) ; \
- lw $10, 40($sp) ; \
- lw $9, 36($sp) ; \
- lw $8, 32($sp) ; \
- lw $7, 28($sp) ; \
- lw $6, 24($sp) ; \
- lw $5, 20($sp) ; \
- lw $4, 16($sp) ; \
- lw $3, 12($sp) ; \
- lw $2, 8($sp) ; \
- lw $1, 4($sp) ; \
- lw $0, ($sp) ; \
- add3 $sp, $sp, 16*4 ; \
- ret
-
-#ifdef L_mep_profile
- .text
- .global __mep_mcount
-__mep_mcount:
- SAVEALL
- ldc $1, $lp
- mov $2, $0
- bsr __mep_mcount_2
- RESTOREALL
-#endif
-
-#ifdef L_mep_bb_init_trace
- .text
- .global __mep_bb_init_trace_func
-__mep_bb_init_trace_func:
- SAVEALL
- lw $1, ($5)
- lw $2, 4($5)
- add $5, 8
- bsr __bb_init_trace_func
- RESTOREALL
-#endif
-
-#ifdef L_mep_bb_init
- .text
- .global __mep_bb_init_func
-__mep_bb_init_func:
- SAVEALL
- lw $1, ($5)
- add $5, 4
- bsr __bb_init_func
- RESTOREALL
-#endif
-
-#ifdef L_mep_bb_trace
- .text
- .global __mep_bb_trace_func
-__mep_bb_trace_func:
- SAVEALL
- movu $3, __bb
- lw $1, ($5)
- sw $1, ($3)
- lw $2, 4($5)
- sw $2, 4($3)
- add $5, 8
- bsr __bb_trace_func
- RESTOREALL
-#endif
-
-#ifdef L_mep_bb_increment
- .text
- .global __mep_bb_increment_func
-__mep_bb_increment_func:
- SAVEALL
- lw $1, ($5)
- lw $0, ($1)
- add $0, 1
- sw $0, ($1)
- add $5, 4
- RESTOREALL
-#endif
diff --git a/gcc/config/mep/mep-lib2.c b/gcc/config/mep/mep-lib2.c
deleted file mode 100644
index 1dbf57d9535..00000000000
--- a/gcc/config/mep/mep-lib2.c
+++ /dev/null
@@ -1,139 +0,0 @@
-/* libgcc routines for MeP.
- Copyright 2001, 2002, 2009 Free Software Foundation, Inc
-
-This file is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-This file 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/>. */
-
-typedef int SItype __attribute__ ((mode (SI)));
-typedef unsigned int USItype __attribute__ ((mode (SI)));
-
-typedef int word_type __attribute__ ((mode (__word__)));
-
-USItype
-__mulsi3 (USItype a, USItype b)
-{
- USItype c = 0;
-
- while (a != 0)
- {
- if (a & 1)
- c += b;
- a >>= 1;
- b <<= 1;
- }
-
- return c;
-}
-
-
-
-USItype
-udivmodsi4(USItype num, USItype den, word_type modwanted)
-{
- USItype bit = 1;
- USItype res = 0;
-
- while (den < num && bit && !(den & (1L<<31)))
- {
- den <<=1;
- bit <<=1;
- }
- while (bit)
- {
- if (num >= den)
- {
- num -= den;
- res |= bit;
- }
- bit >>=1;
- den >>=1;
- }
- if (modwanted) return num;
- return res;
-}
-
-
-
-SItype
-__divsi3 (SItype a, SItype b)
-{
- word_type neg = 0;
- SItype res;
-
- if (a < 0)
- {
- a = -a;
- neg = !neg;
- }
-
- if (b < 0)
- {
- b = -b;
- neg = !neg;
- }
-
- res = udivmodsi4 (a, b, 0);
-
- if (neg)
- res = -res;
-
- return res;
-}
-
-
-
-SItype
-__modsi3 (SItype a, SItype b)
-{
- word_type neg = 0;
- SItype res;
-
- if (a < 0)
- {
- a = -a;
- neg = 1;
- }
-
- if (b < 0)
- b = -b;
-
- res = udivmodsi4 (a, b, 1);
-
- if (neg)
- res = -res;
-
- return res;
-}
-
-
-
-
-SItype
-__udivsi3 (SItype a, SItype b)
-{
- return udivmodsi4 (a, b, 0);
-}
-
-
-
-SItype
-__umodsi3 (SItype a, SItype b)
-{
- return udivmodsi4 (a, b, 1);
-}
diff --git a/gcc/config/mep/mep-tramp.c b/gcc/config/mep/mep-tramp.c
deleted file mode 100644
index bf484ca4e95..00000000000
--- a/gcc/config/mep/mep-tramp.c
+++ /dev/null
@@ -1,103 +0,0 @@
-/* Trampoline support for MeP
- Copyright (C) 2004, 2007 Free Software Foundation, Inc.
- Contributed by Red Hat Inc.
-
-This file is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-This file 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/>. */
-
-/*
- 7a0a ldc $10,$pc
- c0ae000a lw $0,10($10)
- caae000e lw $10,14($10)
- 10ae jmp $10
- 00000000 static chain
- 00000000 function address
-*/
-
-static inline int
-cache_config_register(void) {
- int rv;
- asm ("ldc\t%0, $ccfg" : "=r" (rv));
- return rv;
-}
-
-#define ICACHE_SIZE ((cache_config_register() >> 16) & 0x7f)
-#define DCACHE_SIZE (cache_config_register() & 0x7f)
-
-#define ICACHE_DATA_BASE 0x00300000
-#define ICACHE_TAG_BASE 0x00310000
-#define DCACHE_DATA_BASE 0x00320000
-#define DCACHE_TAG_BASE 0x00330000
-
-static inline void
-flush_dcache (int addr)
-{
- asm volatile ("cache\t0, (%0)" : : "r" (addr));
-}
-
-void
-__mep_trampoline_helper (unsigned long *tramp,
- int function_address,
- int static_chain);
-
-void
-__mep_trampoline_helper (unsigned long *tramp,
- int function_address,
- int static_chain)
-{
- int dsize, isize;
-
-#ifdef __LITTLE_ENDIAN__
- tramp[0] = 0xc0ae7a0a;
- tramp[1] = 0xcaae000a;
- tramp[2] = 0x10ae000e;
-#else
- tramp[0] = 0x7a0ac0ae;
- tramp[1] = 0x000acaae;
- tramp[2] = 0x000e10ae;
-#endif
- tramp[3] = static_chain;
- tramp[4] = function_address;
-
- dsize = DCACHE_SIZE;
- isize = ICACHE_SIZE;
-
- if (dsize)
- {
- flush_dcache ((int)tramp);
- flush_dcache ((int)tramp+16);
- }
-
- if (isize)
- {
- int imask = (isize * 1024) - 1;
- int tmask = ~imask;
- unsigned int i;
- volatile unsigned int *tags;
-
- imask &= 0xffe0;
-
- for (i=(unsigned int)tramp; i<(unsigned int)tramp+20; i+=16)
- {
- tags = (unsigned int *)(ICACHE_TAG_BASE + (i & imask));
- if ((*tags & tmask) == (i & tmask))
- *tags &= ~1;
- }
- }
-}
diff --git a/gcc/config/mep/t-mep b/gcc/config/mep/t-mep
index 29c75457241..96542c4782c 100644
--- a/gcc/config/mep/t-mep
+++ b/gcc/config/mep/t-mep
@@ -24,12 +24,6 @@
GTM_H = tm.h $(tm_file_list) $(srcdir)/config/mep/mep-intrin.h insn-constants.h
-# Use -O0 instead of -O2 so we don't get complex relocations
-
-CRTSTUFF_CFLAGS = -O0 $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -g0 \
- -finhibit-size-directive -fno-inline-functions -fno-exceptions \
- -fno-zero-initialized-in-bss -fno-unit-at-a-time
-
TCFLAGS = -mlibrary
mep-pragma.o: $(srcdir)/config/mep/mep-pragma.c $(CONFIG_H) $(SYSTEM_H) \
@@ -38,27 +32,9 @@ mep-pragma.o: $(srcdir)/config/mep/mep-pragma.c $(CONFIG_H) $(SYSTEM_H) \
function.h insn-config.h reload.h $(TARGET_H)
$(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $<
-# profiling support
-
-LIB1ASMSRC = mep/mep-lib1.asm
-
-LIB1ASMFUNCS = _mep_profile \
- _mep_bb_init_trace \
- _mep_bb_init \
- _mep_bb_trace \
- _mep_bb_increment
-
-# multiply and divide routines
-
-LIB2FUNCS_EXTRA = \
- $(srcdir)/config/mep/mep-lib2.c \
- $(srcdir)/config/mep/mep-tramp.c
-
MULTILIB_OPTIONS = mel mall-opts mfar
MULTILIB_DIRNAMES = el allopt far
-EXTRA_MULTILIB_PARTS = crtbegin.o crtend.o
-
MD_INCLUDES = \
$(srcdir)/config/mep/intrinsics.md \
$(srcdir)/config/mep/predicates.md \
diff --git a/gcc/config/microblaze/crti.s b/gcc/config/microblaze/crti.s
deleted file mode 100644
index 3944443b437..00000000000
--- a/gcc/config/microblaze/crti.s
+++ /dev/null
@@ -1,39 +0,0 @@
-/* crti.s for __init, __fini
- This file supplies the prologue for __init and __fini routines
-
- Copyright 2009, 2010 Free Software Foundation, Inc.
-
- Contributed by Michael Eager <eager@eagercon.com>.
-
- This file 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/>. */
-
- .section .init, "ax"
- .global __init
- .align 2
-__init:
- addik r1, r1, -8
- sw r15, r0, r1
-
- .section .fini, "ax"
- .global __fini
- .align 2
-__fini:
- addik r1, r1, -8
- sw r15, r0, r1
diff --git a/gcc/config/microblaze/crtn.s b/gcc/config/microblaze/crtn.s
deleted file mode 100644
index 7970dee1c93..00000000000
--- a/gcc/config/microblaze/crtn.s
+++ /dev/null
@@ -1,35 +0,0 @@
-/* crtn.s for __init, __fini
- This file supplies the epilogue for __init and __fini routines
-
- Copyright 2009, 2010 Free Software Foundation, Inc.
-
- Contributed by Michael Eager <eager@eagercon.com>.
-
- This file 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/>. */
-
- .section .init, "ax"
- lw r15, r0, r1
- rtsd r15, 8
- addik r1, r1, 8
-
- .section .fini, "ax"
- lw r15, r0, r1
- rtsd r15, 8
- addik r1, r1, 8
diff --git a/gcc/config/microblaze/t-microblaze b/gcc/config/microblaze/t-microblaze
index 8c8767f9baa..cb49636b9ac 100644
--- a/gcc/config/microblaze/t-microblaze
+++ b/gcc/config/microblaze/t-microblaze
@@ -1,8 +1,3 @@
-# For C++ crtstuff
-EXTRA_MULTILIB_PARTS = crtbegin$(objext) crtend$(objext)
-
-EXTRA_PARTS += crti$(objext) crtn$(objext)
-
MULTILIB_OPTIONS = mxl-barrel-shift mno-xl-soft-mul mxl-multiply-high
MULTILIB_DIRNAMES = bs m mh
MULTILIB_EXCEPTIONS = *mxl-barrel-shift/mxl-multiply-high mxl-multiply-high
@@ -13,10 +8,3 @@ microblaze-c.o: $(srcdir)/config/microblaze/microblaze-c.c \
$(CONFIG_H) $(SYSTEM_H) $(CPPLIB_H) $(TM_P_H) $(TREE_H) errors.h $(TM_H)
$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
$(srcdir)/config/microblaze/microblaze-c.c
-
-# Assemble startup files
-$(T)crti$(objext): $(srcdir)/config/microblaze/crti.s
- $(GCC_FOR_TARGET) -c $(srcdir)/config/microblaze/crti.s -o $(T)crti$(objext)
-
-$(T)crtn$(objext): $(srcdir)/config/microblaze/crtn.s
- $(GCC_FOR_TARGET) -c $(srcdir)/config/microblaze/crtn.s -o $(T)crtn$(objext)
diff --git a/gcc/config/mips/crti.asm b/gcc/config/mips/crti.asm
deleted file mode 100644
index ac04271c598..00000000000
--- a/gcc/config/mips/crti.asm
+++ /dev/null
@@ -1,49 +0,0 @@
-/* Copyright (C) 2001, 2002 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/>. */
-
-/* 4 slots for argument spill area. 1 for cpreturn, 1 for stack.
- Return spill offset of 40 and 20. Aligned to 16 bytes for n32. */
-
- .section .init,"ax",@progbits
- .globl _init
- .type _init,@function
-_init:
-#ifdef __mips64
- daddu $sp,$sp,-48
- sd $31,40($sp)
-#else
- addu $sp,$sp,-32
- sw $31,20($sp)
-#endif
-
- .section .fini,"ax",@progbits
- .globl _fini
- .type _fini,@function
-_fini:
-#ifdef __mips64
- daddu $sp,$sp,-48
- sd $31,40($sp)
-#else
- addu $sp,$sp,-32
- sw $31,20($sp)
-#endif
diff --git a/gcc/config/mips/crtn.asm b/gcc/config/mips/crtn.asm
deleted file mode 100644
index 03a6b68c9cf..00000000000
--- a/gcc/config/mips/crtn.asm
+++ /dev/null
@@ -1,52 +0,0 @@
-/* Copyright (C) 2001, 2002 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/>. */
-
-/* 4 slots for argument spill area. 1 for cpreturn, 1 for stack.
- Return spill offset of 40 and 20. Aligned to 16 bytes for n32. */
-
-#ifdef __mips16
-#define RA $7
-#else
-#define RA $31
-#endif
-
- .section .init,"ax",@progbits
-#ifdef __mips64
- ld RA,40($sp)
- daddu $sp,$sp,48
-#else
- lw RA,20($sp)
- addu $sp,$sp,32
-#endif
- j RA
-
- .section .fini,"ax",@progbits
-#ifdef __mips64
- ld RA,40($sp)
- daddu $sp,$sp,48
-#else
- lw RA,20($sp)
- addu $sp,$sp,32
-#endif
- j RA
-
diff --git a/gcc/config/mips/libgcc-mips16.ver b/gcc/config/mips/libgcc-mips16.ver
deleted file mode 100644
index ddb23e7e750..00000000000
--- a/gcc/config/mips/libgcc-mips16.ver
+++ /dev/null
@@ -1,86 +0,0 @@
-# Copyright (C) 2008 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_4.4.0 {
- __mips16_addsf3
- __mips16_subsf3
- __mips16_mulsf3
- __mips16_divsf3
- __mips16_eqsf2
- __mips16_nesf2
- __mips16_gtsf2
- __mips16_gesf2
- __mips16_lesf2
- __mips16_ltsf2
- __mips16_floatsisf
- __mips16_floatunsisf
- __mips16_fix_truncsfsi
- __mips16_adddf3
- __mips16_subdf3
- __mips16_muldf3
- __mips16_divdf3
- __mips16_extendsfdf2
- __mips16_truncdfsf2
- __mips16_eqdf2
- __mips16_nedf2
- __mips16_gtdf2
- __mips16_gedf2
- __mips16_ledf2
- __mips16_ltdf2
- __mips16_floatsidf
- __mips16_floatunsidf
- __mips16_fix_truncdfsi
- __mips16_ret_sf
- __mips16_ret_sc
- __mips16_ret_df
- __mips16_ret_dc
- __mips16_call_stub_1
- __mips16_call_stub_5
- __mips16_call_stub_2
- __mips16_call_stub_6
- __mips16_call_stub_9
- __mips16_call_stub_10
- __mips16_call_stub_sf_0
- __mips16_call_stub_sf_1
- __mips16_call_stub_sf_5
- __mips16_call_stub_sf_2
- __mips16_call_stub_sf_6
- __mips16_call_stub_sf_9
- __mips16_call_stub_sf_10
- __mips16_call_stub_sc_0
- __mips16_call_stub_sc_1
- __mips16_call_stub_sc_5
- __mips16_call_stub_sc_2
- __mips16_call_stub_sc_6
- __mips16_call_stub_sc_9
- __mips16_call_stub_sc_10
- __mips16_call_stub_df_0
- __mips16_call_stub_df_1
- __mips16_call_stub_df_5
- __mips16_call_stub_df_2
- __mips16_call_stub_df_6
- __mips16_call_stub_df_9
- __mips16_call_stub_df_10
- __mips16_call_stub_dc_0
- __mips16_call_stub_dc_1
- __mips16_call_stub_dc_5
- __mips16_call_stub_dc_2
- __mips16_call_stub_dc_6
- __mips16_call_stub_dc_9
- __mips16_call_stub_dc_10
-}
diff --git a/gcc/config/mips/mips16.S b/gcc/config/mips/mips16.S
deleted file mode 100644
index ec331b5f65e..00000000000
--- a/gcc/config/mips/mips16.S
+++ /dev/null
@@ -1,712 +0,0 @@
-/* mips16 floating point support code
- Copyright (C) 1996, 1997, 1998, 2008, 2009, 2010
- Free Software Foundation, Inc.
- Contributed by Cygnus Support
-
-This file is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3, or (at your option) any
-later version.
-
-This file 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/>. */
-
-/* This file contains mips16 floating point support functions. These
- functions are called by mips16 code to handle floating point when
- -msoft-float is not used. They accept the arguments and return
- values using the soft-float calling convention, but do the actual
- operation using the hard floating point instructions. */
-
-#if defined _MIPS_SIM && (_MIPS_SIM == _ABIO32 || _MIPS_SIM == _ABIO64)
-
-/* This file contains 32-bit assembly code. */
- .set nomips16
-
-/* Start a function. */
-
-#define STARTFN(NAME) .globl NAME; .ent NAME; NAME:
-
-/* Finish a function. */
-
-#define ENDFN(NAME) .end NAME
-
-/* ARG1
- The FPR that holds the first floating-point argument.
-
- ARG2
- The FPR that holds the second floating-point argument.
-
- RET
- The FPR that holds a floating-point return value. */
-
-#define RET $f0
-#define ARG1 $f12
-#ifdef __mips64
-#define ARG2 $f13
-#else
-#define ARG2 $f14
-#endif
-
-/* Set 64-bit register GPR so that its high 32 bits contain HIGH_FPR
- and so that its low 32 bits contain LOW_FPR. */
-#define MERGE_GPRf(GPR, HIGH_FPR, LOW_FPR) \
- .set noat; \
- mfc1 $1, LOW_FPR; \
- mfc1 GPR, HIGH_FPR; \
- dsll $1, $1, 32; \
- dsll GPR, GPR, 32; \
- dsrl $1, $1, 32; \
- or GPR, GPR, $1; \
- .set at
-
-/* Move the high 32 bits of GPR to HIGH_FPR and the low 32 bits of
- GPR to LOW_FPR. */
-#define MERGE_GPRt(GPR, HIGH_FPR, LOW_FPR) \
- .set noat; \
- dsrl $1, GPR, 32; \
- mtc1 GPR, LOW_FPR; \
- mtc1 $1, HIGH_FPR; \
- .set at
-
-/* Jump to T, and use "OPCODE, OP2" to implement a delayed move. */
-#define DELAYt(T, OPCODE, OP2) \
- .set noreorder; \
- jr T; \
- OPCODE, OP2; \
- .set reorder
-
-/* Use "OPCODE. OP2" and jump to T. */
-#define DELAYf(T, OPCODE, OP2) OPCODE, OP2; jr T
-
-/* MOVE_SF_BYTE0(D)
- Move the first single-precision floating-point argument between
- GPRs and FPRs.
-
- MOVE_SI_BYTE0(D)
- Likewise the first single-precision integer argument.
-
- MOVE_SF_BYTE4(D)
- Move the second single-precision floating-point argument between
- GPRs and FPRs, given that the first argument occupies 4 bytes.
-
- MOVE_SF_BYTE8(D)
- Move the second single-precision floating-point argument between
- GPRs and FPRs, given that the first argument occupies 8 bytes.
-
- MOVE_DF_BYTE0(D)
- Move the first double-precision floating-point argument between
- GPRs and FPRs.
-
- MOVE_DF_BYTE8(D)
- Likewise the second double-precision floating-point argument.
-
- MOVE_SF_RET(D, T)
- Likewise a single-precision floating-point return value,
- then jump to T.
-
- MOVE_SC_RET(D, T)
- Likewise a complex single-precision floating-point return value.
-
- MOVE_DF_RET(D, T)
- Likewise a double-precision floating-point return value.
-
- MOVE_DC_RET(D, T)
- Likewise a complex double-precision floating-point return value.
-
- MOVE_SI_RET(D, T)
- Likewise a single-precision integer return value.
-
- The D argument is "t" to move to FPRs and "f" to move from FPRs.
- The return macros may assume that the target of the jump does not
- use a floating-point register. */
-
-#define MOVE_SF_RET(D, T) DELAY##D (T, m##D##c1 $2,$f0)
-#define MOVE_SI_RET(D, T) DELAY##D (T, m##D##c1 $2,$f0)
-
-#if defined(__mips64) && defined(__MIPSEB__)
-#define MOVE_SC_RET(D, T) MERGE_GPR##D ($2, $f0, $f1); jr T
-#elif defined(__mips64)
-/* The high 32 bits of $2 correspond to the second word in memory;
- i.e. the imaginary part. */
-#define MOVE_SC_RET(D, T) MERGE_GPR##D ($2, $f1, $f0); jr T
-#elif __mips_fpr == 64
-#define MOVE_SC_RET(D, T) m##D##c1 $2,$f0; DELAY##D (T, m##D##c1 $3,$f1)
-#else
-#define MOVE_SC_RET(D, T) m##D##c1 $2,$f0; DELAY##D (T, m##D##c1 $3,$f2)
-#endif
-
-#if defined(__mips64)
-#define MOVE_SF_BYTE0(D) m##D##c1 $4,$f12
-#define MOVE_SF_BYTE4(D) m##D##c1 $5,$f13
-#define MOVE_SF_BYTE8(D) m##D##c1 $5,$f13
-#else
-#define MOVE_SF_BYTE0(D) m##D##c1 $4,$f12
-#define MOVE_SF_BYTE4(D) m##D##c1 $5,$f14
-#define MOVE_SF_BYTE8(D) m##D##c1 $6,$f14
-#endif
-#define MOVE_SI_BYTE0(D) MOVE_SF_BYTE0(D)
-
-#if defined(__mips64)
-#define MOVE_DF_BYTE0(D) dm##D##c1 $4,$f12
-#define MOVE_DF_BYTE8(D) dm##D##c1 $5,$f13
-#define MOVE_DF_RET(D, T) DELAY##D (T, dm##D##c1 $2,$f0)
-#define MOVE_DC_RET(D, T) dm##D##c1 $3,$f1; MOVE_DF_RET (D, T)
-#elif __mips_fpr == 64 && defined(__MIPSEB__)
-#define MOVE_DF_BYTE0(D) m##D##c1 $5,$f12; m##D##hc1 $4,$f12
-#define MOVE_DF_BYTE8(D) m##D##c1 $7,$f14; m##D##hc1 $6,$f14
-#define MOVE_DF_RET(D, T) m##D##c1 $3,$f0; DELAY##D (T, m##D##hc1 $2,$f0)
-#define MOVE_DC_RET(D, T) m##D##c1 $5,$f1; m##D##hc1 $4,$f1; MOVE_DF_RET (D, T)
-#elif __mips_fpr == 64
-#define MOVE_DF_BYTE0(D) m##D##c1 $4,$f12; m##D##hc1 $5,$f12
-#define MOVE_DF_BYTE8(D) m##D##c1 $6,$f14; m##D##hc1 $7,$f14
-#define MOVE_DF_RET(D, T) m##D##c1 $2,$f0; DELAY##D (T, m##D##hc1 $3,$f0)
-#define MOVE_DC_RET(D, T) m##D##c1 $4,$f1; m##D##hc1 $5,$f1; MOVE_DF_RET (D, T)
-#elif defined(__MIPSEB__)
-/* FPRs are little-endian. */
-#define MOVE_DF_BYTE0(D) m##D##c1 $4,$f13; m##D##c1 $5,$f12
-#define MOVE_DF_BYTE8(D) m##D##c1 $6,$f15; m##D##c1 $7,$f14
-#define MOVE_DF_RET(D, T) m##D##c1 $2,$f1; DELAY##D (T, m##D##c1 $3,$f0)
-#define MOVE_DC_RET(D, T) m##D##c1 $4,$f3; m##D##c1 $5,$f2; MOVE_DF_RET (D, T)
-#else
-#define MOVE_DF_BYTE0(D) m##D##c1 $4,$f12; m##D##c1 $5,$f13
-#define MOVE_DF_BYTE8(D) m##D##c1 $6,$f14; m##D##c1 $7,$f15
-#define MOVE_DF_RET(D, T) m##D##c1 $2,$f0; DELAY##D (T, m##D##c1 $3,$f1)
-#define MOVE_DC_RET(D, T) m##D##c1 $4,$f2; m##D##c1 $5,$f3; MOVE_DF_RET (D, T)
-#endif
-
-/* Single-precision math. */
-
-/* Define a function NAME that loads two single-precision values,
- performs FPU operation OPCODE on them, and returns the single-
- precision result. */
-
-#define OPSF3(NAME, OPCODE) \
-STARTFN (NAME); \
- MOVE_SF_BYTE0 (t); \
- MOVE_SF_BYTE4 (t); \
- OPCODE RET,ARG1,ARG2; \
- MOVE_SF_RET (f, $31); \
- ENDFN (NAME)
-
-#ifdef L_m16addsf3
-OPSF3 (__mips16_addsf3, add.s)
-#endif
-#ifdef L_m16subsf3
-OPSF3 (__mips16_subsf3, sub.s)
-#endif
-#ifdef L_m16mulsf3
-OPSF3 (__mips16_mulsf3, mul.s)
-#endif
-#ifdef L_m16divsf3
-OPSF3 (__mips16_divsf3, div.s)
-#endif
-
-/* Define a function NAME that loads a single-precision value,
- performs FPU operation OPCODE on it, and returns the single-
- precision result. */
-
-#define OPSF2(NAME, OPCODE) \
-STARTFN (NAME); \
- MOVE_SF_BYTE0 (t); \
- OPCODE RET,ARG1; \
- MOVE_SF_RET (f, $31); \
- ENDFN (NAME)
-
-#ifdef L_m16negsf2
-OPSF2 (__mips16_negsf2, neg.s)
-#endif
-#ifdef L_m16abssf2
-OPSF2 (__mips16_abssf2, abs.s)
-#endif
-
-/* Single-precision comparisons. */
-
-/* Define a function NAME that loads two single-precision values,
- performs floating point comparison OPCODE, and returns TRUE or
- FALSE depending on the result. */
-
-#define CMPSF(NAME, OPCODE, TRUE, FALSE) \
-STARTFN (NAME); \
- MOVE_SF_BYTE0 (t); \
- MOVE_SF_BYTE4 (t); \
- OPCODE ARG1,ARG2; \
- li $2,TRUE; \
- bc1t 1f; \
- li $2,FALSE; \
-1:; \
- j $31; \
- ENDFN (NAME)
-
-/* Like CMPSF, but reverse the comparison operands. */
-
-#define REVCMPSF(NAME, OPCODE, TRUE, FALSE) \
-STARTFN (NAME); \
- MOVE_SF_BYTE0 (t); \
- MOVE_SF_BYTE4 (t); \
- OPCODE ARG2,ARG1; \
- li $2,TRUE; \
- bc1t 1f; \
- li $2,FALSE; \
-1:; \
- j $31; \
- ENDFN (NAME)
-
-#ifdef L_m16eqsf2
-CMPSF (__mips16_eqsf2, c.eq.s, 0, 1)
-#endif
-#ifdef L_m16nesf2
-CMPSF (__mips16_nesf2, c.eq.s, 0, 1)
-#endif
-#ifdef L_m16gtsf2
-REVCMPSF (__mips16_gtsf2, c.lt.s, 1, 0)
-#endif
-#ifdef L_m16gesf2
-REVCMPSF (__mips16_gesf2, c.le.s, 0, -1)
-#endif
-#ifdef L_m16lesf2
-CMPSF (__mips16_lesf2, c.le.s, 0, 1)
-#endif
-#ifdef L_m16ltsf2
-CMPSF (__mips16_ltsf2, c.lt.s, -1, 0)
-#endif
-#ifdef L_m16unordsf2
-CMPSF(__mips16_unordsf2, c.un.s, 1, 0)
-#endif
-
-
-/* Single-precision conversions. */
-
-#ifdef L_m16fltsisf
-STARTFN (__mips16_floatsisf)
- MOVE_SF_BYTE0 (t)
- cvt.s.w RET,ARG1
- MOVE_SF_RET (f, $31)
- ENDFN (__mips16_floatsisf)
-#endif
-
-#ifdef L_m16fltunsisf
-STARTFN (__mips16_floatunsisf)
- .set noreorder
- bltz $4,1f
- MOVE_SF_BYTE0 (t)
- .set reorder
- cvt.s.w RET,ARG1
- MOVE_SF_RET (f, $31)
-1:
- and $2,$4,1
- srl $3,$4,1
- or $2,$2,$3
- mtc1 $2,RET
- cvt.s.w RET,RET
- add.s RET,RET,RET
- MOVE_SF_RET (f, $31)
- ENDFN (__mips16_floatunsisf)
-#endif
-
-#ifdef L_m16fix_truncsfsi
-STARTFN (__mips16_fix_truncsfsi)
- MOVE_SF_BYTE0 (t)
- trunc.w.s RET,ARG1,$4
- MOVE_SI_RET (f, $31)
- ENDFN (__mips16_fix_truncsfsi)
-#endif
-
-#if !defined(__mips_single_float) && !defined(__SINGLE_FLOAT)
-
-/* Double-precision math. */
-
-/* Define a function NAME that loads two double-precision values,
- performs FPU operation OPCODE on them, and returns the double-
- precision result. */
-
-#define OPDF3(NAME, OPCODE) \
-STARTFN (NAME); \
- MOVE_DF_BYTE0 (t); \
- MOVE_DF_BYTE8 (t); \
- OPCODE RET,ARG1,ARG2; \
- MOVE_DF_RET (f, $31); \
- ENDFN (NAME)
-
-#ifdef L_m16adddf3
-OPDF3 (__mips16_adddf3, add.d)
-#endif
-#ifdef L_m16subdf3
-OPDF3 (__mips16_subdf3, sub.d)
-#endif
-#ifdef L_m16muldf3
-OPDF3 (__mips16_muldf3, mul.d)
-#endif
-#ifdef L_m16divdf3
-OPDF3 (__mips16_divdf3, div.d)
-#endif
-
-/* Define a function NAME that loads a double-precision value,
- performs FPU operation OPCODE on it, and returns the double-
- precision result. */
-
-#define OPDF2(NAME, OPCODE) \
-STARTFN (NAME); \
- MOVE_DF_BYTE0 (t); \
- OPCODE RET,ARG1; \
- MOVE_DF_RET (f, $31); \
- ENDFN (NAME)
-
-#ifdef L_m16negdf2
-OPDF2 (__mips16_negdf2, neg.d)
-#endif
-#ifdef L_m16absdf2
-OPDF2 (__mips16_absdf2, abs.d)
-#endif
-
-/* Conversions between single and double precision. */
-
-#ifdef L_m16extsfdf2
-STARTFN (__mips16_extendsfdf2)
- MOVE_SF_BYTE0 (t)
- cvt.d.s RET,ARG1
- MOVE_DF_RET (f, $31)
- ENDFN (__mips16_extendsfdf2)
-#endif
-
-#ifdef L_m16trdfsf2
-STARTFN (__mips16_truncdfsf2)
- MOVE_DF_BYTE0 (t)
- cvt.s.d RET,ARG1
- MOVE_SF_RET (f, $31)
- ENDFN (__mips16_truncdfsf2)
-#endif
-
-/* Double-precision comparisons. */
-
-/* Define a function NAME that loads two double-precision values,
- performs floating point comparison OPCODE, and returns TRUE or
- FALSE depending on the result. */
-
-#define CMPDF(NAME, OPCODE, TRUE, FALSE) \
-STARTFN (NAME); \
- MOVE_DF_BYTE0 (t); \
- MOVE_DF_BYTE8 (t); \
- OPCODE ARG1,ARG2; \
- li $2,TRUE; \
- bc1t 1f; \
- li $2,FALSE; \
-1:; \
- j $31; \
- ENDFN (NAME)
-
-/* Like CMPDF, but reverse the comparison operands. */
-
-#define REVCMPDF(NAME, OPCODE, TRUE, FALSE) \
-STARTFN (NAME); \
- MOVE_DF_BYTE0 (t); \
- MOVE_DF_BYTE8 (t); \
- OPCODE ARG2,ARG1; \
- li $2,TRUE; \
- bc1t 1f; \
- li $2,FALSE; \
-1:; \
- j $31; \
- ENDFN (NAME)
-
-#ifdef L_m16eqdf2
-CMPDF (__mips16_eqdf2, c.eq.d, 0, 1)
-#endif
-#ifdef L_m16nedf2
-CMPDF (__mips16_nedf2, c.eq.d, 0, 1)
-#endif
-#ifdef L_m16gtdf2
-REVCMPDF (__mips16_gtdf2, c.lt.d, 1, 0)
-#endif
-#ifdef L_m16gedf2
-REVCMPDF (__mips16_gedf2, c.le.d, 0, -1)
-#endif
-#ifdef L_m16ledf2
-CMPDF (__mips16_ledf2, c.le.d, 0, 1)
-#endif
-#ifdef L_m16ltdf2
-CMPDF (__mips16_ltdf2, c.lt.d, -1, 0)
-#endif
-#ifdef L_m16unorddf2
-CMPDF(__mips16_unorddf2, c.un.d, 1, 0)
-#endif
-
-/* Double-precision conversions. */
-
-#ifdef L_m16fltsidf
-STARTFN (__mips16_floatsidf)
- MOVE_SI_BYTE0 (t)
- cvt.d.w RET,ARG1
- MOVE_DF_RET (f, $31)
- ENDFN (__mips16_floatsidf)
-#endif
-
-#ifdef L_m16fltunsidf
-STARTFN (__mips16_floatunsidf)
- MOVE_SI_BYTE0 (t)
- cvt.d.w RET,ARG1
- bgez $4,1f
- li.d ARG1, 4.294967296e+9
- add.d RET, RET, ARG1
-1: MOVE_DF_RET (f, $31)
- ENDFN (__mips16_floatunsidf)
-#endif
-
-#ifdef L_m16fix_truncdfsi
-STARTFN (__mips16_fix_truncdfsi)
- MOVE_DF_BYTE0 (t)
- trunc.w.d RET,ARG1,$4
- MOVE_SI_RET (f, $31)
- ENDFN (__mips16_fix_truncdfsi)
-#endif
-#endif /* !__mips_single_float */
-
-/* Define a function NAME that moves a return value of mode MODE from
- FPRs to GPRs. */
-
-#define RET_FUNCTION(NAME, MODE) \
-STARTFN (NAME); \
- MOVE_##MODE##_RET (t, $31); \
- ENDFN (NAME)
-
-#ifdef L_m16retsf
-RET_FUNCTION (__mips16_ret_sf, SF)
-#endif
-
-#ifdef L_m16retsc
-RET_FUNCTION (__mips16_ret_sc, SC)
-#endif
-
-#if !defined(__mips_single_float) && !defined(__SINGLE_FLOAT)
-#ifdef L_m16retdf
-RET_FUNCTION (__mips16_ret_df, DF)
-#endif
-
-#ifdef L_m16retdc
-RET_FUNCTION (__mips16_ret_dc, DC)
-#endif
-#endif /* !__mips_single_float */
-
-/* STUB_ARGS_X copies the arguments from GPRs to FPRs for argument
- code X. X is calculated as ARG1 + ARG2 * 4, where ARG1 and ARG2
- classify the first and second arguments as follows:
-
- 1: a single-precision argument
- 2: a double-precision argument
- 0: no argument, or not one of the above. */
-
-#define STUB_ARGS_0 /* () */
-#define STUB_ARGS_1 MOVE_SF_BYTE0 (t) /* (sf) */
-#define STUB_ARGS_5 MOVE_SF_BYTE0 (t); MOVE_SF_BYTE4 (t) /* (sf, sf) */
-#define STUB_ARGS_9 MOVE_SF_BYTE0 (t); MOVE_DF_BYTE8 (t) /* (sf, df) */
-#define STUB_ARGS_2 MOVE_DF_BYTE0 (t) /* (df) */
-#define STUB_ARGS_6 MOVE_DF_BYTE0 (t); MOVE_SF_BYTE8 (t) /* (df, sf) */
-#define STUB_ARGS_10 MOVE_DF_BYTE0 (t); MOVE_DF_BYTE8 (t) /* (df, df) */
-
-/* These functions are used by 16-bit code when calling via a function
- pointer. They must copy the floating point arguments from the GPRs
- to FPRs and then call function $2. */
-
-#define CALL_STUB_NO_RET(NAME, CODE) \
-STARTFN (NAME); \
- STUB_ARGS_##CODE; \
- .set noreorder; \
- jr $2; \
- move $25,$2; \
- .set reorder; \
- ENDFN (NAME)
-
-#ifdef L_m16stub1
-CALL_STUB_NO_RET (__mips16_call_stub_1, 1)
-#endif
-
-#ifdef L_m16stub5
-CALL_STUB_NO_RET (__mips16_call_stub_5, 5)
-#endif
-
-#if !defined(__mips_single_float) && !defined(__SINGLE_FLOAT)
-
-#ifdef L_m16stub2
-CALL_STUB_NO_RET (__mips16_call_stub_2, 2)
-#endif
-
-#ifdef L_m16stub6
-CALL_STUB_NO_RET (__mips16_call_stub_6, 6)
-#endif
-
-#ifdef L_m16stub9
-CALL_STUB_NO_RET (__mips16_call_stub_9, 9)
-#endif
-
-#ifdef L_m16stub10
-CALL_STUB_NO_RET (__mips16_call_stub_10, 10)
-#endif
-#endif /* !__mips_single_float */
-
-/* Now we have the same set of functions, except that this time the
- function being called returns an SFmode, SCmode, DFmode or DCmode
- value; we need to instantiate a set for each case. The calling
- function will arrange to preserve $18, so these functions are free
- to use it to hold the return address.
-
- Note that we do not know whether the function we are calling is 16
- bit or 32 bit. However, it does not matter, because 16-bit
- functions always return floating point values in both the gp and
- the fp regs. It would be possible to check whether the function
- being called is 16 bits, in which case the copy is unnecessary;
- however, it's faster to always do the copy. */
-
-#define CALL_STUB_RET(NAME, CODE, MODE) \
-STARTFN (NAME); \
- move $18,$31; \
- STUB_ARGS_##CODE; \
- .set noreorder; \
- jalr $2; \
- move $25,$2; \
- .set reorder; \
- MOVE_##MODE##_RET (f, $18); \
- ENDFN (NAME)
-
-/* First, instantiate the single-float set. */
-
-#ifdef L_m16stubsf0
-CALL_STUB_RET (__mips16_call_stub_sf_0, 0, SF)
-#endif
-
-#ifdef L_m16stubsf1
-CALL_STUB_RET (__mips16_call_stub_sf_1, 1, SF)
-#endif
-
-#ifdef L_m16stubsf5
-CALL_STUB_RET (__mips16_call_stub_sf_5, 5, SF)
-#endif
-
-#if !defined(__mips_single_float) && !defined(__SINGLE_FLOAT)
-#ifdef L_m16stubsf2
-CALL_STUB_RET (__mips16_call_stub_sf_2, 2, SF)
-#endif
-
-#ifdef L_m16stubsf6
-CALL_STUB_RET (__mips16_call_stub_sf_6, 6, SF)
-#endif
-
-#ifdef L_m16stubsf9
-CALL_STUB_RET (__mips16_call_stub_sf_9, 9, SF)
-#endif
-
-#ifdef L_m16stubsf10
-CALL_STUB_RET (__mips16_call_stub_sf_10, 10, SF)
-#endif
-#endif /* !__mips_single_float */
-
-
-/* Now we have the same set of functions again, except that this time
- the function being called returns an DFmode value. */
-
-#if !defined(__mips_single_float) && !defined(__SINGLE_FLOAT)
-#ifdef L_m16stubdf0
-CALL_STUB_RET (__mips16_call_stub_df_0, 0, DF)
-#endif
-
-#ifdef L_m16stubdf1
-CALL_STUB_RET (__mips16_call_stub_df_1, 1, DF)
-#endif
-
-#ifdef L_m16stubdf5
-CALL_STUB_RET (__mips16_call_stub_df_5, 5, DF)
-#endif
-
-#ifdef L_m16stubdf2
-CALL_STUB_RET (__mips16_call_stub_df_2, 2, DF)
-#endif
-
-#ifdef L_m16stubdf6
-CALL_STUB_RET (__mips16_call_stub_df_6, 6, DF)
-#endif
-
-#ifdef L_m16stubdf9
-CALL_STUB_RET (__mips16_call_stub_df_9, 9, DF)
-#endif
-
-#ifdef L_m16stubdf10
-CALL_STUB_RET (__mips16_call_stub_df_10, 10, DF)
-#endif
-#endif /* !__mips_single_float */
-
-
-/* Ho hum. Here we have the same set of functions again, this time
- for when the function being called returns an SCmode value. */
-
-#ifdef L_m16stubsc0
-CALL_STUB_RET (__mips16_call_stub_sc_0, 0, SC)
-#endif
-
-#ifdef L_m16stubsc1
-CALL_STUB_RET (__mips16_call_stub_sc_1, 1, SC)
-#endif
-
-#ifdef L_m16stubsc5
-CALL_STUB_RET (__mips16_call_stub_sc_5, 5, SC)
-#endif
-
-#if !defined(__mips_single_float) && !defined(__SINGLE_FLOAT)
-#ifdef L_m16stubsc2
-CALL_STUB_RET (__mips16_call_stub_sc_2, 2, SC)
-#endif
-
-#ifdef L_m16stubsc6
-CALL_STUB_RET (__mips16_call_stub_sc_6, 6, SC)
-#endif
-
-#ifdef L_m16stubsc9
-CALL_STUB_RET (__mips16_call_stub_sc_9, 9, SC)
-#endif
-
-#ifdef L_m16stubsc10
-CALL_STUB_RET (__mips16_call_stub_sc_10, 10, SC)
-#endif
-#endif /* !__mips_single_float */
-
-
-/* Finally, another set of functions for DCmode. */
-
-#if !defined(__mips_single_float) && !defined(__SINGLE_FLOAT)
-#ifdef L_m16stubdc0
-CALL_STUB_RET (__mips16_call_stub_dc_0, 0, DC)
-#endif
-
-#ifdef L_m16stubdc1
-CALL_STUB_RET (__mips16_call_stub_dc_1, 1, DC)
-#endif
-
-#ifdef L_m16stubdc5
-CALL_STUB_RET (__mips16_call_stub_dc_5, 5, DC)
-#endif
-
-#ifdef L_m16stubdc2
-CALL_STUB_RET (__mips16_call_stub_dc_2, 2, DC)
-#endif
-
-#ifdef L_m16stubdc6
-CALL_STUB_RET (__mips16_call_stub_dc_6, 6, DC)
-#endif
-
-#ifdef L_m16stubdc9
-CALL_STUB_RET (__mips16_call_stub_dc_9, 9, DC)
-#endif
-
-#ifdef L_m16stubdc10
-CALL_STUB_RET (__mips16_call_stub_dc_10, 10, DC)
-#endif
-#endif /* !__mips_single_float */
-#endif
diff --git a/gcc/config/mips/t-elf b/gcc/config/mips/t-elf
index 4ed36da659b..b4535d28fc4 100644
--- a/gcc/config/mips/t-elf
+++ b/gcc/config/mips/t-elf
@@ -1,5 +1,5 @@
# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2006,
-# 2007 Free Software Foundation, Inc.
+# 2007, 2011 Free Software Foundation, Inc.
#
# This file is part of GCC.
#
@@ -17,28 +17,8 @@
# along with GCC; see the file COPYING3. If not see
# <http://www.gnu.org/licenses/>.
-# Don't let CTOR_LIST end up in sdata section.
-CRTSTUFF_T_CFLAGS = -G 0
-
-# Assemble startup files.
-$(T)crti.o: $(srcdir)/config/mips/crti.asm $(GCC_PASSES)
- $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(MULTILIB_CFLAGS) $(INCLUDES) \
- -c -o $(T)crti.o -x assembler-with-cpp $(srcdir)/config/mips/crti.asm
-
-$(T)crtn.o: $(srcdir)/config/mips/crtn.asm $(GCC_PASSES)
- $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(MULTILIB_CFLAGS) $(INCLUDES) \
- -c -o $(T)crtn.o -x assembler-with-cpp $(srcdir)/config/mips/crtn.asm
-
-# We must build libgcc2.a with -G 0, in case the user wants to link
-# without the $gp register.
-TARGET_LIBGCC2_CFLAGS = -G 0
-
# Build the libraries for both hard and soft floating point
MULTILIB_OPTIONS = msoft-float EL/EB
MULTILIB_DIRNAMES = soft-float el eb
MULTILIB_MATCHES = EL=mel EB=meb msingle-float=m4650
-EXTRA_MULTILIB_PARTS = crtbegin.o crtend.o crti.o crtn.o
-
-LIBGCC = stmp-multilib
-INSTALL_LIBGCC = install-multilib
diff --git a/gcc/config/mips/t-isa3264 b/gcc/config/mips/t-isa3264
index f6dce325562..7291193f8a6 100644
--- a/gcc/config/mips/t-isa3264
+++ b/gcc/config/mips/t-isa3264
@@ -1,5 +1,5 @@
# Copyright (C) 2001, 2002, 2003, 2004, 2007,
-# 2008 Free Software Foundation, Inc.
+# 2008, 2011 Free Software Foundation, Inc.
#
# This file is part of GCC.
#
@@ -17,22 +17,6 @@
# along with GCC; see the file COPYING3. If not see
# <http://www.gnu.org/licenses/>.
-# Don't let CTOR_LIST end up in sdata section.
-CRTSTUFF_T_CFLAGS = -G 0
-
-# Assemble startup files.
-$(T)crti.o: $(srcdir)/config/mips/crti.asm $(GCC_PASSES)
- $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(MULTILIB_CFLAGS) $(INCLUDES) \
- -c -o $(T)crti.o -x assembler-with-cpp $(srcdir)/config/mips/crti.asm
-
-$(T)crtn.o: $(srcdir)/config/mips/crtn.asm $(GCC_PASSES)
- $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(MULTILIB_CFLAGS) $(INCLUDES) \
- -c -o $(T)crtn.o -x assembler-with-cpp $(srcdir)/config/mips/crtn.asm
-
-# We must build libgcc2.a with -G 0, in case the user wants to link
-# without the $gp register.
-TARGET_LIBGCC2_CFLAGS = -G 0
-
# Build the libraries for both hard and soft floating point
ifneq ($(filter MIPS_ABI_DEFAULT=ABI_EABI,$(tm_defines)),)
@@ -48,7 +32,3 @@ MULTILIB_EXCLUSIONS = !mips32r2/mfp64
endif
endif
MULTILIB_MATCHES = EL=mel EB=meb
-EXTRA_MULTILIB_PARTS = crtbegin.o crtend.o crti.o crtn.o
-
-LIBGCC = stmp-multilib
-INSTALL_LIBGCC = install-multilib
diff --git a/gcc/config/mips/t-libgcc-mips16 b/gcc/config/mips/t-libgcc-mips16
deleted file mode 100644
index 772b05ac45e..00000000000
--- a/gcc/config/mips/t-libgcc-mips16
+++ /dev/null
@@ -1,42 +0,0 @@
-# Copyright (C) 2007, 2008, 2011 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/>.
-
-LIB1ASMSRC = mips/mips16.S
-LIB1ASMFUNCS = _m16addsf3 _m16subsf3 _m16mulsf3 _m16divsf3 \
- _m16eqsf2 _m16nesf2 _m16gtsf2 _m16gesf2 _m16lesf2 _m16ltsf2 \
- _m16unordsf2 \
- _m16fltsisf _m16fix_truncsfsi _m16fltunsisf \
- _m16adddf3 _m16subdf3 _m16muldf3 _m16divdf3 \
- _m16extsfdf2 _m16trdfsf2 \
- _m16eqdf2 _m16nedf2 _m16gtdf2 _m16gedf2 _m16ledf2 _m16ltdf2 \
- _m16unorddf2 \
- _m16fltsidf _m16fix_truncdfsi _m16fltunsidf \
- _m16retsf _m16retdf \
- _m16retsc _m16retdc \
- _m16stub1 _m16stub2 _m16stub5 _m16stub6 _m16stub9 _m16stub10 \
- _m16stubsf0 _m16stubsf1 _m16stubsf2 _m16stubsf5 _m16stubsf6 \
- _m16stubsf9 _m16stubsf10 \
- _m16stubdf0 _m16stubdf1 _m16stubdf2 _m16stubdf5 _m16stubdf6 \
- _m16stubdf9 _m16stubdf10 \
- _m16stubsc0 _m16stubsc1 _m16stubsc2 _m16stubsc5 _m16stubsc6 \
- _m16stubsc9 _m16stubsc10 \
- _m16stubdc0 _m16stubdc1 _m16stubdc2 _m16stubdc5 _m16stubdc6 \
- _m16stubdc9 _m16stubdc10
-
-# Version these symbols if building libgcc.so.
-SHLIB_MAPFILES += $(srcdir)/config/mips/libgcc-mips16.ver
diff --git a/gcc/config/mips/t-linux64 b/gcc/config/mips/t-linux64
index 0e695172f55..5197e5ee209 100644
--- a/gcc/config/mips/t-linux64
+++ b/gcc/config/mips/t-linux64
@@ -19,5 +19,3 @@
MULTILIB_OPTIONS = mabi=n32/mabi=32/mabi=64
MULTILIB_DIRNAMES = n32 32 64
MULTILIB_OSDIRNAMES = ../lib32 ../lib ../lib64
-
-EXTRA_MULTILIB_PARTS=crtbegin.o crtend.o crtbeginS.o crtendS.o crtbeginT.o
diff --git a/gcc/config/mips/t-mips b/gcc/config/mips/t-mips
index 53993e9d3c0..46c5ebcb1e4 100644
--- a/gcc/config/mips/t-mips
+++ b/gcc/config/mips/t-mips
@@ -16,8 +16,6 @@
# along with GCC; see the file COPYING3. If not see
# <http://www.gnu.org/licenses/>.
-LIB2_SIDITI_CONV_FUNCS=yes
-
$(srcdir)/config/mips/mips-tables.opt: $(srcdir)/config/mips/genopt.sh \
$(srcdir)/config/mips/mips-cpus.def
$(SHELL) $(srcdir)/config/mips/genopt.sh $(srcdir)/config/mips > \
diff --git a/gcc/config/mips/t-r3900 b/gcc/config/mips/t-r3900
index 2c4216399c5..d542df36ed6 100644
--- a/gcc/config/mips/t-r3900
+++ b/gcc/config/mips/t-r3900
@@ -1,5 +1,5 @@
# Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004,
-# 2007 Free Software Foundation, Inc.
+# 2007, 2011 Free Software Foundation, Inc.
#
# This file is part of GCC.
#
@@ -17,19 +17,8 @@
# along with GCC; see the file COPYING3. If not see
# <http://www.gnu.org/licenses/>.
-# We must build libgcc2.a with -G 0, in case the user wants to link
-# without the $gp register.
-TARGET_LIBGCC2_CFLAGS = -G 0
-
-EXTRA_MULTILIB_PARTS = crtbegin.o crtend.o
-# Don't let CTOR_LIST end up in sdata section.
-CRTSTUFF_T_CFLAGS = -G 0
-
# Build the libraries for both hard and soft floating point
MULTILIB_OPTIONS = msoft-float EL/EB
MULTILIB_DIRNAMES = soft-float el eb
MULTILIB_MATCHES = EL=mel EB=meb
-
-LIBGCC = stmp-multilib
-INSTALL_LIBGCC = install-multilib
diff --git a/gcc/config/mips/t-sde b/gcc/config/mips/t-sde
index 0fa2277d573..d9c229ab4e0 100644
--- a/gcc/config/mips/t-sde
+++ b/gcc/config/mips/t-sde
@@ -1,4 +1,4 @@
-# Copyright (C) 2007, 2008 Free Software Foundation, Inc.
+# Copyright (C) 2007, 2008, 2011 Free Software Foundation, Inc.
#
# This file is part of GCC.
#
@@ -16,18 +16,6 @@
# along with GCC; see the file COPYING3. If not see
# <http://www.gnu.org/licenses/>.
-# Don't let CTOR_LIST end up in sdata section.
-CRTSTUFF_T_CFLAGS = -G 0
-
-# Assemble startup files.
-$(T)crti.o: $(srcdir)/config/mips/crti.asm $(GCC_PASSES)
- $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(MULTILIB_CFLAGS) $(INCLUDES) \
- -c -o $(T)crti.o -x assembler-with-cpp $(srcdir)/config/mips/crti.asm
-
-$(T)crtn.o: $(srcdir)/config/mips/crtn.asm $(GCC_PASSES)
- $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(MULTILIB_CFLAGS) $(INCLUDES) \
- -c -o $(T)crtn.o -x assembler-with-cpp $(srcdir)/config/mips/crtn.asm
-
MULTILIB_OPTIONS = EL/EB mips32/mips32r2/mips64/mips64r2 mips16 msoft-float/mfp64 mcode-readable=no
MULTILIB_DIRNAMES = el eb mips32 mips32r2 mips64 mips64r2 mips16 sof f64 spram
MULTILIB_MATCHES = EL=mel EB=meb
@@ -45,9 +33,3 @@ MULTILIB_EXCLUSIONS += !mips32/!mips32r2/mips16
else
MULTILIB_EXCLUSIONS += mips64/mips16 mips64r2/mips16
endif
-
-EXTRA_MULTILIB_PARTS = crtbegin.o crtend.o crti.o crtn.o
-
-# Build the multilibs.
-LIBGCC = stmp-multilib
-INSTALL_LIBGCC = install-multilib
diff --git a/gcc/config/mips/t-sr71k b/gcc/config/mips/t-sr71k
index 44b69402e62..309eec6a650 100644
--- a/gcc/config/mips/t-sr71k
+++ b/gcc/config/mips/t-sr71k
@@ -16,32 +16,6 @@
# along with GCC; see the file COPYING3. If not see
# <http://www.gnu.org/licenses/>.
-# Suppress building libgcc1.a, since the MIPS compiler port is complete
-# and does not need anything from libgcc1.a.
-LIBGCC1 =
-CROSS_LIBGCC1 =
-
-EXTRA_MULTILIB_PARTS = crtbegin.o crtend.o crti.o crtn.o
-# Don't let CTOR_LIST end up in sdata section.
-CRTSTUFF_T_CFLAGS = -G 0
-
-# Assemble startup files.
-$(T)crti.o: $(srcdir)/config/mips/crti.asm $(GCC_PASSES)
- $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(MULTILIB_CFLAGS) $(INCLUDES) \
- -c -o $(T)crti.o -x assembler-with-cpp $(srcdir)/config/mips/crti.asm
-
-$(T)crtn.o: $(srcdir)/config/mips/crtn.asm $(GCC_PASSES)
- $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(MULTILIB_CFLAGS) $(INCLUDES) \
- -c -o $(T)crtn.o -x assembler-with-cpp $(srcdir)/config/mips/crtn.asm
-
-# We must build libgcc2.a with -G 0, in case the user wants to link
-# without the $gp register.
-TARGET_LIBGCC2_CFLAGS = -G 0
-
# Build the libraries for both hard and soft floating point
-
MULTILIB_OPTIONS = EL/EB msoft-float mips2
MULTILIB_DIRNAMES = el eb soft-float mips2
-
-LIBGCC = stmp-multilib
-INSTALL_LIBGCC = install-multilib
diff --git a/gcc/config/mips/t-st b/gcc/config/mips/t-st
index 83115f6fdd5..b0a8933c32b 100644
--- a/gcc/config/mips/t-st
+++ b/gcc/config/mips/t-st
@@ -1,4 +1,4 @@
-# Copyright (C) 2008 Free Software Foundation, Inc.
+# Copyright (C) 2008, 2011 Free Software Foundation, Inc.
#
# This file is part of GCC.
#
@@ -28,5 +28,3 @@ MULTILIB_OSDIRNAMES += march.loongson2f/mabi.64=../lib64/2f
MULTILIB_OSDIRNAMES += mabi.n32=../lib32
MULTILIB_OSDIRNAMES += mabi.32=../lib
MULTILIB_OSDIRNAMES += mabi.64=../lib64
-
-EXTRA_MULTILIB_PARTS=crtbegin.o crtend.o crtbeginS.o crtendS.o crtbeginT.o
diff --git a/gcc/config/mips/t-vr b/gcc/config/mips/t-vr
index 81efef9b865..de5ca706faf 100644
--- a/gcc/config/mips/t-vr
+++ b/gcc/config/mips/t-vr
@@ -1,4 +1,4 @@
-# Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
+# Copyright (C) 2002, 2004, 2005, 2011 Free Software Foundation, Inc.
#
# This file is part of GCC.
#
@@ -16,30 +16,6 @@
# along with GCC; see the file COPYING3. If not see
# <http://www.gnu.org/licenses/>.
-# BEGIN boiler-plate MIPS stuff
-
-# Don't let CTOR_LIST end up in sdata section.
-CRTSTUFF_T_CFLAGS = -G 0
-
-# We must build libgcc2.a with -G 0, in case the user wants to link
-# without the $gp register.
-TARGET_LIBGCC2_CFLAGS = -G 0
-
-LIB2FUNCS_STATIC_EXTRA = $(srcdir)/config/mips/mips16.S \
- $(srcdir)/config/mips/vr4120-div.S
-EXTRA_MULTILIB_PARTS = crtbegin.o crtend.o crti.o crtn.o
-
-# Assemble startup files.
-$(T)crti.o: $(srcdir)/config/mips/crti.asm $(GCC_PASSES)
- $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(MULTILIB_CFLAGS) $(INCLUDES) \
- -c -o $(T)crti.o -x assembler-with-cpp $(srcdir)/config/mips/crti.asm
-
-$(T)crtn.o: $(srcdir)/config/mips/crtn.asm $(GCC_PASSES)
- $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(MULTILIB_CFLAGS) $(INCLUDES) \
- -c -o $(T)crtn.o -x assembler-with-cpp $(srcdir)/config/mips/crtn.asm
-
-# END boiler-plate
-
# Main multilibs
# --------------
#
diff --git a/gcc/config/mips/vr4120-div.S b/gcc/config/mips/vr4120-div.S
deleted file mode 100644
index 79ede3de955..00000000000
--- a/gcc/config/mips/vr4120-div.S
+++ /dev/null
@@ -1,74 +0,0 @@
-/* Support file for -mfix-vr4120.
- Copyright (C) 2002, 2004, 2007 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 file contains functions which implement divsi3 and modsi3 for
- -mfix-vr4120. div and ddiv do not give the correct result when one
- of the operands is negative. */
-
- .set nomips16
-
-#define DIV \
- xor $3,$4,$5 /* t = x ^ y */ ; \
- li $2,0x80000000; \
- .set noreorder; \
- bgez $4,1f /* x >= 0 */; \
- and $3,$3,$2 /* t = (x ^ y) & 0x80000000 in delay slot */ ;\
- .set reorder; \
- subu $4,$0,$4 /* x = -x */ ; \
-1:; \
- .set noreorder; \
- bgez $5,2f /* y >= 0 */ ; \
- nop; \
- subu $5,$0,$5 /* y = -y */ ; \
- .set reorder; \
-2:; \
- divu $0,$4,$5; /* we use divu because of INT_MIN */ \
- .set noreorder; \
- bne $5,$0,3f; \
- nop; \
- break 7 /* division on zero y */ ; \
-3:; \
- .set reorder; \
- mflo $2 /* r = x / y */ ; \
- .set noreorder; \
- beq $3,$0,4f /* t == 0 */ ; \
- nop; \
- subu $2,$0,$2 /* r = -r */ ; \
- .set reorder; \
-4:
-
- .globl __vr4120_divsi3
- .ent __vr4120_divsi3
-__vr4120_divsi3:
- DIV
- j $31
- .end __vr4120_divsi3
-
- .globl __vr4120_modsi3
- .ent __vr4120_modsi3
-__vr4120_modsi3:
- move $6,$4 # x1 = x
- move $7,$5 # y1 = y
- DIV
- mult $2,$7 # r = r * y1
- mflo $2
- .set noreorder
- j $31
- subu $2,$6,$2 # r = x1 - r in delay slot
- .end __vr4120_modsi3
diff --git a/gcc/config/mmix/crti.asm b/gcc/config/mmix/crti.asm
deleted file mode 100644
index f5f4c5d68c4..00000000000
--- a/gcc/config/mmix/crti.asm
+++ /dev/null
@@ -1,116 +0,0 @@
-/* Copyright (C) 2001, 2002 Free Software Foundation, Inc.
- Contributed by Hans-Peter Nilsson <hp@bitrange.com>
-
-This file is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3, or (at your option) any
-later version.
-
-This file 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/>. */
-
-% This is the crt0 equivalent for mmix-knuth-mmixware, for setting up
-% things for compiler-generated assembly-code and for setting up things
-% between where the simulator calls and main, and shutting things down on
-% the way back. There's an actual crt0.o elsewhere, but that's a dummy.
-
-% This file and the GCC output are supposed to be *reasonably*
-% mmixal-compatible to enable people to re-use output with Knuth's mmixal.
-% However, forward references are used more freely: we are using the
-% binutils tools. Users of mmixal beware; you will sometimes have to
-% re-order things or use temporary variables.
-
-% Users of mmixal will want to set up 8H and 9H to be .text and .data
-% respectively, so the compiler can switch between them pretending they're
-% segments.
-
-% This little treasure is here so the 32 lowest address bits of user data
-% will not be zero. Because of truncation, that would cause testcase
-% gcc.c-torture/execute/980701-1.c to incorrectly fail.
-
- .data ! mmixal:= 8H LOC Data_Segment
- .p2align 3
- LOC @+(8-@)@7
- OCTA 2009
-
- .text ! mmixal:= 9H LOC 8B; LOC #100
- .global Main
-
-% The __Stack_start symbol is provided by the link script.
-stackpp OCTA __Stack_start
-
-% "Main" is the magic symbol the simulator jumps to. We want to go
-% on to "main".
-% We need to set rG explicitly to avoid hard-to-debug situations.
-Main SETL $255,32
- PUT rG,$255
-
-% Initialize the stack pointer. It is supposedly made a global
-% zero-initialized (allowed to change) register in crtn.asm; we use the
-% explicit number.
- GETA $255,stackpp
- LDOU $254,$255,0
-
-% Make sure we get more than one mem, to simplify counting cycles.
- LDBU $255,$1,0
- LDBU $255,$1,1
-
- PUSHJ $2,_init
-
-#ifdef __MMIX_ABI_GNU__
-% Copy argc and argv from their initial position to argument registers
-% where necessary.
- SET $231,$0
- SET $232,$1
-#else
-% For the mmixware ABI, we need to move arguments. The return value will
-% appear in $0.
- SET $2,$1
- SET $1,$0
-#endif
-
- PUSHJ $0,main
- JMP exit
-
-% Provide the first part of _init and _fini. Save the return address on the
-% register stack. We eventually ignore the return address of these
-% PUSHJ:s, so it doesn't matter that whether .init and .fini code calls
-% functions or where they store rJ. We shouldn't get there, so die
-% (TRAP Halt) if that happens.
-
- .section .init,"ax",@progbits
- .global _init
-_init:
- GET $0,:rJ
- PUSHJ $1,0F
- SETL $255,255
- TRAP 0,0,0
-0H IS @
-
-% Register _fini to be executed as the last atexit function.
-#ifdef __MMIX_ABI_GNU__
- GETA $231,_fini
-#else
- GETA $1,_fini
-#endif
- PUSHJ $0,atexit
-
- .section .fini,"ax",@progbits
- .global _fini
-_fini:
- GET $0,:rJ
- PUSHJ $1,0F
- SETL $255,255
- TRAP 0,0,0
-0H IS @
diff --git a/gcc/config/mmix/crtn.asm b/gcc/config/mmix/crtn.asm
deleted file mode 100644
index c109e54db01..00000000000
--- a/gcc/config/mmix/crtn.asm
+++ /dev/null
@@ -1,87 +0,0 @@
-/* Copyright (C) 2001, 2002, 2009 Free Software Foundation, Inc.
- Contributed by Hans-Peter Nilsson <hp@bitrange.com>
-
-This file is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3, or (at your option) any
-later version.
-
-This file 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/>. */
-
-% This must be the last file on the link-line, allocating global registers
-% from the top.
-
-% Register $254 is the stack-pointer.
-sp GREG
-
-% Register $253 is frame-pointer. It's not supposed to be used in most
-% functions.
-fp GREG
-
-% $252 is the static chain register; nested functions receive the
-% context of the surrounding function through a pointer passed in this
-% register.
-static_chain GREG
-struct_value_reg GREG
-
-% These registers are used to pass state at an exceptional return (C++).
-eh_state_3 GREG
-eh_state_2 GREG
-eh_state_1 GREG
-eh_state_0 GREG
-
-#ifdef __MMIX_ABI_GNU__
-
-% Allocate global registers used by the GNU ABI.
-gnu_parm_reg_16 GREG
-gnu_parm_reg_15 GREG
-gnu_parm_reg_14 GREG
-gnu_parm_reg_13 GREG
-gnu_parm_reg_12 GREG
-gnu_parm_reg_11 GREG
-gnu_parm_reg_10 GREG
-gnu_parm_reg_9 GREG
-gnu_parm_reg_8 GREG
-gnu_parm_reg_7 GREG
-gnu_parm_reg_6 GREG
-gnu_parm_reg_5 GREG
-gnu_parm_reg_4 GREG
-gnu_parm_reg_3 GREG
-gnu_parm_reg_2 GREG
-gnu_parm_reg_1 GREG
-
-#endif /* __MMIX_ABI_GNU__ */
-
-% Provide last part of _init and _fini.
-
-% The return address is stored in the topmost stored register in the
-% register-stack. We ignore the current value in rJ. It is probably
-% garbage because each fragment of _init and _fini may have their own idea
-% of the current stack frame, if they're cut out from a "real" function
-% like in gcc/crtstuff.c.
-
- .section .init,"ax",@progbits
- GETA $255,0F
- PUT rJ,$255
- POP 0,0
-0H PUT rJ,$0
- POP 0,0
-
- .section .fini,"ax",@progbits
- GETA $255,0F
- PUT rJ,$255
- POP 0,0
-0H PUT rJ,$0
- POP 0,0
diff --git a/gcc/config/mmix/t-mmix b/gcc/config/mmix/t-mmix
index dc05c8e82f5..b25eebcd35a 100644
--- a/gcc/config/mmix/t-mmix
+++ b/gcc/config/mmix/t-mmix
@@ -1,4 +1,4 @@
-# Copyright (C) 2001, 2002, 2003, 2010 Free Software Foundation, Inc.
+# Copyright (C) 2001, 2002, 2003, 2010, 2011 Free Software Foundation, Inc.
#
# This file is part of GCC.
#
@@ -16,16 +16,5 @@
# along with GCC; see the file COPYING3. If not see
# <http://www.gnu.org/licenses/>.
-# See "Target Fragment" in GCC info. That same order is used here.
-
-TARGET_LIBGCC2_CFLAGS = -mlibfuncs -O2
-
-# We need to turn off some assumptions on normality for code in crtstuff.c
-# and crt{i,n}.asm, specifically about execution not continuing past the
-# end of the section in the file being compiled. Thus we must stop the
-# assembler from generating stubbable PUSHJ relocs, because that will add
-# stubs at the end of the current section when necessary.
-CRTSTUFF_T_CFLAGS = -Wa,--no-stubs
-
MULTILIB_OPTIONS = mabi=gnu
MULTILIB_DIRNAMES = gnuabi
diff --git a/gcc/config/mn10300/t-mn10300 b/gcc/config/mn10300/t-mn10300
index c62c56f2013..af22d94cdc3 100644
--- a/gcc/config/mn10300/t-mn10300
+++ b/gcc/config/mn10300/t-mn10300
@@ -19,6 +19,3 @@
MULTILIB_OPTIONS = mam33/mam33-2/mam34
MULTILIB_DIRNAMES = am33 am33-2 am34
-
-LIBGCC = stmp-multilib
-INSTALL_LIBGCC = install-multilib
diff --git a/gcc/config/moxie/crti.asm b/gcc/config/moxie/crti.asm
deleted file mode 100644
index f44582799a3..00000000000
--- a/gcc/config/moxie/crti.asm
+++ /dev/null
@@ -1,40 +0,0 @@
-# crti.asm for moxie
-#
-# Copyright (C) 2009 Free Software Foundation
-#
-# This file is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the
-# Free Software Foundation; either version 3, or (at your option) any
-# later version.
-#
-# This file 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/>.
-
-# This file just make a stack frame for the contents of the .fini and
-# .init sections. Users may put any desired instructions in those
-# sections.
-
- .file "crti.asm"
-
- .section ".init"
- .global _init
- .type _init, @function
- .p2align 1
-_init:
-
- .section ".fini"
- .global _fini
- .type _fini,@function
- .p2align 1
-_fini:
diff --git a/gcc/config/moxie/crtn.asm b/gcc/config/moxie/crtn.asm
deleted file mode 100644
index 3ac9d31eed8..00000000000
--- a/gcc/config/moxie/crtn.asm
+++ /dev/null
@@ -1,34 +0,0 @@
-# crtn.asm for moxie
-#
-# Copyright (C) 2009 Free Software Foundation
-#
-# This file is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the
-# Free Software Foundation; either version 3, or (at your option) any
-# later version.
-#
-# This file 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/>.
-
-# This file just makes sure that the .fini and .init sections do in
-# fact return. Users may put any desired instructions in those sections.
-# This file is the last thing linked into any executable.
-
- .file "crtn.asm"
-
- .section ".init"
- ret
-
- .section ".fini"
- ret
diff --git a/gcc/config/pa/fptr.c b/gcc/config/pa/fptr.c
deleted file mode 100644
index 320d18267c8..00000000000
--- a/gcc/config/pa/fptr.c
+++ /dev/null
@@ -1,131 +0,0 @@
-/* Subroutine for function pointer canonicalization on PA-RISC with ELF32.
- Copyright 2002, 2003, 2004, 2007, 2009 Free Software Foundation, Inc.
- Contributed by John David Anglin (dave.anglin@nrc.ca).
-
-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/>. */
-
-
-/* WARNING: The code is this function depends on internal and undocumented
- details of the GNU linker and dynamic loader as implemented for parisc
- linux. */
-
-/* This MUST match the defines sysdeps/hppa/dl-machine.h and
- bfd/elf32-hppa.c. */
-#define GOT_FROM_PLT_STUB (4*4)
-
-/* List of byte offsets in _dl_runtime_resolve to search for "bl" branches.
- The first "bl" branch instruction found MUST be a call to fixup. See
- the define for TRAMPOLINE_TEMPLATE in sysdeps/hppa/dl-machine.h. If
- the trampoline template is changed, the list must be appropriately
- updated. The offset of -4 allows for a magic branch at the start of
- the template should it be necessary to change the current branch
- position. */
-#define NOFFSETS 2
-static int fixup_branch_offset[NOFFSETS] = { 32, -4 };
-
-#define GET_FIELD(X, FROM, TO) \
- ((X) >> (31 - (TO)) & ((1 << ((TO) - (FROM) + 1)) - 1))
-#define SIGN_EXTEND(VAL,BITS) \
- ((int) ((VAL) >> ((BITS) - 1) ? (-1 << (BITS)) | (VAL) : (VAL)))
-
-struct link_map;
-typedef int (*fptr_t) (void);
-typedef int (*fixup_t) (struct link_map *, unsigned int);
-extern unsigned int _GLOBAL_OFFSET_TABLE_;
-
-/* __canonicalize_funcptr_for_compare must be hidden so that it is not
- placed in the dynamic symbol table. Like millicode functions, it
- must be linked into all binaries in order access the got table of
- that binary. However, we don't use the millicode calling convention
- and the routine must be a normal function so that it can be compiled
- as pic code. */
-unsigned int __canonicalize_funcptr_for_compare (fptr_t)
- __attribute__ ((visibility ("hidden")));
-
-unsigned int
-__canonicalize_funcptr_for_compare (fptr_t fptr)
-{
- static unsigned int fixup_plabel[2];
- static fixup_t fixup;
- unsigned int *plabel, *got;
-
- /* -1 and page 0 are special. -1 is used in crtend to mark the end of
- a list of function pointers. Also return immediately if the plabel
- bit is not set in the function pointer. In this case, the function
- pointer points directly to the function. */
- if ((int) fptr == -1 || (unsigned int) fptr < 4096 || !((int) fptr & 2))
- return (unsigned int) fptr;
-
- /* The function pointer points to a function descriptor (plabel). If
- the plabel hasn't been resolved, the first word of the plabel points
- to the entry of the PLT stub just before the global offset table.
- The second word in the plabel contains the relocation offset for the
- function. */
- plabel = (unsigned int *) ((unsigned int) fptr & ~3);
- got = (unsigned int *) (plabel[0] + GOT_FROM_PLT_STUB);
-
- /* Return the address of the function if the plabel has been resolved. */
- if (got != &_GLOBAL_OFFSET_TABLE_)
- return plabel[0];
-
- /* Initialize our plabel for calling fixup if we haven't done so already.
- This code needs to be thread safe but we don't have to be too careful
- as the result is invariant. */
- if (!fixup)
- {
- int i;
- unsigned int *iptr;
-
- /* Find the first "bl" branch in the offset search list. This is a
- call to fixup or a magic branch to fixup at the beginning of the
- trampoline template. The fixup function does the actual runtime
- resolution of function descriptors. We only look for "bl" branches
- with a 17-bit pc-relative displacement. */
- for (i = 0; i < NOFFSETS; i++)
- {
- iptr = (unsigned int *) (got[-2] + fixup_branch_offset[i]);
- if ((*iptr & 0xfc00e000) == 0xe8000000)
- break;
- }
-
- /* This should not happen... */
- if (i == NOFFSETS)
- return ~0;
-
- /* Extract the 17-bit displacement from the instruction. */
- iptr += SIGN_EXTEND (GET_FIELD (*iptr, 19, 28) |
- GET_FIELD (*iptr, 29, 29) << 10 |
- GET_FIELD (*iptr, 11, 15) << 11 |
- GET_FIELD (*iptr, 31, 31) << 16, 17);
-
- /* Build a plabel for an indirect call to fixup. */
- fixup_plabel[0] = (unsigned int) iptr + 8; /* address of fixup */
- fixup_plabel[1] = got[-1]; /* ltp for fixup */
- fixup = (fixup_t) ((int) fixup_plabel | 3);
- }
-
- /* Call fixup to resolve the function address. got[1] contains the
- link_map pointer and plabel[1] the relocation offset. */
- fixup ((struct link_map *) got[1], plabel[1]);
-
- return plabel[0];
-}
diff --git a/gcc/config/pa/lib2funcs.asm b/gcc/config/pa/lib2funcs.asm
deleted file mode 100644
index 8aa398c8797..00000000000
--- a/gcc/config/pa/lib2funcs.asm
+++ /dev/null
@@ -1,74 +0,0 @@
-; Subroutines for calling unbound dynamic functions from within GDB for HPPA.
-; Subroutines for out of line prologues and epilogues on for the HPPA
-; Copyright (C) 1994, 1995, 1996, 2009 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(__pro__) && !defined(__rtems__)
- .SPACE $PRIVATE$
- .SUBSPA $DATA$,QUAD=1,ALIGN=8,ACCESS=31
- .SUBSPA $BSS$,QUAD=1,ALIGN=8,ACCESS=31,ZERO,SORT=82
- .SPACE $TEXT$
- .SUBSPA $LIT$,QUAD=0,ALIGN=8,ACCESS=44
- .SUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY
- .SUBSPA $MILLICODE$,QUAD=0,ALIGN=8,ACCESS=44,SORT=8
-#endif
- .IMPORT $$dyncall,MILLICODE
-#if !defined(__pro__) && !defined(__rtems__)
- .SPACE $TEXT$
- .SUBSPA $CODE$
-#else
- .text
-#endif
-
-; Simply call with the address of the desired import stub in %r22 and
-; arguments in the normal place (%r26-%r23 and stack slots).
-;
- .align 4
- .EXPORT __gcc_plt_call,ENTRY,PRIV_LEV=3,RTNVAL=GR
-__gcc_plt_call
- .PROC
- .CALLINFO
- .ENTRY
- ; Our return address comes in %r31, not %r2!
- stw %r31,-8(%r30)
-
- ; An inline version of dyncall so we don't have to worry
- ; about long calls to millicode, PIC and other complexities.
- bb,>=,n %r22,30,L$foo
- depi 0,31,2,%r22
- ldw 4(%r22),%r19
- ldw 0(%r22),%r22
-L$foo
- ldsid (%r22),%r1
- mtsp %r1,%sr0
- ble 0(%sr0,%r22)
- copy %r31,%r2
- ldw -8(%r30),%r2
-
- ; We're going to be returning to a stack address, so we
- ; need to do an intra-space return.
- ldsid (%rp),%r1
- mtsp %r1,%sr0
- be,n 0(%sr0,%rp)
- .EXIT
- .PROCEND
diff --git a/gcc/config/pa/linux-atomic.c b/gcc/config/pa/linux-atomic.c
deleted file mode 100644
index 2ae2426357a..00000000000
--- a/gcc/config/pa/linux-atomic.c
+++ /dev/null
@@ -1,305 +0,0 @@
-/* Linux-specific atomic operations for PA Linux.
- Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
- Based on code contributed by CodeSourcery for ARM EABI Linux.
- Modifications for PA Linux by Helge Deller <deller@gmx.de>
-
-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/>. */
-
-#define EFAULT 14
-#define EBUSY 16
-#define ENOSYS 251
-
-/* All PA-RISC implementations supported by linux have strongly
- ordered loads and stores. Only cache flushes and purges can be
- delayed. The data cache implementations are all globally
- coherent. Thus, there is no need to synchonize memory accesses.
-
- GCC automatically issues a asm memory barrier when it encounters
- a __sync_synchronize builtin. Thus, we do not need to define this
- builtin.
-
- We implement byte, short and int versions of each atomic operation
- using the kernel helper defined below. There is no support for
- 64-bit operations yet. */
-
-/* A privileged instruction to crash a userspace program with SIGILL. */
-#define ABORT_INSTRUCTION asm ("iitlbp %r0,(%sr0, %r0)")
-
-/* Determine kernel LWS function call (0=32-bit, 1=64-bit userspace). */
-#define LWS_CAS (sizeof(unsigned long) == 4 ? 0 : 1)
-
-/* Kernel helper for compare-and-exchange a 32-bit value. */
-static inline long
-__kernel_cmpxchg (int oldval, int newval, int *mem)
-{
- register unsigned long lws_mem asm("r26") = (unsigned long) (mem);
- register long lws_ret asm("r28");
- register long lws_errno asm("r21");
- register int lws_old asm("r25") = oldval;
- register int lws_new asm("r24") = newval;
- asm volatile ( "ble 0xb0(%%sr2, %%r0) \n\t"
- "ldi %5, %%r20 \n\t"
- : "=r" (lws_ret), "=r" (lws_errno), "=r" (lws_mem),
- "=r" (lws_old), "=r" (lws_new)
- : "i" (LWS_CAS), "2" (lws_mem), "3" (lws_old), "4" (lws_new)
- : "r1", "r20", "r22", "r23", "r29", "r31", "memory"
- );
- if (__builtin_expect (lws_errno == -EFAULT || lws_errno == -ENOSYS, 0))
- ABORT_INSTRUCTION;
-
- /* If the kernel LWS call succeeded (lws_errno == 0), lws_ret contains
- the old value from memory. If this value is equal to OLDVAL, the
- new value was written to memory. If not, return -EBUSY. */
- if (!lws_errno && lws_ret != oldval)
- lws_errno = -EBUSY;
-
- return lws_errno;
-}
-
-#define HIDDEN __attribute__ ((visibility ("hidden")))
-
-/* Big endian masks */
-#define INVERT_MASK_1 24
-#define INVERT_MASK_2 16
-
-#define MASK_1 0xffu
-#define MASK_2 0xffffu
-
-#define FETCH_AND_OP_WORD(OP, PFX_OP, INF_OP) \
- int HIDDEN \
- __sync_fetch_and_##OP##_4 (int *ptr, int val) \
- { \
- int failure, tmp; \
- \
- do { \
- tmp = *ptr; \
- failure = __kernel_cmpxchg (tmp, PFX_OP (tmp INF_OP val), ptr); \
- } while (failure != 0); \
- \
- return tmp; \
- }
-
-FETCH_AND_OP_WORD (add, , +)
-FETCH_AND_OP_WORD (sub, , -)
-FETCH_AND_OP_WORD (or, , |)
-FETCH_AND_OP_WORD (and, , &)
-FETCH_AND_OP_WORD (xor, , ^)
-FETCH_AND_OP_WORD (nand, ~, &)
-
-#define NAME_oldval(OP, WIDTH) __sync_fetch_and_##OP##_##WIDTH
-#define NAME_newval(OP, WIDTH) __sync_##OP##_and_fetch_##WIDTH
-
-/* Implement both __sync_<op>_and_fetch and __sync_fetch_and_<op> for
- subword-sized quantities. */
-
-#define SUBWORD_SYNC_OP(OP, PFX_OP, INF_OP, TYPE, WIDTH, RETURN) \
- TYPE HIDDEN \
- NAME##_##RETURN (OP, WIDTH) (TYPE *ptr, TYPE val) \
- { \
- int *wordptr = (int *) ((unsigned long) ptr & ~3); \
- unsigned int mask, shift, oldval, newval; \
- int failure; \
- \
- shift = (((unsigned long) ptr & 3) << 3) ^ INVERT_MASK_##WIDTH; \
- mask = MASK_##WIDTH << shift; \
- \
- do { \
- oldval = *wordptr; \
- newval = ((PFX_OP (((oldval & mask) >> shift) \
- INF_OP (unsigned int) val)) << shift) & mask; \
- newval |= oldval & ~mask; \
- failure = __kernel_cmpxchg (oldval, newval, wordptr); \
- } while (failure != 0); \
- \
- return (RETURN & mask) >> shift; \
- }
-
-SUBWORD_SYNC_OP (add, , +, unsigned short, 2, oldval)
-SUBWORD_SYNC_OP (sub, , -, unsigned short, 2, oldval)
-SUBWORD_SYNC_OP (or, , |, unsigned short, 2, oldval)
-SUBWORD_SYNC_OP (and, , &, unsigned short, 2, oldval)
-SUBWORD_SYNC_OP (xor, , ^, unsigned short, 2, oldval)
-SUBWORD_SYNC_OP (nand, ~, &, unsigned short, 2, oldval)
-
-SUBWORD_SYNC_OP (add, , +, unsigned char, 1, oldval)
-SUBWORD_SYNC_OP (sub, , -, unsigned char, 1, oldval)
-SUBWORD_SYNC_OP (or, , |, unsigned char, 1, oldval)
-SUBWORD_SYNC_OP (and, , &, unsigned char, 1, oldval)
-SUBWORD_SYNC_OP (xor, , ^, unsigned char, 1, oldval)
-SUBWORD_SYNC_OP (nand, ~, &, unsigned char, 1, oldval)
-
-#define OP_AND_FETCH_WORD(OP, PFX_OP, INF_OP) \
- int HIDDEN \
- __sync_##OP##_and_fetch_4 (int *ptr, int val) \
- { \
- int tmp, failure; \
- \
- do { \
- tmp = *ptr; \
- failure = __kernel_cmpxchg (tmp, PFX_OP (tmp INF_OP val), ptr); \
- } while (failure != 0); \
- \
- return PFX_OP (tmp INF_OP val); \
- }
-
-OP_AND_FETCH_WORD (add, , +)
-OP_AND_FETCH_WORD (sub, , -)
-OP_AND_FETCH_WORD (or, , |)
-OP_AND_FETCH_WORD (and, , &)
-OP_AND_FETCH_WORD (xor, , ^)
-OP_AND_FETCH_WORD (nand, ~, &)
-
-SUBWORD_SYNC_OP (add, , +, unsigned short, 2, newval)
-SUBWORD_SYNC_OP (sub, , -, unsigned short, 2, newval)
-SUBWORD_SYNC_OP (or, , |, unsigned short, 2, newval)
-SUBWORD_SYNC_OP (and, , &, unsigned short, 2, newval)
-SUBWORD_SYNC_OP (xor, , ^, unsigned short, 2, newval)
-SUBWORD_SYNC_OP (nand, ~, &, unsigned short, 2, newval)
-
-SUBWORD_SYNC_OP (add, , +, unsigned char, 1, newval)
-SUBWORD_SYNC_OP (sub, , -, unsigned char, 1, newval)
-SUBWORD_SYNC_OP (or, , |, unsigned char, 1, newval)
-SUBWORD_SYNC_OP (and, , &, unsigned char, 1, newval)
-SUBWORD_SYNC_OP (xor, , ^, unsigned char, 1, newval)
-SUBWORD_SYNC_OP (nand, ~, &, unsigned char, 1, newval)
-
-int HIDDEN
-__sync_val_compare_and_swap_4 (int *ptr, int oldval, int newval)
-{
- int actual_oldval, fail;
-
- while (1)
- {
- actual_oldval = *ptr;
-
- if (__builtin_expect (oldval != actual_oldval, 0))
- return actual_oldval;
-
- fail = __kernel_cmpxchg (actual_oldval, newval, ptr);
-
- if (__builtin_expect (!fail, 1))
- return actual_oldval;
- }
-}
-
-#define SUBWORD_VAL_CAS(TYPE, WIDTH) \
- TYPE HIDDEN \
- __sync_val_compare_and_swap_##WIDTH (TYPE *ptr, TYPE oldval, \
- TYPE newval) \
- { \
- int *wordptr = (int *)((unsigned long) ptr & ~3), fail; \
- unsigned int mask, shift, actual_oldval, actual_newval; \
- \
- shift = (((unsigned long) ptr & 3) << 3) ^ INVERT_MASK_##WIDTH; \
- mask = MASK_##WIDTH << shift; \
- \
- while (1) \
- { \
- actual_oldval = *wordptr; \
- \
- if (__builtin_expect (((actual_oldval & mask) >> shift) \
- != (unsigned int) oldval, 0)) \
- return (actual_oldval & mask) >> shift; \
- \
- actual_newval = (actual_oldval & ~mask) \
- | (((unsigned int) newval << shift) & mask); \
- \
- fail = __kernel_cmpxchg (actual_oldval, actual_newval, \
- wordptr); \
- \
- if (__builtin_expect (!fail, 1)) \
- return (actual_oldval & mask) >> shift; \
- } \
- }
-
-SUBWORD_VAL_CAS (unsigned short, 2)
-SUBWORD_VAL_CAS (unsigned char, 1)
-
-typedef unsigned char bool;
-
-bool HIDDEN
-__sync_bool_compare_and_swap_4 (int *ptr, int oldval, int newval)
-{
- int failure = __kernel_cmpxchg (oldval, newval, ptr);
- return (failure == 0);
-}
-
-#define SUBWORD_BOOL_CAS(TYPE, WIDTH) \
- bool HIDDEN \
- __sync_bool_compare_and_swap_##WIDTH (TYPE *ptr, TYPE oldval, \
- TYPE newval) \
- { \
- TYPE actual_oldval \
- = __sync_val_compare_and_swap_##WIDTH (ptr, oldval, newval); \
- return (oldval == actual_oldval); \
- }
-
-SUBWORD_BOOL_CAS (unsigned short, 2)
-SUBWORD_BOOL_CAS (unsigned char, 1)
-
-int HIDDEN
-__sync_lock_test_and_set_4 (int *ptr, int val)
-{
- int failure, oldval;
-
- do {
- oldval = *ptr;
- failure = __kernel_cmpxchg (oldval, val, ptr);
- } while (failure != 0);
-
- return oldval;
-}
-
-#define SUBWORD_TEST_AND_SET(TYPE, WIDTH) \
- TYPE HIDDEN \
- __sync_lock_test_and_set_##WIDTH (TYPE *ptr, TYPE val) \
- { \
- int failure; \
- unsigned int oldval, newval, shift, mask; \
- int *wordptr = (int *) ((unsigned long) ptr & ~3); \
- \
- shift = (((unsigned long) ptr & 3) << 3) ^ INVERT_MASK_##WIDTH; \
- mask = MASK_##WIDTH << shift; \
- \
- do { \
- oldval = *wordptr; \
- newval = (oldval & ~mask) \
- | (((unsigned int) val << shift) & mask); \
- failure = __kernel_cmpxchg (oldval, newval, wordptr); \
- } while (failure != 0); \
- \
- return (oldval & mask) >> shift; \
- }
-
-SUBWORD_TEST_AND_SET (unsigned short, 2)
-SUBWORD_TEST_AND_SET (unsigned char, 1)
-
-#define SYNC_LOCK_RELEASE(TYPE, WIDTH) \
- void HIDDEN \
- __sync_lock_release_##WIDTH (TYPE *ptr) \
- { \
- *ptr = 0; \
- }
-
-SYNC_LOCK_RELEASE (int, 4)
-SYNC_LOCK_RELEASE (short, 2)
-SYNC_LOCK_RELEASE (char, 1)
diff --git a/gcc/config/pa/milli64.S b/gcc/config/pa/milli64.S
deleted file mode 100644
index 2e9c4f741b6..00000000000
--- a/gcc/config/pa/milli64.S
+++ /dev/null
@@ -1,2134 +0,0 @@
-/* 32 and 64-bit millicode, original author Hewlett-Packard
- adapted for gcc by Paul Bame <bame@debian.org>
- and Alan Modra <alan@linuxcare.com.au>.
-
- Copyright 2001, 2002, 2003, 2007, 2009 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/>. */
-
-#ifdef pa64
- .level 2.0w
-#endif
-
-/* Hardware General Registers. */
-r0: .reg %r0
-r1: .reg %r1
-r2: .reg %r2
-r3: .reg %r3
-r4: .reg %r4
-r5: .reg %r5
-r6: .reg %r6
-r7: .reg %r7
-r8: .reg %r8
-r9: .reg %r9
-r10: .reg %r10
-r11: .reg %r11
-r12: .reg %r12
-r13: .reg %r13
-r14: .reg %r14
-r15: .reg %r15
-r16: .reg %r16
-r17: .reg %r17
-r18: .reg %r18
-r19: .reg %r19
-r20: .reg %r20
-r21: .reg %r21
-r22: .reg %r22
-r23: .reg %r23
-r24: .reg %r24
-r25: .reg %r25
-r26: .reg %r26
-r27: .reg %r27
-r28: .reg %r28
-r29: .reg %r29
-r30: .reg %r30
-r31: .reg %r31
-
-/* Hardware Space Registers. */
-sr0: .reg %sr0
-sr1: .reg %sr1
-sr2: .reg %sr2
-sr3: .reg %sr3
-sr4: .reg %sr4
-sr5: .reg %sr5
-sr6: .reg %sr6
-sr7: .reg %sr7
-
-/* Hardware Floating Point Registers. */
-fr0: .reg %fr0
-fr1: .reg %fr1
-fr2: .reg %fr2
-fr3: .reg %fr3
-fr4: .reg %fr4
-fr5: .reg %fr5
-fr6: .reg %fr6
-fr7: .reg %fr7
-fr8: .reg %fr8
-fr9: .reg %fr9
-fr10: .reg %fr10
-fr11: .reg %fr11
-fr12: .reg %fr12
-fr13: .reg %fr13
-fr14: .reg %fr14
-fr15: .reg %fr15
-
-/* Hardware Control Registers. */
-cr11: .reg %cr11
-sar: .reg %cr11 /* Shift Amount Register */
-
-/* Software Architecture General Registers. */
-rp: .reg r2 /* return pointer */
-#ifdef pa64
-mrp: .reg r2 /* millicode return pointer */
-#else
-mrp: .reg r31 /* millicode return pointer */
-#endif
-ret0: .reg r28 /* return value */
-ret1: .reg r29 /* return value (high part of double) */
-sp: .reg r30 /* stack pointer */
-dp: .reg r27 /* data pointer */
-arg0: .reg r26 /* argument */
-arg1: .reg r25 /* argument or high part of double argument */
-arg2: .reg r24 /* argument */
-arg3: .reg r23 /* argument or high part of double argument */
-
-/* Software Architecture Space Registers. */
-/* sr0 ; return link from BLE */
-sret: .reg sr1 /* return value */
-sarg: .reg sr1 /* argument */
-/* sr4 ; PC SPACE tracker */
-/* sr5 ; process private data */
-
-/* Frame Offsets (millicode convention!) Used when calling other
- millicode routines. Stack unwinding is dependent upon these
- definitions. */
-r31_slot: .equ -20 /* "current RP" slot */
-sr0_slot: .equ -16 /* "static link" slot */
-#if defined(pa64)
-mrp_slot: .equ -16 /* "current RP" slot */
-psp_slot: .equ -8 /* "previous SP" slot */
-#else
-mrp_slot: .equ -20 /* "current RP" slot (replacing "r31_slot") */
-#endif
-
-
-#define DEFINE(name,value)name: .EQU value
-#define RDEFINE(name,value)name: .REG value
-#ifdef milliext
-#define MILLI_BE(lbl) BE lbl(sr7,r0)
-#define MILLI_BEN(lbl) BE,n lbl(sr7,r0)
-#define MILLI_BLE(lbl) BLE lbl(sr7,r0)
-#define MILLI_BLEN(lbl) BLE,n lbl(sr7,r0)
-#define MILLIRETN BE,n 0(sr0,mrp)
-#define MILLIRET BE 0(sr0,mrp)
-#define MILLI_RETN BE,n 0(sr0,mrp)
-#define MILLI_RET BE 0(sr0,mrp)
-#else
-#define MILLI_BE(lbl) B lbl
-#define MILLI_BEN(lbl) B,n lbl
-#define MILLI_BLE(lbl) BL lbl,mrp
-#define MILLI_BLEN(lbl) BL,n lbl,mrp
-#define MILLIRETN BV,n 0(mrp)
-#define MILLIRET BV 0(mrp)
-#define MILLI_RETN BV,n 0(mrp)
-#define MILLI_RET BV 0(mrp)
-#endif
-
-#ifdef __STDC__
-#define CAT(a,b) a##b
-#else
-#define CAT(a,b) a/**/b
-#endif
-
-#ifdef ELF
-#define SUBSPA_MILLI .section .text
-#define SUBSPA_MILLI_DIV .section .text.div,"ax",@progbits! .align 16
-#define SUBSPA_MILLI_MUL .section .text.mul,"ax",@progbits! .align 16
-#define ATTR_MILLI
-#define SUBSPA_DATA .section .data
-#define ATTR_DATA
-#define GLOBAL $global$
-#define GSYM(sym) !sym:
-#define LSYM(sym) !CAT(.L,sym:)
-#define LREF(sym) CAT(.L,sym)
-
-#else
-
-#ifdef coff
-/* This used to be .milli but since link32 places different named
- sections in different segments millicode ends up a long ways away
- from .text (1meg?). This way they will be a lot closer.
-
- The SUBSPA_MILLI_* specify locality sets for certain millicode
- modules in order to ensure that modules that call one another are
- placed close together. Without locality sets this is unlikely to
- happen because of the Dynamite linker library search algorithm. We
- want these modules close together so that short calls always reach
- (we don't want to require long calls or use long call stubs). */
-
-#define SUBSPA_MILLI .subspa .text
-#define SUBSPA_MILLI_DIV .subspa .text$dv,align=16
-#define SUBSPA_MILLI_MUL .subspa .text$mu,align=16
-#define ATTR_MILLI .attr code,read,execute
-#define SUBSPA_DATA .subspa .data
-#define ATTR_DATA .attr init_data,read,write
-#define GLOBAL _gp
-#else
-#define SUBSPA_MILLI .subspa $MILLICODE$,QUAD=0,ALIGN=4,ACCESS=0x2c,SORT=8
-#define SUBSPA_MILLI_DIV SUBSPA_MILLI
-#define SUBSPA_MILLI_MUL SUBSPA_MILLI
-#define ATTR_MILLI
-#define SUBSPA_DATA .subspa $BSS$,quad=1,align=8,access=0x1f,sort=80,zero
-#define ATTR_DATA
-#define GLOBAL $global$
-#endif
-#define SPACE_DATA .space $PRIVATE$,spnum=1,sort=16
-
-#define GSYM(sym) !sym
-#define LSYM(sym) !CAT(L$,sym)
-#define LREF(sym) CAT(L$,sym)
-#endif
-
-#ifdef L_dyncall
- SUBSPA_MILLI
- ATTR_DATA
-GSYM($$dyncall)
- .export $$dyncall,millicode
- .proc
- .callinfo millicode
- .entry
- bb,>=,n %r22,30,LREF(1) ; branch if not plabel address
- depi 0,31,2,%r22 ; clear the two least significant bits
- ldw 4(%r22),%r19 ; load new LTP value
- ldw 0(%r22),%r22 ; load address of target
-LSYM(1)
-#ifdef LINUX
- bv %r0(%r22) ; branch to the real target
-#else
- ldsid (%sr0,%r22),%r1 ; get the "space ident" selected by r22
- mtsp %r1,%sr0 ; move that space identifier into sr0
- be 0(%sr0,%r22) ; branch to the real target
-#endif
- stw %r2,-24(%r30) ; save return address into frame marker
- .exit
- .procend
-#endif
-
-#ifdef L_divI
-/* ROUTINES: $$divI, $$divoI
-
- Single precision divide for signed binary integers.
-
- The quotient is truncated towards zero.
- The sign of the quotient is the XOR of the signs of the dividend and
- divisor.
- Divide by zero is trapped.
- Divide of -2**31 by -1 is trapped for $$divoI but not for $$divI.
-
- INPUT REGISTERS:
- . arg0 == dividend
- . arg1 == divisor
- . mrp == return pc
- . sr0 == return space when called externally
-
- OUTPUT REGISTERS:
- . arg0 = undefined
- . arg1 = undefined
- . ret1 = quotient
-
- OTHER REGISTERS AFFECTED:
- . r1 = undefined
-
- SIDE EFFECTS:
- . Causes a trap under the following conditions:
- . divisor is zero (traps with ADDIT,= 0,25,0)
- . dividend==-2**31 and divisor==-1 and routine is $$divoI
- . (traps with ADDO 26,25,0)
- . Changes memory at the following places:
- . NONE
-
- PERMISSIBLE CONTEXT:
- . Unwindable.
- . Suitable for internal or external millicode.
- . Assumes the special millicode register conventions.
-
- DISCUSSION:
- . Branchs to other millicode routines using BE
- . $$div_# for # being 2,3,4,5,6,7,8,9,10,12,14,15
- .
- . For selected divisors, calls a divide by constant routine written by
- . Karl Pettis. Eligible divisors are 1..15 excluding 11 and 13.
- .
- . The only overflow case is -2**31 divided by -1.
- . Both routines return -2**31 but only $$divoI traps. */
-
-RDEFINE(temp,r1)
-RDEFINE(retreg,ret1) /* r29 */
-RDEFINE(temp1,arg0)
- SUBSPA_MILLI_DIV
- ATTR_MILLI
- .import $$divI_2,millicode
- .import $$divI_3,millicode
- .import $$divI_4,millicode
- .import $$divI_5,millicode
- .import $$divI_6,millicode
- .import $$divI_7,millicode
- .import $$divI_8,millicode
- .import $$divI_9,millicode
- .import $$divI_10,millicode
- .import $$divI_12,millicode
- .import $$divI_14,millicode
- .import $$divI_15,millicode
- .export $$divI,millicode
- .export $$divoI,millicode
- .proc
- .callinfo millicode
- .entry
-GSYM($$divoI)
- comib,=,n -1,arg1,LREF(negative1) /* when divisor == -1 */
-GSYM($$divI)
- ldo -1(arg1),temp /* is there at most one bit set ? */
- and,<> arg1,temp,r0 /* if not, don't use power of 2 divide */
- addi,> 0,arg1,r0 /* if divisor > 0, use power of 2 divide */
- b,n LREF(neg_denom)
-LSYM(pow2)
- addi,>= 0,arg0,retreg /* if numerator is negative, add the */
- add arg0,temp,retreg /* (denominaotr -1) to correct for shifts */
- extru,= arg1,15,16,temp /* test denominator with 0xffff0000 */
- extrs retreg,15,16,retreg /* retreg = retreg >> 16 */
- or arg1,temp,arg1 /* arg1 = arg1 | (arg1 >> 16) */
- ldi 0xcc,temp1 /* setup 0xcc in temp1 */
- extru,= arg1,23,8,temp /* test denominator with 0xff00 */
- extrs retreg,23,24,retreg /* retreg = retreg >> 8 */
- or arg1,temp,arg1 /* arg1 = arg1 | (arg1 >> 8) */
- ldi 0xaa,temp /* setup 0xaa in temp */
- extru,= arg1,27,4,r0 /* test denominator with 0xf0 */
- extrs retreg,27,28,retreg /* retreg = retreg >> 4 */
- and,= arg1,temp1,r0 /* test denominator with 0xcc */
- extrs retreg,29,30,retreg /* retreg = retreg >> 2 */
- and,= arg1,temp,r0 /* test denominator with 0xaa */
- extrs retreg,30,31,retreg /* retreg = retreg >> 1 */
- MILLIRETN
-LSYM(neg_denom)
- addi,< 0,arg1,r0 /* if arg1 >= 0, it's not power of 2 */
- b,n LREF(regular_seq)
- sub r0,arg1,temp /* make denominator positive */
- comb,=,n arg1,temp,LREF(regular_seq) /* test against 0x80000000 and 0 */
- ldo -1(temp),retreg /* is there at most one bit set ? */
- and,= temp,retreg,r0 /* if so, the denominator is power of 2 */
- b,n LREF(regular_seq)
- sub r0,arg0,retreg /* negate numerator */
- comb,=,n arg0,retreg,LREF(regular_seq) /* test against 0x80000000 */
- copy retreg,arg0 /* set up arg0, arg1 and temp */
- copy temp,arg1 /* before branching to pow2 */
- b LREF(pow2)
- ldo -1(arg1),temp
-LSYM(regular_seq)
- comib,>>=,n 15,arg1,LREF(small_divisor)
- add,>= 0,arg0,retreg /* move dividend, if retreg < 0, */
-LSYM(normal)
- subi 0,retreg,retreg /* make it positive */
- sub 0,arg1,temp /* clear carry, */
- /* negate the divisor */
- ds 0,temp,0 /* set V-bit to the comple- */
- /* ment of the divisor sign */
- add retreg,retreg,retreg /* shift msb bit into carry */
- ds r0,arg1,temp /* 1st divide step, if no carry */
- addc retreg,retreg,retreg /* shift retreg with/into carry */
- ds temp,arg1,temp /* 2nd divide step */
- addc retreg,retreg,retreg /* shift retreg with/into carry */
- ds temp,arg1,temp /* 3rd divide step */
- addc retreg,retreg,retreg /* shift retreg with/into carry */
- ds temp,arg1,temp /* 4th divide step */
- addc retreg,retreg,retreg /* shift retreg with/into carry */
- ds temp,arg1,temp /* 5th divide step */
- addc retreg,retreg,retreg /* shift retreg with/into carry */
- ds temp,arg1,temp /* 6th divide step */
- addc retreg,retreg,retreg /* shift retreg with/into carry */
- ds temp,arg1,temp /* 7th divide step */
- addc retreg,retreg,retreg /* shift retreg with/into carry */
- ds temp,arg1,temp /* 8th divide step */
- addc retreg,retreg,retreg /* shift retreg with/into carry */
- ds temp,arg1,temp /* 9th divide step */
- addc retreg,retreg,retreg /* shift retreg with/into carry */
- ds temp,arg1,temp /* 10th divide step */
- addc retreg,retreg,retreg /* shift retreg with/into carry */
- ds temp,arg1,temp /* 11th divide step */
- addc retreg,retreg,retreg /* shift retreg with/into carry */
- ds temp,arg1,temp /* 12th divide step */
- addc retreg,retreg,retreg /* shift retreg with/into carry */
- ds temp,arg1,temp /* 13th divide step */
- addc retreg,retreg,retreg /* shift retreg with/into carry */
- ds temp,arg1,temp /* 14th divide step */
- addc retreg,retreg,retreg /* shift retreg with/into carry */
- ds temp,arg1,temp /* 15th divide step */
- addc retreg,retreg,retreg /* shift retreg with/into carry */
- ds temp,arg1,temp /* 16th divide step */
- addc retreg,retreg,retreg /* shift retreg with/into carry */
- ds temp,arg1,temp /* 17th divide step */
- addc retreg,retreg,retreg /* shift retreg with/into carry */
- ds temp,arg1,temp /* 18th divide step */
- addc retreg,retreg,retreg /* shift retreg with/into carry */
- ds temp,arg1,temp /* 19th divide step */
- addc retreg,retreg,retreg /* shift retreg with/into carry */
- ds temp,arg1,temp /* 20th divide step */
- addc retreg,retreg,retreg /* shift retreg with/into carry */
- ds temp,arg1,temp /* 21st divide step */
- addc retreg,retreg,retreg /* shift retreg with/into carry */
- ds temp,arg1,temp /* 22nd divide step */
- addc retreg,retreg,retreg /* shift retreg with/into carry */
- ds temp,arg1,temp /* 23rd divide step */
- addc retreg,retreg,retreg /* shift retreg with/into carry */
- ds temp,arg1,temp /* 24th divide step */
- addc retreg,retreg,retreg /* shift retreg with/into carry */
- ds temp,arg1,temp /* 25th divide step */
- addc retreg,retreg,retreg /* shift retreg with/into carry */
- ds temp,arg1,temp /* 26th divide step */
- addc retreg,retreg,retreg /* shift retreg with/into carry */
- ds temp,arg1,temp /* 27th divide step */
- addc retreg,retreg,retreg /* shift retreg with/into carry */
- ds temp,arg1,temp /* 28th divide step */
- addc retreg,retreg,retreg /* shift retreg with/into carry */
- ds temp,arg1,temp /* 29th divide step */
- addc retreg,retreg,retreg /* shift retreg with/into carry */
- ds temp,arg1,temp /* 30th divide step */
- addc retreg,retreg,retreg /* shift retreg with/into carry */
- ds temp,arg1,temp /* 31st divide step */
- addc retreg,retreg,retreg /* shift retreg with/into carry */
- ds temp,arg1,temp /* 32nd divide step, */
- addc retreg,retreg,retreg /* shift last retreg bit into retreg */
- xor,>= arg0,arg1,0 /* get correct sign of quotient */
- sub 0,retreg,retreg /* based on operand signs */
- MILLIRETN
- nop
-
-LSYM(small_divisor)
-
-#if defined(pa64)
-/* Clear the upper 32 bits of the arg1 register. We are working with */
-/* small divisors (and 32-bit integers) We must not be mislead */
-/* by "1" bits left in the upper 32 bits. */
- depd %r0,31,32,%r25
-#endif
- blr,n arg1,r0
- nop
-/* table for divisor == 0,1, ... ,15 */
- addit,= 0,arg1,r0 /* trap if divisor == 0 */
- nop
- MILLIRET /* divisor == 1 */
- copy arg0,retreg
- MILLI_BEN($$divI_2) /* divisor == 2 */
- nop
- MILLI_BEN($$divI_3) /* divisor == 3 */
- nop
- MILLI_BEN($$divI_4) /* divisor == 4 */
- nop
- MILLI_BEN($$divI_5) /* divisor == 5 */
- nop
- MILLI_BEN($$divI_6) /* divisor == 6 */
- nop
- MILLI_BEN($$divI_7) /* divisor == 7 */
- nop
- MILLI_BEN($$divI_8) /* divisor == 8 */
- nop
- MILLI_BEN($$divI_9) /* divisor == 9 */
- nop
- MILLI_BEN($$divI_10) /* divisor == 10 */
- nop
- b LREF(normal) /* divisor == 11 */
- add,>= 0,arg0,retreg
- MILLI_BEN($$divI_12) /* divisor == 12 */
- nop
- b LREF(normal) /* divisor == 13 */
- add,>= 0,arg0,retreg
- MILLI_BEN($$divI_14) /* divisor == 14 */
- nop
- MILLI_BEN($$divI_15) /* divisor == 15 */
- nop
-
-LSYM(negative1)
- sub 0,arg0,retreg /* result is negation of dividend */
- MILLIRET
- addo arg0,arg1,r0 /* trap iff dividend==0x80000000 && divisor==-1 */
- .exit
- .procend
- .end
-#endif
-
-#ifdef L_divU
-/* ROUTINE: $$divU
- .
- . Single precision divide for unsigned integers.
- .
- . Quotient is truncated towards zero.
- . Traps on divide by zero.
-
- INPUT REGISTERS:
- . arg0 == dividend
- . arg1 == divisor
- . mrp == return pc
- . sr0 == return space when called externally
-
- OUTPUT REGISTERS:
- . arg0 = undefined
- . arg1 = undefined
- . ret1 = quotient
-
- OTHER REGISTERS AFFECTED:
- . r1 = undefined
-
- SIDE EFFECTS:
- . Causes a trap under the following conditions:
- . divisor is zero
- . Changes memory at the following places:
- . NONE
-
- PERMISSIBLE CONTEXT:
- . Unwindable.
- . Does not create a stack frame.
- . Suitable for internal or external millicode.
- . Assumes the special millicode register conventions.
-
- DISCUSSION:
- . Branchs to other millicode routines using BE:
- . $$divU_# for 3,5,6,7,9,10,12,14,15
- .
- . For selected small divisors calls the special divide by constant
- . routines written by Karl Pettis. These are: 3,5,6,7,9,10,12,14,15. */
-
-RDEFINE(temp,r1)
-RDEFINE(retreg,ret1) /* r29 */
-RDEFINE(temp1,arg0)
- SUBSPA_MILLI_DIV
- ATTR_MILLI
- .export $$divU,millicode
- .import $$divU_3,millicode
- .import $$divU_5,millicode
- .import $$divU_6,millicode
- .import $$divU_7,millicode
- .import $$divU_9,millicode
- .import $$divU_10,millicode
- .import $$divU_12,millicode
- .import $$divU_14,millicode
- .import $$divU_15,millicode
- .proc
- .callinfo millicode
- .entry
-GSYM($$divU)
-/* The subtract is not nullified since it does no harm and can be used
- by the two cases that branch back to "normal". */
- ldo -1(arg1),temp /* is there at most one bit set ? */
- and,= arg1,temp,r0 /* if so, denominator is power of 2 */
- b LREF(regular_seq)
- addit,= 0,arg1,0 /* trap for zero dvr */
- copy arg0,retreg
- extru,= arg1,15,16,temp /* test denominator with 0xffff0000 */
- extru retreg,15,16,retreg /* retreg = retreg >> 16 */
- or arg1,temp,arg1 /* arg1 = arg1 | (arg1 >> 16) */
- ldi 0xcc,temp1 /* setup 0xcc in temp1 */
- extru,= arg1,23,8,temp /* test denominator with 0xff00 */
- extru retreg,23,24,retreg /* retreg = retreg >> 8 */
- or arg1,temp,arg1 /* arg1 = arg1 | (arg1 >> 8) */
- ldi 0xaa,temp /* setup 0xaa in temp */
- extru,= arg1,27,4,r0 /* test denominator with 0xf0 */
- extru retreg,27,28,retreg /* retreg = retreg >> 4 */
- and,= arg1,temp1,r0 /* test denominator with 0xcc */
- extru retreg,29,30,retreg /* retreg = retreg >> 2 */
- and,= arg1,temp,r0 /* test denominator with 0xaa */
- extru retreg,30,31,retreg /* retreg = retreg >> 1 */
- MILLIRETN
- nop
-LSYM(regular_seq)
- comib,>= 15,arg1,LREF(special_divisor)
- subi 0,arg1,temp /* clear carry, negate the divisor */
- ds r0,temp,r0 /* set V-bit to 1 */
-LSYM(normal)
- add arg0,arg0,retreg /* shift msb bit into carry */
- ds r0,arg1,temp /* 1st divide step, if no carry */
- addc retreg,retreg,retreg /* shift retreg with/into carry */
- ds temp,arg1,temp /* 2nd divide step */
- addc retreg,retreg,retreg /* shift retreg with/into carry */
- ds temp,arg1,temp /* 3rd divide step */
- addc retreg,retreg,retreg /* shift retreg with/into carry */
- ds temp,arg1,temp /* 4th divide step */
- addc retreg,retreg,retreg /* shift retreg with/into carry */
- ds temp,arg1,temp /* 5th divide step */
- addc retreg,retreg,retreg /* shift retreg with/into carry */
- ds temp,arg1,temp /* 6th divide step */
- addc retreg,retreg,retreg /* shift retreg with/into carry */
- ds temp,arg1,temp /* 7th divide step */
- addc retreg,retreg,retreg /* shift retreg with/into carry */
- ds temp,arg1,temp /* 8th divide step */
- addc retreg,retreg,retreg /* shift retreg with/into carry */
- ds temp,arg1,temp /* 9th divide step */
- addc retreg,retreg,retreg /* shift retreg with/into carry */
- ds temp,arg1,temp /* 10th divide step */
- addc retreg,retreg,retreg /* shift retreg with/into carry */
- ds temp,arg1,temp /* 11th divide step */
- addc retreg,retreg,retreg /* shift retreg with/into carry */
- ds temp,arg1,temp /* 12th divide step */
- addc retreg,retreg,retreg /* shift retreg with/into carry */
- ds temp,arg1,temp /* 13th divide step */
- addc retreg,retreg,retreg /* shift retreg with/into carry */
- ds temp,arg1,temp /* 14th divide step */
- addc retreg,retreg,retreg /* shift retreg with/into carry */
- ds temp,arg1,temp /* 15th divide step */
- addc retreg,retreg,retreg /* shift retreg with/into carry */
- ds temp,arg1,temp /* 16th divide step */
- addc retreg,retreg,retreg /* shift retreg with/into carry */
- ds temp,arg1,temp /* 17th divide step */
- addc retreg,retreg,retreg /* shift retreg with/into carry */
- ds temp,arg1,temp /* 18th divide step */
- addc retreg,retreg,retreg /* shift retreg with/into carry */
- ds temp,arg1,temp /* 19th divide step */
- addc retreg,retreg,retreg /* shift retreg with/into carry */
- ds temp,arg1,temp /* 20th divide step */
- addc retreg,retreg,retreg /* shift retreg with/into carry */
- ds temp,arg1,temp /* 21st divide step */
- addc retreg,retreg,retreg /* shift retreg with/into carry */
- ds temp,arg1,temp /* 22nd divide step */
- addc retreg,retreg,retreg /* shift retreg with/into carry */
- ds temp,arg1,temp /* 23rd divide step */
- addc retreg,retreg,retreg /* shift retreg with/into carry */
- ds temp,arg1,temp /* 24th divide step */
- addc retreg,retreg,retreg /* shift retreg with/into carry */
- ds temp,arg1,temp /* 25th divide step */
- addc retreg,retreg,retreg /* shift retreg with/into carry */
- ds temp,arg1,temp /* 26th divide step */
- addc retreg,retreg,retreg /* shift retreg with/into carry */
- ds temp,arg1,temp /* 27th divide step */
- addc retreg,retreg,retreg /* shift retreg with/into carry */
- ds temp,arg1,temp /* 28th divide step */
- addc retreg,retreg,retreg /* shift retreg with/into carry */
- ds temp,arg1,temp /* 29th divide step */
- addc retreg,retreg,retreg /* shift retreg with/into carry */
- ds temp,arg1,temp /* 30th divide step */
- addc retreg,retreg,retreg /* shift retreg with/into carry */
- ds temp,arg1,temp /* 31st divide step */
- addc retreg,retreg,retreg /* shift retreg with/into carry */
- ds temp,arg1,temp /* 32nd divide step, */
- MILLIRET
- addc retreg,retreg,retreg /* shift last retreg bit into retreg */
-
-/* Handle the cases where divisor is a small constant or has high bit on. */
-LSYM(special_divisor)
-/* blr arg1,r0 */
-/* comib,>,n 0,arg1,LREF(big_divisor) ; nullify previous instruction */
-
-/* Pratap 8/13/90. The 815 Stirling chip set has a bug that prevents us from
- generating such a blr, comib sequence. A problem in nullification. So I
- rewrote this code. */
-
-#if defined(pa64)
-/* Clear the upper 32 bits of the arg1 register. We are working with
- small divisors (and 32-bit unsigned integers) We must not be mislead
- by "1" bits left in the upper 32 bits. */
- depd %r0,31,32,%r25
-#endif
- comib,> 0,arg1,LREF(big_divisor)
- nop
- blr arg1,r0
- nop
-
-LSYM(zero_divisor) /* this label is here to provide external visibility */
- addit,= 0,arg1,0 /* trap for zero dvr */
- nop
- MILLIRET /* divisor == 1 */
- copy arg0,retreg
- MILLIRET /* divisor == 2 */
- extru arg0,30,31,retreg
- MILLI_BEN($$divU_3) /* divisor == 3 */
- nop
- MILLIRET /* divisor == 4 */
- extru arg0,29,30,retreg
- MILLI_BEN($$divU_5) /* divisor == 5 */
- nop
- MILLI_BEN($$divU_6) /* divisor == 6 */
- nop
- MILLI_BEN($$divU_7) /* divisor == 7 */
- nop
- MILLIRET /* divisor == 8 */
- extru arg0,28,29,retreg
- MILLI_BEN($$divU_9) /* divisor == 9 */
- nop
- MILLI_BEN($$divU_10) /* divisor == 10 */
- nop
- b LREF(normal) /* divisor == 11 */
- ds r0,temp,r0 /* set V-bit to 1 */
- MILLI_BEN($$divU_12) /* divisor == 12 */
- nop
- b LREF(normal) /* divisor == 13 */
- ds r0,temp,r0 /* set V-bit to 1 */
- MILLI_BEN($$divU_14) /* divisor == 14 */
- nop
- MILLI_BEN($$divU_15) /* divisor == 15 */
- nop
-
-/* Handle the case where the high bit is on in the divisor.
- Compute: if( dividend>=divisor) quotient=1; else quotient=0;
- Note: dividend>==divisor iff dividend-divisor does not borrow
- and not borrow iff carry. */
-LSYM(big_divisor)
- sub arg0,arg1,r0
- MILLIRET
- addc r0,r0,retreg
- .exit
- .procend
- .end
-#endif
-
-#ifdef L_remI
-/* ROUTINE: $$remI
-
- DESCRIPTION:
- . $$remI returns the remainder of the division of two signed 32-bit
- . integers. The sign of the remainder is the same as the sign of
- . the dividend.
-
-
- INPUT REGISTERS:
- . arg0 == dividend
- . arg1 == divisor
- . mrp == return pc
- . sr0 == return space when called externally
-
- OUTPUT REGISTERS:
- . arg0 = destroyed
- . arg1 = destroyed
- . ret1 = remainder
-
- OTHER REGISTERS AFFECTED:
- . r1 = undefined
-
- SIDE EFFECTS:
- . Causes a trap under the following conditions: DIVIDE BY ZERO
- . Changes memory at the following places: NONE
-
- PERMISSIBLE CONTEXT:
- . Unwindable
- . Does not create a stack frame
- . Is usable for internal or external microcode
-
- DISCUSSION:
- . Calls other millicode routines via mrp: NONE
- . Calls other millicode routines: NONE */
-
-RDEFINE(tmp,r1)
-RDEFINE(retreg,ret1)
-
- SUBSPA_MILLI
- ATTR_MILLI
- .proc
- .callinfo millicode
- .entry
-GSYM($$remI)
-GSYM($$remoI)
- .export $$remI,MILLICODE
- .export $$remoI,MILLICODE
- ldo -1(arg1),tmp /* is there at most one bit set ? */
- and,<> arg1,tmp,r0 /* if not, don't use power of 2 */
- addi,> 0,arg1,r0 /* if denominator > 0, use power */
- /* of 2 */
- b,n LREF(neg_denom)
-LSYM(pow2)
- comb,>,n 0,arg0,LREF(neg_num) /* is numerator < 0 ? */
- and arg0,tmp,retreg /* get the result */
- MILLIRETN
-LSYM(neg_num)
- subi 0,arg0,arg0 /* negate numerator */
- and arg0,tmp,retreg /* get the result */
- subi 0,retreg,retreg /* negate result */
- MILLIRETN
-LSYM(neg_denom)
- addi,< 0,arg1,r0 /* if arg1 >= 0, it's not power */
- /* of 2 */
- b,n LREF(regular_seq)
- sub r0,arg1,tmp /* make denominator positive */
- comb,=,n arg1,tmp,LREF(regular_seq) /* test against 0x80000000 and 0 */
- ldo -1(tmp),retreg /* is there at most one bit set ? */
- and,= tmp,retreg,r0 /* if not, go to regular_seq */
- b,n LREF(regular_seq)
- comb,>,n 0,arg0,LREF(neg_num_2) /* if arg0 < 0, negate it */
- and arg0,retreg,retreg
- MILLIRETN
-LSYM(neg_num_2)
- subi 0,arg0,tmp /* test against 0x80000000 */
- and tmp,retreg,retreg
- subi 0,retreg,retreg
- MILLIRETN
-LSYM(regular_seq)
- addit,= 0,arg1,0 /* trap if div by zero */
- add,>= 0,arg0,retreg /* move dividend, if retreg < 0, */
- sub 0,retreg,retreg /* make it positive */
- sub 0,arg1, tmp /* clear carry, */
- /* negate the divisor */
- ds 0, tmp,0 /* set V-bit to the comple- */
- /* ment of the divisor sign */
- or 0,0, tmp /* clear tmp */
- add retreg,retreg,retreg /* shift msb bit into carry */
- ds tmp,arg1, tmp /* 1st divide step, if no carry */
- /* out, msb of quotient = 0 */
- addc retreg,retreg,retreg /* shift retreg with/into carry */
-LSYM(t1)
- ds tmp,arg1, tmp /* 2nd divide step */
- addc retreg,retreg,retreg /* shift retreg with/into carry */
- ds tmp,arg1, tmp /* 3rd divide step */
- addc retreg,retreg,retreg /* shift retreg with/into carry */
- ds tmp,arg1, tmp /* 4th divide step */
- addc retreg,retreg,retreg /* shift retreg with/into carry */
- ds tmp,arg1, tmp /* 5th divide step */
- addc retreg,retreg,retreg /* shift retreg with/into carry */
- ds tmp,arg1, tmp /* 6th divide step */
- addc retreg,retreg,retreg /* shift retreg with/into carry */
- ds tmp,arg1, tmp /* 7th divide step */
- addc retreg,retreg,retreg /* shift retreg with/into carry */
- ds tmp,arg1, tmp /* 8th divide step */
- addc retreg,retreg,retreg /* shift retreg with/into carry */
- ds tmp,arg1, tmp /* 9th divide step */
- addc retreg,retreg,retreg /* shift retreg with/into carry */
- ds tmp,arg1, tmp /* 10th divide step */
- addc retreg,retreg,retreg /* shift retreg with/into carry */
- ds tmp,arg1, tmp /* 11th divide step */
- addc retreg,retreg,retreg /* shift retreg with/into carry */
- ds tmp,arg1, tmp /* 12th divide step */
- addc retreg,retreg,retreg /* shift retreg with/into carry */
- ds tmp,arg1, tmp /* 13th divide step */
- addc retreg,retreg,retreg /* shift retreg with/into carry */
- ds tmp,arg1, tmp /* 14th divide step */
- addc retreg,retreg,retreg /* shift retreg with/into carry */
- ds tmp,arg1, tmp /* 15th divide step */
- addc retreg,retreg,retreg /* shift retreg with/into carry */
- ds tmp,arg1, tmp /* 16th divide step */
- addc retreg,retreg,retreg /* shift retreg with/into carry */
- ds tmp,arg1, tmp /* 17th divide step */
- addc retreg,retreg,retreg /* shift retreg with/into carry */
- ds tmp,arg1, tmp /* 18th divide step */
- addc retreg,retreg,retreg /* shift retreg with/into carry */
- ds tmp,arg1, tmp /* 19th divide step */
- addc retreg,retreg,retreg /* shift retreg with/into carry */
- ds tmp,arg1, tmp /* 20th divide step */
- addc retreg,retreg,retreg /* shift retreg with/into carry */
- ds tmp,arg1, tmp /* 21st divide step */
- addc retreg,retreg,retreg /* shift retreg with/into carry */
- ds tmp,arg1, tmp /* 22nd divide step */
- addc retreg,retreg,retreg /* shift retreg with/into carry */
- ds tmp,arg1, tmp /* 23rd divide step */
- addc retreg,retreg,retreg /* shift retreg with/into carry */
- ds tmp,arg1, tmp /* 24th divide step */
- addc retreg,retreg,retreg /* shift retreg with/into carry */
- ds tmp,arg1, tmp /* 25th divide step */
- addc retreg,retreg,retreg /* shift retreg with/into carry */
- ds tmp,arg1, tmp /* 26th divide step */
- addc retreg,retreg,retreg /* shift retreg with/into carry */
- ds tmp,arg1, tmp /* 27th divide step */
- addc retreg,retreg,retreg /* shift retreg with/into carry */
- ds tmp,arg1, tmp /* 28th divide step */
- addc retreg,retreg,retreg /* shift retreg with/into carry */
- ds tmp,arg1, tmp /* 29th divide step */
- addc retreg,retreg,retreg /* shift retreg with/into carry */
- ds tmp,arg1, tmp /* 30th divide step */
- addc retreg,retreg,retreg /* shift retreg with/into carry */
- ds tmp,arg1, tmp /* 31st divide step */
- addc retreg,retreg,retreg /* shift retreg with/into carry */
- ds tmp,arg1, tmp /* 32nd divide step, */
- addc retreg,retreg,retreg /* shift last bit into retreg */
- movb,>=,n tmp,retreg,LREF(finish) /* branch if pos. tmp */
- add,< arg1,0,0 /* if arg1 > 0, add arg1 */
- add,tr tmp,arg1,retreg /* for correcting remainder tmp */
- sub tmp,arg1,retreg /* else add absolute value arg1 */
-LSYM(finish)
- add,>= arg0,0,0 /* set sign of remainder */
- sub 0,retreg,retreg /* to sign of dividend */
- MILLIRET
- nop
- .exit
- .procend
-#ifdef milliext
- .origin 0x00000200
-#endif
- .end
-#endif
-
-#ifdef L_remU
-/* ROUTINE: $$remU
- . Single precision divide for remainder with unsigned binary integers.
- .
- . The remainder must be dividend-(dividend/divisor)*divisor.
- . Divide by zero is trapped.
-
- INPUT REGISTERS:
- . arg0 == dividend
- . arg1 == divisor
- . mrp == return pc
- . sr0 == return space when called externally
-
- OUTPUT REGISTERS:
- . arg0 = undefined
- . arg1 = undefined
- . ret1 = remainder
-
- OTHER REGISTERS AFFECTED:
- . r1 = undefined
-
- SIDE EFFECTS:
- . Causes a trap under the following conditions: DIVIDE BY ZERO
- . Changes memory at the following places: NONE
-
- PERMISSIBLE CONTEXT:
- . Unwindable.
- . Does not create a stack frame.
- . Suitable for internal or external millicode.
- . Assumes the special millicode register conventions.
-
- DISCUSSION:
- . Calls other millicode routines using mrp: NONE
- . Calls other millicode routines: NONE */
-
-
-RDEFINE(temp,r1)
-RDEFINE(rmndr,ret1) /* r29 */
- SUBSPA_MILLI
- ATTR_MILLI
- .export $$remU,millicode
- .proc
- .callinfo millicode
- .entry
-GSYM($$remU)
- ldo -1(arg1),temp /* is there at most one bit set ? */
- and,= arg1,temp,r0 /* if not, don't use power of 2 */
- b LREF(regular_seq)
- addit,= 0,arg1,r0 /* trap on div by zero */
- and arg0,temp,rmndr /* get the result for power of 2 */
- MILLIRETN
-LSYM(regular_seq)
- comib,>=,n 0,arg1,LREF(special_case)
- subi 0,arg1,rmndr /* clear carry, negate the divisor */
- ds r0,rmndr,r0 /* set V-bit to 1 */
- add arg0,arg0,temp /* shift msb bit into carry */
- ds r0,arg1,rmndr /* 1st divide step, if no carry */
- addc temp,temp,temp /* shift temp with/into carry */
- ds rmndr,arg1,rmndr /* 2nd divide step */
- addc temp,temp,temp /* shift temp with/into carry */
- ds rmndr,arg1,rmndr /* 3rd divide step */
- addc temp,temp,temp /* shift temp with/into carry */
- ds rmndr,arg1,rmndr /* 4th divide step */
- addc temp,temp,temp /* shift temp with/into carry */
- ds rmndr,arg1,rmndr /* 5th divide step */
- addc temp,temp,temp /* shift temp with/into carry */
- ds rmndr,arg1,rmndr /* 6th divide step */
- addc temp,temp,temp /* shift temp with/into carry */
- ds rmndr,arg1,rmndr /* 7th divide step */
- addc temp,temp,temp /* shift temp with/into carry */
- ds rmndr,arg1,rmndr /* 8th divide step */
- addc temp,temp,temp /* shift temp with/into carry */
- ds rmndr,arg1,rmndr /* 9th divide step */
- addc temp,temp,temp /* shift temp with/into carry */
- ds rmndr,arg1,rmndr /* 10th divide step */
- addc temp,temp,temp /* shift temp with/into carry */
- ds rmndr,arg1,rmndr /* 11th divide step */
- addc temp,temp,temp /* shift temp with/into carry */
- ds rmndr,arg1,rmndr /* 12th divide step */
- addc temp,temp,temp /* shift temp with/into carry */
- ds rmndr,arg1,rmndr /* 13th divide step */
- addc temp,temp,temp /* shift temp with/into carry */
- ds rmndr,arg1,rmndr /* 14th divide step */
- addc temp,temp,temp /* shift temp with/into carry */
- ds rmndr,arg1,rmndr /* 15th divide step */
- addc temp,temp,temp /* shift temp with/into carry */
- ds rmndr,arg1,rmndr /* 16th divide step */
- addc temp,temp,temp /* shift temp with/into carry */
- ds rmndr,arg1,rmndr /* 17th divide step */
- addc temp,temp,temp /* shift temp with/into carry */
- ds rmndr,arg1,rmndr /* 18th divide step */
- addc temp,temp,temp /* shift temp with/into carry */
- ds rmndr,arg1,rmndr /* 19th divide step */
- addc temp,temp,temp /* shift temp with/into carry */
- ds rmndr,arg1,rmndr /* 20th divide step */
- addc temp,temp,temp /* shift temp with/into carry */
- ds rmndr,arg1,rmndr /* 21st divide step */
- addc temp,temp,temp /* shift temp with/into carry */
- ds rmndr,arg1,rmndr /* 22nd divide step */
- addc temp,temp,temp /* shift temp with/into carry */
- ds rmndr,arg1,rmndr /* 23rd divide step */
- addc temp,temp,temp /* shift temp with/into carry */
- ds rmndr,arg1,rmndr /* 24th divide step */
- addc temp,temp,temp /* shift temp with/into carry */
- ds rmndr,arg1,rmndr /* 25th divide step */
- addc temp,temp,temp /* shift temp with/into carry */
- ds rmndr,arg1,rmndr /* 26th divide step */
- addc temp,temp,temp /* shift temp with/into carry */
- ds rmndr,arg1,rmndr /* 27th divide step */
- addc temp,temp,temp /* shift temp with/into carry */
- ds rmndr,arg1,rmndr /* 28th divide step */
- addc temp,temp,temp /* shift temp with/into carry */
- ds rmndr,arg1,rmndr /* 29th divide step */
- addc temp,temp,temp /* shift temp with/into carry */
- ds rmndr,arg1,rmndr /* 30th divide step */
- addc temp,temp,temp /* shift temp with/into carry */
- ds rmndr,arg1,rmndr /* 31st divide step */
- addc temp,temp,temp /* shift temp with/into carry */
- ds rmndr,arg1,rmndr /* 32nd divide step, */
- comiclr,<= 0,rmndr,r0
- add rmndr,arg1,rmndr /* correction */
- MILLIRETN
- nop
-
-/* Putting >= on the last DS and deleting COMICLR does not work! */
-LSYM(special_case)
- sub,>>= arg0,arg1,rmndr
- copy arg0,rmndr
- MILLIRETN
- nop
- .exit
- .procend
- .end
-#endif
-
-#ifdef L_div_const
-/* ROUTINE: $$divI_2
- . $$divI_3 $$divU_3
- . $$divI_4
- . $$divI_5 $$divU_5
- . $$divI_6 $$divU_6
- . $$divI_7 $$divU_7
- . $$divI_8
- . $$divI_9 $$divU_9
- . $$divI_10 $$divU_10
- .
- . $$divI_12 $$divU_12
- .
- . $$divI_14 $$divU_14
- . $$divI_15 $$divU_15
- . $$divI_16
- . $$divI_17 $$divU_17
- .
- . Divide by selected constants for single precision binary integers.
-
- INPUT REGISTERS:
- . arg0 == dividend
- . mrp == return pc
- . sr0 == return space when called externally
-
- OUTPUT REGISTERS:
- . arg0 = undefined
- . arg1 = undefined
- . ret1 = quotient
-
- OTHER REGISTERS AFFECTED:
- . r1 = undefined
-
- SIDE EFFECTS:
- . Causes a trap under the following conditions: NONE
- . Changes memory at the following places: NONE
-
- PERMISSIBLE CONTEXT:
- . Unwindable.
- . Does not create a stack frame.
- . Suitable for internal or external millicode.
- . Assumes the special millicode register conventions.
-
- DISCUSSION:
- . Calls other millicode routines using mrp: NONE
- . Calls other millicode routines: NONE */
-
-
-/* TRUNCATED DIVISION BY SMALL INTEGERS
-
- We are interested in q(x) = floor(x/y), where x >= 0 and y > 0
- (with y fixed).
-
- Let a = floor(z/y), for some choice of z. Note that z will be
- chosen so that division by z is cheap.
-
- Let r be the remainder(z/y). In other words, r = z - ay.
-
- Now, our method is to choose a value for b such that
-
- q'(x) = floor((ax+b)/z)
-
- is equal to q(x) over as large a range of x as possible. If the
- two are equal over a sufficiently large range, and if it is easy to
- form the product (ax), and it is easy to divide by z, then we can
- perform the division much faster than the general division algorithm.
-
- So, we want the following to be true:
-
- . For x in the following range:
- .
- . ky <= x < (k+1)y
- .
- . implies that
- .
- . k <= (ax+b)/z < (k+1)
-
- We want to determine b such that this is true for all k in the
- range {0..K} for some maximum K.
-
- Since (ax+b) is an increasing function of x, we can take each
- bound separately to determine the "best" value for b.
-
- (ax+b)/z < (k+1) implies
-
- (a((k+1)y-1)+b < (k+1)z implies
-
- b < a + (k+1)(z-ay) implies
-
- b < a + (k+1)r
-
- This needs to be true for all k in the range {0..K}. In
- particular, it is true for k = 0 and this leads to a maximum
- acceptable value for b.
-
- b < a+r or b <= a+r-1
-
- Taking the other bound, we have
-
- k <= (ax+b)/z implies
-
- k <= (aky+b)/z implies
-
- k(z-ay) <= b implies
-
- kr <= b
-
- Clearly, the largest range for k will be achieved by maximizing b,
- when r is not zero. When r is zero, then the simplest choice for b
- is 0. When r is not 0, set
-
- . b = a+r-1
-
- Now, by construction, q'(x) = floor((ax+b)/z) = q(x) = floor(x/y)
- for all x in the range:
-
- . 0 <= x < (K+1)y
-
- We need to determine what K is. Of our two bounds,
-
- . b < a+(k+1)r is satisfied for all k >= 0, by construction.
-
- The other bound is
-
- . kr <= b
-
- This is always true if r = 0. If r is not 0 (the usual case), then
- K = floor((a+r-1)/r), is the maximum value for k.
-
- Therefore, the formula q'(x) = floor((ax+b)/z) yields the correct
- answer for q(x) = floor(x/y) when x is in the range
-
- (0,(K+1)y-1) K = floor((a+r-1)/r)
-
- To be most useful, we want (K+1)y-1 = (max x) >= 2**32-1 so that
- the formula for q'(x) yields the correct value of q(x) for all x
- representable by a single word in HPPA.
-
- We are also constrained in that computing the product (ax), adding
- b, and dividing by z must all be done quickly, otherwise we will be
- better off going through the general algorithm using the DS
- instruction, which uses approximately 70 cycles.
-
- For each y, there is a choice of z which satisfies the constraints
- for (K+1)y >= 2**32. We may not, however, be able to satisfy the
- timing constraints for arbitrary y. It seems that z being equal to
- a power of 2 or a power of 2 minus 1 is as good as we can do, since
- it minimizes the time to do division by z. We want the choice of z
- to also result in a value for (a) that minimizes the computation of
- the product (ax). This is best achieved if (a) has a regular bit
- pattern (so the multiplication can be done with shifts and adds).
- The value of (a) also needs to be less than 2**32 so the product is
- always guaranteed to fit in 2 words.
-
- In actual practice, the following should be done:
-
- 1) For negative x, you should take the absolute value and remember
- . the fact so that the result can be negated. This obviously does
- . not apply in the unsigned case.
- 2) For even y, you should factor out the power of 2 that divides y
- . and divide x by it. You can then proceed by dividing by the
- . odd factor of y.
-
- Here is a table of some odd values of y, and corresponding choices
- for z which are "good".
-
- y z r a (hex) max x (hex)
-
- 3 2**32 1 55555555 100000001
- 5 2**32 1 33333333 100000003
- 7 2**24-1 0 249249 (infinite)
- 9 2**24-1 0 1c71c7 (infinite)
- 11 2**20-1 0 1745d (infinite)
- 13 2**24-1 0 13b13b (infinite)
- 15 2**32 1 11111111 10000000d
- 17 2**32 1 f0f0f0f 10000000f
-
- If r is 1, then b = a+r-1 = a. This simplifies the computation
- of (ax+b), since you can compute (x+1)(a) instead. If r is 0,
- then b = 0 is ok to use which simplifies (ax+b).
-
- The bit patterns for 55555555, 33333333, and 11111111 are obviously
- very regular. The bit patterns for the other values of a above are:
-
- y (hex) (binary)
-
- 7 249249 001001001001001001001001 << regular >>
- 9 1c71c7 000111000111000111000111 << regular >>
- 11 1745d 000000010111010001011101 << irregular >>
- 13 13b13b 000100111011000100111011 << irregular >>
-
- The bit patterns for (a) corresponding to (y) of 11 and 13 may be
- too irregular to warrant using this method.
-
- When z is a power of 2 minus 1, then the division by z is slightly
- more complicated, involving an iterative solution.
-
- The code presented here solves division by 1 through 17, except for
- 11 and 13. There are algorithms for both signed and unsigned
- quantities given.
-
- TIMINGS (cycles)
-
- divisor positive negative unsigned
-
- . 1 2 2 2
- . 2 4 4 2
- . 3 19 21 19
- . 4 4 4 2
- . 5 18 22 19
- . 6 19 22 19
- . 8 4 4 2
- . 10 18 19 17
- . 12 18 20 18
- . 15 16 18 16
- . 16 4 4 2
- . 17 16 18 16
-
- Now, the algorithm for 7, 9, and 14 is an iterative one. That is,
- a loop body is executed until the tentative quotient is 0. The
- number of times the loop body is executed varies depending on the
- dividend, but is never more than two times. If the dividend is
- less than the divisor, then the loop body is not executed at all.
- Each iteration adds 4 cycles to the timings.
-
- divisor positive negative unsigned
-
- . 7 19+4n 20+4n 20+4n n = number of iterations
- . 9 21+4n 22+4n 21+4n
- . 14 21+4n 22+4n 20+4n
-
- To give an idea of how the number of iterations varies, here is a
- table of dividend versus number of iterations when dividing by 7.
-
- smallest largest required
- dividend dividend iterations
-
- . 0 6 0
- . 7 0x6ffffff 1
- 0x1000006 0xffffffff 2
-
- There is some overlap in the range of numbers requiring 1 and 2
- iterations. */
-
-RDEFINE(t2,r1)
-RDEFINE(x2,arg0) /* r26 */
-RDEFINE(t1,arg1) /* r25 */
-RDEFINE(x1,ret1) /* r29 */
-
- SUBSPA_MILLI_DIV
- ATTR_MILLI
-
- .proc
- .callinfo millicode
- .entry
-/* NONE of these routines require a stack frame
- ALL of these routines are unwindable from millicode */
-
-GSYM($$divide_by_constant)
- .export $$divide_by_constant,millicode
-/* Provides a "nice" label for the code covered by the unwind descriptor
- for things like gprof. */
-
-/* DIVISION BY 2 (shift by 1) */
-GSYM($$divI_2)
- .export $$divI_2,millicode
- comclr,>= arg0,0,0
- addi 1,arg0,arg0
- MILLIRET
- extrs arg0,30,31,ret1
-
-
-/* DIVISION BY 4 (shift by 2) */
-GSYM($$divI_4)
- .export $$divI_4,millicode
- comclr,>= arg0,0,0
- addi 3,arg0,arg0
- MILLIRET
- extrs arg0,29,30,ret1
-
-
-/* DIVISION BY 8 (shift by 3) */
-GSYM($$divI_8)
- .export $$divI_8,millicode
- comclr,>= arg0,0,0
- addi 7,arg0,arg0
- MILLIRET
- extrs arg0,28,29,ret1
-
-/* DIVISION BY 16 (shift by 4) */
-GSYM($$divI_16)
- .export $$divI_16,millicode
- comclr,>= arg0,0,0
- addi 15,arg0,arg0
- MILLIRET
- extrs arg0,27,28,ret1
-
-/****************************************************************************
-*
-* DIVISION BY DIVISORS OF FFFFFFFF, and powers of 2 times these
-*
-* includes 3,5,15,17 and also 6,10,12
-*
-****************************************************************************/
-
-/* DIVISION BY 3 (use z = 2**32; a = 55555555) */
-
-GSYM($$divI_3)
- .export $$divI_3,millicode
- comb,<,N x2,0,LREF(neg3)
-
- addi 1,x2,x2 /* this cannot overflow */
- extru x2,1,2,x1 /* multiply by 5 to get started */
- sh2add x2,x2,x2
- b LREF(pos)
- addc x1,0,x1
-
-LSYM(neg3)
- subi 1,x2,x2 /* this cannot overflow */
- extru x2,1,2,x1 /* multiply by 5 to get started */
- sh2add x2,x2,x2
- b LREF(neg)
- addc x1,0,x1
-
-GSYM($$divU_3)
- .export $$divU_3,millicode
- addi 1,x2,x2 /* this CAN overflow */
- addc 0,0,x1
- shd x1,x2,30,t1 /* multiply by 5 to get started */
- sh2add x2,x2,x2
- b LREF(pos)
- addc x1,t1,x1
-
-/* DIVISION BY 5 (use z = 2**32; a = 33333333) */
-
-GSYM($$divI_5)
- .export $$divI_5,millicode
- comb,<,N x2,0,LREF(neg5)
-
- addi 3,x2,t1 /* this cannot overflow */
- sh1add x2,t1,x2 /* multiply by 3 to get started */
- b LREF(pos)
- addc 0,0,x1
-
-LSYM(neg5)
- sub 0,x2,x2 /* negate x2 */
- addi 1,x2,x2 /* this cannot overflow */
- shd 0,x2,31,x1 /* get top bit (can be 1) */
- sh1add x2,x2,x2 /* multiply by 3 to get started */
- b LREF(neg)
- addc x1,0,x1
-
-GSYM($$divU_5)
- .export $$divU_5,millicode
- addi 1,x2,x2 /* this CAN overflow */
- addc 0,0,x1
- shd x1,x2,31,t1 /* multiply by 3 to get started */
- sh1add x2,x2,x2
- b LREF(pos)
- addc t1,x1,x1
-
-/* DIVISION BY 6 (shift to divide by 2 then divide by 3) */
-GSYM($$divI_6)
- .export $$divI_6,millicode
- comb,<,N x2,0,LREF(neg6)
- extru x2,30,31,x2 /* divide by 2 */
- addi 5,x2,t1 /* compute 5*(x2+1) = 5*x2+5 */
- sh2add x2,t1,x2 /* multiply by 5 to get started */
- b LREF(pos)
- addc 0,0,x1
-
-LSYM(neg6)
- subi 2,x2,x2 /* negate, divide by 2, and add 1 */
- /* negation and adding 1 are done */
- /* at the same time by the SUBI */
- extru x2,30,31,x2
- shd 0,x2,30,x1
- sh2add x2,x2,x2 /* multiply by 5 to get started */
- b LREF(neg)
- addc x1,0,x1
-
-GSYM($$divU_6)
- .export $$divU_6,millicode
- extru x2,30,31,x2 /* divide by 2 */
- addi 1,x2,x2 /* cannot carry */
- shd 0,x2,30,x1 /* multiply by 5 to get started */
- sh2add x2,x2,x2
- b LREF(pos)
- addc x1,0,x1
-
-/* DIVISION BY 10 (shift to divide by 2 then divide by 5) */
-GSYM($$divU_10)
- .export $$divU_10,millicode
- extru x2,30,31,x2 /* divide by 2 */
- addi 3,x2,t1 /* compute 3*(x2+1) = (3*x2)+3 */
- sh1add x2,t1,x2 /* multiply by 3 to get started */
- addc 0,0,x1
-LSYM(pos)
- shd x1,x2,28,t1 /* multiply by 0x11 */
- shd x2,0,28,t2
- add x2,t2,x2
- addc x1,t1,x1
-LSYM(pos_for_17)
- shd x1,x2,24,t1 /* multiply by 0x101 */
- shd x2,0,24,t2
- add x2,t2,x2
- addc x1,t1,x1
-
- shd x1,x2,16,t1 /* multiply by 0x10001 */
- shd x2,0,16,t2
- add x2,t2,x2
- MILLIRET
- addc x1,t1,x1
-
-GSYM($$divI_10)
- .export $$divI_10,millicode
- comb,< x2,0,LREF(neg10)
- copy 0,x1
- extru x2,30,31,x2 /* divide by 2 */
- addib,TR 1,x2,LREF(pos) /* add 1 (cannot overflow) */
- sh1add x2,x2,x2 /* multiply by 3 to get started */
-
-LSYM(neg10)
- subi 2,x2,x2 /* negate, divide by 2, and add 1 */
- /* negation and adding 1 are done */
- /* at the same time by the SUBI */
- extru x2,30,31,x2
- sh1add x2,x2,x2 /* multiply by 3 to get started */
-LSYM(neg)
- shd x1,x2,28,t1 /* multiply by 0x11 */
- shd x2,0,28,t2
- add x2,t2,x2
- addc x1,t1,x1
-LSYM(neg_for_17)
- shd x1,x2,24,t1 /* multiply by 0x101 */
- shd x2,0,24,t2
- add x2,t2,x2
- addc x1,t1,x1
-
- shd x1,x2,16,t1 /* multiply by 0x10001 */
- shd x2,0,16,t2
- add x2,t2,x2
- addc x1,t1,x1
- MILLIRET
- sub 0,x1,x1
-
-/* DIVISION BY 12 (shift to divide by 4 then divide by 3) */
-GSYM($$divI_12)
- .export $$divI_12,millicode
- comb,< x2,0,LREF(neg12)
- copy 0,x1
- extru x2,29,30,x2 /* divide by 4 */
- addib,tr 1,x2,LREF(pos) /* compute 5*(x2+1) = 5*x2+5 */
- sh2add x2,x2,x2 /* multiply by 5 to get started */
-
-LSYM(neg12)
- subi 4,x2,x2 /* negate, divide by 4, and add 1 */
- /* negation and adding 1 are done */
- /* at the same time by the SUBI */
- extru x2,29,30,x2
- b LREF(neg)
- sh2add x2,x2,x2 /* multiply by 5 to get started */
-
-GSYM($$divU_12)
- .export $$divU_12,millicode
- extru x2,29,30,x2 /* divide by 4 */
- addi 5,x2,t1 /* cannot carry */
- sh2add x2,t1,x2 /* multiply by 5 to get started */
- b LREF(pos)
- addc 0,0,x1
-
-/* DIVISION BY 15 (use z = 2**32; a = 11111111) */
-GSYM($$divI_15)
- .export $$divI_15,millicode
- comb,< x2,0,LREF(neg15)
- copy 0,x1
- addib,tr 1,x2,LREF(pos)+4
- shd x1,x2,28,t1
-
-LSYM(neg15)
- b LREF(neg)
- subi 1,x2,x2
-
-GSYM($$divU_15)
- .export $$divU_15,millicode
- addi 1,x2,x2 /* this CAN overflow */
- b LREF(pos)
- addc 0,0,x1
-
-/* DIVISION BY 17 (use z = 2**32; a = f0f0f0f) */
-GSYM($$divI_17)
- .export $$divI_17,millicode
- comb,<,n x2,0,LREF(neg17)
- addi 1,x2,x2 /* this cannot overflow */
- shd 0,x2,28,t1 /* multiply by 0xf to get started */
- shd x2,0,28,t2
- sub t2,x2,x2
- b LREF(pos_for_17)
- subb t1,0,x1
-
-LSYM(neg17)
- subi 1,x2,x2 /* this cannot overflow */
- shd 0,x2,28,t1 /* multiply by 0xf to get started */
- shd x2,0,28,t2
- sub t2,x2,x2
- b LREF(neg_for_17)
- subb t1,0,x1
-
-GSYM($$divU_17)
- .export $$divU_17,millicode
- addi 1,x2,x2 /* this CAN overflow */
- addc 0,0,x1
- shd x1,x2,28,t1 /* multiply by 0xf to get started */
-LSYM(u17)
- shd x2,0,28,t2
- sub t2,x2,x2
- b LREF(pos_for_17)
- subb t1,x1,x1
-
-
-/* DIVISION BY DIVISORS OF FFFFFF, and powers of 2 times these
- includes 7,9 and also 14
-
-
- z = 2**24-1
- r = z mod x = 0
-
- so choose b = 0
-
- Also, in order to divide by z = 2**24-1, we approximate by dividing
- by (z+1) = 2**24 (which is easy), and then correcting.
-
- (ax) = (z+1)q' + r
- . = zq' + (q'+r)
-
- So to compute (ax)/z, compute q' = (ax)/(z+1) and r = (ax) mod (z+1)
- Then the true remainder of (ax)/z is (q'+r). Repeat the process
- with this new remainder, adding the tentative quotients together,
- until a tentative quotient is 0 (and then we are done). There is
- one last correction to be done. It is possible that (q'+r) = z.
- If so, then (q'+r)/(z+1) = 0 and it looks like we are done. But,
- in fact, we need to add 1 more to the quotient. Now, it turns
- out that this happens if and only if the original value x is
- an exact multiple of y. So, to avoid a three instruction test at
- the end, instead use 1 instruction to add 1 to x at the beginning. */
-
-/* DIVISION BY 7 (use z = 2**24-1; a = 249249) */
-GSYM($$divI_7)
- .export $$divI_7,millicode
- comb,<,n x2,0,LREF(neg7)
-LSYM(7)
- addi 1,x2,x2 /* cannot overflow */
- shd 0,x2,29,x1
- sh3add x2,x2,x2
- addc x1,0,x1
-LSYM(pos7)
- shd x1,x2,26,t1
- shd x2,0,26,t2
- add x2,t2,x2
- addc x1,t1,x1
-
- shd x1,x2,20,t1
- shd x2,0,20,t2
- add x2,t2,x2
- addc x1,t1,t1
-
- /* computed <t1,x2>. Now divide it by (2**24 - 1) */
-
- copy 0,x1
- shd,= t1,x2,24,t1 /* tentative quotient */
-LSYM(1)
- addb,tr t1,x1,LREF(2) /* add to previous quotient */
- extru x2,31,24,x2 /* new remainder (unadjusted) */
-
- MILLIRETN
-
-LSYM(2)
- addb,tr t1,x2,LREF(1) /* adjust remainder */
- extru,= x2,7,8,t1 /* new quotient */
-
-LSYM(neg7)
- subi 1,x2,x2 /* negate x2 and add 1 */
-LSYM(8)
- shd 0,x2,29,x1
- sh3add x2,x2,x2
- addc x1,0,x1
-
-LSYM(neg7_shift)
- shd x1,x2,26,t1
- shd x2,0,26,t2
- add x2,t2,x2
- addc x1,t1,x1
-
- shd x1,x2,20,t1
- shd x2,0,20,t2
- add x2,t2,x2
- addc x1,t1,t1
-
- /* computed <t1,x2>. Now divide it by (2**24 - 1) */
-
- copy 0,x1
- shd,= t1,x2,24,t1 /* tentative quotient */
-LSYM(3)
- addb,tr t1,x1,LREF(4) /* add to previous quotient */
- extru x2,31,24,x2 /* new remainder (unadjusted) */
-
- MILLIRET
- sub 0,x1,x1 /* negate result */
-
-LSYM(4)
- addb,tr t1,x2,LREF(3) /* adjust remainder */
- extru,= x2,7,8,t1 /* new quotient */
-
-GSYM($$divU_7)
- .export $$divU_7,millicode
- addi 1,x2,x2 /* can carry */
- addc 0,0,x1
- shd x1,x2,29,t1
- sh3add x2,x2,x2
- b LREF(pos7)
- addc t1,x1,x1
-
-/* DIVISION BY 9 (use z = 2**24-1; a = 1c71c7) */
-GSYM($$divI_9)
- .export $$divI_9,millicode
- comb,<,n x2,0,LREF(neg9)
- addi 1,x2,x2 /* cannot overflow */
- shd 0,x2,29,t1
- shd x2,0,29,t2
- sub t2,x2,x2
- b LREF(pos7)
- subb t1,0,x1
-
-LSYM(neg9)
- subi 1,x2,x2 /* negate and add 1 */
- shd 0,x2,29,t1
- shd x2,0,29,t2
- sub t2,x2,x2
- b LREF(neg7_shift)
- subb t1,0,x1
-
-GSYM($$divU_9)
- .export $$divU_9,millicode
- addi 1,x2,x2 /* can carry */
- addc 0,0,x1
- shd x1,x2,29,t1
- shd x2,0,29,t2
- sub t2,x2,x2
- b LREF(pos7)
- subb t1,x1,x1
-
-/* DIVISION BY 14 (shift to divide by 2 then divide by 7) */
-GSYM($$divI_14)
- .export $$divI_14,millicode
- comb,<,n x2,0,LREF(neg14)
-GSYM($$divU_14)
- .export $$divU_14,millicode
- b LREF(7) /* go to 7 case */
- extru x2,30,31,x2 /* divide by 2 */
-
-LSYM(neg14)
- subi 2,x2,x2 /* negate (and add 2) */
- b LREF(8)
- extru x2,30,31,x2 /* divide by 2 */
- .exit
- .procend
- .end
-#endif
-
-#ifdef L_mulI
-/* VERSION "@(#)$$mulI $ Revision: 12.4 $ $ Date: 94/03/17 17:18:51 $" */
-/******************************************************************************
-This routine is used on PA2.0 processors when gcc -mno-fpregs is used
-
-ROUTINE: $$mulI
-
-
-DESCRIPTION:
-
- $$mulI multiplies two single word integers, giving a single
- word result.
-
-
-INPUT REGISTERS:
-
- arg0 = Operand 1
- arg1 = Operand 2
- r31 == return pc
- sr0 == return space when called externally
-
-
-OUTPUT REGISTERS:
-
- arg0 = undefined
- arg1 = undefined
- ret1 = result
-
-OTHER REGISTERS AFFECTED:
-
- r1 = undefined
-
-SIDE EFFECTS:
-
- Causes a trap under the following conditions: NONE
- Changes memory at the following places: NONE
-
-PERMISSIBLE CONTEXT:
-
- Unwindable
- Does not create a stack frame
- Is usable for internal or external microcode
-
-DISCUSSION:
-
- Calls other millicode routines via mrp: NONE
- Calls other millicode routines: NONE
-
-***************************************************************************/
-
-
-#define a0 %arg0
-#define a1 %arg1
-#define t0 %r1
-#define r %ret1
-
-#define a0__128a0 zdep a0,24,25,a0
-#define a0__256a0 zdep a0,23,24,a0
-#define a1_ne_0_b_l0 comb,<> a1,0,LREF(l0)
-#define a1_ne_0_b_l1 comb,<> a1,0,LREF(l1)
-#define a1_ne_0_b_l2 comb,<> a1,0,LREF(l2)
-#define b_n_ret_t0 b,n LREF(ret_t0)
-#define b_e_shift b LREF(e_shift)
-#define b_e_t0ma0 b LREF(e_t0ma0)
-#define b_e_t0 b LREF(e_t0)
-#define b_e_t0a0 b LREF(e_t0a0)
-#define b_e_t02a0 b LREF(e_t02a0)
-#define b_e_t04a0 b LREF(e_t04a0)
-#define b_e_2t0 b LREF(e_2t0)
-#define b_e_2t0a0 b LREF(e_2t0a0)
-#define b_e_2t04a0 b LREF(e2t04a0)
-#define b_e_3t0 b LREF(e_3t0)
-#define b_e_4t0 b LREF(e_4t0)
-#define b_e_4t0a0 b LREF(e_4t0a0)
-#define b_e_4t08a0 b LREF(e4t08a0)
-#define b_e_5t0 b LREF(e_5t0)
-#define b_e_8t0 b LREF(e_8t0)
-#define b_e_8t0a0 b LREF(e_8t0a0)
-#define r__r_a0 add r,a0,r
-#define r__r_2a0 sh1add a0,r,r
-#define r__r_4a0 sh2add a0,r,r
-#define r__r_8a0 sh3add a0,r,r
-#define r__r_t0 add r,t0,r
-#define r__r_2t0 sh1add t0,r,r
-#define r__r_4t0 sh2add t0,r,r
-#define r__r_8t0 sh3add t0,r,r
-#define t0__3a0 sh1add a0,a0,t0
-#define t0__4a0 sh2add a0,0,t0
-#define t0__5a0 sh2add a0,a0,t0
-#define t0__8a0 sh3add a0,0,t0
-#define t0__9a0 sh3add a0,a0,t0
-#define t0__16a0 zdep a0,27,28,t0
-#define t0__32a0 zdep a0,26,27,t0
-#define t0__64a0 zdep a0,25,26,t0
-#define t0__128a0 zdep a0,24,25,t0
-#define t0__t0ma0 sub t0,a0,t0
-#define t0__t0_a0 add t0,a0,t0
-#define t0__t0_2a0 sh1add a0,t0,t0
-#define t0__t0_4a0 sh2add a0,t0,t0
-#define t0__t0_8a0 sh3add a0,t0,t0
-#define t0__2t0_a0 sh1add t0,a0,t0
-#define t0__3t0 sh1add t0,t0,t0
-#define t0__4t0 sh2add t0,0,t0
-#define t0__4t0_a0 sh2add t0,a0,t0
-#define t0__5t0 sh2add t0,t0,t0
-#define t0__8t0 sh3add t0,0,t0
-#define t0__8t0_a0 sh3add t0,a0,t0
-#define t0__9t0 sh3add t0,t0,t0
-#define t0__16t0 zdep t0,27,28,t0
-#define t0__32t0 zdep t0,26,27,t0
-#define t0__256a0 zdep a0,23,24,t0
-
-
- SUBSPA_MILLI
- ATTR_MILLI
- .align 16
- .proc
- .callinfo millicode
- .export $$mulI,millicode
-GSYM($$mulI)
- combt,<<= a1,a0,LREF(l4) /* swap args if unsigned a1>a0 */
- copy 0,r /* zero out the result */
- xor a0,a1,a0 /* swap a0 & a1 using the */
- xor a0,a1,a1 /* old xor trick */
- xor a0,a1,a0
-LSYM(l4)
- combt,<= 0,a0,LREF(l3) /* if a0>=0 then proceed like unsigned */
- zdep a1,30,8,t0 /* t0 = (a1&0xff)<<1 ********* */
- sub,> 0,a1,t0 /* otherwise negate both and */
- combt,<=,n a0,t0,LREF(l2) /* swap back if |a0|<|a1| */
- sub 0,a0,a1
- movb,tr,n t0,a0,LREF(l2) /* 10th inst. */
-
-LSYM(l0) r__r_t0 /* add in this partial product */
-LSYM(l1) a0__256a0 /* a0 <<= 8 ****************** */
-LSYM(l2) zdep a1,30,8,t0 /* t0 = (a1&0xff)<<1 ********* */
-LSYM(l3) blr t0,0 /* case on these 8 bits ****** */
- extru a1,23,24,a1 /* a1 >>= 8 ****************** */
-
-/*16 insts before this. */
-/* a0 <<= 8 ************************** */
-LSYM(x0) a1_ne_0_b_l2 ! a0__256a0 ! MILLIRETN ! nop
-LSYM(x1) a1_ne_0_b_l1 ! r__r_a0 ! MILLIRETN ! nop
-LSYM(x2) a1_ne_0_b_l1 ! r__r_2a0 ! MILLIRETN ! nop
-LSYM(x3) a1_ne_0_b_l0 ! t0__3a0 ! MILLIRET ! r__r_t0
-LSYM(x4) a1_ne_0_b_l1 ! r__r_4a0 ! MILLIRETN ! nop
-LSYM(x5) a1_ne_0_b_l0 ! t0__5a0 ! MILLIRET ! r__r_t0
-LSYM(x6) t0__3a0 ! a1_ne_0_b_l1 ! r__r_2t0 ! MILLIRETN
-LSYM(x7) t0__3a0 ! a1_ne_0_b_l0 ! r__r_4a0 ! b_n_ret_t0
-LSYM(x8) a1_ne_0_b_l1 ! r__r_8a0 ! MILLIRETN ! nop
-LSYM(x9) a1_ne_0_b_l0 ! t0__9a0 ! MILLIRET ! r__r_t0
-LSYM(x10) t0__5a0 ! a1_ne_0_b_l1 ! r__r_2t0 ! MILLIRETN
-LSYM(x11) t0__3a0 ! a1_ne_0_b_l0 ! r__r_8a0 ! b_n_ret_t0
-LSYM(x12) t0__3a0 ! a1_ne_0_b_l1 ! r__r_4t0 ! MILLIRETN
-LSYM(x13) t0__5a0 ! a1_ne_0_b_l0 ! r__r_8a0 ! b_n_ret_t0
-LSYM(x14) t0__3a0 ! t0__2t0_a0 ! b_e_shift ! r__r_2t0
-LSYM(x15) t0__5a0 ! a1_ne_0_b_l0 ! t0__3t0 ! b_n_ret_t0
-LSYM(x16) t0__16a0 ! a1_ne_0_b_l1 ! r__r_t0 ! MILLIRETN
-LSYM(x17) t0__9a0 ! a1_ne_0_b_l0 ! t0__t0_8a0 ! b_n_ret_t0
-LSYM(x18) t0__9a0 ! a1_ne_0_b_l1 ! r__r_2t0 ! MILLIRETN
-LSYM(x19) t0__9a0 ! a1_ne_0_b_l0 ! t0__2t0_a0 ! b_n_ret_t0
-LSYM(x20) t0__5a0 ! a1_ne_0_b_l1 ! r__r_4t0 ! MILLIRETN
-LSYM(x21) t0__5a0 ! a1_ne_0_b_l0 ! t0__4t0_a0 ! b_n_ret_t0
-LSYM(x22) t0__5a0 ! t0__2t0_a0 ! b_e_shift ! r__r_2t0
-LSYM(x23) t0__5a0 ! t0__2t0_a0 ! b_e_t0 ! t0__2t0_a0
-LSYM(x24) t0__3a0 ! a1_ne_0_b_l1 ! r__r_8t0 ! MILLIRETN
-LSYM(x25) t0__5a0 ! a1_ne_0_b_l0 ! t0__5t0 ! b_n_ret_t0
-LSYM(x26) t0__3a0 ! t0__4t0_a0 ! b_e_shift ! r__r_2t0
-LSYM(x27) t0__3a0 ! a1_ne_0_b_l0 ! t0__9t0 ! b_n_ret_t0
-LSYM(x28) t0__3a0 ! t0__2t0_a0 ! b_e_shift ! r__r_4t0
-LSYM(x29) t0__3a0 ! t0__2t0_a0 ! b_e_t0 ! t0__4t0_a0
-LSYM(x30) t0__5a0 ! t0__3t0 ! b_e_shift ! r__r_2t0
-LSYM(x31) t0__32a0 ! a1_ne_0_b_l0 ! t0__t0ma0 ! b_n_ret_t0
-LSYM(x32) t0__32a0 ! a1_ne_0_b_l1 ! r__r_t0 ! MILLIRETN
-LSYM(x33) t0__8a0 ! a1_ne_0_b_l0 ! t0__4t0_a0 ! b_n_ret_t0
-LSYM(x34) t0__16a0 ! t0__t0_a0 ! b_e_shift ! r__r_2t0
-LSYM(x35) t0__9a0 ! t0__3t0 ! b_e_t0 ! t0__t0_8a0
-LSYM(x36) t0__9a0 ! a1_ne_0_b_l1 ! r__r_4t0 ! MILLIRETN
-LSYM(x37) t0__9a0 ! a1_ne_0_b_l0 ! t0__4t0_a0 ! b_n_ret_t0
-LSYM(x38) t0__9a0 ! t0__2t0_a0 ! b_e_shift ! r__r_2t0
-LSYM(x39) t0__9a0 ! t0__2t0_a0 ! b_e_t0 ! t0__2t0_a0
-LSYM(x40) t0__5a0 ! a1_ne_0_b_l1 ! r__r_8t0 ! MILLIRETN
-LSYM(x41) t0__5a0 ! a1_ne_0_b_l0 ! t0__8t0_a0 ! b_n_ret_t0
-LSYM(x42) t0__5a0 ! t0__4t0_a0 ! b_e_shift ! r__r_2t0
-LSYM(x43) t0__5a0 ! t0__4t0_a0 ! b_e_t0 ! t0__2t0_a0
-LSYM(x44) t0__5a0 ! t0__2t0_a0 ! b_e_shift ! r__r_4t0
-LSYM(x45) t0__9a0 ! a1_ne_0_b_l0 ! t0__5t0 ! b_n_ret_t0
-LSYM(x46) t0__9a0 ! t0__5t0 ! b_e_t0 ! t0__t0_a0
-LSYM(x47) t0__9a0 ! t0__5t0 ! b_e_t0 ! t0__t0_2a0
-LSYM(x48) t0__3a0 ! a1_ne_0_b_l0 ! t0__16t0 ! b_n_ret_t0
-LSYM(x49) t0__9a0 ! t0__5t0 ! b_e_t0 ! t0__t0_4a0
-LSYM(x50) t0__5a0 ! t0__5t0 ! b_e_shift ! r__r_2t0
-LSYM(x51) t0__9a0 ! t0__t0_8a0 ! b_e_t0 ! t0__3t0
-LSYM(x52) t0__3a0 ! t0__4t0_a0 ! b_e_shift ! r__r_4t0
-LSYM(x53) t0__3a0 ! t0__4t0_a0 ! b_e_t0 ! t0__4t0_a0
-LSYM(x54) t0__9a0 ! t0__3t0 ! b_e_shift ! r__r_2t0
-LSYM(x55) t0__9a0 ! t0__3t0 ! b_e_t0 ! t0__2t0_a0
-LSYM(x56) t0__3a0 ! t0__2t0_a0 ! b_e_shift ! r__r_8t0
-LSYM(x57) t0__9a0 ! t0__2t0_a0 ! b_e_t0 ! t0__3t0
-LSYM(x58) t0__3a0 ! t0__2t0_a0 ! b_e_2t0 ! t0__4t0_a0
-LSYM(x59) t0__9a0 ! t0__2t0_a0 ! b_e_t02a0 ! t0__3t0
-LSYM(x60) t0__5a0 ! t0__3t0 ! b_e_shift ! r__r_4t0
-LSYM(x61) t0__5a0 ! t0__3t0 ! b_e_t0 ! t0__4t0_a0
-LSYM(x62) t0__32a0 ! t0__t0ma0 ! b_e_shift ! r__r_2t0
-LSYM(x63) t0__64a0 ! a1_ne_0_b_l0 ! t0__t0ma0 ! b_n_ret_t0
-LSYM(x64) t0__64a0 ! a1_ne_0_b_l1 ! r__r_t0 ! MILLIRETN
-LSYM(x65) t0__8a0 ! a1_ne_0_b_l0 ! t0__8t0_a0 ! b_n_ret_t0
-LSYM(x66) t0__32a0 ! t0__t0_a0 ! b_e_shift ! r__r_2t0
-LSYM(x67) t0__8a0 ! t0__4t0_a0 ! b_e_t0 ! t0__2t0_a0
-LSYM(x68) t0__8a0 ! t0__2t0_a0 ! b_e_shift ! r__r_4t0
-LSYM(x69) t0__8a0 ! t0__2t0_a0 ! b_e_t0 ! t0__4t0_a0
-LSYM(x70) t0__64a0 ! t0__t0_4a0 ! b_e_t0 ! t0__t0_2a0
-LSYM(x71) t0__9a0 ! t0__8t0 ! b_e_t0 ! t0__t0ma0
-LSYM(x72) t0__9a0 ! a1_ne_0_b_l1 ! r__r_8t0 ! MILLIRETN
-LSYM(x73) t0__9a0 ! t0__8t0_a0 ! b_e_shift ! r__r_t0
-LSYM(x74) t0__9a0 ! t0__4t0_a0 ! b_e_shift ! r__r_2t0
-LSYM(x75) t0__9a0 ! t0__4t0_a0 ! b_e_t0 ! t0__2t0_a0
-LSYM(x76) t0__9a0 ! t0__2t0_a0 ! b_e_shift ! r__r_4t0
-LSYM(x77) t0__9a0 ! t0__2t0_a0 ! b_e_t0 ! t0__4t0_a0
-LSYM(x78) t0__9a0 ! t0__2t0_a0 ! b_e_2t0 ! t0__2t0_a0
-LSYM(x79) t0__16a0 ! t0__5t0 ! b_e_t0 ! t0__t0ma0
-LSYM(x80) t0__16a0 ! t0__5t0 ! b_e_shift ! r__r_t0
-LSYM(x81) t0__9a0 ! t0__9t0 ! b_e_shift ! r__r_t0
-LSYM(x82) t0__5a0 ! t0__8t0_a0 ! b_e_shift ! r__r_2t0
-LSYM(x83) t0__5a0 ! t0__8t0_a0 ! b_e_t0 ! t0__2t0_a0
-LSYM(x84) t0__5a0 ! t0__4t0_a0 ! b_e_shift ! r__r_4t0
-LSYM(x85) t0__8a0 ! t0__2t0_a0 ! b_e_t0 ! t0__5t0
-LSYM(x86) t0__5a0 ! t0__4t0_a0 ! b_e_2t0 ! t0__2t0_a0
-LSYM(x87) t0__9a0 ! t0__9t0 ! b_e_t02a0 ! t0__t0_4a0
-LSYM(x88) t0__5a0 ! t0__2t0_a0 ! b_e_shift ! r__r_8t0
-LSYM(x89) t0__5a0 ! t0__2t0_a0 ! b_e_t0 ! t0__8t0_a0
-LSYM(x90) t0__9a0 ! t0__5t0 ! b_e_shift ! r__r_2t0
-LSYM(x91) t0__9a0 ! t0__5t0 ! b_e_t0 ! t0__2t0_a0
-LSYM(x92) t0__5a0 ! t0__2t0_a0 ! b_e_4t0 ! t0__2t0_a0
-LSYM(x93) t0__32a0 ! t0__t0ma0 ! b_e_t0 ! t0__3t0
-LSYM(x94) t0__9a0 ! t0__5t0 ! b_e_2t0 ! t0__t0_2a0
-LSYM(x95) t0__9a0 ! t0__2t0_a0 ! b_e_t0 ! t0__5t0
-LSYM(x96) t0__8a0 ! t0__3t0 ! b_e_shift ! r__r_4t0
-LSYM(x97) t0__8a0 ! t0__3t0 ! b_e_t0 ! t0__4t0_a0
-LSYM(x98) t0__32a0 ! t0__3t0 ! b_e_t0 ! t0__t0_2a0
-LSYM(x99) t0__8a0 ! t0__4t0_a0 ! b_e_t0 ! t0__3t0
-LSYM(x100) t0__5a0 ! t0__5t0 ! b_e_shift ! r__r_4t0
-LSYM(x101) t0__5a0 ! t0__5t0 ! b_e_t0 ! t0__4t0_a0
-LSYM(x102) t0__32a0 ! t0__t0_2a0 ! b_e_t0 ! t0__3t0
-LSYM(x103) t0__5a0 ! t0__5t0 ! b_e_t02a0 ! t0__4t0_a0
-LSYM(x104) t0__3a0 ! t0__4t0_a0 ! b_e_shift ! r__r_8t0
-LSYM(x105) t0__5a0 ! t0__4t0_a0 ! b_e_t0 ! t0__5t0
-LSYM(x106) t0__3a0 ! t0__4t0_a0 ! b_e_2t0 ! t0__4t0_a0
-LSYM(x107) t0__9a0 ! t0__t0_4a0 ! b_e_t02a0 ! t0__8t0_a0
-LSYM(x108) t0__9a0 ! t0__3t0 ! b_e_shift ! r__r_4t0
-LSYM(x109) t0__9a0 ! t0__3t0 ! b_e_t0 ! t0__4t0_a0
-LSYM(x110) t0__9a0 ! t0__3t0 ! b_e_2t0 ! t0__2t0_a0
-LSYM(x111) t0__9a0 ! t0__4t0_a0 ! b_e_t0 ! t0__3t0
-LSYM(x112) t0__3a0 ! t0__2t0_a0 ! b_e_t0 ! t0__16t0
-LSYM(x113) t0__9a0 ! t0__4t0_a0 ! b_e_t02a0 ! t0__3t0
-LSYM(x114) t0__9a0 ! t0__2t0_a0 ! b_e_2t0 ! t0__3t0
-LSYM(x115) t0__9a0 ! t0__2t0_a0 ! b_e_2t0a0 ! t0__3t0
-LSYM(x116) t0__3a0 ! t0__2t0_a0 ! b_e_4t0 ! t0__4t0_a0
-LSYM(x117) t0__3a0 ! t0__4t0_a0 ! b_e_t0 ! t0__9t0
-LSYM(x118) t0__3a0 ! t0__4t0_a0 ! b_e_t0a0 ! t0__9t0
-LSYM(x119) t0__3a0 ! t0__4t0_a0 ! b_e_t02a0 ! t0__9t0
-LSYM(x120) t0__5a0 ! t0__3t0 ! b_e_shift ! r__r_8t0
-LSYM(x121) t0__5a0 ! t0__3t0 ! b_e_t0 ! t0__8t0_a0
-LSYM(x122) t0__5a0 ! t0__3t0 ! b_e_2t0 ! t0__4t0_a0
-LSYM(x123) t0__5a0 ! t0__8t0_a0 ! b_e_t0 ! t0__3t0
-LSYM(x124) t0__32a0 ! t0__t0ma0 ! b_e_shift ! r__r_4t0
-LSYM(x125) t0__5a0 ! t0__5t0 ! b_e_t0 ! t0__5t0
-LSYM(x126) t0__64a0 ! t0__t0ma0 ! b_e_shift ! r__r_2t0
-LSYM(x127) t0__128a0 ! a1_ne_0_b_l0 ! t0__t0ma0 ! b_n_ret_t0
-LSYM(x128) t0__128a0 ! a1_ne_0_b_l1 ! r__r_t0 ! MILLIRETN
-LSYM(x129) t0__128a0 ! a1_ne_0_b_l0 ! t0__t0_a0 ! b_n_ret_t0
-LSYM(x130) t0__64a0 ! t0__t0_a0 ! b_e_shift ! r__r_2t0
-LSYM(x131) t0__8a0 ! t0__8t0_a0 ! b_e_t0 ! t0__2t0_a0
-LSYM(x132) t0__8a0 ! t0__4t0_a0 ! b_e_shift ! r__r_4t0
-LSYM(x133) t0__8a0 ! t0__4t0_a0 ! b_e_t0 ! t0__4t0_a0
-LSYM(x134) t0__8a0 ! t0__4t0_a0 ! b_e_2t0 ! t0__2t0_a0
-LSYM(x135) t0__9a0 ! t0__5t0 ! b_e_t0 ! t0__3t0
-LSYM(x136) t0__8a0 ! t0__2t0_a0 ! b_e_shift ! r__r_8t0
-LSYM(x137) t0__8a0 ! t0__2t0_a0 ! b_e_t0 ! t0__8t0_a0
-LSYM(x138) t0__8a0 ! t0__2t0_a0 ! b_e_2t0 ! t0__4t0_a0
-LSYM(x139) t0__8a0 ! t0__2t0_a0 ! b_e_2t0a0 ! t0__4t0_a0
-LSYM(x140) t0__3a0 ! t0__2t0_a0 ! b_e_4t0 ! t0__5t0
-LSYM(x141) t0__8a0 ! t0__2t0_a0 ! b_e_4t0a0 ! t0__2t0_a0
-LSYM(x142) t0__9a0 ! t0__8t0 ! b_e_2t0 ! t0__t0ma0
-LSYM(x143) t0__16a0 ! t0__9t0 ! b_e_t0 ! t0__t0ma0
-LSYM(x144) t0__9a0 ! t0__8t0 ! b_e_shift ! r__r_2t0
-LSYM(x145) t0__9a0 ! t0__8t0 ! b_e_t0 ! t0__2t0_a0
-LSYM(x146) t0__9a0 ! t0__8t0_a0 ! b_e_shift ! r__r_2t0
-LSYM(x147) t0__9a0 ! t0__8t0_a0 ! b_e_t0 ! t0__2t0_a0
-LSYM(x148) t0__9a0 ! t0__4t0_a0 ! b_e_shift ! r__r_4t0
-LSYM(x149) t0__9a0 ! t0__4t0_a0 ! b_e_t0 ! t0__4t0_a0
-LSYM(x150) t0__9a0 ! t0__4t0_a0 ! b_e_2t0 ! t0__2t0_a0
-LSYM(x151) t0__9a0 ! t0__4t0_a0 ! b_e_2t0a0 ! t0__2t0_a0
-LSYM(x152) t0__9a0 ! t0__2t0_a0 ! b_e_shift ! r__r_8t0
-LSYM(x153) t0__9a0 ! t0__2t0_a0 ! b_e_t0 ! t0__8t0_a0
-LSYM(x154) t0__9a0 ! t0__2t0_a0 ! b_e_2t0 ! t0__4t0_a0
-LSYM(x155) t0__32a0 ! t0__t0ma0 ! b_e_t0 ! t0__5t0
-LSYM(x156) t0__9a0 ! t0__2t0_a0 ! b_e_4t0 ! t0__2t0_a0
-LSYM(x157) t0__32a0 ! t0__t0ma0 ! b_e_t02a0 ! t0__5t0
-LSYM(x158) t0__16a0 ! t0__5t0 ! b_e_2t0 ! t0__t0ma0
-LSYM(x159) t0__32a0 ! t0__5t0 ! b_e_t0 ! t0__t0ma0
-LSYM(x160) t0__5a0 ! t0__4t0 ! b_e_shift ! r__r_8t0
-LSYM(x161) t0__8a0 ! t0__5t0 ! b_e_t0 ! t0__4t0_a0
-LSYM(x162) t0__9a0 ! t0__9t0 ! b_e_shift ! r__r_2t0
-LSYM(x163) t0__9a0 ! t0__9t0 ! b_e_t0 ! t0__2t0_a0
-LSYM(x164) t0__5a0 ! t0__8t0_a0 ! b_e_shift ! r__r_4t0
-LSYM(x165) t0__8a0 ! t0__4t0_a0 ! b_e_t0 ! t0__5t0
-LSYM(x166) t0__5a0 ! t0__8t0_a0 ! b_e_2t0 ! t0__2t0_a0
-LSYM(x167) t0__5a0 ! t0__8t0_a0 ! b_e_2t0a0 ! t0__2t0_a0
-LSYM(x168) t0__5a0 ! t0__4t0_a0 ! b_e_shift ! r__r_8t0
-LSYM(x169) t0__5a0 ! t0__4t0_a0 ! b_e_t0 ! t0__8t0_a0
-LSYM(x170) t0__32a0 ! t0__t0_2a0 ! b_e_t0 ! t0__5t0
-LSYM(x171) t0__9a0 ! t0__2t0_a0 ! b_e_t0 ! t0__9t0
-LSYM(x172) t0__5a0 ! t0__4t0_a0 ! b_e_4t0 ! t0__2t0_a0
-LSYM(x173) t0__9a0 ! t0__2t0_a0 ! b_e_t02a0 ! t0__9t0
-LSYM(x174) t0__32a0 ! t0__t0_2a0 ! b_e_t04a0 ! t0__5t0
-LSYM(x175) t0__8a0 ! t0__2t0_a0 ! b_e_5t0 ! t0__2t0_a0
-LSYM(x176) t0__5a0 ! t0__4t0_a0 ! b_e_8t0 ! t0__t0_a0
-LSYM(x177) t0__5a0 ! t0__4t0_a0 ! b_e_8t0a0 ! t0__t0_a0
-LSYM(x178) t0__5a0 ! t0__2t0_a0 ! b_e_2t0 ! t0__8t0_a0
-LSYM(x179) t0__5a0 ! t0__2t0_a0 ! b_e_2t0a0 ! t0__8t0_a0
-LSYM(x180) t0__9a0 ! t0__5t0 ! b_e_shift ! r__r_4t0
-LSYM(x181) t0__9a0 ! t0__5t0 ! b_e_t0 ! t0__4t0_a0
-LSYM(x182) t0__9a0 ! t0__5t0 ! b_e_2t0 ! t0__2t0_a0
-LSYM(x183) t0__9a0 ! t0__5t0 ! b_e_2t0a0 ! t0__2t0_a0
-LSYM(x184) t0__5a0 ! t0__9t0 ! b_e_4t0 ! t0__t0_a0
-LSYM(x185) t0__9a0 ! t0__4t0_a0 ! b_e_t0 ! t0__5t0
-LSYM(x186) t0__32a0 ! t0__t0ma0 ! b_e_2t0 ! t0__3t0
-LSYM(x187) t0__9a0 ! t0__4t0_a0 ! b_e_t02a0 ! t0__5t0
-LSYM(x188) t0__9a0 ! t0__5t0 ! b_e_4t0 ! t0__t0_2a0
-LSYM(x189) t0__5a0 ! t0__4t0_a0 ! b_e_t0 ! t0__9t0
-LSYM(x190) t0__9a0 ! t0__2t0_a0 ! b_e_2t0 ! t0__5t0
-LSYM(x191) t0__64a0 ! t0__3t0 ! b_e_t0 ! t0__t0ma0
-LSYM(x192) t0__8a0 ! t0__3t0 ! b_e_shift ! r__r_8t0
-LSYM(x193) t0__8a0 ! t0__3t0 ! b_e_t0 ! t0__8t0_a0
-LSYM(x194) t0__8a0 ! t0__3t0 ! b_e_2t0 ! t0__4t0_a0
-LSYM(x195) t0__8a0 ! t0__8t0_a0 ! b_e_t0 ! t0__3t0
-LSYM(x196) t0__8a0 ! t0__3t0 ! b_e_4t0 ! t0__2t0_a0
-LSYM(x197) t0__8a0 ! t0__3t0 ! b_e_4t0a0 ! t0__2t0_a0
-LSYM(x198) t0__64a0 ! t0__t0_2a0 ! b_e_t0 ! t0__3t0
-LSYM(x199) t0__8a0 ! t0__4t0_a0 ! b_e_2t0a0 ! t0__3t0
-LSYM(x200) t0__5a0 ! t0__5t0 ! b_e_shift ! r__r_8t0
-LSYM(x201) t0__5a0 ! t0__5t0 ! b_e_t0 ! t0__8t0_a0
-LSYM(x202) t0__5a0 ! t0__5t0 ! b_e_2t0 ! t0__4t0_a0
-LSYM(x203) t0__5a0 ! t0__5t0 ! b_e_2t0a0 ! t0__4t0_a0
-LSYM(x204) t0__8a0 ! t0__2t0_a0 ! b_e_4t0 ! t0__3t0
-LSYM(x205) t0__5a0 ! t0__8t0_a0 ! b_e_t0 ! t0__5t0
-LSYM(x206) t0__64a0 ! t0__t0_4a0 ! b_e_t02a0 ! t0__3t0
-LSYM(x207) t0__8a0 ! t0__2t0_a0 ! b_e_3t0 ! t0__4t0_a0
-LSYM(x208) t0__5a0 ! t0__5t0 ! b_e_8t0 ! t0__t0_a0
-LSYM(x209) t0__5a0 ! t0__5t0 ! b_e_8t0a0 ! t0__t0_a0
-LSYM(x210) t0__5a0 ! t0__4t0_a0 ! b_e_2t0 ! t0__5t0
-LSYM(x211) t0__5a0 ! t0__4t0_a0 ! b_e_2t0a0 ! t0__5t0
-LSYM(x212) t0__3a0 ! t0__4t0_a0 ! b_e_4t0 ! t0__4t0_a0
-LSYM(x213) t0__3a0 ! t0__4t0_a0 ! b_e_4t0a0 ! t0__4t0_a0
-LSYM(x214) t0__9a0 ! t0__t0_4a0 ! b_e_2t04a0 ! t0__8t0_a0
-LSYM(x215) t0__5a0 ! t0__4t0_a0 ! b_e_5t0 ! t0__2t0_a0
-LSYM(x216) t0__9a0 ! t0__3t0 ! b_e_shift ! r__r_8t0
-LSYM(x217) t0__9a0 ! t0__3t0 ! b_e_t0 ! t0__8t0_a0
-LSYM(x218) t0__9a0 ! t0__3t0 ! b_e_2t0 ! t0__4t0_a0
-LSYM(x219) t0__9a0 ! t0__8t0_a0 ! b_e_t0 ! t0__3t0
-LSYM(x220) t0__3a0 ! t0__9t0 ! b_e_4t0 ! t0__2t0_a0
-LSYM(x221) t0__3a0 ! t0__9t0 ! b_e_4t0a0 ! t0__2t0_a0
-LSYM(x222) t0__9a0 ! t0__4t0_a0 ! b_e_2t0 ! t0__3t0
-LSYM(x223) t0__9a0 ! t0__4t0_a0 ! b_e_2t0a0 ! t0__3t0
-LSYM(x224) t0__9a0 ! t0__3t0 ! b_e_8t0 ! t0__t0_a0
-LSYM(x225) t0__9a0 ! t0__5t0 ! b_e_t0 ! t0__5t0
-LSYM(x226) t0__3a0 ! t0__2t0_a0 ! b_e_t02a0 ! t0__32t0
-LSYM(x227) t0__9a0 ! t0__5t0 ! b_e_t02a0 ! t0__5t0
-LSYM(x228) t0__9a0 ! t0__2t0_a0 ! b_e_4t0 ! t0__3t0
-LSYM(x229) t0__9a0 ! t0__2t0_a0 ! b_e_4t0a0 ! t0__3t0
-LSYM(x230) t0__9a0 ! t0__5t0 ! b_e_5t0 ! t0__t0_a0
-LSYM(x231) t0__9a0 ! t0__2t0_a0 ! b_e_3t0 ! t0__4t0_a0
-LSYM(x232) t0__3a0 ! t0__2t0_a0 ! b_e_8t0 ! t0__4t0_a0
-LSYM(x233) t0__3a0 ! t0__2t0_a0 ! b_e_8t0a0 ! t0__4t0_a0
-LSYM(x234) t0__3a0 ! t0__4t0_a0 ! b_e_2t0 ! t0__9t0
-LSYM(x235) t0__3a0 ! t0__4t0_a0 ! b_e_2t0a0 ! t0__9t0
-LSYM(x236) t0__9a0 ! t0__2t0_a0 ! b_e_4t08a0 ! t0__3t0
-LSYM(x237) t0__16a0 ! t0__5t0 ! b_e_3t0 ! t0__t0ma0
-LSYM(x238) t0__3a0 ! t0__4t0_a0 ! b_e_2t04a0 ! t0__9t0
-LSYM(x239) t0__16a0 ! t0__5t0 ! b_e_t0ma0 ! t0__3t0
-LSYM(x240) t0__9a0 ! t0__t0_a0 ! b_e_8t0 ! t0__3t0
-LSYM(x241) t0__9a0 ! t0__t0_a0 ! b_e_8t0a0 ! t0__3t0
-LSYM(x242) t0__5a0 ! t0__3t0 ! b_e_2t0 ! t0__8t0_a0
-LSYM(x243) t0__9a0 ! t0__9t0 ! b_e_t0 ! t0__3t0
-LSYM(x244) t0__5a0 ! t0__3t0 ! b_e_4t0 ! t0__4t0_a0
-LSYM(x245) t0__8a0 ! t0__3t0 ! b_e_5t0 ! t0__2t0_a0
-LSYM(x246) t0__5a0 ! t0__8t0_a0 ! b_e_2t0 ! t0__3t0
-LSYM(x247) t0__5a0 ! t0__8t0_a0 ! b_e_2t0a0 ! t0__3t0
-LSYM(x248) t0__32a0 ! t0__t0ma0 ! b_e_shift ! r__r_8t0
-LSYM(x249) t0__32a0 ! t0__t0ma0 ! b_e_t0 ! t0__8t0_a0
-LSYM(x250) t0__5a0 ! t0__5t0 ! b_e_2t0 ! t0__5t0
-LSYM(x251) t0__5a0 ! t0__5t0 ! b_e_2t0a0 ! t0__5t0
-LSYM(x252) t0__64a0 ! t0__t0ma0 ! b_e_shift ! r__r_4t0
-LSYM(x253) t0__64a0 ! t0__t0ma0 ! b_e_t0 ! t0__4t0_a0
-LSYM(x254) t0__128a0 ! t0__t0ma0 ! b_e_shift ! r__r_2t0
-LSYM(x255) t0__256a0 ! a1_ne_0_b_l0 ! t0__t0ma0 ! b_n_ret_t0
-/*1040 insts before this. */
-LSYM(ret_t0) MILLIRET
-LSYM(e_t0) r__r_t0
-LSYM(e_shift) a1_ne_0_b_l2
- a0__256a0 /* a0 <<= 8 *********** */
- MILLIRETN
-LSYM(e_t0ma0) a1_ne_0_b_l0
- t0__t0ma0
- MILLIRET
- r__r_t0
-LSYM(e_t0a0) a1_ne_0_b_l0
- t0__t0_a0
- MILLIRET
- r__r_t0
-LSYM(e_t02a0) a1_ne_0_b_l0
- t0__t0_2a0
- MILLIRET
- r__r_t0
-LSYM(e_t04a0) a1_ne_0_b_l0
- t0__t0_4a0
- MILLIRET
- r__r_t0
-LSYM(e_2t0) a1_ne_0_b_l1
- r__r_2t0
- MILLIRETN
-LSYM(e_2t0a0) a1_ne_0_b_l0
- t0__2t0_a0
- MILLIRET
- r__r_t0
-LSYM(e2t04a0) t0__t0_2a0
- a1_ne_0_b_l1
- r__r_2t0
- MILLIRETN
-LSYM(e_3t0) a1_ne_0_b_l0
- t0__3t0
- MILLIRET
- r__r_t0
-LSYM(e_4t0) a1_ne_0_b_l1
- r__r_4t0
- MILLIRETN
-LSYM(e_4t0a0) a1_ne_0_b_l0
- t0__4t0_a0
- MILLIRET
- r__r_t0
-LSYM(e4t08a0) t0__t0_2a0
- a1_ne_0_b_l1
- r__r_4t0
- MILLIRETN
-LSYM(e_5t0) a1_ne_0_b_l0
- t0__5t0
- MILLIRET
- r__r_t0
-LSYM(e_8t0) a1_ne_0_b_l1
- r__r_8t0
- MILLIRETN
-LSYM(e_8t0a0) a1_ne_0_b_l0
- t0__8t0_a0
- MILLIRET
- r__r_t0
-
- .procend
- .end
-#endif
diff --git a/gcc/config/pa/pa.c b/gcc/config/pa/pa.c
index 6d2f67d00c3..66574bad2fa 100644
--- a/gcc/config/pa/pa.c
+++ b/gcc/config/pa/pa.c
@@ -155,9 +155,7 @@ static void output_deferred_profile_counters (void) ATTRIBUTE_UNUSED;
#ifdef ASM_OUTPUT_EXTERNAL_REAL
static void pa_hpux_file_end (void);
#endif
-#if HPUX_LONG_DOUBLE_LIBRARY
-static void pa_hpux_init_libfuncs (void);
-#endif
+static void pa_init_libfuncs (void);
static rtx pa_struct_value_rtx (tree, int);
static bool pa_pass_by_reference (cumulative_args_t, enum machine_mode,
const_tree, bool);
@@ -316,10 +314,8 @@ static size_t n_deferred_plabels = 0;
#undef TARGET_MACHINE_DEPENDENT_REORG
#define TARGET_MACHINE_DEPENDENT_REORG pa_reorg
-#if HPUX_LONG_DOUBLE_LIBRARY
#undef TARGET_INIT_LIBFUNCS
-#define TARGET_INIT_LIBFUNCS pa_hpux_init_libfuncs
-#endif
+#define TARGET_INIT_LIBFUNCS pa_init_libfuncs
#undef TARGET_PROMOTE_FUNCTION_MODE
#define TARGET_PROMOTE_FUNCTION_MODE pa_promote_function_mode
@@ -5542,47 +5538,56 @@ output_deferred_plabels (void)
}
}
-#if HPUX_LONG_DOUBLE_LIBRARY
-/* Initialize optabs to point to HPUX long double emulation routines. */
+/* Initialize optabs to point to emulation routines. */
+
static void
-pa_hpux_init_libfuncs (void)
-{
- set_optab_libfunc (add_optab, TFmode, "_U_Qfadd");
- set_optab_libfunc (sub_optab, TFmode, "_U_Qfsub");
- set_optab_libfunc (smul_optab, TFmode, "_U_Qfmpy");
- set_optab_libfunc (sdiv_optab, TFmode, "_U_Qfdiv");
- set_optab_libfunc (smin_optab, TFmode, "_U_Qmin");
- set_optab_libfunc (smax_optab, TFmode, "_U_Qfmax");
- set_optab_libfunc (sqrt_optab, TFmode, "_U_Qfsqrt");
- set_optab_libfunc (abs_optab, TFmode, "_U_Qfabs");
- set_optab_libfunc (neg_optab, TFmode, "_U_Qfneg");
-
- set_optab_libfunc (eq_optab, TFmode, "_U_Qfeq");
- set_optab_libfunc (ne_optab, TFmode, "_U_Qfne");
- set_optab_libfunc (gt_optab, TFmode, "_U_Qfgt");
- set_optab_libfunc (ge_optab, TFmode, "_U_Qfge");
- set_optab_libfunc (lt_optab, TFmode, "_U_Qflt");
- set_optab_libfunc (le_optab, TFmode, "_U_Qfle");
- set_optab_libfunc (unord_optab, TFmode, "_U_Qfunord");
-
- set_conv_libfunc (sext_optab, TFmode, SFmode, "_U_Qfcnvff_sgl_to_quad");
- set_conv_libfunc (sext_optab, TFmode, DFmode, "_U_Qfcnvff_dbl_to_quad");
- set_conv_libfunc (trunc_optab, SFmode, TFmode, "_U_Qfcnvff_quad_to_sgl");
- set_conv_libfunc (trunc_optab, DFmode, TFmode, "_U_Qfcnvff_quad_to_dbl");
-
- set_conv_libfunc (sfix_optab, SImode, TFmode, TARGET_64BIT
- ? "__U_Qfcnvfxt_quad_to_sgl"
- : "_U_Qfcnvfxt_quad_to_sgl");
- set_conv_libfunc (sfix_optab, DImode, TFmode, "_U_Qfcnvfxt_quad_to_dbl");
- set_conv_libfunc (ufix_optab, SImode, TFmode, "_U_Qfcnvfxt_quad_to_usgl");
- set_conv_libfunc (ufix_optab, DImode, TFmode, "_U_Qfcnvfxt_quad_to_udbl");
-
- set_conv_libfunc (sfloat_optab, TFmode, SImode, "_U_Qfcnvxf_sgl_to_quad");
- set_conv_libfunc (sfloat_optab, TFmode, DImode, "_U_Qfcnvxf_dbl_to_quad");
- set_conv_libfunc (ufloat_optab, TFmode, SImode, "_U_Qfcnvxf_usgl_to_quad");
- set_conv_libfunc (ufloat_optab, TFmode, DImode, "_U_Qfcnvxf_udbl_to_quad");
+pa_init_libfuncs (void)
+{
+ if (HPUX_LONG_DOUBLE_LIBRARY)
+ {
+ set_optab_libfunc (add_optab, TFmode, "_U_Qfadd");
+ set_optab_libfunc (sub_optab, TFmode, "_U_Qfsub");
+ set_optab_libfunc (smul_optab, TFmode, "_U_Qfmpy");
+ set_optab_libfunc (sdiv_optab, TFmode, "_U_Qfdiv");
+ set_optab_libfunc (smin_optab, TFmode, "_U_Qmin");
+ set_optab_libfunc (smax_optab, TFmode, "_U_Qfmax");
+ set_optab_libfunc (sqrt_optab, TFmode, "_U_Qfsqrt");
+ set_optab_libfunc (abs_optab, TFmode, "_U_Qfabs");
+ set_optab_libfunc (neg_optab, TFmode, "_U_Qfneg");
+
+ set_optab_libfunc (eq_optab, TFmode, "_U_Qfeq");
+ set_optab_libfunc (ne_optab, TFmode, "_U_Qfne");
+ set_optab_libfunc (gt_optab, TFmode, "_U_Qfgt");
+ set_optab_libfunc (ge_optab, TFmode, "_U_Qfge");
+ set_optab_libfunc (lt_optab, TFmode, "_U_Qflt");
+ set_optab_libfunc (le_optab, TFmode, "_U_Qfle");
+ set_optab_libfunc (unord_optab, TFmode, "_U_Qfunord");
+
+ set_conv_libfunc (sext_optab, TFmode, SFmode, "_U_Qfcnvff_sgl_to_quad");
+ set_conv_libfunc (sext_optab, TFmode, DFmode, "_U_Qfcnvff_dbl_to_quad");
+ set_conv_libfunc (trunc_optab, SFmode, TFmode, "_U_Qfcnvff_quad_to_sgl");
+ set_conv_libfunc (trunc_optab, DFmode, TFmode, "_U_Qfcnvff_quad_to_dbl");
+
+ set_conv_libfunc (sfix_optab, SImode, TFmode,
+ TARGET_64BIT ? "__U_Qfcnvfxt_quad_to_sgl"
+ : "_U_Qfcnvfxt_quad_to_sgl");
+ set_conv_libfunc (sfix_optab, DImode, TFmode,
+ "_U_Qfcnvfxt_quad_to_dbl");
+ set_conv_libfunc (ufix_optab, SImode, TFmode,
+ "_U_Qfcnvfxt_quad_to_usgl");
+ set_conv_libfunc (ufix_optab, DImode, TFmode,
+ "_U_Qfcnvfxt_quad_to_udbl");
+
+ set_conv_libfunc (sfloat_optab, TFmode, SImode,
+ "_U_Qfcnvxf_sgl_to_quad");
+ set_conv_libfunc (sfloat_optab, TFmode, DImode,
+ "_U_Qfcnvxf_dbl_to_quad");
+ set_conv_libfunc (ufloat_optab, TFmode, SImode,
+ "_U_Qfcnvxf_usgl_to_quad");
+ set_conv_libfunc (ufloat_optab, TFmode, DImode,
+ "_U_Qfcnvxf_udbl_to_quad");
+ }
}
-#endif
/* HP's millicode routines mean something special to the assembler.
Keep track of which ones we have used. */
diff --git a/gcc/config/pa/quadlib.c b/gcc/config/pa/quadlib.c
deleted file mode 100644
index 2c1160015ed..00000000000
--- a/gcc/config/pa/quadlib.c
+++ /dev/null
@@ -1,245 +0,0 @@
-/* Subroutines for long double support.
- Copyright (C) 2000, 2002, 2004, 2005, 2006, 2009 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/>. */
-
-/* HPUX TFmode compare requires a library call to _U_Qfcmp. It takes
- a magic number as its third argument which indicates what to do.
- The return value is an integer to be compared against zero. The
- comparison conditions are the same as those listed in Table 8-12
- of the PA-RISC 2.0 Architecture book for the fcmp instruction. */
-
-/* Raise FP_INVALID on SNaN as a side effect. */
-#define QCMP_INV 1
-
-/* Comparison relations. */
-#define QCMP_UNORD 2
-#define QCMP_EQ 4
-#define QCMP_LT 8
-#define QCMP_GT 16
-
-int _U_Qfcmp (long double a, long double b, int);
-long _U_Qfcnvfxt_quad_to_sgl (long double);
-
-int _U_Qfeq (long double, long double);
-int _U_Qfne (long double, long double);
-int _U_Qfgt (long double, long double);
-int _U_Qfge (long double, long double);
-int _U_Qflt (long double, long double);
-int _U_Qfle (long double, long double);
-int _U_Qfltgt (long double, long double);
-int _U_Qfunle (long double, long double);
-int _U_Qfunlt (long double, long double);
-int _U_Qfunge (long double, long double);
-int _U_Qfungt (long double, long double);
-int _U_Qfuneq (long double, long double);
-int _U_Qfunord (long double, long double);
-int _U_Qford (long double, long double);
-
-int _U_Qfcomp (long double, long double);
-
-long double _U_Qfneg (long double);
-long double _U_Qfcopysign (long double, long double);
-
-#ifdef __LP64__
-int __U_Qfcnvfxt_quad_to_sgl (long double);
-#endif
-unsigned int _U_Qfcnvfxt_quad_to_usgl(long double);
-long double _U_Qfcnvxf_usgl_to_quad (unsigned int);
-unsigned long long _U_Qfcnvfxt_quad_to_udbl(long double);
-long double _U_Qfcnvxf_udbl_to_quad (unsigned long long);
-
-int
-_U_Qfeq (long double a, long double b)
-{
- return (_U_Qfcmp (a, b, QCMP_EQ) != 0);
-}
-
-int
-_U_Qfne (long double a, long double b)
-{
- return (_U_Qfcmp (a, b, QCMP_EQ) == 0);
-}
-
-int
-_U_Qfgt (long double a, long double b)
-{
- return (_U_Qfcmp (a, b, QCMP_INV | QCMP_GT) != 0);
-}
-
-int
-_U_Qfge (long double a, long double b)
-{
- return (_U_Qfcmp (a, b, QCMP_INV | QCMP_EQ | QCMP_GT) != 0);
-}
-
-int
-_U_Qflt (long double a, long double b)
-{
- return (_U_Qfcmp (a, b, QCMP_INV | QCMP_LT) != 0);
-}
-
-int
-_U_Qfle (long double a, long double b)
-{
- return (_U_Qfcmp (a, b, QCMP_INV | QCMP_EQ | QCMP_LT) != 0);
-}
-
-int
-_U_Qfltgt (long double a, long double b)
-{
- return (_U_Qfcmp (a, b, QCMP_INV | QCMP_LT | QCMP_GT) != 0);
-}
-
-int
-_U_Qfunle (long double a, long double b)
-{
- return (_U_Qfcmp (a, b, QCMP_INV | QCMP_UNORD | QCMP_EQ | QCMP_LT) != 0);
-}
-
-int
-_U_Qfunlt (long double a, long double b)
-{
- return (_U_Qfcmp (a, b, QCMP_INV | QCMP_UNORD | QCMP_LT) != 0);
-}
-
-int
-_U_Qfunge (long double a, long double b)
-{
- return (_U_Qfcmp (a, b, QCMP_INV | QCMP_UNORD | QCMP_EQ | QCMP_GT) != 0);
-}
-
-int
-_U_Qfungt (long double a, long double b)
-{
- return (_U_Qfcmp (a, b, QCMP_INV | QCMP_UNORD | QCMP_GT) != 0);
-}
-
-int
-_U_Qfuneq (long double a, long double b)
-{
- return (_U_Qfcmp (a, b, QCMP_INV | QCMP_UNORD | QCMP_EQ) != 0);
-}
-
-int
-_U_Qfunord (long double a, long double b)
-{
- return (_U_Qfcmp (a, b, QCMP_INV | QCMP_UNORD) != 0);
-}
-
-int
-_U_Qford (long double a, long double b)
-{
- return (_U_Qfcmp (a, b, QCMP_INV | QCMP_EQ | QCMP_LT | QCMP_GT) != 0);
-}
-
-int
-_U_Qfcomp (long double a, long double b)
-{
- if (_U_Qfcmp (a, b, QCMP_EQ) == 0)
- return 0;
-
- return (_U_Qfcmp (a, b, QCMP_UNORD | QCMP_EQ | QCMP_GT) != 0 ? 1 : -1);
-}
-
-/* Negate long double A. */
-long double
-_U_Qfneg (long double a)
-{
- union
- {
- long double ld;
- int i[4];
- } u;
-
- u.ld = a;
- u.i[0] ^= 0x80000000;
- return u.ld;
-}
-
-/* Return long double A with sign changed to sign of long double B. */
-long double
-_U_Qfcopysign (long double a, long double b)
-{
- union
- {
- long double ld;
- int i[4];
- } ua, ub;
-
- ua.ld = a;
- ub.ld = b;
- ua.i[0] &= 0x7fffffff;
- ua.i[0] |= (0x80000000 & ub.i[0]);
- return ua.ld;
-}
-
-#ifdef __LP64__
-/* This routine is only necessary for the PA64 port; for reasons unknown
- _U_Qfcnvfxt_quad_to_sgl returns the integer in the high 32bits of the
- return value. Ugh. */
-int
-__U_Qfcnvfxt_quad_to_sgl (long double a)
-{
- return _U_Qfcnvfxt_quad_to_sgl (a) >> 32;
-}
-#endif
-
-/* HP only has signed conversion in the C library, so need to synthesize
- unsigned versions. */
-unsigned int
-_U_Qfcnvfxt_quad_to_usgl (long double a)
-{
- extern long long _U_Qfcnvfxt_quad_to_dbl (long double a);
- return (unsigned int) _U_Qfcnvfxt_quad_to_dbl (a);
-}
-
-long double
-_U_Qfcnvxf_usgl_to_quad (unsigned int a)
-{
- extern long double _U_Qfcnvxf_dbl_to_quad (long long);
- return _U_Qfcnvxf_dbl_to_quad ((long long) a);
-}
-
-typedef union {
- unsigned long long u[2];
- long double d[1];
-} quad_type;
-
-unsigned long long
-_U_Qfcnvfxt_quad_to_udbl (long double a)
-{
- extern quad_type _U_Qfcnvfxt_quad_to_quad (long double a);
- quad_type u;
- u = _U_Qfcnvfxt_quad_to_quad(a);
- return u.u[1];
-}
-
-long double
-_U_Qfcnvxf_udbl_to_quad (unsigned long long a)
-{
- extern long double _U_Qfcnvxf_quad_to_quad (quad_type a);
- quad_type u;
- u.u[0] = 0;
- u.u[1] = a;
- return _U_Qfcnvxf_quad_to_quad (u);
-}
diff --git a/gcc/config/pa/stublib.c b/gcc/config/pa/stublib.c
deleted file mode 100644
index d3cf559c8ab..00000000000
--- a/gcc/config/pa/stublib.c
+++ /dev/null
@@ -1,97 +0,0 @@
-/* Stub functions.
- Copyright (C) 2006, 2009, 2010 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/>. */
-
-#ifdef L_register_frame_info
-struct object;
-void __register_frame_info (const void * __attribute__((unused)),
- struct object * __attribute__((unused)));
-void
-__register_frame_info (const void *p, struct object *ob)
-{
-}
-#endif
-
-#ifdef L_deregister_frame_info
-void *__deregister_frame_info (const void * __attribute__((unused)));
-void *
-__deregister_frame_info (const void *p)
-{
- return (void *)0;
-}
-#endif
-
-#ifdef L_cxa_finalize
-void __cxa_finalize (void * __attribute__((unused)));
-void
-__cxa_finalize (void *p)
-{
-}
-#endif
-
-#ifdef L_Jv_RegisterClasses
-void _Jv_RegisterClasses (void * __attribute__((unused)));
-void
-_Jv_RegisterClasses (void *p)
-{
-}
-#endif
-
-#ifdef L_pthread_default_stacksize_np
-int pthread_default_stacksize_np (unsigned long __attribute__((unused)),
- unsigned long *);
-int
-pthread_default_stacksize_np (unsigned long new, unsigned long *old)
-{
- if (old)
- *old = 0;
- return 0;
-}
-#endif
-
-#ifdef L_pthread_mutex_lock
-int pthread_mutex_lock (void);
-int
-pthread_mutex_lock (void)
-{
- return 0;
-}
-#endif
-
-#ifdef L_pthread_mutex_unlock
-int pthread_mutex_unlock (void);
-int
-pthread_mutex_unlock (void)
-{
- return 0;
-}
-#endif
-
-#ifdef L_pthread_once
-int pthread_once (void);
-int
-pthread_once (void)
-{
- return 0;
-}
-#endif
diff --git a/gcc/config/pa/t-dce-thr b/gcc/config/pa/t-dce-thr
index 8d86a418186..51b3abcf607 100644
--- a/gcc/config/pa/t-dce-thr
+++ b/gcc/config/pa/t-dce-thr
@@ -1,5 +1,2 @@
MULTILIB_OPTIONS = threads
MULTILIB_DIRNAMES = threads
-
-LIBGCC = stmp-multilib
-INSTALL_LIBGCC = install-multilib
diff --git a/gcc/config/pa/t-hpux-shlib b/gcc/config/pa/t-hpux-shlib
deleted file mode 100644
index d5a5b6c8609..00000000000
--- a/gcc/config/pa/t-hpux-shlib
+++ /dev/null
@@ -1,46 +0,0 @@
-# Copyright (C) 2001, 2003, 2004, 2005, 2006 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/>.
-
-# Build a shared libgcc library.
-SHLIB_EXT = .sl
-SHLIB_NAME = @shlib_base_name@$(SHLIB_EXT)
-SHLIB_SOVERSION = 1
-SHLIB_SONAME = @shlib_base_name@.$(SHLIB_SOVERSION)
-SHLIB_OBJS = @shlib_objs@
-SHLIB_DIR = @multilib_dir@
-SHLIB_SLIBDIR_QUAL = @shlib_slibdir_qual@
-
-SHLIB_LINK = $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) -shared -nodefaultlibs \
- -Wl,+h -Wl,$(SHLIB_SONAME) \
- -o $(SHLIB_DIR)/$(SHLIB_NAME).tmp @multilib_flags@ $(SHLIB_OBJS) && \
- rm -f $(SHLIB_DIR)/$(SHLIB_SONAME) && \
- if [ -f $(SHLIB_DIR)/$(SHLIB_NAME) ]; then \
- mv -f $(SHLIB_DIR)/$(SHLIB_NAME) $(SHLIB_DIR)/$(SHLIB_NAME).backup; \
- else true; fi && \
- mv $(SHLIB_DIR)/$(SHLIB_NAME).tmp $(SHLIB_DIR)/$(SHLIB_NAME) && \
- $(LN_S) $(SHLIB_NAME) $(SHLIB_DIR)/$(SHLIB_SONAME)
-
-# $(slibdir) double quoted to protect it from expansion while building
-# libgcc.mk. We want this delayed until actual install time.
-SHLIB_INSTALL = \
- $$(mkinstalldirs) $$(DESTDIR)$$(slibdir)$(SHLIB_SLIBDIR_QUAL); \
- $(INSTALL_DATA) -m 555 $(SHLIB_DIR)/$(SHLIB_NAME) \
- $$(DESTDIR)$$(slibdir)$(SHLIB_SLIBDIR_QUAL)/$(SHLIB_SONAME); \
- rm -f $$(DESTDIR)$$(slibdir)$(SHLIB_SLIBDIR_QUAL)/$(SHLIB_NAME); \
- $(LN_S) $(SHLIB_SONAME) \
- $$(DESTDIR)$$(slibdir)$(SHLIB_SLIBDIR_QUAL)/$(SHLIB_NAME)
diff --git a/gcc/config/pa/t-linux b/gcc/config/pa/t-linux
deleted file mode 100644
index fbbcfe29fd7..00000000000
--- a/gcc/config/pa/t-linux
+++ /dev/null
@@ -1,37 +0,0 @@
-# Copyright (C) 1999, 2001, 2002, 2008 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/>.
-
-#Plug millicode routines into libgcc.a We want these on both native and
-#cross compiles. We use the "64-bit" routines because the "32-bit" code
-#is broken for certain corner cases.
-
-LIB1ASMFUNCS = _divI _divU _remI _remU _div_const _mulI _dyncall
-LIB1ASMSRC = pa/milli64.S
-
-# Compile libgcc2.a as PIC.
-TARGET_LIBGCC2_CFLAGS = -fPIC -DELF=1 -DLINUX=1
-
-LIB2FUNCS_EXTRA=fptr.c
-LIB2FUNCS_STATIC_EXTRA = $(srcdir)/config/pa/linux-atomic.c
-
-fptr.c: $(srcdir)/config/pa/fptr.c
- rm -f fptr.c
- cp $(srcdir)/config/pa/fptr.c .
-
-# Compile crtbeginS.o and crtendS.o as PIC.
-CRTSTUFF_T_CFLAGS_S = -fPIC
diff --git a/gcc/config/pa/t-linux64 b/gcc/config/pa/t-linux64
deleted file mode 100644
index 1658f6d8aae..00000000000
--- a/gcc/config/pa/t-linux64
+++ /dev/null
@@ -1,32 +0,0 @@
-# Copyright (C) 2001, 2008 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/>.
-
-#Plug millicode routines into libgcc.a We want these on both native and
-#cross compiles.
-
-LIB1ASMFUNCS = _divI _divU _remI _remU _div_const _mulI
-LIB1ASMSRC = pa/milli64.S
-
-# Compile crtbeginS.o and crtendS.o as PIC.
-# Actually, hppa64 is always PIC but adding -fPIC does no harm.
-CRTSTUFF_T_CFLAGS_S = -fPIC
-
-LIB2FUNCS_STATIC_EXTRA = $(srcdir)/config/pa/linux-atomic.c
-
-# Compile libgcc2.a as PIC.
-TARGET_LIBGCC2_CFLAGS = -fPIC -Dpa64=1 -DELF=1
diff --git a/gcc/config/pa/t-pa-hpux b/gcc/config/pa/t-pa-hpux
deleted file mode 100644
index 63eab636200..00000000000
--- a/gcc/config/pa/t-pa-hpux
+++ /dev/null
@@ -1,7 +0,0 @@
-lib2funcs.asm: $(srcdir)/config/pa/lib2funcs.asm
- rm -f lib2funcs.asm
- cp $(srcdir)/config/pa/lib2funcs.asm .
-
-quadlib.c: $(srcdir)/config/pa/quadlib.c
- rm -f quadlib.c
- cp $(srcdir)/config/pa/quadlib.c .
diff --git a/gcc/config/pa/t-pa-hpux10 b/gcc/config/pa/t-pa-hpux10
deleted file mode 100644
index fd7ff484257..00000000000
--- a/gcc/config/pa/t-pa-hpux10
+++ /dev/null
@@ -1,2 +0,0 @@
-TARGET_LIBGCC2_CFLAGS = -fPIC -frandom-seed=fixed-seed -D_T_HPUX10
-LIB2FUNCS_EXTRA=lib2funcs.asm quadlib.c
diff --git a/gcc/config/pa/t-pa-hpux11 b/gcc/config/pa/t-pa-hpux11
deleted file mode 100644
index 4436b4ca640..00000000000
--- a/gcc/config/pa/t-pa-hpux11
+++ /dev/null
@@ -1,31 +0,0 @@
-TARGET_LIBGCC2_CFLAGS = -fPIC -frandom-seed=fixed-seed
-LIB2FUNCS_EXTRA=lib2funcs.asm quadlib.c
-LIBGCCSTUB_OBJS = pthread_default_stacksize_np-stub.o \
- pthread_mutex_lock-stub.o \
- pthread_mutex_unlock-stub.o \
- pthread_once-stub.o
-
-stublib.c: $(srcdir)/config/pa/stublib.c
- rm -f stublib.c
- cp $(srcdir)/config/pa/stublib.c .
-
-pthread_default_stacksize_np-stub.o: stublib.c $(GCC_PASSES)
- $(GCC_FOR_TARGET) -c -O2 -DL_pthread_default_stacksize_np stublib.c \
- -o pthread_default_stacksize_np-stub.o
-
-pthread_mutex_lock-stub.o: stublib.c $(GCC_PASSES)
- $(GCC_FOR_TARGET) -c -O2 -DL_pthread_mutex_lock stublib.c \
- -o pthread_mutex_lock-stub.o
-
-pthread_mutex_unlock-stub.o: stublib.c $(GCC_PASSES)
- $(GCC_FOR_TARGET) -c -O2 -DL_pthread_mutex_unlock stublib.c \
- -o pthread_mutex_unlock-stub.o
-
-pthread_once-stub.o: stublib.c $(GCC_PASSES)
- $(GCC_FOR_TARGET) -c -O2 -DL_pthread_once stublib.c \
- -o pthread_once-stub.o
-
-$(T)libgcc_stub.a: $(LIBGCCSTUB_OBJS)
- -rm -rf $(T)libgcc_stub.a
- $(AR) rc $(T)libgcc_stub.a $(LIBGCCSTUB_OBJS)
- $(RANLIB) $(T)libgcc_stub.a
diff --git a/gcc/config/pa/t-pa64 b/gcc/config/pa/t-pa64
deleted file mode 100644
index e6ac7a5bb7d..00000000000
--- a/gcc/config/pa/t-pa64
+++ /dev/null
@@ -1,67 +0,0 @@
-# Copyright (C) 2000, 2001, 2002, 2004, 2006,
-# 2007, 2010 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/>.
-
-TARGET_LIBGCC2_CFLAGS = -fPIC -Dpa64=1 -DELF=1 -mlong-calls
-LIB2FUNCS_EXTRA = quadlib.c
-LIBGCCSTUB_OBJS = rfi-stub.o dfi-stub.o jvrc-stub.o cxaf-stub.o \
- pthread_default_stacksize_np-stub.o \
- pthread_mutex_lock-stub.o \
- pthread_mutex_unlock-stub.o \
- pthread_once-stub.o
-
-stublib.c: $(srcdir)/config/pa/stublib.c
- rm -f stublib.c
- cp $(srcdir)/config/pa/stublib.c .
-
-rfi-stub.o: stublib.c $(GCC_PASSES)
- $(GCC_FOR_TARGET) -c -O2 -DL_register_frame_info stublib.c \
- -o rfi-stub.o
-
-dfi-stub.o: stublib.c $(GCC_PASSES)
- $(GCC_FOR_TARGET) -c -O2 -DL_deregister_frame_info stublib.c \
- -o dfi-stub.o
-
-cxaf-stub.o: stublib.c $(GCC_PASSES)
- $(GCC_FOR_TARGET) -c -O2 -DL_cxa_finalize stublib.c \
- -o cxaf-stub.o
-
-jvrc-stub.o: stublib.c $(GCC_PASSES)
- $(GCC_FOR_TARGET) -c -O2 -DL_Jv_RegisterClasses stublib.c \
- -o jvrc-stub.o
-
-pthread_default_stacksize_np-stub.o: stublib.c $(GCC_PASSES)
- $(GCC_FOR_TARGET) -c -O2 -DL_pthread_default_stacksize_np stublib.c \
- -o pthread_default_stacksize_np-stub.o
-
-pthread_mutex_lock-stub.o: stublib.c $(GCC_PASSES)
- $(GCC_FOR_TARGET) -c -O2 -DL_pthread_mutex_lock stublib.c \
- -o pthread_mutex_lock-stub.o
-
-pthread_mutex_unlock-stub.o: stublib.c $(GCC_PASSES)
- $(GCC_FOR_TARGET) -c -O2 -DL_pthread_mutex_unlock stublib.c \
- -o pthread_mutex_unlock-stub.o
-
-pthread_once-stub.o: stublib.c $(GCC_PASSES)
- $(GCC_FOR_TARGET) -c -O2 -DL_pthread_once stublib.c \
- -o pthread_once-stub.o
-
-$(T)libgcc_stub.a: $(LIBGCCSTUB_OBJS)
- -rm -rf $(T)libgcc_stub.a
- $(AR) rc $(T)libgcc_stub.a $(LIBGCCSTUB_OBJS)
- $(RANLIB) $(T)libgcc_stub.a
diff --git a/gcc/config/pa/t-slibgcc-dwarf-ver b/gcc/config/pa/t-slibgcc-dwarf-ver
deleted file mode 100644
index fa4688d6994..00000000000
--- a/gcc/config/pa/t-slibgcc-dwarf-ver
+++ /dev/null
@@ -1,3 +0,0 @@
-# Set the version number of the shared libgcc library (DWARF2 EH).
-
-SHLIB_SOVERSION = 4
diff --git a/gcc/config/pa/t-slibgcc-sjlj-ver b/gcc/config/pa/t-slibgcc-sjlj-ver
deleted file mode 100644
index 00140cf204f..00000000000
--- a/gcc/config/pa/t-slibgcc-sjlj-ver
+++ /dev/null
@@ -1,3 +0,0 @@
-# Set the version number of the shared libgcc library (SJLJ EH).
-
-SHLIB_SOVERSION = 3
diff --git a/gcc/config/pdp11/t-pdp11 b/gcc/config/pdp11/t-pdp11
index 032084b381b..c0287d50da2 100644
--- a/gcc/config/pdp11/t-pdp11
+++ b/gcc/config/pdp11/t-pdp11
@@ -17,11 +17,6 @@
# along with GCC; see the file COPYING3. If not see
# <http://www.gnu.org/licenses/>.
-TARGET_LIBGCC2_CFLAGS = -O2 -mfloat32
-LIB2FUNCS_EXTRA = $(srcdir)/config/udivmod.c $(srcdir)/config/udivmodsi4.c \
- $(srcdir)/config/memcmp.c $(srcdir)/config/memcpy.c \
- $(srcdir)/config/memmove.c $(srcdir)/config/memset.c
-
MULTILIB_OPTIONS = msoft-float
# Because the pdp11 POINTER_SIZE is only 16, in dwarf2out.c,
diff --git a/gcc/config/picochip/libgccExtras/adddi3.asm b/gcc/config/picochip/libgccExtras/adddi3.asm
deleted file mode 100644
index 77373ed9f64..00000000000
--- a/gcc/config/picochip/libgccExtras/adddi3.asm
+++ /dev/null
@@ -1,194 +0,0 @@
-// picoChip ASM file
-//
-// Support for 64-bit addition.
-//
-// Copyright (C) 2003, 2004, 2005, 2008, 2009 Free Software Foundation, Inc.
-// Contributed by Picochip Ltd.
-// Maintained by Hariharan Sandanagobalane (hariharan@picochip.com)
-//
-// This file is free software; you can redistribute it and/or modify it
-// under the terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 3, or (at your option) any
-// later version.
-//
-// This file 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/>.
-
-.section .text
-
-.align 8
-.global __adddi3
-__adddi3:
-_picoMark_FUNCTION_BEGIN=
-
-// picoChip Function Prologue : &__adddi3 = 12 bytes
-
- // The first operand of add is completely in registers r[2-5]
- // The second operand of sub is in stack FP(0-3)
- // and result need to be written pointed to by the register r0.
- // All we need to do is to load the appropriate values, add them
- // appropriately (with add or addc ) and then store the values back.
-
- ldw (FP)0, r1
- stl r[7:6], (FP)-1
- add.0 r2, r1, r6
- ldw (FP)1, r1
- addc.0 r3, r1, r7
- ldl (FP)1, r[3:2]
- stl r[7:6], (r0)0
- addc.0 r4, r2, r6
- addc.0 r5, r3, r7
- stl r[7:6], (r0)1
- jr (r12)
-=-> ldl (FP)-1, r[7:6]
-
-_picoMark_FUNCTION_END=
-
-// picoChip Function Epilogue : __adddi3
-
-
-//============================================================================
-// All DWARF information between this marker, and the END OF DWARF
-// marker should be included in the source file. Search for
-// FUNCTION_STACK_SIZE_GOES_HERE and FUNCTION NAME GOES HERE, and
-// provide the relevent information. Add markers called
-// _picoMark_FUNCTION_BEGIN and _picoMark_FUNCTION_END around the
-// function in question.
-//============================================================================
-
-//============================================================================
-// Frame information.
-//============================================================================
-
-.section .debug_frame
-_picoMark_DebugFrame=
-
-// Common CIE header.
-.unalignedInitLong _picoMark_CieEnd-_picoMark_CieBegin
-_picoMark_CieBegin=
-.unalignedInitLong 0xffffffff
-.initByte 0x1 // CIE Version
-.ascii 16#0# // CIE Augmentation
-.uleb128 0x1 // CIE Code Alignment Factor
-.sleb128 2 // CIE Data Alignment Factor
-.initByte 0xc // CIE RA Column
-.initByte 0xc // DW_CFA_def_cfa
-.uleb128 0xd
-.uleb128 0x0
-.align 2
-_picoMark_CieEnd=
-
-// FDE
-_picoMark_LSFDE0I900821033007563=
-.unalignedInitLong _picoMark_FdeEnd-_picoMark_FdeBegin
-_picoMark_FdeBegin=
-.unalignedInitLong _picoMark_DebugFrame // FDE CIE offset
-.unalignedInitWord _picoMark_FUNCTION_BEGIN // FDE initial location
-.unalignedInitWord _picoMark_FUNCTION_END-_picoMark_FUNCTION_BEGIN
-.initByte 0xe // DW_CFA_def_cfa_offset
-.uleb128 0xe // <-- FUNCTION_STACK_SIZE_GOES_HERE
-.initByte 0x4 // DW_CFA_advance_loc4
-.unalignedInitLong _picoMark_FUNCTION_END-_picoMark_FUNCTION_BEGIN
-.initByte 0xe // DW_CFA_def_cfa_offset
-.uleb128 0x0
-.align 2
-_picoMark_FdeEnd=
-
-//============================================================================
-// Abbrevation information.
-//============================================================================
-
-.section .debug_abbrev
-_picoMark_ABBREVIATIONS=
-
-.section .debug_abbrev
- .uleb128 0x1 // (abbrev code)
- .uleb128 0x11 // (TAG: DW_TAG_compile_unit)
- .initByte 0x1 // DW_children_yes
- .uleb128 0x10 // (DW_AT_stmt_list)
- .uleb128 0x6 // (DW_FORM_data4)
- .uleb128 0x12 // (DW_AT_high_pc)
- .uleb128 0x1 // (DW_FORM_addr)
- .uleb128 0x11 // (DW_AT_low_pc)
- .uleb128 0x1 // (DW_FORM_addr)
- .uleb128 0x25 // (DW_AT_producer)
- .uleb128 0x8 // (DW_FORM_string)
- .uleb128 0x13 // (DW_AT_language)
- .uleb128 0x5 // (DW_FORM_data2)
- .uleb128 0x3 // (DW_AT_name)
- .uleb128 0x8 // (DW_FORM_string)
-.initByte 0x0
-.initByte 0x0
-
- .uleb128 0x2 ;# (abbrev code)
- .uleb128 0x2e ;# (TAG: DW_TAG_subprogram)
-.initByte 0x0 ;# DW_children_no
- .uleb128 0x3 ;# (DW_AT_name)
- .uleb128 0x8 ;# (DW_FORM_string)
- .uleb128 0x11 ;# (DW_AT_low_pc)
- .uleb128 0x1 ;# (DW_FORM_addr)
- .uleb128 0x12 ;# (DW_AT_high_pc)
- .uleb128 0x1 ;# (DW_FORM_addr)
-.initByte 0x0
-.initByte 0x0
-
-.initByte 0x0
-
-//============================================================================
-// Line information. DwarfLib requires this to be present, but it can
-// be empty.
-//============================================================================
-
-.section .debug_line
-_picoMark_LINES=
-
-//============================================================================
-// Debug Information
-//============================================================================
-.section .debug_info
-
-//Fixed header.
-.unalignedInitLong _picoMark_DEBUG_INFO_END-_picoMark_DEBUG_INFO_BEGIN
-_picoMark_DEBUG_INFO_BEGIN=
-.unalignedInitWord 0x2
-.unalignedInitLong _picoMark_ABBREVIATIONS
-.initByte 0x2
-
-// Compile unit information.
-.uleb128 0x1 // (DIE 0xb) DW_TAG_compile_unit)
-.unalignedInitLong _picoMark_LINES
-.unalignedInitWord _picoMark_FUNCTION_END
-.unalignedInitWord _picoMark_FUNCTION_BEGIN
-// Producer is `picoChip'
-.ascii 16#70# 16#69# 16#63# 16#6f# 16#43# 16#68# 16#69# 16#70# 16#00#
-.unalignedInitWord 0xcafe // ASM language
-.ascii 16#0# // Name. DwarfLib expects this to be present.
-
-.uleb128 0x2 ;# (DIE DW_TAG_subprogram)
-
-// FUNCTION NAME GOES HERE. Use `echo name | od -t x1' to get the hex. Each hex
-// digit is specified using the format 16#XX#
-.ascii 16#5f# 16#61# 16#64# 16#64# 16#63# 16#69# 16#33# 16#0# // Function name `_adddi3'
-.unalignedInitWord _picoMark_FUNCTION_BEGIN // DW_AT_low_pc
-.unalignedInitWord _picoMark_FUNCTION_END // DW_AT_high_pc
-
-.initByte 0x0 // end of compile unit children.
-
-_picoMark_DEBUG_INFO_END=
-
-//============================================================================
-// END OF DWARF
-//============================================================================
-
-.section .endFile
diff --git a/gcc/config/picochip/libgccExtras/ashlsi3.asm b/gcc/config/picochip/libgccExtras/ashlsi3.asm
deleted file mode 100644
index 688cd8d96ff..00000000000
--- a/gcc/config/picochip/libgccExtras/ashlsi3.asm
+++ /dev/null
@@ -1,193 +0,0 @@
-// picoChip ASM file
-// picoChip ASM file
-//
-// Support for 32-bit arithmetic shift left.
-//
-// Copyright (C) 2003, 2004, 2005, 2008, 2009 Free Software Foundation, Inc.
-// Contributed by Picochip Ltd.
-// Maintained by Hariharan Sandanagobalane (hariharan@picochip.com)
-//
-// This file is free software; you can redistribute it and/or modify it
-// under the terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 3, or (at your option) any
-// later version.
-//
-// This file 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/>.
-
-.section .text
-
-.global ___ashlsi3
-___ashlsi3:
-_picoMark_FUNCTION_BEGIN=
-// picoChip Function Prologue : &___ashlsi3 = 0 bytes
-
- // if (R2 > 15) goto _L2
- SUB.0 15,R2,r15
- JMPLT _L2
-=-> SUB.0 16,R2,R5 // R5 := R5 - R4 (HI)
-
- LSL.0 R1,R2,R1 // R3 := R1 << R2
- LSL.0 R0,R2,R4 // R2 := R0 << R2
-
- LSR.0 R0,R5,R5 // R5 := R12 >> R5 NEED TO CHECK - HARI
- OR.0 R5,R1,R5 // R3 := R5 IOR R0 (HI)
- SUB.0 R2,0,r15
- COPYNE R5,R1
- JR (R12) // Return to caller
-=-> COPY.0 R4,R0
-
-_L2:
- LSL.0 R0,R2,R1 // R3 := R0 << R2
- JR (R12) // Return to caller
-=-> COPY.0 0,R0 // R2 := 0 (short constant)
-
-_picoMark_FUNCTION_END=
-
-// picoChip Function Epilogue : __ashlsi3
-
-//============================================================================
-// All DWARF information between this marker, and the END OF DWARF
-// marker should be included in the source file. Search for
-// FUNCTION_STACK_SIZE_GOES_HERE and FUNCTION NAME GOES HERE, and
-// provide the relevent information. Add markers called
-// _picoMark_FUNCTION_BEGIN and _picoMark_FUNCTION_END around the
-// function in question.
-//============================================================================
-
-//============================================================================
-// Frame information.
-//============================================================================
-
-.section .debug_frame
-_picoMark_DebugFrame=
-
-// Common CIE header.
-.unalignedInitLong _picoMark_CieEnd-_picoMark_CieBegin
-_picoMark_CieBegin=
-.unalignedInitLong 0xffffffff
-.initByte 0x1 // CIE Version
-.ascii 16#0# // CIE Augmentation
-.uleb128 0x1 // CIE Code Alignment Factor
-.sleb128 2 // CIE Data Alignment Factor
-.initByte 0xc // CIE RA Column
-.initByte 0xc // DW_CFA_def_cfa
-.uleb128 0xd
-.uleb128 0x0
-.align 2
-_picoMark_CieEnd=
-
-// FDE
-_picoMark_LSFDE0I900821033007563=
-.unalignedInitLong _picoMark_FdeEnd-_picoMark_FdeBegin
-_picoMark_FdeBegin=
-.unalignedInitLong _picoMark_DebugFrame // FDE CIE offset
-.unalignedInitWord _picoMark_FUNCTION_BEGIN // FDE initial location
-.unalignedInitWord _picoMark_FUNCTION_END-_picoMark_FUNCTION_BEGIN
-.initByte 0xe // DW_CFA_def_cfa_offset
-.uleb128 0x0 // <-- FUNCTION_STACK_SIZE_GOES_HERE
-.initByte 0x4 // DW_CFA_advance_loc4
-.unalignedInitLong _picoMark_FUNCTION_END-_picoMark_FUNCTION_BEGIN
-.initByte 0xe // DW_CFA_def_cfa_offset
-.uleb128 0x0
-.align 2
-_picoMark_FdeEnd=
-
-//============================================================================
-// Abbrevation information.
-//============================================================================
-
-.section .debug_abbrev
-_picoMark_ABBREVIATIONS=
-
-.section .debug_abbrev
- .uleb128 0x1 // (abbrev code)
- .uleb128 0x11 // (TAG: DW_TAG_compile_unit)
- .initByte 0x1 // DW_children_yes
- .uleb128 0x10 // (DW_AT_stmt_list)
- .uleb128 0x6 // (DW_FORM_data4)
- .uleb128 0x12 // (DW_AT_high_pc)
- .uleb128 0x1 // (DW_FORM_addr)
- .uleb128 0x11 // (DW_AT_low_pc)
- .uleb128 0x1 // (DW_FORM_addr)
- .uleb128 0x25 // (DW_AT_producer)
- .uleb128 0x8 // (DW_FORM_string)
- .uleb128 0x13 // (DW_AT_language)
- .uleb128 0x5 // (DW_FORM_data2)
- .uleb128 0x3 // (DW_AT_name)
- .uleb128 0x8 // (DW_FORM_string)
-.initByte 0x0
-.initByte 0x0
-
- .uleb128 0x2 ;# (abbrev code)
- .uleb128 0x2e ;# (TAG: DW_TAG_subprogram)
-.initByte 0x0 ;# DW_children_no
- .uleb128 0x3 ;# (DW_AT_name)
- .uleb128 0x8 ;# (DW_FORM_string)
- .uleb128 0x11 ;# (DW_AT_low_pc)
- .uleb128 0x1 ;# (DW_FORM_addr)
- .uleb128 0x12 ;# (DW_AT_high_pc)
- .uleb128 0x1 ;# (DW_FORM_addr)
-.initByte 0x0
-.initByte 0x0
-
-.initByte 0x0
-
-//============================================================================
-// Line information. DwarfLib requires this to be present, but it can
-// be empty.
-//============================================================================
-
-.section .debug_line
-_picoMark_LINES=
-
-//============================================================================
-// Debug Information
-//============================================================================
-.section .debug_info
-
-//Fixed header.
-.unalignedInitLong _picoMark_DEBUG_INFO_END-_picoMark_DEBUG_INFO_BEGIN
-_picoMark_DEBUG_INFO_BEGIN=
-.unalignedInitWord 0x2
-.unalignedInitLong _picoMark_ABBREVIATIONS
-.initByte 0x2
-
-// Compile unit information.
-.uleb128 0x1 // (DIE 0xb) DW_TAG_compile_unit)
-.unalignedInitLong _picoMark_LINES
-.unalignedInitWord _picoMark_FUNCTION_END
-.unalignedInitWord _picoMark_FUNCTION_BEGIN
-// Producer is `picoChip'
-.ascii 16#70# 16#69# 16#63# 16#6f# 16#43# 16#68# 16#69# 16#70# 16#00#
-.unalignedInitWord 0xcafe // ASM language
-.ascii 16#0# // Name. DwarfLib expects this to be present.
-
-.uleb128 0x2 ;# (DIE DW_TAG_subprogram)
-
-// FUNCTION NAME GOES HERE. Use `echo name | od -t x1' to get the hex. Each hex
-// digit is specified using the format 16#XX#
-.ascii 16#5f# 16#61# 16#73# 16#68# 16#6c# 16#73# 16#69# 16#33# 16#0# // Function name `_ashlsi3'
-.unalignedInitWord _picoMark_FUNCTION_BEGIN // DW_AT_low_pc
-.unalignedInitWord _picoMark_FUNCTION_END // DW_AT_high_pc
-
-.initByte 0x0 // end of compile unit children.
-
-_picoMark_DEBUG_INFO_END=
-
-//============================================================================
-// END OF DWARF
-//============================================================================
-
-.section .endFile
diff --git a/gcc/config/picochip/libgccExtras/ashlsi3.c b/gcc/config/picochip/libgccExtras/ashlsi3.c
deleted file mode 100644
index 600461c0b83..00000000000
--- a/gcc/config/picochip/libgccExtras/ashlsi3.c
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
-
-picoChip GCC support for 32-bit shift left.
-
-Copyright (C) 2003, 2004, 2005, 2008, 2009 Free Software Foundation, Inc.
-Contributed by Picochip Ltd.
-Maintained by Daniel Towner (daniel.towner@picochip.com)
-
-This file is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3, or (at your option) any
-later version.
-
-This file 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 PICOCHIP
-#error "Intended for compilation for PICOCHIP only."
-#endif
-
-typedef int HItype __attribute__ ((mode (HI)));
-typedef unsigned int UHItype __attribute__ ((mode (HI)));
-typedef unsigned int USItype __attribute__ ((mode (SI)));
-
-typedef struct USIstruct {
- UHItype low, high;
-} USIstruct;
-
-typedef union USIunion {
- USItype l;
- USIstruct s;
-} USIunion;
-
-USItype __ashlsi3(USIunion value, HItype count) {
- USIunion result;
- int temp;
-
- /* Ignore a zero count until we get into the (count < 16)
- clause. This is slightly slower when shifting by zero, but faster
- and smaller in all other cases (due to the better scheduling
- opportunities available by putting the test near computational
- instructions. */
- /* if (count == 0) return value.l; */
-
- if (count < 16) {
- /* Shift low and high words by the count. */
- result.s.low = value.s.low << count;
- result.s.high = value.s.high << count;
-
- /* There is now a hole in the lower `count' bits of the high
- word. Shift the upper `count' bits of the low word into the
- high word. This is only required when the count is non-zero. */
- if (count != 0) {
- temp = 16 - count;
- temp = value.s.low >> temp;
- result.s.high |= temp;
- }
-
- } else {
- /* Shift the lower word of the source into the upper word of the
- result, and zero the result's lower word. */
- count -= 16;
- result.s.high = value.s.low << count;
- result.s.low = 0;
-
- }
-
- return result.l;
-
-}
-
diff --git a/gcc/config/picochip/libgccExtras/ashrsi3.asm b/gcc/config/picochip/libgccExtras/ashrsi3.asm
deleted file mode 100644
index fddd70b6895..00000000000
--- a/gcc/config/picochip/libgccExtras/ashrsi3.asm
+++ /dev/null
@@ -1,202 +0,0 @@
-// picoChip ASM file
-//
-// Support for 32-bit arithmetic shift right.
-//
-// Copyright (C) 2003, 2004, 2005, 2008, 2009 Free Software Foundation, Inc.
-// Contributed by Picochip Ltd.
-// Maintained by Hariharan Sandanagobalane (hariharan@picochip.com)
-//
-// This file is free software; you can redistribute it and/or modify it
-// under the terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 3, or (at your option) any
-// later version.
-//
-// This file 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/>.
-
-.section .text
-
-.global ___ashrsi3
-___ashrsi3:
-_picoMark_FUNCTION_BEGIN=
-
-// picoChip Function Prologue : &___ashrsi3 = 0 bytes
-
- // if (R2 > 15) goto _L2
- SUB.0 15,R2,r15
- JMPLT _L2
-=-> COPY.0 R1,R3
-
- LSR.0 R1,R2,R1 // R1 := R1 >> R2
- // if (R2 == 0) goto _L4
- SUB.0 R2,0,r15
- JMPEQ _L4
-=-> LSR.0 R0,R2,R0 // R2 := R0 >> R2
-
- SUB.0 16,R2,R4 // R4 := R4 - R2 (HI)
- ASR.0 R3,15,R5 // R5 = R1 >>{arith} 15
- LSL.0 R5,R4,R5 // R5 := R5 << R4
- LSL.0 R3,R4,R4 // R4 := R1 << R4
- OR.0 R5,R1,R1 // R3 := R5 IOR R3 (HI)
- BRA _L4
- =-> OR.0 R4,R0,R0 // R2 := R4 IOR R0 (HI)
-_L2:
- ASR.0 R1,15,R1 // R4 = R1 >>{arith} 15
- SUB.0 16,R2,R5 // R5 := R5 - R2 (HI)
- LSR.0 R3,R2,R0 // R2 := R1 >> R2
- LSL.0 R1,R5,R5 // R5 := R4 << R5
- OR.0 R5,R0,R5 // R2 := R5 IOR R2 (HI)
- SUB.0 R2,16,r15 // R5 := R5 - R2 (HI)
- COPYNE R5,R0
-_L4:
- JR (R12) // Return to caller
-
-_picoMark_FUNCTION_END=
-
-// picoChip Function Epilogue : __ashrsi3
-//============================================================================
-// All DWARF information between this marker, and the END OF DWARF
-// marker should be included in the source file. Search for
-// FUNCTION_STACK_SIZE_GOES_HERE and FUNCTION NAME GOES HERE, and
-// provide the relevent information. Add markers called
-// _picoMark_FUNCTION_BEGIN and _picoMark_FUNCTION_END around the
-// function in question.
-//============================================================================
-
-//============================================================================
-// Frame information.
-//============================================================================
-
-.section .debug_frame
-_picoMark_DebugFrame=
-
-// Common CIE header.
-.unalignedInitLong _picoMark_CieEnd-_picoMark_CieBegin
-_picoMark_CieBegin=
-.unalignedInitLong 0xffffffff
-.initByte 0x1 // CIE Version
-.ascii 16#0# // CIE Augmentation
-.uleb128 0x1 // CIE Code Alignment Factor
-.sleb128 2 // CIE Data Alignment Factor
-.initByte 0xc // CIE RA Column
-.initByte 0xc // DW_CFA_def_cfa
-.uleb128 0xd
-.uleb128 0x0
-.align 2
-_picoMark_CieEnd=
-
-// FDE
-_picoMark_LSFDE0I900821033007563=
-.unalignedInitLong _picoMark_FdeEnd-_picoMark_FdeBegin
-_picoMark_FdeBegin=
-.unalignedInitLong _picoMark_DebugFrame // FDE CIE offset
-.unalignedInitWord _picoMark_FUNCTION_BEGIN // FDE initial location
-.unalignedInitWord _picoMark_FUNCTION_END-_picoMark_FUNCTION_BEGIN
-.initByte 0xe // DW_CFA_def_cfa_offset
-.uleb128 0x0 // <-- FUNCTION_STACK_SIZE_GOES_HERE
-.initByte 0x4 // DW_CFA_advance_loc4
-.unalignedInitLong _picoMark_FUNCTION_END-_picoMark_FUNCTION_BEGIN
-.initByte 0xe // DW_CFA_def_cfa_offset
-.uleb128 0x0
-.align 2
-_picoMark_FdeEnd=
-
-//============================================================================
-// Abbrevation information.
-//============================================================================
-
-.section .debug_abbrev
-_picoMark_ABBREVIATIONS=
-
-.section .debug_abbrev
- .uleb128 0x1 // (abbrev code)
- .uleb128 0x11 // (TAG: DW_TAG_compile_unit)
- .initByte 0x1 // DW_children_yes
- .uleb128 0x10 // (DW_AT_stmt_list)
- .uleb128 0x6 // (DW_FORM_data4)
- .uleb128 0x12 // (DW_AT_high_pc)
- .uleb128 0x1 // (DW_FORM_addr)
- .uleb128 0x11 // (DW_AT_low_pc)
- .uleb128 0x1 // (DW_FORM_addr)
- .uleb128 0x25 // (DW_AT_producer)
- .uleb128 0x8 // (DW_FORM_string)
- .uleb128 0x13 // (DW_AT_language)
- .uleb128 0x5 // (DW_FORM_data2)
- .uleb128 0x3 // (DW_AT_name)
- .uleb128 0x8 // (DW_FORM_string)
-.initByte 0x0
-.initByte 0x0
-
- .uleb128 0x2 ;# (abbrev code)
- .uleb128 0x2e ;# (TAG: DW_TAG_subprogram)
-.initByte 0x0 ;# DW_children_no
- .uleb128 0x3 ;# (DW_AT_name)
- .uleb128 0x8 ;# (DW_FORM_string)
- .uleb128 0x11 ;# (DW_AT_low_pc)
- .uleb128 0x1 ;# (DW_FORM_addr)
- .uleb128 0x12 ;# (DW_AT_high_pc)
- .uleb128 0x1 ;# (DW_FORM_addr)
-.initByte 0x0
-.initByte 0x0
-
-.initByte 0x0
-
-//============================================================================
-// Line information. DwarfLib requires this to be present, but it can
-// be empty.
-//============================================================================
-
-.section .debug_line
-_picoMark_LINES=
-
-//============================================================================
-// Debug Information
-//============================================================================
-.section .debug_info
-
-//Fixed header.
-.unalignedInitLong _picoMark_DEBUG_INFO_END-_picoMark_DEBUG_INFO_BEGIN
-_picoMark_DEBUG_INFO_BEGIN=
-.unalignedInitWord 0x2
-.unalignedInitLong _picoMark_ABBREVIATIONS
-.initByte 0x2
-
-// Compile unit information.
-.uleb128 0x1 // (DIE 0xb) DW_TAG_compile_unit)
-.unalignedInitLong _picoMark_LINES
-.unalignedInitWord _picoMark_FUNCTION_END
-.unalignedInitWord _picoMark_FUNCTION_BEGIN
-// Producer is `picoChip'
-.ascii 16#70# 16#69# 16#63# 16#6f# 16#43# 16#68# 16#69# 16#70# 16#00#
-.unalignedInitWord 0xcafe // ASM language
-.ascii 16#0# // Name. DwarfLib expects this to be present.
-
-.uleb128 0x2 ;# (DIE DW_TAG_subprogram)
-
-// FUNCTION NAME GOES HERE. Use `echo name | od -t x1' to get the hex. Each hex
-// digit is specified using the format 16#XX#
-.ascii 16#5f# 16#61# 16#73# 16#68# 16#72# 16#73# 16#69# 16#33# 16#0# // Function name `_ashrsi3'
-.unalignedInitWord _picoMark_FUNCTION_BEGIN // DW_AT_low_pc
-.unalignedInitWord _picoMark_FUNCTION_END // DW_AT_high_pc
-
-.initByte 0x0 // end of compile unit children.
-
-_picoMark_DEBUG_INFO_END=
-
-//============================================================================
-// END OF DWARF
-//============================================================================
-
-.section .endFile
-// End of picoChip ASM file
diff --git a/gcc/config/picochip/libgccExtras/ashrsi3.c b/gcc/config/picochip/libgccExtras/ashrsi3.c
deleted file mode 100644
index 4f1567b1347..00000000000
--- a/gcc/config/picochip/libgccExtras/ashrsi3.c
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
-
-picoChip GCC support for 32-bit arithmetic shift right.
-
-Copyright (C) 2003, 2004, 2005, 2008, 2009 Free Software Foundation, Inc.
-Contributed by Picochip Ltd.
-Maintained by Daniel Towner (daniel.towner@picochip.com)
-
-This file is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3, or (at your option) any
-later version.
-
-This file 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/>. */
-
-typedef int HItype __attribute__ ((mode (HI)));
-typedef unsigned int UHItype __attribute__ ((mode (HI)));
-typedef unsigned int USItype __attribute__ ((mode (SI)));
-
-typedef struct USIstruct {
- UHItype low, high;
-} USIstruct;
-
-typedef union USIunion {
- USItype l;
- USIstruct s;
-} USIunion;
-
-USItype __ashrsi3(USIunion value, HItype count) {
- USIunion result;
- int temp;
- int wordOfSignBits;
-
- /* Ignore a zero count until we get into the (count < 16)
- clause. This is slightly slower when shifting by zero, but faster
- and smaller in all other cases (due to the better scheduling
- opportunities available by putting the test near computational
- instructions. */
- /* if (count == 0) return value.l; */
-
- if (count < 16) {
- /* Shift low and high words by the count. The high word must use
- an arithmetic shift. There is no arithmetic shift-right by
- variable, so synthesise it. */
- int signWord;
- int reverseCount;
-
- /* Shift low and high parts by the count. The upper word now has
- invalid signed bits. */
- result.s.low = value.s.low >> count;
- result.s.high = value.s.high >> count;
-
- if (count != 0) {
-
- reverseCount = 16 - count;
-
- /* Given a word of sign bits, shift back left to create the
- destination sign bits. */
- wordOfSignBits = __builtin_asri(value.s.high, 15);
- signWord = wordOfSignBits << reverseCount;
- result.s.high |= signWord;
-
- /* There is now a hole in the upper `count' bits of the low
- word. Shift the lower `count' bits of the upper word into the
- low word. */
- temp = value.s.high << reverseCount;
- result.s.low |= temp;
- }
-
- } else {
- int signWord;
-
- /* Shift is greater than one word, so top word will always be set
- to sign bits, and bottom word will be shifted from top word. */
- result.s.low = value.s.high >> count;
- result.s.high = __builtin_asri(value.s.high, 15);
-
- if (count != 16) {
-
- /* Shift the upper word of the source into the lower word of the
- result. Arithmetically shift the upper word as well, to retain
- the sign. This shift must be synthesised, as no such shift
- exists in the instruction set. */
- int signWord;
-
-
- /* Given a complete word of sign-bits, shift this back left to
- create the destination sign bits. */
- signWord = result.s.high << (16 - count);
- // signWord = wordOfSignBits << (16 - count);
-
- /* Insert the sign bits to the result's low word. */
- result.s.low |= signWord;
-
- }
-
- }
-
- return result.l;
-
-}
diff --git a/gcc/config/picochip/libgccExtras/clzsi2.asm b/gcc/config/picochip/libgccExtras/clzsi2.asm
deleted file mode 100644
index 835d4694167..00000000000
--- a/gcc/config/picochip/libgccExtras/clzsi2.asm
+++ /dev/null
@@ -1,189 +0,0 @@
-// Copyright (C) 2008 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/>.
-
-// picoChip ASM file
-//.file "clzsi2.asm"
-
-.section .text
-
-.global __clzsi2
-__clzsi2:
-_picoMark_FUNCTION_BEGIN=
-
-// picoChip Function Prologue : &__clzsi2 = 0 bytes
-
- // What value should be operated on? If the top word is empty
- // then count the bits in the bottom word, and add 16. If the
- // top word is not empty, then count the bits in the top word.
-
- // R4 stores the constant 0
-
- sub.0 R1,0,r15 \ copy.1 16,r2
- copyeq r0,r1
- copyne 0,r2
-
- // R1 now stores value to count, and R2 stores current bit offset.
- sbc r1,r0
- asr.0 r1,15,r15 \ add.1 r0,1,r0
- jr (lr) \ copyne 0,r0
-=-> add.0 r0,r2,r0
-
-_picoMark_FUNCTION_END=
-
-// picoChip Function Epilogue : __clzsi2
-
-//============================================================================
-// All DWARF information between this marker, and the END OF DWARF
-// marker should be included in the source file. Search for
-// FUNCTION_STACK_SIZE_GOES_HERE and FUNCTION NAME GOES HERE, and
-// provide the relevent information. Add markers called
-// _picoMark_FUNCTION_BEGIN and _picoMark_FUNCTION_END around the
-// function in question.
-//============================================================================
-
-//============================================================================
-// Frame information.
-//============================================================================
-
-.section .debug_frame
-_picoMark_DebugFrame=
-
-// Common CIE header.
-.unalignedInitLong _picoMark_CieEnd-_picoMark_CieBegin
-_picoMark_CieBegin=
-.unalignedInitLong 0xffffffff
-.initByte 0x1 // CIE Version
-.ascii 16#0# // CIE Augmentation
-.uleb128 0x1 // CIE Code Alignment Factor
-.sleb128 2 // CIE Data Alignment Factor
-.initByte 0xc // CIE RA Column
-.initByte 0xc // DW_CFA_def_cfa
-.uleb128 0xd
-.uleb128 0x0
-.align 2
-_picoMark_CieEnd=
-
-// FDE
-_picoMark_LSFDE0I900821033007563=
-.unalignedInitLong _picoMark_FdeEnd-_picoMark_FdeBegin
-_picoMark_FdeBegin=
-.unalignedInitLong _picoMark_DebugFrame // FDE CIE offset
-.unalignedInitWord _picoMark_FUNCTION_BEGIN // FDE initial location
-.unalignedInitWord _picoMark_FUNCTION_END-_picoMark_FUNCTION_BEGIN
-.initByte 0xe // DW_CFA_def_cfa_offset
-.uleb128 0x0 // <-- FUNCTION_STACK_SIZE_GOES_HERE
-.initByte 0x4 // DW_CFA_advance_loc4
-.unalignedInitLong _picoMark_FUNCTION_END-_picoMark_FUNCTION_BEGIN
-.initByte 0xe // DW_CFA_def_cfa_offset
-.uleb128 0x0
-.align 2
-_picoMark_FdeEnd=
-
-//============================================================================
-// Abbrevation information.
-//============================================================================
-
-.section .debug_abbrev
-_picoMark_ABBREVIATIONS=
-
-.section .debug_abbrev
- .uleb128 0x1 // (abbrev code)
- .uleb128 0x11 // (TAG: DW_TAG_compile_unit)
- .initByte 0x1 // DW_children_yes
- .uleb128 0x10 // (DW_AT_stmt_list)
- .uleb128 0x6 // (DW_FORM_data4)
- .uleb128 0x12 // (DW_AT_high_pc)
- .uleb128 0x1 // (DW_FORM_addr)
- .uleb128 0x11 // (DW_AT_low_pc)
- .uleb128 0x1 // (DW_FORM_addr)
- .uleb128 0x25 // (DW_AT_producer)
- .uleb128 0x8 // (DW_FORM_string)
- .uleb128 0x13 // (DW_AT_language)
- .uleb128 0x5 // (DW_FORM_data2)
- .uleb128 0x3 // (DW_AT_name)
- .uleb128 0x8 // (DW_FORM_string)
-.initByte 0x0
-.initByte 0x0
-
- .uleb128 0x2 ;# (abbrev code)
- .uleb128 0x2e ;# (TAG: DW_TAG_subprogram)
-.initByte 0x0 ;# DW_children_no
- .uleb128 0x3 ;# (DW_AT_name)
- .uleb128 0x8 ;# (DW_FORM_string)
- .uleb128 0x11 ;# (DW_AT_low_pc)
- .uleb128 0x1 ;# (DW_FORM_addr)
- .uleb128 0x12 ;# (DW_AT_high_pc)
- .uleb128 0x1 ;# (DW_FORM_addr)
-.initByte 0x0
-.initByte 0x0
-
-.initByte 0x0
-
-//============================================================================
-// Line information. DwarfLib requires this to be present, but it can
-// be empty.
-//============================================================================
-
-.section .debug_line
-_picoMark_LINES=
-
-//============================================================================
-// Debug Information
-//============================================================================
-.section .debug_info
-
-//Fixed header.
-.unalignedInitLong _picoMark_DEBUG_INFO_END-_picoMark_DEBUG_INFO_BEGIN
-_picoMark_DEBUG_INFO_BEGIN=
-.unalignedInitWord 0x2
-.unalignedInitLong _picoMark_ABBREVIATIONS
-.initByte 0x2
-
-// Compile unit information.
-.uleb128 0x1 // (DIE 0xb) DW_TAG_compile_unit)
-.unalignedInitLong _picoMark_LINES
-.unalignedInitWord _picoMark_FUNCTION_END
-.unalignedInitWord _picoMark_FUNCTION_BEGIN
-// Producer is `picoChip'
-.ascii 16#70# 16#69# 16#63# 16#6f# 16#43# 16#68# 16#69# 16#70# 16#00#
-.unalignedInitWord 0xcafe // ASM language
-.ascii 16#0# // Name. DwarfLib expects this to be present.
-
-.uleb128 0x2 ;# (DIE DW_TAG_subprogram)
-
-// FUNCTION NAME GOES HERE. Use `echo name | od -t x1' to get the hex. Each hex
-// digit is specified using the format 16#XX#
-.ascii 16#5F# 16#63# 16#6C# 16#7A# 16#73# 16#69# 16#32# 16#0# // Function name `_clzsi2'
-.unalignedInitWord _picoMark_FUNCTION_BEGIN // DW_AT_low_pc
-.unalignedInitWord _picoMark_FUNCTION_END // DW_AT_high_pc
-
-.initByte 0x0 // end of compile unit children.
-
-_picoMark_DEBUG_INFO_END=
-
-//============================================================================
-// END OF DWARF
-//============================================================================
-
-.section .endFile
-// End of picoChip ASM file
diff --git a/gcc/config/picochip/libgccExtras/cmpsi2.asm b/gcc/config/picochip/libgccExtras/cmpsi2.asm
deleted file mode 100644
index 95322f32419..00000000000
--- a/gcc/config/picochip/libgccExtras/cmpsi2.asm
+++ /dev/null
@@ -1,212 +0,0 @@
-// picoChip ASM file
-//.file "ucmpsi2.c"
-//
-// Support for 32-bit signed compare.
-//
-// Copyright (C) 2003, 2004, 2005, 2008, 2009 Free Software Foundation, Inc.
-// Contributed by Picochip Ltd.
-// Maintained by Daniel Towner (daniel.towner@picochip.com)
-//
-// This file is free software; you can redistribute it and/or modify it
-// under the terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 3, or (at your option) any
-// later version.
-//
-// This file 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/>.
-
-// Compiled from the following, and then hand optimised.
-//
-// int __cmpsi2 (USItype x, USItype y)
-// {
-//
-// SIunion lx; lx.l = x;
-// SIunion ly; ly.l = y;
-//
-// if (lx.s.high < ly.s.high)
-// return 0;
-// else if (lx.s.high > ly.s.high)
-// return 2;
-// if (lx.s.low < ly.s.low)
-// return 0;
-// else if (lx.s.low > ly.s.low)
-// return 2;
-// return 1;
-// }
-
-.section .text
-
-.align 8
-.global ___cmpsi2
-___cmpsi2:
-_picoMark_FUNCTION_BEGIN=
-
-// picoChip Function Prologue : &___cmpsi2 = 0 bytes
-
- SUB.0 R1,R3,r15
-
- BLT _L1
-=-> SUB.0 R3,R1,r15 \ COPY.1 0,R5
-
- BLT _L1
-=-> SUB.0 R0,R2,r15 \ COPY.1 2,R5
-
- BLO _L1
-=-> SUB.0 R2,R0,r15 \ COPY.1 0,R5
-
- BLO _L1
-=-> COPY.0 2,R5
-
- COPY.0 1,R5
-_L1:
- JR (R12)
-=-> COPY.0 R5,R0
-
-_picoMark_FUNCTION_END=
-// picoChip Function Epilogue : __cmpsi2
-//============================================================================
-// All DWARF information between this marker, and the END OF DWARF
-// marker should be included in the source file. Search for
-// FUNCTION_STACK_SIZE_GOES_HERE and FUNCTION NAME GOES HERE, and
-// provide the relevent information. Add markers called
-// _picoMark_FUNCTION_BEGIN and _picoMark_FUNCTION_END around the
-// function in question.
-//============================================================================
-
-//============================================================================
-// Frame information.
-//============================================================================
-
-.section .debug_frame
-_picoMark_DebugFrame=
-
-// Common CIE header.
-.unalignedInitLong _picoMark_CieEnd-_picoMark_CieBegin
-_picoMark_CieBegin=
-.unalignedInitLong 0xffffffff
-.initByte 0x1 // CIE Version
-.ascii 16#0# // CIE Augmentation
-.uleb128 0x1 // CIE Code Alignment Factor
-.sleb128 2 // CIE Data Alignment Factor
-.initByte 0xc // CIE RA Column
-.initByte 0xc // DW_CFA_def_cfa
-.uleb128 0xd
-.uleb128 0x0
-.align 2
-_picoMark_CieEnd=
-
-// FDE
-_picoMark_LSFDE0I900821033007563=
-.unalignedInitLong _picoMark_FdeEnd-_picoMark_FdeBegin
-_picoMark_FdeBegin=
-.unalignedInitLong _picoMark_DebugFrame // FDE CIE offset
-.unalignedInitWord _picoMark_FUNCTION_BEGIN // FDE initial location
-.unalignedInitWord _picoMark_FUNCTION_END-_picoMark_FUNCTION_BEGIN
-.initByte 0xe // DW_CFA_def_cfa_offset
-.uleb128 0x0 // <-- FUNCTION_STACK_SIZE_GOES_HERE
-.initByte 0x4 // DW_CFA_advance_loc4
-.unalignedInitLong _picoMark_FUNCTION_END-_picoMark_FUNCTION_BEGIN
-.initByte 0xe // DW_CFA_def_cfa_offset
-.uleb128 0x0
-.align 2
-_picoMark_FdeEnd=
-
-//============================================================================
-// Abbrevation information.
-//============================================================================
-
-.section .debug_abbrev
-_picoMark_ABBREVIATIONS=
-
-.section .debug_abbrev
- .uleb128 0x1 // (abbrev code)
- .uleb128 0x11 // (TAG: DW_TAG_compile_unit)
- .initByte 0x1 // DW_children_yes
- .uleb128 0x10 // (DW_AT_stmt_list)
- .uleb128 0x6 // (DW_FORM_data4)
- .uleb128 0x12 // (DW_AT_high_pc)
- .uleb128 0x1 // (DW_FORM_addr)
- .uleb128 0x11 // (DW_AT_low_pc)
- .uleb128 0x1 // (DW_FORM_addr)
- .uleb128 0x25 // (DW_AT_producer)
- .uleb128 0x8 // (DW_FORM_string)
- .uleb128 0x13 // (DW_AT_language)
- .uleb128 0x5 // (DW_FORM_data2)
- .uleb128 0x3 // (DW_AT_name)
- .uleb128 0x8 // (DW_FORM_string)
-.initByte 0x0
-.initByte 0x0
-
- .uleb128 0x2 ;# (abbrev code)
- .uleb128 0x2e ;# (TAG: DW_TAG_subprogram)
-.initByte 0x0 ;# DW_children_no
- .uleb128 0x3 ;# (DW_AT_name)
- .uleb128 0x8 ;# (DW_FORM_string)
- .uleb128 0x11 ;# (DW_AT_low_pc)
- .uleb128 0x1 ;# (DW_FORM_addr)
- .uleb128 0x12 ;# (DW_AT_high_pc)
- .uleb128 0x1 ;# (DW_FORM_addr)
-.initByte 0x0
-.initByte 0x0
-
-.initByte 0x0
-
-//============================================================================
-// Line information. DwarfLib requires this to be present, but it can
-// be empty.
-//============================================================================
-
-.section .debug_line
-_picoMark_LINES=
-
-//============================================================================
-// Debug Information
-//============================================================================
-.section .debug_info
-
-//Fixed header.
-.unalignedInitLong _picoMark_DEBUG_INFO_END-_picoMark_DEBUG_INFO_BEGIN
-_picoMark_DEBUG_INFO_BEGIN=
-.unalignedInitWord 0x2
-.unalignedInitLong _picoMark_ABBREVIATIONS
-.initByte 0x2
-
-// Compile unit information.
-.uleb128 0x1 // (DIE 0xb) DW_TAG_compile_unit)
-.unalignedInitLong _picoMark_LINES
-.unalignedInitWord _picoMark_FUNCTION_END
-.unalignedInitWord _picoMark_FUNCTION_BEGIN
-// Producer is `picoChip'
-.ascii 16#70# 16#69# 16#63# 16#6f# 16#43# 16#68# 16#69# 16#70# 16#00#
-.unalignedInitWord 0xcafe // ASM language
-.ascii 16#0# // Name. DwarfLib expects this to be present.
-
-.uleb128 0x2 ;# (DIE DW_TAG_subprogram)
-
-// FUNCTION NAME GOES HERE. Use `echo name | od -t x1' to get the hex. Each hex
-// digit is specified using the format 16#XX#
-.ascii 16#5f# 16#5f# 16#63# 16#6d# 16#70# 16#73# 16#69# 16#32# 16#0# // Function name `__cmpsi2'
-.unalignedInitWord _picoMark_FUNCTION_BEGIN // DW_AT_low_pc
-.unalignedInitWord _picoMark_FUNCTION_END // DW_AT_high_pc
-
-.initByte 0x0 // end of compile unit children.
-
-_picoMark_DEBUG_INFO_END=
-
-//============================================================================
-// END OF DWARF
-//============================================================================
-
-.section .endFile
-// End of picoChip ASM file
diff --git a/gcc/config/picochip/libgccExtras/divmod15.asm b/gcc/config/picochip/libgccExtras/divmod15.asm
deleted file mode 100644
index d314b3be570..00000000000
--- a/gcc/config/picochip/libgccExtras/divmod15.asm
+++ /dev/null
@@ -1,261 +0,0 @@
-// picoChip ASM file
-//
-// Support for 16-bit unsigned division/modulus.
-//
-// Copyright (C) 2003, 2004, 2005, 2008, 2009 Free Software Foundation, Inc.
-// Contributed by Picochip Ltd.
-// Maintained by Daniel Towner (daniel.towner@picochip.com)
-//
-// This file is free software; you can redistribute it and/or modify it
-// under the terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 3, or (at your option) any
-// later version.
-//
-// This file 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/>.
-
-.section .text
-
-.global __divmod15
-__divmod15:
-_picoMark_FUNCTION_BEGIN=
-
-// picoChip Function Prologue : &__divmod15 = 0 bytes
-
- // The picoChip instruction set has a divstep instruction which
- // is used to perform one iteration of a binary division algorithm.
- // The instruction allows 16-bit signed division to be implemented.
- // It does not directly allow 16-bit unsigned division to be
- // implemented. Thus, this function pulls out the common division
- // iteration for 15-bits unsigned, and then special wrappers
- // provide the logic to change this into a 16-bit signed or
- // unsigned division, as appropriate. This allows the two
- // versions of division to share a common implementation, reducing
- // code size when the two are used together. It also reduces
- // the maintenance overhead.
-
- // Input:
- // r0 - dividend
- // r1 - divisor
- // Output:
- // r0 - quotient
- // r1 - remainder
- // R5 is unused
-
- // Check for special cases. The emphasis is on detecting these as
- // quickly as possible, so that the main division can be started. If
- // the user requests division by one, division by self, and so on
- // then they will just have to accept that this won't be particularly
- // quick (relatively), whereas a real division (e.g., dividing a
- // large value by a small value) will run as fast as possible
- // (i.e., special case detection should not slow down the common case)
- //
- // Special cases to consider:
- //
- // Division by zero.
- // Division of zero.
- // Inputs are equal
- // Divisor is bigger than dividend
- // Division by power of two (can be shifted instead).
- // Division by 1 (special case of power of two division)
- //
- // Division/modulus by zero is undefined (ISO C:6.5.5), so
- // don't bother handling this special case.
- //
- // The special cases of division by a power of 2 are ignored, since
- // they cause the general case to slow down. Omitting these
- // special cases also reduces code size considerably.
-
- // Handle divisor >= dividend separately. Note that this also handles
- // the case where the dividend is zero. Note that the flags must be
- // preserved, since they are also used at the branch destination.
- sub.0 r1,r0,r15
- sbc r0,r2 \ bge divisorGeDividend
-=-> sbc r1,r4
-
- // Compute the shift count. The amount by which the divisor
- // must be shifted left to be aligned with the dividend.
- sub.0 r4,r2,r3
-
- // Align the divisor to the dividend. Execute a divstep (since at
- // least one will always be executed). Skip the remaining loop
- // if the shift count is zero.
- lsl.0 r1,r3,r1 \ beq skipLoop
-=-> divstep r0,r1 \ add.1 r3,1,r2
-
- // Execute the divstep loop until temp is 0. This assumes that the
- // loop count is at least one.
- sub.0 r3,1,r4
-divLoop:
- divstep r0,r1 \ bne divLoop
-=-> sub.0 r4,1,r4
-
-skipLoop:
-
- // The top bits of the result are the remainder. The bottom
- // bits are the quotient.
- lsr.0 r0,r2,r1 \ sub.1 16,r2,r4
- jr (lr ) \ lsl.0 r0,r4,r0
-=-> lsr.0 r0,r4,r0
-
-// Special case.
-
-divisorGeDividend:
- // The divisor is greater than or equal to the dividend. The flags
- // indicate which of these alternatives it is. The COPYNE can be used
- // to set the result appropriately, without introducing any more
- // branches.
- copy.0 r0,r1 \ copy.1 0,r0
- jr (lr) \ copyeq r0,r1
-=-> copyeq 1,r0
-
-_picoMark_FUNCTION_END=
-// picoChip Function Epilogue : __divmod15
-
-
-//============================================================================
-// All DWARF information between this marker, and the END OF DWARF
-// marker should be included in the source file. Search for
-// FUNCTION_STACK_SIZE_GOES_HERE and FUNCTION NAME GOES HERE, and
-// provide the relevent information. Add markers called
-// _picoMark_FUNCTION_BEGIN and _picoMark_FUNCTION_END around the
-// function in question.
-//============================================================================
-
-//============================================================================
-// Frame information.
-//============================================================================
-
-.section .debug_frame
-_picoMark_DebugFrame=
-
-// Common CIE header.
-.unalignedInitLong _picoMark_CieEnd-_picoMark_CieBegin
-_picoMark_CieBegin=
-.unalignedInitLong 0xffffffff
-.initByte 0x1 // CIE Version
-.ascii 16#0# // CIE Augmentation
-.uleb128 0x1 // CIE Code Alignment Factor
-.sleb128 2 // CIE Data Alignment Factor
-.initByte 0xc // CIE RA Column
-.initByte 0xc // DW_CFA_def_cfa
-.uleb128 0xd
-.uleb128 0x0
-.align 2
-_picoMark_CieEnd=
-
-// FDE
-_picoMark_LSFDE0I900821033007563=
-.unalignedInitLong _picoMark_FdeEnd-_picoMark_FdeBegin
-_picoMark_FdeBegin=
-.unalignedInitLong _picoMark_DebugFrame // FDE CIE offset
-.unalignedInitWord _picoMark_FUNCTION_BEGIN // FDE initial location
-.unalignedInitWord _picoMark_FUNCTION_END-_picoMark_FUNCTION_BEGIN
-.initByte 0xe // DW_CFA_def_cfa_offset
-.uleb128 0x0 // <-- FUNCTION_STACK_SIZE_GOES_HERE
-.initByte 0x4 // DW_CFA_advance_loc4
-.unalignedInitLong _picoMark_FUNCTION_END-_picoMark_FUNCTION_BEGIN
-.initByte 0xe // DW_CFA_def_cfa_offset
-.uleb128 0x0
-.align 2
-_picoMark_FdeEnd=
-
-//============================================================================
-// Abbrevation information.
-//============================================================================
-
-.section .debug_abbrev
-_picoMark_ABBREVIATIONS=
-
-.section .debug_abbrev
- .uleb128 0x1 // (abbrev code)
- .uleb128 0x11 // (TAG: DW_TAG_compile_unit)
- .initByte 0x1 // DW_children_yes
- .uleb128 0x10 // (DW_AT_stmt_list)
- .uleb128 0x6 // (DW_FORM_data4)
- .uleb128 0x12 // (DW_AT_high_pc)
- .uleb128 0x1 // (DW_FORM_addr)
- .uleb128 0x11 // (DW_AT_low_pc)
- .uleb128 0x1 // (DW_FORM_addr)
- .uleb128 0x25 // (DW_AT_producer)
- .uleb128 0x8 // (DW_FORM_string)
- .uleb128 0x13 // (DW_AT_language)
- .uleb128 0x5 // (DW_FORM_data2)
- .uleb128 0x3 // (DW_AT_name)
- .uleb128 0x8 // (DW_FORM_string)
-.initByte 0x0
-.initByte 0x0
-
- .uleb128 0x2 ;# (abbrev code)
- .uleb128 0x2e ;# (TAG: DW_TAG_subprogram)
-.initByte 0x0 ;# DW_children_no
- .uleb128 0x3 ;# (DW_AT_name)
- .uleb128 0x8 ;# (DW_FORM_string)
- .uleb128 0x11 ;# (DW_AT_low_pc)
- .uleb128 0x1 ;# (DW_FORM_addr)
- .uleb128 0x12 ;# (DW_AT_high_pc)
- .uleb128 0x1 ;# (DW_FORM_addr)
-.initByte 0x0
-.initByte 0x0
-
-.initByte 0x0
-
-//============================================================================
-// Line information. DwarfLib requires this to be present, but it can
-// be empty.
-//============================================================================
-
-.section .debug_line
-_picoMark_LINES=
-
-//============================================================================
-// Debug Information
-//============================================================================
-.section .debug_info
-
-//Fixed header.
-.unalignedInitLong _picoMark_DEBUG_INFO_END-_picoMark_DEBUG_INFO_BEGIN
-_picoMark_DEBUG_INFO_BEGIN=
-.unalignedInitWord 0x2
-.unalignedInitLong _picoMark_ABBREVIATIONS
-.initByte 0x2
-
-// Compile unit information.
-.uleb128 0x1 // (DIE 0xb) DW_TAG_compile_unit)
-.unalignedInitLong _picoMark_LINES
-.unalignedInitWord _picoMark_FUNCTION_END
-.unalignedInitWord _picoMark_FUNCTION_BEGIN
-// Producer is `picoChip'
-.ascii 16#70# 16#69# 16#63# 16#6f# 16#43# 16#68# 16#69# 16#70# 16#00#
-.unalignedInitWord 0xcafe // ASM language
-.ascii 16#0# // Name. DwarfLib expects this to be present.
-
-.uleb128 0x2 ;# (DIE DW_TAG_subprogram)
-
-// FUNCTION NAME GOES HERE. Use `echo name | od -t x1' to get the hex. Each hex
-// digit is specified using the format 16#XX#
-.ascii 16#5f# 16#64# 16#69# 16#76# 16#6d# 16#6f# 16#64# 16#31# 16#35# 16#0# // Function name `_divmod15'
-.unalignedInitWord _picoMark_FUNCTION_BEGIN // DW_AT_low_pc
-.unalignedInitWord _picoMark_FUNCTION_END // DW_AT_high_pc
-
-.initByte 0x0 // end of compile unit children.
-
-_picoMark_DEBUG_INFO_END=
-
-//============================================================================
-// END OF DWARF
-//============================================================================
-
-.section .endFile
-// End of picoChip ASM file
diff --git a/gcc/config/picochip/libgccExtras/divmodhi4.asm b/gcc/config/picochip/libgccExtras/divmodhi4.asm
deleted file mode 100644
index 9dad674c7bc..00000000000
--- a/gcc/config/picochip/libgccExtras/divmodhi4.asm
+++ /dev/null
@@ -1,246 +0,0 @@
-// picoChip ASM file
-//
-// Support for 16-bit signed division/modulus.
-//
-// Copyright (C) 2003, 2004, 2005, 2008, 2009 Free Software Foundation, Inc.
-// Contributed by Picochip Ltd.
-// Maintained by Daniel Towner (daniel.towner@picochip.com)
-//
-// This file is free software; you can redistribute it and/or modify it
-// under the terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 3, or (at your option) any
-// later version.
-//
-// This file 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/>.
-
-.section .text
-
-.align 8
-.global __divmodhi4
-__divmodhi4:
-_picoMark_FUNCTION_BEGIN=
-
-// picoChip Function Prologue : &__divmodhi4 = 4 bytes
-
- // 16-bit signed division. Most of the special cases are dealt
- // with by the 15-bit signed division library (e.g., division by
- // zero, division by 1, and so on). This wrapper simply inverts
- // any negative inputs, calls the 15-bit library, and flips any
- // results as necessary. The
- // only special cases to be handled here are where either the
- // divisor or the dividend are the maximum negative values.
-
- // Encode r5 with a bit pattern which indicates whether the
- // outputs of the division must be negated. The MSB will be set
- // to the sign of the dividend (which controls the remainder's
- // sign), while the LSB will store the XOR of the two signs,
- // which indicates the quotient's sign. R5 is not modified by the
- // 15-bit divmod routine.
- sub.0 r1,16#8000#,r15 \ asr.1 r0,15,r4
- beq divisorIsLargestNegative \ lsr.0 r1,15,r3
-=-> sub.0 r0,16#8000#,r15 \ xor.1 r3,r4,r5
-
- // Handle least negative dividend with a special case. Note that the
- // absolute value of the divisor is also computed here.
- add.0 [asr r1,15],r1,r3 \ beq dividendIsLargestNegative
-=-> xor.0 [asr r1,15],r3,r1 \ stw lr,(fp)-1
-
- // Compute the absolute value of the dividend, and call the main
- // divide routine.
- add.0 r4,r0,r2 \ jl (&__divmod15) // fn_call &__divmod15
-=-> xor.0 r4,r2,r0
-
-handleNegatedResults:
- // Speculatively store the negation of the results.
- sub.0 0,r0,r2 \ sub.1 0,r1,r3
-
- // Does the quotient need negating? The LSB indicates this.
- and.0 r5,1,r15 \ ldw (fp)-1,lr
- copyne r2,r0
-
- asr.0 r5,15,r15 \ jr (lr)
-=-> copyne r3,r1
-
-dividendIsLargestNegative:
-
- // Divide the constant -32768. Use the Hacker's Delight
- // algorithm (i.e., ((dividend / 2) / divisor) * 2) gives
- // approximate answer). This code is a special case, so no
- // great effort is made to make it fast, only to make it
- // small.
-
- lsr.0 r0,1,r0 \ jl (&__divmod15) // fn_call &__divmod15
-=-> stw r1,(fp)-2
-
- // Load the original divisor, and compute the new quotient and
- // remainder.
- lsl.0 r0,1,r0 \ ldw (fp)-2,r3
- lsl.0 r1,1,r1 // Fill stall slot
-
- // The error in the quotient is 0 or 1. The error can be determined
- // by comparing the remainder to the original divisor. If the
- // remainder is bigger, then an error of 1 has been introduced,
- // which must be fixed.
- sub.0 r1,r3,r15
- blo noCompensationForError
-=-> nop
- add.0 r0,1,r0 \ sub.1 r1,r3,r1
-noCompensationForError:
- bra handleNegatedResults
-=-> nop
-
-divisorIsLargestNegative:
- // The flags indicate whether the dividend is also the maximum negative
- copy.0 r0,r1 \ copy.1 0,r0
- copyeq r0,r1 \ jr (lr)
-=-> copyeq 1,r0
-
-_picoMark_FUNCTION_END=
-// picoChip Function Epilogue : __divmodhi4
-
-
-//============================================================================
-// All DWARF information between this marker, and the END OF DWARF
-// marker should be included in the source file. Search for
-// FUNCTION_STACK_SIZE_GOES_HERE and FUNCTION NAME GOES HERE, and
-// provide the relevent information. Add markers called
-// _picoMark_FUNCTION_BEGIN and _picoMark_FUNCTION_END around the
-// function in question.
-//============================================================================
-
-//============================================================================
-// Frame information.
-//============================================================================
-
-.section .debug_frame
-_picoMark_DebugFrame=
-
-// Common CIE header.
-.unalignedInitLong _picoMark_CieEnd-_picoMark_CieBegin
-_picoMark_CieBegin=
-.unalignedInitLong 0xffffffff
-.initByte 0x1 // CIE Version
-.ascii 16#0# // CIE Augmentation
-.uleb128 0x1 // CIE Code Alignment Factor
-.sleb128 2 // CIE Data Alignment Factor
-.initByte 0xc // CIE RA Column
-.initByte 0xc // DW_CFA_def_cfa
-.uleb128 0xd
-.uleb128 0x0
-.align 2
-_picoMark_CieEnd=
-
-// FDE
-_picoMark_LSFDE0I900821033007563=
-.unalignedInitLong _picoMark_FdeEnd-_picoMark_FdeBegin
-_picoMark_FdeBegin=
-.unalignedInitLong _picoMark_DebugFrame // FDE CIE offset
-.unalignedInitWord _picoMark_FUNCTION_BEGIN // FDE initial location
-.unalignedInitWord _picoMark_FUNCTION_END-_picoMark_FUNCTION_BEGIN
-.initByte 0xe // DW_CFA_def_cfa_offset
-.uleb128 0x4 // <-- FUNCTION_STACK_SIZE_GOES_HERE
-.initByte 0x4 // DW_CFA_advance_loc4
-.unalignedInitLong _picoMark_FUNCTION_END-_picoMark_FUNCTION_BEGIN
-.initByte 0xe // DW_CFA_def_cfa_offset
-.uleb128 0x0
-.align 2
-_picoMark_FdeEnd=
-
-//============================================================================
-// Abbrevation information.
-//============================================================================
-
-.section .debug_abbrev
-_picoMark_ABBREVIATIONS=
-
-.section .debug_abbrev
- .uleb128 0x1 // (abbrev code)
- .uleb128 0x11 // (TAG: DW_TAG_compile_unit)
- .initByte 0x1 // DW_children_yes
- .uleb128 0x10 // (DW_AT_stmt_list)
- .uleb128 0x6 // (DW_FORM_data4)
- .uleb128 0x12 // (DW_AT_high_pc)
- .uleb128 0x1 // (DW_FORM_addr)
- .uleb128 0x11 // (DW_AT_low_pc)
- .uleb128 0x1 // (DW_FORM_addr)
- .uleb128 0x25 // (DW_AT_producer)
- .uleb128 0x8 // (DW_FORM_string)
- .uleb128 0x13 // (DW_AT_language)
- .uleb128 0x5 // (DW_FORM_data2)
- .uleb128 0x3 // (DW_AT_name)
- .uleb128 0x8 // (DW_FORM_string)
-.initByte 0x0
-.initByte 0x0
-
- .uleb128 0x2 ;# (abbrev code)
- .uleb128 0x2e ;# (TAG: DW_TAG_subprogram)
-.initByte 0x0 ;# DW_children_no
- .uleb128 0x3 ;# (DW_AT_name)
- .uleb128 0x8 ;# (DW_FORM_string)
- .uleb128 0x11 ;# (DW_AT_low_pc)
- .uleb128 0x1 ;# (DW_FORM_addr)
- .uleb128 0x12 ;# (DW_AT_high_pc)
- .uleb128 0x1 ;# (DW_FORM_addr)
-.initByte 0x0
-.initByte 0x0
-
-.initByte 0x0
-
-//============================================================================
-// Line information. DwarfLib requires this to be present, but it can
-// be empty.
-//============================================================================
-
-.section .debug_line
-_picoMark_LINES=
-
-//============================================================================
-// Debug Information
-//============================================================================
-.section .debug_info
-
-//Fixed header.
-.unalignedInitLong _picoMark_DEBUG_INFO_END-_picoMark_DEBUG_INFO_BEGIN
-_picoMark_DEBUG_INFO_BEGIN=
-.unalignedInitWord 0x2
-.unalignedInitLong _picoMark_ABBREVIATIONS
-.initByte 0x2
-
-// Compile unit information.
-.uleb128 0x1 // (DIE 0xb) DW_TAG_compile_unit)
-.unalignedInitLong _picoMark_LINES
-.unalignedInitWord _picoMark_FUNCTION_END
-.unalignedInitWord _picoMark_FUNCTION_BEGIN
-// Producer is `picoChip'
-.ascii 16#70# 16#69# 16#63# 16#6f# 16#43# 16#68# 16#69# 16#70# 16#00#
-.unalignedInitWord 0xcafe // ASM language
-.ascii 16#0# // Name. DwarfLib expects this to be present.
-
-.uleb128 0x2 ;# (DIE DW_TAG_subprogram)
-
-// FUNCTION NAME GOES HERE. Use `echo name | od -t x1' to get the hex. Each hex
-// digit is specified using the format 16#XX#
-.ascii 16#5f# 16#64# 16#69# 16#76# 16#6d# 16#6f# 16#64# 16#68# 16#69# 16#34# 16#0# // Function name `_divmodhi4'
-.unalignedInitWord _picoMark_FUNCTION_BEGIN // DW_AT_low_pc
-.unalignedInitWord _picoMark_FUNCTION_END // DW_AT_high_pc
-
-.initByte 0x0 // end of compile unit children.
-
-_picoMark_DEBUG_INFO_END=
-
-//============================================================================
-// END OF DWARF
-//============================================================================
-.section .endFile
diff --git a/gcc/config/picochip/libgccExtras/divmodsi4.asm b/gcc/config/picochip/libgccExtras/divmodsi4.asm
deleted file mode 100644
index 4fc1acb1b63..00000000000
--- a/gcc/config/picochip/libgccExtras/divmodsi4.asm
+++ /dev/null
@@ -1,233 +0,0 @@
-// picoChip ASM file
-//
-// Support for 32-bit signed division/modulus.
-//
-// Copyright (C) 2003, 2004, 2005, 2008, 2009 Free Software Foundation, Inc.
-// Contributed by Picochip Ltd.
-// Maintained by Daniel Towner (daniel.towner@picochip.com)
-//
-// This file is free software; you can redistribute it and/or modify it
-// under the terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 3, or (at your option) any
-// later version.
-//
-// This file 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/>.
-
-.section .text
-
-.align 8
-.global __divmodsi4
-__divmodsi4:
-_picoMark_FUNCTION_BEGIN=
-// picoChip Function Prologue : &__divmodsi4 = 8 bytes
-
- // Note: optimising for size is preferred over optimising for speed.
-
- // Note: the frame is setup throughout the following instructions,
- // and is complete at the point the udivmodsi4 function is called.
-
- // Note that R9 is encoded with a pattern which indicates
- // whether the remainder and quotient should be negated on
- // completion. The MSB is set to the sign of the dividend
- // (i.e., the sign of the remainder), while the LSB encodes
- // the XOR of the two input's signs (i.e., the sign of the
- // quotient.
-
- // If dividend is negative, invert the dividend and flag.
- ASR.0 r1,15,r4
- BEQ dividendNotNegative
-=-> STL R[9:8],(FP)-2
-
- // Dividend is negative - negate dividend.
- SUB.0 0,R0,R0
- SUBB.0 0,R1,R1
-
-dividendNotNegative:
-
- // If divisor is negative, invert the divisor.
- AND.0 [lsr r3,15],1,r5
- SUB.0 R3,0, r15
- BGE divisorNotNegative
-=-> XOR.0 r4,r5,r9
-
- // Divisor is negative - negate divisor.
- SUB.0 0,R2,R2
- SUBB.0 0,R3,R3
-
-divisorNotNegative:
-
- STL R[13:12],(FP)-1 \ JL (&__udivmodsi4)
-=-> SUB.0 FP,8,FP // udivmodsi expects the frame to be valid still.
-
- // The LSB of R9 indicates whether the quotient should be negated.
- AND.0 r9,1,r15
- BEQ skipQuotientNegation
-=-> LDL (FP)1,R[13:12] // Convenient point to restore link/fp
-
- SUB.0 0,R4,R4
- SUBB.0 0,R5,R5
-
-skipQuotientNegation:
-
- // The MSB of R9 indicates whether the remainder should be negated.
- ASR.0 R9,15,r15
- BEQ epilogue
-
- SUB.0 0,R6,R6
- SUBB.0 0,R7,R7
-
-epilogue:
-
- JR (R12)
-=-> LDL (FP)-2,R[9:8]
-
-_picoMark_FUNCTION_END=
-// picoChip Function Epilogue : __divmodsi4
-
-//============================================================================
-// All DWARF information between this marker, and the END OF DWARF
-// marker should be included in the source file. Search for
-// FUNCTION_STACK_SIZE_GOES_HERE and FUNCTION NAME GOES HERE, and
-// provide the relevent information. Add markers called
-// _picoMark_FUNCTION_BEGIN and _picoMark_FUNCTION_END around the
-// function in question.
-//============================================================================
-
-//============================================================================
-// Frame information.
-//============================================================================
-
-.section .debug_frame
-_picoMark_DebugFrame=
-
-// Common CIE header.
-.unalignedInitLong _picoMark_CieEnd-_picoMark_CieBegin
-_picoMark_CieBegin=
-.unalignedInitLong 0xffffffff
-.initByte 0x1 // CIE Version
-.ascii 16#0# // CIE Augmentation
-.uleb128 0x1 // CIE Code Alignment Factor
-.sleb128 2 // CIE Data Alignment Factor
-.initByte 0xc // CIE RA Column
-.initByte 0xc // DW_CFA_def_cfa
-.uleb128 0xd
-.uleb128 0x0
-.align 2
-_picoMark_CieEnd=
-
-// FDE
-_picoMark_LSFDE0I900821033007563=
-.unalignedInitLong _picoMark_FdeEnd-_picoMark_FdeBegin
-_picoMark_FdeBegin=
-.unalignedInitLong _picoMark_DebugFrame // FDE CIE offset
-.unalignedInitWord _picoMark_FUNCTION_BEGIN // FDE initial location
-.unalignedInitWord _picoMark_FUNCTION_END-_picoMark_FUNCTION_BEGIN
-.initByte 0xe // DW_CFA_def_cfa_offset
-.uleb128 0x8 // <-- FUNCTION_STACK_SIZE_GOES_HERE
-.initByte 0x4 // DW_CFA_advance_loc4
-.unalignedInitLong _picoMark_FUNCTION_END-_picoMark_FUNCTION_BEGIN
-.initByte 0xe // DW_CFA_def_cfa_offset
-.uleb128 0x0
-.align 2
-_picoMark_FdeEnd=
-
-//============================================================================
-// Abbrevation information.
-//============================================================================
-
-.section .debug_abbrev
-_picoMark_ABBREVIATIONS=
-
-.section .debug_abbrev
- .uleb128 0x1 // (abbrev code)
- .uleb128 0x11 // (TAG: DW_TAG_compile_unit)
- .initByte 0x1 // DW_children_yes
- .uleb128 0x10 // (DW_AT_stmt_list)
- .uleb128 0x6 // (DW_FORM_data4)
- .uleb128 0x12 // (DW_AT_high_pc)
- .uleb128 0x1 // (DW_FORM_addr)
- .uleb128 0x11 // (DW_AT_low_pc)
- .uleb128 0x1 // (DW_FORM_addr)
- .uleb128 0x25 // (DW_AT_producer)
- .uleb128 0x8 // (DW_FORM_string)
- .uleb128 0x13 // (DW_AT_language)
- .uleb128 0x5 // (DW_FORM_data2)
- .uleb128 0x3 // (DW_AT_name)
- .uleb128 0x8 // (DW_FORM_string)
-.initByte 0x0
-.initByte 0x0
-
- .uleb128 0x2 ;# (abbrev code)
- .uleb128 0x2e ;# (TAG: DW_TAG_subprogram)
-.initByte 0x0 ;# DW_children_no
- .uleb128 0x3 ;# (DW_AT_name)
- .uleb128 0x8 ;# (DW_FORM_string)
- .uleb128 0x11 ;# (DW_AT_low_pc)
- .uleb128 0x1 ;# (DW_FORM_addr)
- .uleb128 0x12 ;# (DW_AT_high_pc)
- .uleb128 0x1 ;# (DW_FORM_addr)
-.initByte 0x0
-.initByte 0x0
-
-.initByte 0x0
-
-//============================================================================
-// Line information. DwarfLib requires this to be present, but it can
-// be empty.
-//============================================================================
-
-.section .debug_line
-_picoMark_LINES=
-
-//============================================================================
-// Debug Information
-//============================================================================
-.section .debug_info
-
-//Fixed header.
-.unalignedInitLong _picoMark_DEBUG_INFO_END-_picoMark_DEBUG_INFO_BEGIN
-_picoMark_DEBUG_INFO_BEGIN=
-.unalignedInitWord 0x2
-.unalignedInitLong _picoMark_ABBREVIATIONS
-.initByte 0x2
-
-// Compile unit information.
-.uleb128 0x1 // (DIE 0xb) DW_TAG_compile_unit)
-.unalignedInitLong _picoMark_LINES
-.unalignedInitWord _picoMark_FUNCTION_END
-.unalignedInitWord _picoMark_FUNCTION_BEGIN
-// Producer is `picoChip'
-.ascii 16#70# 16#69# 16#63# 16#6f# 16#43# 16#68# 16#69# 16#70# 16#00#
-.unalignedInitWord 0xcafe // ASM language
-.ascii 16#0# // Name. DwarfLib expects this to be present.
-
-.uleb128 0x2 ;# (DIE DW_TAG_subprogram)
-
-// FUNCTION NAME GOES HERE. Use `echo name | od -t x1' to get the hex. Each hex
-// digit is specified using the format 16#XX#
-.ascii 16#5f# 16#64# 16#69# 16#76# 16#6d# 16#6f# 16#64# 16#73# 16#69# 16#34# 16#0# // Function name `_divmodsi4'
-.unalignedInitWord _picoMark_FUNCTION_BEGIN // DW_AT_low_pc
-.unalignedInitWord _picoMark_FUNCTION_END // DW_AT_high_pc
-
-.initByte 0x0 // end of compile unit children.
-
-_picoMark_DEBUG_INFO_END=
-
-//============================================================================
-// END OF DWARF
-//============================================================================
-
-.section .endFile
-// End of picoChip ASM file
diff --git a/gcc/config/picochip/libgccExtras/fake_libgcc.asm b/gcc/config/picochip/libgccExtras/fake_libgcc.asm
deleted file mode 100644
index e4b78f1e1f1..00000000000
--- a/gcc/config/picochip/libgccExtras/fake_libgcc.asm
+++ /dev/null
@@ -1,6 +0,0 @@
-// picoChip ASM file
-// Fake libgcc asm file. This contains nothing, but is used to prevent gcc
-// getting upset about the lack of a libgcc.S file when LIB1ASMFUNCS is defined
-// to switch off the compilation of parts of libgcc.
-
-
diff --git a/gcc/config/picochip/libgccExtras/longjmp.asm b/gcc/config/picochip/libgccExtras/longjmp.asm
deleted file mode 100644
index d2a80aca730..00000000000
--- a/gcc/config/picochip/libgccExtras/longjmp.asm
+++ /dev/null
@@ -1,182 +0,0 @@
-// picoChip ASM file
-//
-// Support for 32-bit arithmetic shift right.
-//
-// Copyright (C) 2003, 2004, 2005, 2008, 2009 Free Software Foundation, Inc.
-// Contributed by Picochip Ltd.
-// Maintained by Hariharan Sandanagobalane (hariharan@picochip.com)
-//
-// This file is free software; you can redistribute it and/or modify it
-// under the terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 3, or (at your option) any
-// later version.
-//
-// This file 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/>.
-
-.section .text
-
-.global _longjmp
-_longjmp:
-_picoMark_FUNCTION_BEGIN=
-
-// picoChip Function Prologue : &_longjmp = 0 bytes
-
- LDL (R0)0, R[3:2]
- LDL (R0)1, R[5:4]
- LDL (R0)2, R[7:6]
- LDL (R0)3, R[9:8]
- LDL (R0)4, R[11:10]
- LDL (R0)5, R[13:12]
- LDW (R0)12, R14
- LDW (R0)13, R1
- JR (R12)
-=-> COPY.0 1,R0
-
-// picoChip Function Epilogue : longjmp
-//============================================================================
-// All DWARF information between this marker, and the END OF DWARF
-// marker should be included in the source file. Search for
-// FUNCTION_STACK_SIZE_GOES_HERE and FUNCTION NAME GOES HERE, and
-// provide the relevent information. Add markers called
-// _picoMark_FUNCTION_BEGIN and _picoMark_FUNCTION_END around the
-// function in question.
-//============================================================================
-
-//============================================================================
-// Frame information.
-//============================================================================
-
-.section .debug_frame
-_picoMark_DebugFrame=
-
-// Common CIE header.
-.unalignedInitLong _picoMark_CieEnd-_picoMark_CieBegin
-_picoMark_CieBegin=
-.unalignedInitLong 0xffffffff
-.initByte 0x1 // CIE Version
-.ascii 16#0# // CIE Augmentation
-.uleb128 0x1 // CIE Code Alignment Factor
-.sleb128 2 // CIE Data Alignment Factor
-.initByte 0xc // CIE RA Column
-.initByte 0xc // DW_CFA_def_cfa
-.uleb128 0xd
-.uleb128 0x0
-.align 2
-_picoMark_CieEnd=
-
-// FDE
-_picoMark_LSFDE0I900821033007563=
-.unalignedInitLong _picoMark_FdeEnd-_picoMark_FdeBegin
-_picoMark_FdeBegin=
-.unalignedInitLong _picoMark_DebugFrame // FDE CIE offset
-.unalignedInitWord _picoMark_FUNCTION_BEGIN // FDE initial location
-.unalignedInitWord _picoMark_FUNCTION_END-_picoMark_FUNCTION_BEGIN
-.initByte 0xe // DW_CFA_def_cfa_offset
-.uleb128 0x0 // <-- FUNCTION_STACK_SIZE_GOES_HERE
-.initByte 0x4 // DW_CFA_advance_loc4
-.unalignedInitLong _picoMark_FUNCTION_END-_picoMark_FUNCTION_BEGIN
-.initByte 0xe // DW_CFA_def_cfa_offset
-.uleb128 0x0
-.align 2
-_picoMark_FdeEnd=
-
-//============================================================================
-// Abbrevation information.
-//============================================================================
-
-.section .debug_abbrev
-_picoMark_ABBREVIATIONS=
-
-.section .debug_abbrev
- .uleb128 0x1 // (abbrev code)
- .uleb128 0x11 // (TAG: DW_TAG_compile_unit)
- .initByte 0x1 // DW_children_yes
- .uleb128 0x10 // (DW_AT_stmt_list)
- .uleb128 0x6 // (DW_FORM_data4)
- .uleb128 0x12 // (DW_AT_high_pc)
- .uleb128 0x1 // (DW_FORM_addr)
- .uleb128 0x11 // (DW_AT_low_pc)
- .uleb128 0x1 // (DW_FORM_addr)
- .uleb128 0x25 // (DW_AT_producer)
- .uleb128 0x8 // (DW_FORM_string)
- .uleb128 0x13 // (DW_AT_language)
- .uleb128 0x5 // (DW_FORM_data2)
- .uleb128 0x3 // (DW_AT_name)
- .uleb128 0x8 // (DW_FORM_string)
-.initByte 0x0
-.initByte 0x0
-
- .uleb128 0x2 ;# (abbrev code)
- .uleb128 0x2e ;# (TAG: DW_TAG_subprogram)
-.initByte 0x0 ;# DW_children_no
- .uleb128 0x3 ;# (DW_AT_name)
- .uleb128 0x8 ;# (DW_FORM_string)
- .uleb128 0x11 ;# (DW_AT_low_pc)
- .uleb128 0x1 ;# (DW_FORM_addr)
- .uleb128 0x12 ;# (DW_AT_high_pc)
- .uleb128 0x1 ;# (DW_FORM_addr)
-.initByte 0x0
-.initByte 0x0
-
-.initByte 0x0
-
-//============================================================================
-// Line information. DwarfLib requires this to be present, but it can
-// be empty.
-//============================================================================
-
-.section .debug_line
-_picoMark_LINES=
-
-//============================================================================
-// Debug Information
-//============================================================================
-.section .debug_info
-
-//Fixed header.
-.unalignedInitLong _picoMark_DEBUG_INFO_END-_picoMark_DEBUG_INFO_BEGIN
-_picoMark_DEBUG_INFO_BEGIN=
-.unalignedInitWord 0x2
-.unalignedInitLong _picoMark_ABBREVIATIONS
-.initByte 0x2
-
-// Compile unit information.
-.uleb128 0x1 // (DIE 0xb) DW_TAG_compile_unit)
-.unalignedInitLong _picoMark_LINES
-.unalignedInitWord _picoMark_FUNCTION_END
-.unalignedInitWord _picoMark_FUNCTION_BEGIN
-// Producer is `picoChip'
-.ascii 16#70# 16#69# 16#63# 16#6f# 16#43# 16#68# 16#69# 16#70# 16#00#
-.unalignedInitWord 0xcafe // ASM language
-.ascii 16#0# // Name. DwarfLib expects this to be present.
-
-.uleb128 0x2 ;# (DIE DW_TAG_subprogram)
-
-// FUNCTION NAME GOES HERE. Use `echo name | od -t x1' to get the hex. Each hex
-// digit is specified using the format 16#XX#
-.ascii 16#6c# 16#6f# 16#6e# 16#67# 16#6a# 16#6d# 16#70# 16#0# // Function name `longjmp'
-.unalignedInitWord _picoMark_FUNCTION_BEGIN // DW_AT_low_pc
-.unalignedInitWord _picoMark_FUNCTION_END // DW_AT_high_pc
-
-.initByte 0x0 // end of compile unit children.
-
-_picoMark_DEBUG_INFO_END=
-
-//============================================================================
-// END OF DWARF
-//============================================================================
-
-.section .endFile
-// End of picoChip ASM file
diff --git a/gcc/config/picochip/libgccExtras/lshrsi3.asm b/gcc/config/picochip/libgccExtras/lshrsi3.asm
deleted file mode 100644
index 4fc53902955..00000000000
--- a/gcc/config/picochip/libgccExtras/lshrsi3.asm
+++ /dev/null
@@ -1,190 +0,0 @@
-// picoChip ASM file
-//
-// Support for 32-bit logical shift right.
-//
-// Copyright (C) 2003, 2004, 2005, 2008, 2009 Free Software Foundation, Inc.
-// Contributed by Picochip Ltd.
-// Maintained by Hariharan Sandanagobalane (hariharan@picochip.com)
-//
-// This file is free software; you can redistribute it and/or modify it
-// under the terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 3, or (at your option) any
-// later version.
-//
-// This file 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/>.
-.section .text
-
-.global ___lshrsi3
-___lshrsi3:
-_picoMark_FUNCTION_BEGIN=
-
-// picoChip Function Prologue : &___lshrsi3 = 4 bytes
-
- // if (R2 > 15) goto _L2
- SUB.0 15,R2,r15
- JMPLT _L2
-=-> SUB.0 16,R2,R5 // R5 := R5 - R2 (HI)
-
- LSR.0 R0,R2,R0 // R4 := R0 >> R2
- LSR.0 R1,R2,R3 // R3 := R1 >> R2
- // if (R2 == 0) goto _L4
- LSL.0 R1,R5,R5 // R5 := R1 << R5
- OR.0 R5,R0,R4 // R2 := R5 IOR R2 (HI)
- SUB.0 R2,0,r15
- COPYNE R4,R0 // R0 := R2
- JR (R12) // Return to caller
-=-> COPY.0 R3,R1 // R1 := R3
-
-_L2:
- LSR.0 R1,R2,R0 // R2 := R1 >> R2
- JR (R12) // Return to caller
-=-> COPY.0 0,R1 // R3 := 0 (short constant)
-
-_picoMark_FUNCTION_END=
-// picoChip Function Epilogue : __lshrsi3
-
-//============================================================================
-// All DWARF information between this marker, and the END OF DWARF
-// marker should be included in the source file. Search for
-// FUNCTION_STACK_SIZE_GOES_HERE and FUNCTION NAME GOES HERE, and
-// provide the relevent information. Add markers called
-// _picoMark_FUNCTION_BEGIN and _picoMark_FUNCTION_END around the
-// function in question.
-//============================================================================
-
-//============================================================================
-// Frame information.
-//============================================================================
-
-.section .debug_frame
-_picoMark_DebugFrame=
-
-// Common CIE header.
-.unalignedInitLong _picoMark_CieEnd-_picoMark_CieBegin
-_picoMark_CieBegin=
-.unalignedInitLong 0xffffffff
-.initByte 0x1 // CIE Version
-.ascii 16#0# // CIE Augmentation
-.uleb128 0x1 // CIE Code Alignment Factor
-.sleb128 2 // CIE Data Alignment Factor
-.initByte 0xc // CIE RA Column
-.initByte 0xc // DW_CFA_def_cfa
-.uleb128 0xd
-.uleb128 0x0
-.align 2
-_picoMark_CieEnd=
-
-// FDE
-_picoMark_LSFDE0I900821033007563=
-.unalignedInitLong _picoMark_FdeEnd-_picoMark_FdeBegin
-_picoMark_FdeBegin=
-.unalignedInitLong _picoMark_DebugFrame // FDE CIE offset
-.unalignedInitWord _picoMark_FUNCTION_BEGIN // FDE initial location
-.unalignedInitWord _picoMark_FUNCTION_END-_picoMark_FUNCTION_BEGIN
-.initByte 0xe // DW_CFA_def_cfa_offset
-.uleb128 0x4 // <-- FUNCTION_STACK_SIZE_GOES_HERE
-.initByte 0x4 // DW_CFA_advance_loc4
-.unalignedInitLong _picoMark_FUNCTION_END-_picoMark_FUNCTION_BEGIN
-.initByte 0xe // DW_CFA_def_cfa_offset
-.uleb128 0x0
-.align 2
-_picoMark_FdeEnd=
-
-//============================================================================
-// Abbrevation information.
-//============================================================================
-
-.section .debug_abbrev
-_picoMark_ABBREVIATIONS=
-
-.section .debug_abbrev
- .uleb128 0x1 // (abbrev code)
- .uleb128 0x11 // (TAG: DW_TAG_compile_unit)
- .initByte 0x1 // DW_children_yes
- .uleb128 0x10 // (DW_AT_stmt_list)
- .uleb128 0x6 // (DW_FORM_data4)
- .uleb128 0x12 // (DW_AT_high_pc)
- .uleb128 0x1 // (DW_FORM_addr)
- .uleb128 0x11 // (DW_AT_low_pc)
- .uleb128 0x1 // (DW_FORM_addr)
- .uleb128 0x25 // (DW_AT_producer)
- .uleb128 0x8 // (DW_FORM_string)
- .uleb128 0x13 // (DW_AT_language)
- .uleb128 0x5 // (DW_FORM_data2)
- .uleb128 0x3 // (DW_AT_name)
- .uleb128 0x8 // (DW_FORM_string)
-.initByte 0x0
-.initByte 0x0
-
- .uleb128 0x2 ;# (abbrev code)
- .uleb128 0x2e ;# (TAG: DW_TAG_subprogram)
-.initByte 0x0 ;# DW_children_no
- .uleb128 0x3 ;# (DW_AT_name)
- .uleb128 0x8 ;# (DW_FORM_string)
- .uleb128 0x11 ;# (DW_AT_low_pc)
- .uleb128 0x1 ;# (DW_FORM_addr)
- .uleb128 0x12 ;# (DW_AT_high_pc)
- .uleb128 0x1 ;# (DW_FORM_addr)
-.initByte 0x0
-.initByte 0x0
-
-.initByte 0x0
-
-//============================================================================
-// Line information. DwarfLib requires this to be present, but it can
-// be empty.
-//============================================================================
-
-.section .debug_line
-_picoMark_LINES=
-
-//============================================================================
-// Debug Information
-//============================================================================
-.section .debug_info
-
-//Fixed header.
-.unalignedInitLong _picoMark_DEBUG_INFO_END-_picoMark_DEBUG_INFO_BEGIN
-_picoMark_DEBUG_INFO_BEGIN=
-.unalignedInitWord 0x2
-.unalignedInitLong _picoMark_ABBREVIATIONS
-.initByte 0x2
-
-// Compile unit information.
-.uleb128 0x1 // (DIE 0xb) DW_TAG_compile_unit)
-.unalignedInitLong _picoMark_LINES
-.unalignedInitWord _picoMark_FUNCTION_END
-.unalignedInitWord _picoMark_FUNCTION_BEGIN
-// Producer is `picoChip'
-.ascii 16#70# 16#69# 16#63# 16#6f# 16#43# 16#68# 16#69# 16#70# 16#00#
-.unalignedInitWord 0xcafe // ASM language
-.ascii 16#0# // Name. DwarfLib expects this to be present.
-
-.uleb128 0x2 ;# (DIE DW_TAG_subprogram)
-
-// FUNCTION NAME GOES HERE. Use `echo name | od -t x1' to get the hex. Each hex
-// digit is specified using the format 16#XX#
-.ascii 16#5f# 16#5f# 16#6c# 16#73# 16#68# 16#72# 16#72# 16#73# 16#69# 16#33# 16#0# // Function name `__lshrsi3'
-.unalignedInitWord _picoMark_FUNCTION_BEGIN // DW_AT_low_pc
-.unalignedInitWord _picoMark_FUNCTION_END // DW_AT_high_pc
-
-.initByte 0x0 // end of compile unit children.
-
-_picoMark_DEBUG_INFO_END=
-
-//============================================================================
-// END OF DWARF
-//============================================================================
-.section .endFile
diff --git a/gcc/config/picochip/libgccExtras/lshrsi3.c b/gcc/config/picochip/libgccExtras/lshrsi3.c
deleted file mode 100644
index fa32dc726ef..00000000000
--- a/gcc/config/picochip/libgccExtras/lshrsi3.c
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
-
-picoChip GCC support for 32-bit logical shift right.
-
-Copyright (C) 2003, 2004, 2005, 2008, 2009 Free Software Foundation, Inc.
-Contributed by Picochip Ltd.
-Maintained by Daniel Towner (daniel.towner@picochip.com)
-
-This file is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3, or (at your option) any
-later version.
-
-This file 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/>. */
-
-typedef int HItype __attribute__ ((mode (HI)));
-typedef unsigned int UHItype __attribute__ ((mode (HI)));
-typedef unsigned int USItype __attribute__ ((mode (SI)));
-
-typedef struct USIstruct {
- UHItype low, high;
-} USIstruct;
-
-typedef union USIunion {
- USItype l;
- USIstruct s;
-} USIunion;
-
-USItype __lshrsi3(USIunion value, HItype count) {
- USIunion result;
- int temp;
-
- /* Ignore a zero count until we get into the (count < 16)
- clause. This is slightly slower when shifting by zero, but faster
- and smaller in all other cases (due to the better scheduling
- opportunities available by putting the test near computational
- instructions. */
-
- if (count < 16) {
- /* Shift low and high words by the count. */
- result.s.low = value.s.low >> count;
- result.s.high = value.s.high >> count;
-
- /* There is now a hole in the upper `count' bits of the low
- word. Shift the lower `count' bits of the upper word into the
- low word. This only works when count isn't zero. */
- if (count != 0) {
- temp = value.s.high << (16 - count);
- result.s.low |= temp;
- }
-
- } else {
- /* Shift the upper word of the source into the lower word of the
- result, and zero the result's upper word. Note that we actually
- ned to shift by (count - 16), but as we are only using the
- bottom 4 bits, this is equivalent to shifting by count. */
- result.s.low = value.s.high >> count;
- result.s.high = 0;
-
- }
-
- return result.l;
-
-}
diff --git a/gcc/config/picochip/libgccExtras/parityhi2.asm b/gcc/config/picochip/libgccExtras/parityhi2.asm
deleted file mode 100644
index b9d0cdc63dd..00000000000
--- a/gcc/config/picochip/libgccExtras/parityhi2.asm
+++ /dev/null
@@ -1,179 +0,0 @@
-// picoChip ASM file
-//.file "ucmpsi2.c"
-//
-// Support for parity checks.
-//
-// Copyright (C) 2003, 2004, 2005, 2008, 2009 Free Software Foundation, Inc.
-// Contributed by Picochip Ltd.
-// Maintained by Daniel Towner (daniel.towner@picochip.com)
-//
-// This file is free software; you can redistribute it and/or modify it
-// under the terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 3, or (at your option) any
-// later version.
-//
-// This file 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/>.
-
-.section .text
-
-.align 8
-.global ___parityhi2
-___parityhi2:
-_picoMark_FUNCTION_BEGIN=
-
-// picoChip Function Prologue : &___parityhi2 = 0 bytes
- XOR.0 [LSR R0,8],R0,R0
- XOR.0 [LSR R0,4],R0,R0
- XOR.0 [LSR R0,2],R0,R0
- JR (R12) \ XOR.0 [LSR R0,1],R0,R0
-=-> AND.0 R0,1,R0
-
-_picoMark_FUNCTION_END=
-// picoChip Function Epilogue : __parityhi2
-//============================================================================
-// All DWARF information between this marker, and the END OF DWARF
-// marker should be included in the source file. Search for
-// FUNCTION_STACK_SIZE_GOES_HERE and FUNCTION NAME GOES HERE, and
-// provide the relevent information. Add markers called
-// _picoMark_FUNCTION_BEGIN and _picoMark_FUNCTION_END around the
-// function in question.
-//============================================================================
-
-//============================================================================
-// Frame information.
-//============================================================================
-
-.section .debug_frame
-_picoMark_DebugFrame=
-
-// Common CIE header.
-.unalignedInitLong _picoMark_CieEnd-_picoMark_CieBegin
-_picoMark_CieBegin=
-.unalignedInitLong 0xffffffff
-.initByte 0x1 // CIE Version
-.ascii 16#0# // CIE Augmentation
-.uleb128 0x1 // CIE Code Alignment Factor
-.sleb128 2 // CIE Data Alignment Factor
-.initByte 0xc // CIE RA Column
-.initByte 0xc // DW_CFA_def_cfa
-.uleb128 0xd
-.uleb128 0x0
-.align 2
-_picoMark_CieEnd=
-
-// FDE
-_picoMark_LSFDE0I900821033007563=
-.unalignedInitLong _picoMark_FdeEnd-_picoMark_FdeBegin
-_picoMark_FdeBegin=
-.unalignedInitLong _picoMark_DebugFrame // FDE CIE offset
-.unalignedInitWord _picoMark_FUNCTION_BEGIN // FDE initial location
-.unalignedInitWord _picoMark_FUNCTION_END-_picoMark_FUNCTION_BEGIN
-.initByte 0xe // DW_CFA_def_cfa_offset
-.uleb128 0x0 // <-- FUNCTION_STACK_SIZE_GOES_HERE
-.initByte 0x4 // DW_CFA_advance_loc4
-.unalignedInitLong _picoMark_FUNCTION_END-_picoMark_FUNCTION_BEGIN
-.initByte 0xe // DW_CFA_def_cfa_offset
-.uleb128 0x0
-.align 2
-_picoMark_FdeEnd=
-
-//============================================================================
-// Abbrevation information.
-//============================================================================
-
-.section .debug_abbrev
-_picoMark_ABBREVIATIONS=
-
-.section .debug_abbrev
- .uleb128 0x1 // (abbrev code)
- .uleb128 0x11 // (TAG: DW_TAG_compile_unit)
- .initByte 0x1 // DW_children_yes
- .uleb128 0x10 // (DW_AT_stmt_list)
- .uleb128 0x6 // (DW_FORM_data4)
- .uleb128 0x12 // (DW_AT_high_pc)
- .uleb128 0x1 // (DW_FORM_addr)
- .uleb128 0x11 // (DW_AT_low_pc)
- .uleb128 0x1 // (DW_FORM_addr)
- .uleb128 0x25 // (DW_AT_producer)
- .uleb128 0x8 // (DW_FORM_string)
- .uleb128 0x13 // (DW_AT_language)
- .uleb128 0x5 // (DW_FORM_data2)
- .uleb128 0x3 // (DW_AT_name)
- .uleb128 0x8 // (DW_FORM_string)
-.initByte 0x0
-.initByte 0x0
-
- .uleb128 0x2 ;# (abbrev code)
- .uleb128 0x2e ;# (TAG: DW_TAG_subprogram)
-.initByte 0x0 ;# DW_children_no
- .uleb128 0x3 ;# (DW_AT_name)
- .uleb128 0x8 ;# (DW_FORM_string)
- .uleb128 0x11 ;# (DW_AT_low_pc)
- .uleb128 0x1 ;# (DW_FORM_addr)
- .uleb128 0x12 ;# (DW_AT_high_pc)
- .uleb128 0x1 ;# (DW_FORM_addr)
-.initByte 0x0
-.initByte 0x0
-
-.initByte 0x0
-
-//============================================================================
-// Line information. DwarfLib requires this to be present, but it can
-// be empty.
-//============================================================================
-
-.section .debug_line
-_picoMark_LINES=
-
-//============================================================================
-// Debug Information
-//============================================================================
-.section .debug_info
-
-//Fixed header.
-.unalignedInitLong _picoMark_DEBUG_INFO_END-_picoMark_DEBUG_INFO_BEGIN
-_picoMark_DEBUG_INFO_BEGIN=
-.unalignedInitWord 0x2
-.unalignedInitLong _picoMark_ABBREVIATIONS
-.initByte 0x2
-
-// Compile unit information.
-.uleb128 0x1 // (DIE 0xb) DW_TAG_compile_unit)
-.unalignedInitLong _picoMark_LINES
-.unalignedInitWord _picoMark_FUNCTION_END
-.unalignedInitWord _picoMark_FUNCTION_BEGIN
-// Producer is `picoChip'
-.ascii 16#70# 16#69# 16#63# 16#6f# 16#43# 16#68# 16#69# 16#70# 16#00#
-.unalignedInitWord 0xcafe // ASM language
-.ascii 16#0# // Name. DwarfLib expects this to be present.
-
-.uleb128 0x2 ;# (DIE DW_TAG_subprogram)
-
-// FUNCTION NAME GOES HERE. Use `echo name | od -t x1' to get the hex. Each hex
-// digit is specified using the format 16#XX#
-.ascii 16#5f# 16#5f# 16#70# 16#61# 16#72# 16#69# 16#74# 16#79# 16#68# 16#69# 16#32# 16#0# // Function name `__parityhi2'
-.unalignedInitWord _picoMark_FUNCTION_BEGIN // DW_AT_low_pc
-.unalignedInitWord _picoMark_FUNCTION_END // DW_AT_high_pc
-
-.initByte 0x0 // end of compile unit children.
-
-_picoMark_DEBUG_INFO_END=
-
-//============================================================================
-// END OF DWARF
-//============================================================================
-
-.section .endFile
-// End of picoChip ASM file
diff --git a/gcc/config/picochip/libgccExtras/popcounthi2.asm b/gcc/config/picochip/libgccExtras/popcounthi2.asm
deleted file mode 100644
index 2da618c96de..00000000000
--- a/gcc/config/picochip/libgccExtras/popcounthi2.asm
+++ /dev/null
@@ -1,201 +0,0 @@
-// picoChip ASM file
-//.file "popcounthi2.S"
-//
-// Support for 16-bit population count.
-//
-// Copyright (C) 2003, 2004, 2005, 2008, 2009 Free Software Foundation, Inc.
-// Contributed by Picochip Ltd.
-// Maintained by Daniel Towner (daniel.towner@picochip.com)
-//
-// This file is free software; you can redistribute it and/or modify it
-// under the terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 3, or (at your option) any
-// later version.
-//
-// This file 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/>.
-
-.section .text
-
-// The following code (taken from a newsgroup posting) was compiled, and then
-// hand assembled (a similar version is given in the Hacker's Delight
-// book, chapter 5).
-//
-// int
-// popcount (int value)
-// {
-// value = ((value & 0xAAAA) >> 1) + (value & 0x5555);
-// value = ((value & 0xCCCC) >> 2) + (value & 0x3333);
-// value = ((value & 0xF0F0) >> 4) + (value & 0x0F0F);
-// return ((value & 0xFF00) >> 8) + (value & 0x00FF);
-// }
-//
-// This assembly function is approx. 20x faster than a naive loop
-// implementation of the population count, but about 30% bigger
-// (45 bytes v. 34 bytes).
-
-.align 8
-.global ___popcounthi2
-___popcounthi2:
-
-_picoMark_FUNCTION_BEGIN=
-
-// picoChip Function Prologue : &___popcounthi2 = 0 bytes
-
- AND.0 [LSR R0,1],21845,R0 \ AND.1 R0,21845,R5
- ADD.0 R0,R5,R0
- AND.0 [LSR R0,2],13107,R0 \ AND.1 R0,13107,R5
- ADD.0 R0,R5,R0 \ COPY.1 1807,R2
- AND.0 [LSR R0,4],R2,R0 \ AND.1 R0,3855,R5
- ADD.0 R0,R5,R0
- JR (R12) \ AND.0 R0, 255, R5
-=-> ADD.0 [LSR R0,8],R5,R0
-
-_picoMark_FUNCTION_END=
-// picoChip Function Epilogue : ___popcounthi2
-//============================================================================
-// All DWARF information between this marker, and the END OF DWARF
-// marker should be included in the source file. Search for
-// FUNCTION_STACK_SIZE_GOES_HERE and FUNCTION NAME GOES HERE, and
-// provide the relevent information. Add markers called
-// _picoMark_FUNCTION_BEGIN and _picoMark_FUNCTION_END around the
-// function in question.
-//============================================================================
-
-//============================================================================
-// Frame information.
-//============================================================================
-
-.section .debug_frame
-_picoMark_DebugFrame=
-
-// Common CIE header.
-.unalignedInitLong _picoMark_CieEnd-_picoMark_CieBegin
-_picoMark_CieBegin=
-.unalignedInitLong 0xffffffff
-.initByte 0x1 // CIE Version
-.ascii 16#0# // CIE Augmentation
-.uleb128 0x1 // CIE Code Alignment Factor
-.sleb128 2 // CIE Data Alignment Factor
-.initByte 0xc // CIE RA Column
-.initByte 0xc // DW_CFA_def_cfa
-.uleb128 0xd
-.uleb128 0x0
-.align 2
-_picoMark_CieEnd=
-
-// FDE
-_picoMark_LSFDE0I900821033007563=
-.unalignedInitLong _picoMark_FdeEnd-_picoMark_FdeBegin
-_picoMark_FdeBegin=
-.unalignedInitLong _picoMark_DebugFrame // FDE CIE offset
-.unalignedInitWord _picoMark_FUNCTION_BEGIN // FDE initial location
-.unalignedInitWord _picoMark_FUNCTION_END-_picoMark_FUNCTION_BEGIN
-.initByte 0xe // DW_CFA_def_cfa_offset
-.uleb128 0x0 // <-- FUNCTION_STACK_SIZE_GOES_HERE
-.initByte 0x4 // DW_CFA_advance_loc4
-.unalignedInitLong _picoMark_FUNCTION_END-_picoMark_FUNCTION_BEGIN
-.initByte 0xe // DW_CFA_def_cfa_offset
-.uleb128 0x0
-.align 2
-_picoMark_FdeEnd=
-
-//============================================================================
-// Abbrevation information.
-//============================================================================
-
-.section .debug_abbrev
-_picoMark_ABBREVIATIONS=
-
-.section .debug_abbrev
- .uleb128 0x1 // (abbrev code)
- .uleb128 0x11 // (TAG: DW_TAG_compile_unit)
- .initByte 0x1 // DW_children_yes
- .uleb128 0x10 // (DW_AT_stmt_list)
- .uleb128 0x6 // (DW_FORM_data4)
- .uleb128 0x12 // (DW_AT_high_pc)
- .uleb128 0x1 // (DW_FORM_addr)
- .uleb128 0x11 // (DW_AT_low_pc)
- .uleb128 0x1 // (DW_FORM_addr)
- .uleb128 0x25 // (DW_AT_producer)
- .uleb128 0x8 // (DW_FORM_string)
- .uleb128 0x13 // (DW_AT_language)
- .uleb128 0x5 // (DW_FORM_data2)
- .uleb128 0x3 // (DW_AT_name)
- .uleb128 0x8 // (DW_FORM_string)
-.initByte 0x0
-.initByte 0x0
-
- .uleb128 0x2 ;# (abbrev code)
- .uleb128 0x2e ;# (TAG: DW_TAG_subprogram)
-.initByte 0x0 ;# DW_children_no
- .uleb128 0x3 ;# (DW_AT_name)
- .uleb128 0x8 ;# (DW_FORM_string)
- .uleb128 0x11 ;# (DW_AT_low_pc)
- .uleb128 0x1 ;# (DW_FORM_addr)
- .uleb128 0x12 ;# (DW_AT_high_pc)
- .uleb128 0x1 ;# (DW_FORM_addr)
-.initByte 0x0
-.initByte 0x0
-
-.initByte 0x0
-
-//============================================================================
-// Line information. DwarfLib requires this to be present, but it can
-// be empty.
-//============================================================================
-
-.section .debug_line
-_picoMark_LINES=
-
-//============================================================================
-// Debug Information
-//============================================================================
-.section .debug_info
-
-//Fixed header.
-.unalignedInitLong _picoMark_DEBUG_INFO_END-_picoMark_DEBUG_INFO_BEGIN
-_picoMark_DEBUG_INFO_BEGIN=
-.unalignedInitWord 0x2
-.unalignedInitLong _picoMark_ABBREVIATIONS
-.initByte 0x2
-
-// Compile unit information.
-.uleb128 0x1 // (DIE 0xb) DW_TAG_compile_unit)
-.unalignedInitLong _picoMark_LINES
-.unalignedInitWord _picoMark_FUNCTION_END
-.unalignedInitWord _picoMark_FUNCTION_BEGIN
-// Producer is `picoChip'
-.ascii 16#70# 16#69# 16#63# 16#6f# 16#43# 16#68# 16#69# 16#70# 16#00#
-.unalignedInitWord 0xcafe // ASM language
-.ascii 16#0# // Name. DwarfLib expects this to be present.
-
-.uleb128 0x2 ;# (DIE DW_TAG_subprogram)
-
-// FUNCTION NAME GOES HERE. Use `echo name | od -t x1' to get the hex. Each hex
-// digit is specified using the format 16#XX#
-.ascii 16#5f# 16#5f# 16#70# 16#6f# 16#70# 16#63# 16#6f# 16#75# 16#6e# 16#74# 16#68# 16#69# 16#32# 16#0# // Function name `__popcounthi2'
-.unalignedInitWord _picoMark_FUNCTION_BEGIN // DW_AT_low_pc
-.unalignedInitWord _picoMark_FUNCTION_END // DW_AT_high_pc
-
-.initByte 0x0 // end of compile unit children.
-
-_picoMark_DEBUG_INFO_END=
-
-//============================================================================
-// END OF DWARF
-//============================================================================
-
-.section .endFile
-// End of picoChip ASM file
diff --git a/gcc/config/picochip/libgccExtras/setjmp.asm b/gcc/config/picochip/libgccExtras/setjmp.asm
deleted file mode 100644
index 247c715f6a9..00000000000
--- a/gcc/config/picochip/libgccExtras/setjmp.asm
+++ /dev/null
@@ -1,182 +0,0 @@
-// picoChip ASM file
-//
-// Support for 32-bit arithmetic shift right.
-//
-// Copyright (C) 2003, 2004, 2005, 2008, 2009 Free Software Foundation, Inc.
-// Contributed by Picochip Ltd.
-// Maintained by Hariharan Sandanagobalane (hariharan@picochip.com)
-//
-// This file is free software; you can redistribute it and/or modify it
-// under the terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 3, or (at your option) any
-// later version.
-//
-// This file 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/>.
-
-.section .text
-
-.global _setjmp
-_setjmp:
-_picoMark_FUNCTION_BEGIN=
-
-// picoChip Function Prologue : &_setjmp = 0 bytes
-
- STL R[3:2],(R0)0
- STL R[5:4],(R0)1
- STL R[7:6],(R0)2
- STL R[9:8],(R0)3
- STL R[11:10],(R0)4
- STL R[13:12],(R0)5
- STW R14,(R0)12
- STW R1,(R0)13
- JR (R12)
-=-> COPY.0 0,R0
-
-// picoChip Function Epilogue : setjmp
-//============================================================================
-// All DWARF information between this marker, and the END OF DWARF
-// marker should be included in the source file. Search for
-// FUNCTION_STACK_SIZE_GOES_HERE and FUNCTION NAME GOES HERE, and
-// provide the relevent information. Add markers called
-// _picoMark_FUNCTION_BEGIN and _picoMark_FUNCTION_END around the
-// function in question.
-//============================================================================
-
-//============================================================================
-// Frame information.
-//============================================================================
-
-.section .debug_frame
-_picoMark_DebugFrame=
-
-// Common CIE header.
-.unalignedInitLong _picoMark_CieEnd-_picoMark_CieBegin
-_picoMark_CieBegin=
-.unalignedInitLong 0xffffffff
-.initByte 0x1 // CIE Version
-.ascii 16#0# // CIE Augmentation
-.uleb128 0x1 // CIE Code Alignment Factor
-.sleb128 2 // CIE Data Alignment Factor
-.initByte 0xc // CIE RA Column
-.initByte 0xc // DW_CFA_def_cfa
-.uleb128 0xd
-.uleb128 0x0
-.align 2
-_picoMark_CieEnd=
-
-// FDE
-_picoMark_LSFDE0I900821033007563=
-.unalignedInitLong _picoMark_FdeEnd-_picoMark_FdeBegin
-_picoMark_FdeBegin=
-.unalignedInitLong _picoMark_DebugFrame // FDE CIE offset
-.unalignedInitWord _picoMark_FUNCTION_BEGIN // FDE initial location
-.unalignedInitWord _picoMark_FUNCTION_END-_picoMark_FUNCTION_BEGIN
-.initByte 0xe // DW_CFA_def_cfa_offset
-.uleb128 0x0 // <-- FUNCTION_STACK_SIZE_GOES_HERE
-.initByte 0x4 // DW_CFA_advance_loc4
-.unalignedInitLong _picoMark_FUNCTION_END-_picoMark_FUNCTION_BEGIN
-.initByte 0xe // DW_CFA_def_cfa_offset
-.uleb128 0x0
-.align 2
-_picoMark_FdeEnd=
-
-//============================================================================
-// Abbrevation information.
-//============================================================================
-
-.section .debug_abbrev
-_picoMark_ABBREVIATIONS=
-
-.section .debug_abbrev
- .uleb128 0x1 // (abbrev code)
- .uleb128 0x11 // (TAG: DW_TAG_compile_unit)
- .initByte 0x1 // DW_children_yes
- .uleb128 0x10 // (DW_AT_stmt_list)
- .uleb128 0x6 // (DW_FORM_data4)
- .uleb128 0x12 // (DW_AT_high_pc)
- .uleb128 0x1 // (DW_FORM_addr)
- .uleb128 0x11 // (DW_AT_low_pc)
- .uleb128 0x1 // (DW_FORM_addr)
- .uleb128 0x25 // (DW_AT_producer)
- .uleb128 0x8 // (DW_FORM_string)
- .uleb128 0x13 // (DW_AT_language)
- .uleb128 0x5 // (DW_FORM_data2)
- .uleb128 0x3 // (DW_AT_name)
- .uleb128 0x8 // (DW_FORM_string)
-.initByte 0x0
-.initByte 0x0
-
- .uleb128 0x2 ;# (abbrev code)
- .uleb128 0x2e ;# (TAG: DW_TAG_subprogram)
-.initByte 0x0 ;# DW_children_no
- .uleb128 0x3 ;# (DW_AT_name)
- .uleb128 0x8 ;# (DW_FORM_string)
- .uleb128 0x11 ;# (DW_AT_low_pc)
- .uleb128 0x1 ;# (DW_FORM_addr)
- .uleb128 0x12 ;# (DW_AT_high_pc)
- .uleb128 0x1 ;# (DW_FORM_addr)
-.initByte 0x0
-.initByte 0x0
-
-.initByte 0x0
-
-//============================================================================
-// Line information. DwarfLib requires this to be present, but it can
-// be empty.
-//============================================================================
-
-.section .debug_line
-_picoMark_LINES=
-
-//============================================================================
-// Debug Information
-//============================================================================
-.section .debug_info
-
-//Fixed header.
-.unalignedInitLong _picoMark_DEBUG_INFO_END-_picoMark_DEBUG_INFO_BEGIN
-_picoMark_DEBUG_INFO_BEGIN=
-.unalignedInitWord 0x2
-.unalignedInitLong _picoMark_ABBREVIATIONS
-.initByte 0x2
-
-// Compile unit information.
-.uleb128 0x1 // (DIE 0xb) DW_TAG_compile_unit)
-.unalignedInitLong _picoMark_LINES
-.unalignedInitWord _picoMark_FUNCTION_END
-.unalignedInitWord _picoMark_FUNCTION_BEGIN
-// Producer is `picoChip'
-.ascii 16#70# 16#69# 16#63# 16#6f# 16#43# 16#68# 16#69# 16#70# 16#00#
-.unalignedInitWord 0xcafe // ASM language
-.ascii 16#0# // Name. DwarfLib expects this to be present.
-
-.uleb128 0x2 ;# (DIE DW_TAG_subprogram)
-
-// FUNCTION NAME GOES HERE. Use `echo name | od -t x1' to get the hex. Each hex
-// digit is specified using the format 16#XX#
-.ascii 16#73# 16#65# 16#74# 16#6a# 16#6d# 16#70# 16#0# // Function name `setjmp'
-.unalignedInitWord _picoMark_FUNCTION_BEGIN // DW_AT_low_pc
-.unalignedInitWord _picoMark_FUNCTION_END // DW_AT_high_pc
-
-.initByte 0x0 // end of compile unit children.
-
-_picoMark_DEBUG_INFO_END=
-
-//============================================================================
-// END OF DWARF
-//============================================================================
-
-.section .endFile
-// End of picoChip ASM file
diff --git a/gcc/config/picochip/libgccExtras/subdi3.asm b/gcc/config/picochip/libgccExtras/subdi3.asm
deleted file mode 100644
index d1c833ea824..00000000000
--- a/gcc/config/picochip/libgccExtras/subdi3.asm
+++ /dev/null
@@ -1,191 +0,0 @@
-// picoChip ASM file
-//
-// Support for 64-bit subtraction.
-//
-// Copyright (C) 2003, 2004, 2005, 2008, 2009 Free Software Foundation, Inc.
-// Contributed by Picochip Ltd.
-// Maintained by Hariharan Sandanagobalane (hariharan@picochip.com)
-//
-// This file is free software; you can redistribute it and/or modify it
-// under the terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 3, or (at your option) any
-// later version.
-//
-// This file 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/>.
-
-.section .text
-
-.align 8
-.global __subdi3
-__subdi3:
-
-_picoMark_FUNCTION_BEGIN=
-// picoChip Function Prologue : &__subdi3 = 4 bytes
-
- // The first operand of sub is completely in registers r[2-5]
- // The second operand of sub is in stack FP(0-3)
- // and result need to be written pointed to by the register r0.
- // All we need to do is to load the appropriate values, sub them
- // appropriately (with sub or subb) and then store the values back.
- ldw (FP)0, r1
- stl r[7:6], (FP)-1
- sub.0 r2, r1, r6
- ldw (FP)1, r1
- subb.0 r3, r1, r7
- ldl (FP)1, r[3:2]
- stl r[7:6], (r0)0
- subb.0 r4, r2, r6
- subb.0 r5, r3, r7
- stl r[7:6], (r0)1
- jr (r12)
-=-> ldl (FP)2, r[7:6]
-
-_picoMark_FUNCTION_END=
-// picoChip Function Epilogue : __subdi3
-
-//============================================================================
-// All DWARF information between this marker, and the END OF DWARF
-// marker should be included in the source file. Search for
-// FUNCTION_STACK_SIZE_GOES_HERE and FUNCTION NAME GOES HERE, and
-// provide the relevent information. Add markers called
-// _picoMark_FUNCTION_BEGIN and _picoMark_FUNCTION_END around the
-// function in question.
-//============================================================================
-
-//============================================================================
-// Frame information.
-//============================================================================
-
-.section .debug_frame
-_picoMark_DebugFrame=
-
-// Common CIE header.
-.unalignedInitLong _picoMark_CieEnd-_picoMark_CieBegin
-_picoMark_CieBegin=
-.unalignedInitLong 0xffffffff
-.initByte 0x1 // CIE Version
-.ascii 16#0# // CIE Augmentation
-.uleb128 0x1 // CIE Code Alignment Factor
-.sleb128 2 // CIE Data Alignment Factor
-.initByte 0xc // CIE RA Column
-.initByte 0xc // DW_CFA_def_cfa
-.uleb128 0xd
-.uleb128 0x0
-.align 2
-_picoMark_CieEnd=
-
-// FDE
-_picoMark_LSFDE0I900821033007563=
-.unalignedInitLong _picoMark_FdeEnd-_picoMark_FdeBegin
-_picoMark_FdeBegin=
-.unalignedInitLong _picoMark_DebugFrame // FDE CIE offset
-.unalignedInitWord _picoMark_FUNCTION_BEGIN // FDE initial location
-.unalignedInitWord _picoMark_FUNCTION_END-_picoMark_FUNCTION_BEGIN
-.initByte 0xe // DW_CFA_def_cfa_offset
-.uleb128 0x4 // <-- FUNCTION_STACK_SIZE_GOES_HERE
-.initByte 0x4 // DW_CFA_advance_loc4
-.unalignedInitLong _picoMark_FUNCTION_END-_picoMark_FUNCTION_BEGIN
-.initByte 0xe // DW_CFA_def_cfa_offset
-.uleb128 0x0
-.align 2
-_picoMark_FdeEnd=
-
-//============================================================================
-// Abbrevation information.
-//============================================================================
-
-.section .debug_abbrev
-_picoMark_ABBREVIATIONS=
-
-.section .debug_abbrev
- .uleb128 0x1 // (abbrev code)
- .uleb128 0x11 // (TAG: DW_TAG_compile_unit)
- .initByte 0x1 // DW_children_yes
- .uleb128 0x10 // (DW_AT_stmt_list)
- .uleb128 0x6 // (DW_FORM_data4)
- .uleb128 0x12 // (DW_AT_high_pc)
- .uleb128 0x1 // (DW_FORM_addr)
- .uleb128 0x11 // (DW_AT_low_pc)
- .uleb128 0x1 // (DW_FORM_addr)
- .uleb128 0x25 // (DW_AT_producer)
- .uleb128 0x8 // (DW_FORM_string)
- .uleb128 0x13 // (DW_AT_language)
- .uleb128 0x5 // (DW_FORM_data2)
- .uleb128 0x3 // (DW_AT_name)
- .uleb128 0x8 // (DW_FORM_string)
-.initByte 0x0
-.initByte 0x0
-
- .uleb128 0x2 ;# (abbrev code)
- .uleb128 0x2e ;# (TAG: DW_TAG_subprogram)
-.initByte 0x0 ;# DW_children_no
- .uleb128 0x3 ;# (DW_AT_name)
- .uleb128 0x8 ;# (DW_FORM_string)
- .uleb128 0x11 ;# (DW_AT_low_pc)
- .uleb128 0x1 ;# (DW_FORM_addr)
- .uleb128 0x12 ;# (DW_AT_high_pc)
- .uleb128 0x1 ;# (DW_FORM_addr)
-.initByte 0x0
-.initByte 0x0
-
-.initByte 0x0
-
-//============================================================================
-// Line information. DwarfLib requires this to be present, but it can
-// be empty.
-//============================================================================
-
-.section .debug_line
-_picoMark_LINES=
-
-//============================================================================
-// Debug Information
-//============================================================================
-.section .debug_info
-
-//Fixed header.
-.unalignedInitLong _picoMark_DEBUG_INFO_END-_picoMark_DEBUG_INFO_BEGIN
-_picoMark_DEBUG_INFO_BEGIN=
-.unalignedInitWord 0x2
-.unalignedInitLong _picoMark_ABBREVIATIONS
-.initByte 0x2
-
-// Compile unit information.
-.uleb128 0x1 // (DIE 0xb) DW_TAG_compile_unit)
-.unalignedInitLong _picoMark_LINES
-.unalignedInitWord _picoMark_FUNCTION_END
-.unalignedInitWord _picoMark_FUNCTION_BEGIN
-// Producer is `picoChip'
-.ascii 16#70# 16#69# 16#63# 16#6f# 16#43# 16#68# 16#69# 16#70# 16#00#
-.unalignedInitWord 0xcafe // ASM language
-.ascii 16#0# // Name. DwarfLib expects this to be present.
-
-.uleb128 0x2 ;# (DIE DW_TAG_subprogram)
-
-// FUNCTION NAME GOES HERE. Use `echo name | od -t x1' to get the hex. Each hex
-// digit is specified using the format 16#XX#
-.ascii 16#5f# 16#73# 16#75# 16#62# 16#64# 16#69# 16#33# 16#0# // Function name `_subdi3'
-.unalignedInitWord _picoMark_FUNCTION_BEGIN // DW_AT_low_pc
-.unalignedInitWord _picoMark_FUNCTION_END // DW_AT_high_pc
-
-.initByte 0x0 // end of compile unit children.
-
-_picoMark_DEBUG_INFO_END=
-
-//============================================================================
-// END OF DWARF
-//============================================================================
-.section .endFile
-
diff --git a/gcc/config/picochip/libgccExtras/ucmpsi2.asm b/gcc/config/picochip/libgccExtras/ucmpsi2.asm
deleted file mode 100644
index 10c03cfcd6e..00000000000
--- a/gcc/config/picochip/libgccExtras/ucmpsi2.asm
+++ /dev/null
@@ -1,209 +0,0 @@
-// picoChip ASM file
-//.file "ucmpsi2.c"
-//
-// Support for 32-bit unsigned compare.
-//
-// Copyright (C) 2003, 2004, 2005, 2008, 2009 Free Software Foundation, Inc.
-// Contributed by Picochip Ltd.
-// Maintained by Daniel Towner (daniel.towner@picochip.com)
-//
-// This file is free software; you can redistribute it and/or modify it
-// under the terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 3, or (at your option) any
-// later version.
-//
-// This file 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/>.
-//
-// Compiled from the following, and then hand optimised.
-//
-// int __ucmpsi2 (USItype x, USItype y)
-// {
-//
-// USIunion lx; lx.l = x;
-// USIunion ly; ly.l = y;
-//
-// if (lx.s.high < ly.s.high)
-// return 0;
-// else if (lx.s.high > ly.s.high)
-// return 2;
-// if (lx.s.low < ly.s.low)
-// return 0;
-// else if (lx.s.low > ly.s.low)
-// return 2;
-// return 1;
-// }
-
-.section .text
-
-.align 8
-.global ___ucmpsi2
-___ucmpsi2:
-_picoMark_FUNCTION_BEGIN=
-// picoChip Function Prologue : &___ucmpsi2 = 0 bytes
- SUB.0 R1,R3,r15
-
- BLO _L1
-=-> SUB.0 R3,R1,r15 \ COPY.1 0,R5
-
- BLO _L1
-=-> SUB.0 R0,R2,r15 \ COPY.1 2,R5
-
- BLO _L1
-=-> SUB.0 R2,R0,r15 \ COPY.1 0,R5
-
- BLO _L1
-=-> COPY.0 2,R5
-
- COPY.0 1,R5
-_L1:
- JR (R12)
-=-> COPY.0 R5,R0 // R0 := R5
-
-_picoMark_FUNCTION_END=
-// picoChip Function Epilogue : __ucmpsi2
-//============================================================================
-// All DWARF information between this marker, and the END OF DWARF
-// marker should be included in the source file. Search for
-// FUNCTION_STACK_SIZE_GOES_HERE and FUNCTION NAME GOES HERE, and
-// provide the relevent information. Add markers called
-// _picoMark_FUNCTION_BEGIN and _picoMark_FUNCTION_END around the
-// function in question.
-//============================================================================
-
-//============================================================================
-// Frame information.
-//============================================================================
-
-.section .debug_frame
-_picoMark_DebugFrame=
-
-// Common CIE header.
-.unalignedInitLong _picoMark_CieEnd-_picoMark_CieBegin
-_picoMark_CieBegin=
-.unalignedInitLong 0xffffffff
-.initByte 0x1 // CIE Version
-.ascii 16#0# // CIE Augmentation
-.uleb128 0x1 // CIE Code Alignment Factor
-.sleb128 2 // CIE Data Alignment Factor
-.initByte 0xc // CIE RA Column
-.initByte 0xc // DW_CFA_def_cfa
-.uleb128 0xd
-.uleb128 0x0
-.align 2
-_picoMark_CieEnd=
-
-// FDE
-_picoMark_LSFDE0I900821033007563=
-.unalignedInitLong _picoMark_FdeEnd-_picoMark_FdeBegin
-_picoMark_FdeBegin=
-.unalignedInitLong _picoMark_DebugFrame // FDE CIE offset
-.unalignedInitWord _picoMark_FUNCTION_BEGIN // FDE initial location
-.unalignedInitWord _picoMark_FUNCTION_END-_picoMark_FUNCTION_BEGIN
-.initByte 0xe // DW_CFA_def_cfa_offset
-.uleb128 0x0 // <-- FUNCTION_STACK_SIZE_GOES_HERE
-.initByte 0x4 // DW_CFA_advance_loc4
-.unalignedInitLong _picoMark_FUNCTION_END-_picoMark_FUNCTION_BEGIN
-.initByte 0xe // DW_CFA_def_cfa_offset
-.uleb128 0x0
-.align 2
-_picoMark_FdeEnd=
-
-//============================================================================
-// Abbrevation information.
-//============================================================================
-
-.section .debug_abbrev
-_picoMark_ABBREVIATIONS=
-
-.section .debug_abbrev
- .uleb128 0x1 // (abbrev code)
- .uleb128 0x11 // (TAG: DW_TAG_compile_unit)
- .initByte 0x1 // DW_children_yes
- .uleb128 0x10 // (DW_AT_stmt_list)
- .uleb128 0x6 // (DW_FORM_data4)
- .uleb128 0x12 // (DW_AT_high_pc)
- .uleb128 0x1 // (DW_FORM_addr)
- .uleb128 0x11 // (DW_AT_low_pc)
- .uleb128 0x1 // (DW_FORM_addr)
- .uleb128 0x25 // (DW_AT_producer)
- .uleb128 0x8 // (DW_FORM_string)
- .uleb128 0x13 // (DW_AT_language)
- .uleb128 0x5 // (DW_FORM_data2)
- .uleb128 0x3 // (DW_AT_name)
- .uleb128 0x8 // (DW_FORM_string)
-.initByte 0x0
-.initByte 0x0
-
- .uleb128 0x2 ;# (abbrev code)
- .uleb128 0x2e ;# (TAG: DW_TAG_subprogram)
-.initByte 0x0 ;# DW_children_no
- .uleb128 0x3 ;# (DW_AT_name)
- .uleb128 0x8 ;# (DW_FORM_string)
- .uleb128 0x11 ;# (DW_AT_low_pc)
- .uleb128 0x1 ;# (DW_FORM_addr)
- .uleb128 0x12 ;# (DW_AT_high_pc)
- .uleb128 0x1 ;# (DW_FORM_addr)
-.initByte 0x0
-.initByte 0x0
-
-.initByte 0x0
-
-//============================================================================
-// Line information. DwarfLib requires this to be present, but it can
-// be empty.
-//============================================================================
-
-.section .debug_line
-_picoMark_LINES=
-
-//============================================================================
-// Debug Information
-//============================================================================
-.section .debug_info
-
-//Fixed header.
-.unalignedInitLong _picoMark_DEBUG_INFO_END-_picoMark_DEBUG_INFO_BEGIN
-_picoMark_DEBUG_INFO_BEGIN=
-.unalignedInitWord 0x2
-.unalignedInitLong _picoMark_ABBREVIATIONS
-.initByte 0x2
-
-// Compile unit information.
-.uleb128 0x1 // (DIE 0xb) DW_TAG_compile_unit)
-.unalignedInitLong _picoMark_LINES
-.unalignedInitWord _picoMark_FUNCTION_END
-.unalignedInitWord _picoMark_FUNCTION_BEGIN
-// Producer is `picoChip'
-.ascii 16#70# 16#69# 16#63# 16#6f# 16#43# 16#68# 16#69# 16#70# 16#00#
-.unalignedInitWord 0xcafe // ASM language
-.ascii 16#0# // Name. DwarfLib expects this to be present.
-
-.uleb128 0x2 ;# (DIE DW_TAG_subprogram)
-
-// FUNCTION NAME GOES HERE. Use `echo name | od -t x1' to get the hex. Each hex
-// digit is specified using the format 16#XX#
-.ascii 16#5f# 16#5f# 16#75# 16#63# 16#6d# 16#70# 16#73# 16#69# 16#32# 16#0# // Function name `__ucmpsi2'
-.unalignedInitWord _picoMark_FUNCTION_BEGIN // DW_AT_low_pc
-.unalignedInitWord _picoMark_FUNCTION_END // DW_AT_high_pc
-
-.initByte 0x0 // end of compile unit children.
-
-_picoMark_DEBUG_INFO_END=
-
-//============================================================================
-// END OF DWARF
-//============================================================================
-.section .endFile
-// End of picoChip ASM file
diff --git a/gcc/config/picochip/libgccExtras/udivmodhi4.asm b/gcc/config/picochip/libgccExtras/udivmodhi4.asm
deleted file mode 100644
index ac16fae39cf..00000000000
--- a/gcc/config/picochip/libgccExtras/udivmodhi4.asm
+++ /dev/null
@@ -1,238 +0,0 @@
-// picoChip ASM file
-//
-// Support for 16-bit unsigned division/modulus.
-//
-// Copyright (C) 2003, 2004, 2005, 2008, 2009 Free Software Foundation, Inc.
-// Contributed by Picochip Ltd.
-// Maintained by Daniel Towner (daniel.towner@picochip.com)
-//
-// This file is free software; you can redistribute it and/or modify it
-// under the terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 3, or (at your option) any
-// later version.
-//
-// This file 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/>.
-
-.section .text
-
-.global __udivmodhi4
-__udivmodhi4:
-_picoMark_FUNCTION_BEGIN=
-
-// picoChip Function Prologue : &__udivmodhi4 = 6 bytes
-
- // 16-bit unsigned division. The divstep function is only capable of
- // handling 15-bit division (plus a sign to give 16-bits). It is not
- // capable of handling unsigned division directly. Instead, take
- // advantage of the special property that
- // ((divisor / 2) / dividend) * 2 will be almost good enough. The
- // error in the result is only 0 or 1, and this can be easily
- // tested and corrected. A full description of the algorithm can
- // be found in `Hacker's Delight', by Henry Warren, page 146.
-
- // Input:
- // r0 - dividend
- // r1 - divisor
- // Output:
- // r0 - quotient
- // r1 - remainder
-
- // Note that the lr, and original inputs are speculatively saved. They
- // will only be restored if the 15-bit division function is called.
-
- sub.0 r1,0,r15 \ stl r[0:1],(fp)-1
- bge divisorIs15bit
-=-> sub.0 r0,r1,r2 \ stw lr,(fp)-3
-
- // The divisor is >= 2^15.
- bhs quotientIs1
-
- // The dividend < divisor. The quotient is thus 0, and the
- // remainder is the dividend.
- copy.0 r0,r1 \ jr (lr)
-=-> copy.0 0,r0
-
-quotientIs1:
- // The dividend >= divisor. The quotient is thus 1, and the
- // remainder can be computed directly by subtraction (i.e., the
- // result of the comparison already performed to branch here).
- jr (lr) \ copy.0 r2,r1
-=-> copy.0 1,r0
-
-divisorIs15bit:
- // The divisor is < 2^15.
-
- // Divide the original dividend by 2, and call the 15-bit division.
- // Note that the original dividend is stored in r5, which is
- // known to be unused by the called function, so that
- // a memory stall isn't introduced immediately after the
- // function returns, to reload this value from memory.
-
- jl (&__divmod15) \ copy.0 r0,r5 // fn_call &__divmod15
-=-> lsr.0 r0,1,r0
-
- // Compute the new quotient and remainder by multiplying them by 2.
- // The remainder will be 1 out, if the original dividend was odd.
- and.0 r5,1,r5 \ ldl (fp)-1,r[2:3]
- add.0 [lsl r1,1],r5,r1 \ lsl.1 r0,1,r0
-
- // The error in the quotient is 0 or 1. The error can be determined
- // by comparing the remainder to the original divisor. If the
- // remainder is bigger, then an error of 1 has been introduced.
- sub.0 r1,r3,r15 \ ldw (fp)-3,lr
- blo noCompensation
-=-> nop
- add.0 r0,1,r0 \ sub.1 r1,r3,r1
-noCompensation:
- jr (lr)
-
-_picoMark_FUNCTION_END=
-// picoChip Function Epilogue : udivmodhi4
-
-
-//============================================================================
-// All DWARF information between this marker, and the END OF DWARF
-// marker should be included in the source file. Search for
-// FUNCTION_STACK_SIZE_GOES_HERE and FUNCTION NAME GOES HERE, and
-// provide the relevent information. Add markers called
-// _picoMark_FUNCTION_BEGIN and _picoMark_FUNCTION_END around the
-// function in question.
-//============================================================================
-
-//============================================================================
-// Frame information.
-//============================================================================
-
-.section .debug_frame
-_picoMark_DebugFrame=
-
-// Common CIE header.
-.unalignedInitLong _picoMark_CieEnd-_picoMark_CieBegin
-_picoMark_CieBegin=
-.unalignedInitLong 0xffffffff
-.initByte 0x1 // CIE Version
-.ascii 16#0# // CIE Augmentation
-.uleb128 0x1 // CIE Code Alignment Factor
-.sleb128 2 // CIE Data Alignment Factor
-.initByte 0xc // CIE RA Column
-.initByte 0xc // DW_CFA_def_cfa
-.uleb128 0xd
-.uleb128 0x0
-.align 2
-_picoMark_CieEnd=
-
-// FDE
-_picoMark_LSFDE0I900821033007563=
-.unalignedInitLong _picoMark_FdeEnd-_picoMark_FdeBegin
-_picoMark_FdeBegin=
-.unalignedInitLong _picoMark_DebugFrame // FDE CIE offset
-.unalignedInitWord _picoMark_FUNCTION_BEGIN // FDE initial location
-.unalignedInitWord _picoMark_FUNCTION_END-_picoMark_FUNCTION_BEGIN
-.initByte 0xe // DW_CFA_def_cfa_offset
-.uleb128 0x6 // <-- FUNCTION_STACK_SIZE_GOES_HERE
-.initByte 0x4 // DW_CFA_advance_loc4
-.unalignedInitLong _picoMark_FUNCTION_END-_picoMark_FUNCTION_BEGIN
-.initByte 0xe // DW_CFA_def_cfa_offset
-.uleb128 0x0
-.align 2
-_picoMark_FdeEnd=
-
-//============================================================================
-// Abbrevation information.
-//============================================================================
-
-.section .debug_abbrev
-_picoMark_ABBREVIATIONS=
-
-.section .debug_abbrev
- .uleb128 0x1 // (abbrev code)
- .uleb128 0x11 // (TAG: DW_TAG_compile_unit)
- .initByte 0x1 // DW_children_yes
- .uleb128 0x10 // (DW_AT_stmt_list)
- .uleb128 0x6 // (DW_FORM_data4)
- .uleb128 0x12 // (DW_AT_high_pc)
- .uleb128 0x1 // (DW_FORM_addr)
- .uleb128 0x11 // (DW_AT_low_pc)
- .uleb128 0x1 // (DW_FORM_addr)
- .uleb128 0x25 // (DW_AT_producer)
- .uleb128 0x8 // (DW_FORM_string)
- .uleb128 0x13 // (DW_AT_language)
- .uleb128 0x5 // (DW_FORM_data2)
- .uleb128 0x3 // (DW_AT_name)
- .uleb128 0x8 // (DW_FORM_string)
-.initByte 0x0
-.initByte 0x0
-
- .uleb128 0x2 ;# (abbrev code)
- .uleb128 0x2e ;# (TAG: DW_TAG_subprogram)
-.initByte 0x0 ;# DW_children_no
- .uleb128 0x3 ;# (DW_AT_name)
- .uleb128 0x8 ;# (DW_FORM_string)
- .uleb128 0x11 ;# (DW_AT_low_pc)
- .uleb128 0x1 ;# (DW_FORM_addr)
- .uleb128 0x12 ;# (DW_AT_high_pc)
- .uleb128 0x1 ;# (DW_FORM_addr)
-.initByte 0x0
-.initByte 0x0
-
-.initByte 0x0
-
-//============================================================================
-// Line information. DwarfLib requires this to be present, but it can
-// be empty.
-//============================================================================
-
-.section .debug_line
-_picoMark_LINES=
-
-//============================================================================
-// Debug Information
-//============================================================================
-.section .debug_info
-
-//Fixed header.
-.unalignedInitLong _picoMark_DEBUG_INFO_END-_picoMark_DEBUG_INFO_BEGIN
-_picoMark_DEBUG_INFO_BEGIN=
-.unalignedInitWord 0x2
-.unalignedInitLong _picoMark_ABBREVIATIONS
-.initByte 0x2
-
-// Compile unit information.
-.uleb128 0x1 // (DIE 0xb) DW_TAG_compile_unit)
-.unalignedInitLong _picoMark_LINES
-.unalignedInitWord _picoMark_FUNCTION_END
-.unalignedInitWord _picoMark_FUNCTION_BEGIN
-// Producer is `picoChip'
-.ascii 16#70# 16#69# 16#63# 16#6f# 16#43# 16#68# 16#69# 16#70# 16#00#
-.unalignedInitWord 0xcafe // ASM language
-.ascii 16#0# // Name. DwarfLib expects this to be present.
-
-.uleb128 0x2 ;# (DIE DW_TAG_subprogram)
-
-// FUNCTION NAME GOES HERE. Use `echo name | od -t x1' to get the hex. Each hex
-// digit is specified using the format 16#XX#
-.ascii 16#5f# 16#75# 16#64# 16#69# 16#76# 16#6d# 16#6f# 16#64# 16#68# 16#69# 16#34# 16#0# // Function name `_udivmodhi4'
-.unalignedInitWord _picoMark_FUNCTION_BEGIN // DW_AT_low_pc
-.unalignedInitWord _picoMark_FUNCTION_END // DW_AT_high_pc
-
-.initByte 0x0 // end of compile unit children.
-
-_picoMark_DEBUG_INFO_END=
-
-//============================================================================
-// END OF DWARF
-//============================================================================
-.section .endFile
-// End of picoChip ASM file
diff --git a/gcc/config/picochip/libgccExtras/udivmodsi4.asm b/gcc/config/picochip/libgccExtras/udivmodsi4.asm
deleted file mode 100644
index 92c2a4983ce..00000000000
--- a/gcc/config/picochip/libgccExtras/udivmodsi4.asm
+++ /dev/null
@@ -1,318 +0,0 @@
-// picoChip ASM file
-//
-// Support for 32-bit unsigned division/modulus.
-//
-// Copyright (C) 2003, 2004, 2005, 2008, 2009 Free Software Foundation, Inc.
-// Contributed by Picochip Ltd.
-// Maintained by Daniel Towner (daniel.towner@picochip.com)
-//
-// This file is free software; you can redistribute it and/or modify it
-// under the terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 3, or (at your option) any
-// later version.
-//
-// This file 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/>.
-
-.section .text
-
-.align 8
-.global __udivmodsi4
-__udivmodsi4:
-_picoMark_FUNCTION_BEGIN=
-// picoChip Function Prologue : &__udivmodsi4 = 24 bytes
-
- // Schedule the register saves alongside the special cases, so that
- // if the special cases fail, the registers will have already
- // been stored onto the stack.
- SUB.0 R3,R1,r15 \ STL R[13:12],(FP)-1
- BHS skipCommonCase \ STL R[9:8],(FP)-4
-=-> SUB.0 R2,1,r15 \ STL R[11:10],(FP)-3
-
-_L2:
- // Flags set above, and in _L2 caller.
- BNE restOfCode
-=-> SUB.0 R3,0,r15
- BNE restOfCode
-=-> COPY.0 R0,R4 \ COPY.1 R1,R5
- JR (R12) // Return to caller
-=-> COPY.0 0,R6 \ COPY.1 0,R7
- // Never reach here
-
-skipCommonCase:
- SUB.0 R3,R1,r15
- BNE _L3 // (Reversed branch)
-=-> SUB.0 R2,R0,r15 // Must be set in delay slot, so ready by _L9
-
-_L9:
- BLO _L2 // (Reversed branch)
-=-> SUB.0 R2,1,r15
-
-_L3:
- SUB.0 R2,R0,r15
- BEQ _L10 // (Reversed branch)
-=-> SUB.0 R1,R3,r15 // Set flags for branch at _L10
-
-_L4:
- // greater than
- COPY.0 0,R4 \ COPY.1 0,R5 \ JR (R12) // Return to caller
-=-> COPY.0 R0,R6 \ COPY.1 R1,R7
- // Doesn't reach here.
-
-_L10:
- // Flags set in _L10 call delay slot.
- BNE _L4
-=-> COPY.0 1,R4 \ COPY.1 0,R5
- JR (R12) // Return to caller
-=-> COPY.0 0,R6 \ COPY.1 0,R7
-
-restOfCode:
-
-// Prologue
-
- // Register saves scheduled alongside special cases above.
- ADD.0 FP,-20,FP \ STW R14,(FP)-4
-
- // The following can be scheduled together.
- // dividend in R[9:8] (from R[1:0])
- // divisor in R[7:6] (from R[3:2])
- // R14 := clzsi2 (dividend)
- // R0 := clzsi2 (divisor)
- JL (&__clzsi2) \ COPY.0 R0,R8 \ COPY.1 R1,R9
-=-> COPY.0 R2,R6 \ COPY.1 R3,R7
- COPY.0 R0,R14 \ JL (&__clzsi2)
-=-> COPY.0 R6,R0 \ COPY.1 R7,R1
-
- // R14 := R0 - R14
- SUB.0 R0,R14,R14
-
- ADD.0 R14,1,R0 // R0 := R14 + 1 (HI)
-
- // R[11:10] = R[7,6] << R14
- SUB.0 15,R14,r15
- LSL.0 R6,R14,R11 \ BLT setupDivstepLoop
-=-> SUB.0 0,R14,R4 \ COPY.1 0,R10
-
- // Zero shift is a special case. Shifting by zero within a 16-bit
- // source object is fine, but don't execute the OR of the right-shift
- // into the final result.
- LSL.0 R7,R14,R11 \ BEQ setupDivstepLoop
-=-> LSL.0 R6,R14,R10
-
- LSR.0 R6,R4,R4
- OR.0 R11,R4,R11
-
-setupDivstepLoop:
-
- // R[5:4] := R[9:8] (SI)
- COPY.0 R8,R4 \ COPY.1 R9,R5
- COPY.0 0,R6 \ COPY.1 R0,R8
-
- // Store original value of loopCount for use after the loop.
- // The Subtraction is handled in the tail of the loop iteration
- // after this point.
- SUB.0 R4,R10,R0 \ COPY.1 R8,R14
-
- // workingResult in R4,5,6
- // temps in r0,1,2 and r7
- // alignedDivisor in R10,11
- // loopCount in r8
- // r3, r9 scratch, used for renaming.
-
-loopStart:
- // R0 := R4 - zeroExtend (R10) - only need 33-bits (i.e., 48-bits)
- SUBB.0 R5,R11,R1 \ LSR.1 R0,15,R3
- SUBB.0 R6,0,R2 \ LSR.1 R1,15,R6
-
- // if (carry) goto shiftOnly
- SUB.0 R8,1,R8 \ BNE shiftOnly
-=-> LSR.0 R4,15,R7 \ LSL.1 R1,1,R9
-
- OR.0 [LSL R0,1],1,R4 \ BNE loopStart
-=-> SUB.0 R4,R10,R0 \ OR.1 R9,R3,R5
-
- BRA loopEnd
-
-shiftOnly:
-
- OR.0 [LSL R5,1],R7,R5 \ BNE loopStart \ LSR.1 R5,15,R6
-=-> SUB.0 [LSL R4,1],R10,R0 \LSL.1 R4,1,R4
-
-// End of loop
-loopEnd:
-
- // Schedule the computation of the upper word after shifting
- // alongside the decision over whether to branch, and the register
- // restores.
- // R10 is filled with a useful constant.
- SUB.0 15,r14,r15 \ LDL (FP)4,R[13:12]
- SUB.1 0,R14,R1 // Don't set flags!
- LSL.0 R6,R1,R3 \ LDL (FP)-4,R[9:8]
-
- BLT remainderHasMoreThan16Bits \ LSR.0 R5,R14,R7 \ COPY.1 -1,R10
-=-> LSL.0 R5,R1,R2 \ OR.1 R7,R3,R3
-
- LSR.0 R4,R14,R3 \ COPY.1 R3,R7
- BRA epilogue \ LSR.0 -1,R1,R0 \ COPY.1 0,R5
-=-> OR.0 R3,R2,R6 \ AND.1 R0,R4,R4
-
-remainderHasMoreThan16Bits:
-
- LSL.0 R10,R14,R1 \ COPY.1 R3,R6
- XOR.0 R10,R1,R1 \ COPY.1 0,R7
- AND.0 R1,R5,R5
-
-epilogue:
-
- JR (R12) \ LDW (FP)-4,R14
-=-> LDL (FP)-3,R[11:10]
-
-_picoMark_FUNCTION_END=
-
-// picoChip Function Epilogue : udivmodsi4
-
-//============================================================================
-// All DWARF information between this marker, and the END OF DWARF
-// marker should be included in the source file. Search for
-// FUNCTION_STACK_SIZE_GOES_HERE and FUNCTION NAME GOES HERE, and
-// provide the relevent information. Add markers called
-// _picoMark_FUNCTION_BEGIN and _picoMark_FUNCTION_END around the
-// function in question.
-//============================================================================
-
-//============================================================================
-// Frame information.
-//============================================================================
-
-.section .debug_frame
-_picoMark_DebugFrame=
-
-// Common CIE header.
-.unalignedInitLong _picoMark_CieEnd-_picoMark_CieBegin
-_picoMark_CieBegin=
-.unalignedInitLong 0xffffffff
-.initByte 0x1 // CIE Version
-.ascii 16#0# // CIE Augmentation
-.uleb128 0x1 // CIE Code Alignment Factor
-.sleb128 2 // CIE Data Alignment Factor
-.initByte 0xc // CIE RA Column
-.initByte 0xc // DW_CFA_def_cfa
-.uleb128 0xd
-.uleb128 0x0
-.align 2
-_picoMark_CieEnd=
-
-// FDE
-_picoMark_LSFDE0I900821033007563=
-.unalignedInitLong _picoMark_FdeEnd-_picoMark_FdeBegin
-_picoMark_FdeBegin=
-.unalignedInitLong _picoMark_DebugFrame // FDE CIE offset
-.unalignedInitWord _picoMark_FUNCTION_BEGIN // FDE initial location
-.unalignedInitWord _picoMark_FUNCTION_END-_picoMark_FUNCTION_BEGIN
-.initByte 0xe // DW_CFA_def_cfa_offset
-.uleb128 0x18 // <-- FUNCTION_STACK_SIZE_GOES_HERE
-.initByte 0x4 // DW_CFA_advance_loc4
-.unalignedInitLong _picoMark_FUNCTION_END-_picoMark_FUNCTION_BEGIN
-.initByte 0xe // DW_CFA_def_cfa_offset
-.uleb128 0x0
-.align 2
-_picoMark_FdeEnd=
-
-//============================================================================
-// Abbrevation information.
-//============================================================================
-
-.section .debug_abbrev
-_picoMark_ABBREVIATIONS=
-
-.section .debug_abbrev
- .uleb128 0x1 // (abbrev code)
- .uleb128 0x11 // (TAG: DW_TAG_compile_unit)
- .initByte 0x1 // DW_children_yes
- .uleb128 0x10 // (DW_AT_stmt_list)
- .uleb128 0x6 // (DW_FORM_data4)
- .uleb128 0x12 // (DW_AT_high_pc)
- .uleb128 0x1 // (DW_FORM_addr)
- .uleb128 0x11 // (DW_AT_low_pc)
- .uleb128 0x1 // (DW_FORM_addr)
- .uleb128 0x25 // (DW_AT_producer)
- .uleb128 0x8 // (DW_FORM_string)
- .uleb128 0x13 // (DW_AT_language)
- .uleb128 0x5 // (DW_FORM_data2)
- .uleb128 0x3 // (DW_AT_name)
- .uleb128 0x8 // (DW_FORM_string)
-.initByte 0x0
-.initByte 0x0
-
- .uleb128 0x2 ;# (abbrev code)
- .uleb128 0x2e ;# (TAG: DW_TAG_subprogram)
-.initByte 0x0 ;# DW_children_no
- .uleb128 0x3 ;# (DW_AT_name)
- .uleb128 0x8 ;# (DW_FORM_string)
- .uleb128 0x11 ;# (DW_AT_low_pc)
- .uleb128 0x1 ;# (DW_FORM_addr)
- .uleb128 0x12 ;# (DW_AT_high_pc)
- .uleb128 0x1 ;# (DW_FORM_addr)
-.initByte 0x0
-.initByte 0x0
-
-.initByte 0x0
-
-//============================================================================
-// Line information. DwarfLib requires this to be present, but it can
-// be empty.
-//============================================================================
-
-.section .debug_line
-_picoMark_LINES=
-
-//============================================================================
-// Debug Information
-//============================================================================
-.section .debug_info
-
-//Fixed header.
-.unalignedInitLong _picoMark_DEBUG_INFO_END-_picoMark_DEBUG_INFO_BEGIN
-_picoMark_DEBUG_INFO_BEGIN=
-.unalignedInitWord 0x2
-.unalignedInitLong _picoMark_ABBREVIATIONS
-.initByte 0x2
-
-// Compile unit information.
-.uleb128 0x1 // (DIE 0xb) DW_TAG_compile_unit)
-.unalignedInitLong _picoMark_LINES
-.unalignedInitWord _picoMark_FUNCTION_END
-.unalignedInitWord _picoMark_FUNCTION_BEGIN
-// Producer is `picoChip'
-.ascii 16#70# 16#69# 16#63# 16#6f# 16#43# 16#68# 16#69# 16#70# 16#00#
-.unalignedInitWord 0xcafe // ASM language
-.ascii 16#0# // Name. DwarfLib expects this to be present.
-
-.uleb128 0x2 ;# (DIE DW_TAG_subprogram)
-
-// FUNCTION NAME GOES HERE. Use `echo name | od -t x1' to get the hex. Each hex
-// digit is specified using the format 16#XX#
-.ascii 16#5f# 16#75# 16#64# 16#69# 16#76# 16#6d# 16#6f# 16#64# 16#73# 16#69# 16#34# 16#0# // Function name `_udivmodsi4'
-.unalignedInitWord _picoMark_FUNCTION_BEGIN // DW_AT_low_pc
-.unalignedInitWord _picoMark_FUNCTION_END // DW_AT_high_pc
-
-.initByte 0x0 // end of compile unit children.
-
-_picoMark_DEBUG_INFO_END=
-
-//============================================================================
-// END OF DWARF
-//============================================================================
-.section .endFile
-// End of picoChip ASM file
diff --git a/gcc/config/picochip/t-picochip b/gcc/config/picochip/t-picochip
index 222d7a646b9..269a0551407 100644
--- a/gcc/config/picochip/t-picochip
+++ b/gcc/config/picochip/t-picochip
@@ -16,45 +16,6 @@
# along with GCC; see the file COPYING3. If not see
# <http://www.gnu.org/licenses/>.
-# Compile the extra library functions.
-
-LIB2FUNCS_EXTRA = \
- $(srcdir)/config/picochip/libgccExtras/ashrsi3.asm \
- $(srcdir)/config/picochip/libgccExtras/ashlsi3.asm \
- $(srcdir)/config/picochip/libgccExtras/divmodhi4.asm \
- $(srcdir)/config/picochip/libgccExtras/udivmodhi4.asm \
- $(srcdir)/config/picochip/libgccExtras/divmodsi4.asm \
- $(srcdir)/config/picochip/libgccExtras/udivmodsi4.asm \
- $(srcdir)/config/picochip/libgccExtras/divmod15.asm \
- $(srcdir)/config/picochip/libgccExtras/ucmpsi2.asm \
- $(srcdir)/config/picochip/libgccExtras/cmpsi2.asm \
- $(srcdir)/config/picochip/libgccExtras/clzsi2.asm \
- $(srcdir)/config/picochip/libgccExtras/adddi3.asm \
- $(srcdir)/config/picochip/libgccExtras/subdi3.asm \
- $(srcdir)/config/picochip/libgccExtras/lshrsi3.asm \
- $(srcdir)/config/picochip/libgccExtras/parityhi2.asm \
- $(srcdir)/config/picochip/libgccExtras/popcounthi2.asm
-
-# Prevent some of the more complicated libgcc functions from being
-# compiled. This is because they are generally too big to fit into an
-# AE anyway, so there is no point in having them. Also, some don't
-# compile properly so we'll ignore them for the moment.
-
-LIB1ASMFUNCS = _mulsc3 _divsc3
-LIB1ASMSRC = picochip/libgccExtras/fake_libgcc.asm
-
-# Turn off ranlib on target libraries.
-RANLIB_FOR_TARGET = cat
-
-# Special libgcc setup. Make single/double floating point the same,
-# and use our own include files.
-TARGET_LIBGCC2_CFLAGS = -DDF=SF -I../../includes/
-
-# Switch off all debugging for the embedded libraries.
-# (embedded processors need small libraries by default).
-# NOTE: If the debug level is increased, turn off instruction scheduling.
-LIBGCC2_DEBUG_CFLAGS = -g0
-
# Build all combinations of library for different multiply units, and
# presence/absence of byte access.
MULTILIB_OPTIONS = mmul-type=none/mmul-type=mac/mmul-type=mul mno-byte-access/mbyte-access
diff --git a/gcc/config/rs6000/crtresfpr.asm b/gcc/config/rs6000/crtresfpr.asm
deleted file mode 100644
index 9fb228cf458..00000000000
--- a/gcc/config/rs6000/crtresfpr.asm
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Special support for eabi and SVR4
- *
- * Copyright (C) 1995, 1996, 1998, 2000, 2001, 2008, 2009
- * Free Software Foundation, Inc.
- * Written By Michael Meissner
- * 64-bit support written by David Edelsohn
- *
- * This file is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 3, or (at your option) any
- * later version.
- *
- * This file 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/>.
- */
-
-/* Do any initializations needed for the eabi environment */
-
- .section ".text"
- #include "ppc-asm.h"
-
-/* On PowerPC64 Linux, these functions are provided by the linker. */
-#ifndef __powerpc64__
-
-/* Routines for restoring floating point registers, called by the compiler. */
-/* Called with r11 pointing to the stack header word of the caller of the */
-/* function, just beyond the end of the floating point save area. */
-
-CFI_STARTPROC
-HIDDEN_FUNC(_restfpr_14) lfd 14,-144(11) /* restore fp registers */
-HIDDEN_FUNC(_restfpr_15) lfd 15,-136(11)
-HIDDEN_FUNC(_restfpr_16) lfd 16,-128(11)
-HIDDEN_FUNC(_restfpr_17) lfd 17,-120(11)
-HIDDEN_FUNC(_restfpr_18) lfd 18,-112(11)
-HIDDEN_FUNC(_restfpr_19) lfd 19,-104(11)
-HIDDEN_FUNC(_restfpr_20) lfd 20,-96(11)
-HIDDEN_FUNC(_restfpr_21) lfd 21,-88(11)
-HIDDEN_FUNC(_restfpr_22) lfd 22,-80(11)
-HIDDEN_FUNC(_restfpr_23) lfd 23,-72(11)
-HIDDEN_FUNC(_restfpr_24) lfd 24,-64(11)
-HIDDEN_FUNC(_restfpr_25) lfd 25,-56(11)
-HIDDEN_FUNC(_restfpr_26) lfd 26,-48(11)
-HIDDEN_FUNC(_restfpr_27) lfd 27,-40(11)
-HIDDEN_FUNC(_restfpr_28) lfd 28,-32(11)
-HIDDEN_FUNC(_restfpr_29) lfd 29,-24(11)
-HIDDEN_FUNC(_restfpr_30) lfd 30,-16(11)
-HIDDEN_FUNC(_restfpr_31) lfd 31,-8(11)
- blr
-FUNC_END(_restfpr_31)
-FUNC_END(_restfpr_30)
-FUNC_END(_restfpr_29)
-FUNC_END(_restfpr_28)
-FUNC_END(_restfpr_27)
-FUNC_END(_restfpr_26)
-FUNC_END(_restfpr_25)
-FUNC_END(_restfpr_24)
-FUNC_END(_restfpr_23)
-FUNC_END(_restfpr_22)
-FUNC_END(_restfpr_21)
-FUNC_END(_restfpr_20)
-FUNC_END(_restfpr_19)
-FUNC_END(_restfpr_18)
-FUNC_END(_restfpr_17)
-FUNC_END(_restfpr_16)
-FUNC_END(_restfpr_15)
-FUNC_END(_restfpr_14)
-CFI_ENDPROC
-
-#endif
diff --git a/gcc/config/rs6000/crtresgpr.asm b/gcc/config/rs6000/crtresgpr.asm
deleted file mode 100644
index 9f9cec9f9ca..00000000000
--- a/gcc/config/rs6000/crtresgpr.asm
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Special support for eabi and SVR4
- *
- * Copyright (C) 1995, 1996, 1998, 2000, 2001, 2008, 2009
- * Free Software Foundation, Inc.
- * Written By Michael Meissner
- * 64-bit support written by David Edelsohn
- *
- * This file is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 3, or (at your option) any
- * later version.
- *
- * This file 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/>.
- */
-
-/* Do any initializations needed for the eabi environment */
-
- .section ".text"
- #include "ppc-asm.h"
-
-/* On PowerPC64 Linux, these functions are provided by the linker. */
-#ifndef __powerpc64__
-
-/* Routines for restoring integer registers, called by the compiler. */
-/* Called with r11 pointing to the stack header word of the caller of the */
-/* function, just beyond the end of the integer restore area. */
-
-CFI_STARTPROC
-HIDDEN_FUNC(_restgpr_14) lwz 14,-72(11) /* restore gp registers */
-HIDDEN_FUNC(_restgpr_15) lwz 15,-68(11)
-HIDDEN_FUNC(_restgpr_16) lwz 16,-64(11)
-HIDDEN_FUNC(_restgpr_17) lwz 17,-60(11)
-HIDDEN_FUNC(_restgpr_18) lwz 18,-56(11)
-HIDDEN_FUNC(_restgpr_19) lwz 19,-52(11)
-HIDDEN_FUNC(_restgpr_20) lwz 20,-48(11)
-HIDDEN_FUNC(_restgpr_21) lwz 21,-44(11)
-HIDDEN_FUNC(_restgpr_22) lwz 22,-40(11)
-HIDDEN_FUNC(_restgpr_23) lwz 23,-36(11)
-HIDDEN_FUNC(_restgpr_24) lwz 24,-32(11)
-HIDDEN_FUNC(_restgpr_25) lwz 25,-28(11)
-HIDDEN_FUNC(_restgpr_26) lwz 26,-24(11)
-HIDDEN_FUNC(_restgpr_27) lwz 27,-20(11)
-HIDDEN_FUNC(_restgpr_28) lwz 28,-16(11)
-HIDDEN_FUNC(_restgpr_29) lwz 29,-12(11)
-HIDDEN_FUNC(_restgpr_30) lwz 30,-8(11)
-HIDDEN_FUNC(_restgpr_31) lwz 31,-4(11)
- blr
-FUNC_END(_restgpr_31)
-FUNC_END(_restgpr_30)
-FUNC_END(_restgpr_29)
-FUNC_END(_restgpr_28)
-FUNC_END(_restgpr_27)
-FUNC_END(_restgpr_26)
-FUNC_END(_restgpr_25)
-FUNC_END(_restgpr_24)
-FUNC_END(_restgpr_23)
-FUNC_END(_restgpr_22)
-FUNC_END(_restgpr_21)
-FUNC_END(_restgpr_20)
-FUNC_END(_restgpr_19)
-FUNC_END(_restgpr_18)
-FUNC_END(_restgpr_17)
-FUNC_END(_restgpr_16)
-FUNC_END(_restgpr_15)
-FUNC_END(_restgpr_14)
-CFI_ENDPROC
-
-#endif
diff --git a/gcc/config/rs6000/crtresxfpr.asm b/gcc/config/rs6000/crtresxfpr.asm
deleted file mode 100644
index 633f2db61f0..00000000000
--- a/gcc/config/rs6000/crtresxfpr.asm
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * Special support for eabi and SVR4
- *
- * Copyright (C) 1995, 1996, 1998, 2000, 2001, 2008, 2009
- * Free Software Foundation, Inc.
- * Written By Michael Meissner
- * 64-bit support written by David Edelsohn
- *
- * This file is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 3, or (at your option) any
- * later version.
- *
- * This file 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/>.
- */
-
-/* Do any initializations needed for the eabi environment */
-
- .section ".text"
- #include "ppc-asm.h"
-
-/* On PowerPC64 Linux, these functions are provided by the linker. */
-#ifndef __powerpc64__
-
-/* Routines for restoring floating point registers, called by the compiler. */
-/* Called with r11 pointing to the stack header word of the caller of the */
-/* function, just beyond the end of the floating point save area. */
-/* In addition to restoring the fp registers, it will return to the caller's */
-/* caller */
-
-CFI_STARTPROC
-CFI_DEF_CFA_REGISTER (11)
-CFI_OFFSET (65, 4)
-CFI_OFFSET (46, -144)
-CFI_OFFSET (47, -136)
-CFI_OFFSET (48, -128)
-CFI_OFFSET (49, -120)
-CFI_OFFSET (50, -112)
-CFI_OFFSET (51, -104)
-CFI_OFFSET (52, -96)
-CFI_OFFSET (53, -88)
-CFI_OFFSET (54, -80)
-CFI_OFFSET (55, -72)
-CFI_OFFSET (56, -64)
-CFI_OFFSET (57, -56)
-CFI_OFFSET (58, -48)
-CFI_OFFSET (59, -40)
-CFI_OFFSET (60, -32)
-CFI_OFFSET (61, -24)
-CFI_OFFSET (62, -16)
-CFI_OFFSET (63, -8)
-HIDDEN_FUNC(_restfpr_14_x) lfd 14,-144(11) /* restore fp registers */
-CFI_RESTORE (46)
-HIDDEN_FUNC(_restfpr_15_x) lfd 15,-136(11)
-CFI_RESTORE (47)
-HIDDEN_FUNC(_restfpr_16_x) lfd 16,-128(11)
-CFI_RESTORE (48)
-HIDDEN_FUNC(_restfpr_17_x) lfd 17,-120(11)
-CFI_RESTORE (49)
-HIDDEN_FUNC(_restfpr_18_x) lfd 18,-112(11)
-CFI_RESTORE (50)
-HIDDEN_FUNC(_restfpr_19_x) lfd 19,-104(11)
-CFI_RESTORE (51)
-HIDDEN_FUNC(_restfpr_20_x) lfd 20,-96(11)
-CFI_RESTORE (52)
-HIDDEN_FUNC(_restfpr_21_x) lfd 21,-88(11)
-CFI_RESTORE (53)
-HIDDEN_FUNC(_restfpr_22_x) lfd 22,-80(11)
-CFI_RESTORE (54)
-HIDDEN_FUNC(_restfpr_23_x) lfd 23,-72(11)
-CFI_RESTORE (55)
-HIDDEN_FUNC(_restfpr_24_x) lfd 24,-64(11)
-CFI_RESTORE (56)
-HIDDEN_FUNC(_restfpr_25_x) lfd 25,-56(11)
-CFI_RESTORE (57)
-HIDDEN_FUNC(_restfpr_26_x) lfd 26,-48(11)
-CFI_RESTORE (58)
-HIDDEN_FUNC(_restfpr_27_x) lfd 27,-40(11)
-CFI_RESTORE (59)
-HIDDEN_FUNC(_restfpr_28_x) lfd 28,-32(11)
-CFI_RESTORE (60)
-HIDDEN_FUNC(_restfpr_29_x) lfd 29,-24(11)
-CFI_RESTORE (61)
-HIDDEN_FUNC(_restfpr_30_x) lfd 30,-16(11)
-CFI_RESTORE (62)
-HIDDEN_FUNC(_restfpr_31_x) lwz 0,4(11)
- lfd 31,-8(11)
-CFI_RESTORE (63)
- mtlr 0
-CFI_RESTORE (65)
- mr 1,11
-CFI_DEF_CFA_REGISTER (1)
- blr
-FUNC_END(_restfpr_31_x)
-FUNC_END(_restfpr_30_x)
-FUNC_END(_restfpr_29_x)
-FUNC_END(_restfpr_28_x)
-FUNC_END(_restfpr_27_x)
-FUNC_END(_restfpr_26_x)
-FUNC_END(_restfpr_25_x)
-FUNC_END(_restfpr_24_x)
-FUNC_END(_restfpr_23_x)
-FUNC_END(_restfpr_22_x)
-FUNC_END(_restfpr_21_x)
-FUNC_END(_restfpr_20_x)
-FUNC_END(_restfpr_19_x)
-FUNC_END(_restfpr_18_x)
-FUNC_END(_restfpr_17_x)
-FUNC_END(_restfpr_16_x)
-FUNC_END(_restfpr_15_x)
-FUNC_END(_restfpr_14_x)
-CFI_ENDPROC
-
-#endif
diff --git a/gcc/config/rs6000/crtresxgpr.asm b/gcc/config/rs6000/crtresxgpr.asm
deleted file mode 100644
index 451b2b69d1e..00000000000
--- a/gcc/config/rs6000/crtresxgpr.asm
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * Special support for eabi and SVR4
- *
- * Copyright (C) 1995, 1996, 1998, 2000, 2001, 2008, 2009
- * Free Software Foundation, Inc.
- * Written By Michael Meissner
- * 64-bit support written by David Edelsohn
- *
- * This file is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 3, or (at your option) any
- * later version.
- *
- * This file 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/>.
- */
-
-/* Do any initializations needed for the eabi environment */
-
- .section ".text"
- #include "ppc-asm.h"
-
-/* On PowerPC64 Linux, these functions are provided by the linker. */
-#ifndef __powerpc64__
-
-/* Routines for restoring integer registers, called by the compiler. */
-/* Called with r11 pointing to the stack header word of the caller of the */
-/* function, just beyond the end of the integer restore area. */
-
-CFI_STARTPROC
-CFI_DEF_CFA_REGISTER (11)
-CFI_OFFSET (65, 4)
-CFI_OFFSET (14, -72)
-CFI_OFFSET (15, -68)
-CFI_OFFSET (16, -64)
-CFI_OFFSET (17, -60)
-CFI_OFFSET (18, -56)
-CFI_OFFSET (19, -52)
-CFI_OFFSET (20, -48)
-CFI_OFFSET (21, -44)
-CFI_OFFSET (22, -40)
-CFI_OFFSET (23, -36)
-CFI_OFFSET (24, -32)
-CFI_OFFSET (25, -28)
-CFI_OFFSET (26, -24)
-CFI_OFFSET (27, -20)
-CFI_OFFSET (28, -16)
-CFI_OFFSET (29, -12)
-CFI_OFFSET (30, -8)
-CFI_OFFSET (31, -4)
-HIDDEN_FUNC(_restgpr_14_x) lwz 14,-72(11) /* restore gp registers */
-CFI_RESTORE (14)
-HIDDEN_FUNC(_restgpr_15_x) lwz 15,-68(11)
-CFI_RESTORE (15)
-HIDDEN_FUNC(_restgpr_16_x) lwz 16,-64(11)
-CFI_RESTORE (16)
-HIDDEN_FUNC(_restgpr_17_x) lwz 17,-60(11)
-CFI_RESTORE (17)
-HIDDEN_FUNC(_restgpr_18_x) lwz 18,-56(11)
-CFI_RESTORE (18)
-HIDDEN_FUNC(_restgpr_19_x) lwz 19,-52(11)
-CFI_RESTORE (19)
-HIDDEN_FUNC(_restgpr_20_x) lwz 20,-48(11)
-CFI_RESTORE (20)
-HIDDEN_FUNC(_restgpr_21_x) lwz 21,-44(11)
-CFI_RESTORE (21)
-HIDDEN_FUNC(_restgpr_22_x) lwz 22,-40(11)
-CFI_RESTORE (22)
-HIDDEN_FUNC(_restgpr_23_x) lwz 23,-36(11)
-CFI_RESTORE (23)
-HIDDEN_FUNC(_restgpr_24_x) lwz 24,-32(11)
-CFI_RESTORE (24)
-HIDDEN_FUNC(_restgpr_25_x) lwz 25,-28(11)
-CFI_RESTORE (25)
-HIDDEN_FUNC(_restgpr_26_x) lwz 26,-24(11)
-CFI_RESTORE (26)
-HIDDEN_FUNC(_restgpr_27_x) lwz 27,-20(11)
-CFI_RESTORE (27)
-HIDDEN_FUNC(_restgpr_28_x) lwz 28,-16(11)
-CFI_RESTORE (28)
-HIDDEN_FUNC(_restgpr_29_x) lwz 29,-12(11)
-CFI_RESTORE (29)
-HIDDEN_FUNC(_restgpr_30_x) lwz 30,-8(11)
-CFI_RESTORE (30)
-HIDDEN_FUNC(_restgpr_31_x) lwz 0,4(11)
- lwz 31,-4(11)
-CFI_RESTORE (31)
- mtlr 0
-CFI_RESTORE (65)
- mr 1,11
-CFI_DEF_CFA_REGISTER (1)
- blr
-FUNC_END(_restgpr_31_x)
-FUNC_END(_restgpr_30_x)
-FUNC_END(_restgpr_29_x)
-FUNC_END(_restgpr_28_x)
-FUNC_END(_restgpr_27_x)
-FUNC_END(_restgpr_26_x)
-FUNC_END(_restgpr_25_x)
-FUNC_END(_restgpr_24_x)
-FUNC_END(_restgpr_23_x)
-FUNC_END(_restgpr_22_x)
-FUNC_END(_restgpr_21_x)
-FUNC_END(_restgpr_20_x)
-FUNC_END(_restgpr_19_x)
-FUNC_END(_restgpr_18_x)
-FUNC_END(_restgpr_17_x)
-FUNC_END(_restgpr_16_x)
-FUNC_END(_restgpr_15_x)
-FUNC_END(_restgpr_14_x)
-CFI_ENDPROC
-
-#endif
diff --git a/gcc/config/rs6000/crtsavfpr.asm b/gcc/config/rs6000/crtsavfpr.asm
deleted file mode 100644
index 3cdb25033ca..00000000000
--- a/gcc/config/rs6000/crtsavfpr.asm
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Special support for eabi and SVR4
- *
- * Copyright (C) 1995, 1996, 1998, 2000, 2001, 2008, 2009
- * Free Software Foundation, Inc.
- * Written By Michael Meissner
- * 64-bit support written by David Edelsohn
- *
- * This file is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 3, or (at your option) any
- * later version.
- *
- * This file 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/>.
- */
-
-/* Do any initializations needed for the eabi environment */
-
- .section ".text"
- #include "ppc-asm.h"
-
-/* On PowerPC64 Linux, these functions are provided by the linker. */
-#ifndef __powerpc64__
-
-/* Routines for saving floating point registers, called by the compiler. */
-/* Called with r11 pointing to the stack header word of the caller of the */
-/* function, just beyond the end of the floating point save area. */
-
-CFI_STARTPROC
-HIDDEN_FUNC(_savefpr_14) stfd 14,-144(11) /* save fp registers */
-HIDDEN_FUNC(_savefpr_15) stfd 15,-136(11)
-HIDDEN_FUNC(_savefpr_16) stfd 16,-128(11)
-HIDDEN_FUNC(_savefpr_17) stfd 17,-120(11)
-HIDDEN_FUNC(_savefpr_18) stfd 18,-112(11)
-HIDDEN_FUNC(_savefpr_19) stfd 19,-104(11)
-HIDDEN_FUNC(_savefpr_20) stfd 20,-96(11)
-HIDDEN_FUNC(_savefpr_21) stfd 21,-88(11)
-HIDDEN_FUNC(_savefpr_22) stfd 22,-80(11)
-HIDDEN_FUNC(_savefpr_23) stfd 23,-72(11)
-HIDDEN_FUNC(_savefpr_24) stfd 24,-64(11)
-HIDDEN_FUNC(_savefpr_25) stfd 25,-56(11)
-HIDDEN_FUNC(_savefpr_26) stfd 26,-48(11)
-HIDDEN_FUNC(_savefpr_27) stfd 27,-40(11)
-HIDDEN_FUNC(_savefpr_28) stfd 28,-32(11)
-HIDDEN_FUNC(_savefpr_29) stfd 29,-24(11)
-HIDDEN_FUNC(_savefpr_30) stfd 30,-16(11)
-HIDDEN_FUNC(_savefpr_31) stfd 31,-8(11)
- blr
-FUNC_END(_savefpr_31)
-FUNC_END(_savefpr_30)
-FUNC_END(_savefpr_29)
-FUNC_END(_savefpr_28)
-FUNC_END(_savefpr_27)
-FUNC_END(_savefpr_26)
-FUNC_END(_savefpr_25)
-FUNC_END(_savefpr_24)
-FUNC_END(_savefpr_23)
-FUNC_END(_savefpr_22)
-FUNC_END(_savefpr_21)
-FUNC_END(_savefpr_20)
-FUNC_END(_savefpr_19)
-FUNC_END(_savefpr_18)
-FUNC_END(_savefpr_17)
-FUNC_END(_savefpr_16)
-FUNC_END(_savefpr_15)
-FUNC_END(_savefpr_14)
-CFI_ENDPROC
-
-#endif
diff --git a/gcc/config/rs6000/crtsavgpr.asm b/gcc/config/rs6000/crtsavgpr.asm
deleted file mode 100644
index 6d473963bad..00000000000
--- a/gcc/config/rs6000/crtsavgpr.asm
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Special support for eabi and SVR4
- *
- * Copyright (C) 1995, 1996, 1998, 2000, 2001, 2008, 2009
- * Free Software Foundation, Inc.
- * Written By Michael Meissner
- * 64-bit support written by David Edelsohn
- *
- * This file is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 3, or (at your option) any
- * later version.
- *
- * This file 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/>.
- */
-
-/* Do any initializations needed for the eabi environment */
-
- .section ".text"
- #include "ppc-asm.h"
-
-/* On PowerPC64 Linux, these functions are provided by the linker. */
-#ifndef __powerpc64__
-
-/* Routines for saving integer registers, called by the compiler. */
-/* Called with r11 pointing to the stack header word of the caller of the */
-/* function, just beyond the end of the integer save area. */
-
-CFI_STARTPROC
-HIDDEN_FUNC(_savegpr_14) stw 14,-72(11) /* save gp registers */
-HIDDEN_FUNC(_savegpr_15) stw 15,-68(11)
-HIDDEN_FUNC(_savegpr_16) stw 16,-64(11)
-HIDDEN_FUNC(_savegpr_17) stw 17,-60(11)
-HIDDEN_FUNC(_savegpr_18) stw 18,-56(11)
-HIDDEN_FUNC(_savegpr_19) stw 19,-52(11)
-HIDDEN_FUNC(_savegpr_20) stw 20,-48(11)
-HIDDEN_FUNC(_savegpr_21) stw 21,-44(11)
-HIDDEN_FUNC(_savegpr_22) stw 22,-40(11)
-HIDDEN_FUNC(_savegpr_23) stw 23,-36(11)
-HIDDEN_FUNC(_savegpr_24) stw 24,-32(11)
-HIDDEN_FUNC(_savegpr_25) stw 25,-28(11)
-HIDDEN_FUNC(_savegpr_26) stw 26,-24(11)
-HIDDEN_FUNC(_savegpr_27) stw 27,-20(11)
-HIDDEN_FUNC(_savegpr_28) stw 28,-16(11)
-HIDDEN_FUNC(_savegpr_29) stw 29,-12(11)
-HIDDEN_FUNC(_savegpr_30) stw 30,-8(11)
-HIDDEN_FUNC(_savegpr_31) stw 31,-4(11)
- blr
-FUNC_END(_savegpr_31)
-FUNC_END(_savegpr_30)
-FUNC_END(_savegpr_29)
-FUNC_END(_savegpr_28)
-FUNC_END(_savegpr_27)
-FUNC_END(_savegpr_26)
-FUNC_END(_savegpr_25)
-FUNC_END(_savegpr_24)
-FUNC_END(_savegpr_23)
-FUNC_END(_savegpr_22)
-FUNC_END(_savegpr_21)
-FUNC_END(_savegpr_20)
-FUNC_END(_savegpr_19)
-FUNC_END(_savegpr_18)
-FUNC_END(_savegpr_17)
-FUNC_END(_savegpr_16)
-FUNC_END(_savegpr_15)
-FUNC_END(_savegpr_14)
-CFI_ENDPROC
-
-#endif
diff --git a/gcc/config/rs6000/darwin-asm.h b/gcc/config/rs6000/darwin-asm.h
deleted file mode 100644
index 837b7a33ef8..00000000000
--- a/gcc/config/rs6000/darwin-asm.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/* Macro definitions to used to support 32/64-bit code in Darwin's
- * assembly files.
- *
- * Copyright (C) 2004, 2009 Free Software Foundation, Inc.
- *
- * This file is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 3, or (at your option) any
- * later version.
- *
- * This file 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/>.
- */
-
-/* These are donated from /usr/include/architecture/ppc . */
-
-#if defined(__ppc64__)
-#define MODE_CHOICE(x, y) y
-#else
-#define MODE_CHOICE(x, y) x
-#endif
-
-#define cmpg MODE_CHOICE(cmpw, cmpd)
-#define lg MODE_CHOICE(lwz, ld)
-#define stg MODE_CHOICE(stw, std)
-#define lgx MODE_CHOICE(lwzx, ldx)
-#define stgx MODE_CHOICE(stwx, stdx)
-#define lgu MODE_CHOICE(lwzu, ldu)
-#define stgu MODE_CHOICE(stwu, stdu)
-#define lgux MODE_CHOICE(lwzux, ldux)
-#define stgux MODE_CHOICE(stwux, stdux)
-#define lgwa MODE_CHOICE(lwz, lwa)
-
-#define g_long MODE_CHOICE(long, quad) /* usage is ".g_long" */
-
-#define GPR_BYTES MODE_CHOICE(4,8) /* size of a GPR in bytes */
-#define LOG2_GPR_BYTES MODE_CHOICE(2,3) /* log2(GPR_BYTES) */
-
-#define SAVED_LR_OFFSET MODE_CHOICE(8,16) /* position of saved
- LR in frame */
diff --git a/gcc/config/rs6000/darwin-fpsave.asm b/gcc/config/rs6000/darwin-fpsave.asm
deleted file mode 100644
index 47fdc92f860..00000000000
--- a/gcc/config/rs6000/darwin-fpsave.asm
+++ /dev/null
@@ -1,92 +0,0 @@
-/* This file contains the floating-point save and restore routines.
- *
- * Copyright (C) 2004, 2009 Free Software Foundation, Inc.
- *
- * This file is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 3, or (at your option) any
- * later version.
- *
- * This file 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/>.
- */
-
-/* THE SAVE AND RESTORE ROUTINES CAN HAVE ONLY ONE GLOBALLY VISIBLE
- ENTRY POINT - callers have to jump to "saveFP+60" to save f29..f31,
- for example. For FP reg saves/restores, it takes one instruction
- (4 bytes) to do the operation; for Vector regs, 2 instructions are
- required (8 bytes.)
-
- MORAL: DO NOT MESS AROUND WITH THESE FUNCTIONS! */
-
-#include "darwin-asm.h"
-
-.text
- .align 2
-
-/* saveFP saves R0 -- assumed to be the callers LR -- to 8/16(R1). */
-
-.private_extern saveFP
-saveFP:
- stfd f14,-144(r1)
- stfd f15,-136(r1)
- stfd f16,-128(r1)
- stfd f17,-120(r1)
- stfd f18,-112(r1)
- stfd f19,-104(r1)
- stfd f20,-96(r1)
- stfd f21,-88(r1)
- stfd f22,-80(r1)
- stfd f23,-72(r1)
- stfd f24,-64(r1)
- stfd f25,-56(r1)
- stfd f26,-48(r1)
- stfd f27,-40(r1)
- stfd f28,-32(r1)
- stfd f29,-24(r1)
- stfd f30,-16(r1)
- stfd f31,-8(r1)
- stg r0,SAVED_LR_OFFSET(r1)
- blr
-
-/* restFP restores the caller`s LR from 8/16(R1). Note that the code for
- this starts at the offset of F30 restoration, so calling this
- routine in an attempt to restore only F31 WILL NOT WORK (it would
- be a stupid thing to do, anyway.) */
-
-.private_extern restFP
-restFP:
- lfd f14,-144(r1)
- lfd f15,-136(r1)
- lfd f16,-128(r1)
- lfd f17,-120(r1)
- lfd f18,-112(r1)
- lfd f19,-104(r1)
- lfd f20,-96(r1)
- lfd f21,-88(r1)
- lfd f22,-80(r1)
- lfd f23,-72(r1)
- lfd f24,-64(r1)
- lfd f25,-56(r1)
- lfd f26,-48(r1)
- lfd f27,-40(r1)
- lfd f28,-32(r1)
- lfd f29,-24(r1)
- /* <OFFSET OF F30 RESTORE> restore callers LR */
- lg r0,SAVED_LR_OFFSET(r1)
- lfd f30,-16(r1)
- /* and prepare for return to caller */
- mtlr r0
- lfd f31,-8(r1)
- blr
diff --git a/gcc/config/rs6000/darwin-gpsave.asm b/gcc/config/rs6000/darwin-gpsave.asm
deleted file mode 100644
index d3c3b912d27..00000000000
--- a/gcc/config/rs6000/darwin-gpsave.asm
+++ /dev/null
@@ -1,118 +0,0 @@
-/* This file contains the GPR save and restore routines for Darwin.
- *
- * Copyright (C) 2011 Free Software Foundation, Inc.
- *
- * This file is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 3, or (at your option) any
- * later version.
- *
- * This file 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/>.
- */
-
-/* Contributed by Iain Sandoe <iains@gcc.gnu.org> */
-
-/* Like their FP and VEC counterparts, these routines have only one externally
- visible entry point. Calls have to be constructed as offsets from this.
- (I.E. callers have to jump to "saveGPR+((x-13)*4" to save registers x..31).
-
- Each save/load instruction is 4 bytes long (for both m32 and m64 builds).
-
- The save/restores here are done w.r.t r11.
-
- restGPRx restores the link reg from the stack and returns to the saved
- address.
-
- */
-
-#include "darwin-asm.h"
-
- .text
- .align 2
-
- .private_extern saveGPR
-saveGPR:
- stg r13,(-19 * GPR_BYTES)(r11)
- stg r14,(-18 * GPR_BYTES)(r11)
- stg r15,(-17 * GPR_BYTES)(r11)
- stg r16,(-16 * GPR_BYTES)(r11)
- stg r17,(-15 * GPR_BYTES)(r11)
- stg r18,(-14 * GPR_BYTES)(r11)
- stg r19,(-13 * GPR_BYTES)(r11)
- stg r20,(-12 * GPR_BYTES)(r11)
- stg r21,(-11 * GPR_BYTES)(r11)
- stg r22,(-10 * GPR_BYTES)(r11)
- stg r23,( -9 * GPR_BYTES)(r11)
- stg r24,( -8 * GPR_BYTES)(r11)
- stg r25,( -7 * GPR_BYTES)(r11)
- stg r26,( -6 * GPR_BYTES)(r11)
- stg r27,( -5 * GPR_BYTES)(r11)
- stg r28,( -4 * GPR_BYTES)(r11)
- stg r29,( -3 * GPR_BYTES)(r11)
- stg r30,( -2 * GPR_BYTES)(r11)
- stg r31,( -1 * GPR_BYTES)(r11)
- blr
-
-/* */
-
- .private_extern restGPR
-restGPR:
- lg r13,(-19 * GPR_BYTES)(r11)
- lg r14,(-18 * GPR_BYTES)(r11)
- lg r15,(-17 * GPR_BYTES)(r11)
- lg r16,(-16 * GPR_BYTES)(r11)
- lg r17,(-15 * GPR_BYTES)(r11)
- lg r18,(-14 * GPR_BYTES)(r11)
- lg r19,(-13 * GPR_BYTES)(r11)
- lg r20,(-12 * GPR_BYTES)(r11)
- lg r21,(-11 * GPR_BYTES)(r11)
- lg r22,(-10 * GPR_BYTES)(r11)
- lg r23,( -9 * GPR_BYTES)(r11)
- lg r24,( -8 * GPR_BYTES)(r11)
- lg r25,( -7 * GPR_BYTES)(r11)
- lg r26,( -6 * GPR_BYTES)(r11)
- lg r27,( -5 * GPR_BYTES)(r11)
- lg r28,( -4 * GPR_BYTES)(r11)
- lg r29,( -3 * GPR_BYTES)(r11)
- lg r30,( -2 * GPR_BYTES)(r11)
- lg r31,( -1 * GPR_BYTES)(r11)
- blr
-
- .private_extern restGPRx
-restGPRx:
- lg r13,(-19 * GPR_BYTES)(r11)
- lg r14,(-18 * GPR_BYTES)(r11)
- lg r15,(-17 * GPR_BYTES)(r11)
- lg r16,(-16 * GPR_BYTES)(r11)
- lg r17,(-15 * GPR_BYTES)(r11)
- lg r18,(-14 * GPR_BYTES)(r11)
- lg r19,(-13 * GPR_BYTES)(r11)
- lg r20,(-12 * GPR_BYTES)(r11)
- lg r21,(-11 * GPR_BYTES)(r11)
- lg r22,(-10 * GPR_BYTES)(r11)
- lg r23,( -9 * GPR_BYTES)(r11)
- lg r24,( -8 * GPR_BYTES)(r11)
- lg r25,( -7 * GPR_BYTES)(r11)
- lg r26,( -6 * GPR_BYTES)(r11)
- lg r27,( -5 * GPR_BYTES)(r11)
- lg r28,( -4 * GPR_BYTES)(r11)
- lg r29,( -3 * GPR_BYTES)(r11)
- /* Like the FP restore, we start from the offset for r30
- thus a restore of only r31 is not going to work. */
- lg r0,SAVED_LR_OFFSET(r1)
- lg r30,( -2 * GPR_BYTES)(r11)
- mtlr r0
- lg r31,( -1 * GPR_BYTES)(r11)
- blr
diff --git a/gcc/config/rs6000/darwin-libgcc.10.4.ver b/gcc/config/rs6000/darwin-libgcc.10.4.ver
deleted file mode 100644
index 0c6f7c23156..00000000000
--- a/gcc/config/rs6000/darwin-libgcc.10.4.ver
+++ /dev/null
@@ -1,93 +0,0 @@
-# Copyright (C) 2005 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/>.
-__Unwind_Backtrace
-__Unwind_DeleteException
-__Unwind_FindEnclosingFunction
-__Unwind_Find_FDE
-__Unwind_ForcedUnwind
-__Unwind_GetCFA
-__Unwind_GetDataRelBase
-__Unwind_GetGR
-__Unwind_GetIP
-__Unwind_GetLanguageSpecificData
-__Unwind_GetRegionStart
-__Unwind_GetTextRelBase
-__Unwind_RaiseException
-__Unwind_Resume
-__Unwind_Resume_or_Rethrow
-__Unwind_SetGR
-__Unwind_SetIP
-___absvdi2
-___absvsi2
-___addvdi3
-___addvsi3
-___ashldi3
-___ashrdi3
-___clear_cache
-___clzdi2
-___clzsi2
-___cmpdi2
-___ctzdi2
-___ctzsi2
-___deregister_frame
-___deregister_frame_info
-___deregister_frame_info_bases
-___divdi3
-___enable_execute_stack
-___ffsdi2
-___fixdfdi
-___fixsfdi
-___fixtfdi
-___fixunsdfdi
-___fixunsdfsi
-___fixunssfdi
-___fixunssfsi
-___fixunstfdi
-___floatdidf
-___floatdisf
-___floatditf
-___gcc_personality_v0
-___gcc_qadd
-___gcc_qdiv
-___gcc_qmul
-___gcc_qsub
-___lshrdi3
-___moddi3
-___muldi3
-___mulvdi3
-___mulvsi3
-___negdi2
-___negvdi2
-___negvsi2
-___paritydi2
-___paritysi2
-___popcountdi2
-___popcountsi2
-___register_frame
-___register_frame_info
-___register_frame_info_bases
-___register_frame_info_table
-___register_frame_info_table_bases
-___register_frame_table
-___subvdi3
-___subvsi3
-___trampoline_setup
-___ucmpdi2
-___udivdi3
-___udivmoddi4
-___umoddi3
diff --git a/gcc/config/rs6000/darwin-libgcc.10.5.ver b/gcc/config/rs6000/darwin-libgcc.10.5.ver
deleted file mode 100644
index c2f08924fd7..00000000000
--- a/gcc/config/rs6000/darwin-libgcc.10.5.ver
+++ /dev/null
@@ -1,106 +0,0 @@
-# Copyright (C) 2005, 2006 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/>.
-__Unwind_Backtrace
-__Unwind_DeleteException
-__Unwind_FindEnclosingFunction
-__Unwind_Find_FDE
-__Unwind_ForcedUnwind
-__Unwind_GetCFA
-__Unwind_GetDataRelBase
-__Unwind_GetGR
-__Unwind_GetIP
-__Unwind_GetIPInfo
-__Unwind_GetLanguageSpecificData
-__Unwind_GetRegionStart
-__Unwind_GetTextRelBase
-__Unwind_RaiseException
-__Unwind_Resume
-__Unwind_Resume_or_Rethrow
-__Unwind_SetGR
-__Unwind_SetIP
-___absvdi2
-___absvsi2
-___addvdi3
-___addvsi3
-___ashldi3
-___ashrdi3
-___clear_cache
-___clzdi2
-___clzsi2
-___cmpdi2
-___ctzdi2
-___ctzsi2
-___deregister_frame
-___deregister_frame_info
-___deregister_frame_info_bases
-___divdc3
-___divdi3
-___divsc3
-___divtc3
-___enable_execute_stack
-___ffsdi2
-___fixdfdi
-___fixsfdi
-___fixtfdi
-___fixunsdfdi
-___fixunsdfsi
-___fixunssfdi
-___fixunssfsi
-___fixunstfdi
-___floatdidf
-___floatdisf
-___floatditf
-___floatundidf
-___floatundisf
-___floatunditf
-___gcc_personality_v0
-___gcc_qadd
-___gcc_qdiv
-___gcc_qmul
-___gcc_qsub
-___lshrdi3
-___moddi3
-___muldc3
-___muldi3
-___mulsc3
-___multc3
-___mulvdi3
-___mulvsi3
-___negdi2
-___negvdi2
-___negvsi2
-___paritydi2
-___paritysi2
-___popcountdi2
-___popcountsi2
-___powidf2
-___powisf2
-___powitf2
-___register_frame
-___register_frame_info
-___register_frame_info_bases
-___register_frame_info_table
-___register_frame_info_table_bases
-___register_frame_table
-___subvdi3
-___subvsi3
-___trampoline_setup
-___ucmpdi2
-___udivdi3
-___udivmoddi4
-___umoddi3
diff --git a/gcc/config/rs6000/darwin-tramp.asm b/gcc/config/rs6000/darwin-tramp.asm
deleted file mode 100644
index 5188c98ef05..00000000000
--- a/gcc/config/rs6000/darwin-tramp.asm
+++ /dev/null
@@ -1,125 +0,0 @@
-/* Special support for trampolines
- *
- * Copyright (C) 1996, 1997, 2000, 2004, 2005, 2009 Free Software Foundation, Inc.
- * Written By Michael Meissner
- *
- * This file is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 3, or (at your option) any
- * later version.
- *
- * This file is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * Under Section 7 of GPL version 3, you are granted additional
- * permissions described in the GCC Runtime Library Exception, version
- * 3.1, as published by the Free Software Foundation.
- *
- * You should have received a copy of the GNU General Public License and
- * a copy of the GCC Runtime Library Exception along with this program;
- * see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
- * <http://www.gnu.org/licenses/>.
- */
-
-#include "darwin-asm.h"
-
-/* Set up trampolines. */
-
-.text
- .align LOG2_GPR_BYTES
-Ltrampoline_initial:
- mflr r0
- bl 1f
-Lfunc = .-Ltrampoline_initial
- .g_long 0 /* will be replaced with function address */
-Lchain = .-Ltrampoline_initial
- .g_long 0 /* will be replaced with static chain */
-1: mflr r11
- lg r12,0(r11) /* function address */
- mtlr r0
- mtctr r12
- lg r11,GPR_BYTES(r11) /* static chain */
- bctr
-
-trampoline_size = .-Ltrampoline_initial
-
-/* R3 = stack address to store trampoline */
-/* R4 = length of trampoline area */
-/* R5 = function address */
-/* R6 = static chain */
-
- .globl ___trampoline_setup
-___trampoline_setup:
- mflr r0 /* save return address */
- bcl 20,31,LCF0 /* load up __trampoline_initial into r7 */
-LCF0:
- mflr r11
- addis r7,r11,ha16(LTRAMP-LCF0)
- lg r7,lo16(LTRAMP-LCF0)(r7)
- subi r7,r7,4
- li r8,trampoline_size /* verify trampoline big enough */
- cmpg cr1,r8,r4
- srwi r4,r4,2 /* # words to move (insns always 4-byte) */
- addi r9,r3,-4 /* adjust pointer for lgu */
- mtctr r4
- blt cr1,Labort
-
- mtlr r0
-
- /* Copy the instructions to the stack */
-Lmove:
- lwzu r10,4(r7)
- stwu r10,4(r9)
- bdnz Lmove
-
- /* Store correct function and static chain */
- stg r5,Lfunc(r3)
- stg r6,Lchain(r3)
-
- /* Now flush both caches */
- mtctr r4
-Lcache:
- icbi 0,r3
- dcbf 0,r3
- addi r3,r3,4
- bdnz Lcache
-
- /* Ensure cache-flushing has finished. */
- sync
- isync
-
- /* Make stack writeable. */
- b ___enable_execute_stack
-
-Labort:
-#ifdef __DYNAMIC__
- bl L_abort$stub
-.data
-.section __TEXT,__picsymbolstub1,symbol_stubs,pure_instructions,32
- .align 2
-L_abort$stub:
- .indirect_symbol _abort
- mflr r0
- bcl 20,31,L0$_abort
-L0$_abort:
- mflr r11
- addis r11,r11,ha16(L_abort$lazy_ptr-L0$_abort)
- mtlr r0
- lgu r12,lo16(L_abort$lazy_ptr-L0$_abort)(r11)
- mtctr r12
- bctr
-.data
-.lazy_symbol_pointer
-L_abort$lazy_ptr:
- .indirect_symbol _abort
- .g_long dyld_stub_binding_helper
-#else
- bl _abort
-#endif
-.data
- .align LOG2_GPR_BYTES
-LTRAMP:
- .g_long Ltrampoline_initial
-
diff --git a/gcc/config/rs6000/darwin-vecsave.asm b/gcc/config/rs6000/darwin-vecsave.asm
deleted file mode 100644
index 0a46be20c89..00000000000
--- a/gcc/config/rs6000/darwin-vecsave.asm
+++ /dev/null
@@ -1,155 +0,0 @@
-/* This file contains the vector save and restore routines.
- *
- * Copyright (C) 2004, 2009 Free Software Foundation, Inc.
- *
- * This file is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 3, or (at your option) any
- * later version.
- *
- * This file 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/>.
- */
-
-/* Vector save/restore routines for Darwin. Note that each vector
- save/restore requires 2 instructions (8 bytes.)
-
- THE SAVE AND RESTORE ROUTINES CAN HAVE ONLY ONE GLOBALLY VISIBLE
- ENTRY POINT - callers have to jump to "saveFP+60" to save f29..f31,
- for example. For FP reg saves/restores, it takes one instruction
- (4 bytes) to do the operation; for Vector regs, 2 instructions are
- required (8 bytes.). */
-
- .machine ppc7400
-.text
- .align 2
-
-.private_extern saveVEC
-saveVEC:
- li r11,-192
- stvx v20,r11,r0
- li r11,-176
- stvx v21,r11,r0
- li r11,-160
- stvx v22,r11,r0
- li r11,-144
- stvx v23,r11,r0
- li r11,-128
- stvx v24,r11,r0
- li r11,-112
- stvx v25,r11,r0
- li r11,-96
- stvx v26,r11,r0
- li r11,-80
- stvx v27,r11,r0
- li r11,-64
- stvx v28,r11,r0
- li r11,-48
- stvx v29,r11,r0
- li r11,-32
- stvx v30,r11,r0
- li r11,-16
- stvx v31,r11,r0
- blr
-
-.private_extern restVEC
-restVEC:
- li r11,-192
- lvx v20,r11,r0
- li r11,-176
- lvx v21,r11,r0
- li r11,-160
- lvx v22,r11,r0
- li r11,-144
- lvx v23,r11,r0
- li r11,-128
- lvx v24,r11,r0
- li r11,-112
- lvx v25,r11,r0
- li r11,-96
- lvx v26,r11,r0
- li r11,-80
- lvx v27,r11,r0
- li r11,-64
- lvx v28,r11,r0
- li r11,-48
- lvx v29,r11,r0
- li r11,-32
- lvx v30,r11,r0
- li r11,-16
- lvx v31,r11,r0
- blr
-
-/* saveVEC_vr11 -- as saveVEC but VRsave is returned in R11. */
-
-.private_extern saveVEC_vr11
-saveVEC_vr11:
- li r11,-192
- stvx v20,r11,r0
- li r11,-176
- stvx v21,r11,r0
- li r11,-160
- stvx v22,r11,r0
- li r11,-144
- stvx v23,r11,r0
- li r11,-128
- stvx v24,r11,r0
- li r11,-112
- stvx v25,r11,r0
- li r11,-96
- stvx v26,r11,r0
- li r11,-80
- stvx v27,r11,r0
- li r11,-64
- stvx v28,r11,r0
- li r11,-48
- stvx v29,r11,r0
- li r11,-32
- stvx v30,r11,r0
- li r11,-16
- stvx v31,r11,r0
- mfspr r11,VRsave
- blr
-
-/* As restVec, but the original VRsave value passed in R10. */
-
-.private_extern restVEC_vr10
-restVEC_vr10:
- li r11,-192
- lvx v20,r11,r0
- li r11,-176
- lvx v21,r11,r0
- li r11,-160
- lvx v22,r11,r0
- li r11,-144
- lvx v23,r11,r0
- li r11,-128
- lvx v24,r11,r0
- li r11,-112
- lvx v25,r11,r0
- li r11,-96
- lvx v26,r11,r0
- li r11,-80
- lvx v27,r11,r0
- li r11,-64
- lvx v28,r11,r0
- li r11,-48
- lvx v29,r11,r0
- li r11,-32
- lvx v30,r11,r0
- li r11,-16
- lvx v31,r11,r0
- /* restore VRsave from R10. */
- mtspr VRsave,r10
- blr
diff --git a/gcc/config/rs6000/darwin-world.asm b/gcc/config/rs6000/darwin-world.asm
deleted file mode 100644
index c0b1bf1a2b1..00000000000
--- a/gcc/config/rs6000/darwin-world.asm
+++ /dev/null
@@ -1,259 +0,0 @@
-/* This file contains the exception-handling save_world and
- * restore_world routines, which need to do a run-time check to see if
- * they should save and restore the vector registers.
- *
- * Copyright (C) 2004, 2009 Free Software Foundation, Inc.
- *
- * This file is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 3, or (at your option) any
- * later version.
- *
- * This file 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/>.
- */
-
- .machine ppc7400
-.data
- .align 2
-
-#ifdef __DYNAMIC__
-
-.non_lazy_symbol_pointer
-L_has_vec$non_lazy_ptr:
- .indirect_symbol __cpu_has_altivec
-#ifdef __ppc64__
- .quad 0
-#else
- .long 0
-#endif
-
-#else
-
-/* For static, "pretend" we have a non-lazy-pointer. */
-
-L_has_vec$non_lazy_ptr:
- .long __cpu_has_altivec
-
-#endif
-
-
-.text
- .align 2
-
-/* save_world and rest_world save/restore F14-F31 and possibly V20-V31
- (assuming you have a CPU with vector registers; we use a global var
- provided by the System Framework to determine this.)
-
- SAVE_WORLD takes R0 (the caller`s caller`s return address) and R11
- (the stack frame size) as parameters. It returns VRsave in R0 if
- we`re on a CPU with vector regs.
-
- With gcc3, we now need to save and restore CR as well, since gcc3's
- scheduled prologs can cause comparisons to be moved before calls to
- save_world!
-
- USES: R0 R11 R12 */
-
-.private_extern save_world
-save_world:
- stw r0,8(r1)
- mflr r0
- bcl 20,31,Ls$pb
-Ls$pb: mflr r12
- addis r12,r12,ha16(L_has_vec$non_lazy_ptr-Ls$pb)
- lwz r12,lo16(L_has_vec$non_lazy_ptr-Ls$pb)(r12)
- mtlr r0
- lwz r12,0(r12)
- /* grab CR */
- mfcr r0
- /* test HAS_VEC */
- cmpwi r12,0
- stfd f14,-144(r1)
- stfd f15,-136(r1)
- stfd f16,-128(r1)
- stfd f17,-120(r1)
- stfd f18,-112(r1)
- stfd f19,-104(r1)
- stfd f20,-96(r1)
- stfd f21,-88(r1)
- stfd f22,-80(r1)
- stfd f23,-72(r1)
- stfd f24,-64(r1)
- stfd f25,-56(r1)
- stfd f26,-48(r1)
- stfd f27,-40(r1)
- stfd f28,-32(r1)
- stfd f29,-24(r1)
- stfd f30,-16(r1)
- stfd f31,-8(r1)
- stmw r13,-220(r1)
- /* stash CR */
- stw r0,4(r1)
- /* set R12 pointing at Vector Reg save area */
- addi r12,r1,-224
- /* allocate stack frame */
- stwux r1,r1,r11
- /* ...but return if HAS_VEC is zero */
- bne+ L$saveVMX
- /* Not forgetting to restore CR. */
- mtcr r0
- blr
-
-L$saveVMX:
- /* We're saving Vector regs too. */
- /* Restore CR from R0. No More Branches! */
- mtcr r0
-
- /* We should really use VRSAVE to figure out which vector regs
- we actually need to save and restore. Some other time :-/ */
-
- li r11,-192
- stvx v20,r11,r12
- li r11,-176
- stvx v21,r11,r12
- li r11,-160
- stvx v22,r11,r12
- li r11,-144
- stvx v23,r11,r12
- li r11,-128
- stvx v24,r11,r12
- li r11,-112
- stvx v25,r11,r12
- li r11,-96
- stvx v26,r11,r12
- li r11,-80
- stvx v27,r11,r12
- li r11,-64
- stvx v28,r11,r12
- li r11,-48
- stvx v29,r11,r12
- li r11,-32
- stvx v30,r11,r12
- mfspr r0,VRsave
- li r11,-16
- stvx v31,r11,r12
- /* VRsave lives at -224(R1) */
- stw r0,0(r12)
- blr
-
-
-/* eh_rest_world_r10 is jumped to, not called, so no need to worry about LR.
- R10 is the C++ EH stack adjust parameter, we return to the caller`s caller.
-
- USES: R0 R10 R11 R12 and R7 R8
- RETURNS: C++ EH Data registers (R3 - R6.)
-
- We now set up R7/R8 and jump to rest_world_eh_r7r8.
-
- rest_world doesn't use the R10 stack adjust parameter, nor does it
- pick up the R3-R6 exception handling stuff. */
-
-.private_extern rest_world
-rest_world:
- /* Pickup previous SP */
- lwz r11, 0(r1)
- li r7, 0
- lwz r8, 8(r11)
- li r10, 0
- b rest_world_eh_r7r8
-
-.private_extern eh_rest_world_r10
-eh_rest_world_r10:
- /* Pickup previous SP */
- lwz r11, 0(r1)
- mr r7,r10
- lwz r8, 8(r11)
- /* pickup the C++ EH data regs (R3 - R6.) */
- lwz r6,-420(r11)
- lwz r5,-424(r11)
- lwz r4,-428(r11)
- lwz r3,-432(r11)
-
- b rest_world_eh_r7r8
-
-/* rest_world_eh_r7r8 is jumped to -- not called! -- when we're doing
- the exception-handling epilog. R7 contains the offset to add to
- the SP, and R8 contains the 'real' return address.
-
- USES: R0 R11 R12 [R7/R8]
- RETURNS: C++ EH Data registers (R3 - R6.) */
-
-rest_world_eh_r7r8:
- bcl 20,31,Lr7r8$pb
-Lr7r8$pb: mflr r12
- lwz r11,0(r1)
- /* R11 := previous SP */
- addis r12,r12,ha16(L_has_vec$non_lazy_ptr-Lr7r8$pb)
- lwz r12,lo16(L_has_vec$non_lazy_ptr-Lr7r8$pb)(r12)
- lwz r0,4(r11)
- /* R0 := old CR */
- lwz r12,0(r12)
- /* R12 := HAS_VEC */
- mtcr r0
- cmpwi r12,0
- lmw r13,-220(r11)
- beq L.rest_world_fp_eh
- /* restore VRsave and V20..V31 */
- lwz r0,-224(r11)
- li r12,-416
- mtspr VRsave,r0
- lvx v20,r11,r12
- li r12,-400
- lvx v21,r11,r12
- li r12,-384
- lvx v22,r11,r12
- li r12,-368
- lvx v23,r11,r12
- li r12,-352
- lvx v24,r11,r12
- li r12,-336
- lvx v25,r11,r12
- li r12,-320
- lvx v26,r11,r12
- li r12,-304
- lvx v27,r11,r12
- li r12,-288
- lvx v28,r11,r12
- li r12,-272
- lvx v29,r11,r12
- li r12,-256
- lvx v30,r11,r12
- li r12,-240
- lvx v31,r11,r12
-
-L.rest_world_fp_eh:
- lfd f14,-144(r11)
- lfd f15,-136(r11)
- lfd f16,-128(r11)
- lfd f17,-120(r11)
- lfd f18,-112(r11)
- lfd f19,-104(r11)
- lfd f20,-96(r11)
- lfd f21,-88(r11)
- lfd f22,-80(r11)
- lfd f23,-72(r11)
- lfd f24,-64(r11)
- lfd f25,-56(r11)
- lfd f26,-48(r11)
- lfd f27,-40(r11)
- lfd f28,-32(r11)
- lfd f29,-24(r11)
- lfd f30,-16(r11)
- /* R8 is the exception-handler's address */
- mtctr r8
- lfd f31,-8(r11)
- /* set SP to original value + R7 offset */
- add r1,r11,r7
- bctr
diff --git a/gcc/config/rs6000/e500crtres32gpr.asm b/gcc/config/rs6000/e500crtres32gpr.asm
deleted file mode 100644
index 6fbff820b88..00000000000
--- a/gcc/config/rs6000/e500crtres32gpr.asm
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Special support for e500 eabi and SVR4
- *
- * Copyright (C) 2008, 2009 Free Software Foundation, Inc.
- * Written by Nathan Froyd
- *
- * This file is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 3, or (at your option) any
- * later version.
- *
- * This file 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/>.
- */
-
- .section ".text"
- #include "ppc-asm.h"
-
-#ifdef __SPE__
-
-/* Routines for restoring 32-bit integer registers, called by the compiler. */
-/* "Bare" versions that simply return to their caller. */
-
-HIDDEN_FUNC(_rest32gpr_14) lwz 14,-72(11)
-HIDDEN_FUNC(_rest32gpr_15) lwz 15,-68(11)
-HIDDEN_FUNC(_rest32gpr_16) lwz 16,-64(11)
-HIDDEN_FUNC(_rest32gpr_17) lwz 17,-60(11)
-HIDDEN_FUNC(_rest32gpr_18) lwz 18,-56(11)
-HIDDEN_FUNC(_rest32gpr_19) lwz 19,-52(11)
-HIDDEN_FUNC(_rest32gpr_20) lwz 20,-48(11)
-HIDDEN_FUNC(_rest32gpr_21) lwz 21,-44(11)
-HIDDEN_FUNC(_rest32gpr_22) lwz 22,-40(11)
-HIDDEN_FUNC(_rest32gpr_23) lwz 23,-36(11)
-HIDDEN_FUNC(_rest32gpr_24) lwz 24,-32(11)
-HIDDEN_FUNC(_rest32gpr_25) lwz 25,-28(11)
-HIDDEN_FUNC(_rest32gpr_26) lwz 26,-24(11)
-HIDDEN_FUNC(_rest32gpr_27) lwz 27,-20(11)
-HIDDEN_FUNC(_rest32gpr_28) lwz 28,-16(11)
-HIDDEN_FUNC(_rest32gpr_29) lwz 29,-12(11)
-HIDDEN_FUNC(_rest32gpr_30) lwz 30,-8(11)
-HIDDEN_FUNC(_rest32gpr_31) lwz 31,-4(11)
- blr
-FUNC_END(_rest32gpr_31)
-FUNC_END(_rest32gpr_30)
-FUNC_END(_rest32gpr_29)
-FUNC_END(_rest32gpr_28)
-FUNC_END(_rest32gpr_27)
-FUNC_END(_rest32gpr_26)
-FUNC_END(_rest32gpr_25)
-FUNC_END(_rest32gpr_24)
-FUNC_END(_rest32gpr_23)
-FUNC_END(_rest32gpr_22)
-FUNC_END(_rest32gpr_21)
-FUNC_END(_rest32gpr_20)
-FUNC_END(_rest32gpr_19)
-FUNC_END(_rest32gpr_18)
-FUNC_END(_rest32gpr_17)
-FUNC_END(_rest32gpr_16)
-FUNC_END(_rest32gpr_15)
-FUNC_END(_rest32gpr_14)
-
-#endif
diff --git a/gcc/config/rs6000/e500crtres64gpr.asm b/gcc/config/rs6000/e500crtres64gpr.asm
deleted file mode 100644
index 5182e55392d..00000000000
--- a/gcc/config/rs6000/e500crtres64gpr.asm
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Special support for e500 eabi and SVR4
- *
- * Copyright (C) 2008, 2009 Free Software Foundation, Inc.
- * Written by Nathan Froyd
- *
- * This file is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 3, or (at your option) any
- * later version.
- *
- * This file 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/>.
- */
-
- .section ".text"
- #include "ppc-asm.h"
-
-#ifdef __SPE__
-
-/* Routines for restoring 64-bit integer registers, called by the compiler. */
-/* "Bare" versions that return to their caller. */
-
-HIDDEN_FUNC(_rest64gpr_14) evldd 14,0(11)
-HIDDEN_FUNC(_rest64gpr_15) evldd 15,8(11)
-HIDDEN_FUNC(_rest64gpr_16) evldd 16,16(11)
-HIDDEN_FUNC(_rest64gpr_17) evldd 17,24(11)
-HIDDEN_FUNC(_rest64gpr_18) evldd 18,32(11)
-HIDDEN_FUNC(_rest64gpr_19) evldd 19,40(11)
-HIDDEN_FUNC(_rest64gpr_20) evldd 20,48(11)
-HIDDEN_FUNC(_rest64gpr_21) evldd 21,56(11)
-HIDDEN_FUNC(_rest64gpr_22) evldd 22,64(11)
-HIDDEN_FUNC(_rest64gpr_23) evldd 23,72(11)
-HIDDEN_FUNC(_rest64gpr_24) evldd 24,80(11)
-HIDDEN_FUNC(_rest64gpr_25) evldd 25,88(11)
-HIDDEN_FUNC(_rest64gpr_26) evldd 26,96(11)
-HIDDEN_FUNC(_rest64gpr_27) evldd 27,104(11)
-HIDDEN_FUNC(_rest64gpr_28) evldd 28,112(11)
-HIDDEN_FUNC(_rest64gpr_29) evldd 29,120(11)
-HIDDEN_FUNC(_rest64gpr_30) evldd 30,128(11)
-HIDDEN_FUNC(_rest64gpr_31) evldd 31,136(11)
- blr
-FUNC_END(_rest64gpr_31)
-FUNC_END(_rest64gpr_30)
-FUNC_END(_rest64gpr_29)
-FUNC_END(_rest64gpr_28)
-FUNC_END(_rest64gpr_27)
-FUNC_END(_rest64gpr_26)
-FUNC_END(_rest64gpr_25)
-FUNC_END(_rest64gpr_24)
-FUNC_END(_rest64gpr_23)
-FUNC_END(_rest64gpr_22)
-FUNC_END(_rest64gpr_21)
-FUNC_END(_rest64gpr_20)
-FUNC_END(_rest64gpr_19)
-FUNC_END(_rest64gpr_18)
-FUNC_END(_rest64gpr_17)
-FUNC_END(_rest64gpr_16)
-FUNC_END(_rest64gpr_15)
-FUNC_END(_rest64gpr_14)
-
-#endif
diff --git a/gcc/config/rs6000/e500crtres64gprctr.asm b/gcc/config/rs6000/e500crtres64gprctr.asm
deleted file mode 100644
index 74309d6bed6..00000000000
--- a/gcc/config/rs6000/e500crtres64gprctr.asm
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Special support for e500 eabi and SVR4
- *
- * Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
- * Written by Nathan Froyd
- *
- * This file is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 3, or (at your option) any
- * later version.
- *
- * This file 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/>.
- */
-
- .section ".text"
- #include "ppc-asm.h"
-
-#ifdef __SPE__
-
-/* Routines for restoring 64-bit integer registers where the number of
- registers to be restored is passed in CTR, called by the compiler. */
-
-HIDDEN_FUNC(_rest64gpr_ctr_14) evldd 14,0(11)
- bdz _rest64gpr_ctr_done
-HIDDEN_FUNC(_rest64gpr_ctr_15) evldd 15,8(11)
- bdz _rest64gpr_ctr_done
-HIDDEN_FUNC(_rest64gpr_ctr_16) evldd 16,16(11)
- bdz _rest64gpr_ctr_done
-HIDDEN_FUNC(_rest64gpr_ctr_17) evldd 17,24(11)
- bdz _rest64gpr_ctr_done
-HIDDEN_FUNC(_rest64gpr_ctr_18) evldd 18,32(11)
- bdz _rest64gpr_ctr_done
-HIDDEN_FUNC(_rest64gpr_ctr_19) evldd 19,40(11)
- bdz _rest64gpr_ctr_done
-HIDDEN_FUNC(_rest64gpr_ctr_20) evldd 20,48(11)
- bdz _rest64gpr_ctr_done
-HIDDEN_FUNC(_rest64gpr_ctr_21) evldd 21,56(11)
- bdz _rest64gpr_ctr_done
-HIDDEN_FUNC(_rest64gpr_ctr_22) evldd 22,64(11)
- bdz _rest64gpr_ctr_done
-HIDDEN_FUNC(_rest64gpr_ctr_23) evldd 23,72(11)
- bdz _rest64gpr_ctr_done
-HIDDEN_FUNC(_rest64gpr_ctr_24) evldd 24,80(11)
- bdz _rest64gpr_ctr_done
-HIDDEN_FUNC(_rest64gpr_ctr_25) evldd 25,88(11)
- bdz _rest64gpr_ctr_done
-HIDDEN_FUNC(_rest64gpr_ctr_26) evldd 26,96(11)
- bdz _rest64gpr_ctr_done
-HIDDEN_FUNC(_rest64gpr_ctr_27) evldd 27,104(11)
- bdz _rest64gpr_ctr_done
-HIDDEN_FUNC(_rest64gpr_ctr_28) evldd 28,112(11)
- bdz _rest64gpr_ctr_done
-HIDDEN_FUNC(_rest64gpr_ctr_29) evldd 29,120(11)
- bdz _rest64gpr_ctr_done
-HIDDEN_FUNC(_rest64gpr_ctr_30) evldd 30,128(11)
- bdz _rest64gpr_ctr_done
-HIDDEN_FUNC(_rest64gpr_ctr_31) evldd 31,136(11)
-_rest64gpr_ctr_done: blr
-FUNC_END(_rest64gpr_ctr_31)
-FUNC_END(_rest64gpr_ctr_30)
-FUNC_END(_rest64gpr_ctr_29)
-FUNC_END(_rest64gpr_ctr_28)
-FUNC_END(_rest64gpr_ctr_27)
-FUNC_END(_rest64gpr_ctr_26)
-FUNC_END(_rest64gpr_ctr_25)
-FUNC_END(_rest64gpr_ctr_24)
-FUNC_END(_rest64gpr_ctr_23)
-FUNC_END(_rest64gpr_ctr_22)
-FUNC_END(_rest64gpr_ctr_21)
-FUNC_END(_rest64gpr_ctr_20)
-FUNC_END(_rest64gpr_ctr_19)
-FUNC_END(_rest64gpr_ctr_18)
-FUNC_END(_rest64gpr_ctr_17)
-FUNC_END(_rest64gpr_ctr_16)
-FUNC_END(_rest64gpr_ctr_15)
-FUNC_END(_rest64gpr_ctr_14)
-
-#endif
diff --git a/gcc/config/rs6000/e500crtrest32gpr.asm b/gcc/config/rs6000/e500crtrest32gpr.asm
deleted file mode 100644
index 4e61010dcff..00000000000
--- a/gcc/config/rs6000/e500crtrest32gpr.asm
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Special support for e500 eabi and SVR4
- *
- * Copyright (C) 2008, 2009 Free Software Foundation, Inc.
- * Written by Nathan Froyd
- *
- * This file is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 3, or (at your option) any
- * later version.
- *
- * This file 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/>.
- */
-
- .section ".text"
- #include "ppc-asm.h"
-
-#ifdef __SPE__
-
-/* Routines for restoring 32-bit integer registers, called by the compiler. */
-/* "Tail" versions that perform a tail call. */
-
-HIDDEN_FUNC(_rest32gpr_14_t) lwz 14,-72(11)
-HIDDEN_FUNC(_rest32gpr_15_t) lwz 15,-68(11)
-HIDDEN_FUNC(_rest32gpr_16_t) lwz 16,-64(11)
-HIDDEN_FUNC(_rest32gpr_17_t) lwz 17,-60(11)
-HIDDEN_FUNC(_rest32gpr_18_t) lwz 18,-56(11)
-HIDDEN_FUNC(_rest32gpr_19_t) lwz 19,-52(11)
-HIDDEN_FUNC(_rest32gpr_20_t) lwz 20,-48(11)
-HIDDEN_FUNC(_rest32gpr_21_t) lwz 21,-44(11)
-HIDDEN_FUNC(_rest32gpr_22_t) lwz 22,-40(11)
-HIDDEN_FUNC(_rest32gpr_23_t) lwz 23,-36(11)
-HIDDEN_FUNC(_rest32gpr_24_t) lwz 24,-32(11)
-HIDDEN_FUNC(_rest32gpr_25_t) lwz 25,-28(11)
-HIDDEN_FUNC(_rest32gpr_26_t) lwz 26,-24(11)
-HIDDEN_FUNC(_rest32gpr_27_t) lwz 27,-20(11)
-HIDDEN_FUNC(_rest32gpr_28_t) lwz 28,-16(11)
-HIDDEN_FUNC(_rest32gpr_29_t) lwz 29,-12(11)
-HIDDEN_FUNC(_rest32gpr_30_t) lwz 30,-8(11)
-HIDDEN_FUNC(_rest32gpr_31_t) lwz 31,-4(11)
- lwz 0,4(11)
- mr 1,11
- blr
-FUNC_END(_rest32gpr_31_t)
-FUNC_END(_rest32gpr_30_t)
-FUNC_END(_rest32gpr_29_t)
-FUNC_END(_rest32gpr_28_t)
-FUNC_END(_rest32gpr_27_t)
-FUNC_END(_rest32gpr_26_t)
-FUNC_END(_rest32gpr_25_t)
-FUNC_END(_rest32gpr_24_t)
-FUNC_END(_rest32gpr_23_t)
-FUNC_END(_rest32gpr_22_t)
-FUNC_END(_rest32gpr_21_t)
-FUNC_END(_rest32gpr_20_t)
-FUNC_END(_rest32gpr_19_t)
-FUNC_END(_rest32gpr_18_t)
-FUNC_END(_rest32gpr_17_t)
-FUNC_END(_rest32gpr_16_t)
-FUNC_END(_rest32gpr_15_t)
-FUNC_END(_rest32gpr_14_t)
-
-#endif
diff --git a/gcc/config/rs6000/e500crtrest64gpr.asm b/gcc/config/rs6000/e500crtrest64gpr.asm
deleted file mode 100644
index 090786fdc71..00000000000
--- a/gcc/config/rs6000/e500crtrest64gpr.asm
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Special support for e500 eabi and SVR4
- *
- * Copyright (C) 2008, 2009 Free Software Foundation, Inc.
- * Written by Nathan Froyd
- *
- * This file is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 3, or (at your option) any
- * later version.
- *
- * This file 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/>.
- */
-
- .section ".text"
- #include "ppc-asm.h"
-
-#ifdef __SPE__
-
-/* "Tail" versions that perform a tail call. */
-
-HIDDEN_FUNC(_rest64gpr_14_t) evldd 14,0(11)
-HIDDEN_FUNC(_rest64gpr_15_t) evldd 15,8(11)
-HIDDEN_FUNC(_rest64gpr_16_t) evldd 16,16(11)
-HIDDEN_FUNC(_rest64gpr_17_t) evldd 17,24(11)
-HIDDEN_FUNC(_rest64gpr_18_t) evldd 18,32(11)
-HIDDEN_FUNC(_rest64gpr_19_t) evldd 19,40(11)
-HIDDEN_FUNC(_rest64gpr_20_t) evldd 20,48(11)
-HIDDEN_FUNC(_rest64gpr_21_t) evldd 21,56(11)
-HIDDEN_FUNC(_rest64gpr_22_t) evldd 22,64(11)
-HIDDEN_FUNC(_rest64gpr_23_t) evldd 23,72(11)
-HIDDEN_FUNC(_rest64gpr_24_t) evldd 24,80(11)
-HIDDEN_FUNC(_rest64gpr_25_t) evldd 25,88(11)
-HIDDEN_FUNC(_rest64gpr_26_t) evldd 26,96(11)
-HIDDEN_FUNC(_rest64gpr_27_t) evldd 27,104(11)
-HIDDEN_FUNC(_rest64gpr_28_t) evldd 28,112(11)
-HIDDEN_FUNC(_rest64gpr_29_t) evldd 29,120(11)
-HIDDEN_FUNC(_rest64gpr_30_t) evldd 30,128(11)
-HIDDEN_FUNC(_rest64gpr_31_t) lwz 0,148(11)
- evldd 31,136(11)
- addi 1,11,144
- blr
-FUNC_END(_rest64gpr_31_t)
-FUNC_END(_rest64gpr_30_t)
-FUNC_END(_rest64gpr_29_t)
-FUNC_END(_rest64gpr_28_t)
-FUNC_END(_rest64gpr_27_t)
-FUNC_END(_rest64gpr_26_t)
-FUNC_END(_rest64gpr_25_t)
-FUNC_END(_rest64gpr_24_t)
-FUNC_END(_rest64gpr_23_t)
-FUNC_END(_rest64gpr_22_t)
-FUNC_END(_rest64gpr_21_t)
-FUNC_END(_rest64gpr_20_t)
-FUNC_END(_rest64gpr_19_t)
-FUNC_END(_rest64gpr_18_t)
-FUNC_END(_rest64gpr_17_t)
-FUNC_END(_rest64gpr_16_t)
-FUNC_END(_rest64gpr_15_t)
-FUNC_END(_rest64gpr_14_t)
-
-#endif
diff --git a/gcc/config/rs6000/e500crtresx32gpr.asm b/gcc/config/rs6000/e500crtresx32gpr.asm
deleted file mode 100644
index 0b35245df42..00000000000
--- a/gcc/config/rs6000/e500crtresx32gpr.asm
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Special support for e500 eabi and SVR4
- *
- * Copyright (C) 2008, 2009 Free Software Foundation, Inc.
- * Written by Nathan Froyd
- *
- * This file is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 3, or (at your option) any
- * later version.
- *
- * This file 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/>.
- */
- .section ".text"
- #include "ppc-asm.h"
-
-#ifdef __SPE__
-
-/* Routines for restoring 32-bit integer registers, called by the compiler. */
-/* "Exit" versions that return to the caller's caller. */
-
-HIDDEN_FUNC(_rest32gpr_14_x) lwz 14,-72(11)
-HIDDEN_FUNC(_rest32gpr_15_x) lwz 15,-68(11)
-HIDDEN_FUNC(_rest32gpr_16_x) lwz 16,-64(11)
-HIDDEN_FUNC(_rest32gpr_17_x) lwz 17,-60(11)
-HIDDEN_FUNC(_rest32gpr_18_x) lwz 18,-56(11)
-HIDDEN_FUNC(_rest32gpr_19_x) lwz 19,-52(11)
-HIDDEN_FUNC(_rest32gpr_20_x) lwz 20,-48(11)
-HIDDEN_FUNC(_rest32gpr_21_x) lwz 21,-44(11)
-HIDDEN_FUNC(_rest32gpr_22_x) lwz 22,-40(11)
-HIDDEN_FUNC(_rest32gpr_23_x) lwz 23,-36(11)
-HIDDEN_FUNC(_rest32gpr_24_x) lwz 24,-32(11)
-HIDDEN_FUNC(_rest32gpr_25_x) lwz 25,-28(11)
-HIDDEN_FUNC(_rest32gpr_26_x) lwz 26,-24(11)
-HIDDEN_FUNC(_rest32gpr_27_x) lwz 27,-20(11)
-HIDDEN_FUNC(_rest32gpr_28_x) lwz 28,-16(11)
-HIDDEN_FUNC(_rest32gpr_29_x) lwz 29,-12(11)
-HIDDEN_FUNC(_rest32gpr_30_x) lwz 30,-8(11)
-HIDDEN_FUNC(_rest32gpr_31_x) lwz 0,4(11)
- lwz 31,-4(11)
- mr 1,11
- mtlr 0
- blr
-FUNC_END(_rest32gpr_31_x)
-FUNC_END(_rest32gpr_30_x)
-FUNC_END(_rest32gpr_29_x)
-FUNC_END(_rest32gpr_28_x)
-FUNC_END(_rest32gpr_27_x)
-FUNC_END(_rest32gpr_26_x)
-FUNC_END(_rest32gpr_25_x)
-FUNC_END(_rest32gpr_24_x)
-FUNC_END(_rest32gpr_23_x)
-FUNC_END(_rest32gpr_22_x)
-FUNC_END(_rest32gpr_21_x)
-FUNC_END(_rest32gpr_20_x)
-FUNC_END(_rest32gpr_19_x)
-FUNC_END(_rest32gpr_18_x)
-FUNC_END(_rest32gpr_17_x)
-FUNC_END(_rest32gpr_16_x)
-FUNC_END(_rest32gpr_15_x)
-FUNC_END(_rest32gpr_14_x)
-
-#endif
diff --git a/gcc/config/rs6000/e500crtresx64gpr.asm b/gcc/config/rs6000/e500crtresx64gpr.asm
deleted file mode 100644
index ce2a6cfa2aa..00000000000
--- a/gcc/config/rs6000/e500crtresx64gpr.asm
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Special support for e500 eabi and SVR4
- *
- * Copyright (C) 2008, 2009 Free Software Foundation, Inc.
- * Written by Nathan Froyd
- *
- * This file is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 3, or (at your option) any
- * later version.
- *
- * This file 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/>.
- */
-
- .section ".text"
- #include "ppc-asm.h"
-
-#ifdef __SPE__
-
-/* "Exit" versions that return to their caller's caller. */
-
-HIDDEN_FUNC(_rest64gpr_14_x) evldd 14,0(11)
-HIDDEN_FUNC(_rest64gpr_15_x) evldd 15,8(11)
-HIDDEN_FUNC(_rest64gpr_16_x) evldd 16,16(11)
-HIDDEN_FUNC(_rest64gpr_17_x) evldd 17,24(11)
-HIDDEN_FUNC(_rest64gpr_18_x) evldd 18,32(11)
-HIDDEN_FUNC(_rest64gpr_19_x) evldd 19,40(11)
-HIDDEN_FUNC(_rest64gpr_20_x) evldd 20,48(11)
-HIDDEN_FUNC(_rest64gpr_21_x) evldd 21,56(11)
-HIDDEN_FUNC(_rest64gpr_22_x) evldd 22,64(11)
-HIDDEN_FUNC(_rest64gpr_23_x) evldd 23,72(11)
-HIDDEN_FUNC(_rest64gpr_24_x) evldd 24,80(11)
-HIDDEN_FUNC(_rest64gpr_25_x) evldd 25,88(11)
-HIDDEN_FUNC(_rest64gpr_26_x) evldd 26,96(11)
-HIDDEN_FUNC(_rest64gpr_27_x) evldd 27,104(11)
-HIDDEN_FUNC(_rest64gpr_28_x) evldd 28,112(11)
-HIDDEN_FUNC(_rest64gpr_29_x) evldd 29,120(11)
-HIDDEN_FUNC(_rest64gpr_30_x) evldd 30,128(11)
-HIDDEN_FUNC(_rest64gpr_31_x) lwz 0,148(11)
- evldd 31,136(11)
- addi 1,11,144
- mtlr 0
- blr
-FUNC_END(_rest64gpr_31_x)
-FUNC_END(_rest64gpr_30_x)
-FUNC_END(_rest64gpr_29_x)
-FUNC_END(_rest64gpr_28_x)
-FUNC_END(_rest64gpr_27_x)
-FUNC_END(_rest64gpr_26_x)
-FUNC_END(_rest64gpr_25_x)
-FUNC_END(_rest64gpr_24_x)
-FUNC_END(_rest64gpr_23_x)
-FUNC_END(_rest64gpr_22_x)
-FUNC_END(_rest64gpr_21_x)
-FUNC_END(_rest64gpr_20_x)
-FUNC_END(_rest64gpr_19_x)
-FUNC_END(_rest64gpr_18_x)
-FUNC_END(_rest64gpr_17_x)
-FUNC_END(_rest64gpr_16_x)
-FUNC_END(_rest64gpr_15_x)
-FUNC_END(_rest64gpr_14_x)
-
-#endif
diff --git a/gcc/config/rs6000/e500crtsav32gpr.asm b/gcc/config/rs6000/e500crtsav32gpr.asm
deleted file mode 100644
index c891030507e..00000000000
--- a/gcc/config/rs6000/e500crtsav32gpr.asm
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Special support for e500 eabi and SVR4
- *
- * Copyright (C) 2008, 2009 Free Software Foundation, Inc.
- * Written by Nathan Froyd
- *
- * This file is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 3, or (at your option) any
- * later version.
- *
- * This file 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/>.
- */
-
- .section ".text"
- #include "ppc-asm.h"
-
-#ifdef __SPE__
-
-/* Routines for saving 32-bit integer registers, called by the compiler. */
-/* "Bare" versions that simply return to their caller. */
-
-HIDDEN_FUNC(_save32gpr_14) stw 14,-72(11)
-HIDDEN_FUNC(_save32gpr_15) stw 15,-68(11)
-HIDDEN_FUNC(_save32gpr_16) stw 16,-64(11)
-HIDDEN_FUNC(_save32gpr_17) stw 17,-60(11)
-HIDDEN_FUNC(_save32gpr_18) stw 18,-56(11)
-HIDDEN_FUNC(_save32gpr_19) stw 19,-52(11)
-HIDDEN_FUNC(_save32gpr_20) stw 20,-48(11)
-HIDDEN_FUNC(_save32gpr_21) stw 21,-44(11)
-HIDDEN_FUNC(_save32gpr_22) stw 22,-40(11)
-HIDDEN_FUNC(_save32gpr_23) stw 23,-36(11)
-HIDDEN_FUNC(_save32gpr_24) stw 24,-32(11)
-HIDDEN_FUNC(_save32gpr_25) stw 25,-28(11)
-HIDDEN_FUNC(_save32gpr_26) stw 26,-24(11)
-HIDDEN_FUNC(_save32gpr_27) stw 27,-20(11)
-HIDDEN_FUNC(_save32gpr_28) stw 28,-16(11)
-HIDDEN_FUNC(_save32gpr_29) stw 29,-12(11)
-HIDDEN_FUNC(_save32gpr_30) stw 30,-8(11)
-HIDDEN_FUNC(_save32gpr_31) stw 31,-4(11)
- blr
-FUNC_END(_save32gpr_31)
-FUNC_END(_save32gpr_30)
-FUNC_END(_save32gpr_29)
-FUNC_END(_save32gpr_28)
-FUNC_END(_save32gpr_27)
-FUNC_END(_save32gpr_26)
-FUNC_END(_save32gpr_25)
-FUNC_END(_save32gpr_24)
-FUNC_END(_save32gpr_23)
-FUNC_END(_save32gpr_22)
-FUNC_END(_save32gpr_21)
-FUNC_END(_save32gpr_20)
-FUNC_END(_save32gpr_19)
-FUNC_END(_save32gpr_18)
-FUNC_END(_save32gpr_17)
-FUNC_END(_save32gpr_16)
-FUNC_END(_save32gpr_15)
-FUNC_END(_save32gpr_14)
-
-#endif
diff --git a/gcc/config/rs6000/e500crtsav64gpr.asm b/gcc/config/rs6000/e500crtsav64gpr.asm
deleted file mode 100644
index 2a5d3e475fd..00000000000
--- a/gcc/config/rs6000/e500crtsav64gpr.asm
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Special support for e500 eabi and SVR4
- *
- * Copyright (C) 2008, 2009 Free Software Foundation, Inc.
- * Written by Nathan Froyd
- *
- * This file is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 3, or (at your option) any
- * later version.
- *
- * This file 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/>.
- */
-
- .section ".text"
- #include "ppc-asm.h"
-
-#ifdef __SPE__
-
-/* Routines for saving 64-bit integer registers, called by the compiler. */
-
-HIDDEN_FUNC(_save64gpr_14) evstdd 14,0(11)
-HIDDEN_FUNC(_save64gpr_15) evstdd 15,8(11)
-HIDDEN_FUNC(_save64gpr_16) evstdd 16,16(11)
-HIDDEN_FUNC(_save64gpr_17) evstdd 17,24(11)
-HIDDEN_FUNC(_save64gpr_18) evstdd 18,32(11)
-HIDDEN_FUNC(_save64gpr_19) evstdd 19,40(11)
-HIDDEN_FUNC(_save64gpr_20) evstdd 20,48(11)
-HIDDEN_FUNC(_save64gpr_21) evstdd 21,56(11)
-HIDDEN_FUNC(_save64gpr_22) evstdd 22,64(11)
-HIDDEN_FUNC(_save64gpr_23) evstdd 23,72(11)
-HIDDEN_FUNC(_save64gpr_24) evstdd 24,80(11)
-HIDDEN_FUNC(_save64gpr_25) evstdd 25,88(11)
-HIDDEN_FUNC(_save64gpr_26) evstdd 26,96(11)
-HIDDEN_FUNC(_save64gpr_27) evstdd 27,104(11)
-HIDDEN_FUNC(_save64gpr_28) evstdd 28,112(11)
-HIDDEN_FUNC(_save64gpr_29) evstdd 29,120(11)
-HIDDEN_FUNC(_save64gpr_30) evstdd 30,128(11)
-HIDDEN_FUNC(_save64gpr_31) evstdd 31,136(11)
- blr
-FUNC_END(_save64gpr_31)
-FUNC_END(_save64gpr_30)
-FUNC_END(_save64gpr_29)
-FUNC_END(_save64gpr_28)
-FUNC_END(_save64gpr_27)
-FUNC_END(_save64gpr_26)
-FUNC_END(_save64gpr_25)
-FUNC_END(_save64gpr_24)
-FUNC_END(_save64gpr_23)
-FUNC_END(_save64gpr_22)
-FUNC_END(_save64gpr_21)
-FUNC_END(_save64gpr_20)
-FUNC_END(_save64gpr_19)
-FUNC_END(_save64gpr_18)
-FUNC_END(_save64gpr_17)
-FUNC_END(_save64gpr_16)
-FUNC_END(_save64gpr_15)
-FUNC_END(_save64gpr_14)
-
-#endif
diff --git a/gcc/config/rs6000/e500crtsav64gprctr.asm b/gcc/config/rs6000/e500crtsav64gprctr.asm
deleted file mode 100644
index dd0bdf3c89a..00000000000
--- a/gcc/config/rs6000/e500crtsav64gprctr.asm
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Special support for e500 eabi and SVR4
- *
- * Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
- * Written by Nathan Froyd
- *
- * This file is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 3, or (at your option) any
- * later version.
- *
- * This file 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/>.
- */
-
- .section ".text"
- #include "ppc-asm.h"
-
-#ifdef __SPE__
-
-/* Routines for saving 64-bit integer registers where the number of
- registers to be saved is passed in CTR, called by the compiler. */
-/* "Bare" versions that return to their caller. */
-
-HIDDEN_FUNC(_save64gpr_ctr_14) evstdd 14,0(11)
- bdz _save64gpr_ctr_done
-HIDDEN_FUNC(_save64gpr_ctr_15) evstdd 15,8(11)
- bdz _save64gpr_ctr_done
-HIDDEN_FUNC(_save64gpr_ctr_16) evstdd 16,16(11)
- bdz _save64gpr_ctr_done
-HIDDEN_FUNC(_save64gpr_ctr_17) evstdd 17,24(11)
- bdz _save64gpr_ctr_done
-HIDDEN_FUNC(_save64gpr_ctr_18) evstdd 18,32(11)
- bdz _save64gpr_ctr_done
-HIDDEN_FUNC(_save64gpr_ctr_19) evstdd 19,40(11)
- bdz _save64gpr_ctr_done
-HIDDEN_FUNC(_save64gpr_ctr_20) evstdd 20,48(11)
- bdz _save64gpr_ctr_done
-HIDDEN_FUNC(_save64gpr_ctr_21) evstdd 21,56(11)
- bdz _save64gpr_ctr_done
-HIDDEN_FUNC(_save64gpr_ctr_22) evstdd 22,64(11)
- bdz _save64gpr_ctr_done
-HIDDEN_FUNC(_save64gpr_ctr_23) evstdd 23,72(11)
- bdz _save64gpr_ctr_done
-HIDDEN_FUNC(_save64gpr_ctr_24) evstdd 24,80(11)
- bdz _save64gpr_ctr_done
-HIDDEN_FUNC(_save64gpr_ctr_25) evstdd 25,88(11)
- bdz _save64gpr_ctr_done
-HIDDEN_FUNC(_save64gpr_ctr_26) evstdd 26,96(11)
- bdz _save64gpr_ctr_done
-HIDDEN_FUNC(_save64gpr_ctr_27) evstdd 27,104(11)
- bdz _save64gpr_ctr_done
-HIDDEN_FUNC(_save64gpr_ctr_28) evstdd 28,112(11)
- bdz _save64gpr_ctr_done
-HIDDEN_FUNC(_save64gpr_ctr_29) evstdd 29,120(11)
- bdz _save64gpr_ctr_done
-HIDDEN_FUNC(_save64gpr_ctr_30) evstdd 30,128(11)
- bdz _save64gpr_ctr_done
-HIDDEN_FUNC(_save64gpr_ctr_31) evstdd 31,136(11)
-_save64gpr_ctr_done: blr
-FUNC_END(_save64gpr_ctr_31)
-FUNC_END(_save64gpr_ctr_30)
-FUNC_END(_save64gpr_ctr_29)
-FUNC_END(_save64gpr_ctr_28)
-FUNC_END(_save64gpr_ctr_27)
-FUNC_END(_save64gpr_ctr_26)
-FUNC_END(_save64gpr_ctr_25)
-FUNC_END(_save64gpr_ctr_24)
-FUNC_END(_save64gpr_ctr_23)
-FUNC_END(_save64gpr_ctr_22)
-FUNC_END(_save64gpr_ctr_21)
-FUNC_END(_save64gpr_ctr_20)
-FUNC_END(_save64gpr_ctr_19)
-FUNC_END(_save64gpr_ctr_18)
-FUNC_END(_save64gpr_ctr_17)
-FUNC_END(_save64gpr_ctr_16)
-FUNC_END(_save64gpr_ctr_15)
-FUNC_END(_save64gpr_ctr_14)
-
-#endif
diff --git a/gcc/config/rs6000/e500crtsavg32gpr.asm b/gcc/config/rs6000/e500crtsavg32gpr.asm
deleted file mode 100644
index d14088e0dec..00000000000
--- a/gcc/config/rs6000/e500crtsavg32gpr.asm
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Special support for e500 eabi and SVR4
- *
- * Copyright (C) 2008, 2009 Free Software Foundation, Inc.
- * Written by Nathan Froyd
- *
- * This file is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 3, or (at your option) any
- * later version.
- *
- * This file 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/>.
- */
-
- .section ".text"
- #include "ppc-asm.h"
-
-#ifdef __SPE__
-
-/* Routines for saving 32-bit integer registers, called by the compiler. */
-/* "GOT" versions that load the address of the GOT into lr before returning. */
-
-HIDDEN_FUNC(_save32gpr_14_g) stw 14,-72(11)
-HIDDEN_FUNC(_save32gpr_15_g) stw 15,-68(11)
-HIDDEN_FUNC(_save32gpr_16_g) stw 16,-64(11)
-HIDDEN_FUNC(_save32gpr_17_g) stw 17,-60(11)
-HIDDEN_FUNC(_save32gpr_18_g) stw 18,-56(11)
-HIDDEN_FUNC(_save32gpr_19_g) stw 19,-52(11)
-HIDDEN_FUNC(_save32gpr_20_g) stw 20,-48(11)
-HIDDEN_FUNC(_save32gpr_21_g) stw 21,-44(11)
-HIDDEN_FUNC(_save32gpr_22_g) stw 22,-40(11)
-HIDDEN_FUNC(_save32gpr_23_g) stw 23,-36(11)
-HIDDEN_FUNC(_save32gpr_24_g) stw 24,-32(11)
-HIDDEN_FUNC(_save32gpr_25_g) stw 25,-28(11)
-HIDDEN_FUNC(_save32gpr_26_g) stw 26,-24(11)
-HIDDEN_FUNC(_save32gpr_27_g) stw 27,-20(11)
-HIDDEN_FUNC(_save32gpr_28_g) stw 28,-16(11)
-HIDDEN_FUNC(_save32gpr_29_g) stw 29,-12(11)
-HIDDEN_FUNC(_save32gpr_30_g) stw 30,-8(11)
-HIDDEN_FUNC(_save32gpr_31_g) stw 31,-4(11)
- b _GLOBAL_OFFSET_TABLE_-4
-FUNC_END(_save32gpr_31_g)
-FUNC_END(_save32gpr_30_g)
-FUNC_END(_save32gpr_29_g)
-FUNC_END(_save32gpr_28_g)
-FUNC_END(_save32gpr_27_g)
-FUNC_END(_save32gpr_26_g)
-FUNC_END(_save32gpr_25_g)
-FUNC_END(_save32gpr_24_g)
-FUNC_END(_save32gpr_23_g)
-FUNC_END(_save32gpr_22_g)
-FUNC_END(_save32gpr_21_g)
-FUNC_END(_save32gpr_20_g)
-FUNC_END(_save32gpr_19_g)
-FUNC_END(_save32gpr_18_g)
-FUNC_END(_save32gpr_17_g)
-FUNC_END(_save32gpr_16_g)
-FUNC_END(_save32gpr_15_g)
-FUNC_END(_save32gpr_14_g)
-
-#endif
diff --git a/gcc/config/rs6000/e500crtsavg64gpr.asm b/gcc/config/rs6000/e500crtsavg64gpr.asm
deleted file mode 100644
index cbad75bc053..00000000000
--- a/gcc/config/rs6000/e500crtsavg64gpr.asm
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Special support for e500 eabi and SVR4
- *
- * Copyright (C) 2008, 2009 Free Software Foundation, Inc.
- * Written by Nathan Froyd
- *
- * This file is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 3, or (at your option) any
- * later version.
- *
- * This file 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/>.
- */
-
- .section ".text"
- #include "ppc-asm.h"
-
-#ifdef __SPE__
-
-/* Routines for saving 64-bit integer registers, called by the compiler. */
-/* "GOT" versions that load the address of the GOT into lr before returning. */
-
-HIDDEN_FUNC(_save64gpr_14_g) evstdd 14,0(11)
-HIDDEN_FUNC(_save64gpr_15_g) evstdd 15,8(11)
-HIDDEN_FUNC(_save64gpr_16_g) evstdd 16,16(11)
-HIDDEN_FUNC(_save64gpr_17_g) evstdd 17,24(11)
-HIDDEN_FUNC(_save64gpr_18_g) evstdd 18,32(11)
-HIDDEN_FUNC(_save64gpr_19_g) evstdd 19,40(11)
-HIDDEN_FUNC(_save64gpr_20_g) evstdd 20,48(11)
-HIDDEN_FUNC(_save64gpr_21_g) evstdd 21,56(11)
-HIDDEN_FUNC(_save64gpr_22_g) evstdd 22,64(11)
-HIDDEN_FUNC(_save64gpr_23_g) evstdd 23,72(11)
-HIDDEN_FUNC(_save64gpr_24_g) evstdd 24,80(11)
-HIDDEN_FUNC(_save64gpr_25_g) evstdd 25,88(11)
-HIDDEN_FUNC(_save64gpr_26_g) evstdd 26,96(11)
-HIDDEN_FUNC(_save64gpr_27_g) evstdd 27,104(11)
-HIDDEN_FUNC(_save64gpr_28_g) evstdd 28,112(11)
-HIDDEN_FUNC(_save64gpr_29_g) evstdd 29,120(11)
-HIDDEN_FUNC(_save64gpr_30_g) evstdd 30,128(11)
-HIDDEN_FUNC(_save64gpr_31_g) evstdd 31,136(11)
- b _GLOBAL_OFFSET_TABLE_-4
-FUNC_END(_save64gpr_31_g)
-FUNC_END(_save64gpr_30_g)
-FUNC_END(_save64gpr_29_g)
-FUNC_END(_save64gpr_28_g)
-FUNC_END(_save64gpr_27_g)
-FUNC_END(_save64gpr_26_g)
-FUNC_END(_save64gpr_25_g)
-FUNC_END(_save64gpr_24_g)
-FUNC_END(_save64gpr_23_g)
-FUNC_END(_save64gpr_22_g)
-FUNC_END(_save64gpr_21_g)
-FUNC_END(_save64gpr_20_g)
-FUNC_END(_save64gpr_19_g)
-FUNC_END(_save64gpr_18_g)
-FUNC_END(_save64gpr_17_g)
-FUNC_END(_save64gpr_16_g)
-FUNC_END(_save64gpr_15_g)
-FUNC_END(_save64gpr_14_g)
-
-#endif
diff --git a/gcc/config/rs6000/e500crtsavg64gprctr.asm b/gcc/config/rs6000/e500crtsavg64gprctr.asm
deleted file mode 100644
index 238df4e8319..00000000000
--- a/gcc/config/rs6000/e500crtsavg64gprctr.asm
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Special support for e500 eabi and SVR4
- *
- * Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
- * Written by Nathan Froyd
- *
- * This file is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 3, or (at your option) any
- * later version.
- *
- * This file 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/>.
- */
-
- .section ".text"
- #include "ppc-asm.h"
-
-#ifdef __SPE__
-
-/* Routines for saving 64-bit integer registers, called by the compiler. */
-/* "GOT" versions that load the address of the GOT into lr before returning. */
-
-HIDDEN_FUNC(_save64gpr_ctr_14_g) evstdd 14,0(11)
- bdz _save64gpr_ctr_g_done
-HIDDEN_FUNC(_save64gpr_ctr_15_g) evstdd 15,8(11)
- bdz _save64gpr_ctr_g_done
-HIDDEN_FUNC(_save64gpr_ctr_16_g) evstdd 16,16(11)
- bdz _save64gpr_ctr_g_done
-HIDDEN_FUNC(_save64gpr_ctr_17_g) evstdd 17,24(11)
- bdz _save64gpr_ctr_g_done
-HIDDEN_FUNC(_save64gpr_ctr_18_g) evstdd 18,32(11)
- bdz _save64gpr_ctr_g_done
-HIDDEN_FUNC(_save64gpr_ctr_19_g) evstdd 19,40(11)
- bdz _save64gpr_ctr_g_done
-HIDDEN_FUNC(_save64gpr_ctr_20_g) evstdd 20,48(11)
- bdz _save64gpr_ctr_g_done
-HIDDEN_FUNC(_save64gpr_ctr_21_g) evstdd 21,56(11)
- bdz _save64gpr_ctr_g_done
-HIDDEN_FUNC(_save64gpr_ctr_22_g) evstdd 22,64(11)
- bdz _save64gpr_ctr_g_done
-HIDDEN_FUNC(_save64gpr_ctr_23_g) evstdd 23,72(11)
- bdz _save64gpr_ctr_g_done
-HIDDEN_FUNC(_save64gpr_ctr_24_g) evstdd 24,80(11)
- bdz _save64gpr_ctr_g_done
-HIDDEN_FUNC(_save64gpr_ctr_25_g) evstdd 25,88(11)
- bdz _save64gpr_ctr_g_done
-HIDDEN_FUNC(_save64gpr_ctr_26_g) evstdd 26,96(11)
- bdz _save64gpr_ctr_g_done
-HIDDEN_FUNC(_save64gpr_ctr_27_g) evstdd 27,104(11)
- bdz _save64gpr_ctr_g_done
-HIDDEN_FUNC(_save64gpr_ctr_28_g) evstdd 28,112(11)
- bdz _save64gpr_ctr_g_done
-HIDDEN_FUNC(_save64gpr_ctr_29_g) evstdd 29,120(11)
- bdz _save64gpr_ctr_g_done
-HIDDEN_FUNC(_save64gpr_ctr_30_g) evstdd 30,128(11)
- bdz _save64gpr_ctr_g_done
-HIDDEN_FUNC(_save64gpr_ctr_31_g) evstdd 31,136(11)
-_save64gpr_ctr_g_done: b _GLOBAL_OFFSET_TABLE_-4
-FUNC_END(_save64gpr_ctr_31_g)
-FUNC_END(_save64gpr_ctr_30_g)
-FUNC_END(_save64gpr_ctr_29_g)
-FUNC_END(_save64gpr_ctr_28_g)
-FUNC_END(_save64gpr_ctr_27_g)
-FUNC_END(_save64gpr_ctr_26_g)
-FUNC_END(_save64gpr_ctr_25_g)
-FUNC_END(_save64gpr_ctr_24_g)
-FUNC_END(_save64gpr_ctr_23_g)
-FUNC_END(_save64gpr_ctr_22_g)
-FUNC_END(_save64gpr_ctr_21_g)
-FUNC_END(_save64gpr_ctr_20_g)
-FUNC_END(_save64gpr_ctr_19_g)
-FUNC_END(_save64gpr_ctr_18_g)
-FUNC_END(_save64gpr_ctr_17_g)
-FUNC_END(_save64gpr_ctr_16_g)
-FUNC_END(_save64gpr_ctr_15_g)
-FUNC_END(_save64gpr_ctr_14_g)
-
-#endif
diff --git a/gcc/config/rs6000/eabi-ci.asm b/gcc/config/rs6000/eabi-ci.asm
deleted file mode 100644
index 696f33d394f..00000000000
--- a/gcc/config/rs6000/eabi-ci.asm
+++ /dev/null
@@ -1,113 +0,0 @@
-/* crti.s for eabi
- Copyright (C) 1996, 2000, 2008, 2009 Free Software Foundation, Inc.
- Written By Michael Meissner
-
-This file is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3, or (at your option) any
-later version.
-
-This file 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/>. */
-
-/* This file just supplies labeled starting points for the .got* and other
- special sections. It is linked in first before other modules. */
-
- .ident "GNU C crti.s"
-
-#include <ppc-asm.h>
-
-#ifndef __powerpc64__
- .section ".got","aw"
- .globl __GOT_START__
- .type __GOT_START__,@object
-__GOT_START__:
-
- .section ".got1","aw"
- .globl __GOT1_START__
- .type __GOT1_START__,@object
-__GOT1_START__:
-
- .section ".got2","aw"
- .globl __GOT2_START__
- .type __GOT2_START__,@object
-__GOT2_START__:
-
- .section ".fixup","aw"
- .globl __FIXUP_START__
- .type __FIXUP_START__,@object
-__FIXUP_START__:
-
- .section ".ctors","aw"
- .globl __CTOR_LIST__
- .type __CTOR_LIST__,@object
-__CTOR_LIST__:
-
- .section ".dtors","aw"
- .globl __DTOR_LIST__
- .type __DTOR_LIST__,@object
-__DTOR_LIST__:
-
- .section ".sdata","aw"
- .globl __SDATA_START__
- .type __SDATA_START__,@object
- .weak _SDA_BASE_
- .type _SDA_BASE_,@object
-__SDATA_START__:
-_SDA_BASE_:
-
- .section ".sbss","aw",@nobits
- .globl __SBSS_START__
- .type __SBSS_START__,@object
-__SBSS_START__:
-
- .section ".sdata2","a"
- .weak _SDA2_BASE_
- .type _SDA2_BASE_,@object
- .globl __SDATA2_START__
- .type __SDATA2_START__,@object
-__SDATA2_START__:
-_SDA2_BASE_:
-
- .section ".sbss2","a"
- .globl __SBSS2_START__
- .type __SBSS2_START__,@object
-__SBSS2_START__:
-
- .section ".gcc_except_table","aw"
- .globl __EXCEPT_START__
- .type __EXCEPT_START__,@object
-__EXCEPT_START__:
-
- .section ".eh_frame","aw"
- .globl __EH_FRAME_BEGIN__
- .type __EH_FRAME_BEGIN__,@object
-__EH_FRAME_BEGIN__:
-
-/* Head of __init function used for static constructors. */
- .section ".init","ax"
- .align 2
-FUNC_START(__init)
- stwu 1,-16(1)
- mflr 0
- stw 0,20(1)
-
-/* Head of __fini function used for static destructors. */
- .section ".fini","ax"
- .align 2
-FUNC_START(__fini)
- stwu 1,-16(1)
- mflr 0
- stw 0,20(1)
-#endif
diff --git a/gcc/config/rs6000/eabi-cn.asm b/gcc/config/rs6000/eabi-cn.asm
deleted file mode 100644
index 68774097c7c..00000000000
--- a/gcc/config/rs6000/eabi-cn.asm
+++ /dev/null
@@ -1,104 +0,0 @@
-/* crtn.s for eabi
- Copyright (C) 1996, 2000, 2007, 2008, 2009 Free Software Foundation, Inc.
- Written By Michael Meissner
-
-This file is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3, or (at your option) any
-later version.
-
-This file 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/>. */
-
-/* This file just supplies labeled ending points for the .got* and other
- special sections. It is linked in last after other modules. */
-
- .ident "GNU C crtn.s"
-
-#ifndef __powerpc64__
- .section ".got","aw"
- .globl __GOT_END__
- .type __GOT_END__,@object
-__GOT_END__:
-
- .section ".got1","aw"
- .globl __GOT1_END__
- .type __GOT1_END__,@object
-__GOT1_END__:
-
- .section ".got2","aw"
- .globl __GOT2_END__
- .type __GOT2_END__,@object
-__GOT2_END__:
-
- .section ".fixup","aw"
- .globl __FIXUP_END__
- .type __FIXUP_END__,@object
-__FIXUP_END__:
-
- .section ".ctors","aw"
- .globl __CTOR_END__
- .type __CTOR_END__,@object
-__CTOR_END__:
-
- .section ".dtors","aw"
- .weak __DTOR_END__
- .type __DTOR_END__,@object
-__DTOR_END__:
-
- .section ".sdata","aw"
- .globl __SDATA_END__
- .type __SDATA_END__,@object
-__SDATA_END__:
-
- .section ".sbss","aw",@nobits
- .globl __SBSS_END__
- .type __SBSS_END__,@object
-__SBSS_END__:
-
- .section ".sdata2","a"
- .globl __SDATA2_END__
- .type __SDATA2_END__,@object
-__SDATA2_END__:
-
- .section ".sbss2","a"
- .globl __SBSS2_END__
- .type __SBSS2_END__,@object
-__SBSS2_END__:
-
- .section ".gcc_except_table","aw"
- .globl __EXCEPT_END__
- .type __EXCEPT_END__,@object
-__EXCEPT_END__:
-
- .section ".eh_frame","aw"
- .globl __EH_FRAME_END__
- .type __EH_FRAME_END__,@object
-__EH_FRAME_END__:
- .long 0
-
-/* Tail of __init function used for static constructors. */
- .section ".init","ax"
- lwz 0,20(1)
- mtlr 0
- addi 1,1,16
- blr
-
-/* Tail of __fini function used for static destructors. */
- .section ".fini","ax"
- lwz 0,20(1)
- mtlr 0
- addi 1,1,16
- blr
-#endif
diff --git a/gcc/config/rs6000/eabi.asm b/gcc/config/rs6000/eabi.asm
deleted file mode 100644
index 292d88e5016..00000000000
--- a/gcc/config/rs6000/eabi.asm
+++ /dev/null
@@ -1,289 +0,0 @@
-/*
- * Special support for eabi and SVR4
- *
- * Copyright (C) 1995, 1996, 1998, 2000, 2001, 2008, 2009
- * Free Software Foundation, Inc.
- * Written By Michael Meissner
- *
- * This file is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 3, or (at your option) any
- * later version.
- *
- * This file 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/>.
- */
-
-/* Do any initializations needed for the eabi environment */
-
- .section ".text"
- #include "ppc-asm.h"
-
-#ifndef __powerpc64__
-
- .section ".got2","aw"
- .align 2
-.LCTOC1 = . /* +32768 */
-
-/* Table of addresses */
-.Ltable = .-.LCTOC1
- .long .LCTOC1 /* address we are really at */
-
-.Lsda = .-.LCTOC1
- .long _SDA_BASE_ /* address of the first small data area */
-
-.Lsdas = .-.LCTOC1
- .long __SDATA_START__ /* start of .sdata/.sbss section */
-
-.Lsdae = .-.LCTOC1
- .long __SBSS_END__ /* end of .sdata/.sbss section */
-
-.Lsda2 = .-.LCTOC1
- .long _SDA2_BASE_ /* address of the second small data area */
-
-.Lsda2s = .-.LCTOC1
- .long __SDATA2_START__ /* start of .sdata2/.sbss2 section */
-
-.Lsda2e = .-.LCTOC1
- .long __SBSS2_END__ /* end of .sdata2/.sbss2 section */
-
-#ifdef _RELOCATABLE
-.Lgots = .-.LCTOC1
- .long __GOT_START__ /* Global offset table start */
-
-.Lgotm1 = .-.LCTOC1
- .long _GLOBAL_OFFSET_TABLE_-4 /* end of GOT ptrs before BLCL + 3 reserved words */
-
-.Lgotm2 = .-.LCTOC1
- .long _GLOBAL_OFFSET_TABLE_+12 /* start of GOT ptrs after BLCL + 3 reserved words */
-
-.Lgote = .-.LCTOC1
- .long __GOT_END__ /* Global offset table end */
-
-.Lgot2s = .-.LCTOC1
- .long __GOT2_START__ /* -mrelocatable GOT pointers start */
-
-.Lgot2e = .-.LCTOC1
- .long __GOT2_END__ /* -mrelocatable GOT pointers end */
-
-.Lfixups = .-.LCTOC1
- .long __FIXUP_START__ /* start of .fixup section */
-
-.Lfixupe = .-.LCTOC1
- .long __FIXUP_END__ /* end of .fixup section */
-
-.Lctors = .-.LCTOC1
- .long __CTOR_LIST__ /* start of .ctor section */
-
-.Lctore = .-.LCTOC1
- .long __CTOR_END__ /* end of .ctor section */
-
-.Ldtors = .-.LCTOC1
- .long __DTOR_LIST__ /* start of .dtor section */
-
-.Ldtore = .-.LCTOC1
- .long __DTOR_END__ /* end of .dtor section */
-
-.Lexcepts = .-.LCTOC1
- .long __EXCEPT_START__ /* start of .gcc_except_table section */
-
-.Lexcepte = .-.LCTOC1
- .long __EXCEPT_END__ /* end of .gcc_except_table section */
-
-.Linit = .-.LCTOC1
- .long .Linit_p /* address of variable to say we've been called */
-
- .text
- .align 2
-.Lptr:
- .long .LCTOC1-.Laddr /* PC relative pointer to .got2 */
-#endif
-
- .data
- .align 2
-.Linit_p:
- .long 0
-
- .text
-
-FUNC_START(__eabi)
-
-/* Eliminate -mrelocatable code if not -mrelocatable, so that this file can
- be assembled with other assemblers than GAS. */
-
-#ifndef _RELOCATABLE
- addis 10,0,.Linit_p@ha /* init flag */
- addis 11,0,.LCTOC1@ha /* load address of .LCTOC1 */
- lwz 9,.Linit_p@l(10) /* init flag */
- addi 11,11,.LCTOC1@l
- cmplwi 2,9,0 /* init flag != 0? */
- bnelr 2 /* return now, if we've been called already */
- stw 1,.Linit_p@l(10) /* store a nonzero value in the done flag */
-
-#else /* -mrelocatable */
- mflr 0
- bl .Laddr /* get current address */
-.Laddr:
- mflr 12 /* real address of .Laddr */
- lwz 11,(.Lptr-.Laddr)(12) /* linker generated address of .LCTOC1 */
- add 11,11,12 /* correct to real pointer */
- lwz 12,.Ltable(11) /* get linker's idea of where .Laddr is */
- lwz 10,.Linit(11) /* address of init flag */
- subf. 12,12,11 /* calculate difference */
- lwzx 9,10,12 /* done flag */
- cmplwi 2,9,0 /* init flag != 0? */
- mtlr 0 /* restore in case branch was taken */
- bnelr 2 /* return now, if we've been called already */
- stwx 1,10,12 /* store a nonzero value in the done flag */
- beq+ 0,.Lsdata /* skip if we don't need to relocate */
-
-/* We need to relocate the .got2 pointers. */
-
- lwz 3,.Lgot2s(11) /* GOT2 pointers start */
- lwz 4,.Lgot2e(11) /* GOT2 pointers end */
- add 3,12,3 /* adjust pointers */
- add 4,12,4
- bl FUNC_NAME(__eabi_convert) /* convert pointers in .got2 section */
-
-/* Fixup the .ctor section for static constructors */
-
- lwz 3,.Lctors(11) /* constructors pointers start */
- lwz 4,.Lctore(11) /* constructors pointers end */
- bl FUNC_NAME(__eabi_convert) /* convert constructors */
-
-/* Fixup the .dtor section for static destructors */
-
- lwz 3,.Ldtors(11) /* destructors pointers start */
- lwz 4,.Ldtore(11) /* destructors pointers end */
- bl FUNC_NAME(__eabi_convert) /* convert destructors */
-
-/* Fixup the .gcc_except_table section for G++ exceptions */
-
- lwz 3,.Lexcepts(11) /* exception table pointers start */
- lwz 4,.Lexcepte(11) /* exception table pointers end */
- bl FUNC_NAME(__eabi_convert) /* convert exceptions */
-
-/* Fixup the addresses in the GOT below _GLOBAL_OFFSET_TABLE_-4 */
-
- lwz 3,.Lgots(11) /* GOT table pointers start */
- lwz 4,.Lgotm1(11) /* GOT table pointers below _GLOBAL_OFFSET_TABLE-4 */
- bl FUNC_NAME(__eabi_convert) /* convert lower GOT */
-
-/* Fixup the addresses in the GOT above _GLOBAL_OFFSET_TABLE_+12 */
-
- lwz 3,.Lgotm2(11) /* GOT table pointers above _GLOBAL_OFFSET_TABLE+12 */
- lwz 4,.Lgote(11) /* GOT table pointers end */
- bl FUNC_NAME(__eabi_convert) /* convert lower GOT */
-
-/* Fixup any user initialized pointers now (the compiler drops pointers to */
-/* each of the relocs that it does in the .fixup section). */
-
-.Lfix:
- lwz 3,.Lfixups(11) /* fixup pointers start */
- lwz 4,.Lfixupe(11) /* fixup pointers end */
- bl FUNC_NAME(__eabi_uconvert) /* convert user initialized pointers */
-
-.Lsdata:
- mtlr 0 /* restore link register */
-#endif /* _RELOCATABLE */
-
-/* Only load up register 13 if there is a .sdata and/or .sbss section */
- lwz 3,.Lsdas(11) /* start of .sdata/.sbss section */
- lwz 4,.Lsdae(11) /* end of .sdata/.sbss section */
- cmpw 1,3,4 /* .sdata/.sbss section non-empty? */
- beq- 1,.Lsda2l /* skip loading r13 */
-
- lwz 13,.Lsda(11) /* load r13 with _SDA_BASE_ address */
-
-/* Only load up register 2 if there is a .sdata2 and/or .sbss2 section */
-
-.Lsda2l:
- lwz 3,.Lsda2s(11) /* start of .sdata/.sbss section */
- lwz 4,.Lsda2e(11) /* end of .sdata/.sbss section */
- cmpw 1,3,4 /* .sdata/.sbss section non-empty? */
- beq+ 1,.Ldone /* skip loading r2 */
-
- lwz 2,.Lsda2(11) /* load r2 with _SDA2_BASE_ address */
-
-/* Done adjusting pointers, return by way of doing the C++ global constructors. */
-
-.Ldone:
- b FUNC_NAME(__init) /* do any C++ global constructors (which returns to caller) */
-FUNC_END(__eabi)
-
-/* Special subroutine to convert a bunch of pointers directly.
- r0 has original link register
- r3 has low pointer to convert
- r4 has high pointer to convert
- r5 .. r10 are scratch registers
- r11 has the address of .LCTOC1 in it.
- r12 has the value to add to each pointer
- r13 .. r31 are unchanged */
-#ifdef _RELOCATABLE
-FUNC_START(__eabi_convert)
- cmplw 1,3,4 /* any pointers to convert? */
- subf 5,3,4 /* calculate number of words to convert */
- bclr 4,4 /* return if no pointers */
-
- srawi 5,5,2
- addi 3,3,-4 /* start-4 for use with lwzu */
- mtctr 5
-
-.Lcvt:
- lwzu 6,4(3) /* pointer to convert */
- cmpwi 0,6,0
- beq- .Lcvt2 /* if pointer is null, don't convert */
-
- add 6,6,12 /* convert pointer */
- stw 6,0(3)
-.Lcvt2:
- bdnz+ .Lcvt
- blr
-
-FUNC_END(__eabi_convert)
-
-/* Special subroutine to convert the pointers the user has initialized. The
- compiler has placed the address of the initialized pointer into the .fixup
- section.
-
- r0 has original link register
- r3 has low pointer to convert
- r4 has high pointer to convert
- r5 .. r10 are scratch registers
- r11 has the address of .LCTOC1 in it.
- r12 has the value to add to each pointer
- r13 .. r31 are unchanged */
-
-FUNC_START(__eabi_uconvert)
- cmplw 1,3,4 /* any pointers to convert? */
- subf 5,3,4 /* calculate number of words to convert */
- bclr 4,4 /* return if no pointers */
-
- srawi 5,5,2
- addi 3,3,-4 /* start-4 for use with lwzu */
- mtctr 5
-
-.Lucvt:
- lwzu 6,4(3) /* next pointer to pointer to convert */
- add 6,6,12 /* adjust pointer */
- lwz 7,0(6) /* get the pointer it points to */
- stw 6,0(3) /* store adjusted pointer */
- add 7,7,12 /* adjust */
- stw 7,0(6)
- bdnz+ .Lucvt
- blr
-
-FUNC_END(__eabi_uconvert)
-#endif
-#endif
diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index 5b4607a5659..aa04fdd73bf 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -1176,6 +1176,7 @@ static void rs6000_trampoline_init (rtx, tree, rtx);
static bool rs6000_cannot_force_const_mem (enum machine_mode, rtx);
static bool rs6000_legitimate_constant_p (enum machine_mode, rtx);
static bool rs6000_save_toc_in_prologue_p (void);
+static void rs6000_code_end (void) ATTRIBUTE_UNUSED;
/* Hash table stuff for keeping track of TOC entries. */
@@ -19660,7 +19661,7 @@ rs6000_emit_stack_reset (rs6000_stack_t *info,
{
/* This blockage is needed so that sched doesn't decide to move
the sp change before the register restores. */
- if (frame_reg_rtx != sp_reg_rtx
+ if (DEFAULT_ABI == ABI_V4
|| (TARGET_SPE_ABI
&& info->spe_64bit_regs_used != 0
&& info->first_gp_reg_save != 32))
@@ -21460,15 +21461,28 @@ rs6000_output_function_epilogue (FILE *file,
it looks like we might want one, insert a NOP. */
{
rtx insn = get_last_insn ();
+ rtx deleted_debug_label = NULL_RTX;
while (insn
&& NOTE_P (insn)
&& NOTE_KIND (insn) != NOTE_INSN_DELETED_LABEL)
- insn = PREV_INSN (insn);
+ {
+ /* Don't insert a nop for NOTE_INSN_DELETED_DEBUG_LABEL
+ notes only, instead set their CODE_LABEL_NUMBER to -1,
+ otherwise there would be code generation differences
+ in between -g and -g0. */
+ if (NOTE_P (insn) && NOTE_KIND (insn) == NOTE_INSN_DELETED_DEBUG_LABEL)
+ deleted_debug_label = insn;
+ insn = PREV_INSN (insn);
+ }
if (insn
&& (LABEL_P (insn)
|| (NOTE_P (insn)
&& NOTE_KIND (insn) == NOTE_INSN_DELETED_LABEL)))
fputs ("\tnop\n", file);
+ else if (deleted_debug_label)
+ for (insn = deleted_debug_label; insn; insn = NEXT_INSN (insn))
+ if (NOTE_KIND (insn) == NOTE_INSN_DELETED_DEBUG_LABEL)
+ CODE_LABEL_NUMBER (insn) = -1;
}
#endif
@@ -25070,7 +25084,7 @@ macho_branch_islands (void)
if (TARGET_LINK_STACK)
{
char name[32];
- get_ppc64_thunk_name (name);
+ get_ppc476_thunk_name (name);
strcat (tmp_buf, ":\n\tmflr r0\n\tbl ");
strcat (tmp_buf, name);
strcat (tmp_buf, "\n");
@@ -27948,6 +27962,12 @@ rs6000_save_toc_in_prologue_p (void)
return (cfun && cfun->machine && cfun->machine->save_toc_in_prologue);
}
+#ifdef HAVE_GAS_HIDDEN
+# define USE_HIDDEN_LINKONCE 1
+#else
+# define USE_HIDDEN_LINKONCE 0
+#endif
+
/* Fills in the label name that should be used for a 476 link stack thunk. */
void
@@ -27955,7 +27975,7 @@ get_ppc476_thunk_name (char name[32])
{
gcc_assert (TARGET_LINK_STACK);
- if (HAVE_GAS_HIDDEN)
+ if (USE_HIDDEN_LINKONCE)
sprintf (name, "__ppc476.get_thunk");
else
ASM_GENERATE_INTERNAL_LABEL (name, "LPPC476_", 0);
@@ -27982,7 +28002,7 @@ rs6000_code_end (void)
TREE_PUBLIC (decl) = 1;
TREE_STATIC (decl) = 1;
- if (HAVE_GAS_HIDDEN)
+ if (USE_HIDDEN_LINKONCE)
{
DECL_COMDAT_GROUP (decl) = DECL_ASSEMBLER_NAME (decl);
targetm.asm_out.unique_section (decl, 0);
diff --git a/gcc/config/rs6000/rtems.h b/gcc/config/rs6000/rtems.h
index a8bd0e75fa2..7ffdd3e4831 100644
--- a/gcc/config/rs6000/rtems.h
+++ b/gcc/config/rs6000/rtems.h
@@ -49,8 +49,23 @@
%{mcpu=604: %{!Dppc*: %{!Dmpc*: -Dmpc604} } } \
%{mcpu=750: %{!Dppc*: %{!Dmpc*: -Dmpc750} } } \
%{mcpu=821: %{!Dppc*: %{!Dmpc*: -Dmpc821} } } \
-%{mcpu=860: %{!Dppc*: %{!Dmpc*: -Dmpc860} } }"
+%{mcpu=860: %{!Dppc*: %{!Dmpc*: -Dmpc860} } } \
+%{mcpu=8540: %{!Dppc*: %{!Dmpc*: -Dppc8540} } }"
#undef SUBSUBTARGET_EXTRA_SPECS
#define SUBSUBTARGET_EXTRA_SPECS \
{ "cpp_os_rtems", CPP_OS_RTEMS_SPEC }
+
+#undef SUBSUBTARGET_OVERRIDE_OPTIONS
+#define SUBSUBTARGET_OVERRIDE_OPTIONS \
+ do { \
+ if (TARGET_E500) \
+ { \
+ if (TARGET_HARD_FLOAT && !rs6000_explicit_options.float_gprs) \
+ rs6000_float_gprs = 1; \
+ if (rs6000_float_gprs != 0 && !rs6000_explicit_options.spe) \
+ rs6000_spe = 1; \
+ if (rs6000_spe && !rs6000_explicit_options.spe_abi) \
+ rs6000_spe_abi = 1; \
+ } \
+ } while(0)
diff --git a/gcc/config/rs6000/sol-ci.asm b/gcc/config/rs6000/sol-ci.asm
deleted file mode 100644
index 7c2fbae9747..00000000000
--- a/gcc/config/rs6000/sol-ci.asm
+++ /dev/null
@@ -1,94 +0,0 @@
-# crti.s for sysv4
-
-# Copyright (C) 1996, 2008, 2009 Free Software Foundation, Inc.
-# Written By Michael Meissner
-#
-# This file is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the
-# Free Software Foundation; either version 3, or (at your option) any
-# later version.
-#
-# This file 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/>.
-
-# This file just supplies labeled starting points for the .got* and other
-# special sections. It is linked in first before other modules.
-
- .ident "GNU C scrti.s"
-
-#ifndef __powerpc64__
-# Start of .text
- .section ".text"
- .globl _ex_text0
-_ex_text0:
-
-# Exception range
- .section ".exception_ranges","aw"
- .globl _ex_range0
-_ex_range0:
-
-# List of C++ constructors
- .section ".ctors","aw"
- .globl __CTOR_LIST__
- .type __CTOR_LIST__,@object
-__CTOR_LIST__:
-
-# List of C++ destructors
- .section ".dtors","aw"
- .globl __DTOR_LIST__
- .type __DTOR_LIST__,@object
-__DTOR_LIST__:
-
-# Head of _init function used for static constructors
- .section ".init","ax"
- .align 2
- .globl _init
- .type _init,@function
-_init: stwu %r1,-16(%r1)
- mflr %r0
- stw %r31,12(%r1)
- stw %r0,16(%r1)
-
- bl _GLOBAL_OFFSET_TABLE_-4 # get the GOT address
- mflr %r31
-
-# lwz %r3,_ex_shared0@got(%r31)
-# lwz %r4,-8(%r3) # _ex_register or 0
-# cmpi %cr0,%r4,0
-# beq .Lno_reg
-# mtlr %r4
-# blrl
-#.Lno_reg:
-
-# Head of _fini function used for static destructors
- .section ".fini","ax"
- .align 2
- .globl _fini
- .type _fini,@function
-_fini: stwu %r1,-16(%r1)
- mflr %r0
- stw %r31,12(%r1)
- stw %r0,16(%r1)
-
- bl _GLOBAL_OFFSET_TABLE_-4 # get the GOT address
- mflr %r31
-
-# _environ and its evil twin environ, pointing to the environment
- .section ".sdata","aw"
- .align 2
- .globl _environ
- .space 4
- .weak environ
- .set environ,_environ
-#endif
diff --git a/gcc/config/rs6000/sol-cn.asm b/gcc/config/rs6000/sol-cn.asm
deleted file mode 100644
index 4aeacaf2cff..00000000000
--- a/gcc/config/rs6000/sol-cn.asm
+++ /dev/null
@@ -1,72 +0,0 @@
-# crtn.s for sysv4
-
-# Copyright (C) 1996, 2007, 2008, 2009 Free Software Foundation, Inc.
-# Written By Michael Meissner
-#
-# This file is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the
-# Free Software Foundation; either version 3, or (at your option) any
-# later version.
-#
-# This file 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/>.
-
-# This file just supplies labeled ending points for the .got* and other
-# special sections. It is linked in last after other modules.
-
- .ident "GNU C scrtn.s"
-
-#ifndef __powerpc64__
-# Default versions of exception handling register/deregister
- .weak _ex_register
- .weak _ex_deregister
- .set _ex_register,0
- .set _ex_deregister,0
-
-# End list of C++ constructors
- .section ".ctors","aw"
- .globl __CTOR_END__
- .type __CTOR_END__,@object
-__CTOR_END__:
-
-# End list of C++ destructors
- .section ".dtors","aw"
- .weak __DTOR_END__
- .type __DTOR_END__,@object
-__DTOR_END__:
-
- .section ".text"
- .globl _ex_text1
-_ex_text1:
-
- .section ".exception_ranges","aw"
- .globl _ex_range1
-_ex_range1:
-
-# Tail of _init used for static constructors
- .section ".init","ax"
- lwz %r0,16(%r1)
- lwz %r31,12(%r1)
- mtlr %r0
- addi %r1,%r1,16
- blr
-
-# Tail of _fini used for static destructors
- .section ".fini","ax"
- lwz %r0,16(%r1)
- lwz %r31,12(%r1)
- mtlr %r0
- addi %r1,%r1,16
- blr
-#endif
diff --git a/gcc/config/rs6000/t-aix43 b/gcc/config/rs6000/t-aix43
index 374b98dfa93..97ce70ecca3 100644
--- a/gcc/config/rs6000/t-aix43
+++ b/gcc/config/rs6000/t-aix43
@@ -44,35 +44,3 @@ MULTILIB_MATCHES = mcpu?power=mcpu?power \
mcpu?powerpc=mcpu?604e \
mcpu?powerpc=mcpu?620 \
mcpu?powerpc=mcpu?630
-
-LIBGCC = stmp-multilib
-INSTALL_LIBGCC = install-multilib
-
-# Build a shared libgcc library.
-SHLIB_EXT = .a
-SHLIB_LINK = $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) -shared -nodefaultlibs \
- -Wl,-bE:@shlib_map_file@ -o @multilib_dir@/shr.o \
- @multilib_flags@ @shlib_objs@ -lc \
- `case @multilib_dir@ in \
- *pthread*) echo -L/usr/lib/threads -lpthreads -lc_r /usr/lib/libc.a ;; \
- *) echo -lc ;; esac` ; \
- rm -f @multilib_dir@/tmp-@shlib_base_name@.a ; \
- $(AR_CREATE_FOR_TARGET) @multilib_dir@/tmp-@shlib_base_name@.a \
- @multilib_dir@/shr.o ; \
- mv @multilib_dir@/tmp-@shlib_base_name@.a \
- @multilib_dir@/@shlib_base_name@.a ; \
- rm -f @multilib_dir@/shr.o
-# $(slibdir) double quoted to protect it from expansion while building
-# libgcc.mk. We want this delayed until actual install time.
-SHLIB_INSTALL = \
- $$(mkinstalldirs) $$(DESTDIR)$$(slibdir)@shlib_slibdir_qual@; \
- $(INSTALL_DATA) @multilib_dir@/@shlib_base_name@.a \
- $$(DESTDIR)$$(slibdir)@shlib_slibdir_qual@/
-SHLIB_LIBS = -lc `case @multilib_dir@ in *pthread*) echo -lpthread ;; esac`
-SHLIB_MKMAP = $(srcdir)/mkmap-flat.awk
-SHLIB_MAPFILES = $$(libgcc_objdir)/libgcc-std.ver
-SHLIB_NM_FLAGS = -Bpg -X32_64
-
-# Either 32-bit and 64-bit objects in archives.
-AR_FLAGS_FOR_TARGET = -X32_64
-
diff --git a/gcc/config/rs6000/t-aix52 b/gcc/config/rs6000/t-aix52
index 79ef16fd84e..f3bf78d3630 100644
--- a/gcc/config/rs6000/t-aix52
+++ b/gcc/config/rs6000/t-aix52
@@ -25,34 +25,3 @@ MULTILIB_OPTIONS = pthread maix64
MULTILIB_DIRNAMES = pthread ppc64
MULTILIB_MATCHES =
-
-LIBGCC = stmp-multilib
-INSTALL_LIBGCC = install-multilib
-
-# Build a shared libgcc library.
-SHLIB_EXT = .a
-SHLIB_LINK = $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) -shared -nodefaultlibs \
- -Wl,-bE:@shlib_map_file@ -o @multilib_dir@/shr.o \
- @multilib_flags@ @shlib_objs@ -lc \
- `case @multilib_dir@ in \
- *pthread*) echo -L$(TARGET_SYSTEM_ROOT)/usr/lib/threads -lpthreads -lc_r $(TARGET_SYSTEM_ROOT)/usr/lib/libc.a ;; \
- *) echo -lc ;; esac` ; \
- rm -f @multilib_dir@/tmp-@shlib_base_name@.a ; \
- $(AR_CREATE_FOR_TARGET) @multilib_dir@/tmp-@shlib_base_name@.a \
- @multilib_dir@/shr.o ; \
- mv @multilib_dir@/tmp-@shlib_base_name@.a \
- @multilib_dir@/@shlib_base_name@.a ; \
- rm -f @multilib_dir@/shr.o
-# $(slibdir) double quoted to protect it from expansion while building
-# libgcc.mk. We want this delayed until actual install time.
-SHLIB_INSTALL = \
- $$(mkinstalldirs) $$(DESTDIR)$$(slibdir)@shlib_slibdir_qual@; \
- $(INSTALL_DATA) @multilib_dir@/@shlib_base_name@.a \
- $$(DESTDIR)$$(slibdir)@shlib_slibdir_qual@/
-SHLIB_LIBS = -lc `case @multilib_dir@ in *pthread*) echo -lpthread ;; esac`
-SHLIB_MKMAP = $(srcdir)/mkmap-flat.awk
-SHLIB_MAPFILES = $$(libgcc_objdir)/libgcc-std.ver
-SHLIB_NM_FLAGS = -Bpg -X32_64
-
-# Either 32-bit and 64-bit objects in archives.
-AR_FLAGS_FOR_TARGET = -X32_64
diff --git a/gcc/config/rs6000/t-darwin b/gcc/config/rs6000/t-darwin
deleted file mode 100644
index bedd9e6ff9c..00000000000
--- a/gcc/config/rs6000/t-darwin
+++ /dev/null
@@ -1,39 +0,0 @@
-# Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006,
-# 2007, 2011 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/>.
-
-LIB2FUNCS_EXTRA = $(srcdir)/config/rs6000/darwin-tramp.asm \
- $(srcdir)/config/darwin-64.c \
- $(srcdir)/config/rs6000/darwin-fpsave.asm \
- $(srcdir)/config/rs6000/darwin-gpsave.asm \
- $(srcdir)/config/rs6000/darwin-world.asm
-
-LIB2FUNCS_STATIC_EXTRA = \
- $(srcdir)/config/rs6000/darwin-vecsave.asm
-
-# The .asm files above are designed to run on all processors, even though
-# they use AltiVec instructions.
-# -Wa is used because -force_cpusubtype_ALL doesn't work with -dynamiclib.
-# -mmacosx-version-min=10.4 is used to provide compatibility for code from
-# earlier OSX versions.
-
-TARGET_LIBGCC2_CFLAGS += -Wa,-force_cpusubtype_ALL -mmacosx-version-min=10.4
-
-darwin-fpsave.o: $(srcdir)/config/rs6000/darwin-asm.h
-darwin-gpsave.o: $(srcdir)/config/rs6000/darwin-asm.h
-darwin-tramp.o: $(srcdir)/config/rs6000/darwin-asm.h
diff --git a/gcc/config/rs6000/t-darwin64 b/gcc/config/rs6000/t-darwin64
index 4c50b243873..b0a04c7d89d 100644
--- a/gcc/config/rs6000/t-darwin64
+++ b/gcc/config/rs6000/t-darwin64
@@ -1,11 +1,2 @@
-LIB2_SIDITI_CONV_FUNCS=yes
-
-LIB2FUNCS_EXTRA = $(srcdir)/config/rs6000/darwin-tramp.asm \
- $(srcdir)/config/darwin-64.c \
- $(srcdir)/config/rs6000/darwin-world.asm
-
MULTILIB_OPTIONS = m32
MULTILIB_DIRNAMES = ppc
-
-#LIBGCC = stmp-multilib
-#INSTALL_LIBGCC = install-multilib
diff --git a/gcc/config/rs6000/t-fprules b/gcc/config/rs6000/t-fprules
index 42d8fd77b5b..913bbbdae69 100644
--- a/gcc/config/rs6000/t-fprules
+++ b/gcc/config/rs6000/t-fprules
@@ -1,4 +1,4 @@
-# Copyright (C) 2002, 2005, 2006, 2008 Free Software Foundation, Inc.
+# Copyright (C) 2002, 2005, 2006, 2008, 2011 Free Software Foundation, Inc.
#
# This file is part of GCC.
#
@@ -33,6 +33,3 @@ MULTILIB_MATCHES_FLOAT = msoft-float=mcpu?401 \
MULTILIB_OPTIONS = msoft-float
MULTILIB_DIRNAMES = soft-float
MULTILIB_MATCHES = ${MULTILIB_MATCHES_FLOAT}
-
-LIBGCC = stmp-multilib
-INSTALL_LIBGCC = install-multilib
diff --git a/gcc/config/rs6000/t-linux64 b/gcc/config/rs6000/t-linux64
index bd01d319212..6420431214d 100644
--- a/gcc/config/rs6000/t-linux64
+++ b/gcc/config/rs6000/t-linux64
@@ -19,8 +19,6 @@
# along with GCC; see the file COPYING3. If not see
# <http://www.gnu.org/licenses/>.
-TARGET_LIBGCC2_CFLAGS += -mno-minimal-toc
-
# On Debian, Ubuntu and other derivative distributions, the 32bit libraries
# are found in /lib32 and /usr/lib32, /lib64 and /usr/lib64 are symlinks to
# /lib and /usr/lib, while other distributions install libraries into /lib64
diff --git a/gcc/config/rs6000/t-lynx b/gcc/config/rs6000/t-lynx
index 768856e06eb..fdc5b56daed 100644
--- a/gcc/config/rs6000/t-lynx
+++ b/gcc/config/rs6000/t-lynx
@@ -16,14 +16,6 @@
# along with GCC; see the file COPYING3. If not see
# <http://www.gnu.org/licenses/>.
-LIB2FUNCS_EXTRA = tramp.S
-
-tramp.S: $(srcdir)/config/rs6000/tramp.asm
- cat $(srcdir)/config/rs6000/tramp.asm > tramp.S
-
-LIBGCC = stmp-multilib
-INSTALL_LIBGCC = install-multilib
-
MULTILIB_OPTIONS += msoft-float
MULTILIB_DIRNAMES += soft-float
@@ -32,15 +24,6 @@ MULTILIB_DIRNAMES += altivec
MULTILIB_EXCEPTIONS = *msoft-float/*maltivec*
-EXTRA_MULTILIB_PARTS = crtbegin.o crtend.o
-
-# If .sdata is enabled __CTOR_{LIST,END}__ go into .sdata instead of
-# .ctors.
-CRTSTUFF_T_CFLAGS = -mno-sdata
-
-# Compile crtbeginS.o and crtendS.o with pic.
-CRTSTUFF_T_CFLAGS_S = -fPIC -mno-sdata
-
Local Variables:
mode: makefile
End:
diff --git a/gcc/config/rs6000/t-netbsd b/gcc/config/rs6000/t-netbsd
index bad21beaac6..462f0ce7536 100644
--- a/gcc/config/rs6000/t-netbsd
+++ b/gcc/config/rs6000/t-netbsd
@@ -1,6 +1,6 @@
# Support for NetBSD PowerPC ELF targets (SVR4 ABI).
#
-# Copyright (C) 2002, 2008 Free Software Foundation, Inc.
+# Copyright (C) 2002, 2008, 2011 Free Software Foundation, Inc.
#
# This file is part of GCC.
#
@@ -18,37 +18,6 @@
# along with GCC; see the file COPYING3. If not see
# <http://www.gnu.org/licenses/>.
-LIB2FUNCS_EXTRA = tramp.S
-
-LIB2FUNCS_STATIC_EXTRA = crtsavfpr.S crtresfpr.S \
- crtsavgpr.S crtresgpr.S \
- crtresxfpr.S crtresxgpr.S
-
-tramp.S: $(srcdir)/config/rs6000/tramp.asm
- cat $(srcdir)/config/rs6000/tramp.asm > tramp.S
-
-crtsavfpr.S: $(srcdir)/config/rs6000/crtsavfpr.asm
- cat $(srcdir)/config/rs6000/crtsavfpr.asm >crtsavfpr.S
-
-crtresfpr.S: $(srcdir)/config/rs6000/crtresfpr.asm
- cat $(srcdir)/config/rs6000/crtresfpr.asm >crtresfpr.S
-
-crtsavgpr.S: $(srcdir)/config/rs6000/crtsavgpr.asm
- cat $(srcdir)/config/rs6000/crtsavgpr.asm >crtsavgpr.S
-
-crtresgpr.S: $(srcdir)/config/rs6000/crtresgpr.asm
- cat $(srcdir)/config/rs6000/crtresgpr.asm >crtresgpr.S
-
-crtresxfpr.S: $(srcdir)/config/rs6000/crtresxfpr.asm
- cat $(srcdir)/config/rs6000/crtresxfpr.asm >crtresxfpr.S
-
-crtresxgpr.S: $(srcdir)/config/rs6000/crtresxgpr.asm
- cat $(srcdir)/config/rs6000/crtresxgpr.asm >crtresxgpr.S
-
-# It is important that crtbegin.o, etc., aren't surprised by stuff in .sdata.
-CRTSTUFF_T_CFLAGS += -msdata=none
-CRTSTUFF_T_CFLAGS_S += -msdata=none
-
# Switch synonyms
MULTILIB_MATCHES_FLOAT = msoft-float=mcpu?401 \
msoft-float=mcpu?403 \
@@ -65,26 +34,3 @@ MULTILIB_EXTRA_OPTS = fPIC mstrict-align
MULTILIB_EXCEPTIONS =
MULTILIB_MATCHES = ${MULTILIB_MATCHES_FLOAT}
-
-LIBGCC = stmp-multilib
-INSTALL_LIBGCC = install-multilib
-EXTRA_MULTILIB_PARTS = crtbegin$(objext) crtend$(objext) \
- crtbeginS$(objext) crtendS$(objext) crtbeginT$(objext)
-
-$(T)crtsavfpr$(objext): crtsavfpr.S
- $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -c crtsavfpr.S -o $(T)crtsavfpr$(objext)
-
-$(T)crtresfpr$(objext): crtresfpr.S
- $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -c crtresfpr.S -o $(T)crtresfpr$(objext)
-
-$(T)crtsavgpr$(objext): crtsavgpr.S
- $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -c crtsavgpr.S -o $(T)crtsavgpr$(objext)
-
-$(T)crtresgpr$(objext): crtresgpr.S
- $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -c crtresgpr.S -o $(T)crtresgpr$(objext)
-
-$(T)crtresxfpr$(objext): crtresxfpr.S
- $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -c crtresxfpr.S -o $(T)crtresxfpr$(objext)
-
-$(T)crtresxgpr$(objext): crtresxgpr.S
- $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -c crtresxgpr.S -o $(T)crtresxgpr$(objext)
diff --git a/gcc/config/rs6000/t-ppccomm b/gcc/config/rs6000/t-ppccomm
index b7e07a9b4c9..81ab7effa42 100644
--- a/gcc/config/rs6000/t-ppccomm
+++ b/gcc/config/rs6000/t-ppccomm
@@ -19,57 +19,6 @@
# along with GCC; see the file COPYING3. If not see
# <http://www.gnu.org/licenses/>.
-LIB2FUNCS_EXTRA += tramp.S
-
-# These can't end up in shared libgcc
-LIB2FUNCS_STATIC_EXTRA = eabi.S
-
-eabi.S: $(srcdir)/config/rs6000/eabi.asm
- cat $(srcdir)/config/rs6000/eabi.asm > eabi.S
-
-tramp.S: $(srcdir)/config/rs6000/tramp.asm
- cat $(srcdir)/config/rs6000/tramp.asm > tramp.S
-
# Switch synonyms
MULTILIB_MATCHES_ENDIAN = mlittle=mlittle-endian mbig=mbig-endian
MULTILIB_MATCHES_SYSV = mcall-sysv=mcall-sysv-eabi mcall-sysv=mcall-sysv-noeabi mcall-sysv=mcall-linux mcall-sysv=mcall-netbsd
-
-EXTRA_MULTILIB_PARTS = crtbegin$(objext) crtend$(objext) \
- crtbeginS$(objext) crtendS$(objext) crtbeginT$(objext) \
- ecrti$(objext) ecrtn$(objext) \
- ncrti$(objext) ncrtn$(objext)
-
-# We build {e,n}crti.o and {e,n}crtn.o, which serve to add begin and
-# end labels to all of the special sections used when we link using gcc.
-
-# Assemble startup files.
-ecrti.S: $(srcdir)/config/rs6000/eabi-ci.asm
- cat $(srcdir)/config/rs6000/eabi-ci.asm >ecrti.S
-
-ecrtn.S: $(srcdir)/config/rs6000/eabi-cn.asm
- cat $(srcdir)/config/rs6000/eabi-cn.asm >ecrtn.S
-
-ncrti.S: $(srcdir)/config/rs6000/sol-ci.asm
- cat $(srcdir)/config/rs6000/sol-ci.asm >ncrti.S
-
-ncrtn.S: $(srcdir)/config/rs6000/sol-cn.asm
- cat $(srcdir)/config/rs6000/sol-cn.asm >ncrtn.S
-
-# Build multiple copies of ?crt{i,n}.o, one for each target switch.
-$(T)ecrti$(objext): ecrti.S
- $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -c ecrti.S -o $(T)ecrti$(objext)
-
-$(T)ecrtn$(objext): ecrtn.S
- $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -c ecrtn.S -o $(T)ecrtn$(objext)
-
-$(T)ncrti$(objext): ncrti.S
- $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -c ncrti.S -o $(T)ncrti$(objext)
-
-$(T)ncrtn$(objext): ncrtn.S
- $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -c ncrtn.S -o $(T)ncrtn$(objext)
-
-# It is important that crtbegin.o, etc., aren't surprised by stuff in .sdata.
-CRTSTUFF_T_CFLAGS = -msdata=none
-# Make sure crt*.o are built with -fPIC even if configured with
-# --enable-shared --disable-multilib
-CRTSTUFF_T_CFLAGS_S = -fPIC -msdata=none
diff --git a/gcc/config/rs6000/t-rtems b/gcc/config/rs6000/t-rtems
index cad98c51cab..74465b74adb 100644
--- a/gcc/config/rs6000/t-rtems
+++ b/gcc/config/rs6000/t-rtems
@@ -19,14 +19,12 @@
# <http://www.gnu.org/licenses/>.
MULTILIB_OPTIONS = \
-mcpu=403/mcpu=505/mcpu=601/mcpu=603e/mcpu=604/mcpu=860/mcpu=7400 \
-Dmpc8260 \
-msoft-float
+mcpu=403/mcpu=505/mcpu=603e/mcpu=604/mcpu=860/mcpu=7400/mcpu=8540 \
+msoft-float/mfloat-gprs=double
MULTILIB_DIRNAMES = \
-m403 m505 m601 m603e m604 m860 m7400 \
-mpc8260 \
-nof
+m403 m505 m603e m604 m860 m7400 m8540 \
+nof gprsdouble
# MULTILIB_MATCHES = ${MULTILIB_MATCHES_FLOAT}
MULTILIB_MATCHES =
@@ -47,6 +45,13 @@ MULTILIB_MATCHES += mcpu?7400=mcpu?7450
# Map 750 to .
MULTILIB_MATCHES += mcpu?750=
+# Map 8548 to 8540
+MULTILIB_MATCHES += mcpu?8540=mcpu?8548
+
+# Map -mcpu=8540 -mfloat-gprs=single to -mcpu=8540
+# (mfloat-gprs=single is implicit default)
+MULTILIB_MATCHES += mcpu?8540=mcpu?8540/mfloat-gprs?single
+
# Soft-float only, default implies msoft-float
# NOTE: Must match with MULTILIB_MATCHES_FLOAT and MULTILIB_MATCHES
MULTILIB_SOFTFLOAT_ONLY = \
@@ -62,6 +67,16 @@ MULTILIB_SOFTFLOAT_ONLY = \
MULTILIB_HARDFLOAT_ONLY = \
*mcpu=505/*msoft-float*
+# Targets which do not support gprs
+MULTILIB_NOGPRS = \
+mfloat-gprs=* \
+*mcpu=403/*mfloat-gprs=* \
+*mcpu=505/*mfloat-gprs=* \
+*mcpu=603e/*mfloat-gprs=* \
+*mcpu=604/*mfloat-gprs=* \
+*mcpu=860/*mfloat-gprs=* \
+*mcpu=7400/*mfloat-gprs=*
+
MULTILIB_EXCEPTIONS =
# Disallow -Dppc and -Dmpc without other options
@@ -69,14 +84,5 @@ MULTILIB_EXCEPTIONS += Dppc* Dmpc*
MULTILIB_EXCEPTIONS += \
${MULTILIB_SOFTFLOAT_ONLY} \
-${MULTILIB_HARDFLOAT_ONLY}
-
-# Special rules
-# Take out all variants we don't want
-MULTILIB_EXCEPTIONS += *mcpu=403/Dmpc*
-MULTILIB_EXCEPTIONS += *mcpu=505/Dmpc*
-MULTILIB_EXCEPTIONS += *mcpu=601/Dmpc*
-MULTILIB_EXCEPTIONS += *mcpu=604/Dmpc*
-MULTILIB_EXCEPTIONS += *mcpu=750/Dmpc*
-MULTILIB_EXCEPTIONS += *mcpu=860/Dmpc*
-MULTILIB_EXCEPTIONS += *mcpu=7400/Dmpc*
+${MULTILIB_HARDFLOAT_ONLY} \
+${MULTILIB_NOGPRS}
diff --git a/gcc/config/rs6000/t-spe b/gcc/config/rs6000/t-spe
index cbbac79f661..1bed1e32b0e 100644
--- a/gcc/config/rs6000/t-spe
+++ b/gcc/config/rs6000/t-spe
@@ -18,9 +18,6 @@
# along with GCC; see the file COPYING3. If not see
# <http://www.gnu.org/licenses/>.
-LIBGCC = stmp-multilib
-INSTALL_LIBGCC = install-multilib
-
# What we really want are these variants:
# -mcpu=7400
# -mcpu=7400 -maltivec -mabi=altivec
diff --git a/gcc/config/rs6000/t-vxworks b/gcc/config/rs6000/t-vxworks
index 8a3d394ed77..c0128ed845f 100644
--- a/gcc/config/rs6000/t-vxworks
+++ b/gcc/config/rs6000/t-vxworks
@@ -1,6 +1,6 @@
# Multilibs for VxWorks.
#
-# Copyright (C) 2002, 2005, 2006 Free Software Foundation, Inc.
+# Copyright (C) 2002, 2005, 2006, 2011 Free Software Foundation, Inc.
#
# This file is part of GCC.
#
@@ -23,12 +23,3 @@ MULTILIB_OPTIONS = mrtp fPIC msoft-float
MULTILIB_DIRNAMES =
MULTILIB_MATCHES = fPIC=fpic
MULTILIB_EXCEPTIONS = fPIC*
-
-# This is set from the common config/t-vxworks but clobbered by t-ppccomm
-# on this target.
-EXTRA_MULTILIB_PARTS =
-
-# Similarily, LIB2FUNCS_EXTRA is set from config/t-vxworks and
-# t-ppccomm *adds* to it, but the common contents are useful to us.
-# In particular the base trampoline_setup bits are expected to be
-# provided there.
diff --git a/gcc/config/rs6000/tramp.asm b/gcc/config/rs6000/tramp.asm
deleted file mode 100644
index 133b98840f1..00000000000
--- a/gcc/config/rs6000/tramp.asm
+++ /dev/null
@@ -1,107 +0,0 @@
-/* Special support for trampolines
- *
- * Copyright (C) 1996, 1997, 2000, 2007, 2008, 2009 Free Software Foundation, Inc.
- * Written By Michael Meissner
- *
- * This file is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 3, or (at your option) any
- * later version.
- *
- * This file 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/>.
- */
-
-/* Set up trampolines. */
-
- .section ".text"
-#include "ppc-asm.h"
-#include "config.h"
-
-#ifndef __powerpc64__
- .type trampoline_initial,@object
- .align 2
-trampoline_initial:
- mflr r0
- bcl 20,31,1f
-.Lfunc = .-trampoline_initial
- .long 0 /* will be replaced with function address */
-.Lchain = .-trampoline_initial
- .long 0 /* will be replaced with static chain */
-1: mflr r11
- mtlr r0
- lwz r0,0(r11) /* function address */
- lwz r11,4(r11) /* static chain */
- mtctr r0
- bctr
-
-trampoline_size = .-trampoline_initial
- .size trampoline_initial,trampoline_size
-
-
-/* R3 = stack address to store trampoline */
-/* R4 = length of trampoline area */
-/* R5 = function address */
-/* R6 = static chain */
-
-FUNC_START(__trampoline_setup)
- mflr r0 /* save return address */
- bcl 20,31,.LCF0 /* load up __trampoline_initial into r7 */
-.LCF0:
- mflr r11
- addi r7,r11,trampoline_initial-4-.LCF0 /* trampoline address -4 */
-
- li r8,trampoline_size /* verify that the trampoline is big enough */
- cmpw cr1,r8,r4
- srwi r4,r4,2 /* # words to move */
- addi r9,r3,-4 /* adjust pointer for lwzu */
- mtctr r4
- blt cr1,.Labort
-
- mtlr r0
-
- /* Copy the instructions to the stack */
-.Lmove:
- lwzu r10,4(r7)
- stwu r10,4(r9)
- bdnz .Lmove
-
- /* Store correct function and static chain */
- stw r5,.Lfunc(r3)
- stw r6,.Lchain(r3)
-
- /* Now flush both caches */
- mtctr r4
-.Lcache:
- icbi 0,r3
- dcbf 0,r3
- addi r3,r3,4
- bdnz .Lcache
-
- /* Finally synchronize things & return */
- sync
- isync
- blr
-
-.Labort:
-#if (defined __PIC__ || defined __pic__) && defined HAVE_AS_REL16
- bcl 20,31,1f
-1: mflr r30
- addis r30,r30,_GLOBAL_OFFSET_TABLE_-1b@ha
- addi r30,r30,_GLOBAL_OFFSET_TABLE_-1b@l
-#endif
- bl JUMP_TARGET(abort)
-FUNC_END(__trampoline_setup)
-
-#endif
diff --git a/gcc/config/rx/t-rx b/gcc/config/rx/t-rx
index ad667bcc5c9..9a5dca9056a 100644
--- a/gcc/config/rx/t-rx
+++ b/gcc/config/rx/t-rx
@@ -27,8 +27,3 @@ MULTILIB_MATCHES = nofpu=mnofpu nofpu=mcpu?rx200
MULTILIB_EXCEPTIONS =
MULTILIB_EXTRA_OPTS =
-
-LIBGCC = stmp-multilib
-INSTALL_LIBGCC = install-multilib
-
-EXTRA_MULTILIB_PARTS = crtbegin.o crtend.o
diff --git a/gcc/config/score/crti.asm b/gcc/config/score/crti.asm
deleted file mode 100644
index 4cd00cf9914..00000000000
--- a/gcc/config/score/crti.asm
+++ /dev/null
@@ -1,131 +0,0 @@
-# crti.asm for Sunplus S+CORE
-#
-# Copyright (C) 2005, 2009, 2010 Free Software Foundation, Inc.
-#
-# This file is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the
-# Free Software Foundation; either version 3, or (at your option) any
-# later version.
-#
-# This file 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/>.
-
-# This file makes a stack frame for the contents of the .init and
-# .fini sections.
-.extern _stack
-
-#ifndef __pic__
-.section .init, "ax", @progbits
- .weak _start
- .ent _start
- .frame r0, 0, r3, 0
- .mask 0x00000000, 0
-_start:
- la r28, _gp
- la r8, __bss_start
- la r9, __bss_end__
- sub! r9, r8
- srli! r9, 2
- addi r9, -1
- mtsr r9, sr0
- li r9, 0
-1:
- sw r9, [r8]+, 4
- bcnz 1b
- la r0, _stack
- jl _init
- la r4, _end
- jl _init_argv
- jl exit
- .end _start
-
- .weak _init_argv
- .ent
- .frame r0, 0, r3, 0
- .mask 0x00000000, 0
-_init_argv:
- ldiu! r4, 0
- ldiu! r5, 0
- j main
- .end _init_argv
-
- .globl _init
- .type _init, %function
-_init:
- addi r0, -32
- sw r3, [r0, 20]
-
- .section .fini, "ax", @progbits
- .globl _fini
- .type _fini, %function
-_fini:
- addi r0, -32
- sw r3, [r0, 20]
-#else
-.section .init, "ax", @progbits
- .set pic
- .weak _start
- .ent _start
- .frame r0, 0, r3, 0
- .mask 0x00000000, 0
-_start:
- mv r29, r3
- bl 0f
-0:
- .cpload r3
- mv r3, r29
- la r8, __bss_start
- la r9, __bss_end__
- sub! r9, r8
- srli! r9, 2
- addi r9, -1
- mtsr r9, sr0
- li r9, 0
-1:
- sw r9, [r8]+, 4
- bcnz 1b
- la r0, _stack
- bl _init
- la r4, _end
- la r29, _init_argv
- brl r29
- la r29, exit
- brl r29
- .end _start
-
- .weak _init_argv
- .ent _init_argv
- .frame r0, 0, r3, 0
- .mask 0x00000000, 0
-_init_argv:
- ldiu! r4, 0
- ldiu! r5, 0
- la r29, main
- brl r29
- .end _init_argv
-
- .globl _init
- .type _init, %function
-_init:
- addi r0, -32
- sw r3, [r0, 20]
-
- .section .fini, "ax", @progbits
- .globl _fini
- .type _fini, %function
-_fini:
- addi r0, -32
- sw r3, [r0, 20]
-
-#endif
diff --git a/gcc/config/score/crtn.asm b/gcc/config/score/crtn.asm
deleted file mode 100644
index 8132388a0c7..00000000000
--- a/gcc/config/score/crtn.asm
+++ /dev/null
@@ -1,50 +0,0 @@
-# crtn.asm for Sunplus S+CORE
-
-# Copyright (C) 2005, 2009, 2010 Free Software Foundation, Inc.
-#
-# This file is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the
-# Free Software Foundation; either version 3, or (at your option) any
-# later version.
-#
-# This file 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/>.
-
-# This file makes sure that the .init and .fini sections do in
-# fact return.
-
-#ifndef __pic__
-.section .init, "ax", @progbits
- lw r3, [r0, 20]
- addi r0, 32
- br r3
-
-.section .fini, "ax", @progbits
- lw r3, [r0, 20]
- addi r0, 32
- br r3
-#else
- .set pic
-.section .init, "ax", @progbits
- lw r3, [r0, 20]
- addi r0, 32
- br r3
-
- .set pic
-.section .fini, "ax", @progbits
- lw r3, [r0, 20]
- addi r0, 32
- br r3
-#endif
-
diff --git a/gcc/config/score/t-score-elf b/gcc/config/score/t-score-elf
deleted file mode 100644
index fd080c1b1fe..00000000000
--- a/gcc/config/score/t-score-elf
+++ /dev/null
@@ -1,26 +0,0 @@
-# Copyright (C) 2006, 2007, 2008, 2009, 2010 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/>.
-
-# Assemble startup files.
-$(T)crti.o: $(srcdir)/config/score/crti.asm $(GCC_PASSES)
- $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(MULTILIB_CFLAGS) $(INCLUDES) \
- -c -o $(T)crti.o -x assembler-with-cpp $(srcdir)/config/score/crti.asm
-
-$(T)crtn.o: $(srcdir)/config/score/crtn.asm $(GCC_PASSES)
- $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(MULTILIB_CFLAGS) $(INCLUDES) \
- -c -o $(T)crtn.o -x assembler-with-cpp $(srcdir)/config/score/crtn.asm
diff --git a/gcc/config/sh/crt1.asm b/gcc/config/sh/crt1.asm
deleted file mode 100644
index e2857904f86..00000000000
--- a/gcc/config/sh/crt1.asm
+++ /dev/null
@@ -1,1369 +0,0 @@
-/* Copyright (C) 2000, 2001, 2003, 2004, 2005, 2006, 2009
- Free Software Foundation, Inc.
- This file was pretty much copied from newlib.
-
-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/>. */
-
-
-#ifdef MMU_SUPPORT
- /* Section used for exception/timer interrupt stack area */
- .section .data.vbr.stack,"aw"
- .align 4
- .global __ST_VBR
-__ST_VBR:
- .zero 1024 * 2 /* ; 2k for VBR handlers */
-/* Label at the highest stack address where the stack grows from */
-__timer_stack:
-#endif /* MMU_SUPPORT */
-
- /* ;----------------------------------------
- Normal newlib crt1.asm */
-
-#ifdef __SH5__
- .section .data,"aw"
- .global ___data
-___data:
-
- .section .rodata,"a"
- .global ___rodata
-___rodata:
-
-#define ICCR_BASE 0x01600000
-#define OCCR_BASE 0x01e00000
-#define MMUIR_BASE 0x00000000
-#define MMUDR_BASE 0x00800000
-
-#define PTE_ENABLED 1
-#define PTE_DISABLED 0
-
-#define PTE_SHARED (1 << 1)
-#define PTE_NOT_SHARED 0
-
-#define PTE_CB_UNCACHEABLE 0
-#define PTE_CB_DEVICE 1
-#define PTE_CB_CACHEABLE_WB 2
-#define PTE_CB_CACHEABLE_WT 3
-
-#define PTE_SZ_4KB (0 << 3)
-#define PTE_SZ_64KB (1 << 3)
-#define PTE_SZ_1MB (2 << 3)
-#define PTE_SZ_512MB (3 << 3)
-
-#define PTE_PRR (1 << 6)
-#define PTE_PRX (1 << 7)
-#define PTE_PRW (1 << 8)
-#define PTE_PRU (1 << 9)
-
-#define SR_MMU_BIT 31
-#define SR_BL_BIT 28
-
-#define ALIGN_4KB (0xfff)
-#define ALIGN_1MB (0xfffff)
-#define ALIGN_512MB (0x1fffffff)
-
-#define DYNACON_BASE 0x0f000000
-#define DM_CB_DLINK_BASE 0x0c000000
-#define DM_DB_DLINK_BASE 0x0b000000
-
-#define FEMI_AREA_0 0x00000000
-#define FEMI_AREA_1 0x04000000
-#define FEMI_AREA_2 0x05000000
-#define FEMI_AREA_3 0x06000000
-#define FEMI_AREA_4 0x07000000
-#define FEMI_CB 0x08000000
-
-#define EMI_BASE 0X80000000
-
-#define DMA_BASE 0X0e000000
-
-#define CPU_BASE 0X0d000000
-
-#define PERIPH_BASE 0X09000000
-#define DMAC_BASE 0x0e000000
-#define INTC_BASE 0x0a000000
-#define CPRC_BASE 0x0a010000
-#define TMU_BASE 0x0a020000
-#define SCIF_BASE 0x0a030000
-#define RTC_BASE 0x0a040000
-
-
-
-#define LOAD_CONST32(val, reg) \
- movi ((val) >> 16) & 65535, reg; \
- shori (val) & 65535, reg
-
-#define LOAD_PTEH_VAL(sym, align, bits, scratch_reg, reg) \
- LOAD_ADDR (sym, reg); \
- LOAD_CONST32 ((align), scratch_reg); \
- andc reg, scratch_reg, reg; \
- LOAD_CONST32 ((bits), scratch_reg); \
- or reg, scratch_reg, reg
-
-#define LOAD_PTEL_VAL(sym, align, bits, scratch_reg, reg) \
- LOAD_ADDR (sym, reg); \
- LOAD_CONST32 ((align), scratch_reg); \
- andc reg, scratch_reg, reg; \
- LOAD_CONST32 ((bits), scratch_reg); \
- or reg, scratch_reg, reg
-
-#define SET_PTE(pte_addr_reg, pteh_val_reg, ptel_val_reg) \
- putcfg pte_addr_reg, 0, r63; \
- putcfg pte_addr_reg, 1, ptel_val_reg; \
- putcfg pte_addr_reg, 0, pteh_val_reg
-
-#if __SH5__ == 64
- .section .text,"ax"
-#define LOAD_ADDR(sym, reg) \
- movi (sym >> 48) & 65535, reg; \
- shori (sym >> 32) & 65535, reg; \
- shori (sym >> 16) & 65535, reg; \
- shori sym & 65535, reg
-#else
- .mode SHmedia
- .section .text..SHmedia32,"ax"
-#define LOAD_ADDR(sym, reg) \
- movi (sym >> 16) & 65535, reg; \
- shori sym & 65535, reg
-#endif
- .global start
-start:
- LOAD_ADDR (_stack, r15)
-
-#ifdef MMU_SUPPORT
- ! Set up the VM using the MMU and caches
-
- ! .vm_ep is first instruction to execute
- ! after VM initialization
- pt/l .vm_ep, tr1
-
- ! Configure instruction cache (ICCR)
- movi 3, r2
- movi 0, r3
- LOAD_ADDR (ICCR_BASE, r1)
- putcfg r1, 0, r2
- putcfg r1, 1, r3
-
- ! movi 7, r2 ! write through
- ! Configure operand cache (OCCR)
- LOAD_ADDR (OCCR_BASE, r1)
- putcfg r1, 0, r2
- putcfg r1, 1, r3
-
- ! Disable all PTE translations
- LOAD_ADDR (MMUIR_BASE, r1)
- LOAD_ADDR (MMUDR_BASE, r2)
- movi 64, r3
- pt/l .disable_ptes_loop, tr0
-.disable_ptes_loop:
- putcfg r1, 0, r63
- putcfg r2, 0, r63
- addi r1, 16, r1
- addi r2, 16, r2
- addi r3, -1, r3
- bgt r3, r63, tr0
-
- LOAD_ADDR (MMUIR_BASE, r1)
-
- ! FEMI instruction mappings
- ! Area 0 - 1Mb cacheable at 0x00000000
- ! Area 1 - None
- ! Area 2 - 1Mb cacheable at 0x05000000
- ! - 1Mb cacheable at 0x05100000
- ! Area 3 - None
- ! Area 4 - None
-
- ! Map a 1Mb page for instructions at 0x00000000
- LOAD_PTEH_VAL (FEMI_AREA_0, ALIGN_1MB, PTE_ENABLED | PTE_NOT_SHARED, r25, r2)
- LOAD_PTEL_VAL (FEMI_AREA_0, ALIGN_1MB, PTE_CB_CACHEABLE_WB | PTE_SZ_1MB | PTE_PRX | PTE_PRU, r25, r3)
- SET_PTE (r1, r2, r3)
-
- ! Map a 1Mb page for instructions at 0x05000000
- addi r1, 16, r1
- LOAD_PTEH_VAL (FEMI_AREA_2, ALIGN_1MB, PTE_ENABLED | PTE_NOT_SHARED, r25, r2)
- LOAD_PTEL_VAL (FEMI_AREA_2, ALIGN_1MB, PTE_CB_CACHEABLE_WB | PTE_SZ_1MB | PTE_PRX | PTE_PRU, r25, r3)
- SET_PTE (r1, r2, r3)
-
- ! Map a 1Mb page for instructions at 0x05100000
- addi r1, 16, r1
- LOAD_PTEH_VAL ((FEMI_AREA_2+0x100000), ALIGN_1MB, PTE_ENABLED | PTE_NOT_SHARED, r25, r2)
- LOAD_PTEL_VAL ((FEMI_AREA_2+0x100000), ALIGN_1MB, PTE_CB_CACHEABLE_WB | PTE_SZ_1MB | PTE_PRX | PTE_PRU, r25, r3)
- SET_PTE (r1, r2, r3)
-
- ! Map a 512M page for instructions at EMI base
- addi r1, 16, r1
- LOAD_PTEH_VAL (EMI_BASE, ALIGN_512MB, PTE_ENABLED | PTE_NOT_SHARED, r25, r2)
- LOAD_PTEL_VAL (EMI_BASE, ALIGN_512MB, PTE_CB_CACHEABLE_WB | PTE_SZ_512MB | PTE_PRX | PTE_PRU, r25, r3)
- SET_PTE (r1, r2, r3)
-
- ! Map a 4K page for instructions at DM_DB_DLINK_BASE
- addi r1, 16, r1
- LOAD_PTEH_VAL (DM_DB_DLINK_BASE, ALIGN_4KB, PTE_ENABLED | PTE_NOT_SHARED, r25, r2)
- LOAD_PTEL_VAL (DM_DB_DLINK_BASE, ALIGN_4KB, PTE_CB_CACHEABLE_WB | PTE_SZ_4KB | PTE_PRX | PTE_PRU, r25, r3)
- SET_PTE (r1, r2, r3)
-
- LOAD_ADDR (MMUDR_BASE, r1)
-
- ! FEMI data mappings
- ! Area 0 - 1Mb cacheable at 0x00000000
- ! Area 1 - 1Mb device at 0x04000000
- ! Area 2 - 1Mb cacheable at 0x05000000
- ! - 1Mb cacheable at 0x05100000
- ! Area 3 - None
- ! Area 4 - None
- ! CB - 1Mb device at 0x08000000
-
- ! Map a 1Mb page for data at 0x00000000
- LOAD_PTEH_VAL (FEMI_AREA_0, ALIGN_1MB, PTE_ENABLED | PTE_NOT_SHARED, r25, r2)
- LOAD_PTEL_VAL (FEMI_AREA_0, ALIGN_1MB, PTE_CB_CACHEABLE_WB | PTE_SZ_1MB | PTE_PRR | PTE_PRW | PTE_PRU, r25, r3)
- SET_PTE (r1, r2, r3)
-
- ! Map a 1Mb page for data at 0x04000000
- addi r1, 16, r1
- LOAD_PTEH_VAL (FEMI_AREA_1, ALIGN_1MB, PTE_ENABLED | PTE_NOT_SHARED, r25, r2)
- LOAD_PTEL_VAL (FEMI_AREA_1, ALIGN_1MB, PTE_CB_DEVICE | PTE_SZ_1MB | PTE_PRR | PTE_PRW | PTE_PRU, r25, r3)
- SET_PTE (r1, r2, r3)
-
- ! Map a 1Mb page for data at 0x05000000
- addi r1, 16, r1
- LOAD_PTEH_VAL (FEMI_AREA_2, ALIGN_1MB, PTE_ENABLED | PTE_NOT_SHARED, r25, r2)
- LOAD_PTEL_VAL (FEMI_AREA_2, ALIGN_1MB, PTE_CB_CACHEABLE_WB | PTE_SZ_1MB | PTE_PRR | PTE_PRW | PTE_PRU, r25, r3)
- SET_PTE (r1, r2, r3)
-
- ! Map a 1Mb page for data at 0x05100000
- addi r1, 16, r1
- LOAD_PTEH_VAL ((FEMI_AREA_2+0x100000), ALIGN_1MB, PTE_ENABLED | PTE_NOT_SHARED, r25, r2)
- LOAD_PTEL_VAL ((FEMI_AREA_2+0x100000), ALIGN_1MB, PTE_CB_CACHEABLE_WB | PTE_SZ_1MB | PTE_PRR | PTE_PRW | PTE_PRU, r25, r3)
- SET_PTE (r1, r2, r3)
-
- ! Map a 4K page for registers at 0x08000000
- addi r1, 16, r1
- LOAD_PTEH_VAL (FEMI_CB, ALIGN_4KB, PTE_ENABLED | PTE_NOT_SHARED, r25, r2)
- LOAD_PTEL_VAL (FEMI_CB, ALIGN_4KB, PTE_CB_DEVICE | PTE_SZ_4KB | PTE_PRR | PTE_PRW | PTE_PRU, r25, r3)
- SET_PTE (r1, r2, r3)
-
- ! Map a 512M page for data at EMI
- addi r1, 16, r1
- LOAD_PTEH_VAL (EMI_BASE, ALIGN_512MB, PTE_ENABLED | PTE_NOT_SHARED, r25, r2)
- LOAD_PTEL_VAL (EMI_BASE, ALIGN_512MB, PTE_CB_CACHEABLE_WB | PTE_SZ_512MB | PTE_PRR | PTE_PRW | PTE_PRU, r25, r3)
- SET_PTE (r1, r2, r3)
-
- ! Map a 4K page for DYNACON at DYNACON_BASE
- addi r1, 16, r1
- LOAD_PTEH_VAL (DYNACON_BASE, ALIGN_4KB, PTE_ENABLED | PTE_NOT_SHARED, r25, r2)
- LOAD_PTEL_VAL (DYNACON_BASE, ALIGN_4KB, PTE_CB_DEVICE | PTE_SZ_4KB | PTE_PRR | PTE_PRW | PTE_PRU, r25, r3)
- SET_PTE (r1, r2, r3)
-
- ! Map a 4K page for instructions at DM_DB_DLINK_BASE
- addi r1, 16, r1
- LOAD_PTEH_VAL (DM_DB_DLINK_BASE, ALIGN_4KB, PTE_ENABLED | PTE_NOT_SHARED, r25, r2)
- LOAD_PTEL_VAL (DM_DB_DLINK_BASE, ALIGN_4KB, PTE_CB_CACHEABLE_WB | PTE_SZ_4KB | PTE_PRR | PTE_PRW | PTE_PRU, r25, r3)
- SET_PTE (r1, r2, r3)
-
- ! Map a 4K page for data at DM_DB_DLINK_BASE+0x1000
- addi r1, 16, r1
- LOAD_PTEH_VAL ((DM_DB_DLINK_BASE+0x1000), ALIGN_4KB, PTE_ENABLED | PTE_NOT_SHARED, r25, r2)
- LOAD_PTEL_VAL ((DM_DB_DLINK_BASE+0x1000), ALIGN_4KB, PTE_CB_UNCACHEABLE | PTE_SZ_4KB | PTE_PRR | PTE_PRW | PTE_PRU, r25, r3)
- SET_PTE (r1, r2, r3)
-
- ! Map a 4K page for stack DM_DB_DLINK_BASE+0x2000
- addi r1, 16, r1
- LOAD_PTEH_VAL ((DM_DB_DLINK_BASE+0x2000), ALIGN_4KB, PTE_ENABLED | PTE_NOT_SHARED, r25, r2)
- LOAD_PTEL_VAL ((DM_DB_DLINK_BASE+0x2000), ALIGN_4KB, PTE_CB_CACHEABLE_WB | PTE_SZ_4KB | PTE_PRR | PTE_PRW | PTE_PRU, r25, r3)
- SET_PTE (r1, r2, r3)
-
- ! Map a 1M page for DM_CB_BASE2 at DM_CB_DLINK
- ! 0x0c000000 - 0x0c0fffff
- addi r1, 16, r1
- LOAD_PTEH_VAL (DM_CB_DLINK_BASE, ALIGN_1MB, PTE_ENABLED | PTE_NOT_SHARED, r25, r2)
- LOAD_PTEL_VAL (DM_CB_DLINK_BASE, ALIGN_1MB, PTE_CB_DEVICE | PTE_SZ_1MB | PTE_PRR | PTE_PRW | PTE_PRU, r25, r3)
- SET_PTE (r1, r2, r3)
-
- ! Map a 1M page for DM_CB_BASE2 at DM_CB_DLINK
- ! 0x0c100000 - 0x0c1fffff
- addi r1, 16, r1
- LOAD_PTEH_VAL ((DM_CB_DLINK_BASE+0x100000), ALIGN_1MB, PTE_ENABLED | PTE_NOT_SHARED, r25, r2)
- LOAD_PTEL_VAL ((DM_CB_DLINK_BASE+0x100000), ALIGN_1MB, PTE_CB_DEVICE | PTE_SZ_1MB | PTE_PRR | PTE_PRW | PTE_PRU, r25, r3)
- SET_PTE (r1, r2, r3)
-
- ! Map a 1M page for DM_CB_BASE2 at DM_CB_DLINK
- ! 0x0c200000 - 0x0c2fffff
- addi r1, 16, r1
- LOAD_PTEH_VAL ((DM_CB_DLINK_BASE+0x200000), ALIGN_1MB, PTE_ENABLED | PTE_NOT_SHARED, r25, r2)
- LOAD_PTEL_VAL ((DM_CB_DLINK_BASE+0x200000), ALIGN_1MB, PTE_CB_DEVICE | PTE_SZ_1MB | PTE_PRR | PTE_PRW | PTE_PRU, r25, r3)
- SET_PTE (r1, r2, r3)
-
- ! Map a 1M page for DM_CB_BASE2 at DM_CB_DLINK
- ! 0x0c400000 - 0x0c4fffff
- addi r1, 16, r1
- LOAD_PTEH_VAL ((DM_CB_DLINK_BASE+0x400000), ALIGN_1MB, PTE_ENABLED | PTE_NOT_SHARED, r25, r2)
- LOAD_PTEL_VAL ((DM_CB_DLINK_BASE+0x400000), ALIGN_1MB, PTE_CB_DEVICE | PTE_SZ_1MB | PTE_PRR | PTE_PRW | PTE_PRU, r25, r3)
- SET_PTE (r1, r2, r3)
-
- ! Map a 1M page for DM_CB_BASE2 at DM_CB_DLINK
- ! 0x0c800000 - 0x0c8fffff
- addi r1, 16, r1
- LOAD_PTEH_VAL ((DM_CB_DLINK_BASE+0x800000), ALIGN_1MB, PTE_ENABLED | PTE_NOT_SHARED, r25, r2)
- LOAD_PTEL_VAL ((DM_CB_DLINK_BASE+0x800000), ALIGN_1MB, PTE_CB_DEVICE | PTE_SZ_1MB | PTE_PRR | PTE_PRW | PTE_PRU, r25, r3)
- SET_PTE (r1, r2, r3)
-
- ! Map a 4K page for DMA control registers
- addi r1, 16, r1
- LOAD_PTEH_VAL (DMA_BASE, ALIGN_4KB, PTE_ENABLED | PTE_NOT_SHARED, r25, r2)
- LOAD_PTEL_VAL (DMA_BASE, ALIGN_4KB, PTE_CB_DEVICE | PTE_SZ_4KB | PTE_PRR | PTE_PRW | PTE_PRU, r25, r3)
- SET_PTE (r1, r2, r3)
-
- ! Map lots of 4K pages for peripherals
-
- ! /* peripheral */
- addi r1, 16, r1
- LOAD_PTEH_VAL (PERIPH_BASE, ALIGN_4KB, PTE_ENABLED | PTE_NOT_SHARED, r25, r2)
- LOAD_PTEL_VAL (PERIPH_BASE, ALIGN_4KB, PTE_CB_DEVICE | PTE_SZ_4KB | PTE_PRR | PTE_PRW | PTE_PRU, r25, r3)
- SET_PTE (r1, r2, r3)
- ! /* dmac */
- addi r1, 16, r1
- LOAD_PTEH_VAL (DMAC_BASE, ALIGN_4KB, PTE_ENABLED | PTE_NOT_SHARED, r25, r2)
- LOAD_PTEL_VAL (DMAC_BASE, ALIGN_4KB, PTE_CB_DEVICE | PTE_SZ_4KB | PTE_PRR | PTE_PRW | PTE_PRU, r25, r3)
- SET_PTE (r1, r2, r3)
- ! /* intc */
- addi r1, 16, r1
- LOAD_PTEH_VAL (INTC_BASE, ALIGN_4KB, PTE_ENABLED | PTE_NOT_SHARED, r25, r2)
- LOAD_PTEL_VAL (INTC_BASE, ALIGN_4KB, PTE_CB_DEVICE | PTE_SZ_4KB | PTE_PRR | PTE_PRW | PTE_PRU, r25, r3)
- SET_PTE (r1, r2, r3)
- ! /* rtc */
- addi r1, 16, r1
- LOAD_PTEH_VAL (RTC_BASE, ALIGN_4KB, PTE_ENABLED | PTE_NOT_SHARED, r25, r2)
- LOAD_PTEL_VAL (RTC_BASE, ALIGN_4KB, PTE_CB_DEVICE | PTE_SZ_4KB | PTE_PRR | PTE_PRW | PTE_PRU, r25, r3)
- SET_PTE (r1, r2, r3)
- ! /* dmac */
- addi r1, 16, r1
- LOAD_PTEH_VAL (TMU_BASE, ALIGN_4KB, PTE_ENABLED | PTE_NOT_SHARED, r25, r2)
- LOAD_PTEL_VAL (TMU_BASE, ALIGN_4KB, PTE_CB_DEVICE | PTE_SZ_4KB | PTE_PRR | PTE_PRW | PTE_PRU, r25, r3)
- SET_PTE (r1, r2, r3)
- ! /* scif */
- addi r1, 16, r1
- LOAD_PTEH_VAL (SCIF_BASE, ALIGN_4KB, PTE_ENABLED | PTE_NOT_SHARED, r25, r2)
- LOAD_PTEL_VAL (SCIF_BASE, ALIGN_4KB, PTE_CB_DEVICE | PTE_SZ_4KB | PTE_PRR | PTE_PRW | PTE_PRU, r25, r3)
- SET_PTE (r1, r2, r3)
- ! /* cprc */
- addi r1, 16, r1
- LOAD_PTEH_VAL (CPRC_BASE, ALIGN_4KB, PTE_ENABLED | PTE_NOT_SHARED, r25, r2)
- LOAD_PTEL_VAL (CPRC_BASE, ALIGN_4KB, PTE_CB_DEVICE | PTE_SZ_4KB | PTE_PRR | PTE_PRW | PTE_PRU, r25, r3)
- SET_PTE (r1, r2, r3)
-
- ! Map CPU WPC registers
- addi r1, 16, r1
- LOAD_PTEH_VAL (CPU_BASE, ALIGN_1MB, PTE_ENABLED | PTE_NOT_SHARED, r25, r2)
- LOAD_PTEL_VAL (CPU_BASE, ALIGN_1MB, PTE_CB_DEVICE | PTE_SZ_1MB | PTE_PRR | PTE_PRW | PTE_PRU, r25, r3)
- SET_PTE (r1, r2, r3)
- addi r1, 16, r1
-
- LOAD_PTEH_VAL ((CPU_BASE+0x100000), ALIGN_1MB, PTE_ENABLED | PTE_NOT_SHARED, r25, r2)
- LOAD_PTEL_VAL ((CPU_BASE+0x100000), ALIGN_1MB, PTE_CB_DEVICE | PTE_SZ_1MB | PTE_PRR | PTE_PRW | PTE_PRU, r25, r3)
- SET_PTE (r1, r2, r3)
-
- addi r1, 16, r1
- LOAD_PTEH_VAL ((CPU_BASE+0x200000), ALIGN_1MB, PTE_ENABLED | PTE_NOT_SHARED, r25, r2)
- LOAD_PTEL_VAL ((CPU_BASE+0x200000), ALIGN_1MB, PTE_CB_DEVICE | PTE_SZ_1MB | PTE_PRR | PTE_PRW | PTE_PRU, r25, r3)
- SET_PTE (r1, r2, r3)
-
- addi r1, 16, r1
- LOAD_PTEH_VAL ((CPU_BASE+0x400000), ALIGN_1MB, PTE_ENABLED | PTE_NOT_SHARED, r25, r2)
- LOAD_PTEL_VAL ((CPU_BASE+0x400000), ALIGN_1MB, PTE_CB_DEVICE | PTE_SZ_1MB | PTE_PRR | PTE_PRW | PTE_PRU, r25, r3)
- SET_PTE (r1, r2, r3)
-
- ! Switch over to virtual addressing and enabled cache
- getcon sr, r1
- movi 1, r2
- shlli r2, SR_BL_BIT, r2
- or r1, r2, r1
- putcon r1, ssr
- getcon sr, r1
- movi 1, r2
- shlli r2, SR_MMU_BIT, r2
- or r1, r2, r1
- putcon r1, ssr
- gettr tr1, r1
- putcon r1, spc
- synco
- rte
-
- ! VM entry point. From now on, we are in VM mode.
-.vm_ep:
-
- ! Install the trap handler, by seeding vbr with the
- ! correct value, and by assigning sr.bl = 0.
-
- LOAD_ADDR (vbr_start, r1)
- putcon r1, vbr
- movi ~(1<<28), r1
- getcon sr, r2
- and r1, r2, r2
- putcon r2, sr
-#endif /* MMU_SUPPORT */
-
- pt/l .Lzero_bss_loop, tr0
- pt/l _init, tr5
- pt/l ___setup_argv_and_call_main, tr6
- pt/l _exit, tr7
-
- ! zero out bss
- LOAD_ADDR (_edata, r0)
- LOAD_ADDR (_end, r1)
-.Lzero_bss_loop:
- stx.q r0, r63, r63
- addi r0, 8, r0
- bgt/l r1, r0, tr0
-
- LOAD_ADDR (___data, r26)
- LOAD_ADDR (___rodata, r27)
-
-#ifdef __SH_FPU_ANY__
- getcon sr, r0
- ! enable the FP unit, by resetting SR.FD
- ! also zero out SR.FR, SR.SZ and SR.PR, as mandated by the ABI
- movi 0, r1
- shori 0xf000, r1
- andc r0, r1, r0
- putcon r0, sr
-#if __SH5__ == 32
- pt/l ___set_fpscr, tr0
- movi 0, r4
- blink tr0, r18
-#endif
-#endif
-
- ! arrange for exit to call fini
- pt/l _atexit, tr1
- LOAD_ADDR (_fini, r2)
- blink tr1, r18
-
- ! call init
- blink tr5, r18
-
- ! call the mainline
- blink tr6, r18
-
- ! call exit
- blink tr7, r18
- ! We should never return from _exit but in case we do we would enter the
- ! the following tight loop. This avoids executing any data that might follow.
-limbo:
- pt/l limbo, tr0
- blink tr0, r63
-
-#ifdef MMU_SUPPORT
- ! All these traps are handled in the same place.
- .balign 256
-vbr_start:
- pt/l handler, tr0 ! tr0 trashed.
- blink tr0, r63
- .balign 256
-vbr_100:
- pt/l handler, tr0 ! tr0 trashed.
- blink tr0, r63
-vbr_100_end:
- .balign 256
-vbr_200:
- pt/l handler, tr0 ! tr0 trashed.
- blink tr0, r63
- .balign 256
-vbr_300:
- pt/l handler, tr0 ! tr0 trashed.
- blink tr0, r63
- .balign 256
-vbr_400: ! Should be at vbr+0x400
-handler:
- /* If the trap handler is there call it */
- LOAD_ADDR (__superh_trap_handler, r2)
- pta chandler,tr2
- beq r2, r63, tr2 /* If zero, ie not present branch around to chandler */
- /* Now call the trap handler with as much of the context unchanged as possible.
- Move trapping address into R18 to make it look like the trap point */
- getcon spc, r18
- pt/l __superh_trap_handler, tr0
- blink tr0, r7
-chandler:
- getcon spc, r62
- getcon expevt, r2
- pt/l _exit, tr0
- blink tr0, r63
-
- /* Simulated trap handler */
- .section .text..SHmedia32,"ax"
-gcc2_compiled.:
- .section .debug_abbrev
-.Ldebug_abbrev0:
- .section .text..SHmedia32
-.Ltext0:
- .section .debug_info
-.Ldebug_info0:
- .section .debug_line
-.Ldebug_line0:
- .section .text..SHmedia32,"ax"
- .align 5
- .global __superh_trap_handler
- .type __superh_trap_handler,@function
-__superh_trap_handler:
-.LFB1:
- ptabs r18, tr0
- addi.l r15, -8, r15
- st.l r15, 4, r14
- addi.l r15, -8, r15
- add.l r15, r63, r14
- st.l r14, 0, r2
- ptabs r7, tr0
- addi.l r14, 8, r14
- add.l r14, r63, r15
- ld.l r15, 4, r14
- addi.l r15, 8, r15
- blink tr0, r63
-.LFE1:
-.Lfe1:
- .size __superh_trap_handler,.Lfe1-__superh_trap_handler
-
- .section .text..SHmedia32
-.Letext0:
-
- .section .debug_info
- .ualong 0xa7
- .uaword 0x2
- .ualong .Ldebug_abbrev0
- .byte 0x4
- .byte 0x1
- .ualong .Ldebug_line0
- .ualong .Letext0
- .ualong .Ltext0
- .string "trap_handler.c"
-
- .string "xxxxxxxxxxxxxxxxxxxxxxxxxxxx"
-
- .string "GNU C 2.97-sh5-010522"
-
- .byte 0x1
- .byte 0x2
- .ualong 0x9a
- .byte 0x1
- .string "_superh_trap_handler"
-
- .byte 0x1
- .byte 0x2
- .byte 0x1
- .ualong .LFB1
- .ualong .LFE1
- .byte 0x1
- .byte 0x5e
- .byte 0x3
- .string "trap_reason"
-
- .byte 0x1
- .byte 0x1
- .ualong 0x9a
- .byte 0x2
- .byte 0x91
- .byte 0x0
- .byte 0x0
- .byte 0x4
- .string "unsigned int"
-
- .byte 0x4
- .byte 0x7
- .byte 0x0
-
- .section .debug_abbrev
- .byte 0x1
- .byte 0x11
- .byte 0x1
- .byte 0x10
- .byte 0x6
- .byte 0x12
- .byte 0x1
- .byte 0x11
- .byte 0x1
- .byte 0x3
- .byte 0x8
- .byte 0x1b
- .byte 0x8
- .byte 0x25
- .byte 0x8
- .byte 0x13
- .byte 0xb
- .byte 0,0
- .byte 0x2
- .byte 0x2e
- .byte 0x1
- .byte 0x1
- .byte 0x13
- .byte 0x3f
- .byte 0xc
- .byte 0x3
- .byte 0x8
- .byte 0x3a
- .byte 0xb
- .byte 0x3b
- .byte 0xb
- .byte 0x27
- .byte 0xc
- .byte 0x11
- .byte 0x1
- .byte 0x12
- .byte 0x1
- .byte 0x40
- .byte 0xa
- .byte 0,0
- .byte 0x3
- .byte 0x5
- .byte 0x0
- .byte 0x3
- .byte 0x8
- .byte 0x3a
- .byte 0xb
- .byte 0x3b
- .byte 0xb
- .byte 0x49
- .byte 0x13
- .byte 0x2
- .byte 0xa
- .byte 0,0
- .byte 0x4
- .byte 0x24
- .byte 0x0
- .byte 0x3
- .byte 0x8
- .byte 0xb
- .byte 0xb
- .byte 0x3e
- .byte 0xb
- .byte 0,0
- .byte 0
-
- .section .debug_pubnames
- .ualong 0x27
- .uaword 0x2
- .ualong .Ldebug_info0
- .ualong 0xab
- .ualong 0x5b
- .string "_superh_trap_handler"
-
- .ualong 0x0
-
- .section .debug_aranges
- .ualong 0x1c
- .uaword 0x2
- .ualong .Ldebug_info0
- .byte 0x4
- .byte 0x0
- .uaword 0x0,0
- .ualong .Ltext0
- .ualong .Letext0-.Ltext0
- .ualong 0x0
- .ualong 0x0
- .ident "GCC: (GNU) 2.97-sh5-010522"
-#endif /* MMU_SUPPORT */
-#else /* ! __SH5__ */
-
- ! make a place to keep any previous value of the vbr register
- ! this will only have a value if it has been set by redboot (for example)
- .section .bss
-old_vbr:
- .long 0
-#ifdef PROFILE
-profiling_enabled:
- .long 0
-#endif
-
-
- .section .text
- .global start
- .import ___rtos_profiler_start_timer
- .weak ___rtos_profiler_start_timer
-start:
- mov.l stack_k,r15
-
-#if defined (__SH3__) || (defined (__SH_FPU_ANY__) && ! defined (__SH2A__)) || defined (__SH4_NOFPU__)
-#define VBR_SETUP
- ! before zeroing the bss ...
- ! if the vbr is already set to vbr_start then the program has been restarted
- ! (i.e. it is not the first time the program has been run since reset)
- ! reset the vbr to its old value before old_vbr (in bss) is wiped
- ! this ensures that the later code does not create a circular vbr chain
- stc vbr, r1
- mov.l vbr_start_k, r2
- cmp/eq r1, r2
- bf 0f
- ! reset the old vbr value
- mov.l old_vbr_k, r1
- mov.l @r1, r2
- ldc r2, vbr
-0:
-#endif /* VBR_SETUP */
-
- ! zero out bss
- mov.l edata_k,r0
- mov.l end_k,r1
- mov #0,r2
-start_l:
- mov.l r2,@r0
- add #4,r0
- cmp/ge r0,r1
- bt start_l
-
-#if defined (__SH_FPU_ANY__)
- mov.l set_fpscr_k, r1
- mov #4,r4
- jsr @r1
- shll16 r4 ! Set DN bit (flush denormal inputs to zero)
- lds r3,fpscr ! Switch to default precision
-#endif /* defined (__SH_FPU_ANY__) */
-
-#ifdef VBR_SETUP
- ! save the existing contents of the vbr
- ! there will only be a prior value when using something like redboot
- ! otherwise it will be zero
- stc vbr, r1
- mov.l old_vbr_k, r2
- mov.l r1, @r2
- ! setup vbr
- mov.l vbr_start_k, r1
- ldc r1,vbr
-#endif /* VBR_SETUP */
-
- ! if an rtos is exporting a timer start fn,
- ! then pick up an SR which does not enable ints
- ! (the rtos will take care of this)
- mov.l rtos_start_fn, r0
- mov.l sr_initial_bare, r1
- tst r0, r0
- bt set_sr
-
- mov.l sr_initial_rtos, r1
-
-set_sr:
- ! Set status register (sr)
- ldc r1, sr
-
- ! arrange for exit to call fini
- mov.l atexit_k,r0
- mov.l fini_k,r4
- jsr @r0
- nop
-
-#ifdef PROFILE
- ! arrange for exit to call _mcleanup (via stop_profiling)
- mova stop_profiling,r0
- mov.l atexit_k,r1
- jsr @r1
- mov r0, r4
-
- ! Call profiler startup code
- mov.l monstartup_k, r0
- mov.l start_k, r4
- mov.l etext_k, r5
- jsr @r0
- nop
-
- ! enable profiling trap
- ! until now any trap 33s will have been ignored
- ! This means that all library functions called before this point
- ! (directly or indirectly) may have the profiling trap at the start.
- ! Therefore, only mcount itself may not have the extra header.
- mov.l profiling_enabled_k2, r0
- mov #1, r1
- mov.l r1, @r0
-#endif /* PROFILE */
-
- ! call init
- mov.l init_k,r0
- jsr @r0
- nop
-
- ! call the mainline
- mov.l main_k,r0
- jsr @r0
- nop
-
- ! call exit
- mov r0,r4
- mov.l exit_k,r0
- jsr @r0
- nop
-
- .balign 4
-#ifdef PROFILE
-stop_profiling:
- # stop mcount counting
- mov.l profiling_enabled_k2, r0
- mov #0, r1
- mov.l r1, @r0
-
- # call mcleanup
- mov.l mcleanup_k, r0
- jmp @r0
- nop
-
- .balign 4
-mcleanup_k:
- .long __mcleanup
-monstartup_k:
- .long ___monstartup
-profiling_enabled_k2:
- .long profiling_enabled
-start_k:
- .long _start
-etext_k:
- .long __etext
-#endif /* PROFILE */
-
- .align 2
-#if defined (__SH_FPU_ANY__)
-set_fpscr_k:
- .long ___set_fpscr
-#endif /* defined (__SH_FPU_ANY__) */
-
-stack_k:
- .long _stack
-edata_k:
- .long _edata
-end_k:
- .long _end
-main_k:
- .long ___setup_argv_and_call_main
-exit_k:
- .long _exit
-atexit_k:
- .long _atexit
-init_k:
- .long _init
-fini_k:
- .long _fini
-#ifdef VBR_SETUP
-old_vbr_k:
- .long old_vbr
-vbr_start_k:
- .long vbr_start
-#endif /* VBR_SETUP */
-
-sr_initial_rtos:
- ! Privileged mode RB 1 BL 0. Keep BL 0 to allow default trap handlers to work.
- ! Whether profiling or not, keep interrupts masked,
- ! the RTOS will enable these if required.
- .long 0x600000f1
-
-rtos_start_fn:
- .long ___rtos_profiler_start_timer
-
-#ifdef PROFILE
-sr_initial_bare:
- ! Privileged mode RB 1 BL 0. Keep BL 0 to allow default trap handlers to work.
- ! For bare machine, we need to enable interrupts to get profiling working
- .long 0x60000001
-#else
-
-sr_initial_bare:
- ! Privileged mode RB 1 BL 0. Keep BL 0 to allow default trap handlers to work.
- ! Keep interrupts disabled - the application will enable as required.
- .long 0x600000f1
-#endif
-
- ! supplied for backward compatibility only, in case of linking
- ! code whose main() was compiled with an older version of GCC.
- .global ___main
-___main:
- rts
- nop
-#ifdef VBR_SETUP
-! Exception handlers
- .section .text.vbr, "ax"
-vbr_start:
-
- .org 0x100
-vbr_100:
-#ifdef PROFILE
- ! Note on register usage.
- ! we use r0..r3 as scratch in this code. If we are here due to a trapa for profiling
- ! then this is OK as we are just before executing any function code.
- ! The other r4..r7 we save explicityl on the stack
- ! Remaining registers are saved by normal ABI conventions and we assert we do not
- ! use floating point registers.
- mov.l expevt_k1, r1
- mov.l @r1, r1
- mov.l event_mask, r0
- and r0,r1
- mov.l trapcode_k, r2
- cmp/eq r1,r2
- bt 1f
- bra handler_100 ! if not a trapa, go to default handler
- nop
-1:
- mov.l trapa_k, r0
- mov.l @r0, r0
- shlr2 r0 ! trapa code is shifted by 2.
- cmp/eq #33, r0
- bt 2f
- bra handler_100
- nop
-2:
-
- ! If here then it looks like we have trap #33
- ! Now we need to call mcount with the following convention
- ! Save and restore r4..r7
- mov.l r4,@-r15
- mov.l r5,@-r15
- mov.l r6,@-r15
- mov.l r7,@-r15
- sts.l pr,@-r15
-
- ! r4 is frompc.
- ! r5 is selfpc
- ! r0 is the branch back address.
- ! The code sequence emitted by gcc for the profiling trap is
- ! .align 2
- ! trapa #33
- ! .align 2
- ! .long lab Where lab is planted by the compiler. This is the address
- ! of a datum that needs to be incremented.
- sts pr, r4 ! frompc
- stc spc, r5 ! selfpc
- mov #2, r2
- not r2, r2 ! pattern to align to 4
- and r2, r5 ! r5 now has aligned address
-! add #4, r5 ! r5 now has address of address
- mov r5, r2 ! Remember it.
-! mov.l @r5, r5 ! r5 has value of lable (lab in above example)
- add #8, r2
- ldc r2, spc ! our return address avoiding address word
-
- ! only call mcount if profiling is enabled
- mov.l profiling_enabled_k, r0
- mov.l @r0, r0
- cmp/eq #0, r0
- bt 3f
- ! call mcount
- mov.l mcount_k, r2
- jsr @r2
- nop
-3:
- lds.l @r15+,pr
- mov.l @r15+,r7
- mov.l @r15+,r6
- mov.l @r15+,r5
- mov.l @r15+,r4
- rte
- nop
- .balign 4
-event_mask:
- .long 0xfff
-trapcode_k:
- .long 0x160
-expevt_k1:
- .long 0xff000024 ! Address of expevt
-trapa_k:
- .long 0xff000020
-mcount_k:
- .long __call_mcount
-profiling_enabled_k:
- .long profiling_enabled
-#endif
- ! Non profiling case.
-handler_100:
- mov.l 2f, r0 ! load the old vbr setting (if any)
- mov.l @r0, r0
- cmp/eq #0, r0
- bf 1f
- ! no previous vbr - jump to own generic handler
- bra handler
- nop
-1: ! there was a previous handler - chain them
- add #0x7f, r0 ! 0x7f
- add #0x7f, r0 ! 0xfe
- add #0x2, r0 ! add 0x100 without corrupting another register
- jmp @r0
- nop
- .balign 4
-2:
- .long old_vbr
-
- .org 0x400
-vbr_400: ! Should be at vbr+0x400
- mov.l 2f, r0 ! load the old vbr setting (if any)
- mov.l @r0, r0
- cmp/eq #0, r0
- ! no previous vbr - jump to own generic handler
- bt handler
- ! there was a previous handler - chain them
- rotcr r0
- rotcr r0
- add #0x7f, r0 ! 0x1fc
- add #0x7f, r0 ! 0x3f8
- add #0x02, r0 ! 0x400
- rotcl r0
- rotcl r0 ! Add 0x400 without corrupting another register
- jmp @r0
- nop
- .balign 4
-2:
- .long old_vbr
-handler:
- /* If the trap handler is there call it */
- mov.l superh_trap_handler_k, r0
- cmp/eq #0, r0 ! True if zero.
- bf 3f
- bra chandler
- nop
-3:
- ! Here handler available, call it.
- /* Now call the trap handler with as much of the context unchanged as possible.
- Move trapping address into PR to make it look like the trap point */
- stc spc, r1
- lds r1, pr
- mov.l expevt_k, r4
- mov.l @r4, r4 ! r4 is value of expevt, first parameter.
- mov r1, r5 ! Remember trapping pc.
- mov r1, r6 ! Remember trapping pc.
- mov.l chandler_k, r1
- mov.l superh_trap_handler_k, r2
- ! jmp to trap handler to avoid disturbing pr.
- jmp @r2
- nop
-
- .org 0x600
-vbr_600:
-#ifdef PROFILE
- ! Should be at vbr+0x600
- ! Now we are in the land of interrupts so need to save more state.
- ! Save register state
- mov.l interrupt_stack_k, r15 ! r15 has been saved to sgr.
- mov.l r0,@-r15
- mov.l r1,@-r15
- mov.l r2,@-r15
- mov.l r3,@-r15
- mov.l r4,@-r15
- mov.l r5,@-r15
- mov.l r6,@-r15
- mov.l r7,@-r15
- sts.l pr,@-r15
- sts.l mach,@-r15
- sts.l macl,@-r15
-#if defined(__SH_FPU_ANY__)
- ! Save fpul and fpscr, save fr0-fr7 in 64 bit mode
- ! and set the pervading precision for the timer_handler
- mov #0,r0
- sts.l fpul,@-r15
- sts.l fpscr,@-r15
- lds r0,fpscr ! Clear fpscr
- fmov fr0,@-r15
- fmov fr1,@-r15
- fmov fr2,@-r15
- fmov fr3,@-r15
- mov.l pervading_precision_k,r0
- fmov fr4,@-r15
- fmov fr5,@-r15
- mov.l @r0,r0
- fmov fr6,@-r15
- fmov fr7,@-r15
- lds r0,fpscr
-#endif /* __SH_FPU_ANY__ */
- ! Pass interrupted pc to timer_handler as first parameter (r4).
- stc spc, r4
- mov.l timer_handler_k, r0
- jsr @r0
- nop
-#if defined(__SH_FPU_ANY__)
- mov #0,r0
- lds r0,fpscr ! Clear the fpscr
- fmov @r15+,fr7
- fmov @r15+,fr6
- fmov @r15+,fr5
- fmov @r15+,fr4
- fmov @r15+,fr3
- fmov @r15+,fr2
- fmov @r15+,fr1
- fmov @r15+,fr0
- lds.l @r15+,fpscr
- lds.l @r15+,fpul
-#endif /* __SH_FPU_ANY__ */
- lds.l @r15+,macl
- lds.l @r15+,mach
- lds.l @r15+,pr
- mov.l @r15+,r7
- mov.l @r15+,r6
- mov.l @r15+,r5
- mov.l @r15+,r4
- mov.l @r15+,r3
- mov.l @r15+,r2
- mov.l @r15+,r1
- mov.l @r15+,r0
- stc sgr, r15 ! Restore r15, destroyed by this sequence.
- rte
- nop
-#if defined(__SH_FPU_ANY__)
- .balign 4
-pervading_precision_k:
-#define CONCAT1(A,B) A##B
-#define CONCAT(A,B) CONCAT1(A,B)
- .long CONCAT(__USER_LABEL_PREFIX__,__fpscr_values)+4
-#endif
-#else
- mov.l 2f, r0 ! Load the old vbr setting (if any).
- mov.l @r0, r0
- cmp/eq #0, r0
- ! no previous vbr - jump to own handler
- bt chandler
- ! there was a previous handler - chain them
- rotcr r0
- rotcr r0
- add #0x7f, r0 ! 0x1fc
- add #0x7f, r0 ! 0x3f8
- add #0x7f, r0 ! 0x5f4
- add #0x03, r0 ! 0x600
- rotcl r0
- rotcl r0 ! Add 0x600 without corrupting another register
- jmp @r0
- nop
- .balign 4
-2:
- .long old_vbr
-#endif /* PROFILE code */
-chandler:
- mov.l expevt_k, r4
- mov.l @r4, r4 ! r4 is value of expevt hence making this the return code
- mov.l handler_exit_k,r0
- jsr @r0
- nop
- ! We should never return from _exit but in case we do we would enter the
- ! the following tight loop
-limbo:
- bra limbo
- nop
- .balign 4
-#ifdef PROFILE
-interrupt_stack_k:
- .long __timer_stack ! The high end of the stack
-timer_handler_k:
- .long __profil_counter
-#endif
-expevt_k:
- .long 0xff000024 ! Address of expevt
-chandler_k:
- .long chandler
-superh_trap_handler_k:
- .long __superh_trap_handler
-handler_exit_k:
- .long _exit
- .align 2
-! Simulated compile of trap handler.
- .section .debug_abbrev,"",@progbits
-.Ldebug_abbrev0:
- .section .debug_info,"",@progbits
-.Ldebug_info0:
- .section .debug_line,"",@progbits
-.Ldebug_line0:
- .text
-.Ltext0:
- .align 5
- .type __superh_trap_handler,@function
-__superh_trap_handler:
-.LFB1:
- mov.l r14,@-r15
-.LCFI0:
- add #-4,r15
-.LCFI1:
- mov r15,r14
-.LCFI2:
- mov.l r4,@r14
- lds r1, pr
- add #4,r14
- mov r14,r15
- mov.l @r15+,r14
- rts
- nop
-.LFE1:
-.Lfe1:
- .size __superh_trap_handler,.Lfe1-__superh_trap_handler
- .section .debug_frame,"",@progbits
-.Lframe0:
- .ualong .LECIE0-.LSCIE0
-.LSCIE0:
- .ualong 0xffffffff
- .byte 0x1
- .string ""
- .uleb128 0x1
- .sleb128 -4
- .byte 0x11
- .byte 0xc
- .uleb128 0xf
- .uleb128 0x0
- .align 2
-.LECIE0:
-.LSFDE0:
- .ualong .LEFDE0-.LASFDE0
-.LASFDE0:
- .ualong .Lframe0
- .ualong .LFB1
- .ualong .LFE1-.LFB1
- .byte 0x4
- .ualong .LCFI0-.LFB1
- .byte 0xe
- .uleb128 0x4
- .byte 0x4
- .ualong .LCFI1-.LCFI0
- .byte 0xe
- .uleb128 0x8
- .byte 0x8e
- .uleb128 0x1
- .byte 0x4
- .ualong .LCFI2-.LCFI1
- .byte 0xd
- .uleb128 0xe
- .align 2
-.LEFDE0:
- .text
-.Letext0:
- .section .debug_info
- .ualong 0xb3
- .uaword 0x2
- .ualong .Ldebug_abbrev0
- .byte 0x4
- .uleb128 0x1
- .ualong .Ldebug_line0
- .ualong .Letext0
- .ualong .Ltext0
- .string "trap_handler.c"
- .string "xxxxxxxxxxxxxxxxxxxxxxxxxxxx"
- .string "GNU C 3.2 20020529 (experimental)"
- .byte 0x1
- .uleb128 0x2
- .ualong 0xa6
- .byte 0x1
- .string "_superh_trap_handler"
- .byte 0x1
- .byte 0x2
- .byte 0x1
- .ualong .LFB1
- .ualong .LFE1
- .byte 0x1
- .byte 0x5e
- .uleb128 0x3
- .string "trap_reason"
- .byte 0x1
- .byte 0x1
- .ualong 0xa6
- .byte 0x2
- .byte 0x91
- .sleb128 0
- .byte 0x0
- .uleb128 0x4
- .string "unsigned int"
- .byte 0x4
- .byte 0x7
- .byte 0x0
- .section .debug_abbrev
- .uleb128 0x1
- .uleb128 0x11
- .byte 0x1
- .uleb128 0x10
- .uleb128 0x6
- .uleb128 0x12
- .uleb128 0x1
- .uleb128 0x11
- .uleb128 0x1
- .uleb128 0x3
- .uleb128 0x8
- .uleb128 0x1b
- .uleb128 0x8
- .uleb128 0x25
- .uleb128 0x8
- .uleb128 0x13
- .uleb128 0xb
- .byte 0x0
- .byte 0x0
- .uleb128 0x2
- .uleb128 0x2e
- .byte 0x1
- .uleb128 0x1
- .uleb128 0x13
- .uleb128 0x3f
- .uleb128 0xc
- .uleb128 0x3
- .uleb128 0x8
- .uleb128 0x3a
- .uleb128 0xb
- .uleb128 0x3b
- .uleb128 0xb
- .uleb128 0x27
- .uleb128 0xc
- .uleb128 0x11
- .uleb128 0x1
- .uleb128 0x12
- .uleb128 0x1
- .uleb128 0x40
- .uleb128 0xa
- .byte 0x0
- .byte 0x0
- .uleb128 0x3
- .uleb128 0x5
- .byte 0x0
- .uleb128 0x3
- .uleb128 0x8
- .uleb128 0x3a
- .uleb128 0xb
- .uleb128 0x3b
- .uleb128 0xb
- .uleb128 0x49
- .uleb128 0x13
- .uleb128 0x2
- .uleb128 0xa
- .byte 0x0
- .byte 0x0
- .uleb128 0x4
- .uleb128 0x24
- .byte 0x0
- .uleb128 0x3
- .uleb128 0x8
- .uleb128 0xb
- .uleb128 0xb
- .uleb128 0x3e
- .uleb128 0xb
- .byte 0x0
- .byte 0x0
- .byte 0x0
- .section .debug_pubnames,"",@progbits
- .ualong 0x27
- .uaword 0x2
- .ualong .Ldebug_info0
- .ualong 0xb7
- .ualong 0x67
- .string "_superh_trap_handler"
- .ualong 0x0
- .section .debug_aranges,"",@progbits
- .ualong 0x1c
- .uaword 0x2
- .ualong .Ldebug_info0
- .byte 0x4
- .byte 0x0
- .uaword 0x0
- .uaword 0x0
- .ualong .Ltext0
- .ualong .Letext0-.Ltext0
- .ualong 0x0
- .ualong 0x0
-#endif /* VBR_SETUP */
-#endif /* ! __SH5__ */
diff --git a/gcc/config/sh/crti.asm b/gcc/config/sh/crti.asm
deleted file mode 100644
index ef5cd719d82..00000000000
--- a/gcc/config/sh/crti.asm
+++ /dev/null
@@ -1,125 +0,0 @@
-/* Copyright (C) 2000, 2001, 2009 Free Software Foundation, Inc.
- This file was adapted from glibc sources.
-
-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/>. */
-
-
-/* The code in sections .init and .fini is supposed to be a single
- regular function. The function in .init is called directly from
- start in crt1.asm. The function in .fini is atexit()ed in crt1.asm
- too.
-
- crti.asm contributes the prologue of a function to these sections,
- and crtn.asm comes up the epilogue. STARTFILE_SPEC should list
- crti.o before any other object files that might add code to .init
- or .fini sections, and ENDFILE_SPEC should list crtn.o after any
- such object files. */
-
- .section .init
-/* The alignment below can't be smaller, otherwise the mova below
- breaks. Yes, we might align just the label, but then we'd be
- exchanging an alignment here for one there, since the code fragment
- below ensures 4-byte alignment on __ELF__. */
-#ifdef __ELF__
- .p2align 2
-#else
- .p2align 1
-#endif
- .global _init
-_init:
-#if __SHMEDIA__
- addi r15, -16, r15
- st.q r15, 8, r14
- st.q r15, 0, r18
- add r15, r63, r14
-#elif __SH5__ && ! __SHMEDIA__
- mov r15,r0
- add #-8,r15
- mov.l r14,@-r0
- sts.l pr,@-r0
- mov r15,r14
- nop
-#else
-#ifdef __ELF__
- mov.l r12,@-r15
- mova 0f,r0
- mov.l 0f,r12
-#endif
- mov.l r14,@-r15
-#ifdef __ELF__
- add r0,r12
-#endif
- sts.l pr,@-r15
-#ifdef __ELF__
- bra 1f
-#endif
- mov r15,r14
-#ifdef __ELF__
-0: .long _GLOBAL_OFFSET_TABLE_
-1:
-#endif
-#endif /* __SHMEDIA__ */
-
- .section .fini
-/* The alignment below can't be smaller, otherwise the mova below
- breaks. Yes, we might align just the label, but then we'd be
- exchanging an alignment here for one there, since the code fragment
- below ensures 4-byte alignment on __ELF__. */
-#ifdef __ELF__
- .p2align 2
-#else
- .p2align 1
-#endif
- .global _fini
-_fini:
-#if __SHMEDIA__
- addi r15, -16, r15
- st.q r15, 8, r14
- st.q r15, 0, r18
- add r15, r63, r14
-#elif __SH5__ && ! __SHMEDIA__
- mov r15,r0
- add #-8,r15
- mov.l r14,@-r0
- sts.l pr,@-r0
- mov r15,r14
- nop
-#else
-#ifdef __ELF__
- mov.l r12,@-r15
- mova 0f,r0
- mov.l 0f,r12
-#endif
- mov.l r14,@-r15
-#ifdef __ELF__
- add r0,r12
-#endif
- sts.l pr,@-r15
-#ifdef __ELF__
- bra 1f
-#endif
- mov r15,r14
-#ifdef __ELF__
-0: .long _GLOBAL_OFFSET_TABLE_
-1:
-#endif
-#endif /* __SHMEDIA__ */
diff --git a/gcc/config/sh/crtn.asm b/gcc/config/sh/crtn.asm
deleted file mode 100644
index 670d90f7b6a..00000000000
--- a/gcc/config/sh/crtn.asm
+++ /dev/null
@@ -1,77 +0,0 @@
-/* Copyright (C) 2000, 2001, 2009 Free Software Foundation, Inc.
- This file was adapted from glibc sources.
-
-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/>. */
-
-/* See an explanation about .init and .fini in crti.asm. */
-
- .section .init
-#if __SHMEDIA__
- add r14, r63, r15
- ld.q r15, 0, r18
- ptabs r18, tr0
- ld.q r15, 8, r14
- addi r15, 16, r15
- blink tr0, r63
-#elif __SH5__ && ! __SHMEDIA__
- mov r14,r15
- lds.l @r14+,pr
- mov.l @r14,r14
- rts
- add #8,r15
-#else
- mov r14,r15
- lds.l @r15+,pr
- mov.l @r15+,r14
- rts
-#ifdef __ELF__
- mov.l @r15+,r12
-#else
- nop
-#endif
-#endif /* __SHMEDIA__ */
-
- .section .fini
-#if __SHMEDIA__
- add r14, r63, r15
- ld.q r15, 0, r18
- ptabs r18, tr0
- ld.q r15, 8, r14
- addi r15, 16, r15
- blink tr0, r63
-#elif __SH5__ && ! __SHMEDIA__
- mov r14,r15
- lds.l @r14+,pr
- mov.l @r14,r14
- rts
- add #8,r15
-#else
- mov r14,r15
- lds.l @r15+,pr
- mov.l @r15+,r14
- rts
-#ifdef __ELF__
- mov.l @r15+,r12
-#else
- nop
-#endif
-#endif /* __SHMEDIA__ */
diff --git a/gcc/config/sh/lib1funcs-4-300.asm b/gcc/config/sh/lib1funcs-4-300.asm
deleted file mode 100644
index b131877f121..00000000000
--- a/gcc/config/sh/lib1funcs-4-300.asm
+++ /dev/null
@@ -1,936 +0,0 @@
-/* Copyright (C) 2004, 2006, 2009 Free Software Foundation, Inc.
-
-This file is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3, or (at your option) any
-later version.
-
-This file 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/>. */
-
-
-/* libgcc routines for the STMicroelectronics ST40-300 CPU.
- Contributed by J"orn Rennecke joern.rennecke@st.com. */
-
-#include "lib1funcs.h"
-
-#if !__SHMEDIA__
-#ifdef L_div_table
-#if defined (__SH3__) || defined (__SH3E__) || defined (__SH4__) || defined (__SH4_SINGLE__) || defined (__SH4_SINGLE_ONLY__) || defined (__SH4_NOFPU__)
-/* This code used shld, thus is not suitable for SH1 / SH2. */
-
-/* Signed / unsigned division without use of FPU, optimized for SH4-300.
- Uses a lookup table for divisors in the range -128 .. +127, and
- div1 with case distinction for larger divisors in three more ranges.
- The code is lumped together with the table to allow the use of mova. */
-#ifdef __LITTLE_ENDIAN__
-#define L_LSB 0
-#define L_LSWMSB 1
-#define L_MSWLSB 2
-#else
-#define L_LSB 3
-#define L_LSWMSB 2
-#define L_MSWLSB 1
-#endif
-
- .global GLOBAL(udivsi3_i4i)
- .global GLOBAL(sdivsi3_i4i)
- FUNC(GLOBAL(udivsi3_i4i))
- FUNC(GLOBAL(sdivsi3_i4i))
-
- .balign 4
-LOCAL(div_ge8m): ! 10 cycles up to here
- rotcr r1 ! signed shift must use original sign from r4
- div0s r5,r4
- mov #24,r7
- shld r7,r6
- shad r0,r1
- rotcl r6
- div1 r5,r1
- swap.w r5,r0 ! detect -0x80000000 : 0x800000
- rotcl r6
- swap.w r4,r7
- div1 r5,r1
- swap.b r7,r7
- rotcl r6
- or r7,r0
- div1 r5,r1
- swap.w r0,r7
- rotcl r6
- or r7,r0
- div1 r5,r1
- add #-0x80,r0
- rotcl r6
- extu.w r0,r0
- div1 r5,r1
- neg r0,r0
- rotcl r6
- swap.w r0,r0
- div1 r5,r1
- mov.l @r15+,r7
- and r6,r0
- rotcl r6
- div1 r5,r1
- shll2 r0
- rotcl r6
- exts.b r0,r0
- div1 r5,r1
- swap.w r0,r0
- exts.w r0,r1
- exts.b r6,r0
- mov.l @r15+,r6
- rotcl r0
- rts
- sub r1,r0
- ! 31 cycles up to here
-
- .balign 4
-LOCAL(udiv_ge64k): ! 3 cycles up to here
- mov r4,r0
- shlr8 r0
- div0u
- cmp/hi r0,r5
- bt LOCAL(udiv_r8)
- mov.l r5,@-r15
- shll8 r5
- ! 7 cycles up to here
- .rept 8
- div1 r5,r0
- .endr
- extu.b r4,r1 ! 15 cycles up to here
- extu.b r0,r6
- xor r1,r0
- xor r6,r0
- swap.b r6,r6
- .rept 8
- div1 r5,r0
- .endr ! 25 cycles up to here
- extu.b r0,r0
- mov.l @r15+,r5
- or r6,r0
- mov.l @r15+,r6
- rts
- rotcl r0 ! 28 cycles up to here
-
- .balign 4
-LOCAL(udiv_r8): ! 6 cycles up to here
- mov.l r4,@-r15
- shll16 r4
- shll8 r4
- !
- shll r4
- mov r0,r1
- div1 r5,r1
- mov r4,r0
- rotcl r0
- mov.l @r15+,r4
- div1 r5,r1
- ! 12 cycles up to here
- .rept 6
- rotcl r0; div1 r5,r1
- .endr
- mov.l @r15+,r6 ! 24 cycles up to here
- rts
- rotcl r0
-
- .balign 4
-LOCAL(div_ge32k): ! 6 cycles up to here
- mov.l r7,@-r15
- swap.w r5,r6
- exts.b r6,r7
- exts.w r6,r6
- cmp/eq r6,r7
- extu.b r1,r6
- bf/s LOCAL(div_ge8m)
- cmp/hi r1,r4 ! copy sign bit of r4 into T
- rotcr r1 ! signed shift must use original sign from r4
- div0s r5,r4
- shad r0,r1
- shll8 r5
- div1 r5,r1
- mov r5,r7 ! detect r4 == 0x80000000 && r5 == 0x8000(00)
- div1 r5,r1
- shlr8 r7
- div1 r5,r1
- swap.w r4,r0
- div1 r5,r1
- swap.b r0,r0
- div1 r5,r1
- or r0,r7
- div1 r5,r1
- add #-80,r7
- div1 r5,r1
- swap.w r7,r0
- div1 r5,r1
- or r0,r7
- extu.b r1,r0
- xor r6,r1
- xor r0,r1
- exts.b r0,r0
- div1 r5,r1
- extu.w r7,r7
- div1 r5,r1
- neg r7,r7 ! upper 16 bit of r7 == 0 if r4 == 0x80000000 && r5 == 0x8000
- div1 r5,r1
- and r0,r7
- div1 r5,r1
- swap.w r7,r7 ! 26 cycles up to here.
- div1 r5,r1
- shll8 r0
- div1 r5,r1
- exts.w r7,r7
- div1 r5,r1
- add r0,r0
- div1 r5,r1
- sub r7,r0
- extu.b r1,r1
- mov.l @r15+,r7
- rotcl r1
- mov.l @r15+,r6
- add r1,r0
- mov #-8,r1
- rts
- shad r1,r5 ! 34 cycles up to here
-
- .balign 4
-GLOBAL(udivsi3_i4i):
- mov.l r6,@-r15
- extu.w r5,r6
- cmp/eq r5,r6
- mov #0x7f,r0
- bf LOCAL(udiv_ge64k)
- cmp/hi r0,r5
- bf LOCAL(udiv_le128)
- mov r4,r1
- shlr8 r1
- div0u
- shlr r1
- shll16 r6
- div1 r6,r1
- extu.b r4,r0 ! 7 cycles up to here
- .rept 8
- div1 r6,r1
- .endr ! 15 cycles up to here
- xor r1,r0 ! xor dividend with result lsb
- .rept 6
- div1 r6,r1
- .endr
- mov.l r7,@-r15 ! 21 cycles up to here
- div1 r6,r1
- extu.b r0,r7
- div1 r6,r1
- shll8 r7
- extu.w r1,r0
- xor r7,r1 ! replace lsb of result with lsb of dividend
- div1 r6,r1
- mov #0,r7
- div1 r6,r1
- !
- div1 r6,r1
- bra LOCAL(div_end)
- div1 r6,r1 ! 28 cycles up to here
-
- /* This is link-compatible with a GLOBAL(sdivsi3) call,
- but we effectively clobber only r1, macl and mach */
- /* Because negative quotients are calculated as one's complements,
- -0x80000000 divided by the smallest positive number of a number
- range (0x80, 0x8000, 0x800000) causes saturation in the one's
- complement representation, and we have to suppress the
- one's -> two's complement adjustment. Since positive numbers
- don't get such an adjustment, it's OK to also compute one's -> two's
- complement adjustment suppression for a dividend of 0. */
- .balign 4
-GLOBAL(sdivsi3_i4i):
- mov.l r6,@-r15
- exts.b r5,r6
- cmp/eq r5,r6
- mov #-1,r1
- bt/s LOCAL(div_le128)
- cmp/pz r4
- addc r4,r1
- exts.w r5,r6
- cmp/eq r5,r6
- mov #-7,r0
- bf/s LOCAL(div_ge32k)
- cmp/hi r1,r4 ! copy sign bit of r4 into T
- rotcr r1
- shll16 r6 ! 7 cycles up to here
- shad r0,r1
- div0s r5,r4
- div1 r6,r1
- mov.l r7,@-r15
- div1 r6,r1
- mov r4,r0 ! re-compute adjusted dividend
- div1 r6,r1
- mov #-31,r7
- div1 r6,r1
- shad r7,r0
- div1 r6,r1
- add r4,r0 ! adjusted dividend
- div1 r6,r1
- mov.l r8,@-r15
- div1 r6,r1
- swap.w r4,r8 ! detect special case r4 = 0x80000000, r5 = 0x80
- div1 r6,r1
- swap.b r8,r8
- xor r1,r0 ! xor dividend with result lsb
- div1 r6,r1
- div1 r6,r1
- or r5,r8
- div1 r6,r1
- add #-0x80,r8 ! r8 is 0 iff there is a match
- div1 r6,r1
- swap.w r8,r7 ! or upper 16 bits...
- div1 r6,r1
- or r7,r8 !...into lower 16 bits
- div1 r6,r1
- extu.w r8,r8
- div1 r6,r1
- extu.b r0,r7
- div1 r6,r1
- shll8 r7
- exts.w r1,r0
- xor r7,r1 ! replace lsb of result with lsb of dividend
- div1 r6,r1
- neg r8,r8 ! upper 16 bits of r8 are now 0xffff iff we want end adjm.
- div1 r6,r1
- and r0,r8
- div1 r6,r1
- swap.w r8,r7
- div1 r6,r1
- mov.l @r15+,r8 ! 58 insns, 29 cycles up to here
-LOCAL(div_end):
- div1 r6,r1
- shll8 r0
- div1 r6,r1
- exts.w r7,r7
- div1 r6,r1
- add r0,r0
- div1 r6,r1
- sub r7,r0
- extu.b r1,r1
- mov.l @r15+,r7
- rotcl r1
- mov.l @r15+,r6
- rts
- add r1,r0
-
- .balign 4
-LOCAL(udiv_le128): ! 4 cycles up to here (or 7 for mispredict)
- mova LOCAL(div_table_inv),r0
- shll2 r6
- mov.l @(r0,r6),r1
- mova LOCAL(div_table_clz),r0
- lds r4,mach
- !
- !
- !
- tst r1,r1
- !
- bt 0f
- dmulu.l r1,r4
-0: mov.b @(r0,r5),r1
- clrt
- !
- !
- sts mach,r0
- addc r4,r0
- rotcr r0
- mov.l @r15+,r6
- rts
- shld r1,r0
-
- .balign 4
-LOCAL(div_le128): ! 3 cycles up to here (or 6 for mispredict)
- mova LOCAL(div_table_inv),r0
- shll2 r6
- mov.l @(r0,r6),r1
- mova LOCAL(div_table_clz),r0
- neg r4,r6
- bf 0f
- mov r4,r6
-0: lds r6,mach
- tst r1,r1
- bt 0f
- dmulu.l r1,r6
-0: div0s r4,r5
- mov.b @(r0,r5),r1
- bt/s LOCAL(le128_neg)
- clrt
- !
- sts mach,r0
- addc r6,r0
- rotcr r0
- mov.l @r15+,r6
- rts
- shld r1,r0
-
-/* Could trap divide by zero for the cost of one cycle more mispredict penalty:
-...
- dmulu.l r1,r6
-0: div0s r4,r5
- bt/s LOCAL(le128_neg)
- tst r5,r5
- bt LOCAL(div_by_zero)
- mov.b @(r0,r5),r1
- sts mach,r0
- addc r6,r0
-...
-LOCAL(div_by_zero):
- trapa #
- .balign 4
-LOCAL(le128_neg):
- bt LOCAL(div_by_zero)
- mov.b @(r0,r5),r1
- sts mach,r0
- addc r6,r0
-... */
-
- .balign 4
-LOCAL(le128_neg):
- sts mach,r0
- addc r6,r0
- rotcr r0
- mov.l @r15+,r6
- shad r1,r0
- rts
- neg r0,r0
- ENDFUNC(GLOBAL(udivsi3_i4i))
- ENDFUNC(GLOBAL(sdivsi3_i4i))
-
-/* This table has been generated by divtab-sh4.c. */
- .balign 4
- .byte -7
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -5
- .byte -5
- .byte -5
- .byte -5
- .byte -5
- .byte -5
- .byte -5
- .byte -5
- .byte -5
- .byte -5
- .byte -5
- .byte -5
- .byte -5
- .byte -5
- .byte -5
- .byte -5
- .byte -5
- .byte -5
- .byte -5
- .byte -5
- .byte -5
- .byte -5
- .byte -5
- .byte -5
- .byte -5
- .byte -5
- .byte -5
- .byte -5
- .byte -5
- .byte -5
- .byte -5
- .byte -5
- .byte -4
- .byte -4
- .byte -4
- .byte -4
- .byte -4
- .byte -4
- .byte -4
- .byte -4
- .byte -4
- .byte -4
- .byte -4
- .byte -4
- .byte -4
- .byte -4
- .byte -4
- .byte -4
- .byte -3
- .byte -3
- .byte -3
- .byte -3
- .byte -3
- .byte -3
- .byte -3
- .byte -3
- .byte -2
- .byte -2
- .byte -2
- .byte -2
- .byte -1
- .byte -1
- .byte 0
-LOCAL(div_table_clz):
- .byte 0
- .byte 0
- .byte -1
- .byte -1
- .byte -2
- .byte -2
- .byte -2
- .byte -2
- .byte -3
- .byte -3
- .byte -3
- .byte -3
- .byte -3
- .byte -3
- .byte -3
- .byte -3
- .byte -4
- .byte -4
- .byte -4
- .byte -4
- .byte -4
- .byte -4
- .byte -4
- .byte -4
- .byte -4
- .byte -4
- .byte -4
- .byte -4
- .byte -4
- .byte -4
- .byte -4
- .byte -4
- .byte -5
- .byte -5
- .byte -5
- .byte -5
- .byte -5
- .byte -5
- .byte -5
- .byte -5
- .byte -5
- .byte -5
- .byte -5
- .byte -5
- .byte -5
- .byte -5
- .byte -5
- .byte -5
- .byte -5
- .byte -5
- .byte -5
- .byte -5
- .byte -5
- .byte -5
- .byte -5
- .byte -5
- .byte -5
- .byte -5
- .byte -5
- .byte -5
- .byte -5
- .byte -5
- .byte -5
- .byte -5
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
-/* 1/-128 .. 1/127, normalized. There is an implicit leading 1 in bit 32,
- or in bit 33 for powers of two. */
- .balign 4
- .long 0x0
- .long 0x2040811
- .long 0x4104105
- .long 0x624DD30
- .long 0x8421085
- .long 0xA6810A7
- .long 0xC9714FC
- .long 0xECF56BF
- .long 0x11111112
- .long 0x135C8114
- .long 0x15B1E5F8
- .long 0x18118119
- .long 0x1A7B9612
- .long 0x1CF06ADB
- .long 0x1F7047DD
- .long 0x21FB7813
- .long 0x24924925
- .long 0x27350B89
- .long 0x29E4129F
- .long 0x2C9FB4D9
- .long 0x2F684BDB
- .long 0x323E34A3
- .long 0x3521CFB3
- .long 0x38138139
- .long 0x3B13B13C
- .long 0x3E22CBCF
- .long 0x41414142
- .long 0x446F8657
- .long 0x47AE147B
- .long 0x4AFD6A06
- .long 0x4E5E0A73
- .long 0x51D07EAF
- .long 0x55555556
- .long 0x58ED2309
- .long 0x5C9882BA
- .long 0x60581606
- .long 0x642C8591
- .long 0x68168169
- .long 0x6C16C16D
- .long 0x702E05C1
- .long 0x745D1746
- .long 0x78A4C818
- .long 0x7D05F418
- .long 0x81818182
- .long 0x86186187
- .long 0x8ACB90F7
- .long 0x8F9C18FA
- .long 0x948B0FCE
- .long 0x9999999A
- .long 0x9EC8E952
- .long 0xA41A41A5
- .long 0xA98EF607
- .long 0xAF286BCB
- .long 0xB4E81B4F
- .long 0xBACF914D
- .long 0xC0E07039
- .long 0xC71C71C8
- .long 0xCD856891
- .long 0xD41D41D5
- .long 0xDAE6076C
- .long 0xE1E1E1E2
- .long 0xE9131AC0
- .long 0xF07C1F08
- .long 0xF81F81F9
- .long 0x0
- .long 0x4104105
- .long 0x8421085
- .long 0xC9714FC
- .long 0x11111112
- .long 0x15B1E5F8
- .long 0x1A7B9612
- .long 0x1F7047DD
- .long 0x24924925
- .long 0x29E4129F
- .long 0x2F684BDB
- .long 0x3521CFB3
- .long 0x3B13B13C
- .long 0x41414142
- .long 0x47AE147B
- .long 0x4E5E0A73
- .long 0x55555556
- .long 0x5C9882BA
- .long 0x642C8591
- .long 0x6C16C16D
- .long 0x745D1746
- .long 0x7D05F418
- .long 0x86186187
- .long 0x8F9C18FA
- .long 0x9999999A
- .long 0xA41A41A5
- .long 0xAF286BCB
- .long 0xBACF914D
- .long 0xC71C71C8
- .long 0xD41D41D5
- .long 0xE1E1E1E2
- .long 0xF07C1F08
- .long 0x0
- .long 0x8421085
- .long 0x11111112
- .long 0x1A7B9612
- .long 0x24924925
- .long 0x2F684BDB
- .long 0x3B13B13C
- .long 0x47AE147B
- .long 0x55555556
- .long 0x642C8591
- .long 0x745D1746
- .long 0x86186187
- .long 0x9999999A
- .long 0xAF286BCB
- .long 0xC71C71C8
- .long 0xE1E1E1E2
- .long 0x0
- .long 0x11111112
- .long 0x24924925
- .long 0x3B13B13C
- .long 0x55555556
- .long 0x745D1746
- .long 0x9999999A
- .long 0xC71C71C8
- .long 0x0
- .long 0x24924925
- .long 0x55555556
- .long 0x9999999A
- .long 0x0
- .long 0x55555556
- .long 0x0
- .long 0x0
-LOCAL(div_table_inv):
- .long 0x0
- .long 0x0
- .long 0x0
- .long 0x55555556
- .long 0x0
- .long 0x9999999A
- .long 0x55555556
- .long 0x24924925
- .long 0x0
- .long 0xC71C71C8
- .long 0x9999999A
- .long 0x745D1746
- .long 0x55555556
- .long 0x3B13B13C
- .long 0x24924925
- .long 0x11111112
- .long 0x0
- .long 0xE1E1E1E2
- .long 0xC71C71C8
- .long 0xAF286BCB
- .long 0x9999999A
- .long 0x86186187
- .long 0x745D1746
- .long 0x642C8591
- .long 0x55555556
- .long 0x47AE147B
- .long 0x3B13B13C
- .long 0x2F684BDB
- .long 0x24924925
- .long 0x1A7B9612
- .long 0x11111112
- .long 0x8421085
- .long 0x0
- .long 0xF07C1F08
- .long 0xE1E1E1E2
- .long 0xD41D41D5
- .long 0xC71C71C8
- .long 0xBACF914D
- .long 0xAF286BCB
- .long 0xA41A41A5
- .long 0x9999999A
- .long 0x8F9C18FA
- .long 0x86186187
- .long 0x7D05F418
- .long 0x745D1746
- .long 0x6C16C16D
- .long 0x642C8591
- .long 0x5C9882BA
- .long 0x55555556
- .long 0x4E5E0A73
- .long 0x47AE147B
- .long 0x41414142
- .long 0x3B13B13C
- .long 0x3521CFB3
- .long 0x2F684BDB
- .long 0x29E4129F
- .long 0x24924925
- .long 0x1F7047DD
- .long 0x1A7B9612
- .long 0x15B1E5F8
- .long 0x11111112
- .long 0xC9714FC
- .long 0x8421085
- .long 0x4104105
- .long 0x0
- .long 0xF81F81F9
- .long 0xF07C1F08
- .long 0xE9131AC0
- .long 0xE1E1E1E2
- .long 0xDAE6076C
- .long 0xD41D41D5
- .long 0xCD856891
- .long 0xC71C71C8
- .long 0xC0E07039
- .long 0xBACF914D
- .long 0xB4E81B4F
- .long 0xAF286BCB
- .long 0xA98EF607
- .long 0xA41A41A5
- .long 0x9EC8E952
- .long 0x9999999A
- .long 0x948B0FCE
- .long 0x8F9C18FA
- .long 0x8ACB90F7
- .long 0x86186187
- .long 0x81818182
- .long 0x7D05F418
- .long 0x78A4C818
- .long 0x745D1746
- .long 0x702E05C1
- .long 0x6C16C16D
- .long 0x68168169
- .long 0x642C8591
- .long 0x60581606
- .long 0x5C9882BA
- .long 0x58ED2309
- .long 0x55555556
- .long 0x51D07EAF
- .long 0x4E5E0A73
- .long 0x4AFD6A06
- .long 0x47AE147B
- .long 0x446F8657
- .long 0x41414142
- .long 0x3E22CBCF
- .long 0x3B13B13C
- .long 0x38138139
- .long 0x3521CFB3
- .long 0x323E34A3
- .long 0x2F684BDB
- .long 0x2C9FB4D9
- .long 0x29E4129F
- .long 0x27350B89
- .long 0x24924925
- .long 0x21FB7813
- .long 0x1F7047DD
- .long 0x1CF06ADB
- .long 0x1A7B9612
- .long 0x18118119
- .long 0x15B1E5F8
- .long 0x135C8114
- .long 0x11111112
- .long 0xECF56BF
- .long 0xC9714FC
- .long 0xA6810A7
- .long 0x8421085
- .long 0x624DD30
- .long 0x4104105
- .long 0x2040811
- /* maximum error: 0.987342 scaled: 0.921875*/
-
-#endif /* SH3 / SH4 */
-
-#endif /* L_div_table */
-#endif /* !__SHMEDIA__ */
diff --git a/gcc/config/sh/lib1funcs-Os-4-200.asm b/gcc/config/sh/lib1funcs-Os-4-200.asm
deleted file mode 100644
index aae57ccd36c..00000000000
--- a/gcc/config/sh/lib1funcs-Os-4-200.asm
+++ /dev/null
@@ -1,322 +0,0 @@
-/* Copyright (C) 2006, 2009 Free Software Foundation, Inc.
-
-This file is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3, or (at your option) any
-later version.
-
-This file 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/>. */
-
-/* Moderately Space-optimized libgcc routines for the Renesas SH /
- STMicroelectronics ST40 CPUs.
- Contributed by J"orn Rennecke joern.rennecke@st.com. */
-
-#include "lib1funcs.h"
-
-#if !__SHMEDIA__
-#ifdef L_udivsi3_i4i
-
-/* 88 bytes; sh4-200 cycle counts:
- divisor >= 2G: 11 cycles
- dividend < 2G: 48 cycles
- dividend >= 2G: divisor != 1: 54 cycles
- dividend >= 2G, divisor == 1: 22 cycles */
-#if defined (__SH_FPU_DOUBLE__) || defined (__SH4_SINGLE_ONLY__)
-!! args in r4 and r5, result in r0, clobber r1
-
- .global GLOBAL(udivsi3_i4i)
- FUNC(GLOBAL(udivsi3_i4i))
-GLOBAL(udivsi3_i4i):
- mova L1,r0
- cmp/pz r5
- sts fpscr,r1
- lds.l @r0+,fpscr
- sts.l fpul,@-r15
- bf LOCAL(huge_divisor)
- mov.l r1,@-r15
- lds r4,fpul
- cmp/pz r4
-#ifdef FMOVD_WORKS
- fmov.d dr0,@-r15
- float fpul,dr0
- fmov.d dr2,@-r15
- bt LOCAL(dividend_adjusted)
- mov #1,r1
- fmov.d @r0,dr2
- cmp/eq r1,r5
- bt LOCAL(div_by_1)
- fadd dr2,dr0
-LOCAL(dividend_adjusted):
- lds r5,fpul
- float fpul,dr2
- fdiv dr2,dr0
-LOCAL(div_by_1):
- fmov.d @r15+,dr2
- ftrc dr0,fpul
- fmov.d @r15+,dr0
-#else /* !FMOVD_WORKS */
- fmov.s DR01,@-r15
- mov #1,r1
- fmov.s DR00,@-r15
- float fpul,dr0
- fmov.s DR21,@-r15
- bt/s LOCAL(dividend_adjusted)
- fmov.s DR20,@-r15
- cmp/eq r1,r5
- bt LOCAL(div_by_1)
- fmov.s @r0+,DR20
- fmov.s @r0,DR21
- fadd dr2,dr0
-LOCAL(dividend_adjusted):
- lds r5,fpul
- float fpul,dr2
- fdiv dr2,dr0
-LOCAL(div_by_1):
- fmov.s @r15+,DR20
- fmov.s @r15+,DR21
- ftrc dr0,fpul
- fmov.s @r15+,DR00
- fmov.s @r15+,DR01
-#endif /* !FMOVD_WORKS */
- lds.l @r15+,fpscr
- sts fpul,r0
- rts
- lds.l @r15+,fpul
-
-#ifdef FMOVD_WORKS
- .p2align 3 ! make double below 8 byte aligned.
-#endif
-LOCAL(huge_divisor):
- lds r1,fpscr
- add #4,r15
- cmp/hs r5,r4
- rts
- movt r0
-
- .p2align 2
-L1:
-#ifndef FMOVD_WORKS
- .long 0x80000
-#else
- .long 0x180000
-#endif
- .double 4294967296
-
- ENDFUNC(GLOBAL(udivsi3_i4i))
-#elif !defined (__sh1__) /* !__SH_FPU_DOUBLE__ */
-
-#if 0
-/* With 36 bytes, the following would probably be the most compact
- implementation, but with 139 cycles on an sh4-200, it is extremely slow. */
-GLOBAL(udivsi3_i4i):
- mov.l r2,@-r15
- mov #0,r1
- div0u
- mov r1,r2
- mov.l r3,@-r15
- mov r1,r3
- sett
- mov r4,r0
-LOCAL(loop):
- rotcr r2
- ;
- bt/s LOCAL(end)
- cmp/gt r2,r3
- rotcl r0
- bra LOCAL(loop)
- div1 r5,r1
-LOCAL(end):
- rotcl r0
- mov.l @r15+,r3
- rts
- mov.l @r15+,r2
-#endif /* 0 */
-
-/* Size: 186 bytes jointly for udivsi3_i4i and sdivsi3_i4i
- sh4-200 run times:
- udiv small divisor: 55 cycles
- udiv large divisor: 52 cycles
- sdiv small divisor, positive result: 59 cycles
- sdiv large divisor, positive result: 56 cycles
- sdiv small divisor, negative result: 65 cycles (*)
- sdiv large divisor, negative result: 62 cycles (*)
- (*): r2 is restored in the rts delay slot and has a lingering latency
- of two more cycles. */
- .balign 4
- .global GLOBAL(udivsi3_i4i)
- FUNC(GLOBAL(udivsi3_i4i))
- FUNC(GLOBAL(sdivsi3_i4i))
-GLOBAL(udivsi3_i4i):
- sts pr,r1
- mov.l r4,@-r15
- extu.w r5,r0
- cmp/eq r5,r0
- swap.w r4,r0
- shlr16 r4
- bf/s LOCAL(large_divisor)
- div0u
- mov.l r5,@-r15
- shll16 r5
-LOCAL(sdiv_small_divisor):
- div1 r5,r4
- bsr LOCAL(div6)
- div1 r5,r4
- div1 r5,r4
- bsr LOCAL(div6)
- div1 r5,r4
- xtrct r4,r0
- xtrct r0,r4
- bsr LOCAL(div7)
- swap.w r4,r4
- div1 r5,r4
- bsr LOCAL(div7)
- div1 r5,r4
- xtrct r4,r0
- mov.l @r15+,r5
- swap.w r0,r0
- mov.l @r15+,r4
- jmp @r1
- rotcl r0
-LOCAL(div7):
- div1 r5,r4
-LOCAL(div6):
- div1 r5,r4; div1 r5,r4; div1 r5,r4
- div1 r5,r4; div1 r5,r4; rts; div1 r5,r4
-
-LOCAL(divx3):
- rotcl r0
- div1 r5,r4
- rotcl r0
- div1 r5,r4
- rotcl r0
- rts
- div1 r5,r4
-
-LOCAL(large_divisor):
- mov.l r5,@-r15
-LOCAL(sdiv_large_divisor):
- xor r4,r0
- .rept 4
- rotcl r0
- bsr LOCAL(divx3)
- div1 r5,r4
- .endr
- mov.l @r15+,r5
- mov.l @r15+,r4
- jmp @r1
- rotcl r0
- ENDFUNC(GLOBAL(udivsi3_i4i))
-
- .global GLOBAL(sdivsi3_i4i)
-GLOBAL(sdivsi3_i4i):
- mov.l r4,@-r15
- cmp/pz r5
- mov.l r5,@-r15
- bt/s LOCAL(pos_divisor)
- cmp/pz r4
- neg r5,r5
- extu.w r5,r0
- bt/s LOCAL(neg_result)
- cmp/eq r5,r0
- neg r4,r4
-LOCAL(pos_result):
- swap.w r4,r0
- bra LOCAL(sdiv_check_divisor)
- sts pr,r1
-LOCAL(pos_divisor):
- extu.w r5,r0
- bt/s LOCAL(pos_result)
- cmp/eq r5,r0
- neg r4,r4
-LOCAL(neg_result):
- mova LOCAL(negate_result),r0
- ;
- mov r0,r1
- swap.w r4,r0
- lds r2,macl
- sts pr,r2
-LOCAL(sdiv_check_divisor):
- shlr16 r4
- bf/s LOCAL(sdiv_large_divisor)
- div0u
- bra LOCAL(sdiv_small_divisor)
- shll16 r5
- .balign 4
-LOCAL(negate_result):
- neg r0,r0
- jmp @r2
- sts macl,r2
- ENDFUNC(GLOBAL(sdivsi3_i4i))
-#endif /* !__SH_FPU_DOUBLE__ */
-#endif /* L_udivsi3_i4i */
-
-#ifdef L_sdivsi3_i4i
-#if defined (__SH_FPU_DOUBLE__) || defined (__SH4_SINGLE_ONLY__)
-/* 48 bytes, 45 cycles on sh4-200 */
-!! args in r4 and r5, result in r0, clobber r1
-
- .global GLOBAL(sdivsi3_i4i)
- FUNC(GLOBAL(sdivsi3_i4i))
-GLOBAL(sdivsi3_i4i):
- sts.l fpscr,@-r15
- sts fpul,r1
- mova L1,r0
- lds.l @r0+,fpscr
- lds r4,fpul
-#ifdef FMOVD_WORKS
- fmov.d dr0,@-r15
- float fpul,dr0
- lds r5,fpul
- fmov.d dr2,@-r15
-#else
- fmov.s DR01,@-r15
- fmov.s DR00,@-r15
- float fpul,dr0
- lds r5,fpul
- fmov.s DR21,@-r15
- fmov.s DR20,@-r15
-#endif
- float fpul,dr2
- fdiv dr2,dr0
-#ifdef FMOVD_WORKS
- fmov.d @r15+,dr2
-#else
- fmov.s @r15+,DR20
- fmov.s @r15+,DR21
-#endif
- ftrc dr0,fpul
-#ifdef FMOVD_WORKS
- fmov.d @r15+,dr0
-#else
- fmov.s @r15+,DR00
- fmov.s @r15+,DR01
-#endif
- lds.l @r15+,fpscr
- sts fpul,r0
- rts
- lds r1,fpul
-
- .p2align 2
-L1:
-#ifndef FMOVD_WORKS
- .long 0x80000
-#else
- .long 0x180000
-#endif
-
- ENDFUNC(GLOBAL(sdivsi3_i4i))
-#endif /* __SH_FPU_DOUBLE__ */
-#endif /* L_sdivsi3_i4i */
-#endif /* !__SHMEDIA__ */
diff --git a/gcc/config/sh/lib1funcs.asm b/gcc/config/sh/lib1funcs.asm
deleted file mode 100644
index 2f0ca16cd91..00000000000
--- a/gcc/config/sh/lib1funcs.asm
+++ /dev/null
@@ -1,3933 +0,0 @@
-/* Copyright (C) 1994, 1995, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
- 2004, 2005, 2006, 2009
- Free Software Foundation, Inc.
-
-This file is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3, or (at your option) any
-later version.
-
-This file 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/>. */
-
-
-!! libgcc routines for the Renesas / SuperH SH CPUs.
-!! Contributed by Steve Chamberlain.
-!! sac@cygnus.com
-
-!! ashiftrt_r4_x, ___ashrsi3, ___ashlsi3, ___lshrsi3 routines
-!! recoded in assembly by Toshiyasu Morita
-!! tm@netcom.com
-
-#if defined(__ELF__) && defined(__linux__)
-.section .note.GNU-stack,"",%progbits
-.previous
-#endif
-
-/* SH2 optimizations for ___ashrsi3, ___ashlsi3, ___lshrsi3 and
- ELF local label prefixes by J"orn Rennecke
- amylaar@cygnus.com */
-
-#include "lib1funcs.h"
-
-/* t-vxworks needs to build both PIC and non-PIC versions of libgcc,
- so it is more convenient to define NO_FPSCR_VALUES here than to
- define it on the command line. */
-#if defined __vxworks && defined __PIC__
-#define NO_FPSCR_VALUES
-#endif
-
-#if ! __SH5__
-#ifdef L_ashiftrt
- .global GLOBAL(ashiftrt_r4_0)
- .global GLOBAL(ashiftrt_r4_1)
- .global GLOBAL(ashiftrt_r4_2)
- .global GLOBAL(ashiftrt_r4_3)
- .global GLOBAL(ashiftrt_r4_4)
- .global GLOBAL(ashiftrt_r4_5)
- .global GLOBAL(ashiftrt_r4_6)
- .global GLOBAL(ashiftrt_r4_7)
- .global GLOBAL(ashiftrt_r4_8)
- .global GLOBAL(ashiftrt_r4_9)
- .global GLOBAL(ashiftrt_r4_10)
- .global GLOBAL(ashiftrt_r4_11)
- .global GLOBAL(ashiftrt_r4_12)
- .global GLOBAL(ashiftrt_r4_13)
- .global GLOBAL(ashiftrt_r4_14)
- .global GLOBAL(ashiftrt_r4_15)
- .global GLOBAL(ashiftrt_r4_16)
- .global GLOBAL(ashiftrt_r4_17)
- .global GLOBAL(ashiftrt_r4_18)
- .global GLOBAL(ashiftrt_r4_19)
- .global GLOBAL(ashiftrt_r4_20)
- .global GLOBAL(ashiftrt_r4_21)
- .global GLOBAL(ashiftrt_r4_22)
- .global GLOBAL(ashiftrt_r4_23)
- .global GLOBAL(ashiftrt_r4_24)
- .global GLOBAL(ashiftrt_r4_25)
- .global GLOBAL(ashiftrt_r4_26)
- .global GLOBAL(ashiftrt_r4_27)
- .global GLOBAL(ashiftrt_r4_28)
- .global GLOBAL(ashiftrt_r4_29)
- .global GLOBAL(ashiftrt_r4_30)
- .global GLOBAL(ashiftrt_r4_31)
- .global GLOBAL(ashiftrt_r4_32)
-
- HIDDEN_FUNC(GLOBAL(ashiftrt_r4_0))
- HIDDEN_FUNC(GLOBAL(ashiftrt_r4_1))
- HIDDEN_FUNC(GLOBAL(ashiftrt_r4_2))
- HIDDEN_FUNC(GLOBAL(ashiftrt_r4_3))
- HIDDEN_FUNC(GLOBAL(ashiftrt_r4_4))
- HIDDEN_FUNC(GLOBAL(ashiftrt_r4_5))
- HIDDEN_FUNC(GLOBAL(ashiftrt_r4_6))
- HIDDEN_FUNC(GLOBAL(ashiftrt_r4_7))
- HIDDEN_FUNC(GLOBAL(ashiftrt_r4_8))
- HIDDEN_FUNC(GLOBAL(ashiftrt_r4_9))
- HIDDEN_FUNC(GLOBAL(ashiftrt_r4_10))
- HIDDEN_FUNC(GLOBAL(ashiftrt_r4_11))
- HIDDEN_FUNC(GLOBAL(ashiftrt_r4_12))
- HIDDEN_FUNC(GLOBAL(ashiftrt_r4_13))
- HIDDEN_FUNC(GLOBAL(ashiftrt_r4_14))
- HIDDEN_FUNC(GLOBAL(ashiftrt_r4_15))
- HIDDEN_FUNC(GLOBAL(ashiftrt_r4_16))
- HIDDEN_FUNC(GLOBAL(ashiftrt_r4_17))
- HIDDEN_FUNC(GLOBAL(ashiftrt_r4_18))
- HIDDEN_FUNC(GLOBAL(ashiftrt_r4_19))
- HIDDEN_FUNC(GLOBAL(ashiftrt_r4_20))
- HIDDEN_FUNC(GLOBAL(ashiftrt_r4_21))
- HIDDEN_FUNC(GLOBAL(ashiftrt_r4_22))
- HIDDEN_FUNC(GLOBAL(ashiftrt_r4_23))
- HIDDEN_FUNC(GLOBAL(ashiftrt_r4_24))
- HIDDEN_FUNC(GLOBAL(ashiftrt_r4_25))
- HIDDEN_FUNC(GLOBAL(ashiftrt_r4_26))
- HIDDEN_FUNC(GLOBAL(ashiftrt_r4_27))
- HIDDEN_FUNC(GLOBAL(ashiftrt_r4_28))
- HIDDEN_FUNC(GLOBAL(ashiftrt_r4_29))
- HIDDEN_FUNC(GLOBAL(ashiftrt_r4_30))
- HIDDEN_FUNC(GLOBAL(ashiftrt_r4_31))
- HIDDEN_FUNC(GLOBAL(ashiftrt_r4_32))
-
- .align 1
-GLOBAL(ashiftrt_r4_32):
-GLOBAL(ashiftrt_r4_31):
- rotcl r4
- rts
- subc r4,r4
-
-GLOBAL(ashiftrt_r4_30):
- shar r4
-GLOBAL(ashiftrt_r4_29):
- shar r4
-GLOBAL(ashiftrt_r4_28):
- shar r4
-GLOBAL(ashiftrt_r4_27):
- shar r4
-GLOBAL(ashiftrt_r4_26):
- shar r4
-GLOBAL(ashiftrt_r4_25):
- shar r4
-GLOBAL(ashiftrt_r4_24):
- shlr16 r4
- shlr8 r4
- rts
- exts.b r4,r4
-
-GLOBAL(ashiftrt_r4_23):
- shar r4
-GLOBAL(ashiftrt_r4_22):
- shar r4
-GLOBAL(ashiftrt_r4_21):
- shar r4
-GLOBAL(ashiftrt_r4_20):
- shar r4
-GLOBAL(ashiftrt_r4_19):
- shar r4
-GLOBAL(ashiftrt_r4_18):
- shar r4
-GLOBAL(ashiftrt_r4_17):
- shar r4
-GLOBAL(ashiftrt_r4_16):
- shlr16 r4
- rts
- exts.w r4,r4
-
-GLOBAL(ashiftrt_r4_15):
- shar r4
-GLOBAL(ashiftrt_r4_14):
- shar r4
-GLOBAL(ashiftrt_r4_13):
- shar r4
-GLOBAL(ashiftrt_r4_12):
- shar r4
-GLOBAL(ashiftrt_r4_11):
- shar r4
-GLOBAL(ashiftrt_r4_10):
- shar r4
-GLOBAL(ashiftrt_r4_9):
- shar r4
-GLOBAL(ashiftrt_r4_8):
- shar r4
-GLOBAL(ashiftrt_r4_7):
- shar r4
-GLOBAL(ashiftrt_r4_6):
- shar r4
-GLOBAL(ashiftrt_r4_5):
- shar r4
-GLOBAL(ashiftrt_r4_4):
- shar r4
-GLOBAL(ashiftrt_r4_3):
- shar r4
-GLOBAL(ashiftrt_r4_2):
- shar r4
-GLOBAL(ashiftrt_r4_1):
- rts
- shar r4
-
-GLOBAL(ashiftrt_r4_0):
- rts
- nop
-
- ENDFUNC(GLOBAL(ashiftrt_r4_0))
- ENDFUNC(GLOBAL(ashiftrt_r4_1))
- ENDFUNC(GLOBAL(ashiftrt_r4_2))
- ENDFUNC(GLOBAL(ashiftrt_r4_3))
- ENDFUNC(GLOBAL(ashiftrt_r4_4))
- ENDFUNC(GLOBAL(ashiftrt_r4_5))
- ENDFUNC(GLOBAL(ashiftrt_r4_6))
- ENDFUNC(GLOBAL(ashiftrt_r4_7))
- ENDFUNC(GLOBAL(ashiftrt_r4_8))
- ENDFUNC(GLOBAL(ashiftrt_r4_9))
- ENDFUNC(GLOBAL(ashiftrt_r4_10))
- ENDFUNC(GLOBAL(ashiftrt_r4_11))
- ENDFUNC(GLOBAL(ashiftrt_r4_12))
- ENDFUNC(GLOBAL(ashiftrt_r4_13))
- ENDFUNC(GLOBAL(ashiftrt_r4_14))
- ENDFUNC(GLOBAL(ashiftrt_r4_15))
- ENDFUNC(GLOBAL(ashiftrt_r4_16))
- ENDFUNC(GLOBAL(ashiftrt_r4_17))
- ENDFUNC(GLOBAL(ashiftrt_r4_18))
- ENDFUNC(GLOBAL(ashiftrt_r4_19))
- ENDFUNC(GLOBAL(ashiftrt_r4_20))
- ENDFUNC(GLOBAL(ashiftrt_r4_21))
- ENDFUNC(GLOBAL(ashiftrt_r4_22))
- ENDFUNC(GLOBAL(ashiftrt_r4_23))
- ENDFUNC(GLOBAL(ashiftrt_r4_24))
- ENDFUNC(GLOBAL(ashiftrt_r4_25))
- ENDFUNC(GLOBAL(ashiftrt_r4_26))
- ENDFUNC(GLOBAL(ashiftrt_r4_27))
- ENDFUNC(GLOBAL(ashiftrt_r4_28))
- ENDFUNC(GLOBAL(ashiftrt_r4_29))
- ENDFUNC(GLOBAL(ashiftrt_r4_30))
- ENDFUNC(GLOBAL(ashiftrt_r4_31))
- ENDFUNC(GLOBAL(ashiftrt_r4_32))
-#endif
-
-#ifdef L_ashiftrt_n
-
-!
-! GLOBAL(ashrsi3)
-!
-! Entry:
-!
-! r4: Value to shift
-! r5: Shifts
-!
-! Exit:
-!
-! r0: Result
-!
-! Destroys:
-!
-! (none)
-!
-
- .global GLOBAL(ashrsi3)
- HIDDEN_FUNC(GLOBAL(ashrsi3))
- .align 2
-GLOBAL(ashrsi3):
- mov #31,r0
- and r0,r5
- mova LOCAL(ashrsi3_table),r0
- mov.b @(r0,r5),r5
-#ifdef __sh1__
- add r5,r0
- jmp @r0
-#else
- braf r5
-#endif
- mov r4,r0
-
- .align 2
-LOCAL(ashrsi3_table):
- .byte LOCAL(ashrsi3_0)-LOCAL(ashrsi3_table)
- .byte LOCAL(ashrsi3_1)-LOCAL(ashrsi3_table)
- .byte LOCAL(ashrsi3_2)-LOCAL(ashrsi3_table)
- .byte LOCAL(ashrsi3_3)-LOCAL(ashrsi3_table)
- .byte LOCAL(ashrsi3_4)-LOCAL(ashrsi3_table)
- .byte LOCAL(ashrsi3_5)-LOCAL(ashrsi3_table)
- .byte LOCAL(ashrsi3_6)-LOCAL(ashrsi3_table)
- .byte LOCAL(ashrsi3_7)-LOCAL(ashrsi3_table)
- .byte LOCAL(ashrsi3_8)-LOCAL(ashrsi3_table)
- .byte LOCAL(ashrsi3_9)-LOCAL(ashrsi3_table)
- .byte LOCAL(ashrsi3_10)-LOCAL(ashrsi3_table)
- .byte LOCAL(ashrsi3_11)-LOCAL(ashrsi3_table)
- .byte LOCAL(ashrsi3_12)-LOCAL(ashrsi3_table)
- .byte LOCAL(ashrsi3_13)-LOCAL(ashrsi3_table)
- .byte LOCAL(ashrsi3_14)-LOCAL(ashrsi3_table)
- .byte LOCAL(ashrsi3_15)-LOCAL(ashrsi3_table)
- .byte LOCAL(ashrsi3_16)-LOCAL(ashrsi3_table)
- .byte LOCAL(ashrsi3_17)-LOCAL(ashrsi3_table)
- .byte LOCAL(ashrsi3_18)-LOCAL(ashrsi3_table)
- .byte LOCAL(ashrsi3_19)-LOCAL(ashrsi3_table)
- .byte LOCAL(ashrsi3_20)-LOCAL(ashrsi3_table)
- .byte LOCAL(ashrsi3_21)-LOCAL(ashrsi3_table)
- .byte LOCAL(ashrsi3_22)-LOCAL(ashrsi3_table)
- .byte LOCAL(ashrsi3_23)-LOCAL(ashrsi3_table)
- .byte LOCAL(ashrsi3_24)-LOCAL(ashrsi3_table)
- .byte LOCAL(ashrsi3_25)-LOCAL(ashrsi3_table)
- .byte LOCAL(ashrsi3_26)-LOCAL(ashrsi3_table)
- .byte LOCAL(ashrsi3_27)-LOCAL(ashrsi3_table)
- .byte LOCAL(ashrsi3_28)-LOCAL(ashrsi3_table)
- .byte LOCAL(ashrsi3_29)-LOCAL(ashrsi3_table)
- .byte LOCAL(ashrsi3_30)-LOCAL(ashrsi3_table)
- .byte LOCAL(ashrsi3_31)-LOCAL(ashrsi3_table)
-
-LOCAL(ashrsi3_31):
- rotcl r0
- rts
- subc r0,r0
-
-LOCAL(ashrsi3_30):
- shar r0
-LOCAL(ashrsi3_29):
- shar r0
-LOCAL(ashrsi3_28):
- shar r0
-LOCAL(ashrsi3_27):
- shar r0
-LOCAL(ashrsi3_26):
- shar r0
-LOCAL(ashrsi3_25):
- shar r0
-LOCAL(ashrsi3_24):
- shlr16 r0
- shlr8 r0
- rts
- exts.b r0,r0
-
-LOCAL(ashrsi3_23):
- shar r0
-LOCAL(ashrsi3_22):
- shar r0
-LOCAL(ashrsi3_21):
- shar r0
-LOCAL(ashrsi3_20):
- shar r0
-LOCAL(ashrsi3_19):
- shar r0
-LOCAL(ashrsi3_18):
- shar r0
-LOCAL(ashrsi3_17):
- shar r0
-LOCAL(ashrsi3_16):
- shlr16 r0
- rts
- exts.w r0,r0
-
-LOCAL(ashrsi3_15):
- shar r0
-LOCAL(ashrsi3_14):
- shar r0
-LOCAL(ashrsi3_13):
- shar r0
-LOCAL(ashrsi3_12):
- shar r0
-LOCAL(ashrsi3_11):
- shar r0
-LOCAL(ashrsi3_10):
- shar r0
-LOCAL(ashrsi3_9):
- shar r0
-LOCAL(ashrsi3_8):
- shar r0
-LOCAL(ashrsi3_7):
- shar r0
-LOCAL(ashrsi3_6):
- shar r0
-LOCAL(ashrsi3_5):
- shar r0
-LOCAL(ashrsi3_4):
- shar r0
-LOCAL(ashrsi3_3):
- shar r0
-LOCAL(ashrsi3_2):
- shar r0
-LOCAL(ashrsi3_1):
- rts
- shar r0
-
-LOCAL(ashrsi3_0):
- rts
- nop
-
- ENDFUNC(GLOBAL(ashrsi3))
-#endif
-
-#ifdef L_ashiftlt
-
-!
-! GLOBAL(ashlsi3)
-!
-! Entry:
-!
-! r4: Value to shift
-! r5: Shifts
-!
-! Exit:
-!
-! r0: Result
-!
-! Destroys:
-!
-! (none)
-!
- .global GLOBAL(ashlsi3)
- HIDDEN_FUNC(GLOBAL(ashlsi3))
- .align 2
-GLOBAL(ashlsi3):
- mov #31,r0
- and r0,r5
- mova LOCAL(ashlsi3_table),r0
- mov.b @(r0,r5),r5
-#ifdef __sh1__
- add r5,r0
- jmp @r0
-#else
- braf r5
-#endif
- mov r4,r0
-
- .align 2
-LOCAL(ashlsi3_table):
- .byte LOCAL(ashlsi3_0)-LOCAL(ashlsi3_table)
- .byte LOCAL(ashlsi3_1)-LOCAL(ashlsi3_table)
- .byte LOCAL(ashlsi3_2)-LOCAL(ashlsi3_table)
- .byte LOCAL(ashlsi3_3)-LOCAL(ashlsi3_table)
- .byte LOCAL(ashlsi3_4)-LOCAL(ashlsi3_table)
- .byte LOCAL(ashlsi3_5)-LOCAL(ashlsi3_table)
- .byte LOCAL(ashlsi3_6)-LOCAL(ashlsi3_table)
- .byte LOCAL(ashlsi3_7)-LOCAL(ashlsi3_table)
- .byte LOCAL(ashlsi3_8)-LOCAL(ashlsi3_table)
- .byte LOCAL(ashlsi3_9)-LOCAL(ashlsi3_table)
- .byte LOCAL(ashlsi3_10)-LOCAL(ashlsi3_table)
- .byte LOCAL(ashlsi3_11)-LOCAL(ashlsi3_table)
- .byte LOCAL(ashlsi3_12)-LOCAL(ashlsi3_table)
- .byte LOCAL(ashlsi3_13)-LOCAL(ashlsi3_table)
- .byte LOCAL(ashlsi3_14)-LOCAL(ashlsi3_table)
- .byte LOCAL(ashlsi3_15)-LOCAL(ashlsi3_table)
- .byte LOCAL(ashlsi3_16)-LOCAL(ashlsi3_table)
- .byte LOCAL(ashlsi3_17)-LOCAL(ashlsi3_table)
- .byte LOCAL(ashlsi3_18)-LOCAL(ashlsi3_table)
- .byte LOCAL(ashlsi3_19)-LOCAL(ashlsi3_table)
- .byte LOCAL(ashlsi3_20)-LOCAL(ashlsi3_table)
- .byte LOCAL(ashlsi3_21)-LOCAL(ashlsi3_table)
- .byte LOCAL(ashlsi3_22)-LOCAL(ashlsi3_table)
- .byte LOCAL(ashlsi3_23)-LOCAL(ashlsi3_table)
- .byte LOCAL(ashlsi3_24)-LOCAL(ashlsi3_table)
- .byte LOCAL(ashlsi3_25)-LOCAL(ashlsi3_table)
- .byte LOCAL(ashlsi3_26)-LOCAL(ashlsi3_table)
- .byte LOCAL(ashlsi3_27)-LOCAL(ashlsi3_table)
- .byte LOCAL(ashlsi3_28)-LOCAL(ashlsi3_table)
- .byte LOCAL(ashlsi3_29)-LOCAL(ashlsi3_table)
- .byte LOCAL(ashlsi3_30)-LOCAL(ashlsi3_table)
- .byte LOCAL(ashlsi3_31)-LOCAL(ashlsi3_table)
-
-LOCAL(ashlsi3_6):
- shll2 r0
-LOCAL(ashlsi3_4):
- shll2 r0
-LOCAL(ashlsi3_2):
- rts
- shll2 r0
-
-LOCAL(ashlsi3_7):
- shll2 r0
-LOCAL(ashlsi3_5):
- shll2 r0
-LOCAL(ashlsi3_3):
- shll2 r0
-LOCAL(ashlsi3_1):
- rts
- shll r0
-
-LOCAL(ashlsi3_14):
- shll2 r0
-LOCAL(ashlsi3_12):
- shll2 r0
-LOCAL(ashlsi3_10):
- shll2 r0
-LOCAL(ashlsi3_8):
- rts
- shll8 r0
-
-LOCAL(ashlsi3_15):
- shll2 r0
-LOCAL(ashlsi3_13):
- shll2 r0
-LOCAL(ashlsi3_11):
- shll2 r0
-LOCAL(ashlsi3_9):
- shll8 r0
- rts
- shll r0
-
-LOCAL(ashlsi3_22):
- shll2 r0
-LOCAL(ashlsi3_20):
- shll2 r0
-LOCAL(ashlsi3_18):
- shll2 r0
-LOCAL(ashlsi3_16):
- rts
- shll16 r0
-
-LOCAL(ashlsi3_23):
- shll2 r0
-LOCAL(ashlsi3_21):
- shll2 r0
-LOCAL(ashlsi3_19):
- shll2 r0
-LOCAL(ashlsi3_17):
- shll16 r0
- rts
- shll r0
-
-LOCAL(ashlsi3_30):
- shll2 r0
-LOCAL(ashlsi3_28):
- shll2 r0
-LOCAL(ashlsi3_26):
- shll2 r0
-LOCAL(ashlsi3_24):
- shll16 r0
- rts
- shll8 r0
-
-LOCAL(ashlsi3_31):
- shll2 r0
-LOCAL(ashlsi3_29):
- shll2 r0
-LOCAL(ashlsi3_27):
- shll2 r0
-LOCAL(ashlsi3_25):
- shll16 r0
- shll8 r0
- rts
- shll r0
-
-LOCAL(ashlsi3_0):
- rts
- nop
-
- ENDFUNC(GLOBAL(ashlsi3))
-#endif
-
-#ifdef L_lshiftrt
-
-!
-! GLOBAL(lshrsi3)
-!
-! Entry:
-!
-! r4: Value to shift
-! r5: Shifts
-!
-! Exit:
-!
-! r0: Result
-!
-! Destroys:
-!
-! (none)
-!
- .global GLOBAL(lshrsi3)
- HIDDEN_FUNC(GLOBAL(lshrsi3))
- .align 2
-GLOBAL(lshrsi3):
- mov #31,r0
- and r0,r5
- mova LOCAL(lshrsi3_table),r0
- mov.b @(r0,r5),r5
-#ifdef __sh1__
- add r5,r0
- jmp @r0
-#else
- braf r5
-#endif
- mov r4,r0
-
- .align 2
-LOCAL(lshrsi3_table):
- .byte LOCAL(lshrsi3_0)-LOCAL(lshrsi3_table)
- .byte LOCAL(lshrsi3_1)-LOCAL(lshrsi3_table)
- .byte LOCAL(lshrsi3_2)-LOCAL(lshrsi3_table)
- .byte LOCAL(lshrsi3_3)-LOCAL(lshrsi3_table)
- .byte LOCAL(lshrsi3_4)-LOCAL(lshrsi3_table)
- .byte LOCAL(lshrsi3_5)-LOCAL(lshrsi3_table)
- .byte LOCAL(lshrsi3_6)-LOCAL(lshrsi3_table)
- .byte LOCAL(lshrsi3_7)-LOCAL(lshrsi3_table)
- .byte LOCAL(lshrsi3_8)-LOCAL(lshrsi3_table)
- .byte LOCAL(lshrsi3_9)-LOCAL(lshrsi3_table)
- .byte LOCAL(lshrsi3_10)-LOCAL(lshrsi3_table)
- .byte LOCAL(lshrsi3_11)-LOCAL(lshrsi3_table)
- .byte LOCAL(lshrsi3_12)-LOCAL(lshrsi3_table)
- .byte LOCAL(lshrsi3_13)-LOCAL(lshrsi3_table)
- .byte LOCAL(lshrsi3_14)-LOCAL(lshrsi3_table)
- .byte LOCAL(lshrsi3_15)-LOCAL(lshrsi3_table)
- .byte LOCAL(lshrsi3_16)-LOCAL(lshrsi3_table)
- .byte LOCAL(lshrsi3_17)-LOCAL(lshrsi3_table)
- .byte LOCAL(lshrsi3_18)-LOCAL(lshrsi3_table)
- .byte LOCAL(lshrsi3_19)-LOCAL(lshrsi3_table)
- .byte LOCAL(lshrsi3_20)-LOCAL(lshrsi3_table)
- .byte LOCAL(lshrsi3_21)-LOCAL(lshrsi3_table)
- .byte LOCAL(lshrsi3_22)-LOCAL(lshrsi3_table)
- .byte LOCAL(lshrsi3_23)-LOCAL(lshrsi3_table)
- .byte LOCAL(lshrsi3_24)-LOCAL(lshrsi3_table)
- .byte LOCAL(lshrsi3_25)-LOCAL(lshrsi3_table)
- .byte LOCAL(lshrsi3_26)-LOCAL(lshrsi3_table)
- .byte LOCAL(lshrsi3_27)-LOCAL(lshrsi3_table)
- .byte LOCAL(lshrsi3_28)-LOCAL(lshrsi3_table)
- .byte LOCAL(lshrsi3_29)-LOCAL(lshrsi3_table)
- .byte LOCAL(lshrsi3_30)-LOCAL(lshrsi3_table)
- .byte LOCAL(lshrsi3_31)-LOCAL(lshrsi3_table)
-
-LOCAL(lshrsi3_6):
- shlr2 r0
-LOCAL(lshrsi3_4):
- shlr2 r0
-LOCAL(lshrsi3_2):
- rts
- shlr2 r0
-
-LOCAL(lshrsi3_7):
- shlr2 r0
-LOCAL(lshrsi3_5):
- shlr2 r0
-LOCAL(lshrsi3_3):
- shlr2 r0
-LOCAL(lshrsi3_1):
- rts
- shlr r0
-
-LOCAL(lshrsi3_14):
- shlr2 r0
-LOCAL(lshrsi3_12):
- shlr2 r0
-LOCAL(lshrsi3_10):
- shlr2 r0
-LOCAL(lshrsi3_8):
- rts
- shlr8 r0
-
-LOCAL(lshrsi3_15):
- shlr2 r0
-LOCAL(lshrsi3_13):
- shlr2 r0
-LOCAL(lshrsi3_11):
- shlr2 r0
-LOCAL(lshrsi3_9):
- shlr8 r0
- rts
- shlr r0
-
-LOCAL(lshrsi3_22):
- shlr2 r0
-LOCAL(lshrsi3_20):
- shlr2 r0
-LOCAL(lshrsi3_18):
- shlr2 r0
-LOCAL(lshrsi3_16):
- rts
- shlr16 r0
-
-LOCAL(lshrsi3_23):
- shlr2 r0
-LOCAL(lshrsi3_21):
- shlr2 r0
-LOCAL(lshrsi3_19):
- shlr2 r0
-LOCAL(lshrsi3_17):
- shlr16 r0
- rts
- shlr r0
-
-LOCAL(lshrsi3_30):
- shlr2 r0
-LOCAL(lshrsi3_28):
- shlr2 r0
-LOCAL(lshrsi3_26):
- shlr2 r0
-LOCAL(lshrsi3_24):
- shlr16 r0
- rts
- shlr8 r0
-
-LOCAL(lshrsi3_31):
- shlr2 r0
-LOCAL(lshrsi3_29):
- shlr2 r0
-LOCAL(lshrsi3_27):
- shlr2 r0
-LOCAL(lshrsi3_25):
- shlr16 r0
- shlr8 r0
- rts
- shlr r0
-
-LOCAL(lshrsi3_0):
- rts
- nop
-
- ENDFUNC(GLOBAL(lshrsi3))
-#endif
-
-#ifdef L_movmem
- .text
- .balign 4
- .global GLOBAL(movmem)
- HIDDEN_FUNC(GLOBAL(movmem))
- HIDDEN_ALIAS(movstr,movmem)
- /* This would be a lot simpler if r6 contained the byte count
- minus 64, and we wouldn't be called here for a byte count of 64. */
-GLOBAL(movmem):
- sts.l pr,@-r15
- shll2 r6
- bsr GLOBAL(movmemSI52+2)
- mov.l @(48,r5),r0
- .balign 4
-LOCAL(movmem_loop): /* Reached with rts */
- mov.l @(60,r5),r0
- add #-64,r6
- mov.l r0,@(60,r4)
- tst r6,r6
- mov.l @(56,r5),r0
- bt LOCAL(movmem_done)
- mov.l r0,@(56,r4)
- cmp/pl r6
- mov.l @(52,r5),r0
- add #64,r5
- mov.l r0,@(52,r4)
- add #64,r4
- bt GLOBAL(movmemSI52)
-! done all the large groups, do the remainder
-! jump to movmem+
- mova GLOBAL(movmemSI4)+4,r0
- add r6,r0
- jmp @r0
-LOCAL(movmem_done): ! share slot insn, works out aligned.
- lds.l @r15+,pr
- mov.l r0,@(56,r4)
- mov.l @(52,r5),r0
- rts
- mov.l r0,@(52,r4)
- .balign 4
-! ??? We need aliases movstr* for movmem* for the older libraries. These
-! aliases will be removed at the some point in the future.
- .global GLOBAL(movmemSI64)
- HIDDEN_FUNC(GLOBAL(movmemSI64))
- HIDDEN_ALIAS(movstrSI64,movmemSI64)
-GLOBAL(movmemSI64):
- mov.l @(60,r5),r0
- mov.l r0,@(60,r4)
- .global GLOBAL(movmemSI60)
- HIDDEN_FUNC(GLOBAL(movmemSI60))
- HIDDEN_ALIAS(movstrSI60,movmemSI60)
-GLOBAL(movmemSI60):
- mov.l @(56,r5),r0
- mov.l r0,@(56,r4)
- .global GLOBAL(movmemSI56)
- HIDDEN_FUNC(GLOBAL(movmemSI56))
- HIDDEN_ALIAS(movstrSI56,movmemSI56)
-GLOBAL(movmemSI56):
- mov.l @(52,r5),r0
- mov.l r0,@(52,r4)
- .global GLOBAL(movmemSI52)
- HIDDEN_FUNC(GLOBAL(movmemSI52))
- HIDDEN_ALIAS(movstrSI52,movmemSI52)
-GLOBAL(movmemSI52):
- mov.l @(48,r5),r0
- mov.l r0,@(48,r4)
- .global GLOBAL(movmemSI48)
- HIDDEN_FUNC(GLOBAL(movmemSI48))
- HIDDEN_ALIAS(movstrSI48,movmemSI48)
-GLOBAL(movmemSI48):
- mov.l @(44,r5),r0
- mov.l r0,@(44,r4)
- .global GLOBAL(movmemSI44)
- HIDDEN_FUNC(GLOBAL(movmemSI44))
- HIDDEN_ALIAS(movstrSI44,movmemSI44)
-GLOBAL(movmemSI44):
- mov.l @(40,r5),r0
- mov.l r0,@(40,r4)
- .global GLOBAL(movmemSI40)
- HIDDEN_FUNC(GLOBAL(movmemSI40))
- HIDDEN_ALIAS(movstrSI40,movmemSI40)
-GLOBAL(movmemSI40):
- mov.l @(36,r5),r0
- mov.l r0,@(36,r4)
- .global GLOBAL(movmemSI36)
- HIDDEN_FUNC(GLOBAL(movmemSI36))
- HIDDEN_ALIAS(movstrSI36,movmemSI36)
-GLOBAL(movmemSI36):
- mov.l @(32,r5),r0
- mov.l r0,@(32,r4)
- .global GLOBAL(movmemSI32)
- HIDDEN_FUNC(GLOBAL(movmemSI32))
- HIDDEN_ALIAS(movstrSI32,movmemSI32)
-GLOBAL(movmemSI32):
- mov.l @(28,r5),r0
- mov.l r0,@(28,r4)
- .global GLOBAL(movmemSI28)
- HIDDEN_FUNC(GLOBAL(movmemSI28))
- HIDDEN_ALIAS(movstrSI28,movmemSI28)
-GLOBAL(movmemSI28):
- mov.l @(24,r5),r0
- mov.l r0,@(24,r4)
- .global GLOBAL(movmemSI24)
- HIDDEN_FUNC(GLOBAL(movmemSI24))
- HIDDEN_ALIAS(movstrSI24,movmemSI24)
-GLOBAL(movmemSI24):
- mov.l @(20,r5),r0
- mov.l r0,@(20,r4)
- .global GLOBAL(movmemSI20)
- HIDDEN_FUNC(GLOBAL(movmemSI20))
- HIDDEN_ALIAS(movstrSI20,movmemSI20)
-GLOBAL(movmemSI20):
- mov.l @(16,r5),r0
- mov.l r0,@(16,r4)
- .global GLOBAL(movmemSI16)
- HIDDEN_FUNC(GLOBAL(movmemSI16))
- HIDDEN_ALIAS(movstrSI16,movmemSI16)
-GLOBAL(movmemSI16):
- mov.l @(12,r5),r0
- mov.l r0,@(12,r4)
- .global GLOBAL(movmemSI12)
- HIDDEN_FUNC(GLOBAL(movmemSI12))
- HIDDEN_ALIAS(movstrSI12,movmemSI12)
-GLOBAL(movmemSI12):
- mov.l @(8,r5),r0
- mov.l r0,@(8,r4)
- .global GLOBAL(movmemSI8)
- HIDDEN_FUNC(GLOBAL(movmemSI8))
- HIDDEN_ALIAS(movstrSI8,movmemSI8)
-GLOBAL(movmemSI8):
- mov.l @(4,r5),r0
- mov.l r0,@(4,r4)
- .global GLOBAL(movmemSI4)
- HIDDEN_FUNC(GLOBAL(movmemSI4))
- HIDDEN_ALIAS(movstrSI4,movmemSI4)
-GLOBAL(movmemSI4):
- mov.l @(0,r5),r0
- rts
- mov.l r0,@(0,r4)
-
- ENDFUNC(GLOBAL(movmemSI64))
- ENDFUNC(GLOBAL(movmemSI60))
- ENDFUNC(GLOBAL(movmemSI56))
- ENDFUNC(GLOBAL(movmemSI52))
- ENDFUNC(GLOBAL(movmemSI48))
- ENDFUNC(GLOBAL(movmemSI44))
- ENDFUNC(GLOBAL(movmemSI40))
- ENDFUNC(GLOBAL(movmemSI36))
- ENDFUNC(GLOBAL(movmemSI32))
- ENDFUNC(GLOBAL(movmemSI28))
- ENDFUNC(GLOBAL(movmemSI24))
- ENDFUNC(GLOBAL(movmemSI20))
- ENDFUNC(GLOBAL(movmemSI16))
- ENDFUNC(GLOBAL(movmemSI12))
- ENDFUNC(GLOBAL(movmemSI8))
- ENDFUNC(GLOBAL(movmemSI4))
- ENDFUNC(GLOBAL(movmem))
-#endif
-
-#ifdef L_movmem_i4
- .text
- .global GLOBAL(movmem_i4_even)
- .global GLOBAL(movmem_i4_odd)
- .global GLOBAL(movmemSI12_i4)
-
- HIDDEN_FUNC(GLOBAL(movmem_i4_even))
- HIDDEN_FUNC(GLOBAL(movmem_i4_odd))
- HIDDEN_FUNC(GLOBAL(movmemSI12_i4))
-
- HIDDEN_ALIAS(movstr_i4_even,movmem_i4_even)
- HIDDEN_ALIAS(movstr_i4_odd,movmem_i4_odd)
- HIDDEN_ALIAS(movstrSI12_i4,movmemSI12_i4)
-
- .p2align 5
-L_movmem_2mod4_end:
- mov.l r0,@(16,r4)
- rts
- mov.l r1,@(20,r4)
-
- .p2align 2
-
-GLOBAL(movmem_i4_even):
- mov.l @r5+,r0
- bra L_movmem_start_even
- mov.l @r5+,r1
-
-GLOBAL(movmem_i4_odd):
- mov.l @r5+,r1
- add #-4,r4
- mov.l @r5+,r2
- mov.l @r5+,r3
- mov.l r1,@(4,r4)
- mov.l r2,@(8,r4)
-
-L_movmem_loop:
- mov.l r3,@(12,r4)
- dt r6
- mov.l @r5+,r0
- bt/s L_movmem_2mod4_end
- mov.l @r5+,r1
- add #16,r4
-L_movmem_start_even:
- mov.l @r5+,r2
- mov.l @r5+,r3
- mov.l r0,@r4
- dt r6
- mov.l r1,@(4,r4)
- bf/s L_movmem_loop
- mov.l r2,@(8,r4)
- rts
- mov.l r3,@(12,r4)
-
- ENDFUNC(GLOBAL(movmem_i4_even))
- ENDFUNC(GLOBAL(movmem_i4_odd))
-
- .p2align 4
-GLOBAL(movmemSI12_i4):
- mov.l @r5,r0
- mov.l @(4,r5),r1
- mov.l @(8,r5),r2
- mov.l r0,@r4
- mov.l r1,@(4,r4)
- rts
- mov.l r2,@(8,r4)
-
- ENDFUNC(GLOBAL(movmemSI12_i4))
-#endif
-
-#ifdef L_mulsi3
-
-
- .global GLOBAL(mulsi3)
- HIDDEN_FUNC(GLOBAL(mulsi3))
-
-! r4 = aabb
-! r5 = ccdd
-! r0 = aabb*ccdd via partial products
-!
-! if aa == 0 and cc = 0
-! r0 = bb*dd
-!
-! else
-! aa = bb*dd + (aa*dd*65536) + (cc*bb*65536)
-!
-
-GLOBAL(mulsi3):
- mulu.w r4,r5 ! multiply the lsws macl=bb*dd
- mov r5,r3 ! r3 = ccdd
- swap.w r4,r2 ! r2 = bbaa
- xtrct r2,r3 ! r3 = aacc
- tst r3,r3 ! msws zero ?
- bf hiset
- rts ! yes - then we have the answer
- sts macl,r0
-
-hiset: sts macl,r0 ! r0 = bb*dd
- mulu.w r2,r5 ! brewing macl = aa*dd
- sts macl,r1
- mulu.w r3,r4 ! brewing macl = cc*bb
- sts macl,r2
- add r1,r2
- shll16 r2
- rts
- add r2,r0
-
- ENDFUNC(GLOBAL(mulsi3))
-#endif
-#endif /* ! __SH5__ */
-#ifdef L_sdivsi3_i4
- .title "SH DIVIDE"
-!! 4 byte integer Divide code for the Renesas SH
-#ifdef __SH4__
-!! args in r4 and r5, result in fpul, clobber dr0, dr2
-
- .global GLOBAL(sdivsi3_i4)
- HIDDEN_FUNC(GLOBAL(sdivsi3_i4))
-GLOBAL(sdivsi3_i4):
- lds r4,fpul
- float fpul,dr0
- lds r5,fpul
- float fpul,dr2
- fdiv dr2,dr0
- rts
- ftrc dr0,fpul
-
- ENDFUNC(GLOBAL(sdivsi3_i4))
-#elif defined(__SH4_SINGLE__) || defined(__SH4_SINGLE_ONLY__) || (defined (__SH5__) && ! defined __SH4_NOFPU__)
-!! args in r4 and r5, result in fpul, clobber r2, dr0, dr2
-
-#if ! __SH5__ || __SH5__ == 32
-#if __SH5__
- .mode SHcompact
-#endif
- .global GLOBAL(sdivsi3_i4)
- HIDDEN_FUNC(GLOBAL(sdivsi3_i4))
-GLOBAL(sdivsi3_i4):
- sts.l fpscr,@-r15
- mov #8,r2
- swap.w r2,r2
- lds r2,fpscr
- lds r4,fpul
- float fpul,dr0
- lds r5,fpul
- float fpul,dr2
- fdiv dr2,dr0
- ftrc dr0,fpul
- rts
- lds.l @r15+,fpscr
-
- ENDFUNC(GLOBAL(sdivsi3_i4))
-#endif /* ! __SH5__ || __SH5__ == 32 */
-#endif /* ! __SH4__ */
-#endif
-
-#ifdef L_sdivsi3
-/* __SH4_SINGLE_ONLY__ keeps this part for link compatibility with
- sh2e/sh3e code. */
-#if (! defined(__SH4__) && ! defined (__SH4_SINGLE__)) || defined (__linux__)
-!!
-!! Steve Chamberlain
-!! sac@cygnus.com
-!!
-!!
-
-!! args in r4 and r5, result in r0 clobber r1, r2, r3, and t bit
-
- .global GLOBAL(sdivsi3)
-#if __SHMEDIA__
-#if __SH5__ == 32
- .section .text..SHmedia32,"ax"
-#else
- .text
-#endif
- .align 2
-#if 0
-/* The assembly code that follows is a hand-optimized version of the C
- code that follows. Note that the registers that are modified are
- exactly those listed as clobbered in the patterns divsi3_i1 and
- divsi3_i1_media.
-
-int __sdivsi3 (i, j)
- int i, j;
-{
- register unsigned long long r18 asm ("r18");
- register unsigned long long r19 asm ("r19");
- register unsigned long long r0 asm ("r0") = 0;
- register unsigned long long r1 asm ("r1") = 1;
- register int r2 asm ("r2") = i >> 31;
- register int r3 asm ("r3") = j >> 31;
-
- r2 = r2 ? r2 : r1;
- r3 = r3 ? r3 : r1;
- r18 = i * r2;
- r19 = j * r3;
- r2 *= r3;
-
- r19 <<= 31;
- r1 <<= 31;
- do
- if (r18 >= r19)
- r0 |= r1, r18 -= r19;
- while (r19 >>= 1, r1 >>= 1);
-
- return r2 * (int)r0;
-}
-*/
-GLOBAL(sdivsi3):
- pt/l LOCAL(sdivsi3_dontadd), tr2
- pt/l LOCAL(sdivsi3_loop), tr1
- ptabs/l r18, tr0
- movi 0, r0
- movi 1, r1
- shari.l r4, 31, r2
- shari.l r5, 31, r3
- cmveq r2, r1, r2
- cmveq r3, r1, r3
- muls.l r4, r2, r18
- muls.l r5, r3, r19
- muls.l r2, r3, r2
- shlli r19, 31, r19
- shlli r1, 31, r1
-LOCAL(sdivsi3_loop):
- bgtu r19, r18, tr2
- or r0, r1, r0
- sub r18, r19, r18
-LOCAL(sdivsi3_dontadd):
- shlri r1, 1, r1
- shlri r19, 1, r19
- bnei r1, 0, tr1
- muls.l r0, r2, r0
- add.l r0, r63, r0
- blink tr0, r63
-#elif 0 /* ! 0 */
- // inputs: r4,r5
- // clobbered: r1,r2,r3,r18,r19,r20,r21,r25,tr0
- // result in r0
-GLOBAL(sdivsi3):
- // can create absolute value without extra latency,
- // but dependent on proper sign extension of inputs:
- // shari.l r5,31,r2
- // xor r5,r2,r20
- // sub r20,r2,r20 // r20 is now absolute value of r5, zero-extended.
- shari.l r5,31,r2
- ori r2,1,r2
- muls.l r5,r2,r20 // r20 is now absolute value of r5, zero-extended.
- movi 0xffffffffffffbb0c,r19 // shift count eqiv 76
- shari.l r4,31,r3
- nsb r20,r0
- shlld r20,r0,r25
- shlri r25,48,r25
- sub r19,r25,r1
- mmulfx.w r1,r1,r2
- mshflo.w r1,r63,r1
- // If r4 was to be used in-place instead of r21, could use this sequence
- // to compute absolute:
- // sub r63,r4,r19 // compute absolute value of r4
- // shlri r4,32,r3 // into lower 32 bit of r4, keeping
- // mcmv r19,r3,r4 // the sign in the upper 32 bits intact.
- ori r3,1,r3
- mmulfx.w r25,r2,r2
- sub r19,r0,r0
- muls.l r4,r3,r21
- msub.w r1,r2,r2
- addi r2,-2,r1
- mulu.l r21,r1,r19
- mmulfx.w r2,r2,r2
- shlli r1,15,r1
- shlrd r19,r0,r19
- mulu.l r19,r20,r3
- mmacnfx.wl r25,r2,r1
- ptabs r18,tr0
- sub r21,r3,r25
-
- mulu.l r25,r1,r2
- addi r0,14,r0
- xor r4,r5,r18
- shlrd r2,r0,r2
- mulu.l r2,r20,r3
- add r19,r2,r19
- shari.l r18,31,r18
- sub r25,r3,r25
-
- mulu.l r25,r1,r2
- sub r25,r20,r25
- add r19,r18,r19
- shlrd r2,r0,r2
- mulu.l r2,r20,r3
- addi r25,1,r25
- add r19,r2,r19
-
- cmpgt r25,r3,r25
- add.l r19,r25,r0
- xor r0,r18,r0
- blink tr0,r63
-#else /* ! 0 && ! 0 */
-
- // inputs: r4,r5
- // clobbered: r1,r18,r19,r20,r21,r25,tr0
- // result in r0
- HIDDEN_FUNC(GLOBAL(sdivsi3_2))
-#ifndef __pic__
- FUNC(GLOBAL(sdivsi3))
-GLOBAL(sdivsi3): /* this is the shcompact entry point */
- // The special SHmedia entry point sdivsi3_1 prevents accidental linking
- // with the SHcompact implementation, which clobbers tr1 / tr2.
- .global GLOBAL(sdivsi3_1)
-GLOBAL(sdivsi3_1):
- .global GLOBAL(div_table_internal)
- movi (GLOBAL(div_table_internal) >> 16) & 65535, r20
- shori GLOBAL(div_table_internal) & 65535, r20
-#endif
- .global GLOBAL(sdivsi3_2)
- // div_table in r20
- // clobbered: r1,r18,r19,r21,r25,tr0
-GLOBAL(sdivsi3_2):
- nsb r5, r1
- shlld r5, r1, r25 // normalize; [-2 ..1, 1..2) in s2.62
- shari r25, 58, r21 // extract 5(6) bit index (s2.4 with hole -1..1)
- ldx.ub r20, r21, r19 // u0.8
- shari r25, 32, r25 // normalize to s2.30
- shlli r21, 1, r21
- muls.l r25, r19, r19 // s2.38
- ldx.w r20, r21, r21 // s2.14
- ptabs r18, tr0
- shari r19, 24, r19 // truncate to s2.14
- sub r21, r19, r19 // some 11 bit inverse in s1.14
- muls.l r19, r19, r21 // u0.28
- sub r63, r1, r1
- addi r1, 92, r1
- muls.l r25, r21, r18 // s2.58
- shlli r19, 45, r19 // multiply by two and convert to s2.58
- /* bubble */
- sub r19, r18, r18
- shari r18, 28, r18 // some 22 bit inverse in s1.30
- muls.l r18, r25, r0 // s2.60
- muls.l r18, r4, r25 // s32.30
- /* bubble */
- shari r0, 16, r19 // s-16.44
- muls.l r19, r18, r19 // s-16.74
- shari r25, 63, r0
- shari r4, 14, r18 // s19.-14
- shari r19, 30, r19 // s-16.44
- muls.l r19, r18, r19 // s15.30
- xor r21, r0, r21 // You could also use the constant 1 << 27.
- add r21, r25, r21
- sub r21, r19, r21
- shard r21, r1, r21
- sub r21, r0, r0
- blink tr0, r63
-#ifndef __pic__
- ENDFUNC(GLOBAL(sdivsi3))
-#endif
- ENDFUNC(GLOBAL(sdivsi3_2))
-#endif
-#elif defined __SHMEDIA__
-/* m5compact-nofpu */
- // clobbered: r18,r19,r20,r21,r25,tr0,tr1,tr2
- .mode SHmedia
- .section .text..SHmedia32,"ax"
- .align 2
- FUNC(GLOBAL(sdivsi3))
-GLOBAL(sdivsi3):
- pt/l LOCAL(sdivsi3_dontsub), tr0
- pt/l LOCAL(sdivsi3_loop), tr1
- ptabs/l r18,tr2
- shari.l r4,31,r18
- shari.l r5,31,r19
- xor r4,r18,r20
- xor r5,r19,r21
- sub.l r20,r18,r20
- sub.l r21,r19,r21
- xor r18,r19,r19
- shlli r21,32,r25
- addi r25,-1,r21
- addz.l r20,r63,r20
-LOCAL(sdivsi3_loop):
- shlli r20,1,r20
- bgeu/u r21,r20,tr0
- sub r20,r21,r20
-LOCAL(sdivsi3_dontsub):
- addi.l r25,-1,r25
- bnei r25,-32,tr1
- xor r20,r19,r20
- sub.l r20,r19,r0
- blink tr2,r63
- ENDFUNC(GLOBAL(sdivsi3))
-#else /* ! __SHMEDIA__ */
- FUNC(GLOBAL(sdivsi3))
-GLOBAL(sdivsi3):
- mov r4,r1
- mov r5,r0
-
- tst r0,r0
- bt div0
- mov #0,r2
- div0s r2,r1
- subc r3,r3
- subc r2,r1
- div0s r0,r3
- rotcl r1
- div1 r0,r3
- rotcl r1
- div1 r0,r3
- rotcl r1
- div1 r0,r3
- rotcl r1
- div1 r0,r3
- rotcl r1
- div1 r0,r3
- rotcl r1
- div1 r0,r3
- rotcl r1
- div1 r0,r3
- rotcl r1
- div1 r0,r3
- rotcl r1
- div1 r0,r3
- rotcl r1
- div1 r0,r3
- rotcl r1
- div1 r0,r3
- rotcl r1
- div1 r0,r3
- rotcl r1
- div1 r0,r3
- rotcl r1
- div1 r0,r3
- rotcl r1
- div1 r0,r3
- rotcl r1
- div1 r0,r3
- rotcl r1
- div1 r0,r3
- rotcl r1
- div1 r0,r3
- rotcl r1
- div1 r0,r3
- rotcl r1
- div1 r0,r3
- rotcl r1
- div1 r0,r3
- rotcl r1
- div1 r0,r3
- rotcl r1
- div1 r0,r3
- rotcl r1
- div1 r0,r3
- rotcl r1
- div1 r0,r3
- rotcl r1
- div1 r0,r3
- rotcl r1
- div1 r0,r3
- rotcl r1
- div1 r0,r3
- rotcl r1
- div1 r0,r3
- rotcl r1
- div1 r0,r3
- rotcl r1
- div1 r0,r3
- rotcl r1
- div1 r0,r3
- rotcl r1
- addc r2,r1
- rts
- mov r1,r0
-
-
-div0: rts
- mov #0,r0
-
- ENDFUNC(GLOBAL(sdivsi3))
-#endif /* ! __SHMEDIA__ */
-#endif /* ! __SH4__ */
-#endif
-#ifdef L_udivsi3_i4
-
- .title "SH DIVIDE"
-!! 4 byte integer Divide code for the Renesas SH
-#ifdef __SH4__
-!! args in r4 and r5, result in fpul, clobber r0, r1, r4, r5, dr0, dr2, dr4,
-!! and t bit
-
- .global GLOBAL(udivsi3_i4)
- HIDDEN_FUNC(GLOBAL(udivsi3_i4))
-GLOBAL(udivsi3_i4):
- mov #1,r1
- cmp/hi r1,r5
- bf trivial
- rotr r1
- xor r1,r4
- lds r4,fpul
- mova L1,r0
-#ifdef FMOVD_WORKS
- fmov.d @r0+,dr4
-#else
- fmov.s @r0+,DR40
- fmov.s @r0,DR41
-#endif
- float fpul,dr0
- xor r1,r5
- lds r5,fpul
- float fpul,dr2
- fadd dr4,dr0
- fadd dr4,dr2
- fdiv dr2,dr0
- rts
- ftrc dr0,fpul
-
-trivial:
- rts
- lds r4,fpul
-
- .align 2
-#ifdef FMOVD_WORKS
- .align 3 ! make double below 8 byte aligned.
-#endif
-L1:
- .double 2147483648
-
- ENDFUNC(GLOBAL(udivsi3_i4))
-#elif defined (__SH5__) && ! defined (__SH4_NOFPU__)
-#if ! __SH5__ || __SH5__ == 32
-!! args in r4 and r5, result in fpul, clobber r20, r21, dr0, fr33
- .mode SHmedia
- .global GLOBAL(udivsi3_i4)
- HIDDEN_FUNC(GLOBAL(udivsi3_i4))
-GLOBAL(udivsi3_i4):
- addz.l r4,r63,r20
- addz.l r5,r63,r21
- fmov.qd r20,dr0
- fmov.qd r21,dr32
- ptabs r18,tr0
- float.qd dr0,dr0
- float.qd dr32,dr32
- fdiv.d dr0,dr32,dr0
- ftrc.dq dr0,dr32
- fmov.s fr33,fr32
- blink tr0,r63
-
- ENDFUNC(GLOBAL(udivsi3_i4))
-#endif /* ! __SH5__ || __SH5__ == 32 */
-#elif defined(__SH4_SINGLE__) || defined(__SH4_SINGLE_ONLY__)
-!! args in r4 and r5, result in fpul, clobber r0, r1, r4, r5, dr0, dr2, dr4
-
- .global GLOBAL(udivsi3_i4)
- HIDDEN_FUNC(GLOBAL(udivsi3_i4))
-GLOBAL(udivsi3_i4):
- mov #1,r1
- cmp/hi r1,r5
- bf trivial
- sts.l fpscr,@-r15
- mova L1,r0
- lds.l @r0+,fpscr
- rotr r1
- xor r1,r4
- lds r4,fpul
-#ifdef FMOVD_WORKS
- fmov.d @r0+,dr4
-#else
- fmov.s @r0+,DR40
- fmov.s @r0,DR41
-#endif
- float fpul,dr0
- xor r1,r5
- lds r5,fpul
- float fpul,dr2
- fadd dr4,dr0
- fadd dr4,dr2
- fdiv dr2,dr0
- ftrc dr0,fpul
- rts
- lds.l @r15+,fpscr
-
-#ifdef FMOVD_WORKS
- .align 3 ! make double below 8 byte aligned.
-#endif
-trivial:
- rts
- lds r4,fpul
-
- .align 2
-L1:
-#ifndef FMOVD_WORKS
- .long 0x80000
-#else
- .long 0x180000
-#endif
- .double 2147483648
-
- ENDFUNC(GLOBAL(udivsi3_i4))
-#endif /* ! __SH4__ */
-#endif
-
-#ifdef L_udivsi3
-/* __SH4_SINGLE_ONLY__ keeps this part for link compatibility with
- sh2e/sh3e code. */
-#if (! defined(__SH4__) && ! defined (__SH4_SINGLE__)) || defined (__linux__)
-
-!! args in r4 and r5, result in r0, clobbers r4, pr, and t bit
- .global GLOBAL(udivsi3)
- HIDDEN_FUNC(GLOBAL(udivsi3))
-
-#if __SHMEDIA__
-#if __SH5__ == 32
- .section .text..SHmedia32,"ax"
-#else
- .text
-#endif
- .align 2
-#if 0
-/* The assembly code that follows is a hand-optimized version of the C
- code that follows. Note that the registers that are modified are
- exactly those listed as clobbered in the patterns udivsi3_i1 and
- udivsi3_i1_media.
-
-unsigned
-__udivsi3 (i, j)
- unsigned i, j;
-{
- register unsigned long long r0 asm ("r0") = 0;
- register unsigned long long r18 asm ("r18") = 1;
- register unsigned long long r4 asm ("r4") = i;
- register unsigned long long r19 asm ("r19") = j;
-
- r19 <<= 31;
- r18 <<= 31;
- do
- if (r4 >= r19)
- r0 |= r18, r4 -= r19;
- while (r19 >>= 1, r18 >>= 1);
-
- return r0;
-}
-*/
-GLOBAL(udivsi3):
- pt/l LOCAL(udivsi3_dontadd), tr2
- pt/l LOCAL(udivsi3_loop), tr1
- ptabs/l r18, tr0
- movi 0, r0
- movi 1, r18
- addz.l r5, r63, r19
- addz.l r4, r63, r4
- shlli r19, 31, r19
- shlli r18, 31, r18
-LOCAL(udivsi3_loop):
- bgtu r19, r4, tr2
- or r0, r18, r0
- sub r4, r19, r4
-LOCAL(udivsi3_dontadd):
- shlri r18, 1, r18
- shlri r19, 1, r19
- bnei r18, 0, tr1
- blink tr0, r63
-#else
-GLOBAL(udivsi3):
- // inputs: r4,r5
- // clobbered: r18,r19,r20,r21,r22,r25,tr0
- // result in r0.
- addz.l r5,r63,r22
- nsb r22,r0
- shlld r22,r0,r25
- shlri r25,48,r25
- movi 0xffffffffffffbb0c,r20 // shift count eqiv 76
- sub r20,r25,r21
- mmulfx.w r21,r21,r19
- mshflo.w r21,r63,r21
- ptabs r18,tr0
- mmulfx.w r25,r19,r19
- sub r20,r0,r0
- /* bubble */
- msub.w r21,r19,r19
- addi r19,-2,r21 /* It would be nice for scheduling to do this add to r21
- before the msub.w, but we need a different value for
- r19 to keep errors under control. */
- mulu.l r4,r21,r18
- mmulfx.w r19,r19,r19
- shlli r21,15,r21
- shlrd r18,r0,r18
- mulu.l r18,r22,r20
- mmacnfx.wl r25,r19,r21
- /* bubble */
- sub r4,r20,r25
-
- mulu.l r25,r21,r19
- addi r0,14,r0
- /* bubble */
- shlrd r19,r0,r19
- mulu.l r19,r22,r20
- add r18,r19,r18
- /* bubble */
- sub.l r25,r20,r25
-
- mulu.l r25,r21,r19
- addz.l r25,r63,r25
- sub r25,r22,r25
- shlrd r19,r0,r19
- mulu.l r19,r22,r20
- addi r25,1,r25
- add r18,r19,r18
-
- cmpgt r25,r20,r25
- add.l r18,r25,r0
- blink tr0,r63
-#endif
-#elif defined (__SHMEDIA__)
-/* m5compact-nofpu - more emphasis on code size than on speed, but don't
- ignore speed altogether - div1 needs 9 cycles, subc 7 and rotcl 4.
- So use a short shmedia loop. */
- // clobbered: r20,r21,r25,tr0,tr1,tr2
- .mode SHmedia
- .section .text..SHmedia32,"ax"
- .align 2
-GLOBAL(udivsi3):
- pt/l LOCAL(udivsi3_dontsub), tr0
- pt/l LOCAL(udivsi3_loop), tr1
- ptabs/l r18,tr2
- shlli r5,32,r25
- addi r25,-1,r21
- addz.l r4,r63,r20
-LOCAL(udivsi3_loop):
- shlli r20,1,r20
- bgeu/u r21,r20,tr0
- sub r20,r21,r20
-LOCAL(udivsi3_dontsub):
- addi.l r25,-1,r25
- bnei r25,-32,tr1
- add.l r20,r63,r0
- blink tr2,r63
-#else /* ! defined (__SHMEDIA__) */
-LOCAL(div8):
- div1 r5,r4
-LOCAL(div7):
- div1 r5,r4; div1 r5,r4; div1 r5,r4
- div1 r5,r4; div1 r5,r4; div1 r5,r4; rts; div1 r5,r4
-
-LOCAL(divx4):
- div1 r5,r4; rotcl r0
- div1 r5,r4; rotcl r0
- div1 r5,r4; rotcl r0
- rts; div1 r5,r4
-
-GLOBAL(udivsi3):
- sts.l pr,@-r15
- extu.w r5,r0
- cmp/eq r5,r0
-#ifdef __sh1__
- bf LOCAL(large_divisor)
-#else
- bf/s LOCAL(large_divisor)
-#endif
- div0u
- swap.w r4,r0
- shlr16 r4
- bsr LOCAL(div8)
- shll16 r5
- bsr LOCAL(div7)
- div1 r5,r4
- xtrct r4,r0
- xtrct r0,r4
- bsr LOCAL(div8)
- swap.w r4,r4
- bsr LOCAL(div7)
- div1 r5,r4
- lds.l @r15+,pr
- xtrct r4,r0
- swap.w r0,r0
- rotcl r0
- rts
- shlr16 r5
-
-LOCAL(large_divisor):
-#ifdef __sh1__
- div0u
-#endif
- mov #0,r0
- xtrct r4,r0
- xtrct r0,r4
- bsr LOCAL(divx4)
- rotcl r0
- bsr LOCAL(divx4)
- rotcl r0
- bsr LOCAL(divx4)
- rotcl r0
- bsr LOCAL(divx4)
- rotcl r0
- lds.l @r15+,pr
- rts
- rotcl r0
-
- ENDFUNC(GLOBAL(udivsi3))
-#endif /* ! __SHMEDIA__ */
-#endif /* __SH4__ */
-#endif /* L_udivsi3 */
-
-#ifdef L_udivdi3
-#ifdef __SHMEDIA__
- .mode SHmedia
- .section .text..SHmedia32,"ax"
- .align 2
- .global GLOBAL(udivdi3)
- FUNC(GLOBAL(udivdi3))
-GLOBAL(udivdi3):
- HIDDEN_ALIAS(udivdi3_internal,udivdi3)
- shlri r3,1,r4
- nsb r4,r22
- shlld r3,r22,r6
- shlri r6,49,r5
- movi 0xffffffffffffbaf1,r21 /* .l shift count 17. */
- sub r21,r5,r1
- mmulfx.w r1,r1,r4
- mshflo.w r1,r63,r1
- sub r63,r22,r20 // r63 == 64 % 64
- mmulfx.w r5,r4,r4
- pta LOCAL(large_divisor),tr0
- addi r20,32,r9
- msub.w r1,r4,r1
- madd.w r1,r1,r1
- mmulfx.w r1,r1,r4
- shlri r6,32,r7
- bgt/u r9,r63,tr0 // large_divisor
- mmulfx.w r5,r4,r4
- shlri r2,32+14,r19
- addi r22,-31,r0
- msub.w r1,r4,r1
-
- mulu.l r1,r7,r4
- addi r1,-3,r5
- mulu.l r5,r19,r5
- sub r63,r4,r4 // Negate to make sure r1 ends up <= 1/r2
- shlri r4,2,r4 /* chop off leading %0000000000000000 001.00000000000 - or, as
- the case may be, %0000000000000000 000.11111111111, still */
- muls.l r1,r4,r4 /* leaving at least one sign bit. */
- mulu.l r5,r3,r8
- mshalds.l r1,r21,r1
- shari r4,26,r4
- shlld r8,r0,r8
- add r1,r4,r1 // 31 bit unsigned reciprocal now in r1 (msb equiv. 0.5)
- sub r2,r8,r2
- /* Can do second step of 64 : 32 div now, using r1 and the rest in r2. */
-
- shlri r2,22,r21
- mulu.l r21,r1,r21
- shlld r5,r0,r8
- addi r20,30-22,r0
- shlrd r21,r0,r21
- mulu.l r21,r3,r5
- add r8,r21,r8
- mcmpgt.l r21,r63,r21 // See Note 1
- addi r20,30,r0
- mshfhi.l r63,r21,r21
- sub r2,r5,r2
- andc r2,r21,r2
-
- /* small divisor: need a third divide step */
- mulu.l r2,r1,r7
- ptabs r18,tr0
- addi r2,1,r2
- shlrd r7,r0,r7
- mulu.l r7,r3,r5
- add r8,r7,r8
- sub r2,r3,r2
- cmpgt r2,r5,r5
- add r8,r5,r2
- /* could test r3 here to check for divide by zero. */
- blink tr0,r63
-
-LOCAL(large_divisor):
- mmulfx.w r5,r4,r4
- shlrd r2,r9,r25
- shlri r25,32,r8
- msub.w r1,r4,r1
-
- mulu.l r1,r7,r4
- addi r1,-3,r5
- mulu.l r5,r8,r5
- sub r63,r4,r4 // Negate to make sure r1 ends up <= 1/r2
- shlri r4,2,r4 /* chop off leading %0000000000000000 001.00000000000 - or, as
- the case may be, %0000000000000000 000.11111111111, still */
- muls.l r1,r4,r4 /* leaving at least one sign bit. */
- shlri r5,14-1,r8
- mulu.l r8,r7,r5
- mshalds.l r1,r21,r1
- shari r4,26,r4
- add r1,r4,r1 // 31 bit unsigned reciprocal now in r1 (msb equiv. 0.5)
- sub r25,r5,r25
- /* Can do second step of 64 : 32 div now, using r1 and the rest in r25. */
-
- shlri r25,22,r21
- mulu.l r21,r1,r21
- pta LOCAL(no_lo_adj),tr0
- addi r22,32,r0
- shlri r21,40,r21
- mulu.l r21,r7,r5
- add r8,r21,r8
- shlld r2,r0,r2
- sub r25,r5,r25
- bgtu/u r7,r25,tr0 // no_lo_adj
- addi r8,1,r8
- sub r25,r7,r25
-LOCAL(no_lo_adj):
- mextr4 r2,r25,r2
-
- /* large_divisor: only needs a few adjustments. */
- mulu.l r8,r6,r5
- ptabs r18,tr0
- /* bubble */
- cmpgtu r5,r2,r5
- sub r8,r5,r2
- blink tr0,r63
- ENDFUNC(GLOBAL(udivdi3))
-/* Note 1: To shift the result of the second divide stage so that the result
- always fits into 32 bits, yet we still reduce the rest sufficiently
- would require a lot of instructions to do the shifts just right. Using
- the full 64 bit shift result to multiply with the divisor would require
- four extra instructions for the upper 32 bits (shift / mulu / shift / sub).
- Fortunately, if the upper 32 bits of the shift result are nonzero, we
- know that the rest after taking this partial result into account will
- fit into 32 bits. So we just clear the upper 32 bits of the rest if the
- upper 32 bits of the partial result are nonzero. */
-#endif /* __SHMEDIA__ */
-#endif /* L_udivdi3 */
-
-#ifdef L_divdi3
-#ifdef __SHMEDIA__
- .mode SHmedia
- .section .text..SHmedia32,"ax"
- .align 2
- .global GLOBAL(divdi3)
- FUNC(GLOBAL(divdi3))
-GLOBAL(divdi3):
- pta GLOBAL(udivdi3_internal),tr0
- shari r2,63,r22
- shari r3,63,r23
- xor r2,r22,r2
- xor r3,r23,r3
- sub r2,r22,r2
- sub r3,r23,r3
- beq/u r22,r23,tr0
- ptabs r18,tr1
- blink tr0,r18
- sub r63,r2,r2
- blink tr1,r63
- ENDFUNC(GLOBAL(divdi3))
-#endif /* __SHMEDIA__ */
-#endif /* L_divdi3 */
-
-#ifdef L_umoddi3
-#ifdef __SHMEDIA__
- .mode SHmedia
- .section .text..SHmedia32,"ax"
- .align 2
- .global GLOBAL(umoddi3)
- FUNC(GLOBAL(umoddi3))
-GLOBAL(umoddi3):
- HIDDEN_ALIAS(umoddi3_internal,umoddi3)
- shlri r3,1,r4
- nsb r4,r22
- shlld r3,r22,r6
- shlri r6,49,r5
- movi 0xffffffffffffbaf1,r21 /* .l shift count 17. */
- sub r21,r5,r1
- mmulfx.w r1,r1,r4
- mshflo.w r1,r63,r1
- sub r63,r22,r20 // r63 == 64 % 64
- mmulfx.w r5,r4,r4
- pta LOCAL(large_divisor),tr0
- addi r20,32,r9
- msub.w r1,r4,r1
- madd.w r1,r1,r1
- mmulfx.w r1,r1,r4
- shlri r6,32,r7
- bgt/u r9,r63,tr0 // large_divisor
- mmulfx.w r5,r4,r4
- shlri r2,32+14,r19
- addi r22,-31,r0
- msub.w r1,r4,r1
-
- mulu.l r1,r7,r4
- addi r1,-3,r5
- mulu.l r5,r19,r5
- sub r63,r4,r4 // Negate to make sure r1 ends up <= 1/r2
- shlri r4,2,r4 /* chop off leading %0000000000000000 001.00000000000 - or, as
- the case may be, %0000000000000000 000.11111111111, still */
- muls.l r1,r4,r4 /* leaving at least one sign bit. */
- mulu.l r5,r3,r5
- mshalds.l r1,r21,r1
- shari r4,26,r4
- shlld r5,r0,r5
- add r1,r4,r1 // 31 bit unsigned reciprocal now in r1 (msb equiv. 0.5)
- sub r2,r5,r2
- /* Can do second step of 64 : 32 div now, using r1 and the rest in r2. */
-
- shlri r2,22,r21
- mulu.l r21,r1,r21
- addi r20,30-22,r0
- /* bubble */ /* could test r3 here to check for divide by zero. */
- shlrd r21,r0,r21
- mulu.l r21,r3,r5
- mcmpgt.l r21,r63,r21 // See Note 1
- addi r20,30,r0
- mshfhi.l r63,r21,r21
- sub r2,r5,r2
- andc r2,r21,r2
-
- /* small divisor: need a third divide step */
- mulu.l r2,r1,r7
- ptabs r18,tr0
- sub r2,r3,r8 /* re-use r8 here for rest - r3 */
- shlrd r7,r0,r7
- mulu.l r7,r3,r5
- /* bubble */
- addi r8,1,r7
- cmpgt r7,r5,r7
- cmvne r7,r8,r2
- sub r2,r5,r2
- blink tr0,r63
-
-LOCAL(large_divisor):
- mmulfx.w r5,r4,r4
- shlrd r2,r9,r25
- shlri r25,32,r8
- msub.w r1,r4,r1
-
- mulu.l r1,r7,r4
- addi r1,-3,r5
- mulu.l r5,r8,r5
- sub r63,r4,r4 // Negate to make sure r1 ends up <= 1/r2
- shlri r4,2,r4 /* chop off leading %0000000000000000 001.00000000000 - or, as
- the case may be, %0000000000000000 000.11111111111, still */
- muls.l r1,r4,r4 /* leaving at least one sign bit. */
- shlri r5,14-1,r8
- mulu.l r8,r7,r5
- mshalds.l r1,r21,r1
- shari r4,26,r4
- add r1,r4,r1 // 31 bit unsigned reciprocal now in r1 (msb equiv. 0.5)
- sub r25,r5,r25
- /* Can do second step of 64 : 32 div now, using r1 and the rest in r25. */
-
- shlri r25,22,r21
- mulu.l r21,r1,r21
- pta LOCAL(no_lo_adj),tr0
- addi r22,32,r0
- shlri r21,40,r21
- mulu.l r21,r7,r5
- add r8,r21,r8
- shlld r2,r0,r2
- sub r25,r5,r25
- bgtu/u r7,r25,tr0 // no_lo_adj
- addi r8,1,r8
- sub r25,r7,r25
-LOCAL(no_lo_adj):
- mextr4 r2,r25,r2
-
- /* large_divisor: only needs a few adjustments. */
- mulu.l r8,r6,r5
- ptabs r18,tr0
- add r2,r6,r7
- cmpgtu r5,r2,r8
- cmvne r8,r7,r2
- sub r2,r5,r2
- shlrd r2,r22,r2
- blink tr0,r63
- ENDFUNC(GLOBAL(umoddi3))
-/* Note 1: To shift the result of the second divide stage so that the result
- always fits into 32 bits, yet we still reduce the rest sufficiently
- would require a lot of instructions to do the shifts just right. Using
- the full 64 bit shift result to multiply with the divisor would require
- four extra instructions for the upper 32 bits (shift / mulu / shift / sub).
- Fortunately, if the upper 32 bits of the shift result are nonzero, we
- know that the rest after taking this partial result into account will
- fit into 32 bits. So we just clear the upper 32 bits of the rest if the
- upper 32 bits of the partial result are nonzero. */
-#endif /* __SHMEDIA__ */
-#endif /* L_umoddi3 */
-
-#ifdef L_moddi3
-#ifdef __SHMEDIA__
- .mode SHmedia
- .section .text..SHmedia32,"ax"
- .align 2
- .global GLOBAL(moddi3)
- FUNC(GLOBAL(moddi3))
-GLOBAL(moddi3):
- pta GLOBAL(umoddi3_internal),tr0
- shari r2,63,r22
- shari r3,63,r23
- xor r2,r22,r2
- xor r3,r23,r3
- sub r2,r22,r2
- sub r3,r23,r3
- beq/u r22,r63,tr0
- ptabs r18,tr1
- blink tr0,r18
- sub r63,r2,r2
- blink tr1,r63
- ENDFUNC(GLOBAL(moddi3))
-#endif /* __SHMEDIA__ */
-#endif /* L_moddi3 */
-
-#ifdef L_set_fpscr
-#if !defined (__SH2A_NOFPU__)
-#if defined (__SH2E__) || defined (__SH2A__) || defined (__SH3E__) || defined(__SH4_SINGLE__) || defined(__SH4__) || defined(__SH4_SINGLE_ONLY__) || __SH5__ == 32
-#ifdef __SH5__
- .mode SHcompact
-#endif
- .global GLOBAL(set_fpscr)
- HIDDEN_FUNC(GLOBAL(set_fpscr))
-GLOBAL(set_fpscr):
- lds r4,fpscr
-#ifdef __PIC__
- mov.l r12,@-r15
-#ifdef __vxworks
- mov.l LOCAL(set_fpscr_L0_base),r12
- mov.l LOCAL(set_fpscr_L0_index),r0
- mov.l @r12,r12
- mov.l @(r0,r12),r12
-#else
- mova LOCAL(set_fpscr_L0),r0
- mov.l LOCAL(set_fpscr_L0),r12
- add r0,r12
-#endif
- mov.l LOCAL(set_fpscr_L1),r0
- mov.l @(r0,r12),r1
- mov.l @r15+,r12
-#else
- mov.l LOCAL(set_fpscr_L1),r1
-#endif
- swap.w r4,r0
- or #24,r0
-#ifndef FMOVD_WORKS
- xor #16,r0
-#endif
-#if defined(__SH4__) || defined (__SH2A_DOUBLE__)
- swap.w r0,r3
- mov.l r3,@(4,r1)
-#else /* defined (__SH2E__) || defined(__SH3E__) || defined(__SH4_SINGLE*__) */
- swap.w r0,r2
- mov.l r2,@r1
-#endif
-#ifndef FMOVD_WORKS
- xor #8,r0
-#else
- xor #24,r0
-#endif
-#if defined(__SH4__) || defined (__SH2A_DOUBLE__)
- swap.w r0,r2
- rts
- mov.l r2,@r1
-#else /* defined(__SH2E__) || defined(__SH3E__) || defined(__SH4_SINGLE*__) */
- swap.w r0,r3
- rts
- mov.l r3,@(4,r1)
-#endif
- .align 2
-#ifdef __PIC__
-#ifdef __vxworks
-LOCAL(set_fpscr_L0_base):
- .long ___GOTT_BASE__
-LOCAL(set_fpscr_L0_index):
- .long ___GOTT_INDEX__
-#else
-LOCAL(set_fpscr_L0):
- .long _GLOBAL_OFFSET_TABLE_
-#endif
-LOCAL(set_fpscr_L1):
- .long GLOBAL(fpscr_values@GOT)
-#else
-LOCAL(set_fpscr_L1):
- .long GLOBAL(fpscr_values)
-#endif
-
- ENDFUNC(GLOBAL(set_fpscr))
-#ifndef NO_FPSCR_VALUES
-#ifdef __ELF__
- .comm GLOBAL(fpscr_values),8,4
-#else
- .comm GLOBAL(fpscr_values),8
-#endif /* ELF */
-#endif /* NO_FPSCR_VALUES */
-#endif /* SH2E / SH3E / SH4 */
-#endif /* __SH2A_NOFPU__ */
-#endif /* L_set_fpscr */
-#ifdef L_ic_invalidate
-#if __SH5__ == 32
- .mode SHmedia
- .section .text..SHmedia32,"ax"
- .align 2
- .global GLOBAL(init_trampoline)
- HIDDEN_FUNC(GLOBAL(init_trampoline))
-GLOBAL(init_trampoline):
- st.l r0,8,r2
-#ifdef __LITTLE_ENDIAN__
- movi 9,r20
- shori 0x402b,r20
- shori 0xd101,r20
- shori 0xd002,r20
-#else
- movi 0xffffffffffffd002,r20
- shori 0xd101,r20
- shori 0x402b,r20
- shori 9,r20
-#endif
- st.q r0,0,r20
- st.l r0,12,r3
- ENDFUNC(GLOBAL(init_trampoline))
- .global GLOBAL(ic_invalidate)
- HIDDEN_FUNC(GLOBAL(ic_invalidate))
-GLOBAL(ic_invalidate):
- ocbwb r0,0
- synco
- icbi r0, 0
- ptabs r18, tr0
- synci
- blink tr0, r63
- ENDFUNC(GLOBAL(ic_invalidate))
-#elif defined(__SH4A__)
- .global GLOBAL(ic_invalidate)
- HIDDEN_FUNC(GLOBAL(ic_invalidate))
-GLOBAL(ic_invalidate):
- ocbwb @r4
- synco
- icbi @r4
- rts
- nop
- ENDFUNC(GLOBAL(ic_invalidate))
-#elif defined(__SH4_SINGLE__) || defined(__SH4__) || defined(__SH4_SINGLE_ONLY__) || (defined(__SH4_NOFPU__) && !defined(__SH5__))
- /* For system code, we use ic_invalidate_line_i, but user code
- needs a different mechanism. A kernel call is generally not
- available, and it would also be slow. Different SH4 variants use
- different sizes and associativities of the Icache. We use a small
- bit of dispatch code that can be put hidden in every shared object,
- which calls the actual processor-specific invalidation code in a
- separate module.
- Or if you have operating system support, the OS could mmap the
- procesor-specific code from a single page, since it is highly
- repetitive. */
- .global GLOBAL(ic_invalidate)
- HIDDEN_FUNC(GLOBAL(ic_invalidate))
-GLOBAL(ic_invalidate):
-#ifdef __pic__
-#ifdef __vxworks
- mov.l 1f,r1
- mov.l 2f,r0
- mov.l @r1,r1
- mov.l 0f,r2
- mov.l @(r0,r1),r0
-#else
- mov.l 1f,r1
- mova 1f,r0
- mov.l 0f,r2
- add r1,r0
-#endif
- mov.l @(r0,r2),r1
-#else
- mov.l 0f,r1
-#endif
- ocbwb @r4
- mov.l @(8,r1),r0
- sub r1,r4
- and r4,r0
- add r1,r0
- jmp @r0
- mov.l @(4,r1),r0
- .align 2
-#ifndef __pic__
-0: .long GLOBAL(ic_invalidate_array)
-#else /* __pic__ */
- .global GLOBAL(ic_invalidate_array)
-0: .long GLOBAL(ic_invalidate_array)@GOT
-#ifdef __vxworks
-1: .long ___GOTT_BASE__
-2: .long ___GOTT_INDEX__
-#else
-1: .long _GLOBAL_OFFSET_TABLE_
-#endif
- ENDFUNC(GLOBAL(ic_invalidate))
-#endif /* __pic__ */
-#endif /* SH4 */
-#endif /* L_ic_invalidate */
-
-#ifdef L_ic_invalidate_array
-#if defined(__SH4A__) || (defined (__FORCE_SH4A__) && (defined(__SH4_SINGLE__) || defined(__SH4__) || defined(__SH4_SINGLE_ONLY__) || (defined(__SH4_NOFPU__) && !defined(__SH5__))))
- .global GLOBAL(ic_invalidate_array)
- /* This is needed when an SH4 dso with trampolines is used on SH4A. */
- .global GLOBAL(ic_invalidate_array)
- FUNC(GLOBAL(ic_invalidate_array))
-GLOBAL(ic_invalidate_array):
- add r1,r4
- synco
- icbi @r4
- rts
- nop
- .align 2
- .long 0
- ENDFUNC(GLOBAL(ic_invalidate_array))
-#elif defined(__SH4_SINGLE__) || defined(__SH4__) || defined(__SH4_SINGLE_ONLY__) || (defined(__SH4_NOFPU__) && !defined(__SH5__))
- .global GLOBAL(ic_invalidate_array)
- .p2align 5
- FUNC(GLOBAL(ic_invalidate_array))
-/* This must be aligned to the beginning of a cache line. */
-GLOBAL(ic_invalidate_array):
-#ifndef WAYS
-#define WAYS 4
-#define WAY_SIZE 0x4000
-#endif
-#if WAYS == 1
- .rept WAY_SIZE * WAYS / 32
- rts
- nop
- .rept 7
- .long WAY_SIZE - 32
- .endr
- .endr
-#elif WAYS <= 6
- .rept WAY_SIZE * WAYS / 32
- braf r0
- add #-8,r0
- .long WAY_SIZE + 8
- .long WAY_SIZE - 32
- .rept WAYS-2
- braf r0
- nop
- .endr
- .rept 7 - WAYS
- rts
- nop
- .endr
- .endr
-#else /* WAYS > 6 */
- /* This variant needs two different pages for mmap-ing. */
- .rept WAYS-1
- .rept WAY_SIZE / 32
- braf r0
- nop
- .long WAY_SIZE
- .rept 6
- .long WAY_SIZE - 32
- .endr
- .endr
- .endr
- .rept WAY_SIZE / 32
- rts
- .rept 15
- nop
- .endr
- .endr
-#endif /* WAYS */
- ENDFUNC(GLOBAL(ic_invalidate_array))
-#endif /* SH4 */
-#endif /* L_ic_invalidate_array */
-
-#if defined (__SH5__) && __SH5__ == 32
-#ifdef L_shcompact_call_trampoline
- .section .rodata
- .align 1
-LOCAL(ct_main_table):
-.word LOCAL(ct_r2_fp) - datalabel LOCAL(ct_main_label)
-.word LOCAL(ct_r2_ld) - datalabel LOCAL(ct_main_label)
-.word LOCAL(ct_r2_pop) - datalabel LOCAL(ct_main_label)
-.word LOCAL(ct_r3_fp) - datalabel LOCAL(ct_main_label)
-.word LOCAL(ct_r3_ld) - datalabel LOCAL(ct_main_label)
-.word LOCAL(ct_r3_pop) - datalabel LOCAL(ct_main_label)
-.word LOCAL(ct_r4_fp) - datalabel LOCAL(ct_main_label)
-.word LOCAL(ct_r4_ld) - datalabel LOCAL(ct_main_label)
-.word LOCAL(ct_r4_pop) - datalabel LOCAL(ct_main_label)
-.word LOCAL(ct_r5_fp) - datalabel LOCAL(ct_main_label)
-.word LOCAL(ct_r5_ld) - datalabel LOCAL(ct_main_label)
-.word LOCAL(ct_r5_pop) - datalabel LOCAL(ct_main_label)
-.word LOCAL(ct_r6_fph) - datalabel LOCAL(ct_main_label)
-.word LOCAL(ct_r6_fpl) - datalabel LOCAL(ct_main_label)
-.word LOCAL(ct_r6_ld) - datalabel LOCAL(ct_main_label)
-.word LOCAL(ct_r6_pop) - datalabel LOCAL(ct_main_label)
-.word LOCAL(ct_r7_fph) - datalabel LOCAL(ct_main_label)
-.word LOCAL(ct_r7_fpl) - datalabel LOCAL(ct_main_label)
-.word LOCAL(ct_r7_ld) - datalabel LOCAL(ct_main_label)
-.word LOCAL(ct_r7_pop) - datalabel LOCAL(ct_main_label)
-.word LOCAL(ct_r8_fph) - datalabel LOCAL(ct_main_label)
-.word LOCAL(ct_r8_fpl) - datalabel LOCAL(ct_main_label)
-.word LOCAL(ct_r8_ld) - datalabel LOCAL(ct_main_label)
-.word LOCAL(ct_r8_pop) - datalabel LOCAL(ct_main_label)
-.word LOCAL(ct_r9_fph) - datalabel LOCAL(ct_main_label)
-.word LOCAL(ct_r9_fpl) - datalabel LOCAL(ct_main_label)
-.word LOCAL(ct_r9_ld) - datalabel LOCAL(ct_main_label)
-.word LOCAL(ct_r9_pop) - datalabel LOCAL(ct_main_label)
-.word LOCAL(ct_pop_seq) - datalabel LOCAL(ct_main_label)
-.word LOCAL(ct_pop_seq) - datalabel LOCAL(ct_main_label)
-.word LOCAL(ct_r9_pop) - datalabel LOCAL(ct_main_label)
-.word LOCAL(ct_ret_wide) - datalabel LOCAL(ct_main_label)
-.word LOCAL(ct_call_func) - datalabel LOCAL(ct_main_label)
- .mode SHmedia
- .section .text..SHmedia32, "ax"
- .align 2
-
- /* This function loads 64-bit general-purpose registers from the
- stack, from a memory address contained in them or from an FP
- register, according to a cookie passed in r1. Its execution
- time is linear on the number of registers that actually have
- to be copied. See sh.h for details on the actual bit pattern.
-
- The function to be called is passed in r0. If a 32-bit return
- value is expected, the actual function will be tail-called,
- otherwise the return address will be stored in r10 (that the
- caller should expect to be clobbered) and the return value
- will be expanded into r2/r3 upon return. */
-
- .global GLOBAL(GCC_shcompact_call_trampoline)
- FUNC(GLOBAL(GCC_shcompact_call_trampoline))
-GLOBAL(GCC_shcompact_call_trampoline):
- ptabs/l r0, tr0 /* Prepare to call the actual function. */
- movi ((datalabel LOCAL(ct_main_table) - 31 * 2) >> 16) & 65535, r0
- pt/l LOCAL(ct_loop), tr1
- addz.l r1, r63, r1
- shori ((datalabel LOCAL(ct_main_table) - 31 * 2)) & 65535, r0
-LOCAL(ct_loop):
- nsb r1, r28
- shlli r28, 1, r29
- ldx.w r0, r29, r30
-LOCAL(ct_main_label):
- ptrel/l r30, tr2
- blink tr2, r63
-LOCAL(ct_r2_fp): /* Copy r2 from an FP register. */
- /* It must be dr0, so just do it. */
- fmov.dq dr0, r2
- movi 7, r30
- shlli r30, 29, r31
- andc r1, r31, r1
- blink tr1, r63
-LOCAL(ct_r3_fp): /* Copy r3 from an FP register. */
- /* It is either dr0 or dr2. */
- movi 7, r30
- shlri r1, 26, r32
- shlli r30, 26, r31
- andc r1, r31, r1
- fmov.dq dr0, r3
- beqi/l r32, 4, tr1
- fmov.dq dr2, r3
- blink tr1, r63
-LOCAL(ct_r4_fp): /* Copy r4 from an FP register. */
- shlri r1, 23 - 3, r34
- andi r34, 3 << 3, r33
- addi r33, LOCAL(ct_r4_fp_copy) - datalabel LOCAL(ct_r4_fp_base), r32
-LOCAL(ct_r4_fp_base):
- ptrel/l r32, tr2
- movi 7, r30
- shlli r30, 23, r31
- andc r1, r31, r1
- blink tr2, r63
-LOCAL(ct_r4_fp_copy):
- fmov.dq dr0, r4
- blink tr1, r63
- fmov.dq dr2, r4
- blink tr1, r63
- fmov.dq dr4, r4
- blink tr1, r63
-LOCAL(ct_r5_fp): /* Copy r5 from an FP register. */
- shlri r1, 20 - 3, r34
- andi r34, 3 << 3, r33
- addi r33, LOCAL(ct_r5_fp_copy) - datalabel LOCAL(ct_r5_fp_base), r32
-LOCAL(ct_r5_fp_base):
- ptrel/l r32, tr2
- movi 7, r30
- shlli r30, 20, r31
- andc r1, r31, r1
- blink tr2, r63
-LOCAL(ct_r5_fp_copy):
- fmov.dq dr0, r5
- blink tr1, r63
- fmov.dq dr2, r5
- blink tr1, r63
- fmov.dq dr4, r5
- blink tr1, r63
- fmov.dq dr6, r5
- blink tr1, r63
-LOCAL(ct_r6_fph): /* Copy r6 from a high FP register. */
- /* It must be dr8. */
- fmov.dq dr8, r6
- movi 15, r30
- shlli r30, 16, r31
- andc r1, r31, r1
- blink tr1, r63
-LOCAL(ct_r6_fpl): /* Copy r6 from a low FP register. */
- shlri r1, 16 - 3, r34
- andi r34, 3 << 3, r33
- addi r33, LOCAL(ct_r6_fp_copy) - datalabel LOCAL(ct_r6_fp_base), r32
-LOCAL(ct_r6_fp_base):
- ptrel/l r32, tr2
- movi 7, r30
- shlli r30, 16, r31
- andc r1, r31, r1
- blink tr2, r63
-LOCAL(ct_r6_fp_copy):
- fmov.dq dr0, r6
- blink tr1, r63
- fmov.dq dr2, r6
- blink tr1, r63
- fmov.dq dr4, r6
- blink tr1, r63
- fmov.dq dr6, r6
- blink tr1, r63
-LOCAL(ct_r7_fph): /* Copy r7 from a high FP register. */
- /* It is either dr8 or dr10. */
- movi 15 << 12, r31
- shlri r1, 12, r32
- andc r1, r31, r1
- fmov.dq dr8, r7
- beqi/l r32, 8, tr1
- fmov.dq dr10, r7
- blink tr1, r63
-LOCAL(ct_r7_fpl): /* Copy r7 from a low FP register. */
- shlri r1, 12 - 3, r34
- andi r34, 3 << 3, r33
- addi r33, LOCAL(ct_r7_fp_copy) - datalabel LOCAL(ct_r7_fp_base), r32
-LOCAL(ct_r7_fp_base):
- ptrel/l r32, tr2
- movi 7 << 12, r31
- andc r1, r31, r1
- blink tr2, r63
-LOCAL(ct_r7_fp_copy):
- fmov.dq dr0, r7
- blink tr1, r63
- fmov.dq dr2, r7
- blink tr1, r63
- fmov.dq dr4, r7
- blink tr1, r63
- fmov.dq dr6, r7
- blink tr1, r63
-LOCAL(ct_r8_fph): /* Copy r8 from a high FP register. */
- /* It is either dr8 or dr10. */
- movi 15 << 8, r31
- andi r1, 1 << 8, r32
- andc r1, r31, r1
- fmov.dq dr8, r8
- beq/l r32, r63, tr1
- fmov.dq dr10, r8
- blink tr1, r63
-LOCAL(ct_r8_fpl): /* Copy r8 from a low FP register. */
- shlri r1, 8 - 3, r34
- andi r34, 3 << 3, r33
- addi r33, LOCAL(ct_r8_fp_copy) - datalabel LOCAL(ct_r8_fp_base), r32
-LOCAL(ct_r8_fp_base):
- ptrel/l r32, tr2
- movi 7 << 8, r31
- andc r1, r31, r1
- blink tr2, r63
-LOCAL(ct_r8_fp_copy):
- fmov.dq dr0, r8
- blink tr1, r63
- fmov.dq dr2, r8
- blink tr1, r63
- fmov.dq dr4, r8
- blink tr1, r63
- fmov.dq dr6, r8
- blink tr1, r63
-LOCAL(ct_r9_fph): /* Copy r9 from a high FP register. */
- /* It is either dr8 or dr10. */
- movi 15 << 4, r31
- andi r1, 1 << 4, r32
- andc r1, r31, r1
- fmov.dq dr8, r9
- beq/l r32, r63, tr1
- fmov.dq dr10, r9
- blink tr1, r63
-LOCAL(ct_r9_fpl): /* Copy r9 from a low FP register. */
- shlri r1, 4 - 3, r34
- andi r34, 3 << 3, r33
- addi r33, LOCAL(ct_r9_fp_copy) - datalabel LOCAL(ct_r9_fp_base), r32
-LOCAL(ct_r9_fp_base):
- ptrel/l r32, tr2
- movi 7 << 4, r31
- andc r1, r31, r1
- blink tr2, r63
-LOCAL(ct_r9_fp_copy):
- fmov.dq dr0, r9
- blink tr1, r63
- fmov.dq dr2, r9
- blink tr1, r63
- fmov.dq dr4, r9
- blink tr1, r63
- fmov.dq dr6, r9
- blink tr1, r63
-LOCAL(ct_r2_ld): /* Copy r2 from a memory address. */
- pt/l LOCAL(ct_r2_load), tr2
- movi 3, r30
- shlli r30, 29, r31
- and r1, r31, r32
- andc r1, r31, r1
- beq/l r31, r32, tr2
- addi.l r2, 8, r3
- ldx.q r2, r63, r2
- /* Fall through. */
-LOCAL(ct_r3_ld): /* Copy r3 from a memory address. */
- pt/l LOCAL(ct_r3_load), tr2
- movi 3, r30
- shlli r30, 26, r31
- and r1, r31, r32
- andc r1, r31, r1
- beq/l r31, r32, tr2
- addi.l r3, 8, r4
- ldx.q r3, r63, r3
-LOCAL(ct_r4_ld): /* Copy r4 from a memory address. */
- pt/l LOCAL(ct_r4_load), tr2
- movi 3, r30
- shlli r30, 23, r31
- and r1, r31, r32
- andc r1, r31, r1
- beq/l r31, r32, tr2
- addi.l r4, 8, r5
- ldx.q r4, r63, r4
-LOCAL(ct_r5_ld): /* Copy r5 from a memory address. */
- pt/l LOCAL(ct_r5_load), tr2
- movi 3, r30
- shlli r30, 20, r31
- and r1, r31, r32
- andc r1, r31, r1
- beq/l r31, r32, tr2
- addi.l r5, 8, r6
- ldx.q r5, r63, r5
-LOCAL(ct_r6_ld): /* Copy r6 from a memory address. */
- pt/l LOCAL(ct_r6_load), tr2
- movi 3 << 16, r31
- and r1, r31, r32
- andc r1, r31, r1
- beq/l r31, r32, tr2
- addi.l r6, 8, r7
- ldx.q r6, r63, r6
-LOCAL(ct_r7_ld): /* Copy r7 from a memory address. */
- pt/l LOCAL(ct_r7_load), tr2
- movi 3 << 12, r31
- and r1, r31, r32
- andc r1, r31, r1
- beq/l r31, r32, tr2
- addi.l r7, 8, r8
- ldx.q r7, r63, r7
-LOCAL(ct_r8_ld): /* Copy r8 from a memory address. */
- pt/l LOCAL(ct_r8_load), tr2
- movi 3 << 8, r31
- and r1, r31, r32
- andc r1, r31, r1
- beq/l r31, r32, tr2
- addi.l r8, 8, r9
- ldx.q r8, r63, r8
-LOCAL(ct_r9_ld): /* Copy r9 from a memory address. */
- pt/l LOCAL(ct_check_tramp), tr2
- ldx.q r9, r63, r9
- blink tr2, r63
-LOCAL(ct_r2_load):
- ldx.q r2, r63, r2
- blink tr1, r63
-LOCAL(ct_r3_load):
- ldx.q r3, r63, r3
- blink tr1, r63
-LOCAL(ct_r4_load):
- ldx.q r4, r63, r4
- blink tr1, r63
-LOCAL(ct_r5_load):
- ldx.q r5, r63, r5
- blink tr1, r63
-LOCAL(ct_r6_load):
- ldx.q r6, r63, r6
- blink tr1, r63
-LOCAL(ct_r7_load):
- ldx.q r7, r63, r7
- blink tr1, r63
-LOCAL(ct_r8_load):
- ldx.q r8, r63, r8
- blink tr1, r63
-LOCAL(ct_r2_pop): /* Pop r2 from the stack. */
- movi 1, r30
- ldx.q r15, r63, r2
- shlli r30, 29, r31
- addi.l r15, 8, r15
- andc r1, r31, r1
- blink tr1, r63
-LOCAL(ct_r3_pop): /* Pop r3 from the stack. */
- movi 1, r30
- ldx.q r15, r63, r3
- shlli r30, 26, r31
- addi.l r15, 8, r15
- andc r1, r31, r1
- blink tr1, r63
-LOCAL(ct_r4_pop): /* Pop r4 from the stack. */
- movi 1, r30
- ldx.q r15, r63, r4
- shlli r30, 23, r31
- addi.l r15, 8, r15
- andc r1, r31, r1
- blink tr1, r63
-LOCAL(ct_r5_pop): /* Pop r5 from the stack. */
- movi 1, r30
- ldx.q r15, r63, r5
- shlli r30, 20, r31
- addi.l r15, 8, r15
- andc r1, r31, r1
- blink tr1, r63
-LOCAL(ct_r6_pop): /* Pop r6 from the stack. */
- movi 1, r30
- ldx.q r15, r63, r6
- shlli r30, 16, r31
- addi.l r15, 8, r15
- andc r1, r31, r1
- blink tr1, r63
-LOCAL(ct_r7_pop): /* Pop r7 from the stack. */
- ldx.q r15, r63, r7
- movi 1 << 12, r31
- addi.l r15, 8, r15
- andc r1, r31, r1
- blink tr1, r63
-LOCAL(ct_r8_pop): /* Pop r8 from the stack. */
- ldx.q r15, r63, r8
- movi 1 << 8, r31
- addi.l r15, 8, r15
- andc r1, r31, r1
- blink tr1, r63
-LOCAL(ct_pop_seq): /* Pop a sequence of registers off the stack. */
- andi r1, 7 << 1, r30
- movi (LOCAL(ct_end_of_pop_seq) >> 16) & 65535, r32
- shlli r30, 2, r31
- shori LOCAL(ct_end_of_pop_seq) & 65535, r32
- sub.l r32, r31, r33
- ptabs/l r33, tr2
- blink tr2, r63
-LOCAL(ct_start_of_pop_seq): /* Beginning of pop sequence. */
- ldx.q r15, r63, r3
- addi.l r15, 8, r15
- ldx.q r15, r63, r4
- addi.l r15, 8, r15
- ldx.q r15, r63, r5
- addi.l r15, 8, r15
- ldx.q r15, r63, r6
- addi.l r15, 8, r15
- ldx.q r15, r63, r7
- addi.l r15, 8, r15
- ldx.q r15, r63, r8
- addi.l r15, 8, r15
-LOCAL(ct_r9_pop): /* Pop r9 from the stack. */
- ldx.q r15, r63, r9
- addi.l r15, 8, r15
-LOCAL(ct_end_of_pop_seq): /* Label used to compute first pop instruction. */
-LOCAL(ct_check_tramp): /* Check whether we need a trampoline. */
- pt/u LOCAL(ct_ret_wide), tr2
- andi r1, 1, r1
- bne/u r1, r63, tr2
-LOCAL(ct_call_func): /* Just branch to the function. */
- blink tr0, r63
-LOCAL(ct_ret_wide): /* Call the function, so that we can unpack its
- 64-bit return value. */
- add.l r18, r63, r10
- blink tr0, r18
- ptabs r10, tr0
-#if __LITTLE_ENDIAN__
- shari r2, 32, r3
- add.l r2, r63, r2
-#else
- add.l r2, r63, r3
- shari r2, 32, r2
-#endif
- blink tr0, r63
-
- ENDFUNC(GLOBAL(GCC_shcompact_call_trampoline))
-#endif /* L_shcompact_call_trampoline */
-
-#ifdef L_shcompact_return_trampoline
- /* This function does the converse of the code in `ret_wide'
- above. It is tail-called by SHcompact functions returning
- 64-bit non-floating-point values, to pack the 32-bit values in
- r2 and r3 into r2. */
-
- .mode SHmedia
- .section .text..SHmedia32, "ax"
- .align 2
- .global GLOBAL(GCC_shcompact_return_trampoline)
- HIDDEN_FUNC(GLOBAL(GCC_shcompact_return_trampoline))
-GLOBAL(GCC_shcompact_return_trampoline):
- ptabs/l r18, tr0
-#if __LITTLE_ENDIAN__
- addz.l r2, r63, r2
- shlli r3, 32, r3
-#else
- addz.l r3, r63, r3
- shlli r2, 32, r2
-#endif
- or r3, r2, r2
- blink tr0, r63
-
- ENDFUNC(GLOBAL(GCC_shcompact_return_trampoline))
-#endif /* L_shcompact_return_trampoline */
-
-#ifdef L_shcompact_incoming_args
- .section .rodata
- .align 1
-LOCAL(ia_main_table):
-.word 1 /* Invalid, just loop */
-.word LOCAL(ia_r2_ld) - datalabel LOCAL(ia_main_label)
-.word LOCAL(ia_r2_push) - datalabel LOCAL(ia_main_label)
-.word 1 /* Invalid, just loop */
-.word LOCAL(ia_r3_ld) - datalabel LOCAL(ia_main_label)
-.word LOCAL(ia_r3_push) - datalabel LOCAL(ia_main_label)
-.word 1 /* Invalid, just loop */
-.word LOCAL(ia_r4_ld) - datalabel LOCAL(ia_main_label)
-.word LOCAL(ia_r4_push) - datalabel LOCAL(ia_main_label)
-.word 1 /* Invalid, just loop */
-.word LOCAL(ia_r5_ld) - datalabel LOCAL(ia_main_label)
-.word LOCAL(ia_r5_push) - datalabel LOCAL(ia_main_label)
-.word 1 /* Invalid, just loop */
-.word 1 /* Invalid, just loop */
-.word LOCAL(ia_r6_ld) - datalabel LOCAL(ia_main_label)
-.word LOCAL(ia_r6_push) - datalabel LOCAL(ia_main_label)
-.word 1 /* Invalid, just loop */
-.word 1 /* Invalid, just loop */
-.word LOCAL(ia_r7_ld) - datalabel LOCAL(ia_main_label)
-.word LOCAL(ia_r7_push) - datalabel LOCAL(ia_main_label)
-.word 1 /* Invalid, just loop */
-.word 1 /* Invalid, just loop */
-.word LOCAL(ia_r8_ld) - datalabel LOCAL(ia_main_label)
-.word LOCAL(ia_r8_push) - datalabel LOCAL(ia_main_label)
-.word 1 /* Invalid, just loop */
-.word 1 /* Invalid, just loop */
-.word LOCAL(ia_r9_ld) - datalabel LOCAL(ia_main_label)
-.word LOCAL(ia_r9_push) - datalabel LOCAL(ia_main_label)
-.word LOCAL(ia_push_seq) - datalabel LOCAL(ia_main_label)
-.word LOCAL(ia_push_seq) - datalabel LOCAL(ia_main_label)
-.word LOCAL(ia_r9_push) - datalabel LOCAL(ia_main_label)
-.word LOCAL(ia_return) - datalabel LOCAL(ia_main_label)
-.word LOCAL(ia_return) - datalabel LOCAL(ia_main_label)
- .mode SHmedia
- .section .text..SHmedia32, "ax"
- .align 2
-
- /* This function stores 64-bit general-purpose registers back in
- the stack, and loads the address in which each register
- was stored into itself. The lower 32 bits of r17 hold the address
- to begin storing, and the upper 32 bits of r17 hold the cookie.
- Its execution time is linear on the
- number of registers that actually have to be copied, and it is
- optimized for structures larger than 64 bits, as opposed to
- individual `long long' arguments. See sh.h for details on the
- actual bit pattern. */
-
- .global GLOBAL(GCC_shcompact_incoming_args)
- FUNC(GLOBAL(GCC_shcompact_incoming_args))
-GLOBAL(GCC_shcompact_incoming_args):
- ptabs/l r18, tr0 /* Prepare to return. */
- shlri r17, 32, r0 /* Load the cookie. */
- movi ((datalabel LOCAL(ia_main_table) - 31 * 2) >> 16) & 65535, r43
- pt/l LOCAL(ia_loop), tr1
- add.l r17, r63, r17
- shori ((datalabel LOCAL(ia_main_table) - 31 * 2)) & 65535, r43
-LOCAL(ia_loop):
- nsb r0, r36
- shlli r36, 1, r37
- ldx.w r43, r37, r38
-LOCAL(ia_main_label):
- ptrel/l r38, tr2
- blink tr2, r63
-LOCAL(ia_r2_ld): /* Store r2 and load its address. */
- movi 3, r38
- shlli r38, 29, r39
- and r0, r39, r40
- andc r0, r39, r0
- stx.q r17, r63, r2
- add.l r17, r63, r2
- addi.l r17, 8, r17
- beq/u r39, r40, tr1
-LOCAL(ia_r3_ld): /* Store r3 and load its address. */
- movi 3, r38
- shlli r38, 26, r39
- and r0, r39, r40
- andc r0, r39, r0
- stx.q r17, r63, r3
- add.l r17, r63, r3
- addi.l r17, 8, r17
- beq/u r39, r40, tr1
-LOCAL(ia_r4_ld): /* Store r4 and load its address. */
- movi 3, r38
- shlli r38, 23, r39
- and r0, r39, r40
- andc r0, r39, r0
- stx.q r17, r63, r4
- add.l r17, r63, r4
- addi.l r17, 8, r17
- beq/u r39, r40, tr1
-LOCAL(ia_r5_ld): /* Store r5 and load its address. */
- movi 3, r38
- shlli r38, 20, r39
- and r0, r39, r40
- andc r0, r39, r0
- stx.q r17, r63, r5
- add.l r17, r63, r5
- addi.l r17, 8, r17
- beq/u r39, r40, tr1
-LOCAL(ia_r6_ld): /* Store r6 and load its address. */
- movi 3, r38
- shlli r38, 16, r39
- and r0, r39, r40
- andc r0, r39, r0
- stx.q r17, r63, r6
- add.l r17, r63, r6
- addi.l r17, 8, r17
- beq/u r39, r40, tr1
-LOCAL(ia_r7_ld): /* Store r7 and load its address. */
- movi 3 << 12, r39
- and r0, r39, r40
- andc r0, r39, r0
- stx.q r17, r63, r7
- add.l r17, r63, r7
- addi.l r17, 8, r17
- beq/u r39, r40, tr1
-LOCAL(ia_r8_ld): /* Store r8 and load its address. */
- movi 3 << 8, r39
- and r0, r39, r40
- andc r0, r39, r0
- stx.q r17, r63, r8
- add.l r17, r63, r8
- addi.l r17, 8, r17
- beq/u r39, r40, tr1
-LOCAL(ia_r9_ld): /* Store r9 and load its address. */
- stx.q r17, r63, r9
- add.l r17, r63, r9
- blink tr0, r63
-LOCAL(ia_r2_push): /* Push r2 onto the stack. */
- movi 1, r38
- shlli r38, 29, r39
- andc r0, r39, r0
- stx.q r17, r63, r2
- addi.l r17, 8, r17
- blink tr1, r63
-LOCAL(ia_r3_push): /* Push r3 onto the stack. */
- movi 1, r38
- shlli r38, 26, r39
- andc r0, r39, r0
- stx.q r17, r63, r3
- addi.l r17, 8, r17
- blink tr1, r63
-LOCAL(ia_r4_push): /* Push r4 onto the stack. */
- movi 1, r38
- shlli r38, 23, r39
- andc r0, r39, r0
- stx.q r17, r63, r4
- addi.l r17, 8, r17
- blink tr1, r63
-LOCAL(ia_r5_push): /* Push r5 onto the stack. */
- movi 1, r38
- shlli r38, 20, r39
- andc r0, r39, r0
- stx.q r17, r63, r5
- addi.l r17, 8, r17
- blink tr1, r63
-LOCAL(ia_r6_push): /* Push r6 onto the stack. */
- movi 1, r38
- shlli r38, 16, r39
- andc r0, r39, r0
- stx.q r17, r63, r6
- addi.l r17, 8, r17
- blink tr1, r63
-LOCAL(ia_r7_push): /* Push r7 onto the stack. */
- movi 1 << 12, r39
- andc r0, r39, r0
- stx.q r17, r63, r7
- addi.l r17, 8, r17
- blink tr1, r63
-LOCAL(ia_r8_push): /* Push r8 onto the stack. */
- movi 1 << 8, r39
- andc r0, r39, r0
- stx.q r17, r63, r8
- addi.l r17, 8, r17
- blink tr1, r63
-LOCAL(ia_push_seq): /* Push a sequence of registers onto the stack. */
- andi r0, 7 << 1, r38
- movi (LOCAL(ia_end_of_push_seq) >> 16) & 65535, r40
- shlli r38, 2, r39
- shori LOCAL(ia_end_of_push_seq) & 65535, r40
- sub.l r40, r39, r41
- ptabs/l r41, tr2
- blink tr2, r63
-LOCAL(ia_stack_of_push_seq): /* Beginning of push sequence. */
- stx.q r17, r63, r3
- addi.l r17, 8, r17
- stx.q r17, r63, r4
- addi.l r17, 8, r17
- stx.q r17, r63, r5
- addi.l r17, 8, r17
- stx.q r17, r63, r6
- addi.l r17, 8, r17
- stx.q r17, r63, r7
- addi.l r17, 8, r17
- stx.q r17, r63, r8
- addi.l r17, 8, r17
-LOCAL(ia_r9_push): /* Push r9 onto the stack. */
- stx.q r17, r63, r9
-LOCAL(ia_return): /* Return. */
- blink tr0, r63
-LOCAL(ia_end_of_push_seq): /* Label used to compute the first push instruction. */
- ENDFUNC(GLOBAL(GCC_shcompact_incoming_args))
-#endif /* L_shcompact_incoming_args */
-#endif
-#if __SH5__
-#ifdef L_nested_trampoline
-#if __SH5__ == 32
- .section .text..SHmedia32,"ax"
-#else
- .text
-#endif
- .align 3 /* It is copied in units of 8 bytes in SHmedia mode. */
- .global GLOBAL(GCC_nested_trampoline)
- HIDDEN_FUNC(GLOBAL(GCC_nested_trampoline))
-GLOBAL(GCC_nested_trampoline):
- .mode SHmedia
- ptrel/u r63, tr0
- gettr tr0, r0
-#if __SH5__ == 64
- ld.q r0, 24, r1
-#else
- ld.l r0, 24, r1
-#endif
- ptabs/l r1, tr1
-#if __SH5__ == 64
- ld.q r0, 32, r1
-#else
- ld.l r0, 28, r1
-#endif
- blink tr1, r63
-
- ENDFUNC(GLOBAL(GCC_nested_trampoline))
-#endif /* L_nested_trampoline */
-#endif /* __SH5__ */
-#if __SH5__ == 32
-#ifdef L_push_pop_shmedia_regs
- .section .text..SHmedia32,"ax"
- .mode SHmedia
- .align 2
-#ifndef __SH4_NOFPU__
- .global GLOBAL(GCC_push_shmedia_regs)
- FUNC(GLOBAL(GCC_push_shmedia_regs))
-GLOBAL(GCC_push_shmedia_regs):
- addi.l r15, -14*8, r15
- fst.d r15, 13*8, dr62
- fst.d r15, 12*8, dr60
- fst.d r15, 11*8, dr58
- fst.d r15, 10*8, dr56
- fst.d r15, 9*8, dr54
- fst.d r15, 8*8, dr52
- fst.d r15, 7*8, dr50
- fst.d r15, 6*8, dr48
- fst.d r15, 5*8, dr46
- fst.d r15, 4*8, dr44
- fst.d r15, 3*8, dr42
- fst.d r15, 2*8, dr40
- fst.d r15, 1*8, dr38
- fst.d r15, 0*8, dr36
-#else /* ! __SH4_NOFPU__ */
- .global GLOBAL(GCC_push_shmedia_regs_nofpu)
- FUNC(GLOBAL(GCC_push_shmedia_regs_nofpu))
-GLOBAL(GCC_push_shmedia_regs_nofpu):
-#endif /* ! __SH4_NOFPU__ */
- ptabs/l r18, tr0
- addi.l r15, -27*8, r15
- gettr tr7, r62
- gettr tr6, r61
- gettr tr5, r60
- st.q r15, 26*8, r62
- st.q r15, 25*8, r61
- st.q r15, 24*8, r60
- st.q r15, 23*8, r59
- st.q r15, 22*8, r58
- st.q r15, 21*8, r57
- st.q r15, 20*8, r56
- st.q r15, 19*8, r55
- st.q r15, 18*8, r54
- st.q r15, 17*8, r53
- st.q r15, 16*8, r52
- st.q r15, 15*8, r51
- st.q r15, 14*8, r50
- st.q r15, 13*8, r49
- st.q r15, 12*8, r48
- st.q r15, 11*8, r47
- st.q r15, 10*8, r46
- st.q r15, 9*8, r45
- st.q r15, 8*8, r44
- st.q r15, 7*8, r35
- st.q r15, 6*8, r34
- st.q r15, 5*8, r33
- st.q r15, 4*8, r32
- st.q r15, 3*8, r31
- st.q r15, 2*8, r30
- st.q r15, 1*8, r29
- st.q r15, 0*8, r28
- blink tr0, r63
-#ifndef __SH4_NOFPU__
- ENDFUNC(GLOBAL(GCC_push_shmedia_regs))
-#else
- ENDFUNC(GLOBAL(GCC_push_shmedia_regs_nofpu))
-#endif
-#ifndef __SH4_NOFPU__
- .global GLOBAL(GCC_pop_shmedia_regs)
- FUNC(GLOBAL(GCC_pop_shmedia_regs))
-GLOBAL(GCC_pop_shmedia_regs):
- pt .L0, tr1
- movi 41*8, r0
- fld.d r15, 40*8, dr62
- fld.d r15, 39*8, dr60
- fld.d r15, 38*8, dr58
- fld.d r15, 37*8, dr56
- fld.d r15, 36*8, dr54
- fld.d r15, 35*8, dr52
- fld.d r15, 34*8, dr50
- fld.d r15, 33*8, dr48
- fld.d r15, 32*8, dr46
- fld.d r15, 31*8, dr44
- fld.d r15, 30*8, dr42
- fld.d r15, 29*8, dr40
- fld.d r15, 28*8, dr38
- fld.d r15, 27*8, dr36
- blink tr1, r63
-#else /* ! __SH4_NOFPU__ */
- .global GLOBAL(GCC_pop_shmedia_regs_nofpu)
- FUNC(GLOBAL(GCC_pop_shmedia_regs_nofpu))
-GLOBAL(GCC_pop_shmedia_regs_nofpu):
-#endif /* ! __SH4_NOFPU__ */
- movi 27*8, r0
-.L0:
- ptabs r18, tr0
- ld.q r15, 26*8, r62
- ld.q r15, 25*8, r61
- ld.q r15, 24*8, r60
- ptabs r62, tr7
- ptabs r61, tr6
- ptabs r60, tr5
- ld.q r15, 23*8, r59
- ld.q r15, 22*8, r58
- ld.q r15, 21*8, r57
- ld.q r15, 20*8, r56
- ld.q r15, 19*8, r55
- ld.q r15, 18*8, r54
- ld.q r15, 17*8, r53
- ld.q r15, 16*8, r52
- ld.q r15, 15*8, r51
- ld.q r15, 14*8, r50
- ld.q r15, 13*8, r49
- ld.q r15, 12*8, r48
- ld.q r15, 11*8, r47
- ld.q r15, 10*8, r46
- ld.q r15, 9*8, r45
- ld.q r15, 8*8, r44
- ld.q r15, 7*8, r35
- ld.q r15, 6*8, r34
- ld.q r15, 5*8, r33
- ld.q r15, 4*8, r32
- ld.q r15, 3*8, r31
- ld.q r15, 2*8, r30
- ld.q r15, 1*8, r29
- ld.q r15, 0*8, r28
- add.l r15, r0, r15
- blink tr0, r63
-
-#ifndef __SH4_NOFPU__
- ENDFUNC(GLOBAL(GCC_pop_shmedia_regs))
-#else
- ENDFUNC(GLOBAL(GCC_pop_shmedia_regs_nofpu))
-#endif
-#endif /* __SH5__ == 32 */
-#endif /* L_push_pop_shmedia_regs */
-
-#ifdef L_div_table
-#if __SH5__
-#if defined(__pic__) && defined(__SHMEDIA__)
- .global GLOBAL(sdivsi3)
- FUNC(GLOBAL(sdivsi3))
-#if __SH5__ == 32
- .section .text..SHmedia32,"ax"
-#else
- .text
-#endif
-#if 0
-/* ??? FIXME: Presumably due to a linker bug, exporting data symbols
- in a text section does not work (at least for shared libraries):
- the linker sets the LSB of the address as if this was SHmedia code. */
-#define TEXT_DATA_BUG
-#endif
- .align 2
- // inputs: r4,r5
- // clobbered: r1,r18,r19,r20,r21,r25,tr0
- // result in r0
- .global GLOBAL(sdivsi3)
-GLOBAL(sdivsi3):
-#ifdef TEXT_DATA_BUG
- ptb datalabel Local_div_table,tr0
-#else
- ptb GLOBAL(div_table_internal),tr0
-#endif
- nsb r5, r1
- shlld r5, r1, r25 // normalize; [-2 ..1, 1..2) in s2.62
- shari r25, 58, r21 // extract 5(6) bit index (s2.4 with hole -1..1)
- /* bubble */
- gettr tr0,r20
- ldx.ub r20, r21, r19 // u0.8
- shari r25, 32, r25 // normalize to s2.30
- shlli r21, 1, r21
- muls.l r25, r19, r19 // s2.38
- ldx.w r20, r21, r21 // s2.14
- ptabs r18, tr0
- shari r19, 24, r19 // truncate to s2.14
- sub r21, r19, r19 // some 11 bit inverse in s1.14
- muls.l r19, r19, r21 // u0.28
- sub r63, r1, r1
- addi r1, 92, r1
- muls.l r25, r21, r18 // s2.58
- shlli r19, 45, r19 // multiply by two and convert to s2.58
- /* bubble */
- sub r19, r18, r18
- shari r18, 28, r18 // some 22 bit inverse in s1.30
- muls.l r18, r25, r0 // s2.60
- muls.l r18, r4, r25 // s32.30
- /* bubble */
- shari r0, 16, r19 // s-16.44
- muls.l r19, r18, r19 // s-16.74
- shari r25, 63, r0
- shari r4, 14, r18 // s19.-14
- shari r19, 30, r19 // s-16.44
- muls.l r19, r18, r19 // s15.30
- xor r21, r0, r21 // You could also use the constant 1 << 27.
- add r21, r25, r21
- sub r21, r19, r21
- shard r21, r1, r21
- sub r21, r0, r0
- blink tr0, r63
- ENDFUNC(GLOBAL(sdivsi3))
-/* This table has been generated by divtab.c .
-Defects for bias -330:
- Max defect: 6.081536e-07 at -1.000000e+00
- Min defect: 2.849516e-08 at 1.030651e+00
- Max 2nd step defect: 9.606539e-12 at -1.000000e+00
- Min 2nd step defect: 0.000000e+00 at 0.000000e+00
- Defect at 1: 1.238659e-07
- Defect at -2: 1.061708e-07 */
-#else /* ! __pic__ || ! __SHMEDIA__ */
- .section .rodata
-#endif /* __pic__ */
-#if defined(TEXT_DATA_BUG) && defined(__pic__) && defined(__SHMEDIA__)
- .balign 2
- .type Local_div_table,@object
- .size Local_div_table,128
-/* negative division constants */
- .word -16638
- .word -17135
- .word -17737
- .word -18433
- .word -19103
- .word -19751
- .word -20583
- .word -21383
- .word -22343
- .word -23353
- .word -24407
- .word -25582
- .word -26863
- .word -28382
- .word -29965
- .word -31800
-/* negative division factors */
- .byte 66
- .byte 70
- .byte 75
- .byte 81
- .byte 87
- .byte 93
- .byte 101
- .byte 109
- .byte 119
- .byte 130
- .byte 142
- .byte 156
- .byte 172
- .byte 192
- .byte 214
- .byte 241
- .skip 16
-Local_div_table:
- .skip 16
-/* positive division factors */
- .byte 241
- .byte 214
- .byte 192
- .byte 172
- .byte 156
- .byte 142
- .byte 130
- .byte 119
- .byte 109
- .byte 101
- .byte 93
- .byte 87
- .byte 81
- .byte 75
- .byte 70
- .byte 66
-/* positive division constants */
- .word 31801
- .word 29966
- .word 28383
- .word 26864
- .word 25583
- .word 24408
- .word 23354
- .word 22344
- .word 21384
- .word 20584
- .word 19752
- .word 19104
- .word 18434
- .word 17738
- .word 17136
- .word 16639
- .section .rodata
-#endif /* TEXT_DATA_BUG */
- .balign 2
- .type GLOBAL(div_table),@object
- .size GLOBAL(div_table),128
-/* negative division constants */
- .word -16638
- .word -17135
- .word -17737
- .word -18433
- .word -19103
- .word -19751
- .word -20583
- .word -21383
- .word -22343
- .word -23353
- .word -24407
- .word -25582
- .word -26863
- .word -28382
- .word -29965
- .word -31800
-/* negative division factors */
- .byte 66
- .byte 70
- .byte 75
- .byte 81
- .byte 87
- .byte 93
- .byte 101
- .byte 109
- .byte 119
- .byte 130
- .byte 142
- .byte 156
- .byte 172
- .byte 192
- .byte 214
- .byte 241
- .skip 16
- .global GLOBAL(div_table)
-GLOBAL(div_table):
- HIDDEN_ALIAS(div_table_internal,div_table)
- .skip 16
-/* positive division factors */
- .byte 241
- .byte 214
- .byte 192
- .byte 172
- .byte 156
- .byte 142
- .byte 130
- .byte 119
- .byte 109
- .byte 101
- .byte 93
- .byte 87
- .byte 81
- .byte 75
- .byte 70
- .byte 66
-/* positive division constants */
- .word 31801
- .word 29966
- .word 28383
- .word 26864
- .word 25583
- .word 24408
- .word 23354
- .word 22344
- .word 21384
- .word 20584
- .word 19752
- .word 19104
- .word 18434
- .word 17738
- .word 17136
- .word 16639
-
-#elif defined (__SH3__) || defined (__SH3E__) || defined (__SH4__) || defined (__SH4_SINGLE__) || defined (__SH4_SINGLE_ONLY__) || defined (__SH4_NOFPU__)
-/* This code used shld, thus is not suitable for SH1 / SH2. */
-
-/* Signed / unsigned division without use of FPU, optimized for SH4.
- Uses a lookup table for divisors in the range -128 .. +128, and
- div1 with case distinction for larger divisors in three more ranges.
- The code is lumped together with the table to allow the use of mova. */
-#ifdef __LITTLE_ENDIAN__
-#define L_LSB 0
-#define L_LSWMSB 1
-#define L_MSWLSB 2
-#else
-#define L_LSB 3
-#define L_LSWMSB 2
-#define L_MSWLSB 1
-#endif
-
- .balign 4
- .global GLOBAL(udivsi3_i4i)
- FUNC(GLOBAL(udivsi3_i4i))
-GLOBAL(udivsi3_i4i):
- mov.w LOCAL(c128_w), r1
- div0u
- mov r4,r0
- shlr8 r0
- cmp/hi r1,r5
- extu.w r5,r1
- bf LOCAL(udiv_le128)
- cmp/eq r5,r1
- bf LOCAL(udiv_ge64k)
- shlr r0
- mov r5,r1
- shll16 r5
- mov.l r4,@-r15
- div1 r5,r0
- mov.l r1,@-r15
- div1 r5,r0
- div1 r5,r0
- bra LOCAL(udiv_25)
- div1 r5,r0
-
-LOCAL(div_le128):
- mova LOCAL(div_table_ix),r0
- bra LOCAL(div_le128_2)
- mov.b @(r0,r5),r1
-LOCAL(udiv_le128):
- mov.l r4,@-r15
- mova LOCAL(div_table_ix),r0
- mov.b @(r0,r5),r1
- mov.l r5,@-r15
-LOCAL(div_le128_2):
- mova LOCAL(div_table_inv),r0
- mov.l @(r0,r1),r1
- mov r5,r0
- tst #0xfe,r0
- mova LOCAL(div_table_clz),r0
- dmulu.l r1,r4
- mov.b @(r0,r5),r1
- bt/s LOCAL(div_by_1)
- mov r4,r0
- mov.l @r15+,r5
- sts mach,r0
- /* clrt */
- addc r4,r0
- mov.l @r15+,r4
- rotcr r0
- rts
- shld r1,r0
-
-LOCAL(div_by_1_neg):
- neg r4,r0
-LOCAL(div_by_1):
- mov.l @r15+,r5
- rts
- mov.l @r15+,r4
-
-LOCAL(div_ge64k):
- bt/s LOCAL(div_r8)
- div0u
- shll8 r5
- bra LOCAL(div_ge64k_2)
- div1 r5,r0
-LOCAL(udiv_ge64k):
- cmp/hi r0,r5
- mov r5,r1
- bt LOCAL(udiv_r8)
- shll8 r5
- mov.l r4,@-r15
- div1 r5,r0
- mov.l r1,@-r15
-LOCAL(div_ge64k_2):
- div1 r5,r0
- mov.l LOCAL(zero_l),r1
- .rept 4
- div1 r5,r0
- .endr
- mov.l r1,@-r15
- div1 r5,r0
- mov.w LOCAL(m256_w),r1
- div1 r5,r0
- mov.b r0,@(L_LSWMSB,r15)
- xor r4,r0
- and r1,r0
- bra LOCAL(div_ge64k_end)
- xor r4,r0
-
-LOCAL(div_r8):
- shll16 r4
- bra LOCAL(div_r8_2)
- shll8 r4
-LOCAL(udiv_r8):
- mov.l r4,@-r15
- shll16 r4
- clrt
- shll8 r4
- mov.l r5,@-r15
-LOCAL(div_r8_2):
- rotcl r4
- mov r0,r1
- div1 r5,r1
- mov r4,r0
- rotcl r0
- mov r5,r4
- div1 r5,r1
- .rept 5
- rotcl r0; div1 r5,r1
- .endr
- rotcl r0
- mov.l @r15+,r5
- div1 r4,r1
- mov.l @r15+,r4
- rts
- rotcl r0
-
- ENDFUNC(GLOBAL(udivsi3_i4i))
-
- .global GLOBAL(sdivsi3_i4i)
- FUNC(GLOBAL(sdivsi3_i4i))
- /* This is link-compatible with a GLOBAL(sdivsi3) call,
- but we effectively clobber only r1. */
-GLOBAL(sdivsi3_i4i):
- mov.l r4,@-r15
- cmp/pz r5
- mov.w LOCAL(c128_w), r1
- bt/s LOCAL(pos_divisor)
- cmp/pz r4
- mov.l r5,@-r15
- neg r5,r5
- bt/s LOCAL(neg_result)
- cmp/hi r1,r5
- neg r4,r4
-LOCAL(pos_result):
- extu.w r5,r0
- bf LOCAL(div_le128)
- cmp/eq r5,r0
- mov r4,r0
- shlr8 r0
- bf/s LOCAL(div_ge64k)
- cmp/hi r0,r5
- div0u
- shll16 r5
- div1 r5,r0
- div1 r5,r0
- div1 r5,r0
-LOCAL(udiv_25):
- mov.l LOCAL(zero_l),r1
- div1 r5,r0
- div1 r5,r0
- mov.l r1,@-r15
- .rept 3
- div1 r5,r0
- .endr
- mov.b r0,@(L_MSWLSB,r15)
- xtrct r4,r0
- swap.w r0,r0
- .rept 8
- div1 r5,r0
- .endr
- mov.b r0,@(L_LSWMSB,r15)
-LOCAL(div_ge64k_end):
- .rept 8
- div1 r5,r0
- .endr
- mov.l @r15+,r4 ! zero-extension and swap using LS unit.
- extu.b r0,r0
- mov.l @r15+,r5
- or r4,r0
- mov.l @r15+,r4
- rts
- rotcl r0
-
-LOCAL(div_le128_neg):
- tst #0xfe,r0
- mova LOCAL(div_table_ix),r0
- mov.b @(r0,r5),r1
- mova LOCAL(div_table_inv),r0
- bt/s LOCAL(div_by_1_neg)
- mov.l @(r0,r1),r1
- mova LOCAL(div_table_clz),r0
- dmulu.l r1,r4
- mov.b @(r0,r5),r1
- mov.l @r15+,r5
- sts mach,r0
- /* clrt */
- addc r4,r0
- mov.l @r15+,r4
- rotcr r0
- shld r1,r0
- rts
- neg r0,r0
-
-LOCAL(pos_divisor):
- mov.l r5,@-r15
- bt/s LOCAL(pos_result)
- cmp/hi r1,r5
- neg r4,r4
-LOCAL(neg_result):
- extu.w r5,r0
- bf LOCAL(div_le128_neg)
- cmp/eq r5,r0
- mov r4,r0
- shlr8 r0
- bf/s LOCAL(div_ge64k_neg)
- cmp/hi r0,r5
- div0u
- mov.l LOCAL(zero_l),r1
- shll16 r5
- div1 r5,r0
- mov.l r1,@-r15
- .rept 7
- div1 r5,r0
- .endr
- mov.b r0,@(L_MSWLSB,r15)
- xtrct r4,r0
- swap.w r0,r0
- .rept 8
- div1 r5,r0
- .endr
- mov.b r0,@(L_LSWMSB,r15)
-LOCAL(div_ge64k_neg_end):
- .rept 8
- div1 r5,r0
- .endr
- mov.l @r15+,r4 ! zero-extension and swap using LS unit.
- extu.b r0,r1
- mov.l @r15+,r5
- or r4,r1
-LOCAL(div_r8_neg_end):
- mov.l @r15+,r4
- rotcl r1
- rts
- neg r1,r0
-
-LOCAL(div_ge64k_neg):
- bt/s LOCAL(div_r8_neg)
- div0u
- shll8 r5
- mov.l LOCAL(zero_l),r1
- .rept 6
- div1 r5,r0
- .endr
- mov.l r1,@-r15
- div1 r5,r0
- mov.w LOCAL(m256_w),r1
- div1 r5,r0
- mov.b r0,@(L_LSWMSB,r15)
- xor r4,r0
- and r1,r0
- bra LOCAL(div_ge64k_neg_end)
- xor r4,r0
-
-LOCAL(c128_w):
- .word 128
-
-LOCAL(div_r8_neg):
- clrt
- shll16 r4
- mov r4,r1
- shll8 r1
- mov r5,r4
- .rept 7
- rotcl r1; div1 r5,r0
- .endr
- mov.l @r15+,r5
- rotcl r1
- bra LOCAL(div_r8_neg_end)
- div1 r4,r0
-
-LOCAL(m256_w):
- .word 0xff00
-/* This table has been generated by divtab-sh4.c. */
- .balign 4
-LOCAL(div_table_clz):
- .byte 0
- .byte 1
- .byte 0
- .byte -1
- .byte -1
- .byte -2
- .byte -2
- .byte -2
- .byte -2
- .byte -3
- .byte -3
- .byte -3
- .byte -3
- .byte -3
- .byte -3
- .byte -3
- .byte -3
- .byte -4
- .byte -4
- .byte -4
- .byte -4
- .byte -4
- .byte -4
- .byte -4
- .byte -4
- .byte -4
- .byte -4
- .byte -4
- .byte -4
- .byte -4
- .byte -4
- .byte -4
- .byte -4
- .byte -5
- .byte -5
- .byte -5
- .byte -5
- .byte -5
- .byte -5
- .byte -5
- .byte -5
- .byte -5
- .byte -5
- .byte -5
- .byte -5
- .byte -5
- .byte -5
- .byte -5
- .byte -5
- .byte -5
- .byte -5
- .byte -5
- .byte -5
- .byte -5
- .byte -5
- .byte -5
- .byte -5
- .byte -5
- .byte -5
- .byte -5
- .byte -5
- .byte -5
- .byte -5
- .byte -5
- .byte -5
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
- .byte -6
-/* Lookup table translating positive divisor to index into table of
- normalized inverse. N.B. the '0' entry is also the last entry of the
- previous table, and causes an unaligned access for division by zero. */
-LOCAL(div_table_ix):
- .byte -6
- .byte -128
- .byte -128
- .byte 0
- .byte -128
- .byte -64
- .byte 0
- .byte 64
- .byte -128
- .byte -96
- .byte -64
- .byte -32
- .byte 0
- .byte 32
- .byte 64
- .byte 96
- .byte -128
- .byte -112
- .byte -96
- .byte -80
- .byte -64
- .byte -48
- .byte -32
- .byte -16
- .byte 0
- .byte 16
- .byte 32
- .byte 48
- .byte 64
- .byte 80
- .byte 96
- .byte 112
- .byte -128
- .byte -120
- .byte -112
- .byte -104
- .byte -96
- .byte -88
- .byte -80
- .byte -72
- .byte -64
- .byte -56
- .byte -48
- .byte -40
- .byte -32
- .byte -24
- .byte -16
- .byte -8
- .byte 0
- .byte 8
- .byte 16
- .byte 24
- .byte 32
- .byte 40
- .byte 48
- .byte 56
- .byte 64
- .byte 72
- .byte 80
- .byte 88
- .byte 96
- .byte 104
- .byte 112
- .byte 120
- .byte -128
- .byte -124
- .byte -120
- .byte -116
- .byte -112
- .byte -108
- .byte -104
- .byte -100
- .byte -96
- .byte -92
- .byte -88
- .byte -84
- .byte -80
- .byte -76
- .byte -72
- .byte -68
- .byte -64
- .byte -60
- .byte -56
- .byte -52
- .byte -48
- .byte -44
- .byte -40
- .byte -36
- .byte -32
- .byte -28
- .byte -24
- .byte -20
- .byte -16
- .byte -12
- .byte -8
- .byte -4
- .byte 0
- .byte 4
- .byte 8
- .byte 12
- .byte 16
- .byte 20
- .byte 24
- .byte 28
- .byte 32
- .byte 36
- .byte 40
- .byte 44
- .byte 48
- .byte 52
- .byte 56
- .byte 60
- .byte 64
- .byte 68
- .byte 72
- .byte 76
- .byte 80
- .byte 84
- .byte 88
- .byte 92
- .byte 96
- .byte 100
- .byte 104
- .byte 108
- .byte 112
- .byte 116
- .byte 120
- .byte 124
- .byte -128
-/* 1/64 .. 1/127, normalized. There is an implicit leading 1 in bit 32. */
- .balign 4
-LOCAL(zero_l):
- .long 0x0
- .long 0xF81F81F9
- .long 0xF07C1F08
- .long 0xE9131AC0
- .long 0xE1E1E1E2
- .long 0xDAE6076C
- .long 0xD41D41D5
- .long 0xCD856891
- .long 0xC71C71C8
- .long 0xC0E07039
- .long 0xBACF914D
- .long 0xB4E81B4F
- .long 0xAF286BCB
- .long 0xA98EF607
- .long 0xA41A41A5
- .long 0x9EC8E952
- .long 0x9999999A
- .long 0x948B0FCE
- .long 0x8F9C18FA
- .long 0x8ACB90F7
- .long 0x86186187
- .long 0x81818182
- .long 0x7D05F418
- .long 0x78A4C818
- .long 0x745D1746
- .long 0x702E05C1
- .long 0x6C16C16D
- .long 0x68168169
- .long 0x642C8591
- .long 0x60581606
- .long 0x5C9882BA
- .long 0x58ED2309
-LOCAL(div_table_inv):
- .long 0x55555556
- .long 0x51D07EAF
- .long 0x4E5E0A73
- .long 0x4AFD6A06
- .long 0x47AE147B
- .long 0x446F8657
- .long 0x41414142
- .long 0x3E22CBCF
- .long 0x3B13B13C
- .long 0x38138139
- .long 0x3521CFB3
- .long 0x323E34A3
- .long 0x2F684BDB
- .long 0x2C9FB4D9
- .long 0x29E4129F
- .long 0x27350B89
- .long 0x24924925
- .long 0x21FB7813
- .long 0x1F7047DD
- .long 0x1CF06ADB
- .long 0x1A7B9612
- .long 0x18118119
- .long 0x15B1E5F8
- .long 0x135C8114
- .long 0x11111112
- .long 0xECF56BF
- .long 0xC9714FC
- .long 0xA6810A7
- .long 0x8421085
- .long 0x624DD30
- .long 0x4104105
- .long 0x2040811
- /* maximum error: 0.987342 scaled: 0.921875*/
-
- ENDFUNC(GLOBAL(sdivsi3_i4i))
-#endif /* SH3 / SH4 */
-
-#endif /* L_div_table */
-
-#ifdef L_udiv_qrnnd_16
-#if !__SHMEDIA__
- HIDDEN_FUNC(GLOBAL(udiv_qrnnd_16))
- /* r0: rn r1: qn */ /* r0: n1 r4: n0 r5: d r6: d1 */ /* r2: __m */
- /* n1 < d, but n1 might be larger than d1. */
- .global GLOBAL(udiv_qrnnd_16)
- .balign 8
-GLOBAL(udiv_qrnnd_16):
- div0u
- cmp/hi r6,r0
- bt .Lots
- .rept 16
- div1 r6,r0
- .endr
- extu.w r0,r1
- bt 0f
- add r6,r0
-0: rotcl r1
- mulu.w r1,r5
- xtrct r4,r0
- swap.w r0,r0
- sts macl,r2
- cmp/hs r2,r0
- sub r2,r0
- bt 0f
- addc r5,r0
- add #-1,r1
- bt 0f
-1: add #-1,r1
- rts
- add r5,r0
- .balign 8
-.Lots:
- sub r5,r0
- swap.w r4,r1
- xtrct r0,r1
- clrt
- mov r1,r0
- addc r5,r0
- mov #-1,r1
- SL1(bf, 1b,
- shlr16 r1)
-0: rts
- nop
- ENDFUNC(GLOBAL(udiv_qrnnd_16))
-#endif /* !__SHMEDIA__ */
-#endif /* L_udiv_qrnnd_16 */
diff --git a/gcc/config/sh/lib1funcs.h b/gcc/config/sh/lib1funcs.h
deleted file mode 100644
index af4b41cc314..00000000000
--- a/gcc/config/sh/lib1funcs.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/* Copyright (C) 1994, 1995, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
- 2004, 2005, 2006, 2009
- Free Software Foundation, Inc.
-
-This file is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3, or (at your option) any
-later version.
-
-This file 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/>. */
-
-#ifdef __ELF__
-#define LOCAL(X) .L_##X
-#define FUNC(X) .type X,@function
-#define HIDDEN_FUNC(X) FUNC(X); .hidden X
-#define HIDDEN_ALIAS(X,Y) ALIAS (X,Y); .hidden GLOBAL(X)
-#define ENDFUNC0(X) .Lfe_##X: .size X,.Lfe_##X-X
-#define ENDFUNC(X) ENDFUNC0(X)
-#else
-#define LOCAL(X) L_##X
-#define FUNC(X)
-#define HIDDEN_FUNC(X)
-#define HIDDEN_ALIAS(X,Y) ALIAS (X,Y)
-#define ENDFUNC(X)
-#endif
-
-#define CONCAT(A,B) A##B
-#define GLOBAL0(U,X) CONCAT(U,__##X)
-#define GLOBAL(X) GLOBAL0(__USER_LABEL_PREFIX__,X)
-
-#define ALIAS(X,Y) .global GLOBAL(X); .set GLOBAL(X),GLOBAL(Y)
-
-#if defined __SH2A__ && defined __FMOVD_ENABLED__
-#undef FMOVD_WORKS
-#define FMOVD_WORKS
-#endif
-
-#ifdef __LITTLE_ENDIAN__
-#define DR00 fr1
-#define DR01 fr0
-#define DR20 fr3
-#define DR21 fr2
-#define DR40 fr5
-#define DR41 fr4
-#else /* !__LITTLE_ENDIAN__ */
-#define DR00 fr0
-#define DR01 fr1
-#define DR20 fr2
-#define DR21 fr3
-#define DR40 fr4
-#define DR41 fr5
-#endif /* !__LITTLE_ENDIAN__ */
-
-#ifdef __sh1__
-#define SL(branch, dest, in_slot, in_slot_arg2) \
- in_slot, in_slot_arg2; branch dest
-#define SL1(branch, dest, in_slot) \
- in_slot; branch dest
-#else /* ! __sh1__ */
-#define SL(branch, dest, in_slot, in_slot_arg2) \
- branch##.s dest; in_slot, in_slot_arg2
-#define SL1(branch, dest, in_slot) \
- branch##/s dest; in_slot
-#endif /* !__sh1__ */
diff --git a/gcc/config/sh/libgcc-excl.ver b/gcc/config/sh/libgcc-excl.ver
deleted file mode 100644
index 325c74054ec..00000000000
--- a/gcc/config/sh/libgcc-excl.ver
+++ /dev/null
@@ -1,8 +0,0 @@
-# Exclude various symbols which should not be visible in libgcc.so for SH.
-%exclude {
- __ashlsi3
- __ashrsi3
- __lshrsi3
- __mulsi3 # this is an SH1-only symbol.
- __udivsi3
-}
diff --git a/gcc/config/sh/libgcc-glibc.ver b/gcc/config/sh/libgcc-glibc.ver
deleted file mode 100644
index b8ec3265310..00000000000
--- a/gcc/config/sh/libgcc-glibc.ver
+++ /dev/null
@@ -1,48 +0,0 @@
-# Copyright (C) 2002, 2008 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/>.
-
-# In order to work around the very problems that force us to now generally
-# create a libgcc.so, glibc reexported a number of routines from libgcc.a.
-# By now choosing the same version tags for these specific routines, we
-# maintain enough binary compatibility to allow future versions of glibc
-# to defer implementation of these routines to libgcc.so via DT_AUXILIARY.
-
-# Note that we cannot use the default libgcc-glibc.ver file on sh,
-# because GLIBC_2.0 does not exist on this architecture, as the first
-# ever glibc release on the platform was GLIBC_2.2.
-
-%exclude {
- __register_frame
- __register_frame_table
- __deregister_frame
- __register_frame_info
- __deregister_frame_info
- __frame_state_for
- __register_frame_info_table
-}
-
-%inherit GCC_3.0 GLIBC_2.2
-GLIBC_2.2 {
- __register_frame
- __register_frame_table
- __deregister_frame
- __register_frame_info
- __deregister_frame_info
- __frame_state_for
- __register_frame_info_table
-}
diff --git a/gcc/config/sh/linux-atomic.asm b/gcc/config/sh/linux-atomic.asm
deleted file mode 100644
index 743c61bb76c..00000000000
--- a/gcc/config/sh/linux-atomic.asm
+++ /dev/null
@@ -1,223 +0,0 @@
-/* Copyright (C) 2006, 2008, 2009 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/>. */
-
-
-!! Linux specific atomic routines for the Renesas / SuperH SH CPUs.
-!! Linux kernel for SH3/4 has implemented the support for software
-!! atomic sequences.
-
-#define FUNC(X) .type X,@function
-#define HIDDEN_FUNC(X) FUNC(X); .hidden X
-#define ENDFUNC0(X) .Lfe_##X: .size X,.Lfe_##X-X
-#define ENDFUNC(X) ENDFUNC0(X)
-
-#if ! __SH5__
-
-#define ATOMIC_TEST_AND_SET(N,T,EXT) \
- .global __sync_lock_test_and_set_##N; \
- HIDDEN_FUNC(__sync_lock_test_and_set_##N); \
- .align 2; \
-__sync_lock_test_and_set_##N:; \
- mova 1f, r0; \
- nop; \
- mov r15, r1; \
- mov #(0f-1f), r15; \
-0: mov.##T @r4, r2; \
- mov.##T r5, @r4; \
-1: mov r1, r15; \
- rts; \
- EXT r2, r0; \
- ENDFUNC(__sync_lock_test_and_set_##N)
-
-ATOMIC_TEST_AND_SET (1,b,extu.b)
-ATOMIC_TEST_AND_SET (2,w,extu.w)
-ATOMIC_TEST_AND_SET (4,l,mov)
-
-#define ATOMIC_COMPARE_AND_SWAP(N,T,EXTS,EXT) \
- .global __sync_val_compare_and_swap_##N; \
- HIDDEN_FUNC(__sync_val_compare_and_swap_##N); \
- .align 2; \
-__sync_val_compare_and_swap_##N:; \
- mova 1f, r0; \
- EXTS r5, r5; \
- mov r15, r1; \
- mov #(0f-1f), r15; \
-0: mov.##T @r4, r2; \
- cmp/eq r2, r5; \
- bf 1f; \
- mov.##T r6, @r4; \
-1: mov r1, r15; \
- rts; \
- EXT r2, r0; \
- ENDFUNC(__sync_val_compare_and_swap_##N)
-
-ATOMIC_COMPARE_AND_SWAP (1,b,exts.b,extu.b)
-ATOMIC_COMPARE_AND_SWAP (2,w,exts.w,extu.w)
-ATOMIC_COMPARE_AND_SWAP (4,l,mov,mov)
-
-#define ATOMIC_BOOL_COMPARE_AND_SWAP(N,T,EXTS) \
- .global __sync_bool_compare_and_swap_##N; \
- HIDDEN_FUNC(__sync_bool_compare_and_swap_##N); \
- .align 2; \
-__sync_bool_compare_and_swap_##N:; \
- mova 1f, r0; \
- EXTS r5, r5; \
- mov r15, r1; \
- mov #(0f-1f), r15; \
-0: mov.##T @r4, r2; \
- cmp/eq r2, r5; \
- bf 1f; \
- mov.##T r6, @r4; \
-1: mov r1, r15; \
- rts; \
- movt r0; \
- ENDFUNC(__sync_bool_compare_and_swap_##N)
-
-ATOMIC_BOOL_COMPARE_AND_SWAP (1,b,exts.b)
-ATOMIC_BOOL_COMPARE_AND_SWAP (2,w,exts.w)
-ATOMIC_BOOL_COMPARE_AND_SWAP (4,l,mov)
-
-#define ATOMIC_FETCH_AND_OP(OP,N,T,EXT) \
- .global __sync_fetch_and_##OP##_##N; \
- HIDDEN_FUNC(__sync_fetch_and_##OP##_##N); \
- .align 2; \
-__sync_fetch_and_##OP##_##N:; \
- mova 1f, r0; \
- nop; \
- mov r15, r1; \
- mov #(0f-1f), r15; \
-0: mov.##T @r4, r2; \
- mov r5, r3; \
- OP r2, r3; \
- mov.##T r3, @r4; \
-1: mov r1, r15; \
- rts; \
- EXT r2, r0; \
- ENDFUNC(__sync_fetch_and_##OP##_##N)
-
-ATOMIC_FETCH_AND_OP(add,1,b,extu.b)
-ATOMIC_FETCH_AND_OP(add,2,w,extu.w)
-ATOMIC_FETCH_AND_OP(add,4,l,mov)
-
-ATOMIC_FETCH_AND_OP(or,1,b,extu.b)
-ATOMIC_FETCH_AND_OP(or,2,w,extu.w)
-ATOMIC_FETCH_AND_OP(or,4,l,mov)
-
-ATOMIC_FETCH_AND_OP(and,1,b,extu.b)
-ATOMIC_FETCH_AND_OP(and,2,w,extu.w)
-ATOMIC_FETCH_AND_OP(and,4,l,mov)
-
-ATOMIC_FETCH_AND_OP(xor,1,b,extu.b)
-ATOMIC_FETCH_AND_OP(xor,2,w,extu.w)
-ATOMIC_FETCH_AND_OP(xor,4,l,mov)
-
-#define ATOMIC_FETCH_AND_COMBOP(OP,OP0,OP1,N,T,EXT) \
- .global __sync_fetch_and_##OP##_##N; \
- HIDDEN_FUNC(__sync_fetch_and_##OP##_##N); \
- .align 2; \
-__sync_fetch_and_##OP##_##N:; \
- mova 1f, r0; \
- mov r15, r1; \
- mov #(0f-1f), r15; \
-0: mov.##T @r4, r2; \
- mov r5, r3; \
- OP0 r2, r3; \
- OP1 r3, r3; \
- mov.##T r3, @r4; \
-1: mov r1, r15; \
- rts; \
- EXT r2, r0; \
- ENDFUNC(__sync_fetch_and_##OP##_##N)
-
-ATOMIC_FETCH_AND_COMBOP(sub,sub,neg,1,b,extu.b)
-ATOMIC_FETCH_AND_COMBOP(sub,sub,neg,2,w,extu.w)
-ATOMIC_FETCH_AND_COMBOP(sub,sub,neg,4,l,mov)
-
-ATOMIC_FETCH_AND_COMBOP(nand,and,not,1,b,extu.b)
-ATOMIC_FETCH_AND_COMBOP(nand,and,not,2,w,extu.w)
-ATOMIC_FETCH_AND_COMBOP(nand,and,not,4,l,mov)
-
-#define ATOMIC_OP_AND_FETCH(OP,N,T,EXT) \
- .global __sync_##OP##_and_fetch_##N; \
- HIDDEN_FUNC(__sync_##OP##_and_fetch_##N); \
- .align 2; \
-__sync_##OP##_and_fetch_##N:; \
- mova 1f, r0; \
- nop; \
- mov r15, r1; \
- mov #(0f-1f), r15; \
-0: mov.##T @r4, r2; \
- mov r5, r3; \
- OP r2, r3; \
- mov.##T r3, @r4; \
-1: mov r1, r15; \
- rts; \
- EXT r3, r0; \
- ENDFUNC(__sync_##OP##_and_fetch_##N)
-
-ATOMIC_OP_AND_FETCH(add,1,b,extu.b)
-ATOMIC_OP_AND_FETCH(add,2,w,extu.w)
-ATOMIC_OP_AND_FETCH(add,4,l,mov)
-
-ATOMIC_OP_AND_FETCH(or,1,b,extu.b)
-ATOMIC_OP_AND_FETCH(or,2,w,extu.w)
-ATOMIC_OP_AND_FETCH(or,4,l,mov)
-
-ATOMIC_OP_AND_FETCH(and,1,b,extu.b)
-ATOMIC_OP_AND_FETCH(and,2,w,extu.w)
-ATOMIC_OP_AND_FETCH(and,4,l,mov)
-
-ATOMIC_OP_AND_FETCH(xor,1,b,extu.b)
-ATOMIC_OP_AND_FETCH(xor,2,w,extu.w)
-ATOMIC_OP_AND_FETCH(xor,4,l,mov)
-
-#define ATOMIC_COMBOP_AND_FETCH(OP,OP0,OP1,N,T,EXT) \
- .global __sync_##OP##_and_fetch_##N; \
- HIDDEN_FUNC(__sync_##OP##_and_fetch_##N); \
- .align 2; \
-__sync_##OP##_and_fetch_##N:; \
- mova 1f, r0; \
- mov r15, r1; \
- mov #(0f-1f), r15; \
-0: mov.##T @r4, r2; \
- mov r5, r3; \
- OP0 r2, r3; \
- OP1 r3, r3; \
- mov.##T r3, @r4; \
-1: mov r1, r15; \
- rts; \
- EXT r3, r0; \
- ENDFUNC(__sync_##OP##_and_fetch_##N)
-
-ATOMIC_COMBOP_AND_FETCH(sub,sub,neg,1,b,extu.b)
-ATOMIC_COMBOP_AND_FETCH(sub,sub,neg,2,w,extu.w)
-ATOMIC_COMBOP_AND_FETCH(sub,sub,neg,4,l,mov)
-
-ATOMIC_COMBOP_AND_FETCH(nand,and,not,1,b,extu.b)
-ATOMIC_COMBOP_AND_FETCH(nand,and,not,2,w,extu.w)
-ATOMIC_COMBOP_AND_FETCH(nand,and,not,4,l,mov)
-
-.section .note.GNU-stack,"",%progbits
-.previous
-
-#endif /* ! __SH5__ */
diff --git a/gcc/config/sh/sh.h b/gcc/config/sh/sh.h
index 1e654801334..cc26e05a764 100644
--- a/gcc/config/sh/sh.h
+++ b/gcc/config/sh/sh.h
@@ -1983,7 +1983,7 @@ struct sh_args {
that the native compiler puts too large (> 32) immediate shift counts
into a register and shifts by the register, letting the SH decide what
to do instead of doing that itself. */
-/* ??? The library routines in lib1funcs.asm truncate the shift count.
+/* ??? The library routines in lib1funcs.S truncate the shift count.
However, the SH3 has hardware shifts that do not truncate exactly as gcc
expects - the sign bit is significant - so it appears that we need to
leave this zero for correct SH3 code. */
diff --git a/gcc/config/sh/t-elf b/gcc/config/sh/t-elf
deleted file mode 100644
index 333efb54e09..00000000000
--- a/gcc/config/sh/t-elf
+++ /dev/null
@@ -1,10 +0,0 @@
-EXTRA_MULTILIB_PARTS= crt1.o crti.o crtn.o \
- crtbegin.o crtend.o crtbeginS.o crtendS.o $(IC_EXTRA_PARTS) $(OPT_EXTRA_PARTS)
-
-# Compile crtbeginS.o and crtendS.o with pic.
-CRTSTUFF_T_CFLAGS_S = -fPIC
-
-# Don't compile libgcc with -fpic for now. It's unlikely that we'll
-# build shared libraries for embedded SH.
-# Linux / Netbsd will already have set TARGET_LIBGCC2_CFLAGS.
-# TARGET_LIBGCC2_CFLAGS = -fpic
diff --git a/gcc/config/sh/t-linux b/gcc/config/sh/t-linux
index 13ff848dd7c..d33c6383915 100644
--- a/gcc/config/sh/t-linux
+++ b/gcc/config/sh/t-linux
@@ -1,8 +1,2 @@
-LIB1ASMFUNCS_CACHE = _ic_invalidate _ic_invalidate_array
-
-LIB2FUNCS_EXTRA= $(srcdir)/config/sh/linux-atomic.asm
-
MULTILIB_DIRNAMES=
MULTILIB_MATCHES =
-
-EXTRA_MULTILIB_PARTS= crtbegin.o crtend.o crtbeginS.o crtendS.o crtbeginT.o
diff --git a/gcc/config/sh/t-linux64 b/gcc/config/sh/t-linux64
deleted file mode 100644
index 126b0163754..00000000000
--- a/gcc/config/sh/t-linux64
+++ /dev/null
@@ -1 +0,0 @@
-EXTRA_MULTILIB_PARTS= crtbegin.o crtend.o crtbeginS.o crtendS.o crtbeginT.o
diff --git a/gcc/config/sh/t-netbsd b/gcc/config/sh/t-netbsd
deleted file mode 100644
index 11bfe31458e..00000000000
--- a/gcc/config/sh/t-netbsd
+++ /dev/null
@@ -1,24 +0,0 @@
-# Copyright (C) 2002, 2004, 2009, 2011 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/>.
-
-TARGET_LIBGCC2_CFLAGS = -fpic -mieee
-LIB1ASMFUNCS_CACHE = _ic_invalidate
-
-LIB2FUNCS_EXTRA=
-
-EXTRA_MULTILIB_PARTS=
diff --git a/gcc/config/sh/t-sh b/gcc/config/sh/t-sh
index e63131a5348..1d305ee5193 100644
--- a/gcc/config/sh/t-sh
+++ b/gcc/config/sh/t-sh
@@ -22,15 +22,6 @@ sh-c.o: $(srcdir)/config/sh/sh-c.c \
$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
$(srcdir)/config/sh/sh-c.c
-LIB1ASMSRC = sh/lib1funcs.asm
-LIB1ASMFUNCS = _ashiftrt _ashiftrt_n _ashiftlt _lshiftrt _movmem \
- _movmem_i4 _mulsi3 _sdivsi3 _sdivsi3_i4 _udivsi3 _udivsi3_i4 _set_fpscr \
- _div_table _udiv_qrnnd_16 \
- $(LIB1ASMFUNCS_CACHE)
-LIB1ASMFUNCS_CACHE = _ic_invalidate _ic_invalidate_array
-
-TARGET_LIBGCC2_CFLAGS = -mieee
-
DEFAULT_ENDIAN = $(word 1,$(TM_ENDIAN_CONFIG))
OTHER_ENDIAN = $(word 2,$(TM_ENDIAN_CONFIG))
@@ -91,58 +82,9 @@ MULTILIB_OSDIRNAMES = \
m5-64media=!m5-64media $(OTHER_ENDIAN)/m5-64media=!$(OTHER_ENDIAN)/m5-64media \
m5-64media-nofpu=!m5-64media-nofpu $(OTHER_ENDIAN)/m5-64media-nofpu=!$(OTHER_ENDIAN)/m5-64media-nofpu
-LIBGCC = stmp-multilib
-INSTALL_LIBGCC = install-multilib
-
-$(T)crt1.o: $(srcdir)/config/sh/crt1.asm $(GCC_PASSES)
- $(GCC_FOR_TARGET) $(MULTILIB_CFLAGS) -c -o $(T)crt1.o -x assembler-with-cpp $(srcdir)/config/sh/crt1.asm
-$(T)crti.o: $(srcdir)/config/sh/crti.asm $(GCC_PASSES)
- $(GCC_FOR_TARGET) $(MULTILIB_CFLAGS) -c -o $(T)crti.o -x assembler-with-cpp $(srcdir)/config/sh/crti.asm
-$(T)crtn.o: $(srcdir)/config/sh/crtn.asm $(GCC_PASSES)
- $(GCC_FOR_TARGET) $(MULTILIB_CFLAGS) -c -o $(T)crtn.o -x assembler-with-cpp $(srcdir)/config/sh/crtn.asm
-
$(out_object_file): gt-sh.h
gt-sh.h : s-gtype ; @true
-# These are not suitable for COFF.
-# EXTRA_MULTILIB_PARTS= crt1.o crti.o crtn.o crtbegin.o crtend.o
-
-IC_EXTRA_PARTS= libic_invalidate_array_4-100.a libic_invalidate_array_4-200.a \
-libic_invalidate_array_4a.a
-OPT_EXTRA_PARTS= libgcc-Os-4-200.a libgcc-4-300.a
-EXTRA_MULTILIB_PARTS= $(IC_EXTRA_PARTS) $(OPT_EXTRA_PARTS)
-
-$(T)ic_invalidate_array_4-100.o: $(srcdir)/config/sh/lib1funcs.asm $(GCC_PASSES)
- $(GCC_FOR_TARGET) $(MULTILIB_CFLAGS) -c -o $(T)ic_invalidate_array_4-100.o -DL_ic_invalidate_array -DWAYS=1 -DWAY_SIZE=0x2000 -x assembler-with-cpp $(srcdir)/config/sh/lib1funcs.asm
-$(T)libic_invalidate_array_4-100.a: $(T)ic_invalidate_array_4-100.o $(GCC_PASSES)
- $(AR_CREATE_FOR_TARGET) $(T)libic_invalidate_array_4-100.a $(T)ic_invalidate_array_4-100.o
-
-$(T)ic_invalidate_array_4-200.o: $(srcdir)/config/sh/lib1funcs.asm $(GCC_PASSES)
- $(GCC_FOR_TARGET) $(MULTILIB_CFLAGS) -c -o $(T)ic_invalidate_array_4-200.o -DL_ic_invalidate_array -DWAYS=2 -DWAY_SIZE=0x2000 -x assembler-with-cpp $(srcdir)/config/sh/lib1funcs.asm
-$(T)libic_invalidate_array_4-200.a: $(T)ic_invalidate_array_4-200.o $(GCC_PASSES)
- $(AR_CREATE_FOR_TARGET) $(T)libic_invalidate_array_4-200.a $(T)ic_invalidate_array_4-200.o
-
-$(T)ic_invalidate_array_4a.o: $(srcdir)/config/sh/lib1funcs.asm $(GCC_PASSES)
- $(GCC_FOR_TARGET) $(MULTILIB_CFLAGS) -c -o $(T)ic_invalidate_array_4a.o -DL_ic_invalidate_array -D__FORCE_SH4A__ -x assembler-with-cpp $(srcdir)/config/sh/lib1funcs.asm
-$(T)libic_invalidate_array_4a.a: $(T)ic_invalidate_array_4a.o $(GCC_PASSES)
- $(AR_CREATE_FOR_TARGET) $(T)libic_invalidate_array_4a.a $(T)ic_invalidate_array_4a.o
-
-$(T)sdivsi3_i4i-Os-4-200.o: $(srcdir)/config/sh/lib1funcs-Os-4-200.asm $(GCC_PASSES)
- $(GCC_FOR_TARGET) $(MULTILIB_CFLAGS) -c -o $@ -DL_sdivsi3_i4i -x assembler-with-cpp $<
-$(T)udivsi3_i4i-Os-4-200.o: $(srcdir)/config/sh/lib1funcs-Os-4-200.asm $(GCC_PASSES)
- $(GCC_FOR_TARGET) $(MULTILIB_CFLAGS) -c -o $@ -DL_udivsi3_i4i -x assembler-with-cpp $<
-$(T)unwind-dw2-Os-4-200.o: $(srcdir)/../libgcc/unwind-dw2.c $(srcdir)/../libgcc/unwind-generic.h $(srcdir)/../libgcc/unwind-pe.h $(srcdir)/../libgcc/unwind.inc $(srcdir)/../libgcc/unwind-dw2-fde.h $(srcdir)/../libgcc/unwind-dw2.h $(CONFIG_H) coretypes.h $(TM_H) $(MACHMODE_H) longlong.h config.status stmp-int-hdrs tsystem.h $(GCC_PASSES)
- $(GCC_FOR_TARGET) $(MULTILIB_CFLAGS) $(LIBGCC2_CFLAGS) $(INCLUDES) $(vis_hide) -fexceptions -Os -c -o $@ $<
-OBJS_Os_4_200=$(T)sdivsi3_i4i-Os-4-200.o $(T)udivsi3_i4i-Os-4-200.o $(T)unwind-dw2-Os-4-200.o
-$(T)libgcc-Os-4-200.a: $(OBJS_Os_4_200) $(GCC_PASSES)
- $(AR_CREATE_FOR_TARGET) $@ $(OBJS_Os_4_200)
-
-$(T)div_table-4-300.o: $(srcdir)/config/sh/lib1funcs-4-300.asm $(GCC_PASSES)
- $(GCC_FOR_TARGET) $(MULTILIB_CFLAGS) -c -o $@ -DL_div_table -x assembler-with-cpp $<
-
-$(T)libgcc-4-300.a: $(T)div_table-4-300.o $(GCC_PASSES)
- $(AR_CREATE_FOR_TARGET) $@ $(T)div_table-4-300.o
-
# Local Variables:
# mode: Makefile
# End:
diff --git a/gcc/config/sh/t-sh64 b/gcc/config/sh/t-sh64
index d88f929fd7a..3bd9205079b 100644
--- a/gcc/config/sh/t-sh64
+++ b/gcc/config/sh/t-sh64
@@ -1,4 +1,4 @@
-# Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
+# Copyright (C) 2002, 2004, 2005, 2011 Free Software Foundation, Inc.
#
# This file is part of GCC.
#
@@ -16,13 +16,6 @@
# along with GCC; see the file COPYING3. If not see
# <http://www.gnu.org/licenses/>.
-LIB1ASMFUNCS = \
- _sdivsi3 _sdivsi3_i4 _udivsi3 _udivsi3_i4 _set_fpscr \
- _shcompact_call_trampoline _shcompact_return_trampoline \
- _shcompact_incoming_args _ic_invalidate _nested_trampoline \
- _push_pop_shmedia_regs \
- _udivdi3 _divdi3 _umoddi3 _moddi3 _div_table
-
MULTILIB_CPU_DIRS= $(ML_sh1) $(ML_sh2e) $(ML_sh2) $(ML_sh3e) $(ML_sh3) $(ML_sh4_nofpu) $(ML_sh4_single_only) $(ML_sh4_single) $(ML_sh4) $(ML_sh5_32media:m5-32media/=media32) $(ML_sh5_32media_nofpu:m5-32media-nofpu/=nofpu/media32) $(ML_sh5_compact:m5-compact/=compact) $(ML_sh5_compact_nofpu:m5-compact-nofpu/=nofpu/compact) $(ML_sh5_64media:m5-64media/=media64) $(ML_sh5_64media_nofpu:m5-64media-nofpu/=nofpu/media64)
MULTILIB_RAW_DIRNAMES= $(MULTILIB_ENDIAN:/mb= mb) $(MULTILIB_CPU_DIRS:/=)
diff --git a/gcc/config/sh/t-superh b/gcc/config/sh/t-superh
deleted file mode 100644
index 4e2d83dcba0..00000000000
--- a/gcc/config/sh/t-superh
+++ /dev/null
@@ -1,33 +0,0 @@
-# Copyright (C) 2005, 2006 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/>.
-
-EXTRA_MULTILIB_PARTS= crt1.o crti.o crtn.o \
- crtbegin.o crtend.o crtbeginS.o crtendS.o \
- crt1-mmu.o gcrt1-mmu.o gcrt1.o $(IC_EXTRA_PARTS) $(OPT_EXTRA_PARTS)
-
-# Compile crt1-mmu.o as crt1.o with -DMMU_SUPPORT
-$(T)crt1-mmu.o: $(srcdir)/config/sh/crt1.asm $(GCC_PASSES)
- $(GCC_FOR_TARGET) $(MULTILIB_CFLAGS) -c -o $(T)crt1-mmu.o -DMMU_SUPPORT -x assembler-with-cpp $(srcdir)/config/sh/crt1.asm
-
-# Compile gcrt1-mmu.o as crt1-mmu.o with -DPROFILE
-$(T)gcrt1-mmu.o: $(srcdir)/config/sh/crt1.asm $(GCC_PASSES)
- $(GCC_FOR_TARGET) $(MULTILIB_CFLAGS) -c -o $(T)gcrt1-mmu.o -DPROFILE -DMMU_SUPPORT -x assembler-with-cpp $(srcdir)/config/sh/crt1.asm
-
-# For sh4-400: Compile gcrt1.o as crt1.o with -DPROFILE
-$(T)gcrt1.o: $(srcdir)/config/sh/crt1.asm $(GCC_PASSES)
- $(GCC_FOR_TARGET) $(MULTILIB_CFLAGS) -c -o $(T)gcrt1.o -DPROFILE -x assembler-with-cpp $(srcdir)/config/sh/crt1.asm
diff --git a/gcc/config/sh/t-vxworks b/gcc/config/sh/t-vxworks
index 66aa7091ab1..d7ccc9b7f59 100644
--- a/gcc/config/sh/t-vxworks
+++ b/gcc/config/sh/t-vxworks
@@ -4,6 +4,3 @@ MULTILIB_OPTIONS = mrtp fPIC m2/m3/m4/m4a ml
# Don't build -fPIC without -mrtp, or -ml without -m3/-m4.
MULTILIB_EXCEPTIONS = fPIC* ml* mrtp/ml* mrtp/fPIC/ml* *m2/ml*
MULTILIB_MATCHES = m2=m4-nofpu fPIC=fpic
-
-# Restore a variable from t-vxworks clobbered by t-elf.
-EXTRA_MULTILIB_PARTS =
diff --git a/gcc/config/sparc/lb1spc.asm b/gcc/config/sparc/lb1spc.asm
deleted file mode 100644
index b60bd5740e7..00000000000
--- a/gcc/config/sparc/lb1spc.asm
+++ /dev/null
@@ -1,784 +0,0 @@
-/* This is an assembly language implementation of mulsi3, divsi3, and modsi3
- for the sparc processor.
-
- These routines are derived from the SPARC Architecture Manual, version 8,
- slightly edited to match the desired calling convention, and also to
- optimize them for our purposes. */
-
-#ifdef L_mulsi3
-.text
- .align 4
- .global .umul
- .proc 4
-.umul:
- or %o0, %o1, %o4 ! logical or of multiplier and multiplicand
- mov %o0, %y ! multiplier to Y register
- andncc %o4, 0xfff, %o5 ! mask out lower 12 bits
- be mul_shortway ! can do it the short way
- andcc %g0, %g0, %o4 ! zero the partial product and clear NV cc
- !
- ! long multiply
- !
- mulscc %o4, %o1, %o4 ! first iteration of 33
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4 ! 32nd iteration
- mulscc %o4, %g0, %o4 ! last iteration only shifts
- ! the upper 32 bits of product are wrong, but we do not care
- retl
- rd %y, %o0
- !
- ! short multiply
- !
-mul_shortway:
- mulscc %o4, %o1, %o4 ! first iteration of 13
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4 ! 12th iteration
- mulscc %o4, %g0, %o4 ! last iteration only shifts
- rd %y, %o5
- sll %o4, 12, %o4 ! left shift partial product by 12 bits
- srl %o5, 20, %o5 ! right shift partial product by 20 bits
- retl
- or %o5, %o4, %o0 ! merge for true product
-#endif
-
-#ifdef L_divsi3
-/*
- * Division and remainder, from Appendix E of the SPARC Version 8
- * Architecture Manual, with fixes from Gordon Irlam.
- */
-
-/*
- * Input: dividend and divisor in %o0 and %o1 respectively.
- *
- * m4 parameters:
- * .div name of function to generate
- * div div=div => %o0 / %o1; div=rem => %o0 % %o1
- * true true=true => signed; true=false => unsigned
- *
- * Algorithm parameters:
- * N how many bits per iteration we try to get (4)
- * WORDSIZE total number of bits (32)
- *
- * Derived constants:
- * TOPBITS number of bits in the top decade of a number
- *
- * Important variables:
- * Q the partial quotient under development (initially 0)
- * R the remainder so far, initially the dividend
- * ITER number of main division loop iterations required;
- * equal to ceil(log2(quotient) / N). Note that this
- * is the log base (2^N) of the quotient.
- * V the current comparand, initially divisor*2^(ITER*N-1)
- *
- * Cost:
- * Current estimate for non-large dividend is
- * ceil(log2(quotient) / N) * (10 + 7N/2) + C
- * A large dividend is one greater than 2^(31-TOPBITS) and takes a
- * different path, as the upper bits of the quotient must be developed
- * one bit at a time.
- */
- .global .udiv
- .align 4
- .proc 4
- .text
-.udiv:
- b ready_to_divide
- mov 0, %g3 ! result is always positive
-
- .global .div
- .align 4
- .proc 4
- .text
-.div:
- ! compute sign of result; if neither is negative, no problem
- orcc %o1, %o0, %g0 ! either negative?
- bge ready_to_divide ! no, go do the divide
- xor %o1, %o0, %g3 ! compute sign in any case
- tst %o1
- bge 1f
- tst %o0
- ! %o1 is definitely negative; %o0 might also be negative
- bge ready_to_divide ! if %o0 not negative...
- sub %g0, %o1, %o1 ! in any case, make %o1 nonneg
-1: ! %o0 is negative, %o1 is nonnegative
- sub %g0, %o0, %o0 ! make %o0 nonnegative
-
-
-ready_to_divide:
-
- ! Ready to divide. Compute size of quotient; scale comparand.
- orcc %o1, %g0, %o5
- bne 1f
- mov %o0, %o3
-
- ! Divide by zero trap. If it returns, return 0 (about as
- ! wrong as possible, but that is what SunOS does...).
- ta 0x2 ! ST_DIV0
- retl
- clr %o0
-
-1:
- cmp %o3, %o5 ! if %o1 exceeds %o0, done
- blu got_result ! (and algorithm fails otherwise)
- clr %o2
- sethi %hi(1 << (32 - 4 - 1)), %g1
- cmp %o3, %g1
- blu not_really_big
- clr %o4
-
- ! Here the dividend is >= 2**(31-N) or so. We must be careful here,
- ! as our usual N-at-a-shot divide step will cause overflow and havoc.
- ! The number of bits in the result here is N*ITER+SC, where SC <= N.
- ! Compute ITER in an unorthodox manner: know we need to shift V into
- ! the top decade: so do not even bother to compare to R.
- 1:
- cmp %o5, %g1
- bgeu 3f
- mov 1, %g2
- sll %o5, 4, %o5
- b 1b
- add %o4, 1, %o4
-
- ! Now compute %g2.
- 2: addcc %o5, %o5, %o5
- bcc not_too_big
- add %g2, 1, %g2
-
- ! We get here if the %o1 overflowed while shifting.
- ! This means that %o3 has the high-order bit set.
- ! Restore %o5 and subtract from %o3.
- sll %g1, 4, %g1 ! high order bit
- srl %o5, 1, %o5 ! rest of %o5
- add %o5, %g1, %o5
- b do_single_div
- sub %g2, 1, %g2
-
- not_too_big:
- 3: cmp %o5, %o3
- blu 2b
- nop
- be do_single_div
- nop
- /* NB: these are commented out in the V8-SPARC manual as well */
- /* (I do not understand this) */
- ! %o5 > %o3: went too far: back up 1 step
- ! srl %o5, 1, %o5
- ! dec %g2
- ! do single-bit divide steps
- !
- ! We have to be careful here. We know that %o3 >= %o5, so we can do the
- ! first divide step without thinking. BUT, the others are conditional,
- ! and are only done if %o3 >= 0. Because both %o3 and %o5 may have the high-
- ! order bit set in the first step, just falling into the regular
- ! division loop will mess up the first time around.
- ! So we unroll slightly...
- do_single_div:
- subcc %g2, 1, %g2
- bl end_regular_divide
- nop
- sub %o3, %o5, %o3
- mov 1, %o2
- b end_single_divloop
- nop
- single_divloop:
- sll %o2, 1, %o2
- bl 1f
- srl %o5, 1, %o5
- ! %o3 >= 0
- sub %o3, %o5, %o3
- b 2f
- add %o2, 1, %o2
- 1: ! %o3 < 0
- add %o3, %o5, %o3
- sub %o2, 1, %o2
- 2:
- end_single_divloop:
- subcc %g2, 1, %g2
- bge single_divloop
- tst %o3
- b,a end_regular_divide
-
-not_really_big:
-1:
- sll %o5, 4, %o5
- cmp %o5, %o3
- bleu 1b
- addcc %o4, 1, %o4
- be got_result
- sub %o4, 1, %o4
-
- tst %o3 ! set up for initial iteration
-divloop:
- sll %o2, 4, %o2
- ! depth 1, accumulated bits 0
- bl L1.16
- srl %o5,1,%o5
- ! remainder is positive
- subcc %o3,%o5,%o3
- ! depth 2, accumulated bits 1
- bl L2.17
- srl %o5,1,%o5
- ! remainder is positive
- subcc %o3,%o5,%o3
- ! depth 3, accumulated bits 3
- bl L3.19
- srl %o5,1,%o5
- ! remainder is positive
- subcc %o3,%o5,%o3
- ! depth 4, accumulated bits 7
- bl L4.23
- srl %o5,1,%o5
- ! remainder is positive
- subcc %o3,%o5,%o3
- b 9f
- add %o2, (7*2+1), %o2
-
-L4.23:
- ! remainder is negative
- addcc %o3,%o5,%o3
- b 9f
- add %o2, (7*2-1), %o2
-
-
-L3.19:
- ! remainder is negative
- addcc %o3,%o5,%o3
- ! depth 4, accumulated bits 5
- bl L4.21
- srl %o5,1,%o5
- ! remainder is positive
- subcc %o3,%o5,%o3
- b 9f
- add %o2, (5*2+1), %o2
-
-L4.21:
- ! remainder is negative
- addcc %o3,%o5,%o3
- b 9f
- add %o2, (5*2-1), %o2
-
-L2.17:
- ! remainder is negative
- addcc %o3,%o5,%o3
- ! depth 3, accumulated bits 1
- bl L3.17
- srl %o5,1,%o5
- ! remainder is positive
- subcc %o3,%o5,%o3
- ! depth 4, accumulated bits 3
- bl L4.19
- srl %o5,1,%o5
- ! remainder is positive
- subcc %o3,%o5,%o3
- b 9f
- add %o2, (3*2+1), %o2
-
-L4.19:
- ! remainder is negative
- addcc %o3,%o5,%o3
- b 9f
- add %o2, (3*2-1), %o2
-
-L3.17:
- ! remainder is negative
- addcc %o3,%o5,%o3
- ! depth 4, accumulated bits 1
- bl L4.17
- srl %o5,1,%o5
- ! remainder is positive
- subcc %o3,%o5,%o3
- b 9f
- add %o2, (1*2+1), %o2
-
-L4.17:
- ! remainder is negative
- addcc %o3,%o5,%o3
- b 9f
- add %o2, (1*2-1), %o2
-
-L1.16:
- ! remainder is negative
- addcc %o3,%o5,%o3
- ! depth 2, accumulated bits -1
- bl L2.15
- srl %o5,1,%o5
- ! remainder is positive
- subcc %o3,%o5,%o3
- ! depth 3, accumulated bits -1
- bl L3.15
- srl %o5,1,%o5
- ! remainder is positive
- subcc %o3,%o5,%o3
- ! depth 4, accumulated bits -1
- bl L4.15
- srl %o5,1,%o5
- ! remainder is positive
- subcc %o3,%o5,%o3
- b 9f
- add %o2, (-1*2+1), %o2
-
-L4.15:
- ! remainder is negative
- addcc %o3,%o5,%o3
- b 9f
- add %o2, (-1*2-1), %o2
-
-L3.15:
- ! remainder is negative
- addcc %o3,%o5,%o3
- ! depth 4, accumulated bits -3
- bl L4.13
- srl %o5,1,%o5
- ! remainder is positive
- subcc %o3,%o5,%o3
- b 9f
- add %o2, (-3*2+1), %o2
-
-L4.13:
- ! remainder is negative
- addcc %o3,%o5,%o3
- b 9f
- add %o2, (-3*2-1), %o2
-
-L2.15:
- ! remainder is negative
- addcc %o3,%o5,%o3
- ! depth 3, accumulated bits -3
- bl L3.13
- srl %o5,1,%o5
- ! remainder is positive
- subcc %o3,%o5,%o3
- ! depth 4, accumulated bits -5
- bl L4.11
- srl %o5,1,%o5
- ! remainder is positive
- subcc %o3,%o5,%o3
- b 9f
- add %o2, (-5*2+1), %o2
-
-L4.11:
- ! remainder is negative
- addcc %o3,%o5,%o3
- b 9f
- add %o2, (-5*2-1), %o2
-
-L3.13:
- ! remainder is negative
- addcc %o3,%o5,%o3
- ! depth 4, accumulated bits -7
- bl L4.9
- srl %o5,1,%o5
- ! remainder is positive
- subcc %o3,%o5,%o3
- b 9f
- add %o2, (-7*2+1), %o2
-
-L4.9:
- ! remainder is negative
- addcc %o3,%o5,%o3
- b 9f
- add %o2, (-7*2-1), %o2
-
- 9:
-end_regular_divide:
- subcc %o4, 1, %o4
- bge divloop
- tst %o3
- bl,a got_result
- ! non-restoring fixup here (one instruction only!)
- sub %o2, 1, %o2
-
-
-got_result:
- ! check to see if answer should be < 0
- tst %g3
- bl,a 1f
- sub %g0, %o2, %o2
-1:
- retl
- mov %o2, %o0
-#endif
-
-#ifdef L_modsi3
-/* This implementation was taken from glibc:
- *
- * Input: dividend and divisor in %o0 and %o1 respectively.
- *
- * Algorithm parameters:
- * N how many bits per iteration we try to get (4)
- * WORDSIZE total number of bits (32)
- *
- * Derived constants:
- * TOPBITS number of bits in the top decade of a number
- *
- * Important variables:
- * Q the partial quotient under development (initially 0)
- * R the remainder so far, initially the dividend
- * ITER number of main division loop iterations required;
- * equal to ceil(log2(quotient) / N). Note that this
- * is the log base (2^N) of the quotient.
- * V the current comparand, initially divisor*2^(ITER*N-1)
- *
- * Cost:
- * Current estimate for non-large dividend is
- * ceil(log2(quotient) / N) * (10 + 7N/2) + C
- * A large dividend is one greater than 2^(31-TOPBITS) and takes a
- * different path, as the upper bits of the quotient must be developed
- * one bit at a time.
- */
-.text
- .align 4
- .global .urem
- .proc 4
-.urem:
- b divide
- mov 0, %g3 ! result always positive
-
- .align 4
- .global .rem
- .proc 4
-.rem:
- ! compute sign of result; if neither is negative, no problem
- orcc %o1, %o0, %g0 ! either negative?
- bge 2f ! no, go do the divide
- mov %o0, %g3 ! sign of remainder matches %o0
- tst %o1
- bge 1f
- tst %o0
- ! %o1 is definitely negative; %o0 might also be negative
- bge 2f ! if %o0 not negative...
- sub %g0, %o1, %o1 ! in any case, make %o1 nonneg
-1: ! %o0 is negative, %o1 is nonnegative
- sub %g0, %o0, %o0 ! make %o0 nonnegative
-2:
-
- ! Ready to divide. Compute size of quotient; scale comparand.
-divide:
- orcc %o1, %g0, %o5
- bne 1f
- mov %o0, %o3
-
- ! Divide by zero trap. If it returns, return 0 (about as
- ! wrong as possible, but that is what SunOS does...).
- ta 0x2 !ST_DIV0
- retl
- clr %o0
-
-1:
- cmp %o3, %o5 ! if %o1 exceeds %o0, done
- blu got_result ! (and algorithm fails otherwise)
- clr %o2
- sethi %hi(1 << (32 - 4 - 1)), %g1
- cmp %o3, %g1
- blu not_really_big
- clr %o4
-
- ! Here the dividend is >= 2**(31-N) or so. We must be careful here,
- ! as our usual N-at-a-shot divide step will cause overflow and havoc.
- ! The number of bits in the result here is N*ITER+SC, where SC <= N.
- ! Compute ITER in an unorthodox manner: know we need to shift V into
- ! the top decade: so do not even bother to compare to R.
- 1:
- cmp %o5, %g1
- bgeu 3f
- mov 1, %g2
- sll %o5, 4, %o5
- b 1b
- add %o4, 1, %o4
-
- ! Now compute %g2.
- 2: addcc %o5, %o5, %o5
- bcc not_too_big
- add %g2, 1, %g2
-
- ! We get here if the %o1 overflowed while shifting.
- ! This means that %o3 has the high-order bit set.
- ! Restore %o5 and subtract from %o3.
- sll %g1, 4, %g1 ! high order bit
- srl %o5, 1, %o5 ! rest of %o5
- add %o5, %g1, %o5
- b do_single_div
- sub %g2, 1, %g2
-
- not_too_big:
- 3: cmp %o5, %o3
- blu 2b
- nop
- be do_single_div
- nop
- /* NB: these are commented out in the V8-SPARC manual as well */
- /* (I do not understand this) */
- ! %o5 > %o3: went too far: back up 1 step
- ! srl %o5, 1, %o5
- ! dec %g2
- ! do single-bit divide steps
- !
- ! We have to be careful here. We know that %o3 >= %o5, so we can do the
- ! first divide step without thinking. BUT, the others are conditional,
- ! and are only done if %o3 >= 0. Because both %o3 and %o5 may have the high-
- ! order bit set in the first step, just falling into the regular
- ! division loop will mess up the first time around.
- ! So we unroll slightly...
- do_single_div:
- subcc %g2, 1, %g2
- bl end_regular_divide
- nop
- sub %o3, %o5, %o3
- mov 1, %o2
- b end_single_divloop
- nop
- single_divloop:
- sll %o2, 1, %o2
- bl 1f
- srl %o5, 1, %o5
- ! %o3 >= 0
- sub %o3, %o5, %o3
- b 2f
- add %o2, 1, %o2
- 1: ! %o3 < 0
- add %o3, %o5, %o3
- sub %o2, 1, %o2
- 2:
- end_single_divloop:
- subcc %g2, 1, %g2
- bge single_divloop
- tst %o3
- b,a end_regular_divide
-
-not_really_big:
-1:
- sll %o5, 4, %o5
- cmp %o5, %o3
- bleu 1b
- addcc %o4, 1, %o4
- be got_result
- sub %o4, 1, %o4
-
- tst %o3 ! set up for initial iteration
-divloop:
- sll %o2, 4, %o2
- ! depth 1, accumulated bits 0
- bl L1.16
- srl %o5,1,%o5
- ! remainder is positive
- subcc %o3,%o5,%o3
- ! depth 2, accumulated bits 1
- bl L2.17
- srl %o5,1,%o5
- ! remainder is positive
- subcc %o3,%o5,%o3
- ! depth 3, accumulated bits 3
- bl L3.19
- srl %o5,1,%o5
- ! remainder is positive
- subcc %o3,%o5,%o3
- ! depth 4, accumulated bits 7
- bl L4.23
- srl %o5,1,%o5
- ! remainder is positive
- subcc %o3,%o5,%o3
- b 9f
- add %o2, (7*2+1), %o2
-L4.23:
- ! remainder is negative
- addcc %o3,%o5,%o3
- b 9f
- add %o2, (7*2-1), %o2
-
-L3.19:
- ! remainder is negative
- addcc %o3,%o5,%o3
- ! depth 4, accumulated bits 5
- bl L4.21
- srl %o5,1,%o5
- ! remainder is positive
- subcc %o3,%o5,%o3
- b 9f
- add %o2, (5*2+1), %o2
-
-L4.21:
- ! remainder is negative
- addcc %o3,%o5,%o3
- b 9f
- add %o2, (5*2-1), %o2
-
-L2.17:
- ! remainder is negative
- addcc %o3,%o5,%o3
- ! depth 3, accumulated bits 1
- bl L3.17
- srl %o5,1,%o5
- ! remainder is positive
- subcc %o3,%o5,%o3
- ! depth 4, accumulated bits 3
- bl L4.19
- srl %o5,1,%o5
- ! remainder is positive
- subcc %o3,%o5,%o3
- b 9f
- add %o2, (3*2+1), %o2
-
-L4.19:
- ! remainder is negative
- addcc %o3,%o5,%o3
- b 9f
- add %o2, (3*2-1), %o2
-
-L3.17:
- ! remainder is negative
- addcc %o3,%o5,%o3
- ! depth 4, accumulated bits 1
- bl L4.17
- srl %o5,1,%o5
- ! remainder is positive
- subcc %o3,%o5,%o3
- b 9f
- add %o2, (1*2+1), %o2
-
-L4.17:
- ! remainder is negative
- addcc %o3,%o5,%o3
- b 9f
- add %o2, (1*2-1), %o2
-
-L1.16:
- ! remainder is negative
- addcc %o3,%o5,%o3
- ! depth 2, accumulated bits -1
- bl L2.15
- srl %o5,1,%o5
- ! remainder is positive
- subcc %o3,%o5,%o3
- ! depth 3, accumulated bits -1
- bl L3.15
- srl %o5,1,%o5
- ! remainder is positive
- subcc %o3,%o5,%o3
- ! depth 4, accumulated bits -1
- bl L4.15
- srl %o5,1,%o5
- ! remainder is positive
- subcc %o3,%o5,%o3
- b 9f
- add %o2, (-1*2+1), %o2
-
-L4.15:
- ! remainder is negative
- addcc %o3,%o5,%o3
- b 9f
- add %o2, (-1*2-1), %o2
-
-L3.15:
- ! remainder is negative
- addcc %o3,%o5,%o3
- ! depth 4, accumulated bits -3
- bl L4.13
- srl %o5,1,%o5
- ! remainder is positive
- subcc %o3,%o5,%o3
- b 9f
- add %o2, (-3*2+1), %o2
-
-L4.13:
- ! remainder is negative
- addcc %o3,%o5,%o3
- b 9f
- add %o2, (-3*2-1), %o2
-
-L2.15:
- ! remainder is negative
- addcc %o3,%o5,%o3
- ! depth 3, accumulated bits -3
- bl L3.13
- srl %o5,1,%o5
- ! remainder is positive
- subcc %o3,%o5,%o3
- ! depth 4, accumulated bits -5
- bl L4.11
- srl %o5,1,%o5
- ! remainder is positive
- subcc %o3,%o5,%o3
- b 9f
- add %o2, (-5*2+1), %o2
-
-L4.11:
- ! remainder is negative
- addcc %o3,%o5,%o3
- b 9f
- add %o2, (-5*2-1), %o2
-
-L3.13:
- ! remainder is negative
- addcc %o3,%o5,%o3
- ! depth 4, accumulated bits -7
- bl L4.9
- srl %o5,1,%o5
- ! remainder is positive
- subcc %o3,%o5,%o3
- b 9f
- add %o2, (-7*2+1), %o2
-
-L4.9:
- ! remainder is negative
- addcc %o3,%o5,%o3
- b 9f
- add %o2, (-7*2-1), %o2
-
- 9:
-end_regular_divide:
- subcc %o4, 1, %o4
- bge divloop
- tst %o3
- bl,a got_result
- ! non-restoring fixup here (one instruction only!)
- add %o3, %o1, %o3
-
-got_result:
- ! check to see if answer should be < 0
- tst %g3
- bl,a 1f
- sub %g0, %o3, %o3
-1:
- retl
- mov %o3, %o0
-
-#endif
-
diff --git a/gcc/config/sparc/lb1spl.asm b/gcc/config/sparc/lb1spl.asm
deleted file mode 100644
index 973401f8018..00000000000
--- a/gcc/config/sparc/lb1spl.asm
+++ /dev/null
@@ -1,246 +0,0 @@
-/* This is an assembly language implementation of mulsi3, divsi3, and modsi3
- for the sparclite processor.
-
- These routines are all from the SPARClite User's Guide, slightly edited
- to match the desired calling convention, and also to optimize them. */
-
-#ifdef L_udivsi3
-.text
- .align 4
- .global .udiv
- .proc 04
-.udiv:
- wr %g0,%g0,%y ! Not a delayed write for sparclite
- tst %g0
- divscc %o0,%o1,%g1
- divscc %g1,%o1,%g1
- divscc %g1,%o1,%g1
- divscc %g1,%o1,%g1
- divscc %g1,%o1,%g1
- divscc %g1,%o1,%g1
- divscc %g1,%o1,%g1
- divscc %g1,%o1,%g1
- divscc %g1,%o1,%g1
- divscc %g1,%o1,%g1
- divscc %g1,%o1,%g1
- divscc %g1,%o1,%g1
- divscc %g1,%o1,%g1
- divscc %g1,%o1,%g1
- divscc %g1,%o1,%g1
- divscc %g1,%o1,%g1
- divscc %g1,%o1,%g1
- divscc %g1,%o1,%g1
- divscc %g1,%o1,%g1
- divscc %g1,%o1,%g1
- divscc %g1,%o1,%g1
- divscc %g1,%o1,%g1
- divscc %g1,%o1,%g1
- divscc %g1,%o1,%g1
- divscc %g1,%o1,%g1
- divscc %g1,%o1,%g1
- divscc %g1,%o1,%g1
- divscc %g1,%o1,%g1
- divscc %g1,%o1,%g1
- divscc %g1,%o1,%g1
- divscc %g1,%o1,%g1
- retl
- divscc %g1,%o1,%o0
-#endif
-
-#ifdef L_umodsi3
-.text
- .align 4
- .global .urem
- .proc 04
-.urem:
- wr %g0,%g0,%y ! Not a delayed write for sparclite
- tst %g0
- divscc %o0,%o1,%g1
- divscc %g1,%o1,%g1
- divscc %g1,%o1,%g1
- divscc %g1,%o1,%g1
- divscc %g1,%o1,%g1
- divscc %g1,%o1,%g1
- divscc %g1,%o1,%g1
- divscc %g1,%o1,%g1
- divscc %g1,%o1,%g1
- divscc %g1,%o1,%g1
- divscc %g1,%o1,%g1
- divscc %g1,%o1,%g1
- divscc %g1,%o1,%g1
- divscc %g1,%o1,%g1
- divscc %g1,%o1,%g1
- divscc %g1,%o1,%g1
- divscc %g1,%o1,%g1
- divscc %g1,%o1,%g1
- divscc %g1,%o1,%g1
- divscc %g1,%o1,%g1
- divscc %g1,%o1,%g1
- divscc %g1,%o1,%g1
- divscc %g1,%o1,%g1
- divscc %g1,%o1,%g1
- divscc %g1,%o1,%g1
- divscc %g1,%o1,%g1
- divscc %g1,%o1,%g1
- divscc %g1,%o1,%g1
- divscc %g1,%o1,%g1
- divscc %g1,%o1,%g1
- divscc %g1,%o1,%g1
- divscc %g1,%o1,%g1
- bl 1f
- rd %y,%o0
- retl
- nop
-1: retl
- add %o0,%o1,%o0
-#endif
-
-#ifdef L_divsi3
-.text
- .align 4
- .global .div
- .proc 04
-! ??? This routine could be made faster if was optimized, and if it was
-! rewritten to only calculate the quotient.
-.div:
- wr %g0,%g0,%y ! Not a delayed write for sparclite
- mov %o1,%o4
- tst %o1
- bl,a 1f
- sub %g0,%o4,%o4
-1: tst %o0
- bl,a 2f
- mov -1,%y
-2: divscc %o0,%o4,%g1
- divscc %g1,%o4,%g1
- divscc %g1,%o4,%g1
- divscc %g1,%o4,%g1
- divscc %g1,%o4,%g1
- divscc %g1,%o4,%g1
- divscc %g1,%o4,%g1
- divscc %g1,%o4,%g1
- divscc %g1,%o4,%g1
- divscc %g1,%o4,%g1
- divscc %g1,%o4,%g1
- divscc %g1,%o4,%g1
- divscc %g1,%o4,%g1
- divscc %g1,%o4,%g1
- divscc %g1,%o4,%g1
- divscc %g1,%o4,%g1
- divscc %g1,%o4,%g1
- divscc %g1,%o4,%g1
- divscc %g1,%o4,%g1
- divscc %g1,%o4,%g1
- divscc %g1,%o4,%g1
- divscc %g1,%o4,%g1
- divscc %g1,%o4,%g1
- divscc %g1,%o4,%g1
- divscc %g1,%o4,%g1
- divscc %g1,%o4,%g1
- divscc %g1,%o4,%g1
- divscc %g1,%o4,%g1
- divscc %g1,%o4,%g1
- divscc %g1,%o4,%g1
- divscc %g1,%o4,%g1
- divscc %g1,%o4,%g1
- be 6f
- mov %y,%o3
- bg 4f
- addcc %o3,%o4,%g0
- be,a 6f
- mov %g0,%o3
- tst %o0
- bl 5f
- tst %g1
- ba 5f
- add %o3,%o4,%o3
-4: subcc %o3,%o4,%g0
- be,a 6f
- mov %g0,%o3
- tst %o0
- bge 5f
- tst %g1
- sub %o3,%o4,%o3
-5: bl,a 6f
- add %g1,1,%g1
-6: tst %o1
- bl,a 7f
- sub %g0,%g1,%g1
-7: retl
- mov %g1,%o0 ! Quotient is in %g1.
-#endif
-
-#ifdef L_modsi3
-.text
- .align 4
- .global .rem
- .proc 04
-! ??? This routine could be made faster if was optimized, and if it was
-! rewritten to only calculate the remainder.
-.rem:
- wr %g0,%g0,%y ! Not a delayed write for sparclite
- mov %o1,%o4
- tst %o1
- bl,a 1f
- sub %g0,%o4,%o4
-1: tst %o0
- bl,a 2f
- mov -1,%y
-2: divscc %o0,%o4,%g1
- divscc %g1,%o4,%g1
- divscc %g1,%o4,%g1
- divscc %g1,%o4,%g1
- divscc %g1,%o4,%g1
- divscc %g1,%o4,%g1
- divscc %g1,%o4,%g1
- divscc %g1,%o4,%g1
- divscc %g1,%o4,%g1
- divscc %g1,%o4,%g1
- divscc %g1,%o4,%g1
- divscc %g1,%o4,%g1
- divscc %g1,%o4,%g1
- divscc %g1,%o4,%g1
- divscc %g1,%o4,%g1
- divscc %g1,%o4,%g1
- divscc %g1,%o4,%g1
- divscc %g1,%o4,%g1
- divscc %g1,%o4,%g1
- divscc %g1,%o4,%g1
- divscc %g1,%o4,%g1
- divscc %g1,%o4,%g1
- divscc %g1,%o4,%g1
- divscc %g1,%o4,%g1
- divscc %g1,%o4,%g1
- divscc %g1,%o4,%g1
- divscc %g1,%o4,%g1
- divscc %g1,%o4,%g1
- divscc %g1,%o4,%g1
- divscc %g1,%o4,%g1
- divscc %g1,%o4,%g1
- divscc %g1,%o4,%g1
- be 6f
- mov %y,%o3
- bg 4f
- addcc %o3,%o4,%g0
- be,a 6f
- mov %g0,%o3
- tst %o0
- bl 5f
- tst %g1
- ba 5f
- add %o3,%o4,%o3
-4: subcc %o3,%o4,%g0
- be,a 6f
- mov %g0,%o3
- tst %o0
- bge 5f
- tst %g1
- sub %o3,%o4,%o3
-5: bl,a 6f
- add %g1,1,%g1
-6: tst %o1
- bl,a 7f
- sub %g0,%g1,%g1
-7: retl
- mov %o3,%o0 ! Remainder is in %o3.
-#endif
diff --git a/gcc/config/sparc/libgcc-sparc-glibc.ver b/gcc/config/sparc/libgcc-sparc-glibc.ver
deleted file mode 100644
index 91138d3795e..00000000000
--- a/gcc/config/sparc/libgcc-sparc-glibc.ver
+++ /dev/null
@@ -1,93 +0,0 @@
-# Copyright (C) 2002, 2006, 2008 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/>.
-
-# In order to work around the very problems that force us to now generally
-# create a libgcc.so, glibc reexported a number of routines from libgcc.a.
-# By now choosing the same version tags for these specific routines, we
-# maintain enough binary compatibility to allow future versions of glibc
-# to defer implementation of these routines to libgcc.so via DT_AUXILIARY.
-
-%exclude {
- __divdi3
- __moddi3
- __udivdi3
- __umoddi3
- __register_frame
- __register_frame_table
- __deregister_frame
- __register_frame_info
- __deregister_frame_info
- __frame_state_for
- __register_frame_info_table
-}
-
-%ifdef __arch64__
-%define GLIBC_VER GLIBC_2.2
-%else
-%define GLIBC_VER GLIBC_2.0
-%endif
-%inherit GCC_3.0 GLIBC_VER
-GLIBC_VER {
- # Sampling of DImode arithmetic used by (at least) i386 and m68k.
- __divdi3
- __moddi3
- __udivdi3
- __umoddi3
-
- # Exception handling support functions used by most everyone.
- __register_frame
- __register_frame_table
- __deregister_frame
- __register_frame_info
- __deregister_frame_info
- __frame_state_for
- __register_frame_info_table
-}
-
-%if !defined (__arch64__) && defined (__LONG_DOUBLE_128__)
-
-# long double 128 bit support from 32-bit libgcc_s.so.1 is only available
-# when configured with --with-long-double-128. Make sure all the
-# symbols are available at @@GCC_LDBL_* versions to make it clear
-# there is a configurable symbol set.
-
-%exclude {
- __fixtfdi
- __fixunstfdi
- __floatditf
-
- __divtc3
- __multc3
- __powitf2
-}
-
-%inherit GCC_LDBL_3.0 GCC_3.0
-GCC_LDBL_3.0 {
- __fixtfdi
- __fixunstfdi
- __floatditf
-}
-
-%inherit GCC_LDBL_4.0.0 GCC_4.0.0
-GCC_LDBL_4.0.0 {
- __divtc3
- __multc3
- __powitf2
-}
-
-%endif
diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c
index 6431405b87f..5d22fc0313e 100644
--- a/gcc/config/sparc/sparc.c
+++ b/gcc/config/sparc/sparc.c
@@ -3440,7 +3440,7 @@ sparc_legitimate_address_p (enum machine_mode mode, rtx addr, bool strict)
REG+REG address, then only one of them gets converted to an
offsettable address. */
if (mode == TFmode
- && ! (TARGET_FPU && TARGET_ARCH64 && TARGET_HARD_QUAD))
+ && ! (TARGET_ARCH64 && TARGET_HARD_QUAD))
return 0;
/* We prohibit REG + REG on ARCH32 if not optimizing for
@@ -11280,64 +11280,333 @@ output_v8plus_mult (rtx insn, rtx *operands, const char *name)
}
static void
-vector_init_bshuffle (rtx target, rtx elt, enum machine_mode mode,
+vector_init_bshuffle (rtx target, rtx *locs, int n_elts, enum machine_mode mode,
enum machine_mode inner_mode)
{
- rtx t1, final_insn;
- int bmask;
+ rtx mid_target, r0_high, r0_low, r1_high, r1_low;
+ enum machine_mode partial_mode;
+ int bmask, i, idxs[8];
- t1 = gen_reg_rtx (mode);
+ partial_mode = (mode == V4HImode
+ ? V2HImode
+ : (mode == V8QImode
+ ? V4QImode : mode));
- elt = convert_modes (SImode, inner_mode, elt, true);
- emit_move_insn (gen_lowpart(SImode, t1), elt);
+ r0_high = r0_low = NULL_RTX;
+ r1_high = r1_low = NULL_RTX;
- switch (mode)
+ /* Move the pieces into place, as needed, and calculate the nibble
+ indexes for the bmask calculation. After we execute this loop the
+ locs[] array is no longer needed. Therefore, to simplify things,
+ we set entries that have been processed already to NULL_RTX. */
+
+ for (i = 0; i < n_elts; i++)
+ {
+ int j;
+
+ if (locs[i] == NULL_RTX)
+ continue;
+
+ if (!r0_low)
{
- case V2SImode:
- final_insn = gen_bshufflev2si_vis (target, t1, t1);
- bmask = 0x45674567;
- break;
- case V4HImode:
- final_insn = gen_bshufflev4hi_vis (target, t1, t1);
- bmask = 0x67676767;
+ r0_low = locs[i];
+ idxs[i] = 0x7;
+ }
+ else if (!r1_low)
+ {
+ r1_low = locs[i];
+ idxs[i] = 0xf;
+ }
+ else if (!r0_high)
+ {
+ r0_high = gen_highpart (partial_mode, r0_low);
+ emit_move_insn (r0_high, gen_lowpart (partial_mode, locs[i]));
+ idxs[i] = 0x3;
+ }
+ else if (!r1_high)
+ {
+ r1_high = gen_highpart (partial_mode, r1_low);
+ emit_move_insn (r1_high, gen_lowpart (partial_mode, locs[i]));
+ idxs[i] = 0xb;
+ }
+ else
+ gcc_unreachable ();
+
+ for (j = i + 1; j < n_elts; j++)
+ {
+ if (locs[j] == locs[i])
+ {
+ locs[j] = NULL_RTX;
+ idxs[j] = idxs[i];
+ }
+ }
+ locs[i] = NULL_RTX;
+ }
+
+ bmask = 0;
+ for (i = 0; i < n_elts; i++)
+ {
+ int v = idxs[i];
+
+ switch (GET_MODE_SIZE (inner_mode))
+ {
+ case 2:
+ bmask <<= 8;
+ bmask |= (((v - 1) << 4) | v);
break;
- case V8QImode:
- final_insn = gen_bshufflev8qi_vis (target, t1, t1);
- bmask = 0x77777777;
+
+ case 1:
+ bmask <<= 4;
+ bmask |= v;
break;
+
default:
gcc_unreachable ();
}
+ }
+
+ emit_insn (gen_bmasksi_vis (gen_reg_rtx (SImode), CONST0_RTX (SImode),
+ force_reg (SImode, GEN_INT (bmask))));
+
+ mid_target = target;
+ if (GET_MODE_SIZE (mode) == 4)
+ {
+ mid_target = gen_reg_rtx (mode == V2HImode
+ ? V4HImode : V8QImode);
+ }
+
+ if (!r1_low)
+ r1_low = r0_low;
+
+ switch (GET_MODE (mid_target))
+ {
+ case V4HImode:
+ emit_insn (gen_bshufflev4hi_vis (mid_target, r0_low, r1_low));
+ break;
+ case V8QImode:
+ emit_insn (gen_bshufflev8qi_vis (mid_target, r0_low, r1_low));
+ break;
+ default:
+ gcc_unreachable ();
+ }
+
+ if (mid_target != target)
+ emit_move_insn (target, gen_lowpart (partial_mode, mid_target));
+}
+
+static bool
+vector_init_move_words (rtx target, rtx vals, enum machine_mode mode,
+ enum machine_mode inner_mode)
+{
+ switch (mode)
+ {
+ case V1SImode:
+ case V1DImode:
+ emit_move_insn (gen_lowpart (inner_mode, target),
+ gen_lowpart (inner_mode, XVECEXP (vals, 0, 0)));
+ return true;
+
+ case V2SImode:
+ emit_move_insn (gen_highpart (SImode, target), XVECEXP (vals, 0, 0));
+ emit_move_insn (gen_lowpart (SImode, target), XVECEXP (vals, 0, 1));
+ return true;
+
+ default:
+ break;
+ }
+ return false;
+}
+
+/* Move the elements in rtvec VALS into registers compatible with MODE.
+ Store the rtx for these regs into the corresponding array entry of
+ LOCS. */
+static void
+vector_init_prepare_elts (rtx vals, int n_elts, rtx *locs, enum machine_mode mode,
+ enum machine_mode inner_mode)
+{
+ enum machine_mode loc_mode;
+ int i;
+
+ switch (mode)
+ {
+ case V2HImode:
+ loc_mode = V4HImode;
+ break;
+
+ case V4QImode:
+ loc_mode = V8QImode;
+ break;
+
+ case V4HImode:
+ case V8QImode:
+ loc_mode = mode;
+ break;
+
+ default:
+ gcc_unreachable ();
+ }
+
+ gcc_assert (GET_MODE_SIZE (inner_mode) <= 4);
+ for (i = 0; i < n_elts; i++)
+ {
+ rtx dst, elt = XVECEXP (vals, 0, i);
+ int j;
+
+ /* Did we see this already? If so just record it's location. */
+ dst = NULL_RTX;
+ for (j = 0; j < i; j++)
+ {
+ if (XVECEXP (vals, 0, j) == elt)
+ {
+ dst = locs[j];
+ break;
+ }
+ }
+
+ if (! dst)
+ {
+ enum rtx_code code = GET_CODE (elt);
+
+ dst = gen_reg_rtx (loc_mode);
+
+ /* We use different strategies based upon whether the element
+ is in memory or in a register. When we start in a register
+ and we're VIS3 capable, it's always cheaper to use the VIS3
+ int-->fp register moves since we avoid having to use stack
+ memory. */
+ if ((TARGET_VIS3 && (code == REG || code == SUBREG))
+ || (CONSTANT_P (elt)
+ && (const_zero_operand (elt, inner_mode)
+ || const_all_ones_operand (elt, inner_mode))))
+ {
+ elt = convert_modes (SImode, inner_mode, elt, true);
+
+ emit_clobber (dst);
+ emit_move_insn (gen_lowpart (SImode, dst), elt);
+ }
+ else
+ {
+ rtx m = elt;
+
+ if (CONSTANT_P (elt))
+ {
+ m = force_const_mem (inner_mode, elt);
+ }
+ else if (code != MEM)
+ {
+ rtx stk = assign_stack_temp (inner_mode, GET_MODE_SIZE(inner_mode), 0);
+ emit_move_insn (stk, elt);
+ m = stk;
+ }
+
+ switch (loc_mode)
+ {
+ case V4HImode:
+ emit_insn (gen_zero_extend_v4hi_vis (dst, m));
+ break;
+ case V8QImode:
+ emit_insn (gen_zero_extend_v8qi_vis (dst, m));
+ break;
+ default:
+ gcc_unreachable ();
+ }
+ }
+ }
+ locs[i] = dst;
+ }
+}
+
+static void
+sparc_expand_vector_init_vis2 (rtx target, rtx *locs, int n_elts, int n_unique,
+ enum machine_mode mode,
+ enum machine_mode inner_mode)
+{
+ if (n_unique <= 4)
+ {
+ vector_init_bshuffle (target, locs, n_elts, mode, inner_mode);
+ }
+ else
+ {
+ int i;
- emit_insn (gen_bmasksi_vis (gen_reg_rtx (SImode), CONST0_RTX (SImode),
- force_reg (SImode, GEN_INT (bmask))));
- emit_insn (final_insn);
+ gcc_assert (mode == V8QImode);
+
+ emit_insn (gen_alignaddrsi_vis (gen_reg_rtx (SImode),
+ force_reg (SImode, GEN_INT (7)),
+ CONST0_RTX (SImode)));
+ i = n_elts - 1;
+ emit_insn (gen_faligndatav8qi_vis (target, locs[i], locs[i]));
+ while (--i >= 0)
+ emit_insn (gen_faligndatav8qi_vis (target, locs[i], target));
+ }
}
static void
-vector_init_fpmerge (rtx target, rtx elt, enum machine_mode inner_mode)
+sparc_expand_vector_init_vis1 (rtx target, rtx *locs, int n_elts, int n_unique,
+ enum machine_mode mode)
{
- rtx t1, t2, t3, t3_low;
+ enum machine_mode full_mode = mode;
+ rtx (*emitter)(rtx, rtx, rtx);
+ int alignaddr_val, i;
+ rtx tmp = target;
+
+ if (n_unique == 1 && mode == V8QImode)
+ {
+ rtx t2, t2_low, t1;
+
+ t1 = gen_reg_rtx (V4QImode);
+ emit_move_insn (t1, gen_lowpart (V4QImode, locs[0]));
- t1 = gen_reg_rtx (V4QImode);
- elt = convert_modes (SImode, inner_mode, elt, true);
- emit_move_insn (gen_lowpart (SImode, t1), elt);
+ t2 = gen_reg_rtx (V8QImode);
+ t2_low = gen_lowpart (V4QImode, t2);
+
+ /* xxxxxxAA --> xxxxxxxxxxxxAAAA
+ xxxxAAAA --> xxxxxxxxAAAAAAAA
+ AAAAAAAA --> AAAAAAAAAAAAAAAA */
+ emit_insn (gen_fpmerge_vis (t2, t1, t1));
+ emit_move_insn (t1, t2_low);
+ emit_insn (gen_fpmerge_vis (t2, t1, t1));
+ emit_move_insn (t1, t2_low);
+ emit_insn (gen_fpmerge_vis (target, t1, t1));
+ return;
+ }
+
+ switch (mode)
+ {
+ case V2HImode:
+ full_mode = V4HImode;
+ /* FALLTHRU */
+ case V4HImode:
+ emitter = gen_faligndatav4hi_vis;
+ alignaddr_val = 6;
+ break;
+
+ case V4QImode:
+ full_mode = V8QImode;
+ /* FALLTHRU */
+ case V8QImode:
+ emitter = gen_faligndatav8qi_vis;
+ alignaddr_val = 7;
+ break;
- t2 = gen_reg_rtx (V4QImode);
- emit_move_insn (t2, t1);
+ default:
+ gcc_unreachable ();
+ }
- t3 = gen_reg_rtx (V8QImode);
- t3_low = gen_lowpart (V4QImode, t3);
+ if (full_mode != mode)
+ tmp = gen_reg_rtx (full_mode);
- emit_insn (gen_fpmerge_vis (t3, t1, t2));
- emit_move_insn (t1, t3_low);
- emit_move_insn (t2, t3_low);
+ emit_insn (gen_alignaddrsi_vis (gen_reg_rtx (SImode),
+ force_reg (SImode, GEN_INT (alignaddr_val)),
+ CONST0_RTX (SImode)));
- emit_insn (gen_fpmerge_vis (t3, t1, t2));
- emit_move_insn (t1, t3_low);
- emit_move_insn (t2, t3_low);
+ i = n_elts - 1;
+ emit_insn (emitter (tmp, locs[i], locs[i]));
+ while (--i >= 0)
+ emit_insn (emitter (tmp, locs[i], tmp));
- emit_insn (gen_fpmerge_vis (gen_lowpart (V8QImode, target), t1, t2));
+ if (tmp != target)
+ emit_move_insn (target, gen_highpart (mode, tmp));
}
void
@@ -11346,19 +11615,30 @@ sparc_expand_vector_init (rtx target, rtx vals)
enum machine_mode mode = GET_MODE (target);
enum machine_mode inner_mode = GET_MODE_INNER (mode);
int n_elts = GET_MODE_NUNITS (mode);
- int i, n_var = 0;
- bool all_same;
- rtx mem;
+ int i, n_var = 0, n_unique = 0;
+ rtx locs[8];
+
+ gcc_assert (n_elts <= 8);
- all_same = true;
for (i = 0; i < n_elts; i++)
{
rtx x = XVECEXP (vals, 0, i);
+ bool found = false;
+ int j;
+
if (!CONSTANT_P (x))
n_var++;
- if (i > 0 && !rtx_equal_p (x, XVECEXP (vals, 0, 0)))
- all_same = false;
+ for (j = 0; j < i; j++)
+ {
+ if (rtx_equal_p (x, XVECEXP (vals, 0, j)))
+ {
+ found = true;
+ break;
+ }
+ }
+ if (!found)
+ n_unique++;
}
if (n_var == 0)
@@ -11367,51 +11647,16 @@ sparc_expand_vector_init (rtx target, rtx vals)
return;
}
- if (GET_MODE_SIZE (inner_mode) == GET_MODE_SIZE (mode))
- {
- if (GET_MODE_SIZE (inner_mode) == 4)
- {
- emit_move_insn (gen_lowpart (SImode, target),
- gen_lowpart (SImode, XVECEXP (vals, 0, 0)));
- return;
- }
- else if (GET_MODE_SIZE (inner_mode) == 8)
- {
- emit_move_insn (gen_lowpart (DImode, target),
- gen_lowpart (DImode, XVECEXP (vals, 0, 0)));
- return;
- }
- }
- else if (GET_MODE_SIZE (inner_mode) == GET_MODE_SIZE (word_mode)
- && GET_MODE_SIZE (mode) == 2 * GET_MODE_SIZE (word_mode))
- {
- emit_move_insn (gen_highpart (word_mode, target),
- gen_lowpart (word_mode, XVECEXP (vals, 0, 0)));
- emit_move_insn (gen_lowpart (word_mode, target),
- gen_lowpart (word_mode, XVECEXP (vals, 0, 1)));
- return;
- }
+ if (vector_init_move_words (target, vals, mode, inner_mode))
+ return;
- if (all_same && GET_MODE_SIZE (mode) == 8)
- {
- if (TARGET_VIS2)
- {
- vector_init_bshuffle (target, XVECEXP (vals, 0, 0), mode, inner_mode);
- return;
- }
- if (mode == V8QImode)
- {
- vector_init_fpmerge (target, XVECEXP (vals, 0, 0), inner_mode);
- return;
- }
- }
+ vector_init_prepare_elts (vals, n_elts, locs, mode, inner_mode);
- mem = assign_stack_temp (mode, GET_MODE_SIZE (mode), 0);
- for (i = 0; i < n_elts; i++)
- emit_move_insn (adjust_address_nv (mem, inner_mode,
- i * GET_MODE_SIZE (inner_mode)),
- XVECEXP (vals, 0, i));
- emit_move_insn (target, mem);
+ if (TARGET_VIS2)
+ sparc_expand_vector_init_vis2 (target, locs, n_elts, n_unique,
+ mode, inner_mode);
+ else
+ sparc_expand_vector_init_vis1 (target, locs, n_elts, n_unique, mode);
}
static reg_class_t
@@ -11485,12 +11730,16 @@ sparc_expand_conditional_move (enum machine_mode mode, rtx *operands)
rtx cc_reg, dst, cmp;
cmp = operands[1];
- cmp_mode = GET_MODE (XEXP (cmp, 0));
- if (cmp_mode == DImode && !TARGET_ARCH64)
+ if (GET_MODE (XEXP (cmp, 0)) == DImode && !TARGET_ARCH64)
return false;
- dst = operands[0];
+ if (GET_MODE (XEXP (cmp, 0)) == TFmode && !TARGET_HARD_QUAD)
+ cmp = sparc_emit_float_lib_cmp (XEXP (cmp, 0), XEXP (cmp, 1), rc);
+ cmp_mode = GET_MODE (XEXP (cmp, 0));
+ rc = GET_CODE (cmp);
+
+ dst = operands[0];
if (! rtx_equal_p (operands[2], dst)
&& ! rtx_equal_p (operands[3], dst))
{
@@ -11509,9 +11758,6 @@ sparc_expand_conditional_move (enum machine_mode mode, rtx *operands)
rc = reverse_condition (rc);
}
- if (cmp_mode == TFmode && !TARGET_HARD_QUAD)
- cmp = sparc_emit_float_lib_cmp (XEXP (cmp, 0), XEXP (cmp, 1), rc);
-
if (XEXP (cmp, 1) == const0_rtx
&& GET_CODE (XEXP (cmp, 0)) == REG
&& cmp_mode == DImode
diff --git a/gcc/config/sparc/sparc.h b/gcc/config/sparc/sparc.h
index 65b45271890..e8707f50577 100644
--- a/gcc/config/sparc/sparc.h
+++ b/gcc/config/sparc/sparc.h
@@ -328,6 +328,7 @@ extern enum cmodel sparc_cmodel;
%{mcpu=sparclite:-Asparclite} \
%{mcpu=sparclite86x:-Asparclite} \
%{mcpu=f930:-Asparclite} %{mcpu=f934:-Asparclite} \
+%{mcpu=v8:-Av8} \
%{mv8plus:-Av8plus} \
%{mcpu=v9:-Av9} \
%{mcpu=ultrasparc:%{!mv8plus:-Av9a}} \
diff --git a/gcc/config/sparc/sparc.md b/gcc/config/sparc/sparc.md
index 592440389e5..56f4dc06804 100644
--- a/gcc/config/sparc/sparc.md
+++ b/gcc/config/sparc/sparc.md
@@ -2041,8 +2041,8 @@
})
(define_insn "*movsf_insn"
- [(set (match_operand:SF 0 "nonimmediate_operand" "=d,d,f, *r,*r,*r,*r, f, f,*r, m, m")
- (match_operand:SF 1 "input_operand" "G,C,f,*rR, Q, S, f,*r, m, m, f,*rG"))]
+ [(set (match_operand:SF 0 "nonimmediate_operand" "=d,d,f, *r,*r,*r,*r, f,f,*r,m, m")
+ (match_operand:SF 1 "input_operand" "G,C,f,*rR, Q, S, f,*r,m, m,f,*rG"))]
"(register_operand (operands[0], SFmode)
|| register_or_zero_or_all_ones_operand (operands[1], SFmode))"
{
@@ -2138,8 +2138,8 @@
})
(define_insn "*movdf_insn_sp32"
- [(set (match_operand:DF 0 "nonimmediate_operand" "=b,b,e,e,*r, f, e,T,W,U,T, f, *r, o,o")
- (match_operand:DF 1 "input_operand" "G,C,e,e, f,*r,W#F,G,e,T,U,o#F,*roGF,*rG,f"))]
+ [(set (match_operand:DF 0 "nonimmediate_operand" "=b,b,e,e,*r, f, e,T,W,U,T, f, *r, o,o")
+ (match_operand:DF 1 "input_operand" "G,C,e,e, f,*r,W#F,G,e,T,U,o#F,*roF,*rG,f"))]
"! TARGET_ARCH64
&& (register_operand (operands[0], DFmode)
|| register_or_zero_or_all_ones_operand (operands[1], DFmode))"
@@ -2166,7 +2166,7 @@
(define_insn "*movdf_insn_sp64"
[(set (match_operand:DF 0 "nonimmediate_operand" "=b,b,e,*r, e, e,W, *r,*r, m,*r")
- (match_operand:DF 1 "input_operand" "G,C,e, e,*r,W#F,e,*rG, m,*rG, F"))]
+ (match_operand:DF 1 "input_operand" "G,C,e, e,*r,W#F,e,*rG, m,*rG, F"))]
"TARGET_ARCH64
&& (register_operand (operands[0], DFmode)
|| register_or_zero_or_all_ones_operand (operands[1], DFmode))"
@@ -2191,9 +2191,8 @@
(define_split
[(set (match_operand:DF 0 "register_operand" "")
(match_operand:DF 1 "const_double_operand" ""))]
- "TARGET_FPU
- && (GET_CODE (operands[0]) == REG
- && SPARC_INT_REG_P (REGNO (operands[0])))
+ "REG_P (operands[0])
+ && SPARC_INT_REG_P (REGNO (operands[0]))
&& ! const_zero_operand (operands[1], GET_MODE (operands[0]))
&& reload_completed"
[(clobber (const_int 0))]
@@ -2378,45 +2377,30 @@
})
(define_insn "*movtf_insn_sp32"
- [(set (match_operand:TF 0 "nonimmediate_operand" "=b,e,o,U,r")
- (match_operand:TF 1 "input_operand" "G,oe,GeUr,o,roG"))]
- "TARGET_FPU
- && ! TARGET_ARCH64
- && (register_operand (operands[0], TFmode)
- || register_or_zero_operand (operands[1], TFmode))"
- "#"
- [(set_attr "length" "4")])
-
-;; Exactly the same as above, except that all `e' cases are deleted.
-;; This is necessary to prevent reload from ever trying to use a `e' reg
-;; when -mno-fpu.
-
-(define_insn "*movtf_insn_sp32_no_fpu"
- [(set (match_operand:TF 0 "nonimmediate_operand" "=o,U,o,r,o")
- (match_operand:TF 1 "input_operand" "G,o,U,roG,r"))]
- "! TARGET_FPU
- && ! TARGET_ARCH64
+ [(set (match_operand:TF 0 "nonimmediate_operand" "=b, e,o, o,U, r")
+ (match_operand:TF 1 "input_operand" " G,oe,e,rGU,o,roG"))]
+ "! TARGET_ARCH64
&& (register_operand (operands[0], TFmode)
|| register_or_zero_operand (operands[1], TFmode))"
"#"
- [(set_attr "length" "4")])
+ [(set_attr "length" "4,4,4,4,4,4")
+ (set_attr "cpu_feature" "fpu,fpu,fpu,*,*,*")])
(define_insn "*movtf_insn_sp64"
- [(set (match_operand:TF 0 "nonimmediate_operand" "=b,e,o,r")
- (match_operand:TF 1 "input_operand" "G,oe,Ger,roG"))]
- "TARGET_FPU
- && TARGET_ARCH64
+ [(set (match_operand:TF 0 "nonimmediate_operand" "=b, e,o, o, r")
+ (match_operand:TF 1 "input_operand" "G,oe,e,rG,roG"))]
+ "TARGET_ARCH64
&& ! TARGET_HARD_QUAD
&& (register_operand (operands[0], TFmode)
|| register_or_zero_operand (operands[1], TFmode))"
"#"
- [(set_attr "length" "2")])
+ [(set_attr "length" "2,2,2,2,2")
+ (set_attr "cpu_feature" "fpu,fpu,fpu,*,*")])
(define_insn "*movtf_insn_sp64_hq"
- [(set (match_operand:TF 0 "nonimmediate_operand" "=b,e,e,m,o,r")
- (match_operand:TF 1 "input_operand" "G,e,m,e,rG,roG"))]
- "TARGET_FPU
- && TARGET_ARCH64
+ [(set (match_operand:TF 0 "nonimmediate_operand" "=b,e,e,m, o, r")
+ (match_operand:TF 1 "input_operand" "G,e,m,e,rG,roG"))]
+ "TARGET_ARCH64
&& TARGET_HARD_QUAD
&& (register_operand (operands[0], TFmode)
|| register_or_zero_operand (operands[1], TFmode))"
@@ -2430,16 +2414,6 @@
[(set_attr "type" "*,fpmove,fpload,fpstore,*,*")
(set_attr "length" "2,*,*,*,2,2")])
-(define_insn "*movtf_insn_sp64_no_fpu"
- [(set (match_operand:TF 0 "nonimmediate_operand" "=r,o")
- (match_operand:TF 1 "input_operand" "orG,rG"))]
- "! TARGET_FPU
- && TARGET_ARCH64
- && (register_operand (operands[0], TFmode)
- || register_or_zero_operand (operands[1], TFmode))"
- "#"
- [(set_attr "length" "2")])
-
;; Now all the splits to handle multi-insn TF mode moves.
(define_split
[(set (match_operand:TF 0 "register_operand" "")
@@ -7856,6 +7830,60 @@
DONE;
})
+(define_expand "zero_extend_v8qi_vis"
+ [(set (match_operand:V8QI 0 "register_operand" "")
+ (vec_merge:V8QI
+ (vec_duplicate:V8QI
+ (match_operand:QI 1 "memory_operand" ""))
+ (match_dup 2)
+ (const_int 254)))]
+ "TARGET_VIS"
+{
+ if (! REG_P (XEXP (operands[1], 0)))
+ {
+ rtx addr = force_reg (Pmode, XEXP (operands[1], 0));
+ operands[1] = replace_equiv_address (operands[1], addr);
+ }
+ operands[2] = CONST0_RTX (V8QImode);
+})
+
+(define_expand "zero_extend_v4hi_vis"
+ [(set (match_operand:V4HI 0 "register_operand" "")
+ (vec_merge:V4HI
+ (vec_duplicate:V4HI
+ (match_operand:HI 1 "memory_operand" ""))
+ (match_dup 2)
+ (const_int 14)))]
+ "TARGET_VIS"
+{
+ if (! REG_P (XEXP (operands[1], 0)))
+ {
+ rtx addr = force_reg (Pmode, XEXP (operands[1], 0));
+ operands[1] = replace_equiv_address (operands[1], addr);
+ }
+ operands[2] = CONST0_RTX (V4HImode);
+})
+
+(define_insn "*zero_extend_v8qi_<P:mode>_insn"
+ [(set (match_operand:V8QI 0 "register_operand" "=e")
+ (vec_merge:V8QI
+ (vec_duplicate:V8QI
+ (mem:QI (match_operand:P 1 "register_operand" "r")))
+ (match_operand:V8QI 2 "const_zero_operand" "Y")
+ (const_int 254)))]
+ "TARGET_VIS"
+ "ldda\t[%1] 0xd0, %0")
+
+(define_insn "*zero_extend_v4hi_<P:mode>_insn"
+ [(set (match_operand:V4HI 0 "register_operand" "=e")
+ (vec_merge:V4HI
+ (vec_duplicate:V4HI
+ (mem:HI (match_operand:P 1 "register_operand" "r")))
+ (match_operand:V4HI 2 "const_zero_operand" "Y")
+ (const_int 14)))]
+ "TARGET_VIS"
+ "ldda\t[%1] 0xd2, %0")
+
(define_expand "vec_init<mode>"
[(match_operand:VMALL 0 "register_operand" "")
(match_operand:VMALL 1 "" "")]
diff --git a/gcc/config/sparc/t-elf b/gcc/config/sparc/t-elf
index 7073bcb7721..e9acfe3693e 100644
--- a/gcc/config/sparc/t-elf
+++ b/gcc/config/sparc/t-elf
@@ -17,12 +17,6 @@
# along with GCC; see the file COPYING3. If not see
# <http://www.gnu.org/licenses/>.
-LIB1ASMSRC = sparc/lb1spc.asm
-LIB1ASMFUNCS = _mulsi3 _divsi3 _modsi3
-
MULTILIB_OPTIONS = msoft-float mcpu=v8 mflat
MULTILIB_DIRNAMES = soft v8 flat
MULTILIB_MATCHES = msoft-float=mno-fpu
-
-LIBGCC = stmp-multilib
-INSTALL_LIBGCC = install-multilib
diff --git a/gcc/config/sparc/t-leon b/gcc/config/sparc/t-leon
index 4f9d0a9e797..25fc61136a9 100644
--- a/gcc/config/sparc/t-leon
+++ b/gcc/config/sparc/t-leon
@@ -16,15 +16,9 @@
# along with GCC; see the file COPYING3. If not see
# <http://www.gnu.org/licenses/>.
-LIB1ASMSRC = sparc/lb1spc.asm
-LIB1ASMFUNCS = _mulsi3 _divsi3 _modsi3
-
# Multilibs for LEON
# LEON is a SPARC-V8, but the AT697 implementation has a bug in the
# V8-specific instructions.
MULTILIB_OPTIONS = mcpu=v7 msoft-float mflat
MULTILIB_DIRNAMES = v7 soft flat
MULTILIB_MATCHES = mcpu?v7=mv7 msoft-float=mno-fpu
-
-LIBGCC = stmp-multilib
-INSTALL_LIBGCC = install-multilib
diff --git a/gcc/config/sparc/t-leon3 b/gcc/config/sparc/t-leon3
index 0e7e45cc594..acdd1f2c67b 100644
--- a/gcc/config/sparc/t-leon3
+++ b/gcc/config/sparc/t-leon3
@@ -20,6 +20,3 @@
MULTILIB_OPTIONS = msoft-float
MULTILIB_DIRNAMES = soft
MULTILIB_MATCHES = msoft-float=mno-fpu
-
-LIBGCC = stmp-multilib
-INSTALL_LIBGCC = install-multilib
diff --git a/gcc/config/sparc/t-linux b/gcc/config/sparc/t-linux
deleted file mode 100644
index 30daa376614..00000000000
--- a/gcc/config/sparc/t-linux
+++ /dev/null
@@ -1,5 +0,0 @@
-# Override t-slibgcc-elf-ver to export some libgcc symbols with
-# the symbol versions that glibc used.
-# Avoid the t-linux version file.
-SHLIB_MAPFILES = $$(libgcc_objdir)/libgcc-std.ver \
- $(srcdir)/config/sparc/libgcc-sparc-glibc.ver
diff --git a/gcc/config/sparc/t-linux64 b/gcc/config/sparc/t-linux64
index 74d04898d9f..d9dfad66ce7 100644
--- a/gcc/config/sparc/t-linux64
+++ b/gcc/config/sparc/t-linux64
@@ -1,5 +1,5 @@
# Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004,
-# 2006, 2010 Free Software Foundation, Inc.
+# 2006, 2010, 2011 Free Software Foundation, Inc.
#
# This file is part of GCC.
#
@@ -27,10 +27,3 @@
MULTILIB_OPTIONS = m64/m32
MULTILIB_DIRNAMES = 64 32
MULTILIB_OSDIRNAMES = ../lib64 $(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib)
-
-LIBGCC = stmp-multilib
-INSTALL_LIBGCC = install-multilib
-
-CRTSTUFF_T_CFLAGS = `if test x$$($(GCC_FOR_TARGET) $(MULTILIB_CFLAGS) \
- -print-multi-os-directory) \
- = x../lib64; then echo -mcmodel=medany; fi`
diff --git a/gcc/config/sparc/t-netbsd64 b/gcc/config/sparc/t-netbsd64
index 0fddb0ffe87..bc783c19366 100644
--- a/gcc/config/sparc/t-netbsd64
+++ b/gcc/config/sparc/t-netbsd64
@@ -1,8 +1,5 @@
-# Disable multilib fow now, as NetBSD/sparc64 does not ship with
+# Disable multilib for now, as NetBSD/sparc64 does not ship with
# a 32-bit environment.
#MULTILIB_OPTIONS = m32/m64
#MULTILIB_DIRNAMES = 32 64
#MULTILIB_MATCHES =
-
-#LIBGCC = stmp-multilib
-#INSTALL_LIBGCC = install-multilib
diff --git a/gcc/config/spu/cache.S b/gcc/config/spu/cache.S
deleted file mode 100644
index 9ffb6a0d194..00000000000
--- a/gcc/config/spu/cache.S
+++ /dev/null
@@ -1,43 +0,0 @@
-/* Copyright (C) 2008, 2009 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/>. */
-
- .data
- .p2align 7
- .global __cache
-__cache:
- .rept __CACHE_SIZE__ * 8
- .fill 128
- .endr
-
- .p2align 7
- .global __cache_tag_array
-__cache_tag_array:
- .rept __CACHE_SIZE__ * 2
- .long 1, 1, 1, 1
- .fill 128-16
- .endr
-__end_cache_tag_array:
-
- .globl __cache_tag_array_size
- .set __cache_tag_array_size, __end_cache_tag_array-__cache_tag_array
-
diff --git a/gcc/config/spu/cachemgr.c b/gcc/config/spu/cachemgr.c
deleted file mode 100644
index e7abd5e62db..00000000000
--- a/gcc/config/spu/cachemgr.c
+++ /dev/null
@@ -1,438 +0,0 @@
-/* Copyright (C) 2008, 2009 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/>. */
-
-#include <spu_mfcio.h>
-#include <spu_internals.h>
-#include <spu_intrinsics.h>
-#include <spu_cache.h>
-
-extern unsigned long long __ea_local_store;
-extern char __cache_tag_array_size;
-
-#define LINE_SIZE 128
-#define TAG_MASK (LINE_SIZE - 1)
-
-#define WAYS 4
-#define SET_MASK ((int) &__cache_tag_array_size - LINE_SIZE)
-
-#define CACHE_LINES ((int) &__cache_tag_array_size / \
- sizeof (struct __cache_tag_array) * WAYS)
-
-struct __cache_tag_array
-{
- unsigned int tag_lo[WAYS];
- unsigned int tag_hi[WAYS];
- void *base[WAYS];
- int reserved[WAYS];
- vector unsigned short dirty_bits[WAYS];
-};
-
-extern struct __cache_tag_array __cache_tag_array[];
-extern char __cache[];
-
-/* In order to make the code seem a little cleaner, and to avoid having
- 64/32 bit ifdefs all over the place, we use macros. */
-
-#ifdef __EA64__
-typedef unsigned long long addr;
-
-#define CHECK_TAG(_entry, _way, _tag) \
- ((_entry)->tag_lo[(_way)] == ((_tag) & 0xFFFFFFFF) \
- && (_entry)->tag_hi[(_way)] == ((_tag) >> 32))
-
-#define GET_TAG(_entry, _way) \
- ((unsigned long long)(_entry)->tag_hi[(_way)] << 32 \
- | (unsigned long long)(_entry)->tag_lo[(_way)])
-
-#define SET_TAG(_entry, _way, _tag) \
- (_entry)->tag_lo[(_way)] = (_tag) & 0xFFFFFFFF; \
- (_entry)->tag_hi[(_way)] = (_tag) >> 32
-
-#else /*__EA32__*/
-typedef unsigned long addr;
-
-#define CHECK_TAG(_entry, _way, _tag) \
- ((_entry)->tag_lo[(_way)] == (_tag))
-
-#define GET_TAG(_entry, _way) \
- ((_entry)->tag_lo[(_way)])
-
-#define SET_TAG(_entry, _way, _tag) \
- (_entry)->tag_lo[(_way)] = (_tag)
-
-#endif
-
-/* In GET_ENTRY, we cast away the high 32 bits,
- as the tag is only in the low 32. */
-
-#define GET_ENTRY(_addr) \
- ((struct __cache_tag_array *) \
- si_to_uint (si_a (si_and (si_from_uint ((unsigned int) (addr) (_addr)), \
- si_from_uint (SET_MASK)), \
- si_from_uint ((unsigned int) __cache_tag_array))))
-
-#define GET_CACHE_LINE(_addr, _way) \
- ((void *) (__cache + ((_addr) & SET_MASK) * WAYS) + ((_way) * LINE_SIZE));
-
-#define CHECK_DIRTY(_vec) (si_to_uint (si_orx ((qword) (_vec))))
-#define SET_EMPTY(_entry, _way) ((_entry)->tag_lo[(_way)] = 1)
-#define CHECK_EMPTY(_entry, _way) ((_entry)->tag_lo[(_way)] == 1)
-
-#define LS_FLAG 0x80000000
-#define SET_IS_LS(_entry, _way) ((_entry)->reserved[(_way)] |= LS_FLAG)
-#define CHECK_IS_LS(_entry, _way) ((_entry)->reserved[(_way)] & LS_FLAG)
-#define GET_LRU(_entry, _way) ((_entry)->reserved[(_way)] & ~LS_FLAG)
-
-static int dma_tag = 32;
-
-static void
-__cache_evict_entry (struct __cache_tag_array *entry, int way)
-{
- addr tag = GET_TAG (entry, way);
-
- if (CHECK_DIRTY (entry->dirty_bits[way]) && !CHECK_IS_LS (entry, way))
- {
-#ifdef NONATOMIC
- /* Non-atomic writes. */
- unsigned int oldmask, mach_stat;
- char *line = ((void *) 0);
-
- /* Enter critical section. */
- mach_stat = spu_readch (SPU_RdMachStat);
- spu_idisable ();
-
- /* Issue DMA request. */
- line = GET_CACHE_LINE (entry->tag_lo[way], way);
- mfc_put (line, tag, LINE_SIZE, dma_tag, 0, 0);
-
- /* Wait for DMA completion. */
- oldmask = mfc_read_tag_mask ();
- mfc_write_tag_mask (1 << dma_tag);
- mfc_read_tag_status_all ();
- mfc_write_tag_mask (oldmask);
-
- /* Leave critical section. */
- if (__builtin_expect (mach_stat & 1, 0))
- spu_ienable ();
-#else
- /* Allocate a buffer large enough that we know it has 128 bytes
- that are 128 byte aligned (for DMA). */
-
- char buffer[LINE_SIZE + 127];
- qword *buf_ptr = (qword *) (((unsigned int) (buffer) + 127) & ~127);
- qword *line = GET_CACHE_LINE (entry->tag_lo[way], way);
- qword bits;
- unsigned int mach_stat;
-
- /* Enter critical section. */
- mach_stat = spu_readch (SPU_RdMachStat);
- spu_idisable ();
-
- do
- {
- /* We atomically read the current memory into a buffer
- modify the dirty bytes in the buffer, and write it
- back. If writeback fails, loop and try again. */
-
- mfc_getllar (buf_ptr, tag, 0, 0);
- mfc_read_atomic_status ();
-
- /* The method we're using to write 16 dirty bytes into
- the buffer at a time uses fsmb which in turn uses
- the least significant 16 bits of word 0, so we
- load the bits and rotate so that the first bit of
- the bitmap is in the first bit that fsmb will use. */
-
- bits = (qword) entry->dirty_bits[way];
- bits = si_rotqbyi (bits, -2);
-
- /* Si_fsmb creates the mask of dirty bytes.
- Use selb to nab the appropriate bits. */
- buf_ptr[0] = si_selb (buf_ptr[0], line[0], si_fsmb (bits));
-
- /* Rotate to next 16 byte section of cache. */
- bits = si_rotqbyi (bits, 2);
-
- buf_ptr[1] = si_selb (buf_ptr[1], line[1], si_fsmb (bits));
- bits = si_rotqbyi (bits, 2);
- buf_ptr[2] = si_selb (buf_ptr[2], line[2], si_fsmb (bits));
- bits = si_rotqbyi (bits, 2);
- buf_ptr[3] = si_selb (buf_ptr[3], line[3], si_fsmb (bits));
- bits = si_rotqbyi (bits, 2);
- buf_ptr[4] = si_selb (buf_ptr[4], line[4], si_fsmb (bits));
- bits = si_rotqbyi (bits, 2);
- buf_ptr[5] = si_selb (buf_ptr[5], line[5], si_fsmb (bits));
- bits = si_rotqbyi (bits, 2);
- buf_ptr[6] = si_selb (buf_ptr[6], line[6], si_fsmb (bits));
- bits = si_rotqbyi (bits, 2);
- buf_ptr[7] = si_selb (buf_ptr[7], line[7], si_fsmb (bits));
- bits = si_rotqbyi (bits, 2);
-
- mfc_putllc (buf_ptr, tag, 0, 0);
- }
- while (mfc_read_atomic_status ());
-
- /* Leave critical section. */
- if (__builtin_expect (mach_stat & 1, 0))
- spu_ienable ();
-#endif
- }
-
- /* In any case, marking the lo tag with 1 which denotes empty. */
- SET_EMPTY (entry, way);
- entry->dirty_bits[way] = (vector unsigned short) si_from_uint (0);
-}
-
-void
-__cache_evict (__ea void *ea)
-{
- addr tag = (addr) ea & ~TAG_MASK;
- struct __cache_tag_array *entry = GET_ENTRY (ea);
- int i = 0;
-
- /* Cycles through all the possible ways an address could be at
- and evicts the way if found. */
-
- for (i = 0; i < WAYS; i++)
- if (CHECK_TAG (entry, i, tag))
- __cache_evict_entry (entry, i);
-}
-
-static void *
-__cache_fill (int way, addr tag)
-{
- unsigned int oldmask, mach_stat;
- char *line = ((void *) 0);
-
- /* Reserve our DMA tag. */
- if (dma_tag == 32)
- dma_tag = mfc_tag_reserve ();
-
- /* Enter critical section. */
- mach_stat = spu_readch (SPU_RdMachStat);
- spu_idisable ();
-
- /* Issue DMA request. */
- line = GET_CACHE_LINE (tag, way);
- mfc_get (line, tag, LINE_SIZE, dma_tag, 0, 0);
-
- /* Wait for DMA completion. */
- oldmask = mfc_read_tag_mask ();
- mfc_write_tag_mask (1 << dma_tag);
- mfc_read_tag_status_all ();
- mfc_write_tag_mask (oldmask);
-
- /* Leave critical section. */
- if (__builtin_expect (mach_stat & 1, 0))
- spu_ienable ();
-
- return (void *) line;
-}
-
-static void
-__cache_miss (__ea void *ea, struct __cache_tag_array *entry, int way)
-{
-
- addr tag = (addr) ea & ~TAG_MASK;
- unsigned int lru = 0;
- int i = 0;
- int idx = 0;
-
- /* If way > 4, then there are no empty slots, so we must evict
- the least recently used entry. */
- if (way >= 4)
- {
- for (i = 0; i < WAYS; i++)
- {
- if (GET_LRU (entry, i) > lru)
- {
- lru = GET_LRU (entry, i);
- idx = i;
- }
- }
- __cache_evict_entry (entry, idx);
- way = idx;
- }
-
- /* Set the empty entry's tag and fill it's cache line. */
-
- SET_TAG (entry, way, tag);
- entry->reserved[way] = 0;
-
- /* Check if the address is just an effective address within the
- SPU's local store. */
-
- /* Because the LS is not 256k aligned, we can't do a nice and mask
- here to compare, so we must check the whole range. */
-
- if ((addr) ea >= (addr) __ea_local_store
- && (addr) ea < (addr) (__ea_local_store + 0x40000))
- {
- SET_IS_LS (entry, way);
- entry->base[way] =
- (void *) ((unsigned int) ((addr) ea -
- (addr) __ea_local_store) & ~0x7f);
- }
- else
- {
- entry->base[way] = __cache_fill (way, tag);
- }
-}
-
-void *
-__cache_fetch_dirty (__ea void *ea, int n_bytes_dirty)
-{
-#ifdef __EA64__
- unsigned int tag_hi;
- qword etag_hi;
-#endif
- unsigned int tag_lo;
- struct __cache_tag_array *entry;
-
- qword etag_lo;
- qword equal;
- qword bit_mask;
- qword way;
-
- /* This first chunk, we merely fill the pointer and tag. */
-
- entry = GET_ENTRY (ea);
-
-#ifndef __EA64__
- tag_lo =
- si_to_uint (si_andc
- (si_shufb
- (si_from_uint ((addr) ea), si_from_uint (0),
- si_from_uint (0x00010203)), si_from_uint (TAG_MASK)));
-#else
- tag_lo =
- si_to_uint (si_andc
- (si_shufb
- (si_from_ullong ((addr) ea), si_from_uint (0),
- si_from_uint (0x04050607)), si_from_uint (TAG_MASK)));
-
- tag_hi =
- si_to_uint (si_shufb
- (si_from_ullong ((addr) ea), si_from_uint (0),
- si_from_uint (0x00010203)));
-#endif
-
- /* Increment LRU in reserved bytes. */
- si_stqd (si_ai (si_lqd (si_from_ptr (entry), 48), 1),
- si_from_ptr (entry), 48);
-
-missreturn:
- /* Check if the entry's lo_tag is equal to the address' lo_tag. */
- etag_lo = si_lqd (si_from_ptr (entry), 0);
- equal = si_ceq (etag_lo, si_from_uint (tag_lo));
-#ifdef __EA64__
- /* And the high tag too. */
- etag_hi = si_lqd (si_from_ptr (entry), 16);
- equal = si_and (equal, (si_ceq (etag_hi, si_from_uint (tag_hi))));
-#endif
-
- if ((si_to_uint (si_orx (equal)) == 0))
- goto misshandler;
-
- if (n_bytes_dirty)
- {
- /* way = 0x40,0x50,0x60,0x70 for each way, which is also the
- offset of the appropriate dirty bits. */
- way = si_shli (si_clz (si_gbb (equal)), 2);
-
- /* To create the bit_mask, we set it to all 1s (uint -1), then we
- shift it over (128 - n_bytes_dirty) times. */
-
- bit_mask = si_from_uint (-1);
-
- bit_mask =
- si_shlqby (bit_mask, si_from_uint ((LINE_SIZE - n_bytes_dirty) / 8));
-
- bit_mask =
- si_shlqbi (bit_mask, si_from_uint ((LINE_SIZE - n_bytes_dirty) % 8));
-
- /* Rotate it around to the correct offset. */
- bit_mask =
- si_rotqby (bit_mask,
- si_from_uint (-1 * ((addr) ea & TAG_MASK) / 8));
-
- bit_mask =
- si_rotqbi (bit_mask,
- si_from_uint (-1 * ((addr) ea & TAG_MASK) % 8));
-
- /* Update the dirty bits. */
- si_stqx (si_or (si_lqx (si_from_ptr (entry), way), bit_mask),
- si_from_ptr (entry), way);
- };
-
- /* We've definitely found the right entry, set LRU (reserved) to 0
- maintaining the LS flag (MSB). */
-
- si_stqd (si_andc
- (si_lqd (si_from_ptr (entry), 48),
- si_and (equal, si_from_uint (~(LS_FLAG)))),
- si_from_ptr (entry), 48);
-
- return (void *)
- si_to_uint (si_a
- (si_orx
- (si_and (si_lqd (si_from_ptr (entry), 32), equal)),
- si_from_uint (((unsigned int) (addr) ea) & TAG_MASK)));
-
-misshandler:
- equal = si_ceqi (etag_lo, 1);
- __cache_miss (ea, entry, (si_to_uint (si_clz (si_gbb (equal))) - 16) >> 2);
- goto missreturn;
-}
-
-void *
-__cache_fetch (__ea void *ea)
-{
- return __cache_fetch_dirty (ea, 0);
-}
-
-void
-__cache_touch (__ea void *ea __attribute__ ((unused)))
-{
- /* NO-OP for now. */
-}
-
-void __cache_flush (void) __attribute__ ((destructor));
-void
-__cache_flush (void)
-{
- struct __cache_tag_array *entry = __cache_tag_array;
- unsigned int i;
- int j;
-
- /* Cycle through each cache entry and evict all used ways. */
-
- for (i = 0; i < CACHE_LINES / WAYS; i++)
- {
- for (j = 0; j < WAYS; j++)
- if (!CHECK_EMPTY (entry, j))
- __cache_evict_entry (entry, j);
-
- entry++;
- }
-}
diff --git a/gcc/config/spu/divmodti4.c b/gcc/config/spu/divmodti4.c
deleted file mode 100644
index 57c975c6b3c..00000000000
--- a/gcc/config/spu/divmodti4.c
+++ /dev/null
@@ -1,188 +0,0 @@
-/* Copyright (C) 2008, 2009 Free Software Foundation, Inc.
-
- This file is free software; you can redistribute it and/or modify it under
- the terms of the GNU General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your option)
- any later version.
-
- This file is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- for more details.
-
- Under Section 7 of GPL version 3, you are granted additional
- permissions described in the GCC Runtime Library Exception, version
- 3.1, as published by the Free Software Foundation.
-
- You should have received a copy of the GNU General Public License and
- a copy of the GCC Runtime Library Exception along with this program;
- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
- <http://www.gnu.org/licenses/>. */
-
-#include <spu_intrinsics.h>
-
-typedef unsigned int UTItype __attribute__ ((mode (TI)));
-typedef int TItype __attribute__ ((mode (TI)));
-TItype __divti3 (TItype u, TItype v);
-TItype __modti3 (TItype u, TItype v);
-UTItype __udivti3 (UTItype u, UTItype v);
-UTItype __umodti3 (UTItype u, UTItype v);
-UTItype __udivmodti4 (UTItype u, UTItype v, UTItype *w);
-
-union qword_UTItype
- {
- qword q;
- UTItype t;
- };
-
-inline static qword
-si_from_UTItype (UTItype t)
-{
- union qword_UTItype u;
- u.t = t;
- return u.q;
-}
-
-inline static UTItype
-si_to_UTItype (qword q)
-{
- union qword_UTItype u;
- u.q = q;
- return u.t;
-}
-
-inline static unsigned int
-count_leading_zeros (UTItype x)
-{
- qword c = si_clz (*(qword *) & x);
- qword cmp0 = si_cgti (c, 31);
- qword cmp1 = si_and (cmp0, si_shlqbyi (cmp0, 4));
- qword cmp2 = si_and (cmp1, si_shlqbyi (cmp0, 8));
- qword s = si_a (c, si_and (cmp0, si_shlqbyi (c, 4)));
- s = si_a (s, si_and (cmp1, si_shlqbyi (c, 8)));
- s = si_a (s, si_and (cmp2, si_shlqbyi (c, 12)));
- return si_to_uint (s);
-}
-
-/* Based on implementation of udivmodsi4, which is essentially
- * an optimized version of gcc/config/udivmodsi4.c
- clz %7,%2
- clz %4,%1
- il %5,1
- fsmbi %0,0
- sf %7,%4,%7
- ori %3,%1,0
- shl %5,%5,%7
- shl %4,%2,%7
-1: or %8,%0,%5
- rotmi %5,%5,-1
- clgt %6,%4,%3
- sf %7,%4,%3
- rotmi %4,%4,-1
- selb %0,%8,%0,%6
- selb %3,%7,%3,%6
-3: brnz %5,1b
- */
-
-UTItype
-__udivmodti4 (UTItype num, UTItype den, UTItype * rp)
-{
- qword shift =
- si_from_uint (count_leading_zeros (den) - count_leading_zeros (num));
- qword n0 = si_from_UTItype (num);
- qword d0 = si_from_UTItype (den);
- qword bit = si_andi (si_fsmbi (1), 1);
- qword r0 = si_il (0);
- qword m1 = si_fsmbi (0x000f);
- qword mask, r1, n1;
-
- d0 = si_shlqbybi (si_shlqbi (d0, shift), shift);
- bit = si_shlqbybi (si_shlqbi (bit, shift), shift);
-
- do
- {
- r1 = si_or (r0, bit);
-
- // n1 = n0 - d0 in TImode
- n1 = si_bg (d0, n0);
- n1 = si_shlqbyi (n1, 4);
- n1 = si_sf (m1, n1);
- n1 = si_bgx (d0, n0, n1);
- n1 = si_shlqbyi (n1, 4);
- n1 = si_sf (m1, n1);
- n1 = si_bgx (d0, n0, n1);
- n1 = si_shlqbyi (n1, 4);
- n1 = si_sf (m1, n1);
- n1 = si_sfx (d0, n0, n1);
-
- mask = si_fsm (si_cgti (n1, -1));
- r0 = si_selb (r0, r1, mask);
- n0 = si_selb (n0, n1, mask);
- bit = si_rotqmbii (bit, -1);
- d0 = si_rotqmbii (d0, -1);
- }
- while (si_to_uint (si_orx (bit)));
- if (rp)
- *rp = si_to_UTItype (n0);
- return si_to_UTItype (r0);
-}
-
-UTItype
-__udivti3 (UTItype n, UTItype d)
-{
- return __udivmodti4 (n, d, (UTItype *)0);
-}
-
-UTItype
-__umodti3 (UTItype n, UTItype d)
-{
- UTItype w;
- __udivmodti4 (n, d, &w);
- return w;
-}
-
-TItype
-__divti3 (TItype n, TItype d)
-{
- int c = 0;
- TItype w;
-
- if (n < 0)
- {
- c = ~c;
- n = -n;
- }
- if (d < 0)
- {
- c = ~c;
- d = -d;
- }
-
- w = __udivmodti4 (n, d, (UTItype *)0);
- if (c)
- w = -w;
- return w;
-}
-
-TItype
-__modti3 (TItype n, TItype d)
-{
- int c = 0;
- TItype w;
-
- if (n < 0)
- {
- c = ~c;
- n = -n;
- }
- if (d < 0)
- {
- c = ~c;
- d = -d;
- }
-
- __udivmodti4 (n, d, (UTItype *) &w);
- if (c)
- w = -w;
- return w;
-}
diff --git a/gcc/config/spu/divv2df3.c b/gcc/config/spu/divv2df3.c
deleted file mode 100644
index 9d5e1a594e1..00000000000
--- a/gcc/config/spu/divv2df3.c
+++ /dev/null
@@ -1,195 +0,0 @@
-/* Copyright (C) 2009 Free Software Foundation, Inc.
-
- This file is free software; you can redistribute it and/or modify it under
- the terms of the GNU General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your option)
- any later version.
-
- This file is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- for more details.
-
- Under Section 7 of GPL version 3, you are granted additional
- permissions described in the GCC Runtime Library Exception, version
- 3.1, as published by the Free Software Foundation.
-
- You should have received a copy of the GNU General Public License and
- a copy of the GCC Runtime Library Exception along with this program;
- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
- <http://www.gnu.org/licenses/>. */
-
-#include <spu_intrinsics.h>
-
-vector double __divv2df3 (vector double a_in, vector double b_in);
-
-/* __divv2df3 divides the vector dividend a by the vector divisor b and
- returns the resulting vector quotient. Maximum error about 0.5 ulp
- over entire double range including denorms, compared to true result
- in round-to-nearest rounding mode. Handles Inf or NaN operands and
- results correctly. */
-
-vector double
-__divv2df3 (vector double a_in, vector double b_in)
-{
- /* Variables */
- vec_int4 exp, exp_bias;
- vec_uint4 no_underflow, overflow;
- vec_float4 mant_bf, inv_bf;
- vec_ullong2 exp_a, exp_b;
- vec_ullong2 a_nan, a_zero, a_inf, a_denorm, a_denorm0;
- vec_ullong2 b_nan, b_zero, b_inf, b_denorm, b_denorm0;
- vec_ullong2 nan;
- vec_uint4 a_exp, b_exp;
- vec_ullong2 a_mant_0, b_mant_0;
- vec_ullong2 a_exp_1s, b_exp_1s;
- vec_ullong2 sign_exp_mask;
-
- vec_double2 a, b;
- vec_double2 mant_a, mant_b, inv_b, q0, q1, q2, mult;
-
- /* Constants */
- vec_uint4 exp_mask_u32 = spu_splats((unsigned int)0x7FF00000);
- vec_uchar16 splat_hi = (vec_uchar16){0,1,2,3, 0,1,2,3, 8, 9,10,11, 8,9,10,11};
- vec_uchar16 swap_32 = (vec_uchar16){4,5,6,7, 0,1,2,3, 12,13,14,15, 8,9,10,11};
- vec_ullong2 exp_mask = spu_splats(0x7FF0000000000000ULL);
- vec_ullong2 sign_mask = spu_splats(0x8000000000000000ULL);
- vec_float4 onef = spu_splats(1.0f);
- vec_double2 one = spu_splats(1.0);
- vec_double2 exp_53 = (vec_double2)spu_splats(0x0350000000000000ULL);
-
- sign_exp_mask = spu_or(sign_mask, exp_mask);
-
- /* Extract the floating point components from each of the operands including
- * exponent and mantissa.
- */
- a_exp = (vec_uint4)spu_and((vec_uint4)a_in, exp_mask_u32);
- a_exp = spu_shuffle(a_exp, a_exp, splat_hi);
- b_exp = (vec_uint4)spu_and((vec_uint4)b_in, exp_mask_u32);
- b_exp = spu_shuffle(b_exp, b_exp, splat_hi);
-
- a_mant_0 = (vec_ullong2)spu_cmpeq((vec_uint4)spu_andc((vec_ullong2)a_in, sign_exp_mask), 0);
- a_mant_0 = spu_and(a_mant_0, spu_shuffle(a_mant_0, a_mant_0, swap_32));
-
- b_mant_0 = (vec_ullong2)spu_cmpeq((vec_uint4)spu_andc((vec_ullong2)b_in, sign_exp_mask), 0);
- b_mant_0 = spu_and(b_mant_0, spu_shuffle(b_mant_0, b_mant_0, swap_32));
-
- a_exp_1s = (vec_ullong2)spu_cmpeq(a_exp, exp_mask_u32);
- b_exp_1s = (vec_ullong2)spu_cmpeq(b_exp, exp_mask_u32);
-
- /* Identify all possible special values that must be accomodated including:
- * +-denorm, +-0, +-infinity, and NaNs.
- */
- a_denorm0= (vec_ullong2)spu_cmpeq(a_exp, 0);
- a_nan = spu_andc(a_exp_1s, a_mant_0);
- a_zero = spu_and (a_denorm0, a_mant_0);
- a_inf = spu_and (a_exp_1s, a_mant_0);
- a_denorm = spu_andc(a_denorm0, a_zero);
-
- b_denorm0= (vec_ullong2)spu_cmpeq(b_exp, 0);
- b_nan = spu_andc(b_exp_1s, b_mant_0);
- b_zero = spu_and (b_denorm0, b_mant_0);
- b_inf = spu_and (b_exp_1s, b_mant_0);
- b_denorm = spu_andc(b_denorm0, b_zero);
-
- /* Scale denorm inputs to into normalized numbers by conditionally scaling the
- * input parameters.
- */
- a = spu_sub(spu_or(a_in, exp_53), spu_sel(exp_53, a_in, sign_mask));
- a = spu_sel(a_in, a, a_denorm);
-
- b = spu_sub(spu_or(b_in, exp_53), spu_sel(exp_53, b_in, sign_mask));
- b = spu_sel(b_in, b, b_denorm);
-
- /* Extract the divisor and dividend exponent and force parameters into the signed
- * range [1.0,2.0) or [-1.0,2.0).
- */
- exp_a = spu_and((vec_ullong2)a, exp_mask);
- exp_b = spu_and((vec_ullong2)b, exp_mask);
-
- mant_a = spu_sel(a, one, (vec_ullong2)exp_mask);
- mant_b = spu_sel(b, one, (vec_ullong2)exp_mask);
-
- /* Approximate the single reciprocal of b by using
- * the single precision reciprocal estimate followed by one
- * single precision iteration of Newton-Raphson.
- */
- mant_bf = spu_roundtf(mant_b);
- inv_bf = spu_re(mant_bf);
- inv_bf = spu_madd(spu_nmsub(mant_bf, inv_bf, onef), inv_bf, inv_bf);
-
- /* Perform 2 more Newton-Raphson iterations in double precision. The
- * result (q1) is in the range (0.5, 2.0).
- */
- inv_b = spu_extend(inv_bf);
- inv_b = spu_madd(spu_nmsub(mant_b, inv_b, one), inv_b, inv_b);
- q0 = spu_mul(mant_a, inv_b);
- q1 = spu_madd(spu_nmsub(mant_b, q0, mant_a), inv_b, q0);
-
- /* Determine the exponent correction factor that must be applied
- * to q1 by taking into account the exponent of the normalized inputs
- * and the scale factors that were applied to normalize them.
- */
- exp = spu_rlmaska(spu_sub((vec_int4)exp_a, (vec_int4)exp_b), -20);
- exp = spu_add(exp, (vec_int4)spu_add(spu_and((vec_int4)a_denorm, -0x34), spu_and((vec_int4)b_denorm, 0x34)));
-
- /* Bias the quotient exponent depending on the sign of the exponent correction
- * factor so that a single multiplier will ensure the entire double precision
- * domain (including denorms) can be achieved.
- *
- * exp bias q1 adjust exp
- * ===== ======== ==========
- * positive 2^+65 -65
- * negative 2^-64 +64
- */
- exp_bias = spu_xor(spu_rlmaska(exp, -31), 64);
- exp = spu_sub(exp, exp_bias);
-
- q1 = spu_sel(q1, (vec_double2)spu_add((vec_int4)q1, spu_sl(exp_bias, 20)), exp_mask);
-
- /* Compute a multiplier (mult) to applied to the quotient (q1) to produce the
- * expected result. On overflow, clamp the multiplier to the maximum non-infinite
- * number in case the rounding mode is not round-to-nearest.
- */
- exp = spu_add(exp, 0x3FF);
- no_underflow = spu_cmpgt(exp, 0);
- overflow = spu_cmpgt(exp, 0x7FE);
- exp = spu_and(spu_sl(exp, 20), (vec_int4)no_underflow);
- exp = spu_and(exp, (vec_int4)exp_mask);
-
- mult = spu_sel((vec_double2)exp, (vec_double2)(spu_add((vec_uint4)exp_mask, -1)), (vec_ullong2)overflow);
-
- /* Handle special value conditions. These include:
- *
- * 1) IF either operand is a NaN OR both operands are 0 or INFINITY THEN a NaN
- * results.
- * 2) ELSE IF the dividend is an INFINITY OR the divisor is 0 THEN a INFINITY results.
- * 3) ELSE IF the dividend is 0 OR the divisor is INFINITY THEN a 0 results.
- */
- mult = spu_andc(mult, (vec_double2)spu_or(a_zero, b_inf));
- mult = spu_sel(mult, (vec_double2)exp_mask, spu_or(a_inf, b_zero));
-
- nan = spu_or(a_nan, b_nan);
- nan = spu_or(nan, spu_and(a_zero, b_zero));
- nan = spu_or(nan, spu_and(a_inf, b_inf));
-
- mult = spu_or(mult, (vec_double2)nan);
-
- /* Scale the final quotient */
-
- q2 = spu_mul(q1, mult);
-
- return (q2);
-}
-
-
-/* We use the same function for vector and scalar division. Provide the
- scalar entry point as an alias. */
-double __divdf3 (double a, double b)
- __attribute__ ((__alias__ ("__divv2df3")));
-
-/* Some toolchain builds used the __fast_divdf3 name for this helper function.
- Provide this as another alternate entry point for compatibility. */
-double __fast_divdf3 (double a, double b)
- __attribute__ ((__alias__ ("__divv2df3")));
-
diff --git a/gcc/config/spu/float_disf.c b/gcc/config/spu/float_disf.c
deleted file mode 100644
index 0f4fe3d8e29..00000000000
--- a/gcc/config/spu/float_disf.c
+++ /dev/null
@@ -1,31 +0,0 @@
-/* Copyright (C) 2008, 2009 Free Software Foundation, Inc.
-
- This file is free software; you can redistribute it and/or modify it under
- the terms of the GNU General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your option)
- any later version.
-
- This file 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/>. */
-
-/* Prototype. */
-float __floatdisf (long long x);
-
-float __floatdisf (long long x)
-{
- /* The SPU back-end now generates inline code for this conversion.
- This file is solely used to provide the __floatdisf functions
- for objects generated with prior versions of GCC. */
- return x;
-}
diff --git a/gcc/config/spu/float_unsdidf.c b/gcc/config/spu/float_unsdidf.c
deleted file mode 100644
index 4fdf0b88a2b..00000000000
--- a/gcc/config/spu/float_unsdidf.c
+++ /dev/null
@@ -1,54 +0,0 @@
-/* Copyright (C) 2006, 2008, 2009 Free Software Foundation, Inc.
-
- This file is free software; you can redistribute it and/or modify it under
- the terms of the GNU General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your option)
- any later version.
-
- This file is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- for more details.
-
- Under Section 7 of GPL version 3, you are granted additional
- permissions described in the GCC Runtime Library Exception, version
- 3.1, as published by the Free Software Foundation.
-
- You should have received a copy of the GNU General Public License and
- a copy of the GCC Runtime Library Exception along with this program;
- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
- <http://www.gnu.org/licenses/>. */
-
-#include <spu_intrinsics.h>
-const unsigned char __didf_scale[16] __attribute__ ((__aligned__ (16))) = {
- 0x00, 0x00, 0x04, 0x3e,
- 0x00, 0x00, 0x04, 0x1e,
- 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00
-};
-const unsigned char __didf_pat[16] __attribute__ ((__aligned__ (16))) = {
- 0x02, 0x03, 0x10, 0x11,
- 0x12, 0x13, 0x80, 0x80,
- 0x06, 0x07, 0x14, 0x15,
- 0x16, 0x17, 0x80, 0x80
-};
-
-/* double __float_unsdidf (unsigned long long int)
- Construct two exact doubles representing the high and low parts (in
- parallel), then add them. */
-qword __float_unsdidf (qword DI);
-qword
-__float_unsdidf (qword DI)
-{
- qword t0, t1, t2, t3, t4, t5, t6, t7, t8;
- t0 = si_clz (DI);
- t1 = si_shl (DI, t0);
- t2 = si_ceqi (t0, 32);
- t3 = si_sf (t0, *(const qword *) __didf_scale);
- t4 = si_a (t1, t1);
- t5 = si_andc (t3, t2);
- t6 = si_shufb (t5, t4, *(const qword *) __didf_pat);
- t7 = si_shlqbii (t6, 4);
- t8 = si_shlqbyi (t7, 8);
- return si_dfa (t7, t8);
-}
diff --git a/gcc/config/spu/float_unsdisf.c b/gcc/config/spu/float_unsdisf.c
deleted file mode 100644
index 7af120ecc8c..00000000000
--- a/gcc/config/spu/float_unsdisf.c
+++ /dev/null
@@ -1,31 +0,0 @@
-/* Copyright (C) 2008, 2009 Free Software Foundation, Inc.
-
- This file is free software; you can redistribute it and/or modify it under
- the terms of the GNU General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your option)
- any later version.
-
- This file 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/>. */
-
-/* Prototype. */
-float __floatundisf (unsigned long long x);
-
-float __floatundisf (unsigned long long x)
-{
- /* The SPU back-end now generates inline code for this conversion.
- This file is solely used to provide the __floatundisf function
- for objects generated with prior versions of GCC. */
- return x;
-}
diff --git a/gcc/config/spu/float_unssidf.c b/gcc/config/spu/float_unssidf.c
deleted file mode 100644
index b255f81af55..00000000000
--- a/gcc/config/spu/float_unssidf.c
+++ /dev/null
@@ -1,45 +0,0 @@
-/* Copyright (C) 2006, 2008, 2009 Free Software Foundation, Inc.
-
- This file is free software; you can redistribute it and/or modify it under
- the terms of the GNU General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your option)
- any later version.
-
- This file is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- for more details.
-
- Under Section 7 of GPL version 3, you are granted additional
- permissions described in the GCC Runtime Library Exception, version
- 3.1, as published by the Free Software Foundation.
-
- You should have received a copy of the GNU General Public License and
- a copy of the GCC Runtime Library Exception along with this program;
- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
- <http://www.gnu.org/licenses/>. */
-
-#include <spu_intrinsics.h>
-const unsigned char __sidf_pat[16] __attribute__ ((__aligned__ (16))) = {
- 0x02, 0x03, 0x10, 0x11,
- 0x12, 0x13, 0x80, 0x80,
- 0x06, 0x07, 0x14, 0x15,
- 0x16, 0x17, 0x80, 0x80
-};
-
-/* double __float_unssidf (unsigned int SI) */
-qword __float_unssidf (qword SI);
-qword
-__float_unssidf (qword SI)
-{
- qword t0, t1, t2, t3, t4, t5, t6, t7;
- t0 = si_clz (SI);
- t1 = si_il (1054);
- t2 = si_shl (SI, t0);
- t3 = si_ceqi (t0, 32);
- t4 = si_sf (t0, t1);
- t5 = si_a (t2, t2);
- t6 = si_andc (t4, t3);
- t7 = si_shufb (t6, t5, *(const qword *) __sidf_pat);
- return si_shlqbii (t7, 4);
-}
diff --git a/gcc/config/spu/mfc_multi_tag_release.c b/gcc/config/spu/mfc_multi_tag_release.c
deleted file mode 100644
index 62eb2beeb8f..00000000000
--- a/gcc/config/spu/mfc_multi_tag_release.c
+++ /dev/null
@@ -1,72 +0,0 @@
-/* Copyright (C) 2007, 2009 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/>. */
-
-#include <spu_mfcio.h>
-extern vector unsigned int __mfc_tag_table;
-
-/* Release a sequential group of tags from exclusive use. The sequential
- group of tags is the range starting from <first_tag> through
- <first_tag>+<number_of_tags>-1. Upon sucessful release, MFC_DMA_TAG_VALID
- is returned and the tags become available for future reservation.
-
- If the specified tags were not previously reserved, no action is
- taken and MFC_DMA_TAG_INVALID is returned. */
-
-unsigned int
-__mfc_multi_tag_release (unsigned int first_tag, unsigned int number_of_tags)
-{
- vector unsigned int table_copy, tmp, tmp1;
- vector unsigned int one = (vector unsigned int)
- { 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF };
- vector unsigned int is_invalid;
- unsigned int last_tag;
- vector unsigned int has_been_reserved;
-
- last_tag = first_tag + number_of_tags;
-
- table_copy = spu_sl (one, number_of_tags);
- table_copy = spu_rl (table_copy, -last_tag);
- table_copy = spu_xor (table_copy, -1);
-
- /* Make sure the tags are in range and valid. */
- tmp = spu_cmpgt (spu_promote(last_tag, 0), 32);
- tmp1 = spu_cmpgt (spu_promote(number_of_tags, 0), 32);
- is_invalid = spu_cmpgt (spu_promote(first_tag, 0), 31);
-
- /* All bits are set to 1 if invalid, 0 if valid. */
- is_invalid = spu_or (tmp, is_invalid);
- is_invalid = spu_or (tmp1, is_invalid);
-
- /* check whether these tags have been reserved */
- tmp = spu_rlmask (one, (int)-number_of_tags);
- tmp1 = spu_sl (__mfc_tag_table, first_tag);
- has_been_reserved = spu_cmpgt(tmp1, tmp);
-
- is_invalid = spu_or (has_been_reserved, is_invalid);
-
- table_copy = spu_sel (__mfc_tag_table, table_copy, table_copy);
- __mfc_tag_table = spu_sel (table_copy, __mfc_tag_table, is_invalid);
-
- return spu_extract (is_invalid, 0);
-}
-
diff --git a/gcc/config/spu/mfc_multi_tag_reserve.c b/gcc/config/spu/mfc_multi_tag_reserve.c
deleted file mode 100644
index 06d70259276..00000000000
--- a/gcc/config/spu/mfc_multi_tag_reserve.c
+++ /dev/null
@@ -1,84 +0,0 @@
-/* Copyright (C) 2007, 2009 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/>. */
-
-#include <spu_mfcio.h>
-extern vector unsigned int __mfc_tag_table;
-
-/* Reserve a sequential group of tags for exclusive use. The number of
- tags to be reserved is specified by the <number_of_tags> parameter.
- This routine returns the first tag ID for a sequential list of
- available tags and marks them as reserved. The reserved group
- of tags is in the range starting from the returned tag through
- the returned tag + <number_of_tags>-1.
-
- If the number of tags requested exceeds the number of available
- sequential tags, then MFC_DMA_TAG_INVALID is returned indicating
- that the request could not be serviced. */
-
-unsigned int
-__mfc_multi_tag_reserve (unsigned int number_of_tags)
-{
- vector unsigned int table_copy;
- vector unsigned int one = (vector unsigned int)
- { 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF };
- vector unsigned int count_busy, is_valid;
- vector unsigned int count_total;
- vector unsigned int count_avail = (vector unsigned int) { 0, 0, 0, 0 };
- vector unsigned int index = (vector unsigned int) { 0, 0, 0, 0 };
-
- table_copy = __mfc_tag_table;
-
-
- /* count_busy: number of consecutive busy tags
- count_avail: number of consecutive free tags
- table_copy: temporary copy of the tag table
- count_total: sum of count_busy and count_avail
- index: index of the current working tag */
- do
- {
- table_copy = spu_sl (table_copy, count_avail);
-
- count_busy = spu_cntlz (table_copy);
- table_copy = spu_sl (table_copy, count_busy);
- count_avail = spu_cntlz (spu_xor(table_copy, -1));
- count_total = spu_add (count_busy, count_avail);
- index = spu_add (index, count_total);
- }
- while (spu_extract (count_avail, 0) < number_of_tags
- && spu_extract (table_copy, 0) != 0);
-
- index = spu_sub (index, count_avail);
-
- /* is_valid is set to 0xFFFFFFFF if table_copy == 0, 0 otherwise. */
- is_valid = spu_cmpeq (table_copy, 0);
- index = spu_sel (index, is_valid, is_valid);
-
- /* Now I need to actually mark the tags as used. */
- table_copy = spu_sl (one, number_of_tags);
- table_copy = spu_rl (table_copy, -number_of_tags - spu_extract (index, 0));
- table_copy = spu_sel (table_copy, __mfc_tag_table, table_copy);
- __mfc_tag_table = spu_sel (table_copy, __mfc_tag_table, is_valid);
-
- return spu_extract (index, 0);
-}
-
diff --git a/gcc/config/spu/mfc_tag_release.c b/gcc/config/spu/mfc_tag_release.c
deleted file mode 100644
index d59c5713053..00000000000
--- a/gcc/config/spu/mfc_tag_release.c
+++ /dev/null
@@ -1,59 +0,0 @@
-/* Copyright (C) 2007, 2009 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/>. */
-
-#include <spu_mfcio.h>
-extern vector unsigned int __mfc_tag_table;
-
-/* Release the specified DMA tag from exclusive use. Once released, the
- tag is available for future reservation. Upon sucessful release,
- MFC_DMA_TAG_VALID is returned. If the specified tag is not in the
- range 0 to 31, or had not been reserved, no action is taken and
- MFC_DMA_TAG_INVALID is returned. */
-
-unsigned int
-__mfc_tag_release (unsigned int tag)
-{
- vector unsigned int is_invalid;
- vector unsigned int mask = (vector unsigned int)
- { 0x80000000, 0x80000000, 0x80000000, 0x80000000 };
- vector signed int zero = (vector signed int) { 0, 0, 0, 0 };
-
- vector signed int has_been_reserved;
-
- /* Check if the tag is out of range. */
- is_invalid = spu_cmpgt (spu_promote (tag, 0), 31);
-
- /* Check whether the tag has been reserved, set to all 1 if has not
- been reserved, 0 otherwise. */
- has_been_reserved = (vector signed int) spu_rl (__mfc_tag_table, tag);
- has_been_reserved = (vector signed int) spu_cmpgt (zero, has_been_reserved);
-
- /* Set invalid. */
- is_invalid = spu_or ((vector unsigned int) has_been_reserved, is_invalid);
-
- mask = spu_rlmask (mask, (int)(-tag));
- __mfc_tag_table = spu_or (__mfc_tag_table, mask);
-
- return spu_extract(is_invalid, 0);
-}
-
diff --git a/gcc/config/spu/mfc_tag_reserve.c b/gcc/config/spu/mfc_tag_reserve.c
deleted file mode 100644
index 23b4817c74f..00000000000
--- a/gcc/config/spu/mfc_tag_reserve.c
+++ /dev/null
@@ -1,51 +0,0 @@
-/* Copyright (C) 2007, 2009 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/>. */
-
-#include <spu_mfcio.h>
-extern vector unsigned int __mfc_tag_table;
-
-/* Reserves a DMA tag for exclusive use. This routine returns an available
- tag id in the range 0 to 31 and marks the tag as reserved. If no tags
- are available, MFC_DMA_TAG_INVALID is returned indicating that all tags
- are already reserved. */
-
-unsigned int
-__mfc_tag_reserve (void)
-{
- vector unsigned int mask = (vector unsigned int)
- { 0x80000000, 0x80000000, 0x80000000, 0x80000000 };
- vector unsigned int count_zeros, is_valid;
- vector signed int count_neg;
-
- count_zeros = spu_cntlz (__mfc_tag_table);
- count_neg = spu_sub (0, (vector signed int) count_zeros);
-
- mask = spu_rlmask (mask, (vector signed int) count_neg);
- __mfc_tag_table = spu_andc (__mfc_tag_table, mask);
-
- is_valid = spu_cmpeq (count_zeros, 32);
- count_zeros = spu_sel (count_zeros, is_valid, is_valid);
-
- return spu_extract (count_zeros, 0);
-}
-
diff --git a/gcc/config/spu/mfc_tag_table.c b/gcc/config/spu/mfc_tag_table.c
deleted file mode 100644
index bd08c580c18..00000000000
--- a/gcc/config/spu/mfc_tag_table.c
+++ /dev/null
@@ -1,39 +0,0 @@
-/* Copyright (C) 2007, 2009 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/>. */
-
-/* The free tag table used by the MFC tag manager, with tag0
- reserved for the overlay manager. */
-__vector unsigned int
-__mfc_tag_table = (__vector unsigned int) { 0x7FFFFFFF, -1, -1, -1 };
-
-/* Arrange to release tag0 if overlays are not present. */
-static void __mfc_tag_init (void) __attribute__ ((constructor));
-
-static void
-__mfc_tag_init (void)
-{
- extern void _ovly_table __attribute__ ((weak));
-
- if (&_ovly_table == 0)
- __mfc_tag_table = (__vector unsigned int) { -1, -1, -1, -1 };
-}
diff --git a/gcc/config/spu/multi3.c b/gcc/config/spu/multi3.c
deleted file mode 100644
index b8b0e90ee25..00000000000
--- a/gcc/config/spu/multi3.c
+++ /dev/null
@@ -1,119 +0,0 @@
-/* Copyright (C) 2008, 2009 Free Software Foundation, Inc.
-
- This file is free software; you can redistribute it and/or modify it under
- the terms of the GNU General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your option)
- any later version.
-
- This file is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- for more details.
-
- Under Section 7 of GPL version 3, you are granted additional
- permissions described in the GCC Runtime Library Exception, version
- 3.1, as published by the Free Software Foundation.
-
- You should have received a copy of the GNU General Public License and
- a copy of the GCC Runtime Library Exception along with this program;
- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
- <http://www.gnu.org/licenses/>. */
-
-#include <spu_intrinsics.h>
-
-typedef int TItype __attribute__ ((mode (TI)));
-
-union qword_TItype
- {
- qword q;
- TItype t;
- };
-
-inline static qword
-si_from_TItype (TItype t)
-{
- union qword_TItype u;
- u.t = t;
- return u.q;
-}
-
-inline static TItype
-si_to_TItype (qword q)
-{
- union qword_TItype u;
- u.q = q;
- return u.t;
-}
-
-/* A straight forward vectorization and unrolling of
- * short l[8], r[8];
- * TItype total = 0;
- * for (i = 0; i < 8; i++)
- * for (j = 0; j < 8; j++)
- * total += (TItype)((l[7-i] * r[7-j]) << (16 * (i + j)));
- */
-TItype
-__multi3 (TItype l, TItype r)
-{
- qword u = si_from_TItype (l);
- qword v = si_from_TItype (r);
- qword splat0 = si_shufb (v, v, si_ilh (0x0001));
- qword splat1 = si_shufb (v, v, si_ilh (0x0203));
- qword splat2 = si_shufb (v, v, si_ilh (0x0405));
- qword splat3 = si_shufb (v, v, si_ilh (0x0607));
- qword splat4 = si_shufb (v, v, si_ilh (0x0809));
- qword splat5 = si_shufb (v, v, si_ilh (0x0a0b));
- qword splat6 = si_shufb (v, v, si_ilh (0x0c0d));
- qword splat7 = si_shufb (v, v, si_ilh (0x0e0f));
-
- qword part0l = si_shlqbyi (si_mpyu (u, splat0), 14);
- qword part1h = si_shlqbyi (si_mpyhhu (u, splat1), 14);
- qword part1l = si_shlqbyi (si_mpyu (u, splat1), 12);
- qword part2h = si_shlqbyi (si_mpyhhu (u, splat2), 12);
- qword part2l = si_shlqbyi (si_mpyu (u, splat2), 10);
- qword part3h = si_shlqbyi (si_mpyhhu (u, splat3), 10);
- qword part3l = si_shlqbyi (si_mpyu (u, splat3), 8);
- qword part4h = si_shlqbyi (si_mpyhhu (u, splat4), 8);
- qword part4l = si_shlqbyi (si_mpyu (u, splat4), 6);
- qword part5h = si_shlqbyi (si_mpyhhu (u, splat5), 6);
- qword part5l = si_shlqbyi (si_mpyu (u, splat5), 4);
- qword part6h = si_shlqbyi (si_mpyhhu (u, splat6), 4);
- qword part6l = si_shlqbyi (si_mpyu (u, splat6), 2);
- qword part7h = si_shlqbyi (si_mpyhhu (u, splat7), 2);
- qword part7l = si_mpyu (u, splat7);
-
- qword carry, total0, total1, total2, total3, total4;
- qword total5, total6, total7, total8, total9, total10;
- qword total;
-
- total0 = si_a (si_a (si_a (part0l, part1h), si_a (part1l, part2h)), part7l);
- total1 = si_a (part2l, part3h);
- total2 = si_a (part3l, part4h);
- total3 = si_a (part4l, part5h);
- total4 = si_a (part5l, part6h);
- total5 = si_a (part6l, part7h);
- total6 = si_a (total0, total1);
- total7 = si_a (total2, total3);
- total8 = si_a (total4, total5);
- total9 = si_a (total6, total7);
- total10 = si_a (total8, total9);
-
- carry = si_cg (part2l, part3h);
- carry = si_a (carry, si_cg (part3l, part4h));
- carry = si_a (carry, si_cg (part4l, part5h));
- carry = si_a (carry, si_cg (part5l, part6h));
- carry = si_a (carry, si_cg (part6l, part7h));
- carry = si_a (carry, si_cg (total0, total1));
- carry = si_a (carry, si_cg (total2, total3));
- carry = si_a (carry, si_cg (total4, total5));
- carry = si_a (carry, si_cg (total6, total7));
- carry = si_a (carry, si_cg (total8, total9));
- carry = si_shlqbyi (carry, 4);
-
- total = si_cg (total10, carry);
- total = si_shlqbyi (total, 4);
- total = si_cgx (total10, carry, total);
- total = si_shlqbyi (total, 4);
- total = si_addx (total10, carry, total);
- return si_to_TItype (total);
-}
diff --git a/gcc/config/spu/t-spu-elf b/gcc/config/spu/t-spu-elf
index b48106efed2..50c8d0353f5 100644
--- a/gcc/config/spu/t-spu-elf
+++ b/gcc/config/spu/t-spu-elf
@@ -15,74 +15,9 @@
# along with GCC; see the file COPYING3. If not see
# <http://www.gnu.org/licenses/>.
-# Suppress building libgcc1.a
-LIBGCC1 =
-CROSS_LIBGCC1 =
-
-TARGET_LIBGCC2_CFLAGS = -fPIC -mwarn-reloc -D__IN_LIBGCC2
-
-# We exclude those because the libgcc2.c default versions do not support
-# the SPU single-precision format (round towards zero). We provide our
-# own versions below and/or via direct expansion.
-LIB2FUNCS_EXCLUDE = _floatdisf _floatundisf _floattisf _floatunstisf
-
-LIB2FUNCS_STATIC_EXTRA = $(srcdir)/config/spu/float_unssidf.c \
- $(srcdir)/config/spu/float_unsdidf.c \
- $(srcdir)/config/spu/float_unsdisf.c \
- $(srcdir)/config/spu/float_disf.c \
- $(srcdir)/config/spu/mfc_tag_table.c \
- $(srcdir)/config/spu/mfc_tag_reserve.c \
- $(srcdir)/config/spu/mfc_tag_release.c \
- $(srcdir)/config/spu/mfc_multi_tag_reserve.c \
- $(srcdir)/config/spu/mfc_multi_tag_release.c \
- $(srcdir)/config/spu/multi3.c \
- $(srcdir)/config/spu/divmodti4.c \
- $(srcdir)/config/spu/divv2df3.c
-
-# Build TImode conversion routines to support Fortran 128-bit
-# integer data types.
-LIB2_SIDITI_CONV_FUNCS=yes
-
-# Don't let CTOR_LIST end up in sdata section.
-CRTSTUFF_T_CFLAGS =
-
# Multi-lib support.
MULTILIB_OPTIONS=mea64
-# Neither gcc or newlib seem to have a standard way to generate multiple
-# crt*.o files. So we don't use the standard crt0.o name anymore.
-
-EXTRA_MULTILIB_PARTS = crtbegin.o crtend.o libgcc_cachemgr.a libgcc_cachemgr_nonatomic.a \
- libgcc_cache8k.a libgcc_cache16k.a libgcc_cache32k.a libgcc_cache64k.a libgcc_cache128k.a
-
-$(T)cachemgr.o: $(srcdir)/config/spu/cachemgr.c
- $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(MULTILIB_CFLAGS) -c $< -o $@
-
-# Specialised rule to add a -D flag.
-$(T)cachemgr_nonatomic.o: $(srcdir)/config/spu/cachemgr.c
- $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(MULTILIB_CFLAGS) -DNONATOMIC -c $< -o $@
-
-$(T)libgcc_%.a: $(T)%.o
- $(AR_FOR_TARGET) -rcs $@ $<
-
-$(T)cache8k.o: $(srcdir)/config/spu/cache.S
- $(GCC_FOR_TARGET) $(MULTILIB_CFLAGS) -D__CACHE_SIZE__=8 -o $@ -c $<
-
-$(T)cache16k.o: $(srcdir)/config/spu/cache.S
- $(GCC_FOR_TARGET) $(MULTILIB_CFLAGS) -D__CACHE_SIZE__=16 -o $@ -c $<
-
-$(T)cache32k.o: $(srcdir)/config/spu/cache.S
- $(GCC_FOR_TARGET) $(MULTILIB_CFLAGS) -D__CACHE_SIZE__=32 -o $@ -c $<
-
-$(T)cache64k.o: $(srcdir)/config/spu/cache.S
- $(GCC_FOR_TARGET) $(MULTILIB_CFLAGS) -D__CACHE_SIZE__=64 -o $@ -c $<
-
-$(T)cache128k.o: $(srcdir)/config/spu/cache.S
- $(GCC_FOR_TARGET) $(MULTILIB_CFLAGS) -D__CACHE_SIZE__=128 -o $@ -c $<
-
-LIBGCC = stmp-multilib
-INSTALL_LIBGCC = install-multilib
-
spu.o: $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
$(RTL_H) $(REGS_H) hard-reg-set.h \
real.h insn-config.h conditions.h insn-attr.h flags.h $(RECOG_H) \
diff --git a/gcc/config/stormy16/stormy16-lib2-ashlsi3.c b/gcc/config/stormy16/stormy16-lib2-ashlsi3.c
deleted file mode 100644
index d6cabc6691c..00000000000
--- a/gcc/config/stormy16/stormy16-lib2-ashlsi3.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define XSTORMY16_ASHLSI3
-#include "stormy16-lib2.c"
diff --git a/gcc/config/stormy16/stormy16-lib2-ashrsi3.c b/gcc/config/stormy16/stormy16-lib2-ashrsi3.c
deleted file mode 100644
index 151e3d01cab..00000000000
--- a/gcc/config/stormy16/stormy16-lib2-ashrsi3.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define XSTORMY16_ASHRSI3
-#include "stormy16-lib2.c"
diff --git a/gcc/config/stormy16/stormy16-lib2-clzhi2.c b/gcc/config/stormy16/stormy16-lib2-clzhi2.c
deleted file mode 100644
index 066fdf13112..00000000000
--- a/gcc/config/stormy16/stormy16-lib2-clzhi2.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define XSTORMY16_CLZHI2
-#include "stormy16-lib2.c"
diff --git a/gcc/config/stormy16/stormy16-lib2-cmpsi2.c b/gcc/config/stormy16/stormy16-lib2-cmpsi2.c
deleted file mode 100644
index 7563c36b569..00000000000
--- a/gcc/config/stormy16/stormy16-lib2-cmpsi2.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define XSTORMY16_CMPSI2
-#include "stormy16-lib2.c"
diff --git a/gcc/config/stormy16/stormy16-lib2-ctzhi2.c b/gcc/config/stormy16/stormy16-lib2-ctzhi2.c
deleted file mode 100644
index c1497db952f..00000000000
--- a/gcc/config/stormy16/stormy16-lib2-ctzhi2.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define XSTORMY16_CTZHI2
-#include "stormy16-lib2.c"
diff --git a/gcc/config/stormy16/stormy16-lib2-divsi3.c b/gcc/config/stormy16/stormy16-lib2-divsi3.c
deleted file mode 100644
index 33c370d1c1f..00000000000
--- a/gcc/config/stormy16/stormy16-lib2-divsi3.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define XSTORMY16_DIVSI3
-#include "stormy16-lib2.c"
diff --git a/gcc/config/stormy16/stormy16-lib2-ffshi2.c b/gcc/config/stormy16/stormy16-lib2-ffshi2.c
deleted file mode 100644
index 4b629ddece8..00000000000
--- a/gcc/config/stormy16/stormy16-lib2-ffshi2.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define XSTORMY16_FFSHI2
-#include "stormy16-lib2.c"
diff --git a/gcc/config/stormy16/stormy16-lib2-lshrsi3.c b/gcc/config/stormy16/stormy16-lib2-lshrsi3.c
deleted file mode 100644
index cd769ee6647..00000000000
--- a/gcc/config/stormy16/stormy16-lib2-lshrsi3.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define XSTORMY16_LSHRSI3
-#include "stormy16-lib2.c"
diff --git a/gcc/config/stormy16/stormy16-lib2-modsi3.c b/gcc/config/stormy16/stormy16-lib2-modsi3.c
deleted file mode 100644
index 587d0070d23..00000000000
--- a/gcc/config/stormy16/stormy16-lib2-modsi3.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define XSTORMY16_MODSI3
-#include "stormy16-lib2.c"
diff --git a/gcc/config/stormy16/stormy16-lib2-parityhi2.c b/gcc/config/stormy16/stormy16-lib2-parityhi2.c
deleted file mode 100644
index 1d128171a8b..00000000000
--- a/gcc/config/stormy16/stormy16-lib2-parityhi2.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define XSTORMY16_PARITYHI2
-#include "stormy16-lib2.c"
diff --git a/gcc/config/stormy16/stormy16-lib2-popcounthi2.c b/gcc/config/stormy16/stormy16-lib2-popcounthi2.c
deleted file mode 100644
index f07d66873e6..00000000000
--- a/gcc/config/stormy16/stormy16-lib2-popcounthi2.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define XSTORMY16_POPCOUNTHI2
-#include "stormy16-lib2.c"
diff --git a/gcc/config/stormy16/stormy16-lib2-ucmpsi2.c b/gcc/config/stormy16/stormy16-lib2-ucmpsi2.c
deleted file mode 100644
index da1a3e70753..00000000000
--- a/gcc/config/stormy16/stormy16-lib2-ucmpsi2.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define XSTORMY16_UCMPSI2
-#include "stormy16-lib2.c"
diff --git a/gcc/config/stormy16/stormy16-lib2-udivmodsi4.c b/gcc/config/stormy16/stormy16-lib2-udivmodsi4.c
deleted file mode 100644
index d555e64c6d8..00000000000
--- a/gcc/config/stormy16/stormy16-lib2-udivmodsi4.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define XSTORMY16_UDIVMODSI4
-#include "stormy16-lib2.c"
diff --git a/gcc/config/stormy16/stormy16-lib2-udivsi3.c b/gcc/config/stormy16/stormy16-lib2-udivsi3.c
deleted file mode 100644
index fdcd64a0ae0..00000000000
--- a/gcc/config/stormy16/stormy16-lib2-udivsi3.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define XSTORMY16_UDIVSI3
-#include "stormy16-lib2.c"
diff --git a/gcc/config/stormy16/stormy16-lib2-umodsi3.c b/gcc/config/stormy16/stormy16-lib2-umodsi3.c
deleted file mode 100644
index 87921f2a196..00000000000
--- a/gcc/config/stormy16/stormy16-lib2-umodsi3.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define XSTORMY16_UMODSI3
-#include "stormy16-lib2.c"
diff --git a/gcc/config/stormy16/stormy16-lib2.c b/gcc/config/stormy16/stormy16-lib2.c
deleted file mode 100644
index e3c16435471..00000000000
--- a/gcc/config/stormy16/stormy16-lib2.c
+++ /dev/null
@@ -1,357 +0,0 @@
-/* This file contains 16-bit versions of some of the functions found in
- libgcc2.c. Really libgcc ought to be moved out of the gcc directory
- and into its own top level directory, and then split up into multiple
- files. On this glorious day maybe this code can be integrated into
- it too. */
-
-/* Copyright (C) 2005, 2008, 2009, 2010 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/>. */
-
-#include "tconfig.h"
-#include "tsystem.h"
-#include "coretypes.h"
-#include "tm.h"
-
-#ifdef HAVE_GAS_HIDDEN
-#define ATTRIBUTE_HIDDEN __attribute__ ((__visibility__ ("hidden")))
-#else
-#define ATTRIBUTE_HIDDEN
-#endif
-
-#ifndef MIN_UNITS_PER_WORD
-#define MIN_UNITS_PER_WORD UNITS_PER_WORD
-#endif
-
-#ifndef LIBGCC2_UNITS_PER_WORD
-# if MIN_UNITS_PER_WORD > 4
-# define LIBGCC2_UNITS_PER_WORD 8
-# elif (MIN_UNITS_PER_WORD > 2 \
- || (MIN_UNITS_PER_WORD > 1 && LONG_LONG_TYPE_SIZE > 32))
-# define LIBGCC2_UNITS_PER_WORD 4
-# else
-# define LIBGCC2_UNITS_PER_WORD MIN_UNITS_PER_WORD
-# endif
-#endif
-
-#define word_type Wtype
-
-#include "libgcc2.h"
-#undef int
-
-/* These prototypes would normally live in libgcc2.h, but this can
- only happen once the code below is integrated into libgcc2.c. */
-
-extern USItype udivmodsi4 (USItype, USItype, word_type);
-extern SItype __divsi3 (SItype, SItype);
-extern SItype __modsi3 (SItype, SItype);
-extern SItype __udivsi3 (SItype, SItype);
-extern SItype __umodsi3 (SItype, SItype);
-extern SItype __ashlsi3 (SItype, SItype);
-extern SItype __ashrsi3 (SItype, SItype);
-extern USItype __lshrsi3 (USItype, USItype);
-extern int __popcounthi2 (UHWtype);
-extern int __parityhi2 (UHWtype);
-extern int __clzhi2 (UHWtype);
-extern int __ctzhi2 (UHWtype);
-
-
-#ifdef XSTORMY16_UDIVMODSI4
-USItype
-udivmodsi4 (USItype num, USItype den, word_type modwanted)
-{
- USItype bit = 1;
- USItype res = 0;
-
- while (den < num && bit && !(den & (1L << 31)))
- {
- den <<= 1;
- bit <<= 1;
- }
- while (bit)
- {
- if (num >= den)
- {
- num -= den;
- res |= bit;
- }
- bit >>= 1;
- den >>= 1;
- }
-
- if (modwanted)
- return num;
- return res;
-}
-#endif
-
-#ifdef XSTORMY16_DIVSI3
-SItype
-__divsi3 (SItype a, SItype b)
-{
- word_type neg = 0;
- SItype res;
-
- if (a < 0)
- {
- a = -a;
- neg = !neg;
- }
-
- if (b < 0)
- {
- b = -b;
- neg = !neg;
- }
-
- res = udivmodsi4 (a, b, 0);
-
- if (neg)
- res = -res;
-
- return res;
-}
-#endif
-
-#ifdef XSTORMY16_MODSI3
-SItype
-__modsi3 (SItype a, SItype b)
-{
- word_type neg = 0;
- SItype res;
-
- if (a < 0)
- {
- a = -a;
- neg = 1;
- }
-
- if (b < 0)
- b = -b;
-
- res = udivmodsi4 (a, b, 1);
-
- if (neg)
- res = -res;
-
- return res;
-}
-#endif
-
-#ifdef XSTORMY16_UDIVSI3
-SItype
-__udivsi3 (SItype a, SItype b)
-{
- return udivmodsi4 (a, b, 0);
-}
-#endif
-
-#ifdef XSTORMY16_UMODSI3
-SItype
-__umodsi3 (SItype a, SItype b)
-{
- return udivmodsi4 (a, b, 1);
-}
-#endif
-
-#ifdef XSTORMY16_ASHLSI3
-SItype
-__ashlsi3 (SItype a, SItype b)
-{
- word_type i;
-
- if (b & 16)
- a <<= 16;
- if (b & 8)
- a <<= 8;
- for (i = (b & 0x7); i > 0; --i)
- a <<= 1;
- return a;
-}
-#endif
-
-#ifdef XSTORMY16_ASHRSI3
-SItype
-__ashrsi3 (SItype a, SItype b)
-{
- word_type i;
-
- if (b & 16)
- a >>= 16;
- if (b & 8)
- a >>= 8;
- for (i = (b & 0x7); i > 0; --i)
- a >>= 1;
- return a;
-}
-#endif
-
-#ifdef XSTORMY16_LSHRSI3
-USItype
-__lshrsi3 (USItype a, USItype b)
-{
- word_type i;
-
- if (b & 16)
- a >>= 16;
- if (b & 8)
- a >>= 8;
- for (i = (b & 0x7); i > 0; --i)
- a >>= 1;
- return a;
-}
-#endif
-
-#ifdef XSTORMY16_POPCOUNTHI2
-/* Returns the number of set bits in X.
- FIXME: The return type really should be "unsigned int"
- but this is not how the builtin is prototyped. */
-int
-__popcounthi2 (UHWtype x)
-{
- int ret;
-
- ret = __popcount_tab [x & 0xff];
- ret += __popcount_tab [(x >> 8) & 0xff];
-
- return ret;
-}
-#endif
-
-#ifdef XSTORMY16_PARITYHI2
-/* Returns the number of set bits in X, modulo 2.
- FIXME: The return type really should be "unsigned int"
- but this is not how the builtin is prototyped. */
-
-int
-__parityhi2 (UHWtype x)
-{
- x ^= x >> 8;
- x ^= x >> 4;
- x &= 0xf;
- return (0x6996 >> x) & 1;
-}
-#endif
-
-#ifdef XSTORMY16_CLZHI2
-/* Returns the number of zero-bits from the most significant bit to the
- first nonzero bit in X. Returns 16 for X == 0. Implemented as a
- simple for loop in order to save space by removing the need for
- the __clz_tab array.
- FIXME: The return type really should be "unsigned int" but this is
- not how the builtin is prototyped. */
-#undef unsigned
-int
-__clzhi2 (UHWtype x)
-{
- unsigned int i;
- unsigned int c;
- unsigned int value = x;
-
- for (c = 0, i = 1 << 15; i; i >>= 1, c++)
- if (i & value)
- break;
- return c;
-}
-#endif
-
-#ifdef XSTORMY16_CTZHI2
-/* Returns the number of trailing zero bits in X.
- FIXME: The return type really should be "signed int" since
- ctz(0) returns -1, but this is not how the builtin is prototyped. */
-
-int
-__ctzhi2 (UHWtype x)
-{
- /* This is cunning. It converts X into a number with only the one bit
- set, the bit that was the least significant bit in X. From this we
- can use the count_leading_zeros to compute the number of trailing
- bits. */
- x &= - x;
-
- return 15 - __builtin_clz (x);
-}
-#endif
-
-#ifdef XSTORMY16_FFSHI2
-/* Returns one plus the index of the least significant 1-bit of X,
- or if X is zero, returns zero. FIXME: The return type really
- should be "unsigned int" but this is not how the builtin is
- prototyped. */
-
-int
-__ffshi2 (UHWtype u)
-{
- UHWtype count;
-
- if (u == 0)
- return 0;
-
- return 16 - __builtin_clz (u & - u);
-}
-#endif
-
-#ifdef XSTORMY16_UCMPSI2
-/* Performs an unsigned comparison of two 32-bit values: A and B.
- If A is less than B, then 0 is returned. If A is greater than B,
- then 2 is returned. Otherwise A and B are equal and 1 is returned. */
-
-word_type
-__ucmpsi2 (USItype a, USItype b)
-{
- word_type hi_a = (a >> 16);
- word_type hi_b = (b >> 16);
-
- if (hi_a == hi_b)
- {
- word_type low_a = (a & 0xffff);
- word_type low_b = (b & 0xffff);
-
- return low_a < low_b ? 0 : (low_a > low_b ? 2 : 1);
- }
-
- return hi_a < hi_b ? 0 : 2;
-}
-#endif
-
-#ifdef XSTORMY16_CMPSI2
-/* Performs an signed comparison of two 32-bit values: A and B.
- If A is less than B, then 0 is returned. If A is greater than B,
- then 2 is returned. Otherwise A and B are equal and 1 is returned. */
-
-word_type
-__cmpsi2 (SItype a, SItype b)
-{
- word_type hi_a = (a >> 16);
- word_type hi_b = (b >> 16);
-
- if (hi_a == hi_b)
- {
- word_type low_a = (a & 0xffff);
- word_type low_b = (b & 0xffff);
-
- return low_a < low_b ? 0 : (low_a > low_b ? 2 : 1);
- }
-
- return hi_a < hi_b ? 0 : 2;
-}
-#endif
diff --git a/gcc/config/stormy16/t-stormy16 b/gcc/config/stormy16/t-stormy16
deleted file mode 100644
index c2b6c2a5573..00000000000
--- a/gcc/config/stormy16/t-stormy16
+++ /dev/null
@@ -1,39 +0,0 @@
-# -*- makefile -*-
-#
-# Copyright (C) 2001, 2004, 2010, 2011 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/>.
-
-# SImode arithmetic and logical routines, HImode bit counting routines.
-LIB2FUNCS_EXTRA = \
- $(srcdir)/config/stormy16/stormy16-lib2-udivmodsi4.c \
- $(srcdir)/config/stormy16/stormy16-lib2-divsi3.c \
- $(srcdir)/config/stormy16/stormy16-lib2-modsi3.c \
- $(srcdir)/config/stormy16/stormy16-lib2-udivsi3.c \
- $(srcdir)/config/stormy16/stormy16-lib2-umodsi3.c \
- $(srcdir)/config/stormy16/stormy16-lib2-ashlsi3.c \
- $(srcdir)/config/stormy16/stormy16-lib2-ashrsi3.c \
- $(srcdir)/config/stormy16/stormy16-lib2-lshrsi3.c \
- $(srcdir)/config/stormy16/stormy16-lib2-popcounthi2.c \
- $(srcdir)/config/stormy16/stormy16-lib2-parityhi2.c \
- $(srcdir)/config/stormy16/stormy16-lib2-clzhi2.c \
- $(srcdir)/config/stormy16/stormy16-lib2-ctzhi2.c \
- $(srcdir)/config/stormy16/stormy16-lib2-ffshi2.c \
- $(srcdir)/config/stormy16/stormy16-lib2-cmpsi2.c \
- $(srcdir)/config/stormy16/stormy16-lib2-ucmpsi2.c
-
-TARGET_LIBGCC2_CFLAGS = -O2
diff --git a/gcc/config/t-darwin b/gcc/config/t-darwin
index d952bd39273..e2bd74d61b0 100644
--- a/gcc/config/t-darwin
+++ b/gcc/config/t-darwin
@@ -41,9 +41,3 @@ darwin-driver.o: $(srcdir)/config/darwin-driver.c \
$(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(GCC_H) opts.h
$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
$(srcdir)/config/darwin-driver.c
-
-# -pipe because there's an assembler bug, 4077127, which causes
-# it to not properly process the first # directive, causing temporary
-# file names to appear in stabs, causing the bootstrap to fail. Using -pipe
-# works around this by not having any temporary file names.
-TARGET_LIBGCC2_CFLAGS = -fPIC -pipe
diff --git a/gcc/config/t-freebsd b/gcc/config/t-freebsd
deleted file mode 100644
index 0680618a6ec..00000000000
--- a/gcc/config/t-freebsd
+++ /dev/null
@@ -1,5 +0,0 @@
-# Compile crtbeginS.o and crtendS.o with pic.
-CRTSTUFF_T_CFLAGS_S = $(CRTSTUFF_T_CFLAGS) -fPIC
-
-# Compile libgcc.a with pic.
-TARGET_LIBGCC2_CFLAGS += -fPIC
diff --git a/gcc/config/t-freebsd-thread b/gcc/config/t-freebsd-thread
deleted file mode 100644
index 6e5c64f78cf..00000000000
--- a/gcc/config/t-freebsd-thread
+++ /dev/null
@@ -1,2 +0,0 @@
-# This is currently needed to compile libgcc2 for threads support
-TARGET_LIBGCC2_CFLAGS += -pthread
diff --git a/gcc/config/t-libc-ok b/gcc/config/t-libc-ok
deleted file mode 100644
index 561ee0b31d1..00000000000
--- a/gcc/config/t-libc-ok
+++ /dev/null
@@ -1 +0,0 @@
-CRTSTUFF_T_CFLAGS_S = $(CRTSTUFF_T_CFLAGS) -fPIC
diff --git a/gcc/config/t-libgcc-pic b/gcc/config/t-libgcc-pic
deleted file mode 100644
index ff935fe1e05..00000000000
--- a/gcc/config/t-libgcc-pic
+++ /dev/null
@@ -1,2 +0,0 @@
-# Compile libgcc2.a with pic.
-TARGET_LIBGCC2_CFLAGS = -fPIC
diff --git a/gcc/config/t-libunwind b/gcc/config/t-libunwind
index 6b8d2dd1292..6ebef7cc837 100644
--- a/gcc/config/t-libunwind
+++ b/gcc/config/t-libunwind
@@ -17,11 +17,5 @@
# <http://www.gnu.org/licenses/>.
# Use the system libunwind library.
-#
-# Override the default value from t-slibgcc-elf-ver and mention -lunwind
-# so that the resulting libgcc_s.so has the necessary DT_NEEDED entry for
-# libunwind.
-SHLIB_LC = -lunwind -lc
T_CFLAGS += -DUSE_LIBUNWIND_EXCEPTIONS
-TARGET_LIBGCC2_CFLAGS += -DUSE_GAS_SYMVER
diff --git a/gcc/config/t-linux b/gcc/config/t-linux
deleted file mode 100644
index 64d19ca8dd7..00000000000
--- a/gcc/config/t-linux
+++ /dev/null
@@ -1,27 +0,0 @@
-# Copyright (C) 1996, 1997, 1998, 2000, 2001, 2002, 2003,
-# 2004, 2011 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/>.
-
-# Compile crtbeginS.o and crtendS.o with pic.
-CRTSTUFF_T_CFLAGS_S = $(CRTSTUFF_T_CFLAGS) -fPIC
-# Compile libgcc2.a with pic.
-TARGET_LIBGCC2_CFLAGS = -fPIC
-
-# Override t-slibgcc-elf-ver to export some libgcc symbols with
-# the symbol versions that glibc used.
-SHLIB_MAPFILES += $(srcdir)/config/libgcc-glibc.ver
diff --git a/gcc/config/t-lynx b/gcc/config/t-lynx
index ab6d2675c4f..860f61281d0 100644
--- a/gcc/config/t-lynx
+++ b/gcc/config/t-lynx
@@ -1,4 +1,4 @@
-# Copyright (C) 2004, 2007 Free Software Foundation, Inc.
+# Copyright (C) 2004, 2007, 2011 Free Software Foundation, Inc.
#
# This file is part of GCC.
#
@@ -16,18 +16,9 @@
# along with GCC; see the file COPYING3. If not see
# <http://www.gnu.org/licenses/>.
-# Compile crtbeginS.o and crtendS.o with pic.
-CRTSTUFF_T_CFLAGS_S = $(CRTSTUFF_T_CFLAGS) -fPIC
-
-# Compile libgcc2.a with pic.
-TARGET_LIBGCC2_CFLAGS = -fPIC
-
MULTILIB_OPTIONS = mthreads
MULTILIB_DIRNAMES = thread
-LIBGCC = stmp-multilib
-INSTALL_LIBGCC = install-multilib
-
Local Variables:
mode: makefile
End:
diff --git a/gcc/config/t-netbsd b/gcc/config/t-netbsd
deleted file mode 100644
index 34949e12858..00000000000
--- a/gcc/config/t-netbsd
+++ /dev/null
@@ -1,2 +0,0 @@
-# Always build crtstuff with PIC.
-CRTSTUFF_T_CFLAGS_S = $(CRTSTUFF_T_CFLAGS) -fPIC
diff --git a/gcc/config/t-openbsd-thread b/gcc/config/t-openbsd-thread
deleted file mode 100644
index 5f4edf567c5..00000000000
--- a/gcc/config/t-openbsd-thread
+++ /dev/null
@@ -1,3 +0,0 @@
-# This is currently needed to compile libgcc2 for threads support
-TARGET_LIBGCC2_CFLAGS=-pthread
-
diff --git a/gcc/config/t-rtems b/gcc/config/t-rtems
index dfbd3afe9ee..baa00d83176 100644
--- a/gcc/config/t-rtems
+++ b/gcc/config/t-rtems
@@ -1,7 +1,2 @@
# RTEMS always has limits.h.
LIMITS_H_TEST = true
-
-# If we are building next to newlib, this will let us find the RTEMS
-# limits.h when building libgcc2. Otherwise, newlib must be installed
-# first.
-LIBGCC2_INCLUDES = -I$(srcdir)/../newlib/libc/sys/rtems/include
diff --git a/gcc/config/t-slibgcc b/gcc/config/t-slibgcc
new file mode 100644
index 00000000000..91f2d92e822
--- /dev/null
+++ b/gcc/config/t-slibgcc
@@ -0,0 +1,2 @@
+# Cause ENABLE_SHARED_LIBGCC to be defined in gcc/Makefile.in (DRIVER_DEFINES).
+SHLIB = true
diff --git a/gcc/config/t-slibgcc-dummy b/gcc/config/t-slibgcc-dummy
deleted file mode 100644
index e68ce5eb24a..00000000000
--- a/gcc/config/t-slibgcc-dummy
+++ /dev/null
@@ -1,3 +0,0 @@
-# SHLIB_LINK must be non-empty so ENABLE_SHARED_LIBGCC is defined correctly
-# in DRIVER_DEFINES if libgcc configuration has been moved to toplevel.
-SHLIB_LINK = dummy
diff --git a/gcc/config/t-slibgcc-elf-ver b/gcc/config/t-slibgcc-elf-ver
deleted file mode 100644
index b90f4fcf3a3..00000000000
--- a/gcc/config/t-slibgcc-elf-ver
+++ /dev/null
@@ -1,56 +0,0 @@
-# Copyright (C) 2001, 2002, 2003, 2004, 2005 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/>.
-
-# Build a shared libgcc library for ELF with symbol versioning
-# with the GNU linker.
-
-SHLIB_EXT = .so
-SHLIB_SOLINK = @shlib_base_name@.so
-SHLIB_SOVERSION = 1
-SHLIB_SONAME = @shlib_base_name@.so.$(SHLIB_SOVERSION)
-SHLIB_MAP = @shlib_map_file@
-SHLIB_OBJS = @shlib_objs@
-SHLIB_DIR = @multilib_dir@
-SHLIB_SLIBDIR_QUAL = @shlib_slibdir_qual@
-SHLIB_LC = -lc
-SHLIB_MAKE_SOLINK = $(LN_S) $(SHLIB_SONAME) $(SHLIB_DIR)/$(SHLIB_SOLINK)
-SHLIB_INSTALL_SOLINK = $(LN_S) $(SHLIB_SONAME) \
- $$(DESTDIR)$$(slibdir)$(SHLIB_SLIBDIR_QUAL)/$(SHLIB_SOLINK)
-
-SHLIB_LINK = $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) -shared -nodefaultlibs \
- -Wl,--soname=$(SHLIB_SONAME) \
- -Wl,--version-script=$(SHLIB_MAP) \
- -o $(SHLIB_DIR)/$(SHLIB_SONAME).tmp @multilib_flags@ \
- $(SHLIB_OBJS) $(SHLIB_LC) && \
- rm -f $(SHLIB_DIR)/$(SHLIB_SOLINK) && \
- if [ -f $(SHLIB_DIR)/$(SHLIB_SONAME) ]; then \
- mv -f $(SHLIB_DIR)/$(SHLIB_SONAME) \
- $(SHLIB_DIR)/$(SHLIB_SONAME).backup; \
- else true; fi && \
- mv $(SHLIB_DIR)/$(SHLIB_SONAME).tmp $(SHLIB_DIR)/$(SHLIB_SONAME) && \
- $(SHLIB_MAKE_SOLINK)
-# $(slibdir) double quoted to protect it from expansion while building
-# libgcc.mk. We want this delayed until actual install time.
-SHLIB_INSTALL = \
- $$(mkinstalldirs) $$(DESTDIR)$$(slibdir)$(SHLIB_SLIBDIR_QUAL); \
- $(INSTALL_DATA) $(SHLIB_DIR)/$(SHLIB_SONAME) \
- $$(DESTDIR)$$(slibdir)$(SHLIB_SLIBDIR_QUAL)/$(SHLIB_SONAME); \
- rm -f $$(DESTDIR)$$(slibdir)$(SHLIB_SLIBDIR_QUAL)/$(SHLIB_SOLINK); \
- $(SHLIB_INSTALL_SOLINK)
-SHLIB_MKMAP = $(srcdir)/mkmap-symver.awk
-SHLIB_MAPFILES = $$(libgcc_objdir)/libgcc-std.ver
diff --git a/gcc/config/t-slibgcc-libgcc b/gcc/config/t-slibgcc-libgcc
deleted file mode 100644
index df004a5e964..00000000000
--- a/gcc/config/t-slibgcc-libgcc
+++ /dev/null
@@ -1,32 +0,0 @@
-# Copyright (C) 2009 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/>.
-
-# Instead of creating $(SHLIB_SOLINK) symlink create a GNU ld
-# linker script which sources in both $(SHLIB_SONAME) and libgcc.a.
-# This is needed on targets where libgcc.a contains routines that aren't in
-# $(SHLIB_SONAME) and are needed for shared libraries.
-
-SHLIB_MAKE_SOLINK = \
- (echo "/* GNU ld script"; \
- echo " Use the shared library, but some functions are only in"; \
- echo " the static library. */"; \
- echo "GROUP ( $(SHLIB_SONAME) libgcc.a )" \
- ) > $(SHLIB_DIR)/$(SHLIB_SOLINK)
-SHLIB_INSTALL_SOLINK = \
- $(INSTALL_DATA) $(SHLIB_DIR)/$(SHLIB_SOLINK) \
- $$(DESTDIR)$$(slibdir)$(SHLIB_SLIBDIR_QUAL)/$(SHLIB_SOLINK)
diff --git a/gcc/config/t-slibgcc-nolc-override b/gcc/config/t-slibgcc-nolc-override
deleted file mode 100644
index 959d2cc2a1f..00000000000
--- a/gcc/config/t-slibgcc-nolc-override
+++ /dev/null
@@ -1 +0,0 @@
-SHLIB_LC =
diff --git a/gcc/config/t-sol2 b/gcc/config/t-sol2
index f9156223593..8646e3625e8 100644
--- a/gcc/config/t-sol2
+++ b/gcc/config/t-sol2
@@ -36,6 +36,3 @@ sol2-stubs.o: $(srcdir)/config/sol2-stubs.c $(CONFIG_H) $(SYSTEM_H) coretypes.h
sol2.o: $(srcdir)/config/sol2.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
tree.h output.h $(TM_H) $(TARGET_H) $(TM_P_H) $(GGC_H)
$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $<
-
-# This is required by gcc/ada/gcc-interface/Makefile.in.
-TARGET_LIBGCC2_CFLAGS = -fPIC
diff --git a/gcc/config/t-svr4 b/gcc/config/t-svr4
deleted file mode 100644
index 6e75eea1f6e..00000000000
--- a/gcc/config/t-svr4
+++ /dev/null
@@ -1,8 +0,0 @@
-# We need to use -fPIC when we are using gcc to compile the routines in
-# crtstuff.c. This is only really needed when we are going to use gcc/g++
-# to produce a shared library, but since we don't know ahead of time when
-# we will be doing that, we just always use -fPIC when compiling the
-# routines in crtstuff.c. Likewise for libgcc2.c.
-
-CRTSTUFF_T_CFLAGS_S = $(CRTSTUFF_T_CFLAGS) -fPIC
-TARGET_LIBGCC2_CFLAGS = -fPIC
diff --git a/gcc/config/t-vxworks b/gcc/config/t-vxworks
index e200d932095..61d6e710aca 100644
--- a/gcc/config/t-vxworks
+++ b/gcc/config/t-vxworks
@@ -1,5 +1,5 @@
# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008,
-# 2009, 2010 Free Software Foundation, Inc.
+# 2009, 2010, 2011 Free Software Foundation, Inc.
#
# This file is part of GCC.
#
@@ -17,37 +17,9 @@
# along with GCC; see the file COPYING3. If not see
# <http://www.gnu.org/licenses/>.
-# Build libgcc using the multilib mechanism
-LIBGCC = stmp-multilib
-INSTALL_LIBGCC = install-multilib
-
-# No special flags needed for libgcc.a
-TARGET_LIBGCC2_CFLAGS =
-
-# Don't build libgcc.a with debug info
-LIBGCC2_DEBUG_CFLAGS =
-
-# Extra libgcc2 modules used by gthr-vxworks.h functions
-LIB2FUNCS_EXTRA = $(srcdir)/config/vxlib.c $(srcdir)/config/vxlib-tls.c
-
-# Some runtime modules need these. Can't set extra_headers in config.gcc
-# because the paths are always made absolute to the cpu config dir.
-EXTRA_HEADERS += $(srcdir)/gthr-vxworks.h gthr-default.h
-
-# This ensures that the correct target headers are used; some
-# VxWorks system headers have names that collide with GCC's
-# internal (host) headers, e.g. regs.h.
-LIBGCC2_INCLUDES = -nostdinc -I \
- `case "/$$(MULTIDIR)" in \
- */mrtp*) echo $(WIND_USR)/h ;; \
- *) echo $(WIND_BASE)/target/h ;; \
- esac`
-
# Both the kernel and RTP headers provide limits.h.
LIMITS_H_TEST = true
-EXTRA_MULTILIB_PARTS =
-
vxworks.o: $(srcdir)/config/vxworks.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
$(TARGET_H) output.h $(TM_H)
$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $<
diff --git a/gcc/config/udivmod.c b/gcc/config/udivmod.c
deleted file mode 100644
index dc70de64fc7..00000000000
--- a/gcc/config/udivmod.c
+++ /dev/null
@@ -1,37 +0,0 @@
-/* Copyright (C) 2000 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/>. */
-
-long udivmodsi4 ();
-
-long
-__udivsi3 (long a, long b)
-{
- return udivmodsi4 (a, b, 0);
-}
-
-long
-__umodsi3 (long a, long b)
-{
- return udivmodsi4 (a, b, 1);
-}
-
diff --git a/gcc/config/udivmodsi4.c b/gcc/config/udivmodsi4.c
deleted file mode 100644
index 39c030fa4df..00000000000
--- a/gcc/config/udivmodsi4.c
+++ /dev/null
@@ -1,47 +0,0 @@
-/* Copyright (C) 2000 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/>. */
-
-unsigned long
-udivmodsi4(unsigned long num, unsigned long den, int modwanted)
-{
- unsigned long bit = 1;
- unsigned long res = 0;
-
- while (den < num && bit && !(den & (1L<<31)))
- {
- den <<=1;
- bit <<=1;
- }
- while (bit)
- {
- if (num >= den)
- {
- num -= den;
- res |= bit;
- }
- bit >>=1;
- den >>=1;
- }
- if (modwanted) return num;
- return res;
-}
diff --git a/gcc/config/v850/lib1funcs.asm b/gcc/config/v850/lib1funcs.asm
deleted file mode 100644
index 04e9b1e0ad4..00000000000
--- a/gcc/config/v850/lib1funcs.asm
+++ /dev/null
@@ -1,2330 +0,0 @@
-/* libgcc routines for NEC V850.
- Copyright (C) 1996, 1997, 2002, 2005, 2009, 2010
- 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.
-
-This file 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/>. */
-
-#ifdef L_mulsi3
- .text
- .globl ___mulsi3
- .type ___mulsi3,@function
-___mulsi3:
-#ifdef __v850__
-/*
- #define SHIFT 12
- #define MASK ((1 << SHIFT) - 1)
-
- #define STEP(i, j) \
- ({ \
- short a_part = (a >> (i)) & MASK; \
- short b_part = (b >> (j)) & MASK; \
- int res = (((int) a_part) * ((int) b_part)); \
- res; \
- })
-
- int
- __mulsi3 (unsigned a, unsigned b)
- {
- return STEP (0, 0) +
- ((STEP (SHIFT, 0) + STEP (0, SHIFT)) << SHIFT) +
- ((STEP (0, 2 * SHIFT) + STEP (SHIFT, SHIFT) + STEP (2 * SHIFT, 0))
- << (2 * SHIFT));
- }
-*/
- mov r6, r14
- movea lo(32767), r0, r10
- and r10, r14
- mov r7, r15
- and r10, r15
- shr 15, r6
- mov r6, r13
- and r10, r13
- shr 15, r7
- mov r7, r12
- and r10, r12
- shr 15, r6
- shr 15, r7
- mov r14, r10
- mulh r15, r10
- mov r14, r11
- mulh r12, r11
- mov r13, r16
- mulh r15, r16
- mulh r14, r7
- mulh r15, r6
- add r16, r11
- mulh r13, r12
- shl 15, r11
- add r11, r10
- add r12, r7
- add r6, r7
- shl 30, r7
- add r7, r10
- jmp [r31]
-#endif /* __v850__ */
-#if defined(__v850e__) || defined(__v850ea__) || defined(__v850e2__) || defined(__v850e2v3__)
- /* This routine is almost unneccesarry because gcc
- generates the MUL instruction for the RTX mulsi3.
- But if someone wants to link his application with
- previsously compiled v850 objects then they will
- need this function. */
-
- /* It isn't good to put the inst sequence as below;
- mul r7, r6,
- mov r6, r10, r0
- In this case, there is a RAW hazard between them.
- MUL inst takes 2 cycle in EX stage, then MOV inst
- must wait 1cycle. */
- mov r7, r10
- mul r6, r10, r0
- jmp [r31]
-#endif /* __v850e__ */
- .size ___mulsi3,.-___mulsi3
-#endif /* L_mulsi3 */
-
-
-#ifdef L_udivsi3
- .text
- .global ___udivsi3
- .type ___udivsi3,@function
-___udivsi3:
-#ifdef __v850__
- mov 1,r12
- mov 0,r10
- cmp r6,r7
- bnl .L12
- movhi hi(-2147483648),r0,r13
- cmp r0,r7
- blt .L12
-.L4:
- shl 1,r7
- shl 1,r12
- cmp r6,r7
- bnl .L12
- cmp r0,r12
- be .L8
- mov r7,r19
- and r13,r19
- be .L4
- br .L12
-.L9:
- cmp r7,r6
- bl .L10
- sub r7,r6
- or r12,r10
-.L10:
- shr 1,r12
- shr 1,r7
-.L12:
- cmp r0,r12
- bne .L9
-.L8:
- jmp [r31]
-
-#else /* defined(__v850e__) */
-
- /* See comments at end of __mulsi3. */
- mov r6, r10
- divu r7, r10, r0
- jmp [r31]
-
-#endif /* __v850e__ */
-
- .size ___udivsi3,.-___udivsi3
-#endif
-
-#ifdef L_divsi3
- .text
- .globl ___divsi3
- .type ___divsi3,@function
-___divsi3:
-#ifdef __v850__
- add -8,sp
- st.w r31,4[sp]
- st.w r22,0[sp]
- mov 1,r22
- tst r7,r7
- bp .L3
- subr r0,r7
- subr r0,r22
-.L3:
- tst r6,r6
- bp .L4
- subr r0,r6
- subr r0,r22
-.L4:
- jarl ___udivsi3,r31
- cmp r0,r22
- bp .L7
- subr r0,r10
-.L7:
- ld.w 0[sp],r22
- ld.w 4[sp],r31
- add 8,sp
- jmp [r31]
-
-#else /* defined(__v850e__) */
-
- /* See comments at end of __mulsi3. */
- mov r6, r10
- div r7, r10, r0
- jmp [r31]
-
-#endif /* __v850e__ */
-
- .size ___divsi3,.-___divsi3
-#endif
-
-#ifdef L_umodsi3
- .text
- .globl ___umodsi3
- .type ___umodsi3,@function
-___umodsi3:
-#ifdef __v850__
- add -12,sp
- st.w r31,8[sp]
- st.w r7,4[sp]
- st.w r6,0[sp]
- jarl ___udivsi3,r31
- ld.w 4[sp],r7
- mov r10,r6
- jarl ___mulsi3,r31
- ld.w 0[sp],r6
- subr r6,r10
- ld.w 8[sp],r31
- add 12,sp
- jmp [r31]
-
-#else /* defined(__v850e__) */
-
- /* See comments at end of __mulsi3. */
- divu r7, r6, r10
- jmp [r31]
-
-#endif /* __v850e__ */
-
- .size ___umodsi3,.-___umodsi3
-#endif /* L_umodsi3 */
-
-#ifdef L_modsi3
- .text
- .globl ___modsi3
- .type ___modsi3,@function
-___modsi3:
-#ifdef __v850__
- add -12,sp
- st.w r31,8[sp]
- st.w r7,4[sp]
- st.w r6,0[sp]
- jarl ___divsi3,r31
- ld.w 4[sp],r7
- mov r10,r6
- jarl ___mulsi3,r31
- ld.w 0[sp],r6
- subr r6,r10
- ld.w 8[sp],r31
- add 12,sp
- jmp [r31]
-
-#else /* defined(__v850e__) */
-
- /* See comments at end of __mulsi3. */
- div r7, r6, r10
- jmp [r31]
-
-#endif /* __v850e__ */
-
- .size ___modsi3,.-___modsi3
-#endif /* L_modsi3 */
-
-#ifdef L_save_2
- .text
- .align 2
- .globl __save_r2_r29
- .type __save_r2_r29,@function
- /* Allocate space and save registers 2, 20 .. 29 on the stack. */
- /* Called via: jalr __save_r2_r29,r10. */
-__save_r2_r29:
-#ifdef __EP__
- mov ep,r1
- addi -44,sp,sp
- mov sp,ep
- sst.w r29,0[ep]
- sst.w r28,4[ep]
- sst.w r27,8[ep]
- sst.w r26,12[ep]
- sst.w r25,16[ep]
- sst.w r24,20[ep]
- sst.w r23,24[ep]
- sst.w r22,28[ep]
- sst.w r21,32[ep]
- sst.w r20,36[ep]
- sst.w r2,40[ep]
- mov r1,ep
-#else
- addi -44,sp,sp
- st.w r29,0[sp]
- st.w r28,4[sp]
- st.w r27,8[sp]
- st.w r26,12[sp]
- st.w r25,16[sp]
- st.w r24,20[sp]
- st.w r23,24[sp]
- st.w r22,28[sp]
- st.w r21,32[sp]
- st.w r20,36[sp]
- st.w r2,40[sp]
-#endif
- jmp [r10]
- .size __save_r2_r29,.-__save_r2_r29
-
- /* Restore saved registers, deallocate stack and return to the user. */
- /* Called via: jr __return_r2_r29. */
- .align 2
- .globl __return_r2_r29
- .type __return_r2_r29,@function
-__return_r2_r29:
-#ifdef __EP__
- mov ep,r1
- mov sp,ep
- sld.w 0[ep],r29
- sld.w 4[ep],r28
- sld.w 8[ep],r27
- sld.w 12[ep],r26
- sld.w 16[ep],r25
- sld.w 20[ep],r24
- sld.w 24[ep],r23
- sld.w 28[ep],r22
- sld.w 32[ep],r21
- sld.w 36[ep],r20
- sld.w 40[ep],r2
- addi 44,sp,sp
- mov r1,ep
-#else
- ld.w 0[sp],r29
- ld.w 4[sp],r28
- ld.w 8[sp],r27
- ld.w 12[sp],r26
- ld.w 16[sp],r25
- ld.w 20[sp],r24
- ld.w 24[sp],r23
- ld.w 28[sp],r22
- ld.w 32[sp],r21
- ld.w 36[sp],r20
- ld.w 40[sp],r2
- addi 44,sp,sp
-#endif
- jmp [r31]
- .size __return_r2_r29,.-__return_r2_r29
-#endif /* L_save_2 */
-
-#ifdef L_save_20
- .text
- .align 2
- .globl __save_r20_r29
- .type __save_r20_r29,@function
- /* Allocate space and save registers 20 .. 29 on the stack. */
- /* Called via: jalr __save_r20_r29,r10. */
-__save_r20_r29:
-#ifdef __EP__
- mov ep,r1
- addi -40,sp,sp
- mov sp,ep
- sst.w r29,0[ep]
- sst.w r28,4[ep]
- sst.w r27,8[ep]
- sst.w r26,12[ep]
- sst.w r25,16[ep]
- sst.w r24,20[ep]
- sst.w r23,24[ep]
- sst.w r22,28[ep]
- sst.w r21,32[ep]
- sst.w r20,36[ep]
- mov r1,ep
-#else
- addi -40,sp,sp
- st.w r29,0[sp]
- st.w r28,4[sp]
- st.w r27,8[sp]
- st.w r26,12[sp]
- st.w r25,16[sp]
- st.w r24,20[sp]
- st.w r23,24[sp]
- st.w r22,28[sp]
- st.w r21,32[sp]
- st.w r20,36[sp]
-#endif
- jmp [r10]
- .size __save_r20_r29,.-__save_r20_r29
-
- /* Restore saved registers, deallocate stack and return to the user. */
- /* Called via: jr __return_r20_r29. */
- .align 2
- .globl __return_r20_r29
- .type __return_r20_r29,@function
-__return_r20_r29:
-#ifdef __EP__
- mov ep,r1
- mov sp,ep
- sld.w 0[ep],r29
- sld.w 4[ep],r28
- sld.w 8[ep],r27
- sld.w 12[ep],r26
- sld.w 16[ep],r25
- sld.w 20[ep],r24
- sld.w 24[ep],r23
- sld.w 28[ep],r22
- sld.w 32[ep],r21
- sld.w 36[ep],r20
- addi 40,sp,sp
- mov r1,ep
-#else
- ld.w 0[sp],r29
- ld.w 4[sp],r28
- ld.w 8[sp],r27
- ld.w 12[sp],r26
- ld.w 16[sp],r25
- ld.w 20[sp],r24
- ld.w 24[sp],r23
- ld.w 28[sp],r22
- ld.w 32[sp],r21
- ld.w 36[sp],r20
- addi 40,sp,sp
-#endif
- jmp [r31]
- .size __return_r20_r29,.-__return_r20_r29
-#endif /* L_save_20 */
-
-#ifdef L_save_21
- .text
- .align 2
- .globl __save_r21_r29
- .type __save_r21_r29,@function
- /* Allocate space and save registers 21 .. 29 on the stack. */
- /* Called via: jalr __save_r21_r29,r10. */
-__save_r21_r29:
-#ifdef __EP__
- mov ep,r1
- addi -36,sp,sp
- mov sp,ep
- sst.w r29,0[ep]
- sst.w r28,4[ep]
- sst.w r27,8[ep]
- sst.w r26,12[ep]
- sst.w r25,16[ep]
- sst.w r24,20[ep]
- sst.w r23,24[ep]
- sst.w r22,28[ep]
- sst.w r21,32[ep]
- mov r1,ep
-#else
- addi -36,sp,sp
- st.w r29,0[sp]
- st.w r28,4[sp]
- st.w r27,8[sp]
- st.w r26,12[sp]
- st.w r25,16[sp]
- st.w r24,20[sp]
- st.w r23,24[sp]
- st.w r22,28[sp]
- st.w r21,32[sp]
-#endif
- jmp [r10]
- .size __save_r21_r29,.-__save_r21_r29
-
- /* Restore saved registers, deallocate stack and return to the user. */
- /* Called via: jr __return_r21_r29. */
- .align 2
- .globl __return_r21_r29
- .type __return_r21_r29,@function
-__return_r21_r29:
-#ifdef __EP__
- mov ep,r1
- mov sp,ep
- sld.w 0[ep],r29
- sld.w 4[ep],r28
- sld.w 8[ep],r27
- sld.w 12[ep],r26
- sld.w 16[ep],r25
- sld.w 20[ep],r24
- sld.w 24[ep],r23
- sld.w 28[ep],r22
- sld.w 32[ep],r21
- addi 36,sp,sp
- mov r1,ep
-#else
- ld.w 0[sp],r29
- ld.w 4[sp],r28
- ld.w 8[sp],r27
- ld.w 12[sp],r26
- ld.w 16[sp],r25
- ld.w 20[sp],r24
- ld.w 24[sp],r23
- ld.w 28[sp],r22
- ld.w 32[sp],r21
- addi 36,sp,sp
-#endif
- jmp [r31]
- .size __return_r21_r29,.-__return_r21_r29
-#endif /* L_save_21 */
-
-#ifdef L_save_22
- .text
- .align 2
- .globl __save_r22_r29
- .type __save_r22_r29,@function
- /* Allocate space and save registers 22 .. 29 on the stack. */
- /* Called via: jalr __save_r22_r29,r10. */
-__save_r22_r29:
-#ifdef __EP__
- mov ep,r1
- addi -32,sp,sp
- mov sp,ep
- sst.w r29,0[ep]
- sst.w r28,4[ep]
- sst.w r27,8[ep]
- sst.w r26,12[ep]
- sst.w r25,16[ep]
- sst.w r24,20[ep]
- sst.w r23,24[ep]
- sst.w r22,28[ep]
- mov r1,ep
-#else
- addi -32,sp,sp
- st.w r29,0[sp]
- st.w r28,4[sp]
- st.w r27,8[sp]
- st.w r26,12[sp]
- st.w r25,16[sp]
- st.w r24,20[sp]
- st.w r23,24[sp]
- st.w r22,28[sp]
-#endif
- jmp [r10]
- .size __save_r22_r29,.-__save_r22_r29
-
- /* Restore saved registers, deallocate stack and return to the user. */
- /* Called via: jr __return_r22_r29. */
- .align 2
- .globl __return_r22_r29
- .type __return_r22_r29,@function
-__return_r22_r29:
-#ifdef __EP__
- mov ep,r1
- mov sp,ep
- sld.w 0[ep],r29
- sld.w 4[ep],r28
- sld.w 8[ep],r27
- sld.w 12[ep],r26
- sld.w 16[ep],r25
- sld.w 20[ep],r24
- sld.w 24[ep],r23
- sld.w 28[ep],r22
- addi 32,sp,sp
- mov r1,ep
-#else
- ld.w 0[sp],r29
- ld.w 4[sp],r28
- ld.w 8[sp],r27
- ld.w 12[sp],r26
- ld.w 16[sp],r25
- ld.w 20[sp],r24
- ld.w 24[sp],r23
- ld.w 28[sp],r22
- addi 32,sp,sp
-#endif
- jmp [r31]
- .size __return_r22_r29,.-__return_r22_r29
-#endif /* L_save_22 */
-
-#ifdef L_save_23
- .text
- .align 2
- .globl __save_r23_r29
- .type __save_r23_r29,@function
- /* Allocate space and save registers 23 .. 29 on the stack. */
- /* Called via: jalr __save_r23_r29,r10. */
-__save_r23_r29:
-#ifdef __EP__
- mov ep,r1
- addi -28,sp,sp
- mov sp,ep
- sst.w r29,0[ep]
- sst.w r28,4[ep]
- sst.w r27,8[ep]
- sst.w r26,12[ep]
- sst.w r25,16[ep]
- sst.w r24,20[ep]
- sst.w r23,24[ep]
- mov r1,ep
-#else
- addi -28,sp,sp
- st.w r29,0[sp]
- st.w r28,4[sp]
- st.w r27,8[sp]
- st.w r26,12[sp]
- st.w r25,16[sp]
- st.w r24,20[sp]
- st.w r23,24[sp]
-#endif
- jmp [r10]
- .size __save_r23_r29,.-__save_r23_r29
-
- /* Restore saved registers, deallocate stack and return to the user. */
- /* Called via: jr __return_r23_r29. */
- .align 2
- .globl __return_r23_r29
- .type __return_r23_r29,@function
-__return_r23_r29:
-#ifdef __EP__
- mov ep,r1
- mov sp,ep
- sld.w 0[ep],r29
- sld.w 4[ep],r28
- sld.w 8[ep],r27
- sld.w 12[ep],r26
- sld.w 16[ep],r25
- sld.w 20[ep],r24
- sld.w 24[ep],r23
- addi 28,sp,sp
- mov r1,ep
-#else
- ld.w 0[sp],r29
- ld.w 4[sp],r28
- ld.w 8[sp],r27
- ld.w 12[sp],r26
- ld.w 16[sp],r25
- ld.w 20[sp],r24
- ld.w 24[sp],r23
- addi 28,sp,sp
-#endif
- jmp [r31]
- .size __return_r23_r29,.-__return_r23_r29
-#endif /* L_save_23 */
-
-#ifdef L_save_24
- .text
- .align 2
- .globl __save_r24_r29
- .type __save_r24_r29,@function
- /* Allocate space and save registers 24 .. 29 on the stack. */
- /* Called via: jalr __save_r24_r29,r10. */
-__save_r24_r29:
-#ifdef __EP__
- mov ep,r1
- addi -24,sp,sp
- mov sp,ep
- sst.w r29,0[ep]
- sst.w r28,4[ep]
- sst.w r27,8[ep]
- sst.w r26,12[ep]
- sst.w r25,16[ep]
- sst.w r24,20[ep]
- mov r1,ep
-#else
- addi -24,sp,sp
- st.w r29,0[sp]
- st.w r28,4[sp]
- st.w r27,8[sp]
- st.w r26,12[sp]
- st.w r25,16[sp]
- st.w r24,20[sp]
-#endif
- jmp [r10]
- .size __save_r24_r29,.-__save_r24_r29
-
- /* Restore saved registers, deallocate stack and return to the user. */
- /* Called via: jr __return_r24_r29. */
- .align 2
- .globl __return_r24_r29
- .type __return_r24_r29,@function
-__return_r24_r29:
-#ifdef __EP__
- mov ep,r1
- mov sp,ep
- sld.w 0[ep],r29
- sld.w 4[ep],r28
- sld.w 8[ep],r27
- sld.w 12[ep],r26
- sld.w 16[ep],r25
- sld.w 20[ep],r24
- addi 24,sp,sp
- mov r1,ep
-#else
- ld.w 0[sp],r29
- ld.w 4[sp],r28
- ld.w 8[sp],r27
- ld.w 12[sp],r26
- ld.w 16[sp],r25
- ld.w 20[sp],r24
- addi 24,sp,sp
-#endif
- jmp [r31]
- .size __return_r24_r29,.-__return_r24_r29
-#endif /* L_save_24 */
-
-#ifdef L_save_25
- .text
- .align 2
- .globl __save_r25_r29
- .type __save_r25_r29,@function
- /* Allocate space and save registers 25 .. 29 on the stack. */
- /* Called via: jalr __save_r25_r29,r10. */
-__save_r25_r29:
-#ifdef __EP__
- mov ep,r1
- addi -20,sp,sp
- mov sp,ep
- sst.w r29,0[ep]
- sst.w r28,4[ep]
- sst.w r27,8[ep]
- sst.w r26,12[ep]
- sst.w r25,16[ep]
- mov r1,ep
-#else
- addi -20,sp,sp
- st.w r29,0[sp]
- st.w r28,4[sp]
- st.w r27,8[sp]
- st.w r26,12[sp]
- st.w r25,16[sp]
-#endif
- jmp [r10]
- .size __save_r25_r29,.-__save_r25_r29
-
- /* Restore saved registers, deallocate stack and return to the user. */
- /* Called via: jr __return_r25_r29. */
- .align 2
- .globl __return_r25_r29
- .type __return_r25_r29,@function
-__return_r25_r29:
-#ifdef __EP__
- mov ep,r1
- mov sp,ep
- sld.w 0[ep],r29
- sld.w 4[ep],r28
- sld.w 8[ep],r27
- sld.w 12[ep],r26
- sld.w 16[ep],r25
- addi 20,sp,sp
- mov r1,ep
-#else
- ld.w 0[ep],r29
- ld.w 4[ep],r28
- ld.w 8[ep],r27
- ld.w 12[ep],r26
- ld.w 16[ep],r25
- addi 20,sp,sp
-#endif
- jmp [r31]
- .size __return_r25_r29,.-__return_r25_r29
-#endif /* L_save_25 */
-
-#ifdef L_save_26
- .text
- .align 2
- .globl __save_r26_r29
- .type __save_r26_r29,@function
- /* Allocate space and save registers 26 .. 29 on the stack. */
- /* Called via: jalr __save_r26_r29,r10. */
-__save_r26_r29:
-#ifdef __EP__
- mov ep,r1
- add -16,sp
- mov sp,ep
- sst.w r29,0[ep]
- sst.w r28,4[ep]
- sst.w r27,8[ep]
- sst.w r26,12[ep]
- mov r1,ep
-#else
- add -16,sp
- st.w r29,0[sp]
- st.w r28,4[sp]
- st.w r27,8[sp]
- st.w r26,12[sp]
-#endif
- jmp [r10]
- .size __save_r26_r29,.-__save_r26_r29
-
- /* Restore saved registers, deallocate stack and return to the user. */
- /* Called via: jr __return_r26_r29. */
- .align 2
- .globl __return_r26_r29
- .type __return_r26_r29,@function
-__return_r26_r29:
-#ifdef __EP__
- mov ep,r1
- mov sp,ep
- sld.w 0[ep],r29
- sld.w 4[ep],r28
- sld.w 8[ep],r27
- sld.w 12[ep],r26
- addi 16,sp,sp
- mov r1,ep
-#else
- ld.w 0[sp],r29
- ld.w 4[sp],r28
- ld.w 8[sp],r27
- ld.w 12[sp],r26
- addi 16,sp,sp
-#endif
- jmp [r31]
- .size __return_r26_r29,.-__return_r26_r29
-#endif /* L_save_26 */
-
-#ifdef L_save_27
- .text
- .align 2
- .globl __save_r27_r29
- .type __save_r27_r29,@function
- /* Allocate space and save registers 27 .. 29 on the stack. */
- /* Called via: jalr __save_r27_r29,r10. */
-__save_r27_r29:
- add -12,sp
- st.w r29,0[sp]
- st.w r28,4[sp]
- st.w r27,8[sp]
- jmp [r10]
- .size __save_r27_r29,.-__save_r27_r29
-
- /* Restore saved registers, deallocate stack and return to the user. */
- /* Called via: jr __return_r27_r29. */
- .align 2
- .globl __return_r27_r29
- .type __return_r27_r29,@function
-__return_r27_r29:
- ld.w 0[sp],r29
- ld.w 4[sp],r28
- ld.w 8[sp],r27
- add 12,sp
- jmp [r31]
- .size __return_r27_r29,.-__return_r27_r29
-#endif /* L_save_27 */
-
-#ifdef L_save_28
- .text
- .align 2
- .globl __save_r28_r29
- .type __save_r28_r29,@function
- /* Allocate space and save registers 28,29 on the stack. */
- /* Called via: jalr __save_r28_r29,r10. */
-__save_r28_r29:
- add -8,sp
- st.w r29,0[sp]
- st.w r28,4[sp]
- jmp [r10]
- .size __save_r28_r29,.-__save_r28_r29
-
- /* Restore saved registers, deallocate stack and return to the user. */
- /* Called via: jr __return_r28_r29. */
- .align 2
- .globl __return_r28_r29
- .type __return_r28_r29,@function
-__return_r28_r29:
- ld.w 0[sp],r29
- ld.w 4[sp],r28
- add 8,sp
- jmp [r31]
- .size __return_r28_r29,.-__return_r28_r29
-#endif /* L_save_28 */
-
-#ifdef L_save_29
- .text
- .align 2
- .globl __save_r29
- .type __save_r29,@function
- /* Allocate space and save register 29 on the stack. */
- /* Called via: jalr __save_r29,r10. */
-__save_r29:
- add -4,sp
- st.w r29,0[sp]
- jmp [r10]
- .size __save_r29,.-__save_r29
-
- /* Restore saved register 29, deallocate stack and return to the user. */
- /* Called via: jr __return_r29. */
- .align 2
- .globl __return_r29
- .type __return_r29,@function
-__return_r29:
- ld.w 0[sp],r29
- add 4,sp
- jmp [r31]
- .size __return_r29,.-__return_r29
-#endif /* L_save_28 */
-
-#ifdef L_save_2c
- .text
- .align 2
- .globl __save_r2_r31
- .type __save_r2_r31,@function
- /* Allocate space and save registers 20 .. 29, 31 on the stack. */
- /* Also allocate space for the argument save area. */
- /* Called via: jalr __save_r2_r31,r10. */
-__save_r2_r31:
-#ifdef __EP__
- mov ep,r1
- addi -48,sp,sp
- mov sp,ep
- sst.w r29,0[ep]
- sst.w r28,4[ep]
- sst.w r27,8[ep]
- sst.w r26,12[ep]
- sst.w r25,16[ep]
- sst.w r24,20[ep]
- sst.w r23,24[ep]
- sst.w r22,28[ep]
- sst.w r21,32[ep]
- sst.w r20,36[ep]
- sst.w r2,40[ep]
- sst.w r31,44[ep]
- mov r1,ep
-#else
- addi -48,sp,sp
- st.w r29,0[sp]
- st.w r28,4[sp]
- st.w r27,8[sp]
- st.w r26,12[sp]
- st.w r25,16[sp]
- st.w r24,20[sp]
- st.w r23,24[sp]
- st.w r22,28[sp]
- st.w r21,32[sp]
- st.w r20,36[sp]
- st.w r2,40[sp]
- st.w r31,44[sp]
-#endif
- jmp [r10]
- .size __save_r2_r31,.-__save_r2_r31
-
- /* Restore saved registers, deallocate stack and return to the user. */
- /* Called via: jr __return_r20_r31. */
- .align 2
- .globl __return_r2_r31
- .type __return_r2_r31,@function
-__return_r2_r31:
-#ifdef __EP__
- mov ep,r1
- mov sp,ep
- sld.w 0[ep],r29
- sld.w 4[ep],r28
- sld.w 8[ep],r27
- sld.w 12[ep],r26
- sld.w 16[ep],r25
- sld.w 20[ep],r24
- sld.w 24[ep],r23
- sld.w 28[ep],r22
- sld.w 32[ep],r21
- sld.w 36[ep],r20
- sld.w 40[ep],r2
- sld.w 44[ep],r31
- addi 48,sp,sp
- mov r1,ep
-#else
- ld.w 44[sp],r29
- ld.w 40[sp],r28
- ld.w 36[sp],r27
- ld.w 32[sp],r26
- ld.w 28[sp],r25
- ld.w 24[sp],r24
- ld.w 20[sp],r23
- ld.w 16[sp],r22
- ld.w 12[sp],r21
- ld.w 8[sp],r20
- ld.w 4[sp],r2
- ld.w 0[sp],r31
- addi 48,sp,sp
-#endif
- jmp [r31]
- .size __return_r2_r31,.-__return_r2_r31
-#endif /* L_save_2c */
-
-#ifdef L_save_20c
- .text
- .align 2
- .globl __save_r20_r31
- .type __save_r20_r31,@function
- /* Allocate space and save registers 20 .. 29, 31 on the stack. */
- /* Also allocate space for the argument save area. */
- /* Called via: jalr __save_r20_r31,r10. */
-__save_r20_r31:
-#ifdef __EP__
- mov ep,r1
- addi -44,sp,sp
- mov sp,ep
- sst.w r29,0[ep]
- sst.w r28,4[ep]
- sst.w r27,8[ep]
- sst.w r26,12[ep]
- sst.w r25,16[ep]
- sst.w r24,20[ep]
- sst.w r23,24[ep]
- sst.w r22,28[ep]
- sst.w r21,32[ep]
- sst.w r20,36[ep]
- sst.w r31,40[ep]
- mov r1,ep
-#else
- addi -44,sp,sp
- st.w r29,0[sp]
- st.w r28,4[sp]
- st.w r27,8[sp]
- st.w r26,12[sp]
- st.w r25,16[sp]
- st.w r24,20[sp]
- st.w r23,24[sp]
- st.w r22,28[sp]
- st.w r21,32[sp]
- st.w r20,36[sp]
- st.w r31,40[sp]
-#endif
- jmp [r10]
- .size __save_r20_r31,.-__save_r20_r31
-
- /* Restore saved registers, deallocate stack and return to the user. */
- /* Called via: jr __return_r20_r31. */
- .align 2
- .globl __return_r20_r31
- .type __return_r20_r31,@function
-__return_r20_r31:
-#ifdef __EP__
- mov ep,r1
- mov sp,ep
- sld.w 0[ep],r29
- sld.w 4[ep],r28
- sld.w 8[ep],r27
- sld.w 12[ep],r26
- sld.w 16[ep],r25
- sld.w 20[ep],r24
- sld.w 24[ep],r23
- sld.w 28[ep],r22
- sld.w 32[ep],r21
- sld.w 36[ep],r20
- sld.w 40[ep],r31
- addi 44,sp,sp
- mov r1,ep
-#else
- ld.w 0[sp],r29
- ld.w 4[sp],r28
- ld.w 8[sp],r27
- ld.w 12[sp],r26
- ld.w 16[sp],r25
- ld.w 20[sp],r24
- ld.w 24[sp],r23
- ld.w 28[sp],r22
- ld.w 32[sp],r21
- ld.w 36[sp],r20
- ld.w 40[sp],r31
- addi 44,sp,sp
-#endif
- jmp [r31]
- .size __return_r20_r31,.-__return_r20_r31
-#endif /* L_save_20c */
-
-#ifdef L_save_21c
- .text
- .align 2
- .globl __save_r21_r31
- .type __save_r21_r31,@function
- /* Allocate space and save registers 21 .. 29, 31 on the stack. */
- /* Also allocate space for the argument save area. */
- /* Called via: jalr __save_r21_r31,r10. */
-__save_r21_r31:
-#ifdef __EP__
- mov ep,r1
- addi -40,sp,sp
- mov sp,ep
- sst.w r29,0[ep]
- sst.w r28,4[ep]
- sst.w r27,8[ep]
- sst.w r26,12[ep]
- sst.w r25,16[ep]
- sst.w r24,20[ep]
- sst.w r23,24[ep]
- sst.w r22,28[ep]
- sst.w r21,32[ep]
- sst.w r31,36[ep]
- mov r1,ep
- jmp [r10]
-#else
- addi -40,sp,sp
- st.w r29,0[sp]
- st.w r28,4[sp]
- st.w r27,8[sp]
- st.w r26,12[sp]
- st.w r25,16[sp]
- st.w r24,20[sp]
- st.w r23,24[sp]
- st.w r22,28[sp]
- st.w r21,32[sp]
- st.w r31,36[sp]
- jmp [r10]
-#endif
- .size __save_r21_r31,.-__save_r21_r31
-
- /* Restore saved registers, deallocate stack and return to the user. */
- /* Called via: jr __return_r21_r31. */
- .align 2
- .globl __return_r21_r31
- .type __return_r21_r31,@function
-__return_r21_r31:
-#ifdef __EP__
- mov ep,r1
- mov sp,ep
- sld.w 0[ep],r29
- sld.w 4[ep],r28
- sld.w 8[ep],r27
- sld.w 12[ep],r26
- sld.w 16[ep],r25
- sld.w 20[ep],r24
- sld.w 24[ep],r23
- sld.w 28[ep],r22
- sld.w 32[ep],r21
- sld.w 36[ep],r31
- addi 40,sp,sp
- mov r1,ep
-#else
- ld.w 0[sp],r29
- ld.w 4[sp],r28
- ld.w 8[sp],r27
- ld.w 12[sp],r26
- ld.w 16[sp],r25
- ld.w 20[sp],r24
- ld.w 24[sp],r23
- ld.w 28[sp],r22
- ld.w 32[sp],r21
- ld.w 36[sp],r31
- addi 40,sp,sp
-#endif
- jmp [r31]
- .size __return_r21_r31,.-__return_r21_r31
-#endif /* L_save_21c */
-
-#ifdef L_save_22c
- .text
- .align 2
- .globl __save_r22_r31
- .type __save_r22_r31,@function
- /* Allocate space and save registers 22 .. 29, 31 on the stack. */
- /* Also allocate space for the argument save area. */
- /* Called via: jalr __save_r22_r31,r10. */
-__save_r22_r31:
-#ifdef __EP__
- mov ep,r1
- addi -36,sp,sp
- mov sp,ep
- sst.w r29,0[ep]
- sst.w r28,4[ep]
- sst.w r27,8[ep]
- sst.w r26,12[ep]
- sst.w r25,16[ep]
- sst.w r24,20[ep]
- sst.w r23,24[ep]
- sst.w r22,28[ep]
- sst.w r31,32[ep]
- mov r1,ep
-#else
- addi -36,sp,sp
- st.w r29,0[sp]
- st.w r28,4[sp]
- st.w r27,8[sp]
- st.w r26,12[sp]
- st.w r25,16[sp]
- st.w r24,20[sp]
- st.w r23,24[sp]
- st.w r22,28[sp]
- st.w r31,32[sp]
-#endif
- jmp [r10]
- .size __save_r22_r31,.-__save_r22_r31
-
- /* Restore saved registers, deallocate stack and return to the user. */
- /* Called via: jr __return_r22_r31. */
- .align 2
- .globl __return_r22_r31
- .type __return_r22_r31,@function
-__return_r22_r31:
-#ifdef __EP__
- mov ep,r1
- mov sp,ep
- sld.w 0[ep],r29
- sld.w 4[ep],r28
- sld.w 8[ep],r27
- sld.w 12[ep],r26
- sld.w 16[ep],r25
- sld.w 20[ep],r24
- sld.w 24[ep],r23
- sld.w 28[ep],r22
- sld.w 32[ep],r31
- addi 36,sp,sp
- mov r1,ep
-#else
- ld.w 0[sp],r29
- ld.w 4[sp],r28
- ld.w 8[sp],r27
- ld.w 12[sp],r26
- ld.w 16[sp],r25
- ld.w 20[sp],r24
- ld.w 24[sp],r23
- ld.w 28[sp],r22
- ld.w 32[sp],r31
- addi 36,sp,sp
-#endif
- jmp [r31]
- .size __return_r22_r31,.-__return_r22_r31
-#endif /* L_save_22c */
-
-#ifdef L_save_23c
- .text
- .align 2
- .globl __save_r23_r31
- .type __save_r23_r31,@function
- /* Allocate space and save registers 23 .. 29, 31 on the stack. */
- /* Also allocate space for the argument save area. */
- /* Called via: jalr __save_r23_r31,r10. */
-__save_r23_r31:
-#ifdef __EP__
- mov ep,r1
- addi -32,sp,sp
- mov sp,ep
- sst.w r29,0[ep]
- sst.w r28,4[ep]
- sst.w r27,8[ep]
- sst.w r26,12[ep]
- sst.w r25,16[ep]
- sst.w r24,20[ep]
- sst.w r23,24[ep]
- sst.w r31,28[ep]
- mov r1,ep
-#else
- addi -32,sp,sp
- st.w r29,0[sp]
- st.w r28,4[sp]
- st.w r27,8[sp]
- st.w r26,12[sp]
- st.w r25,16[sp]
- st.w r24,20[sp]
- st.w r23,24[sp]
- st.w r31,28[sp]
-#endif
- jmp [r10]
- .size __save_r23_r31,.-__save_r23_r31
-
- /* Restore saved registers, deallocate stack and return to the user. */
- /* Called via: jr __return_r23_r31. */
- .align 2
- .globl __return_r23_r31
- .type __return_r23_r31,@function
-__return_r23_r31:
-#ifdef __EP__
- mov ep,r1
- mov sp,ep
- sld.w 0[ep],r29
- sld.w 4[ep],r28
- sld.w 8[ep],r27
- sld.w 12[ep],r26
- sld.w 16[ep],r25
- sld.w 20[ep],r24
- sld.w 24[ep],r23
- sld.w 28[ep],r31
- addi 32,sp,sp
- mov r1,ep
-#else
- ld.w 0[sp],r29
- ld.w 4[sp],r28
- ld.w 8[sp],r27
- ld.w 12[sp],r26
- ld.w 16[sp],r25
- ld.w 20[sp],r24
- ld.w 24[sp],r23
- ld.w 28[sp],r31
- addi 32,sp,sp
-#endif
- jmp [r31]
- .size __return_r23_r31,.-__return_r23_r31
-#endif /* L_save_23c */
-
-#ifdef L_save_24c
- .text
- .align 2
- .globl __save_r24_r31
- .type __save_r24_r31,@function
- /* Allocate space and save registers 24 .. 29, 31 on the stack. */
- /* Also allocate space for the argument save area. */
- /* Called via: jalr __save_r24_r31,r10. */
-__save_r24_r31:
-#ifdef __EP__
- mov ep,r1
- addi -28,sp,sp
- mov sp,ep
- sst.w r29,0[ep]
- sst.w r28,4[ep]
- sst.w r27,8[ep]
- sst.w r26,12[ep]
- sst.w r25,16[ep]
- sst.w r24,20[ep]
- sst.w r31,24[ep]
- mov r1,ep
-#else
- addi -28,sp,sp
- st.w r29,0[sp]
- st.w r28,4[sp]
- st.w r27,8[sp]
- st.w r26,12[sp]
- st.w r25,16[sp]
- st.w r24,20[sp]
- st.w r31,24[sp]
-#endif
- jmp [r10]
- .size __save_r24_r31,.-__save_r24_r31
-
- /* Restore saved registers, deallocate stack and return to the user. */
- /* Called via: jr __return_r24_r31. */
- .align 2
- .globl __return_r24_r31
- .type __return_r24_r31,@function
-__return_r24_r31:
-#ifdef __EP__
- mov ep,r1
- mov sp,ep
- sld.w 0[ep],r29
- sld.w 4[ep],r28
- sld.w 8[ep],r27
- sld.w 12[ep],r26
- sld.w 16[ep],r25
- sld.w 20[ep],r24
- sld.w 24[ep],r31
- addi 28,sp,sp
- mov r1,ep
-#else
- ld.w 0[sp],r29
- ld.w 4[sp],r28
- ld.w 8[sp],r27
- ld.w 12[sp],r26
- ld.w 16[sp],r25
- ld.w 20[sp],r24
- ld.w 24[sp],r31
- addi 28,sp,sp
-#endif
- jmp [r31]
- .size __return_r24_r31,.-__return_r24_r31
-#endif /* L_save_24c */
-
-#ifdef L_save_25c
- .text
- .align 2
- .globl __save_r25_r31
- .type __save_r25_r31,@function
- /* Allocate space and save registers 25 .. 29, 31 on the stack. */
- /* Also allocate space for the argument save area. */
- /* Called via: jalr __save_r25_r31,r10. */
-__save_r25_r31:
-#ifdef __EP__
- mov ep,r1
- addi -24,sp,sp
- mov sp,ep
- sst.w r29,0[ep]
- sst.w r28,4[ep]
- sst.w r27,8[ep]
- sst.w r26,12[ep]
- sst.w r25,16[ep]
- sst.w r31,20[ep]
- mov r1,ep
-#else
- addi -24,sp,sp
- st.w r29,0[sp]
- st.w r28,4[sp]
- st.w r27,8[sp]
- st.w r26,12[sp]
- st.w r25,16[sp]
- st.w r31,20[sp]
-#endif
- jmp [r10]
- .size __save_r25_r31,.-__save_r25_r31
-
- /* Restore saved registers, deallocate stack and return to the user. */
- /* Called via: jr __return_r25_r31. */
- .align 2
- .globl __return_r25_r31
- .type __return_r25_r31,@function
-__return_r25_r31:
-#ifdef __EP__
- mov ep,r1
- mov sp,ep
- sld.w 0[ep],r29
- sld.w 4[ep],r28
- sld.w 8[ep],r27
- sld.w 12[ep],r26
- sld.w 16[ep],r25
- sld.w 20[ep],r31
- addi 24,sp,sp
- mov r1,ep
-#else
- ld.w 0[sp],r29
- ld.w 4[sp],r28
- ld.w 8[sp],r27
- ld.w 12[sp],r26
- ld.w 16[sp],r25
- ld.w 20[sp],r31
- addi 24,sp,sp
-#endif
- jmp [r31]
- .size __return_r25_r31,.-__return_r25_r31
-#endif /* L_save_25c */
-
-#ifdef L_save_26c
- .text
- .align 2
- .globl __save_r26_r31
- .type __save_r26_r31,@function
- /* Allocate space and save registers 26 .. 29, 31 on the stack. */
- /* Also allocate space for the argument save area. */
- /* Called via: jalr __save_r26_r31,r10. */
-__save_r26_r31:
-#ifdef __EP__
- mov ep,r1
- addi -20,sp,sp
- mov sp,ep
- sst.w r29,0[ep]
- sst.w r28,4[ep]
- sst.w r27,8[ep]
- sst.w r26,12[ep]
- sst.w r31,16[ep]
- mov r1,ep
-#else
- addi -20,sp,sp
- st.w r29,0[sp]
- st.w r28,4[sp]
- st.w r27,8[sp]
- st.w r26,12[sp]
- st.w r31,16[sp]
-#endif
- jmp [r10]
- .size __save_r26_r31,.-__save_r26_r31
-
- /* Restore saved registers, deallocate stack and return to the user. */
- /* Called via: jr __return_r26_r31. */
- .align 2
- .globl __return_r26_r31
- .type __return_r26_r31,@function
-__return_r26_r31:
-#ifdef __EP__
- mov ep,r1
- mov sp,ep
- sld.w 0[ep],r29
- sld.w 4[ep],r28
- sld.w 8[ep],r27
- sld.w 12[ep],r26
- sld.w 16[ep],r31
- addi 20,sp,sp
- mov r1,ep
-#else
- ld.w 0[sp],r29
- ld.w 4[sp],r28
- ld.w 8[sp],r27
- ld.w 12[sp],r26
- ld.w 16[sp],r31
- addi 20,sp,sp
-#endif
- jmp [r31]
- .size __return_r26_r31,.-__return_r26_r31
-#endif /* L_save_26c */
-
-#ifdef L_save_27c
- .text
- .align 2
- .globl __save_r27_r31
- .type __save_r27_r31,@function
- /* Allocate space and save registers 27 .. 29, 31 on the stack. */
- /* Also allocate space for the argument save area. */
- /* Called via: jalr __save_r27_r31,r10. */
-__save_r27_r31:
-#ifdef __EP__
- mov ep,r1
- addi -16,sp,sp
- mov sp,ep
- sst.w r29,0[ep]
- sst.w r28,4[ep]
- sst.w r27,8[ep]
- sst.w r31,12[ep]
- mov r1,ep
-#else
- addi -16,sp,sp
- st.w r29,0[sp]
- st.w r28,4[sp]
- st.w r27,8[sp]
- st.w r31,12[sp]
-#endif
- jmp [r10]
- .size __save_r27_r31,.-__save_r27_r31
-
- /* Restore saved registers, deallocate stack and return to the user. */
- /* Called via: jr __return_r27_r31. */
- .align 2
- .globl __return_r27_r31
- .type __return_r27_r31,@function
-__return_r27_r31:
-#ifdef __EP__
- mov ep,r1
- mov sp,ep
- sld.w 0[ep],r29
- sld.w 4[ep],r28
- sld.w 8[ep],r27
- sld.w 12[ep],r31
- addi 16,sp,sp
- mov r1,ep
-#else
- ld.w 0[sp],r29
- ld.w 4[sp],r28
- ld.w 8[sp],r27
- ld.w 12[sp],r31
- addi 16,sp,sp
-#endif
- jmp [r31]
- .size __return_r27_r31,.-__return_r27_r31
-#endif /* L_save_27c */
-
-#ifdef L_save_28c
- .text
- .align 2
- .globl __save_r28_r31
- .type __save_r28_r31,@function
- /* Allocate space and save registers 28 .. 29, 31 on the stack. */
- /* Also allocate space for the argument save area. */
- /* Called via: jalr __save_r28_r31,r10. */
-__save_r28_r31:
- addi -12,sp,sp
- st.w r29,0[sp]
- st.w r28,4[sp]
- st.w r31,8[sp]
- jmp [r10]
- .size __save_r28_r31,.-__save_r28_r31
-
- /* Restore saved registers, deallocate stack and return to the user. */
- /* Called via: jr __return_r28_r31. */
- .align 2
- .globl __return_r28_r31
- .type __return_r28_r31,@function
-__return_r28_r31:
- ld.w 0[sp],r29
- ld.w 4[sp],r28
- ld.w 8[sp],r31
- addi 12,sp,sp
- jmp [r31]
- .size __return_r28_r31,.-__return_r28_r31
-#endif /* L_save_28c */
-
-#ifdef L_save_29c
- .text
- .align 2
- .globl __save_r29_r31
- .type __save_r29_r31,@function
- /* Allocate space and save registers 29 & 31 on the stack. */
- /* Also allocate space for the argument save area. */
- /* Called via: jalr __save_r29_r31,r10. */
-__save_r29_r31:
- addi -8,sp,sp
- st.w r29,0[sp]
- st.w r31,4[sp]
- jmp [r10]
- .size __save_r29_r31,.-__save_r29_r31
-
- /* Restore saved registers, deallocate stack and return to the user. */
- /* Called via: jr __return_r29_r31. */
- .align 2
- .globl __return_r29_r31
- .type __return_r29_r31,@function
-__return_r29_r31:
- ld.w 0[sp],r29
- ld.w 4[sp],r31
- addi 8,sp,sp
- jmp [r31]
- .size __return_r29_r31,.-__return_r29_r31
-#endif /* L_save_29c */
-
-#ifdef L_save_31c
- .text
- .align 2
- .globl __save_r31
- .type __save_r31,@function
- /* Allocate space and save register 31 on the stack. */
- /* Also allocate space for the argument save area. */
- /* Called via: jalr __save_r31,r10. */
-__save_r31:
- addi -4,sp,sp
- st.w r31,0[sp]
- jmp [r10]
- .size __save_r31,.-__save_r31
-
- /* Restore saved registers, deallocate stack and return to the user. */
- /* Called via: jr __return_r31. */
- .align 2
- .globl __return_r31
- .type __return_r31,@function
-__return_r31:
- ld.w 0[sp],r31
- addi 4,sp,sp
- jmp [r31]
- .size __return_r31,.-__return_r31
-#endif /* L_save_31c */
-
-#ifdef L_save_interrupt
- .text
- .align 2
- .globl __save_interrupt
- .type __save_interrupt,@function
- /* Save registers r1, r4 on stack and load up with expected values. */
- /* Note, 20 bytes of stack have already been allocated. */
- /* Called via: jalr __save_interrupt,r10. */
-__save_interrupt:
- /* add -20,sp ; st.w r11,16[sp] ; st.w r10,12[sp] ; */
- st.w ep,0[sp]
- st.w gp,4[sp]
- st.w r1,8[sp]
- movhi hi(__ep),r0,ep
- movea lo(__ep),ep,ep
- movhi hi(__gp),r0,gp
- movea lo(__gp),gp,gp
- jmp [r10]
- .size __save_interrupt,.-__save_interrupt
-
- /* Restore saved registers, deallocate stack and return from the interrupt. */
- /* Called via: jr __return_interrupt. */
- .align 2
- .globl __return_interrupt
- .type __return_interrupt,@function
-__return_interrupt:
- ld.w 0[sp],ep
- ld.w 4[sp],gp
- ld.w 8[sp],r1
- ld.w 12[sp],r10
- ld.w 16[sp],r11
- addi 20,sp,sp
- reti
- .size __return_interrupt,.-__return_interrupt
-#endif /* L_save_interrupt */
-
-#ifdef L_save_all_interrupt
- .text
- .align 2
- .globl __save_all_interrupt
- .type __save_all_interrupt,@function
- /* Save all registers except for those saved in __save_interrupt. */
- /* Allocate enough stack for all of the registers & 16 bytes of space. */
- /* Called via: jalr __save_all_interrupt,r10. */
-__save_all_interrupt:
- addi -104,sp,sp
-#ifdef __EP__
- mov ep,r1
- mov sp,ep
- sst.w r31,100[ep]
- sst.w r2,96[ep]
- sst.w gp,92[ep]
- sst.w r6,88[ep]
- sst.w r7,84[ep]
- sst.w r8,80[ep]
- sst.w r9,76[ep]
- sst.w r11,72[ep]
- sst.w r12,68[ep]
- sst.w r13,64[ep]
- sst.w r14,60[ep]
- sst.w r15,56[ep]
- sst.w r16,52[ep]
- sst.w r17,48[ep]
- sst.w r18,44[ep]
- sst.w r19,40[ep]
- sst.w r20,36[ep]
- sst.w r21,32[ep]
- sst.w r22,28[ep]
- sst.w r23,24[ep]
- sst.w r24,20[ep]
- sst.w r25,16[ep]
- sst.w r26,12[ep]
- sst.w r27,8[ep]
- sst.w r28,4[ep]
- sst.w r29,0[ep]
- mov r1,ep
-#else
- st.w r31,100[sp]
- st.w r2,96[sp]
- st.w gp,92[sp]
- st.w r6,88[sp]
- st.w r7,84[sp]
- st.w r8,80[sp]
- st.w r9,76[sp]
- st.w r11,72[sp]
- st.w r12,68[sp]
- st.w r13,64[sp]
- st.w r14,60[sp]
- st.w r15,56[sp]
- st.w r16,52[sp]
- st.w r17,48[sp]
- st.w r18,44[sp]
- st.w r19,40[sp]
- st.w r20,36[sp]
- st.w r21,32[sp]
- st.w r22,28[sp]
- st.w r23,24[sp]
- st.w r24,20[sp]
- st.w r25,16[sp]
- st.w r26,12[sp]
- st.w r27,8[sp]
- st.w r28,4[sp]
- st.w r29,0[sp]
-#endif
- jmp [r10]
- .size __save_all_interrupt,.-__save_all_interrupt
-
- .globl __restore_all_interrupt
- .type __restore_all_interrupt,@function
- /* Restore all registers saved in __save_all_interrupt and
- deallocate the stack space. */
- /* Called via: jalr __restore_all_interrupt,r10. */
-__restore_all_interrupt:
-#ifdef __EP__
- mov ep,r1
- mov sp,ep
- sld.w 100[ep],r31
- sld.w 96[ep],r2
- sld.w 92[ep],gp
- sld.w 88[ep],r6
- sld.w 84[ep],r7
- sld.w 80[ep],r8
- sld.w 76[ep],r9
- sld.w 72[ep],r11
- sld.w 68[ep],r12
- sld.w 64[ep],r13
- sld.w 60[ep],r14
- sld.w 56[ep],r15
- sld.w 52[ep],r16
- sld.w 48[ep],r17
- sld.w 44[ep],r18
- sld.w 40[ep],r19
- sld.w 36[ep],r20
- sld.w 32[ep],r21
- sld.w 28[ep],r22
- sld.w 24[ep],r23
- sld.w 20[ep],r24
- sld.w 16[ep],r25
- sld.w 12[ep],r26
- sld.w 8[ep],r27
- sld.w 4[ep],r28
- sld.w 0[ep],r29
- mov r1,ep
-#else
- ld.w 100[sp],r31
- ld.w 96[sp],r2
- ld.w 92[sp],gp
- ld.w 88[sp],r6
- ld.w 84[sp],r7
- ld.w 80[sp],r8
- ld.w 76[sp],r9
- ld.w 72[sp],r11
- ld.w 68[sp],r12
- ld.w 64[sp],r13
- ld.w 60[sp],r14
- ld.w 56[sp],r15
- ld.w 52[sp],r16
- ld.w 48[sp],r17
- ld.w 44[sp],r18
- ld.w 40[sp],r19
- ld.w 36[sp],r20
- ld.w 32[sp],r21
- ld.w 28[sp],r22
- ld.w 24[sp],r23
- ld.w 20[sp],r24
- ld.w 16[sp],r25
- ld.w 12[sp],r26
- ld.w 8[sp],r27
- ld.w 4[sp],r28
- ld.w 0[sp],r29
-#endif
- addi 104,sp,sp
- jmp [r10]
- .size __restore_all_interrupt,.-__restore_all_interrupt
-#endif /* L_save_all_interrupt */
-
-#if defined(__v850e__) || defined(__v850e1__) || defined(__v850e2__) || defined(__v850e2v3__)
-#ifdef L_callt_save_r2_r29
- /* Put these functions into the call table area. */
- .call_table_text
-
- /* Allocate space and save registers 2, 20 .. 29 on the stack. */
- /* Called via: callt ctoff(__callt_save_r2_r29). */
- .align 2
-.L_save_r2_r29:
- add -4, sp
- st.w r2, 0[sp]
- prepare {r20 - r29}, 0
- ctret
-
- /* Restore saved registers, deallocate stack and return to the user. */
- /* Called via: callt ctoff(__callt_return_r2_r29). */
- .align 2
-.L_return_r2_r29:
- dispose 0, {r20-r29}
- ld.w 0[sp], r2
- add 4, sp
- jmp [r31]
-
- /* Place the offsets of the start of these routines into the call table. */
- .call_table_data
-
- .global __callt_save_r2_r29
- .type __callt_save_r2_r29,@function
-__callt_save_r2_r29: .short ctoff(.L_save_r2_r29)
-
- .global __callt_return_r2_r29
- .type __callt_return_r2_r29,@function
-__callt_return_r2_r29: .short ctoff(.L_return_r2_r29)
-
-#endif /* L_callt_save_r2_r29. */
-
-#ifdef L_callt_save_r2_r31
- /* Put these functions into the call table area. */
- .call_table_text
-
- /* Allocate space and save registers 2 and 20 .. 29, 31 on the stack. */
- /* Also allocate space for the argument save area. */
- /* Called via: callt ctoff(__callt_save_r2_r31). */
- .align 2
-.L_save_r2_r31:
- add -4, sp
- st.w r2, 0[sp]
- prepare {r20 - r29, r31}, 0
- ctret
-
- /* Restore saved registers, deallocate stack and return to the user. */
- /* Called via: callt ctoff(__callt_return_r2_r31). */
- .align 2
-.L_return_r2_r31:
- dispose 0, {r20 - r29, r31}
- ld.w 0[sp], r2
- addi 4, sp, sp
- jmp [r31]
-
- /* Place the offsets of the start of these routines into the call table. */
- .call_table_data
-
- .global __callt_save_r2_r31
- .type __callt_save_r2_r31,@function
-__callt_save_r2_r31: .short ctoff(.L_save_r2_r31)
-
- .global __callt_return_r2_r31
- .type __callt_return_r2_r31,@function
-__callt_return_r2_r31: .short ctoff(.L_return_r2_r31)
-
-#endif /* L_callt_save_r2_r31 */
-
-#ifdef L_callt_save_interrupt
- /* Put these functions into the call table area. */
- .call_table_text
-
- /* Save registers r1, ep, gp, r10 on stack and load up with expected values. */
- /* Called via: callt ctoff(__callt_save_interrupt). */
- .align 2
-.L_save_interrupt:
- /* SP has already been moved before callt ctoff(_save_interrupt). */
- /* R1,R10,R11,ctpc,ctpsw has alread been saved bofore callt ctoff(_save_interrupt). */
- /* addi -28, sp, sp */
- /* st.w r1, 24[sp] */
- /* st.w r10, 12[sp] */
- /* st.w r11, 16[sp] */
- /* stsr ctpc, r10 */
- /* st.w r10, 20[sp] */
- /* stsr ctpsw, r10 */
- /* st.w r10, 24[sp] */
- st.w ep, 0[sp]
- st.w gp, 4[sp]
- st.w r1, 8[sp]
- mov hilo(__ep),ep
- mov hilo(__gp),gp
- ctret
-
- .call_table_text
- /* Restore saved registers, deallocate stack and return from the interrupt. */
- /* Called via: callt ctoff(__callt_restore_interrupt). */
- .align 2
- .globl __return_interrupt
- .type __return_interrupt,@function
-.L_return_interrupt:
- ld.w 24[sp], r1
- ldsr r1, ctpsw
- ld.w 20[sp], r1
- ldsr r1, ctpc
- ld.w 16[sp], r11
- ld.w 12[sp], r10
- ld.w 8[sp], r1
- ld.w 4[sp], gp
- ld.w 0[sp], ep
- addi 28, sp, sp
- reti
-
- /* Place the offsets of the start of these routines into the call table. */
- .call_table_data
-
- .global __callt_save_interrupt
- .type __callt_save_interrupt,@function
-__callt_save_interrupt: .short ctoff(.L_save_interrupt)
-
- .global __callt_return_interrupt
- .type __callt_return_interrupt,@function
-__callt_return_interrupt: .short ctoff(.L_return_interrupt)
-
-#endif /* L_callt_save_interrupt */
-
-#ifdef L_callt_save_all_interrupt
- /* Put these functions into the call table area. */
- .call_table_text
-
- /* Save all registers except for those saved in __save_interrupt. */
- /* Allocate enough stack for all of the registers & 16 bytes of space. */
- /* Called via: callt ctoff(__callt_save_all_interrupt). */
- .align 2
-.L_save_all_interrupt:
- addi -60, sp, sp
-#ifdef __EP__
- mov ep, r1
- mov sp, ep
- sst.w r2, 56[ep]
- sst.w r5, 52[ep]
- sst.w r6, 48[ep]
- sst.w r7, 44[ep]
- sst.w r8, 40[ep]
- sst.w r9, 36[ep]
- sst.w r11, 32[ep]
- sst.w r12, 28[ep]
- sst.w r13, 24[ep]
- sst.w r14, 20[ep]
- sst.w r15, 16[ep]
- sst.w r16, 12[ep]
- sst.w r17, 8[ep]
- sst.w r18, 4[ep]
- sst.w r19, 0[ep]
- mov r1, ep
-#else
- st.w r2, 56[sp]
- st.w r5, 52[sp]
- st.w r6, 48[sp]
- st.w r7, 44[sp]
- st.w r8, 40[sp]
- st.w r9, 36[sp]
- st.w r11, 32[sp]
- st.w r12, 28[sp]
- st.w r13, 24[sp]
- st.w r14, 20[sp]
- st.w r15, 16[sp]
- st.w r16, 12[sp]
- st.w r17, 8[sp]
- st.w r18, 4[sp]
- st.w r19, 0[sp]
-#endif
- prepare {r20 - r29, r31}, 0
- ctret
-
- /* Restore all registers saved in __save_all_interrupt
- deallocate the stack space. */
- /* Called via: callt ctoff(__callt_restore_all_interrupt). */
- .align 2
-.L_restore_all_interrupt:
- dispose 0, {r20 - r29, r31}
-#ifdef __EP__
- mov ep, r1
- mov sp, ep
- sld.w 0 [ep], r19
- sld.w 4 [ep], r18
- sld.w 8 [ep], r17
- sld.w 12[ep], r16
- sld.w 16[ep], r15
- sld.w 20[ep], r14
- sld.w 24[ep], r13
- sld.w 28[ep], r12
- sld.w 32[ep], r11
- sld.w 36[ep], r9
- sld.w 40[ep], r8
- sld.w 44[ep], r7
- sld.w 48[ep], r6
- sld.w 52[ep], r5
- sld.w 56[ep], r2
- mov r1, ep
-#else
- ld.w 0 [sp], r19
- ld.w 4 [sp], r18
- ld.w 8 [sp], r17
- ld.w 12[sp], r16
- ld.w 16[sp], r15
- ld.w 20[sp], r14
- ld.w 24[sp], r13
- ld.w 28[sp], r12
- ld.w 32[sp], r11
- ld.w 36[sp], r9
- ld.w 40[sp], r8
- ld.w 44[sp], r7
- ld.w 48[sp], r6
- ld.w 52[sp], r5
- ld.w 56[sp], r2
-#endif
- addi 60, sp, sp
- ctret
-
- /* Place the offsets of the start of these routines into the call table. */
- .call_table_data
-
- .global __callt_save_all_interrupt
- .type __callt_save_all_interrupt,@function
-__callt_save_all_interrupt: .short ctoff(.L_save_all_interrupt)
-
- .global __callt_restore_all_interrupt
- .type __callt_restore_all_interrupt,@function
-__callt_restore_all_interrupt: .short ctoff(.L_restore_all_interrupt)
-
-#endif /* L_callt_save_all_interrupt */
-
-
-#define MAKE_CALLT_FUNCS( START ) \
- .call_table_text ;\
- .align 2 ;\
- /* Allocate space and save registers START .. r29 on the stack. */ ;\
- /* Called via: callt ctoff(__callt_save_START_r29). */ ;\
-.L_save_##START##_r29: ;\
- prepare { START - r29 }, 0 ;\
- ctret ;\
- ;\
- /* Restore saved registers, deallocate stack and return. */ ;\
- /* Called via: callt ctoff(__return_START_r29). */ ;\
- .align 2 ;\
-.L_return_##START##_r29: ;\
- dispose 0, { START - r29 }, r31 ;\
- ;\
- /* Place the offsets of the start of these funcs into the call table. */;\
- .call_table_data ;\
- ;\
- .global __callt_save_##START##_r29 ;\
- .type __callt_save_##START##_r29,@function ;\
-__callt_save_##START##_r29: .short ctoff(.L_save_##START##_r29 ) ;\
- ;\
- .global __callt_return_##START##_r29 ;\
- .type __callt_return_##START##_r29,@function ;\
-__callt_return_##START##_r29: .short ctoff(.L_return_##START##_r29 )
-
-
-#define MAKE_CALLT_CFUNCS( START ) \
- .call_table_text ;\
- .align 2 ;\
- /* Allocate space and save registers START .. r31 on the stack. */ ;\
- /* Called via: callt ctoff(__callt_save_START_r31c). */ ;\
-.L_save_##START##_r31c: ;\
- prepare { START - r29, r31}, 0 ;\
- ctret ;\
- ;\
- /* Restore saved registers, deallocate stack and return. */ ;\
- /* Called via: callt ctoff(__return_START_r31c). */ ;\
- .align 2 ;\
-.L_return_##START##_r31c: ;\
- dispose 0, { START - r29, r31}, r31 ;\
- ;\
- /* Place the offsets of the start of these funcs into the call table. */;\
- .call_table_data ;\
- ;\
- .global __callt_save_##START##_r31c ;\
- .type __callt_save_##START##_r31c,@function ;\
-__callt_save_##START##_r31c: .short ctoff(.L_save_##START##_r31c ) ;\
- ;\
- .global __callt_return_##START##_r31c ;\
- .type __callt_return_##START##_r31c,@function ;\
-__callt_return_##START##_r31c: .short ctoff(.L_return_##START##_r31c )
-
-
-#ifdef L_callt_save_20
- MAKE_CALLT_FUNCS (r20)
-#endif
-#ifdef L_callt_save_21
- MAKE_CALLT_FUNCS (r21)
-#endif
-#ifdef L_callt_save_22
- MAKE_CALLT_FUNCS (r22)
-#endif
-#ifdef L_callt_save_23
- MAKE_CALLT_FUNCS (r23)
-#endif
-#ifdef L_callt_save_24
- MAKE_CALLT_FUNCS (r24)
-#endif
-#ifdef L_callt_save_25
- MAKE_CALLT_FUNCS (r25)
-#endif
-#ifdef L_callt_save_26
- MAKE_CALLT_FUNCS (r26)
-#endif
-#ifdef L_callt_save_27
- MAKE_CALLT_FUNCS (r27)
-#endif
-#ifdef L_callt_save_28
- MAKE_CALLT_FUNCS (r28)
-#endif
-#ifdef L_callt_save_29
- MAKE_CALLT_FUNCS (r29)
-#endif
-
-#ifdef L_callt_save_20c
- MAKE_CALLT_CFUNCS (r20)
-#endif
-#ifdef L_callt_save_21c
- MAKE_CALLT_CFUNCS (r21)
-#endif
-#ifdef L_callt_save_22c
- MAKE_CALLT_CFUNCS (r22)
-#endif
-#ifdef L_callt_save_23c
- MAKE_CALLT_CFUNCS (r23)
-#endif
-#ifdef L_callt_save_24c
- MAKE_CALLT_CFUNCS (r24)
-#endif
-#ifdef L_callt_save_25c
- MAKE_CALLT_CFUNCS (r25)
-#endif
-#ifdef L_callt_save_26c
- MAKE_CALLT_CFUNCS (r26)
-#endif
-#ifdef L_callt_save_27c
- MAKE_CALLT_CFUNCS (r27)
-#endif
-#ifdef L_callt_save_28c
- MAKE_CALLT_CFUNCS (r28)
-#endif
-#ifdef L_callt_save_29c
- MAKE_CALLT_CFUNCS (r29)
-#endif
-
-
-#ifdef L_callt_save_31c
- .call_table_text
- .align 2
- /* Allocate space and save register r31 on the stack. */
- /* Called via: callt ctoff(__callt_save_r31c). */
-.L_callt_save_r31c:
- prepare {r31}, 0
- ctret
-
- /* Restore saved registers, deallocate stack and return. */
- /* Called via: callt ctoff(__return_r31c). */
- .align 2
-.L_callt_return_r31c:
- dispose 0, {r31}, r31
-
- /* Place the offsets of the start of these funcs into the call table. */
- .call_table_data
-
- .global __callt_save_r31c
- .type __callt_save_r31c,@function
-__callt_save_r31c: .short ctoff(.L_callt_save_r31c)
-
- .global __callt_return_r31c
- .type __callt_return_r31c,@function
-__callt_return_r31c: .short ctoff(.L_callt_return_r31c)
-#endif
-
-#endif /* __v850e__ */
-
-/* libgcc2 routines for NEC V850. */
-/* Double Integer Arithmetical Operation. */
-
-#ifdef L_negdi2
- .text
- .global ___negdi2
- .type ___negdi2, @function
-___negdi2:
- not r6, r10
- add 1, r10
- setf l, r6
- not r7, r11
- add r6, r11
- jmp [lp]
-
- .size ___negdi2,.-___negdi2
-#endif
-
-#ifdef L_cmpdi2
- .text
- .global ___cmpdi2
- .type ___cmpdi2,@function
-___cmpdi2:
- # Signed comparison bitween each high word.
- cmp r9, r7
- be .L_cmpdi_cmp_low
- setf ge, r10
- setf gt, r6
- add r6, r10
- jmp [lp]
-.L_cmpdi_cmp_low:
- # Unsigned comparigon bitween each low word.
- cmp r8, r6
- setf nl, r10
- setf h, r6
- add r6, r10
- jmp [lp]
- .size ___cmpdi2, . - ___cmpdi2
-#endif
-
-#ifdef L_ucmpdi2
- .text
- .global ___ucmpdi2
- .type ___ucmpdi2,@function
-___ucmpdi2:
- cmp r9, r7 # Check if each high word are same.
- bne .L_ucmpdi_check_psw
- cmp r8, r6 # Compare the word.
-.L_ucmpdi_check_psw:
- setf nl, r10 #
- setf h, r6 #
- add r6, r10 # Add the result of comparison NL and comparison H.
- jmp [lp]
- .size ___ucmpdi2, . - ___ucmpdi2
-#endif
-
-#ifdef L_muldi3
- .text
- .global ___muldi3
- .type ___muldi3,@function
-___muldi3:
-#ifdef __v850__
- jarl __save_r26_r31, r10
- addi 16, sp, sp
- mov r6, r28
- shr 15, r28
- movea lo(32767), r0, r14
- and r14, r28
- mov r8, r10
- shr 15, r10
- and r14, r10
- mov r6, r19
- shr 30, r19
- mov r7, r12
- shl 2, r12
- or r12, r19
- and r14, r19
- mov r8, r13
- shr 30, r13
- mov r9, r12
- shl 2, r12
- or r12, r13
- and r14, r13
- mov r7, r11
- shr 13, r11
- and r14, r11
- mov r9, r31
- shr 13, r31
- and r14, r31
- mov r7, r29
- shr 28, r29
- and r14, r29
- mov r9, r12
- shr 28, r12
- and r14, r12
- and r14, r6
- and r14, r8
- mov r6, r14
- mulh r8, r14
- mov r6, r16
- mulh r10, r16
- mov r6, r18
- mulh r13, r18
- mov r6, r15
- mulh r31, r15
- mulh r12, r6
- mov r28, r17
- mulh r10, r17
- add -16, sp
- mov r28, r12
- mulh r8, r12
- add r17, r18
- mov r28, r17
- mulh r31, r17
- add r12, r16
- mov r28, r12
- mulh r13, r12
- add r17, r6
- mov r19, r17
- add r12, r15
- mov r19, r12
- mulh r8, r12
- mulh r10, r17
- add r12, r18
- mov r19, r12
- mulh r13, r12
- add r17, r15
- mov r11, r13
- mulh r8, r13
- add r12, r6
- mov r11, r12
- mulh r10, r12
- add r13, r15
- mulh r29, r8
- add r12, r6
- mov r16, r13
- shl 15, r13
- add r14, r13
- mov r18, r12
- shl 30, r12
- mov r13, r26
- add r12, r26
- shr 15, r14
- movhi hi(131071), r0, r12
- movea lo(131071), r12, r13
- and r13, r14
- mov r16, r12
- and r13, r12
- add r12, r14
- mov r18, r12
- shl 15, r12
- and r13, r12
- add r12, r14
- shr 17, r14
- shr 17, r16
- add r14, r16
- shl 13, r15
- shr 2, r18
- add r18, r15
- add r15, r16
- mov r16, r27
- add r8, r6
- shl 28, r6
- add r6, r27
- mov r26, r10
- mov r27, r11
- jr __return_r26_r31
-#else /* defined(__v850e__) */
- /* (Ahi << 32 + Alo) * (Bhi << 32 + Blo) */
- /* r7 r6 r9 r8 */
- mov r8, r10
- mulu r7, r8, r0 /* Ahi * Blo */
- mulu r6, r9, r0 /* Alo * Bhi */
- mulu r6, r10, r11 /* Alo * Blo */
- add r8, r11
- add r9, r11
- jmp [r31]
-#endif /* defined(__v850e__) */
- .size ___muldi3, . - ___muldi3
-#endif
-
diff --git a/gcc/config/v850/t-v850 b/gcc/config/v850/t-v850
index fcd3b841e30..ca7f7ff73aa 100644
--- a/gcc/config/v850/t-v850
+++ b/gcc/config/v850/t-v850
@@ -17,71 +17,9 @@
# along with GCC; see the file COPYING3. If not see
# <http://www.gnu.org/licenses/>.
-LIB1ASMSRC = v850/lib1funcs.asm
-LIB1ASMFUNCS = _mulsi3 \
- _divsi3 \
- _udivsi3 \
- _modsi3 \
- _umodsi3 \
- _save_2 \
- _save_20 \
- _save_21 \
- _save_22 \
- _save_23 \
- _save_24 \
- _save_25 \
- _save_26 \
- _save_27 \
- _save_28 \
- _save_29 \
- _save_2c \
- _save_20c \
- _save_21c \
- _save_22c \
- _save_23c \
- _save_24c \
- _save_25c \
- _save_26c \
- _save_27c \
- _save_28c \
- _save_29c \
- _save_31c \
- _save_interrupt \
- _save_all_interrupt \
- _callt_save_20 \
- _callt_save_21 \
- _callt_save_22 \
- _callt_save_23 \
- _callt_save_24 \
- _callt_save_25 \
- _callt_save_26 \
- _callt_save_27 \
- _callt_save_28 \
- _callt_save_29 \
- _callt_save_20c \
- _callt_save_21c \
- _callt_save_22c \
- _callt_save_23c \
- _callt_save_24c \
- _callt_save_25c \
- _callt_save_26c \
- _callt_save_27c \
- _callt_save_28c \
- _callt_save_29c \
- _callt_save_31c \
- _callt_save_interrupt \
- _callt_save_all_interrupt \
- _callt_save_r2_r29 \
- _callt_save_r2_r31 \
- _negdi2 \
- _cmpdi2 \
- _ucmpdi2 \
- _muldi3
-
# Create target-specific versions of the libraries
MULTILIB_OPTIONS = mv850/mv850e/mv850e2/mv850e2v3
MULTILIB_DIRNAMES = v850 v850e v850e2 v850e2v3
-INSTALL_LIBGCC = install-multilib
MULTILIB_MATCHES = mv850e=mv850e1
TCFLAGS = -mno-app-regs -msmall-sld -Wa,-mwarn-signed-overflow -Wa,-mwarn-unsigned-overflow
diff --git a/gcc/config/vax/lib1funcs.asm b/gcc/config/vax/lib1funcs.asm
deleted file mode 100644
index 1d57b56dad9..00000000000
--- a/gcc/config/vax/lib1funcs.asm
+++ /dev/null
@@ -1,92 +0,0 @@
-/* Copyright (C) 2009 Free Software Foundation, Inc.
- This file is part of GCC.
- Contributed by Maciej W. Rozycki <macro@linux-mips.org>.
-
- This file is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the
- Free Software Foundation; either version 3, or (at your option) any
- later version.
-
- This file 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/>. */
-
-#ifdef L_udivsi3
- .text
- .globl __udivsi3
- .type __udivsi3, @function
-__udivsi3:
- .word 0
- movl 8(%ap), %r1
- blss 0f /* Check bit #31 of divisor. */
- movl 4(%ap), %r2
- blss 1f /* Check bit #31 of dividend. */
-
- /* Both zero, do a standard division. */
-
- divl3 %r1, %r2, %r0
- ret
-
- /* MSB of divisor set, only 1 or 0 may result. */
-0:
- decl %r1
- clrl %r0
- cmpl %r1, 4(%ap)
- adwc $0, %r0
- ret
-
- /* MSB of dividend set, do an extended division. */
-1:
- clrl %r3
- ediv %r1, %r2, %r0, %r3
- ret
- .size __udivsi3, . - __udivsi3
- .previous
-#endif
-
-#ifdef L_umodsi3
- .text
- .globl __umodsi3
- .type __umodsi3, @function
-__umodsi3:
- .word 0
- movl 8(%ap), %r1
- blss 0f /* Check bit #31 of divisor. */
- movl 4(%ap), %r2
- blss 1f /* Check bit #31 of dividend. */
-
- /* Both zero, do a standard division. */
-
- divl3 %r1, %r2, %r0
- mull2 %r0, %r1
- subl3 %r1, %r2, %r0
- ret
-
- /* MSB of divisor set, subtract the divisor at most once. */
-0:
- movl 4(%ap), %r2
- clrl %r0
- cmpl %r2, %r1
- sbwc $0, %r0
- bicl2 %r0, %r1
- subl3 %r1, %r2, %r0
- ret
-
- /* MSB of dividend set, do an extended division. */
-1:
- clrl %r3
- ediv %r1, %r2, %r3, %r0
- ret
- .size __umodsi3, . - __umodsi3
- .previous
-#endif
diff --git a/gcc/config/vax/t-linux b/gcc/config/vax/t-linux
deleted file mode 100644
index 9af1edb0fab..00000000000
--- a/gcc/config/vax/t-linux
+++ /dev/null
@@ -1,2 +0,0 @@
-LIB1ASMSRC = vax/lib1funcs.asm
-LIB1ASMFUNCS = _udivsi3 _umodsi3
diff --git a/gcc/config/vms/t-vms b/gcc/config/vms/t-vms
index 516435df1f9..61f9df55c31 100644
--- a/gcc/config/vms/t-vms
+++ b/gcc/config/vms/t-vms
@@ -1,4 +1,4 @@
-# Copyright (C) 2009, 2010
+# Copyright (C) 2009, 2010, 2011
# Free Software Foundation, Inc.
#
# This file is part of GCC.
@@ -24,17 +24,6 @@ LIMITS_H_TEST = false
# Under VMS, directory names cannot contain dots.
version:=$(shell echo $(BASEVER_c) | sed -e 's/\./_/g')
-VMS_EXTRA_PARTS=vcrt0.o pcrt0.o
-
-# Assemble startup files.
-$(T)vcrt0.o: $(srcdir)/config/vms/vms-ucrt0.c $(GCC_PASSES)
- $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(MULTILIB_CFLAGS) $(INCLUDES) \
- -c -o $(T)vcrt0.o $(srcdir)/config/vms/vms-ucrt0.c
-
-$(T)pcrt0.o: $(srcdir)/config/vms/vms-ucrt0.c $(GCC_PASSES)
- $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(MULTILIB_CFLAGS) $(INCLUDES) \
- -c -o $(T)pcrt0.o -DCRT0_POSIX_EXIT $(srcdir)/config/vms/vms-ucrt0.c
-
vms-crtlmap.h: $(srcdir)/config/vms/vms-crtlmap.map \
$(srcdir)/config/vms/make-crtlmap.awk
$(AWK) -f $(srcdir)/config/vms/make-crtlmap.awk \
@@ -43,3 +32,9 @@ vms-crtlmap.h: $(srcdir)/config/vms/vms-crtlmap.map \
vms.o: $(srcdir)/config/vms/vms.c $(TREE_H) $(CONFIG_H) $(SYSTEM_H) \
coretypes.h $(TM_P_H) vms-crtlmap.h
$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $<
+
+vms-c.o: $(srcdir)/config/vms/vms-c.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
+ $(TM_H) $(CPPLIB_H) $(TREE_H) c-family/c-pragma.h toplev.h $(GGC_H) \
+ $(TM_P_H)
+ $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
+ $(PREPROCESSOR_DEFINES) \$<
diff --git a/gcc/config/vms/vms-c.c b/gcc/config/vms/vms-c.c
new file mode 100644
index 00000000000..eb4c63577a9
--- /dev/null
+++ b/gcc/config/vms/vms-c.c
@@ -0,0 +1,248 @@
+/* VMS specific, C compiler specific functions.
+ Copyright (C) 2011
+ Free Software Foundation, Inc.
+ Contributed by Tristan Gingold (gingold@adacore.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 "tm.h"
+#include "cpplib.h"
+#include "tree.h"
+#include "c-family/c-pragma.h"
+#include "c-family/c-common.h"
+#include "toplev.h"
+#include "ggc.h"
+#include "tm_p.h"
+#include "incpath.h"
+#include "diagnostic.h"
+
+/* '#pragma __nostandard' is simply ignored. */
+
+static void
+vms_pragma_nostandard (cpp_reader *pfile ATTRIBUTE_UNUSED)
+{
+ tree x;
+
+ if (pragma_lex (&x) != CPP_EOF)
+ warning (OPT_Wpragmas, "junk at end of #pragma __nostandard");
+}
+
+/* '#pragma __standard' is simply ignored. */
+
+static void
+vms_pragma_standard (cpp_reader *pfile ATTRIBUTE_UNUSED)
+{
+ tree x;
+
+ if (pragma_lex (&x) != CPP_EOF)
+ warning (OPT_Wpragmas, "junk at end of #pragma __standard");
+}
+
+/* Saved member alignment. */
+static int saved_member_alignment;
+
+/* Handle '#pragma member_alignment'. */
+
+static void
+vms_pragma_member_alignment (cpp_reader *pfile ATTRIBUTE_UNUSED)
+{
+ tree x;
+ int tok;
+ const char *arg;
+
+ tok = pragma_lex (&x);
+
+ if (tok == CPP_EOF)
+ {
+ /* Disable packing. */
+ maximum_field_alignment = initial_max_fld_align;
+ return;
+ }
+ if (tok != CPP_NAME)
+ {
+ warning (OPT_Wpragmas, "malformed '#pragma member_alignment', ignoring");
+ return;
+ }
+
+ arg = IDENTIFIER_POINTER (x);
+ /* Accept '__' prefix. */
+ if (arg[0] == '_' && arg[1] == '_')
+ arg += 2;
+
+ if (strcmp (arg, "save") == 0)
+ saved_member_alignment = maximum_field_alignment;
+ else if (strcmp (arg, "restore") == 0)
+ maximum_field_alignment = saved_member_alignment;
+ else
+ {
+ error ("unknown '#pragma member_alignment' name %s", arg);
+ return;
+ }
+ if (pragma_lex (&x) != CPP_EOF)
+ {
+ error ("malformed '#pragma member_alignment'");
+ return;
+ }
+}
+
+/* Handle '#pragma nomember_alignment'. */
+
+static void
+vms_pragma_nomember_alignment (cpp_reader *pfile ATTRIBUTE_UNUSED)
+{
+ tree x;
+ int tok;
+
+ tok = pragma_lex (&x);
+ if (tok == CPP_NAME)
+ {
+ const char *arg = IDENTIFIER_POINTER (x);
+
+ /* Accept '__' prefix. */
+ if (arg[0] == '_' && arg[1] == '_')
+ arg += 2;
+
+ if (strcmp (arg, "word") == 0)
+ maximum_field_alignment = 2 * BITS_PER_UNIT;
+ else if (strcmp (arg, "longword") == 0)
+ maximum_field_alignment = 4 * BITS_PER_UNIT;
+ else if (strcmp (arg, "quadword") == 0)
+ maximum_field_alignment = 8 * BITS_PER_UNIT;
+ else
+ {
+ error ("unhandled alignment for '#pragma nomember_alignment'");
+ }
+
+ tok = pragma_lex (&x);
+ }
+ else
+ {
+ /* Enable packing. */
+ maximum_field_alignment = BITS_PER_UNIT;
+ }
+
+ if (tok != CPP_EOF)
+ {
+ error ("garbage at end of '#pragma nomember_alignment'");
+ return;
+ }
+}
+
+/* The 'extern model' for public data. */
+
+enum extern_model_kind
+{
+ /* Create one overlaid section per variable. */
+ extern_model_common_block,
+
+ /* Like unix: multiple not-initialized declarations are allowed. */
+ extern_model_relaxed_refdef,
+
+ /* Like -fno-common. */
+ extern_model_strict_refdef,
+
+ /* Declarations creates symbols without storage. */
+ extern_model_globalvalue
+};
+
+/* Current and saved extern model. */
+static enum extern_model_kind current_extern_model;
+static enum extern_model_kind saved_extern_model;
+
+/* Partial handling of '#pragma extern_model'. */
+
+static void
+vms_pragma_extern_model (cpp_reader *pfile ATTRIBUTE_UNUSED)
+{
+ tree x;
+ int tok;
+ const char *arg;
+
+ tok = pragma_lex (&x);
+
+ if (tok != CPP_NAME)
+ {
+ warning (OPT_Wpragmas, "malformed '#pragma extern_model', ignoring");
+ return;
+ }
+
+ arg = IDENTIFIER_POINTER (x);
+ /* Accept "__" prefix. */
+ if (arg[0] == '_' && arg[1] == '_')
+ arg += 2;
+
+ if (strcmp (arg, "save") == 0)
+ saved_extern_model = current_extern_model;
+ else if (strcmp (arg, "restore") == 0)
+ current_extern_model = saved_extern_model;
+ else if (strcmp (arg, "strict_refdef") == 0)
+ current_extern_model = extern_model_strict_refdef;
+ else if (strcmp (arg, "common_block") == 0)
+ current_extern_model = extern_model_common_block;
+ else if (strcmp (arg, "globalvalue") == 0)
+ {
+ sorry ("extern model globalvalue");
+ return;
+ }
+ else
+ {
+ error ("unknown '#pragma extern_model' model '%s'", arg);
+ return;
+ }
+#if 0
+ if (pragma_lex (&x) != CPP_EOF)
+ {
+ permerror (input_location, "junk at end of '#pragma extern_model'");
+ return;
+ }
+#endif
+}
+
+/* Ignore '#pragma message'. */
+
+static void
+vms_pragma_message (cpp_reader *pfile ATTRIBUTE_UNUSED)
+{
+ /* Completly ignored. */
+#if 0
+ pedwarn (input_location, OPT_Wpragmas,
+ "vms '#pragma __message' is ignored");
+#endif
+}
+
+/* Add vms-specific pragma. */
+
+void
+vms_c_register_pragma (void)
+{
+ c_register_pragma (NULL, "__nostandard", vms_pragma_nostandard);
+ c_register_pragma (NULL, "nostandard", vms_pragma_nostandard);
+ c_register_pragma (NULL, "__standard", vms_pragma_standard);
+ c_register_pragma (NULL, "standard", vms_pragma_standard);
+ c_register_pragma (NULL, "__member_alignment", vms_pragma_member_alignment);
+ c_register_pragma (NULL, "member_alignment", vms_pragma_member_alignment);
+ c_register_pragma (NULL, "__nomember_alignment",
+ vms_pragma_nomember_alignment);
+ c_register_pragma (NULL, "nomember_alignment",
+ vms_pragma_nomember_alignment);
+ c_register_pragma (NULL, "__extern_model", vms_pragma_extern_model);
+ c_register_pragma (NULL, "extern_model", vms_pragma_extern_model);
+ c_register_pragma (NULL, "__message", vms_pragma_message);
+}
diff --git a/gcc/config/vms/vms-protos.h b/gcc/config/vms/vms-protos.h
index 04dcd606999..c313638eae2 100644
--- a/gcc/config/vms/vms-protos.h
+++ b/gcc/config/vms/vms-protos.h
@@ -17,5 +17,8 @@ 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/>. */
+/* vms-c.c */
+extern void vms_c_register_pragma (void);
+
/* vms.c */
void vms_patch_builtins (void);
diff --git a/gcc/config/vms/vms-ucrt0.c b/gcc/config/vms/vms-ucrt0.c
deleted file mode 100644
index 344b59520e0..00000000000
--- a/gcc/config/vms/vms-ucrt0.c
+++ /dev/null
@@ -1,127 +0,0 @@
-/* VMS crt0 returning Unix style condition codes.
- Copyright (C) 2001, 2009, 2010 Free Software Foundation, Inc.
- Contributed by Douglas B. Rupp (rupp@gnat.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.
-
- Under Section 7 of GPL version 3, you are granted additional
- permissions described in the GCC Runtime Library Exception, version
- 3.1, as published by the Free Software Foundation.
-
- You should have received a copy of the GNU General Public License and
- a copy of the GCC Runtime Library Exception along with this program;
- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
- <http://www.gnu.org/licenses/>. */
-
-#include <stdlib.h>
-
-/* Lots of cheat to handle 32bits/64bits pointer conversions.
- We use 'long long' for 64 bits pointers and 'int' for 32 bits pointers. */
-
-extern void decc$main (void *arg1, void *arg2, void *arg3,
- void *image_file_desc, void *arg5, void *arg6,
- int *, int *, int *);
-extern int main (int, char **, char **);
-extern int _malloc32 (int);
-
-#ifdef __ia64__
-#define MAIN_ASM_NAME asm ("ELF$TFRADR")
-#else
-#define MAIN_ASM_NAME
-#endif
-
-int __main (void *arg1, void *arg2, void *arg3,
- void *image_file_desc, void *arg5, void *arg6) MAIN_ASM_NAME;
-
-/* From errnodef.h, but we need to emulate the globalval. */
-extern int C$_EXIT1;
-
-/* From stsdef.h */
-#define STS$V_MSG_NO 0x03
-#define STS$M_INHIB_MSG 0x10000000
-
-/* From ssdef.h */
-#define SS$_NORMAL 1
-
-int
-__main (void *arg1, void *arg2, void *arg3,
- void *image_file_desc, void *arg5, void *arg6)
-{
- int argc;
- int argv;
- int envp;
- int status;
- int i;
- long long *long_argv;
- long long *long_envp;
-
- /* The argv and envp arrays are 32 bits pointers to 32 bits pointers. */
- decc$main (arg1, arg2, arg3, image_file_desc,
- arg5, arg6, &argc, &argv, &envp);
-
- if (sizeof (void *) == 8)
- {
- /* Reallocate argv and envp with 64 bit pointers. */
- long_argv = (long long *)
- (long long) _malloc32 (sizeof (long long) * (argc + 1));
-
- for (i = 0; i < argc; i++)
- long_argv[i] = ((int *) (long long) argv)[i];
-
- long_argv[argc] = 0;
-
- for (i = 0; ((int *) (long long) envp)[i]; i++)
- ;
- long_envp = (long long *)
- (long long) _malloc32 (sizeof (long long) * (i + 1));
-
- for (i = 0; ((int *) (long long) envp)[i]; i++)
- long_envp[i] = ((int *) (long long) envp)[i];
-
- long_envp[i] = 0;
- }
- else
- {
- long_argv = (long long *) argv;
- long_envp = (long long *) envp;
- }
- status = main (argc, (char **)long_argv, (char **)long_envp);
-
-#ifdef CRT0_POSIX_EXIT
- /* Map into a range of 0 - 255. */
- status = status & 255;
-
- if (status > 0)
- {
- int save_status = status;
-
- status = (long) &C$_EXIT1 + ((status - 1) << STS$V_MSG_NO);
-
- /* An exit failure status requires a "severe" error. All status values
- are defined in errno with a successful (1) severity but can be
- changed to an error (2) severity by adding 1. In addition for
- compatibility with UNIX exit() routines we inhibit a run-time error
- message from being generated on exit(1). */
-
- if (save_status == 1)
- {
- status++;
- status |= STS$M_INHIB_MSG;
- }
- }
- else
- status = SS$_NORMAL;
-#endif /* CRT0_POSIX_EXIT */
-
- return status;
-}
diff --git a/gcc/config/vms/vms.c b/gcc/config/vms/vms.c
index 44940a3aa3b..ab37f827f83 100644
--- a/gcc/config/vms/vms.c
+++ b/gcc/config/vms/vms.c
@@ -99,11 +99,11 @@ vms_patch_builtins (void)
unsigned int i;
/* Fwrite on VMS is non-standard. */
- if (builtin_decl_implicit_p (BUILT_IN_WRITE))
- set_builtin_decl_implicit_p (BUILT_IN_WRITE, false);
+ if (builtin_decl_implicit_p (BUILT_IN_FWRITE))
+ set_builtin_decl_implicit_p (BUILT_IN_FWRITE, false);
- if (builtin_decl_implicit_p (BUILT_IN_WRITE_UNLOCKED))
- set_builtin_decl_implicit_p (BUILT_IN_WRITE_UNLOCKED, false);
+ if (builtin_decl_implicit_p (BUILT_IN_FWRITE_UNLOCKED))
+ set_builtin_decl_implicit_p (BUILT_IN_FWRITE_UNLOCKED, false);
/* Define aliases for names. */
for (i = 0; i < NBR_CRTL_NAMES; i++)
diff --git a/gcc/config/vms/vms.h b/gcc/config/vms/vms.h
new file mode 100644
index 00000000000..0da9d85a89c
--- /dev/null
+++ b/gcc/config/vms/vms.h
@@ -0,0 +1,60 @@
+/* Definitions of target machine GNU compiler. VMS common version.
+ Copyright (C) 2003-2009,2011 Free Software Foundation, Inc.
+ Contributed by Douglas B Rupp (rupp@gnat.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/>. */
+
+#define TARGET_OBJECT_SUFFIX ".obj"
+#define TARGET_EXECUTABLE_SUFFIX ".exe"
+
+#define TARGET_OS_CPP_BUILTINS() \
+ do { \
+ builtin_define_std ("vms"); \
+ builtin_define_std ("VMS"); \
+ builtin_assert ("system=vms"); \
+ SUBTARGET_OS_CPP_BUILTINS(); \
+ if (POINTER_SIZE == 64) \
+ { \
+ builtin_define ("__LONG_POINTERS=1"); \
+ builtin_define ("__int64=long long"); \
+ } \
+ } while (0)
+
+/* Tell compiler we want to support VMS pragmas */
+#define REGISTER_TARGET_PRAGMAS() vms_c_register_pragma ()
+
+/* By default, allow $ to be part of an identifier. */
+#define DOLLARS_IN_IDENTIFIERS 2
+
+#undef TARGET_ABI_OPEN_VMS
+#define TARGET_ABI_OPEN_VMS 1
+
+/* "long" is 32 bits, but 64 bits for Ada. */
+#undef LONG_TYPE_SIZE
+#define LONG_TYPE_SIZE 32
+#define ADA_LONG_TYPE_SIZE 64
+
+/* Pointer is 32 bits but the hardware has 64-bit addresses, sign extended. */
+#undef POINTER_SIZE
+#define POINTER_SIZE 32
+#define POINTERS_EXTEND_UNSIGNED 0
+
+/* Always 32 bits. */
+#undef SIZE_TYPE
+#define SIZE_TYPE "unsigned int"
+#undef PTRDIFF_TYPE
+#define PTRDIFF_TYPE "int"
diff --git a/gcc/config/ia64/vms64.h b/gcc/config/vms/vms64.h
index a92014337c5..24249ce9b3f 100644
--- a/gcc/config/ia64/vms64.h
+++ b/gcc/config/vms/vms64.h
@@ -1,6 +1,6 @@
-/* Definitions of target machine GNU compiler. 64bit IA64-VMS version.
- Copyright (C) 2004-2009 Free Software Foundation, Inc.
- Contributed by Douglas B Rupp (rupp@gnat.com).
+/* Output variables, constants and external declarations, for GNU compiler.
+ Copyright (C) 2001, 2007, 2009 Free Software Foundation, Inc.
+ Contributed by Douglas Rupp (rupp@gnat.com).
This file is part of GCC.
@@ -18,22 +18,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/>. */
-#undef TARGET_OS_CPP_BUILTINS
-#define TARGET_OS_CPP_BUILTINS() \
- do { \
- builtin_define_std ("vms"); \
- builtin_define_std ("VMS"); \
- builtin_define ("__IA64"); \
- builtin_assert ("system=vms"); \
- builtin_define ("__IEEE_FLOAT"); \
- builtin_define ("__LONG_POINTERS=1"); \
- } while (0)
-
#undef LONG_TYPE_SIZE
#define LONG_TYPE_SIZE 64
#undef POINTER_SIZE
#define POINTER_SIZE 64
-#undef TARGET_DEFAULT
-#define TARGET_DEFAULT (MASK_DWARF2_ASM | MASK_GNU_AS | MASK_MALLOC64)
+/* Defaults to "long int" */
+#undef SIZE_TYPE
+#undef PTRDIFF_TYPE
diff --git a/gcc/config/vxlib-tls.c b/gcc/config/vxlib-tls.c
deleted file mode 100644
index c4696768f0f..00000000000
--- a/gcc/config/vxlib-tls.c
+++ /dev/null
@@ -1,362 +0,0 @@
-/* Copyright (C) 2002, 2003, 2004, 2005, 2009 Free Software Foundation, Inc.
- Contributed by Zack Weinberg <zack@codesourcery.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.
-
-Under Section 7 of GPL version 3, you are granted additional
-permissions described in the GCC Runtime Library Exception, version
-3.1, as published by the Free Software Foundation.
-
-You should have received a copy of the GNU General Public License and
-a copy of the GCC Runtime Library Exception along with this program;
-see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
-<http://www.gnu.org/licenses/>. */
-
-/* Threads compatibility routines for libgcc2 for VxWorks.
- These are out-of-line routines called from gthr-vxworks.h.
-
- This file provides the TLS related support routines, calling specific
- VxWorks kernel entry points for this purpose. The base VxWorks 5.x kernels
- don't feature these entry points, and we provide gthr_supp_vxw_5x.c as an
- option to fill this gap. Asking users to rebuild a kernel is not to be
- taken lightly, still, so we have isolated these routines from the rest of
- vxlib to ensure that the kernel dependencies are only dragged when really
- necessary. */
-
-#include "tconfig.h"
-#include "tsystem.h"
-#include "gthr.h"
-
-#if defined(__GTHREADS)
-#include <vxWorks.h>
-#ifndef __RTP__
-#include <vxLib.h>
-#endif
-#include <taskLib.h>
-#ifndef __RTP__
-#include <taskHookLib.h>
-#else
-# include <errno.h>
-#endif
-
-/* Thread-local storage.
-
- We reserve a field in the TCB to point to a dynamically allocated
- array which is used to store TLS values. A TLS key is simply an
- offset in this array. The exact location of the TCB field is not
- known to this code nor to vxlib.c -- all access to it indirects
- through the routines __gthread_get_tls_data and
- __gthread_set_tls_data, which are provided by the VxWorks kernel.
-
- There is also a global array which records which keys are valid and
- which have destructors.
-
- A task delete hook is installed to execute key destructors. The
- routines __gthread_enter_tls_dtor_context and
- __gthread_leave_tls_dtor_context, which are also provided by the
- kernel, ensure that it is safe to call free() on memory allocated
- by the task being deleted. (This is a no-op on VxWorks 5, but
- a major undertaking on AE.)
-
- The task delete hook is only installed when at least one thread
- has TLS data. This is a necessary precaution, to allow this module
- to be unloaded - a module with a hook can not be removed.
-
- Since this interface is used to allocate only a small number of
- keys, the table size is small and static, which simplifies the
- code quite a bit. Revisit this if and when it becomes necessary. */
-
-#define MAX_KEYS 4
-
-/* This is the structure pointed to by the pointer returned
- by __gthread_get_tls_data. */
-struct tls_data
-{
- int *owner;
- void *values[MAX_KEYS];
- unsigned int generation[MAX_KEYS];
-};
-
-/* To make sure we only delete TLS data associated with this object,
- include a pointer to a local variable in the TLS data object. */
-static int self_owner;
-
-/* Flag to check whether the delete hook is installed. Once installed
- it is only removed when unloading this module. */
-static volatile int delete_hook_installed;
-
-/* kernel provided routines */
-extern void *__gthread_get_tls_data (void);
-extern void __gthread_set_tls_data (void *data);
-
-extern void __gthread_enter_tls_dtor_context (void);
-extern void __gthread_leave_tls_dtor_context (void);
-
-
-/* This is a global structure which records all of the active keys.
-
- A key is potentially valid (i.e. has been handed out by
- __gthread_key_create) iff its generation count in this structure is
- even. In that case, the matching entry in the dtors array is a
- routine to be called when a thread terminates with a valid,
- non-NULL specific value for that key.
-
- A key is actually valid in a thread T iff the generation count
- stored in this structure is equal to the generation count stored in
- T's specific-value structure. */
-
-typedef void (*tls_dtor) (void *);
-
-struct tls_keys
-{
- tls_dtor dtor[MAX_KEYS];
- unsigned int generation[MAX_KEYS];
-};
-
-#define KEY_VALID_P(key) !(tls_keys.generation[key] & 1)
-
-/* Note: if MAX_KEYS is increased, this initializer must be updated
- to match. All the generation counts begin at 1, which means no
- key is valid. */
-static struct tls_keys tls_keys =
-{
- { 0, 0, 0, 0 },
- { 1, 1, 1, 1 }
-};
-
-/* This lock protects the tls_keys structure. */
-static __gthread_mutex_t tls_lock;
-
-static __gthread_once_t tls_init_guard = __GTHREAD_ONCE_INIT;
-
-/* Internal routines. */
-
-/* The task TCB has just been deleted. Call the destructor
- function for each TLS key that has both a destructor and
- a non-NULL specific value in this thread.
-
- This routine does not need to take tls_lock; the generation
- count protects us from calling a stale destructor. It does
- need to read tls_keys.dtor[key] atomically. */
-
-static void
-tls_delete_hook (void *tcb ATTRIBUTE_UNUSED)
-{
- struct tls_data *data;
- __gthread_key_t key;
-
-#ifdef __RTP__
- data = __gthread_get_tls_data ();
-#else
- /* In kernel mode, we can be called in the context of the thread
- doing the killing, so must use the TCB to determine the data of
- the thread being killed. */
- data = __gthread_get_tsd_data (tcb);
-#endif
-
- if (data && data->owner == &self_owner)
- {
-#ifdef __RTP__
- __gthread_enter_tls_dtor_context ();
-#else
- __gthread_enter_tsd_dtor_context (tcb);
-#endif
- for (key = 0; key < MAX_KEYS; key++)
- {
- if (data->generation[key] == tls_keys.generation[key])
- {
- tls_dtor dtor = tls_keys.dtor[key];
-
- if (dtor)
- dtor (data->values[key]);
- }
- }
- free (data);
-#ifdef __RTP__
- __gthread_leave_tls_dtor_context ();
-#else
- __gthread_leave_tsd_dtor_context ();
-#endif
-
-#ifdef __RTP__
- __gthread_set_tls_data (0);
-#else
- __gthread_set_tsd_data (tcb, 0);
-#endif
- }
-}
-
-/* Initialize global data used by the TLS system. */
-static void
-tls_init (void)
-{
- __GTHREAD_MUTEX_INIT_FUNCTION (&tls_lock);
-}
-
-static void tls_destructor (void) __attribute__ ((destructor));
-static void
-tls_destructor (void)
-{
-#ifdef __RTP__
- /* All threads but this one should have exited by now. */
- tls_delete_hook (NULL);
-#endif
- /* Unregister the hook. */
- if (delete_hook_installed)
- taskDeleteHookDelete ((FUNCPTR)tls_delete_hook);
-
- if (tls_init_guard.done && __gthread_mutex_lock (&tls_lock) != ERROR)
- semDelete (tls_lock);
-}
-
-/* External interface */
-
-/* Store in KEYP a value which can be passed to __gthread_setspecific/
- __gthread_getspecific to store and retrieve a value which is
- specific to each calling thread. If DTOR is not NULL, it will be
- called when a thread terminates with a non-NULL specific value for
- this key, with the value as its sole argument. */
-
-int
-__gthread_key_create (__gthread_key_t *keyp, tls_dtor dtor)
-{
- __gthread_key_t key;
-
- __gthread_once (&tls_init_guard, tls_init);
-
- if (__gthread_mutex_lock (&tls_lock) == ERROR)
- return errno;
-
- for (key = 0; key < MAX_KEYS; key++)
- if (!KEY_VALID_P (key))
- goto found_slot;
-
- /* no room */
- __gthread_mutex_unlock (&tls_lock);
- return EAGAIN;
-
- found_slot:
- tls_keys.generation[key]++; /* making it even */
- tls_keys.dtor[key] = dtor;
- *keyp = key;
- __gthread_mutex_unlock (&tls_lock);
- return 0;
-}
-
-/* Invalidate KEY; it can no longer be used as an argument to
- setspecific/getspecific. Note that this does NOT call destructor
- functions for any live values for this key. */
-int
-__gthread_key_delete (__gthread_key_t key)
-{
- if (key >= MAX_KEYS)
- return EINVAL;
-
- __gthread_once (&tls_init_guard, tls_init);
-
- if (__gthread_mutex_lock (&tls_lock) == ERROR)
- return errno;
-
- if (!KEY_VALID_P (key))
- {
- __gthread_mutex_unlock (&tls_lock);
- return EINVAL;
- }
-
- tls_keys.generation[key]++; /* making it odd */
- tls_keys.dtor[key] = 0;
-
- __gthread_mutex_unlock (&tls_lock);
- return 0;
-}
-
-/* Retrieve the thread-specific value for KEY. If it has never been
- set in this thread, or KEY is invalid, returns NULL.
-
- It does not matter if this function races with key_create or
- key_delete; the worst that can happen is you get a value other than
- the one that a serialized implementation would have provided. */
-
-void *
-__gthread_getspecific (__gthread_key_t key)
-{
- struct tls_data *data;
-
- if (key >= MAX_KEYS)
- return 0;
-
- data = __gthread_get_tls_data ();
-
- if (!data)
- return 0;
-
- if (data->generation[key] != tls_keys.generation[key])
- return 0;
-
- return data->values[key];
-}
-
-/* Set the thread-specific value for KEY. If KEY is invalid, or
- memory allocation fails, returns -1, otherwise 0.
-
- The generation count protects this function against races with
- key_create/key_delete; the worst thing that can happen is that a
- value is successfully stored into a dead generation (and then
- immediately becomes invalid). However, we do have to make sure
- to read tls_keys.generation[key] atomically. */
-
-int
-__gthread_setspecific (__gthread_key_t key, void *value)
-{
- struct tls_data *data;
- unsigned int generation;
-
- if (key >= MAX_KEYS)
- return EINVAL;
-
- data = __gthread_get_tls_data ();
- if (!data)
- {
- if (!delete_hook_installed)
- {
- /* Install the delete hook. */
- if (__gthread_mutex_lock (&tls_lock) == ERROR)
- return ENOMEM;
- if (!delete_hook_installed)
- {
- taskDeleteHookAdd ((FUNCPTR)tls_delete_hook);
- delete_hook_installed = 1;
- }
- __gthread_mutex_unlock (&tls_lock);
- }
-
- data = malloc (sizeof (struct tls_data));
- if (!data)
- return ENOMEM;
-
- memset (data, 0, sizeof (struct tls_data));
- data->owner = &self_owner;
- __gthread_set_tls_data (data);
- }
-
- generation = tls_keys.generation[key];
-
- if (generation & 1)
- return EINVAL;
-
- data->generation[key] = generation;
- data->values[key] = value;
-
- return 0;
-}
-#endif /* __GTHREADS */
diff --git a/gcc/config/vxlib.c b/gcc/config/vxlib.c
deleted file mode 100644
index 0ff996cfced..00000000000
--- a/gcc/config/vxlib.c
+++ /dev/null
@@ -1,95 +0,0 @@
-/* Copyright (C) 2002, 2003, 2004, 2005, 2009 Free Software Foundation, Inc.
- Contributed by Zack Weinberg <zack@codesourcery.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.
-
-Under Section 7 of GPL version 3, you are granted additional
-permissions described in the GCC Runtime Library Exception, version
-3.1, as published by the Free Software Foundation.
-
-You should have received a copy of the GNU General Public License and
-a copy of the GCC Runtime Library Exception along with this program;
-see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
-<http://www.gnu.org/licenses/>. */
-
-/* Threads compatibility routines for libgcc2 for VxWorks.
- These are out-of-line routines called from gthr-vxworks.h. */
-
-#include "tconfig.h"
-#include "tsystem.h"
-#include "gthr.h"
-
-#if defined(__GTHREADS)
-#include <vxWorks.h>
-#ifndef __RTP__
-#include <vxLib.h>
-#endif
-#include <taskLib.h>
-#ifndef __RTP__
-#include <taskHookLib.h>
-#else
-# include <errno.h>
-#endif
-
-/* Init-once operation.
-
- This would be a clone of the implementation from gthr-solaris.h,
- except that we have a bootstrap problem - the whole point of this
- exercise is to prevent double initialization, but if two threads
- are racing with each other, once->mutex is liable to be initialized
- by both. Then each thread will lock its own mutex, and proceed to
- call the initialization routine.
-
- So instead we use a bare atomic primitive (vxTas()) to handle
- mutual exclusion. Threads losing the race then busy-wait, calling
- taskDelay() to yield the processor, until the initialization is
- completed. Inefficient, but reliable. */
-
-int
-__gthread_once (__gthread_once_t *guard, void (*func)(void))
-{
- if (guard->done)
- return 0;
-
-#ifdef __RTP__
- __gthread_lock_library ();
-#else
- while (!vxTas ((void *)&guard->busy))
- {
-#ifdef __PPC__
- /* This can happen on powerpc, which is using all 32 bits
- of the gthread_once_t structure. */
- if (guard->done)
- return;
-#endif
- taskDelay (1);
- }
-#endif
-
- /* Only one thread at a time gets here. Check ->done again, then
- go ahead and call func() if no one has done it yet. */
- if (!guard->done)
- {
- func ();
- guard->done = 1;
- }
-
-#ifdef __RTP__
- __gthread_unlock_library ();
-#else
- guard->busy = 0;
-#endif
- return 0;
-}
-
-#endif /* __GTHREADS */
diff --git a/gcc/config/xtensa/crti.asm b/gcc/config/xtensa/crti.asm
deleted file mode 100644
index cbe91b0e748..00000000000
--- a/gcc/config/xtensa/crti.asm
+++ /dev/null
@@ -1,51 +0,0 @@
-# Start .init and .fini sections.
-# Copyright (C) 2003, 2009 Free Software Foundation, Inc.
-#
-# This file 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/>.
-
-# This file just makes a stack frame for the contents of the .fini and
-# .init sections. Users may put any desired instructions in those
-# sections.
-
-#include "xtensa-config.h"
-
- .section .init
- .globl _init
- .type _init,@function
- .align 4
-_init:
-#if XCHAL_HAVE_WINDOWED && !__XTENSA_CALL0_ABI__
- entry sp, 64
-#else
- addi sp, sp, -32
- s32i a0, sp, 0
-#endif
-
- .section .fini
- .globl _fini
- .type _fini,@function
- .align 4
-_fini:
-#if XCHAL_HAVE_WINDOWED && !__XTENSA_CALL0_ABI__
- entry sp, 64
-#else
- addi sp, sp, -32
- s32i a0, sp, 0
-#endif
diff --git a/gcc/config/xtensa/crtn.asm b/gcc/config/xtensa/crtn.asm
deleted file mode 100644
index 413cfa0ac10..00000000000
--- a/gcc/config/xtensa/crtn.asm
+++ /dev/null
@@ -1,46 +0,0 @@
-# End of .init and .fini sections.
-# Copyright (C) 2003, 2009 Free Software Foundation, Inc.
-#
-# This file 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/>.
-
-
-# This file just makes sure that the .fini and .init sections do in
-# fact return. Users may put any desired instructions in those sections.
-# This file is the last thing linked into any executable.
-
-#include "xtensa-config.h"
-
- .section .init
-#if XCHAL_HAVE_WINDOWED && !__XTENSA_CALL0_ABI__
- retw
-#else
- l32i a0, sp, 0
- addi sp, sp, 32
- ret
-#endif
-
- .section .fini
-#if XCHAL_HAVE_WINDOWED && !__XTENSA_CALL0_ABI__
- retw
-#else
- l32i a0, sp, 0
- addi sp, sp, 32
- ret
-#endif
diff --git a/gcc/config/xtensa/ieee754-df.S b/gcc/config/xtensa/ieee754-df.S
deleted file mode 100644
index 9b46889bdc2..00000000000
--- a/gcc/config/xtensa/ieee754-df.S
+++ /dev/null
@@ -1,2388 +0,0 @@
-/* IEEE-754 double-precision functions for Xtensa
- Copyright (C) 2006, 2007, 2009 Free Software Foundation, Inc.
- Contributed by Bob Wilson (bwilson@tensilica.com) at Tensilica.
-
- 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/>. */
-
-#ifdef __XTENSA_EB__
-#define xh a2
-#define xl a3
-#define yh a4
-#define yl a5
-#else
-#define xh a3
-#define xl a2
-#define yh a5
-#define yl a4
-#endif
-
-/* Warning! The branch displacements for some Xtensa branch instructions
- are quite small, and this code has been carefully laid out to keep
- branch targets in range. If you change anything, be sure to check that
- the assembler is not relaxing anything to branch over a jump. */
-
-#ifdef L_negdf2
-
- .align 4
- .global __negdf2
- .type __negdf2, @function
-__negdf2:
- leaf_entry sp, 16
- movi a4, 0x80000000
- xor xh, xh, a4
- leaf_return
-
-#endif /* L_negdf2 */
-
-#ifdef L_addsubdf3
-
- /* Addition */
-__adddf3_aux:
-
- /* Handle NaNs and Infinities. (This code is placed before the
- start of the function just to keep it in range of the limited
- branch displacements.) */
-
-.Ladd_xnan_or_inf:
- /* If y is neither Infinity nor NaN, return x. */
- bnall yh, a6, 1f
- /* If x is a NaN, return it. Otherwise, return y. */
- slli a7, xh, 12
- or a7, a7, xl
- beqz a7, .Ladd_ynan_or_inf
-1: leaf_return
-
-.Ladd_ynan_or_inf:
- /* Return y. */
- mov xh, yh
- mov xl, yl
- leaf_return
-
-.Ladd_opposite_signs:
- /* Operand signs differ. Do a subtraction. */
- slli a7, a6, 11
- xor yh, yh, a7
- j .Lsub_same_sign
-
- .align 4
- .global __adddf3
- .type __adddf3, @function
-__adddf3:
- leaf_entry sp, 16
- movi a6, 0x7ff00000
-
- /* Check if the two operands have the same sign. */
- xor a7, xh, yh
- bltz a7, .Ladd_opposite_signs
-
-.Ladd_same_sign:
- /* Check if either exponent == 0x7ff (i.e., NaN or Infinity). */
- ball xh, a6, .Ladd_xnan_or_inf
- ball yh, a6, .Ladd_ynan_or_inf
-
- /* Compare the exponents. The smaller operand will be shifted
- right by the exponent difference and added to the larger
- one. */
- extui a7, xh, 20, 12
- extui a8, yh, 20, 12
- bltu a7, a8, .Ladd_shiftx
-
-.Ladd_shifty:
- /* Check if the smaller (or equal) exponent is zero. */
- bnone yh, a6, .Ladd_yexpzero
-
- /* Replace yh sign/exponent with 0x001. */
- or yh, yh, a6
- slli yh, yh, 11
- srli yh, yh, 11
-
-.Ladd_yexpdiff:
- /* Compute the exponent difference. Optimize for difference < 32. */
- sub a10, a7, a8
- bgeui a10, 32, .Ladd_bigshifty
-
- /* Shift yh/yl right by the exponent difference. Any bits that are
- shifted out of yl are saved in a9 for rounding the result. */
- ssr a10
- movi a9, 0
- src a9, yl, a9
- src yl, yh, yl
- srl yh, yh
-
-.Ladd_addy:
- /* Do the 64-bit addition. */
- add xl, xl, yl
- add xh, xh, yh
- bgeu xl, yl, 1f
- addi xh, xh, 1
-1:
- /* Check if the add overflowed into the exponent. */
- extui a10, xh, 20, 12
- beq a10, a7, .Ladd_round
- mov a8, a7
- j .Ladd_carry
-
-.Ladd_yexpzero:
- /* y is a subnormal value. Replace its sign/exponent with zero,
- i.e., no implicit "1.0", and increment the apparent exponent
- because subnormals behave as if they had the minimum (nonzero)
- exponent. Test for the case when both exponents are zero. */
- slli yh, yh, 12
- srli yh, yh, 12
- bnone xh, a6, .Ladd_bothexpzero
- addi a8, a8, 1
- j .Ladd_yexpdiff
-
-.Ladd_bothexpzero:
- /* Both exponents are zero. Handle this as a special case. There
- is no need to shift or round, and the normal code for handling
- a carry into the exponent field will not work because it
- assumes there is an implicit "1.0" that needs to be added. */
- add xl, xl, yl
- add xh, xh, yh
- bgeu xl, yl, 1f
- addi xh, xh, 1
-1: leaf_return
-
-.Ladd_bigshifty:
- /* Exponent difference > 64 -- just return the bigger value. */
- bgeui a10, 64, 1b
-
- /* Shift yh/yl right by the exponent difference. Any bits that are
- shifted out are saved in a9 for rounding the result. */
- ssr a10
- sll a11, yl /* lost bits shifted out of yl */
- src a9, yh, yl
- srl yl, yh
- movi yh, 0
- beqz a11, .Ladd_addy
- or a9, a9, a10 /* any positive, nonzero value will work */
- j .Ladd_addy
-
-.Ladd_xexpzero:
- /* Same as "yexpzero" except skip handling the case when both
- exponents are zero. */
- slli xh, xh, 12
- srli xh, xh, 12
- addi a7, a7, 1
- j .Ladd_xexpdiff
-
-.Ladd_shiftx:
- /* Same thing as the "shifty" code, but with x and y swapped. Also,
- because the exponent difference is always nonzero in this version,
- the shift sequence can use SLL and skip loading a constant zero. */
- bnone xh, a6, .Ladd_xexpzero
-
- or xh, xh, a6
- slli xh, xh, 11
- srli xh, xh, 11
-
-.Ladd_xexpdiff:
- sub a10, a8, a7
- bgeui a10, 32, .Ladd_bigshiftx
-
- ssr a10
- sll a9, xl
- src xl, xh, xl
- srl xh, xh
-
-.Ladd_addx:
- add xl, xl, yl
- add xh, xh, yh
- bgeu xl, yl, 1f
- addi xh, xh, 1
-1:
- /* Check if the add overflowed into the exponent. */
- extui a10, xh, 20, 12
- bne a10, a8, .Ladd_carry
-
-.Ladd_round:
- /* Round up if the leftover fraction is >= 1/2. */
- bgez a9, 1f
- addi xl, xl, 1
- beqz xl, .Ladd_roundcarry
-
- /* Check if the leftover fraction is exactly 1/2. */
- slli a9, a9, 1
- beqz a9, .Ladd_exactlyhalf
-1: leaf_return
-
-.Ladd_bigshiftx:
- /* Mostly the same thing as "bigshifty".... */
- bgeui a10, 64, .Ladd_returny
-
- ssr a10
- sll a11, xl
- src a9, xh, xl
- srl xl, xh
- movi xh, 0
- beqz a11, .Ladd_addx
- or a9, a9, a10
- j .Ladd_addx
-
-.Ladd_returny:
- mov xh, yh
- mov xl, yl
- leaf_return
-
-.Ladd_carry:
- /* The addition has overflowed into the exponent field, so the
- value needs to be renormalized. The mantissa of the result
- can be recovered by subtracting the original exponent and
- adding 0x100000 (which is the explicit "1.0" for the
- mantissa of the non-shifted operand -- the "1.0" for the
- shifted operand was already added). The mantissa can then
- be shifted right by one bit. The explicit "1.0" of the
- shifted mantissa then needs to be replaced by the exponent,
- incremented by one to account for the normalizing shift.
- It is faster to combine these operations: do the shift first
- and combine the additions and subtractions. If x is the
- original exponent, the result is:
- shifted mantissa - (x << 19) + (1 << 19) + (x << 20)
- or:
- shifted mantissa + ((x + 1) << 19)
- Note that the exponent is incremented here by leaving the
- explicit "1.0" of the mantissa in the exponent field. */
-
- /* Shift xh/xl right by one bit. Save the lsb of xl. */
- mov a10, xl
- ssai 1
- src xl, xh, xl
- srl xh, xh
-
- /* See explanation above. The original exponent is in a8. */
- addi a8, a8, 1
- slli a8, a8, 19
- add xh, xh, a8
-
- /* Return an Infinity if the exponent overflowed. */
- ball xh, a6, .Ladd_infinity
-
- /* Same thing as the "round" code except the msb of the leftover
- fraction is bit 0 of a10, with the rest of the fraction in a9. */
- bbci.l a10, 0, 1f
- addi xl, xl, 1
- beqz xl, .Ladd_roundcarry
- beqz a9, .Ladd_exactlyhalf
-1: leaf_return
-
-.Ladd_infinity:
- /* Clear the mantissa. */
- movi xl, 0
- srli xh, xh, 20
- slli xh, xh, 20
-
- /* The sign bit may have been lost in a carry-out. Put it back. */
- slli a8, a8, 1
- or xh, xh, a8
- leaf_return
-
-.Ladd_exactlyhalf:
- /* Round down to the nearest even value. */
- srli xl, xl, 1
- slli xl, xl, 1
- leaf_return
-
-.Ladd_roundcarry:
- /* xl is always zero when the rounding increment overflows, so
- there's no need to round it to an even value. */
- addi xh, xh, 1
- /* Overflow to the exponent is OK. */
- leaf_return
-
-
- /* Subtraction */
-__subdf3_aux:
-
- /* Handle NaNs and Infinities. (This code is placed before the
- start of the function just to keep it in range of the limited
- branch displacements.) */
-
-.Lsub_xnan_or_inf:
- /* If y is neither Infinity nor NaN, return x. */
- bnall yh, a6, 1f
- /* Both x and y are either NaN or Inf, so the result is NaN. */
- movi a4, 0x80000 /* make it a quiet NaN */
- or xh, xh, a4
-1: leaf_return
-
-.Lsub_ynan_or_inf:
- /* Negate y and return it. */
- slli a7, a6, 11
- xor xh, yh, a7
- mov xl, yl
- leaf_return
-
-.Lsub_opposite_signs:
- /* Operand signs differ. Do an addition. */
- slli a7, a6, 11
- xor yh, yh, a7
- j .Ladd_same_sign
-
- .align 4
- .global __subdf3
- .type __subdf3, @function
-__subdf3:
- leaf_entry sp, 16
- movi a6, 0x7ff00000
-
- /* Check if the two operands have the same sign. */
- xor a7, xh, yh
- bltz a7, .Lsub_opposite_signs
-
-.Lsub_same_sign:
- /* Check if either exponent == 0x7ff (i.e., NaN or Infinity). */
- ball xh, a6, .Lsub_xnan_or_inf
- ball yh, a6, .Lsub_ynan_or_inf
-
- /* Compare the operands. In contrast to addition, the entire
- value matters here. */
- extui a7, xh, 20, 11
- extui a8, yh, 20, 11
- bltu xh, yh, .Lsub_xsmaller
- beq xh, yh, .Lsub_compare_low
-
-.Lsub_ysmaller:
- /* Check if the smaller (or equal) exponent is zero. */
- bnone yh, a6, .Lsub_yexpzero
-
- /* Replace yh sign/exponent with 0x001. */
- or yh, yh, a6
- slli yh, yh, 11
- srli yh, yh, 11
-
-.Lsub_yexpdiff:
- /* Compute the exponent difference. Optimize for difference < 32. */
- sub a10, a7, a8
- bgeui a10, 32, .Lsub_bigshifty
-
- /* Shift yh/yl right by the exponent difference. Any bits that are
- shifted out of yl are saved in a9 for rounding the result. */
- ssr a10
- movi a9, 0
- src a9, yl, a9
- src yl, yh, yl
- srl yh, yh
-
-.Lsub_suby:
- /* Do the 64-bit subtraction. */
- sub xh, xh, yh
- bgeu xl, yl, 1f
- addi xh, xh, -1
-1: sub xl, xl, yl
-
- /* Subtract the leftover bits in a9 from zero and propagate any
- borrow from xh/xl. */
- neg a9, a9
- beqz a9, 1f
- addi a5, xh, -1
- moveqz xh, a5, xl
- addi xl, xl, -1
-1:
- /* Check if the subtract underflowed into the exponent. */
- extui a10, xh, 20, 11
- beq a10, a7, .Lsub_round
- j .Lsub_borrow
-
-.Lsub_compare_low:
- /* The high words are equal. Compare the low words. */
- bltu xl, yl, .Lsub_xsmaller
- bltu yl, xl, .Lsub_ysmaller
- /* The operands are equal. Return 0.0. */
- movi xh, 0
- movi xl, 0
-1: leaf_return
-
-.Lsub_yexpzero:
- /* y is a subnormal value. Replace its sign/exponent with zero,
- i.e., no implicit "1.0". Unless x is also a subnormal, increment
- y's apparent exponent because subnormals behave as if they had
- the minimum (nonzero) exponent. */
- slli yh, yh, 12
- srli yh, yh, 12
- bnone xh, a6, .Lsub_yexpdiff
- addi a8, a8, 1
- j .Lsub_yexpdiff
-
-.Lsub_bigshifty:
- /* Exponent difference > 64 -- just return the bigger value. */
- bgeui a10, 64, 1b
-
- /* Shift yh/yl right by the exponent difference. Any bits that are
- shifted out are saved in a9 for rounding the result. */
- ssr a10
- sll a11, yl /* lost bits shifted out of yl */
- src a9, yh, yl
- srl yl, yh
- movi yh, 0
- beqz a11, .Lsub_suby
- or a9, a9, a10 /* any positive, nonzero value will work */
- j .Lsub_suby
-
-.Lsub_xsmaller:
- /* Same thing as the "ysmaller" code, but with x and y swapped and
- with y negated. */
- bnone xh, a6, .Lsub_xexpzero
-
- or xh, xh, a6
- slli xh, xh, 11
- srli xh, xh, 11
-
-.Lsub_xexpdiff:
- sub a10, a8, a7
- bgeui a10, 32, .Lsub_bigshiftx
-
- ssr a10
- movi a9, 0
- src a9, xl, a9
- src xl, xh, xl
- srl xh, xh
-
- /* Negate y. */
- slli a11, a6, 11
- xor yh, yh, a11
-
-.Lsub_subx:
- sub xl, yl, xl
- sub xh, yh, xh
- bgeu yl, xl, 1f
- addi xh, xh, -1
-1:
- /* Subtract the leftover bits in a9 from zero and propagate any
- borrow from xh/xl. */
- neg a9, a9
- beqz a9, 1f
- addi a5, xh, -1
- moveqz xh, a5, xl
- addi xl, xl, -1
-1:
- /* Check if the subtract underflowed into the exponent. */
- extui a10, xh, 20, 11
- bne a10, a8, .Lsub_borrow
-
-.Lsub_round:
- /* Round up if the leftover fraction is >= 1/2. */
- bgez a9, 1f
- addi xl, xl, 1
- beqz xl, .Lsub_roundcarry
-
- /* Check if the leftover fraction is exactly 1/2. */
- slli a9, a9, 1
- beqz a9, .Lsub_exactlyhalf
-1: leaf_return
-
-.Lsub_xexpzero:
- /* Same as "yexpzero". */
- slli xh, xh, 12
- srli xh, xh, 12
- bnone yh, a6, .Lsub_xexpdiff
- addi a7, a7, 1
- j .Lsub_xexpdiff
-
-.Lsub_bigshiftx:
- /* Mostly the same thing as "bigshifty", but with the sign bit of the
- shifted value set so that the subsequent subtraction flips the
- sign of y. */
- bgeui a10, 64, .Lsub_returny
-
- ssr a10
- sll a11, xl
- src a9, xh, xl
- srl xl, xh
- slli xh, a6, 11 /* set sign bit of xh */
- beqz a11, .Lsub_subx
- or a9, a9, a10
- j .Lsub_subx
-
-.Lsub_returny:
- /* Negate and return y. */
- slli a7, a6, 11
- xor xh, yh, a7
- mov xl, yl
- leaf_return
-
-.Lsub_borrow:
- /* The subtraction has underflowed into the exponent field, so the
- value needs to be renormalized. Shift the mantissa left as
- needed to remove any leading zeros and adjust the exponent
- accordingly. If the exponent is not large enough to remove
- all the leading zeros, the result will be a subnormal value. */
-
- slli a8, xh, 12
- beqz a8, .Lsub_xhzero
- do_nsau a6, a8, a7, a11
- srli a8, a8, 12
- bge a6, a10, .Lsub_subnormal
- addi a6, a6, 1
-
-.Lsub_shift_lt32:
- /* Shift the mantissa (a8/xl/a9) left by a6. */
- ssl a6
- src a8, a8, xl
- src xl, xl, a9
- sll a9, a9
-
- /* Combine the shifted mantissa with the sign and exponent,
- decrementing the exponent by a6. (The exponent has already
- been decremented by one due to the borrow from the subtraction,
- but adding the mantissa will increment the exponent by one.) */
- srli xh, xh, 20
- sub xh, xh, a6
- slli xh, xh, 20
- add xh, xh, a8
- j .Lsub_round
-
-.Lsub_exactlyhalf:
- /* Round down to the nearest even value. */
- srli xl, xl, 1
- slli xl, xl, 1
- leaf_return
-
-.Lsub_roundcarry:
- /* xl is always zero when the rounding increment overflows, so
- there's no need to round it to an even value. */
- addi xh, xh, 1
- /* Overflow to the exponent is OK. */
- leaf_return
-
-.Lsub_xhzero:
- /* When normalizing the result, all the mantissa bits in the high
- word are zero. Shift by "20 + (leading zero count of xl) + 1". */
- do_nsau a6, xl, a7, a11
- addi a6, a6, 21
- blt a10, a6, .Lsub_subnormal
-
-.Lsub_normalize_shift:
- bltui a6, 32, .Lsub_shift_lt32
-
- ssl a6
- src a8, xl, a9
- sll xl, a9
- movi a9, 0
-
- srli xh, xh, 20
- sub xh, xh, a6
- slli xh, xh, 20
- add xh, xh, a8
- j .Lsub_round
-
-.Lsub_subnormal:
- /* The exponent is too small to shift away all the leading zeros.
- Set a6 to the current exponent (which has already been
- decremented by the borrow) so that the exponent of the result
- will be zero. Do not add 1 to a6 in this case, because: (1)
- adding the mantissa will not increment the exponent, so there is
- no need to subtract anything extra from the exponent to
- compensate, and (2) the effective exponent of a subnormal is 1
- not 0 so the shift amount must be 1 smaller than normal. */
- mov a6, a10
- j .Lsub_normalize_shift
-
-#endif /* L_addsubdf3 */
-
-#ifdef L_muldf3
-
- /* Multiplication */
-#if !XCHAL_HAVE_MUL16 && !XCHAL_HAVE_MUL32 && !XCHAL_HAVE_MAC16
-#define XCHAL_NO_MUL 1
-#endif
-
-__muldf3_aux:
-
- /* Handle unusual cases (zeros, subnormals, NaNs and Infinities).
- (This code is placed before the start of the function just to
- keep it in range of the limited branch displacements.) */
-
-.Lmul_xexpzero:
- /* Clear the sign bit of x. */
- slli xh, xh, 1
- srli xh, xh, 1
-
- /* If x is zero, return zero. */
- or a10, xh, xl
- beqz a10, .Lmul_return_zero
-
- /* Normalize x. Adjust the exponent in a8. */
- beqz xh, .Lmul_xh_zero
- do_nsau a10, xh, a11, a12
- addi a10, a10, -11
- ssl a10
- src xh, xh, xl
- sll xl, xl
- movi a8, 1
- sub a8, a8, a10
- j .Lmul_xnormalized
-.Lmul_xh_zero:
- do_nsau a10, xl, a11, a12
- addi a10, a10, -11
- movi a8, -31
- sub a8, a8, a10
- ssl a10
- bltz a10, .Lmul_xl_srl
- sll xh, xl
- movi xl, 0
- j .Lmul_xnormalized
-.Lmul_xl_srl:
- srl xh, xl
- sll xl, xl
- j .Lmul_xnormalized
-
-.Lmul_yexpzero:
- /* Clear the sign bit of y. */
- slli yh, yh, 1
- srli yh, yh, 1
-
- /* If y is zero, return zero. */
- or a10, yh, yl
- beqz a10, .Lmul_return_zero
-
- /* Normalize y. Adjust the exponent in a9. */
- beqz yh, .Lmul_yh_zero
- do_nsau a10, yh, a11, a12
- addi a10, a10, -11
- ssl a10
- src yh, yh, yl
- sll yl, yl
- movi a9, 1
- sub a9, a9, a10
- j .Lmul_ynormalized
-.Lmul_yh_zero:
- do_nsau a10, yl, a11, a12
- addi a10, a10, -11
- movi a9, -31
- sub a9, a9, a10
- ssl a10
- bltz a10, .Lmul_yl_srl
- sll yh, yl
- movi yl, 0
- j .Lmul_ynormalized
-.Lmul_yl_srl:
- srl yh, yl
- sll yl, yl
- j .Lmul_ynormalized
-
-.Lmul_return_zero:
- /* Return zero with the appropriate sign bit. */
- srli xh, a7, 31
- slli xh, xh, 31
- movi xl, 0
- j .Lmul_done
-
-.Lmul_xnan_or_inf:
- /* If y is zero, return NaN. */
- bnez yl, 1f
- slli a8, yh, 1
- bnez a8, 1f
- movi a4, 0x80000 /* make it a quiet NaN */
- or xh, xh, a4
- j .Lmul_done
-1:
- /* If y is NaN, return y. */
- bnall yh, a6, .Lmul_returnx
- slli a8, yh, 12
- or a8, a8, yl
- beqz a8, .Lmul_returnx
-
-.Lmul_returny:
- mov xh, yh
- mov xl, yl
-
-.Lmul_returnx:
- /* Set the sign bit and return. */
- extui a7, a7, 31, 1
- slli xh, xh, 1
- ssai 1
- src xh, a7, xh
- j .Lmul_done
-
-.Lmul_ynan_or_inf:
- /* If x is zero, return NaN. */
- bnez xl, .Lmul_returny
- slli a8, xh, 1
- bnez a8, .Lmul_returny
- movi a7, 0x80000 /* make it a quiet NaN */
- or xh, yh, a7
- j .Lmul_done
-
- .align 4
- .global __muldf3
- .type __muldf3, @function
-__muldf3:
-#if __XTENSA_CALL0_ABI__
- leaf_entry sp, 32
- addi sp, sp, -32
- s32i a12, sp, 16
- s32i a13, sp, 20
- s32i a14, sp, 24
- s32i a15, sp, 28
-#elif XCHAL_NO_MUL
- /* This is not really a leaf function; allocate enough stack space
- to allow CALL12s to a helper function. */
- leaf_entry sp, 64
-#else
- leaf_entry sp, 32
-#endif
- movi a6, 0x7ff00000
-
- /* Get the sign of the result. */
- xor a7, xh, yh
-
- /* Check for NaN and infinity. */
- ball xh, a6, .Lmul_xnan_or_inf
- ball yh, a6, .Lmul_ynan_or_inf
-
- /* Extract the exponents. */
- extui a8, xh, 20, 11
- extui a9, yh, 20, 11
-
- beqz a8, .Lmul_xexpzero
-.Lmul_xnormalized:
- beqz a9, .Lmul_yexpzero
-.Lmul_ynormalized:
-
- /* Add the exponents. */
- add a8, a8, a9
-
- /* Replace sign/exponent fields with explicit "1.0". */
- movi a10, 0x1fffff
- or xh, xh, a6
- and xh, xh, a10
- or yh, yh, a6
- and yh, yh, a10
-
- /* Multiply 64x64 to 128 bits. The result ends up in xh/xl/a6.
- The least-significant word of the result is thrown away except
- that if it is nonzero, the lsb of a6 is set to 1. */
-#if XCHAL_HAVE_MUL32_HIGH
-
- /* Compute a6 with any carry-outs in a10. */
- movi a10, 0
- mull a6, xl, yh
- mull a11, xh, yl
- add a6, a6, a11
- bgeu a6, a11, 1f
- addi a10, a10, 1
-1:
- muluh a11, xl, yl
- add a6, a6, a11
- bgeu a6, a11, 1f
- addi a10, a10, 1
-1:
- /* If the low word of the result is nonzero, set the lsb of a6. */
- mull a11, xl, yl
- beqz a11, 1f
- movi a9, 1
- or a6, a6, a9
-1:
- /* Compute xl with any carry-outs in a9. */
- movi a9, 0
- mull a11, xh, yh
- add a10, a10, a11
- bgeu a10, a11, 1f
- addi a9, a9, 1
-1:
- muluh a11, xh, yl
- add a10, a10, a11
- bgeu a10, a11, 1f
- addi a9, a9, 1
-1:
- muluh xl, xl, yh
- add xl, xl, a10
- bgeu xl, a10, 1f
- addi a9, a9, 1
-1:
- /* Compute xh. */
- muluh xh, xh, yh
- add xh, xh, a9
-
-#else /* ! XCHAL_HAVE_MUL32_HIGH */
-
- /* Break the inputs into 16-bit chunks and compute 16 32-bit partial
- products. These partial products are:
-
- 0 xll * yll
-
- 1 xll * ylh
- 2 xlh * yll
-
- 3 xll * yhl
- 4 xlh * ylh
- 5 xhl * yll
-
- 6 xll * yhh
- 7 xlh * yhl
- 8 xhl * ylh
- 9 xhh * yll
-
- 10 xlh * yhh
- 11 xhl * yhl
- 12 xhh * ylh
-
- 13 xhl * yhh
- 14 xhh * yhl
-
- 15 xhh * yhh
-
- where the input chunks are (hh, hl, lh, ll). If using the Mul16
- or Mul32 multiplier options, these input chunks must be stored in
- separate registers. For Mac16, the UMUL.AA.* opcodes can specify
- that the inputs come from either half of the registers, so there
- is no need to shift them out ahead of time. If there is no
- multiply hardware, the 16-bit chunks can be extracted when setting
- up the arguments to the separate multiply function. */
-
- /* Save a7 since it is needed to hold a temporary value. */
- s32i a7, sp, 4
-#if __XTENSA_CALL0_ABI__ && XCHAL_NO_MUL
- /* Calling a separate multiply function will clobber a0 and requires
- use of a8 as a temporary, so save those values now. (The function
- uses a custom ABI so nothing else needs to be saved.) */
- s32i a0, sp, 0
- s32i a8, sp, 8
-#endif
-
-#if XCHAL_HAVE_MUL16 || XCHAL_HAVE_MUL32
-
-#define xlh a12
-#define ylh a13
-#define xhh a14
-#define yhh a15
-
- /* Get the high halves of the inputs into registers. */
- srli xlh, xl, 16
- srli ylh, yl, 16
- srli xhh, xh, 16
- srli yhh, yh, 16
-
-#define xll xl
-#define yll yl
-#define xhl xh
-#define yhl yh
-
-#if XCHAL_HAVE_MUL32 && !XCHAL_HAVE_MUL16
- /* Clear the high halves of the inputs. This does not matter
- for MUL16 because the high bits are ignored. */
- extui xl, xl, 0, 16
- extui xh, xh, 0, 16
- extui yl, yl, 0, 16
- extui yh, yh, 0, 16
-#endif
-#endif /* MUL16 || MUL32 */
-
-
-#if XCHAL_HAVE_MUL16
-
-#define do_mul(dst, xreg, xhalf, yreg, yhalf) \
- mul16u dst, xreg ## xhalf, yreg ## yhalf
-
-#elif XCHAL_HAVE_MUL32
-
-#define do_mul(dst, xreg, xhalf, yreg, yhalf) \
- mull dst, xreg ## xhalf, yreg ## yhalf
-
-#elif XCHAL_HAVE_MAC16
-
-/* The preprocessor insists on inserting a space when concatenating after
- a period in the definition of do_mul below. These macros are a workaround
- using underscores instead of periods when doing the concatenation. */
-#define umul_aa_ll umul.aa.ll
-#define umul_aa_lh umul.aa.lh
-#define umul_aa_hl umul.aa.hl
-#define umul_aa_hh umul.aa.hh
-
-#define do_mul(dst, xreg, xhalf, yreg, yhalf) \
- umul_aa_ ## xhalf ## yhalf xreg, yreg; \
- rsr dst, ACCLO
-
-#else /* no multiply hardware */
-
-#define set_arg_l(dst, src) \
- extui dst, src, 0, 16
-#define set_arg_h(dst, src) \
- srli dst, src, 16
-
-#if __XTENSA_CALL0_ABI__
-#define do_mul(dst, xreg, xhalf, yreg, yhalf) \
- set_arg_ ## xhalf (a13, xreg); \
- set_arg_ ## yhalf (a14, yreg); \
- call0 .Lmul_mulsi3; \
- mov dst, a12
-#else
-#define do_mul(dst, xreg, xhalf, yreg, yhalf) \
- set_arg_ ## xhalf (a14, xreg); \
- set_arg_ ## yhalf (a15, yreg); \
- call12 .Lmul_mulsi3; \
- mov dst, a14
-#endif /* __XTENSA_CALL0_ABI__ */
-
-#endif /* no multiply hardware */
-
- /* Add pp1 and pp2 into a10 with carry-out in a9. */
- do_mul(a10, xl, l, yl, h) /* pp 1 */
- do_mul(a11, xl, h, yl, l) /* pp 2 */
- movi a9, 0
- add a10, a10, a11
- bgeu a10, a11, 1f
- addi a9, a9, 1
-1:
- /* Initialize a6 with a9/a10 shifted into position. Note that
- this value can be safely incremented without any carry-outs. */
- ssai 16
- src a6, a9, a10
-
- /* Compute the low word into a10. */
- do_mul(a11, xl, l, yl, l) /* pp 0 */
- sll a10, a10
- add a10, a10, a11
- bgeu a10, a11, 1f
- addi a6, a6, 1
-1:
- /* Compute the contributions of pp0-5 to a6, with carry-outs in a9.
- This is good enough to determine the low half of a6, so that any
- nonzero bits from the low word of the result can be collapsed
- into a6, freeing up a register. */
- movi a9, 0
- do_mul(a11, xl, l, yh, l) /* pp 3 */
- add a6, a6, a11
- bgeu a6, a11, 1f
- addi a9, a9, 1
-1:
- do_mul(a11, xl, h, yl, h) /* pp 4 */
- add a6, a6, a11
- bgeu a6, a11, 1f
- addi a9, a9, 1
-1:
- do_mul(a11, xh, l, yl, l) /* pp 5 */
- add a6, a6, a11
- bgeu a6, a11, 1f
- addi a9, a9, 1
-1:
- /* Collapse any nonzero bits from the low word into a6. */
- beqz a10, 1f
- movi a11, 1
- or a6, a6, a11
-1:
- /* Add pp6-9 into a11 with carry-outs in a10. */
- do_mul(a7, xl, l, yh, h) /* pp 6 */
- do_mul(a11, xh, h, yl, l) /* pp 9 */
- movi a10, 0
- add a11, a11, a7
- bgeu a11, a7, 1f
- addi a10, a10, 1
-1:
- do_mul(a7, xl, h, yh, l) /* pp 7 */
- add a11, a11, a7
- bgeu a11, a7, 1f
- addi a10, a10, 1
-1:
- do_mul(a7, xh, l, yl, h) /* pp 8 */
- add a11, a11, a7
- bgeu a11, a7, 1f
- addi a10, a10, 1
-1:
- /* Shift a10/a11 into position, and add low half of a11 to a6. */
- src a10, a10, a11
- add a10, a10, a9
- sll a11, a11
- add a6, a6, a11
- bgeu a6, a11, 1f
- addi a10, a10, 1
-1:
- /* Add pp10-12 into xl with carry-outs in a9. */
- movi a9, 0
- do_mul(xl, xl, h, yh, h) /* pp 10 */
- add xl, xl, a10
- bgeu xl, a10, 1f
- addi a9, a9, 1
-1:
- do_mul(a10, xh, l, yh, l) /* pp 11 */
- add xl, xl, a10
- bgeu xl, a10, 1f
- addi a9, a9, 1
-1:
- do_mul(a10, xh, h, yl, h) /* pp 12 */
- add xl, xl, a10
- bgeu xl, a10, 1f
- addi a9, a9, 1
-1:
- /* Add pp13-14 into a11 with carry-outs in a10. */
- do_mul(a11, xh, l, yh, h) /* pp 13 */
- do_mul(a7, xh, h, yh, l) /* pp 14 */
- movi a10, 0
- add a11, a11, a7
- bgeu a11, a7, 1f
- addi a10, a10, 1
-1:
- /* Shift a10/a11 into position, and add low half of a11 to a6. */
- src a10, a10, a11
- add a10, a10, a9
- sll a11, a11
- add xl, xl, a11
- bgeu xl, a11, 1f
- addi a10, a10, 1
-1:
- /* Compute xh. */
- do_mul(xh, xh, h, yh, h) /* pp 15 */
- add xh, xh, a10
-
- /* Restore values saved on the stack during the multiplication. */
- l32i a7, sp, 4
-#if __XTENSA_CALL0_ABI__ && XCHAL_NO_MUL
- l32i a0, sp, 0
- l32i a8, sp, 8
-#endif
-#endif /* ! XCHAL_HAVE_MUL32_HIGH */
-
- /* Shift left by 12 bits, unless there was a carry-out from the
- multiply, in which case, shift by 11 bits and increment the
- exponent. Note: It is convenient to use the constant 0x3ff
- instead of 0x400 when removing the extra exponent bias (so that
- it is easy to construct 0x7fe for the overflow check). Reverse
- the logic here to decrement the exponent sum by one unless there
- was a carry-out. */
- movi a4, 11
- srli a5, xh, 21 - 12
- bnez a5, 1f
- addi a4, a4, 1
- addi a8, a8, -1
-1: ssl a4
- src xh, xh, xl
- src xl, xl, a6
- sll a6, a6
-
- /* Subtract the extra bias from the exponent sum (plus one to account
- for the explicit "1.0" of the mantissa that will be added to the
- exponent in the final result). */
- movi a4, 0x3ff
- sub a8, a8, a4
-
- /* Check for over/underflow. The value in a8 is one less than the
- final exponent, so values in the range 0..7fd are OK here. */
- slli a4, a4, 1 /* 0x7fe */
- bgeu a8, a4, .Lmul_overflow
-
-.Lmul_round:
- /* Round. */
- bgez a6, .Lmul_rounded
- addi xl, xl, 1
- beqz xl, .Lmul_roundcarry
- slli a6, a6, 1
- beqz a6, .Lmul_exactlyhalf
-
-.Lmul_rounded:
- /* Add the exponent to the mantissa. */
- slli a8, a8, 20
- add xh, xh, a8
-
-.Lmul_addsign:
- /* Add the sign bit. */
- srli a7, a7, 31
- slli a7, a7, 31
- or xh, xh, a7
-
-.Lmul_done:
-#if __XTENSA_CALL0_ABI__
- l32i a12, sp, 16
- l32i a13, sp, 20
- l32i a14, sp, 24
- l32i a15, sp, 28
- addi sp, sp, 32
-#endif
- leaf_return
-
-.Lmul_exactlyhalf:
- /* Round down to the nearest even value. */
- srli xl, xl, 1
- slli xl, xl, 1
- j .Lmul_rounded
-
-.Lmul_roundcarry:
- /* xl is always zero when the rounding increment overflows, so
- there's no need to round it to an even value. */
- addi xh, xh, 1
- /* Overflow is OK -- it will be added to the exponent. */
- j .Lmul_rounded
-
-.Lmul_overflow:
- bltz a8, .Lmul_underflow
- /* Return +/- Infinity. */
- addi a8, a4, 1 /* 0x7ff */
- slli xh, a8, 20
- movi xl, 0
- j .Lmul_addsign
-
-.Lmul_underflow:
- /* Create a subnormal value, where the exponent field contains zero,
- but the effective exponent is 1. The value of a8 is one less than
- the actual exponent, so just negate it to get the shift amount. */
- neg a8, a8
- mov a9, a6
- ssr a8
- bgeui a8, 32, .Lmul_bigshift
-
- /* Shift xh/xl right. Any bits that are shifted out of xl are saved
- in a6 (combined with the shifted-out bits currently in a6) for
- rounding the result. */
- sll a6, xl
- src xl, xh, xl
- srl xh, xh
- j 1f
-
-.Lmul_bigshift:
- bgeui a8, 64, .Lmul_flush_to_zero
- sll a10, xl /* lost bits shifted out of xl */
- src a6, xh, xl
- srl xl, xh
- movi xh, 0
- or a9, a9, a10
-
- /* Set the exponent to zero. */
-1: movi a8, 0
-
- /* Pack any nonzero bits shifted out into a6. */
- beqz a9, .Lmul_round
- movi a9, 1
- or a6, a6, a9
- j .Lmul_round
-
-.Lmul_flush_to_zero:
- /* Return zero with the appropriate sign bit. */
- srli xh, a7, 31
- slli xh, xh, 31
- movi xl, 0
- j .Lmul_done
-
-#if XCHAL_NO_MUL
-
- /* For Xtensa processors with no multiply hardware, this simplified
- version of _mulsi3 is used for multiplying 16-bit chunks of
- the floating-point mantissas. When using CALL0, this function
- uses a custom ABI: the inputs are passed in a13 and a14, the
- result is returned in a12, and a8 and a15 are clobbered. */
- .align 4
-.Lmul_mulsi3:
- leaf_entry sp, 16
- .macro mul_mulsi3_body dst, src1, src2, tmp1, tmp2
- movi \dst, 0
-1: add \tmp1, \src2, \dst
- extui \tmp2, \src1, 0, 1
- movnez \dst, \tmp1, \tmp2
-
- do_addx2 \tmp1, \src2, \dst, \tmp1
- extui \tmp2, \src1, 1, 1
- movnez \dst, \tmp1, \tmp2
-
- do_addx4 \tmp1, \src2, \dst, \tmp1
- extui \tmp2, \src1, 2, 1
- movnez \dst, \tmp1, \tmp2
-
- do_addx8 \tmp1, \src2, \dst, \tmp1
- extui \tmp2, \src1, 3, 1
- movnez \dst, \tmp1, \tmp2
-
- srli \src1, \src1, 4
- slli \src2, \src2, 4
- bnez \src1, 1b
- .endm
-#if __XTENSA_CALL0_ABI__
- mul_mulsi3_body a12, a13, a14, a15, a8
-#else
- /* The result will be written into a2, so save that argument in a4. */
- mov a4, a2
- mul_mulsi3_body a2, a4, a3, a5, a6
-#endif
- leaf_return
-#endif /* XCHAL_NO_MUL */
-#endif /* L_muldf3 */
-
-#ifdef L_divdf3
-
- /* Division */
-__divdf3_aux:
-
- /* Handle unusual cases (zeros, subnormals, NaNs and Infinities).
- (This code is placed before the start of the function just to
- keep it in range of the limited branch displacements.) */
-
-.Ldiv_yexpzero:
- /* Clear the sign bit of y. */
- slli yh, yh, 1
- srli yh, yh, 1
-
- /* Check for division by zero. */
- or a10, yh, yl
- beqz a10, .Ldiv_yzero
-
- /* Normalize y. Adjust the exponent in a9. */
- beqz yh, .Ldiv_yh_zero
- do_nsau a10, yh, a11, a9
- addi a10, a10, -11
- ssl a10
- src yh, yh, yl
- sll yl, yl
- movi a9, 1
- sub a9, a9, a10
- j .Ldiv_ynormalized
-.Ldiv_yh_zero:
- do_nsau a10, yl, a11, a9
- addi a10, a10, -11
- movi a9, -31
- sub a9, a9, a10
- ssl a10
- bltz a10, .Ldiv_yl_srl
- sll yh, yl
- movi yl, 0
- j .Ldiv_ynormalized
-.Ldiv_yl_srl:
- srl yh, yl
- sll yl, yl
- j .Ldiv_ynormalized
-
-.Ldiv_yzero:
- /* y is zero. Return NaN if x is also zero; otherwise, infinity. */
- slli xh, xh, 1
- srli xh, xh, 1
- or xl, xl, xh
- srli xh, a7, 31
- slli xh, xh, 31
- or xh, xh, a6
- bnez xl, 1f
- movi a4, 0x80000 /* make it a quiet NaN */
- or xh, xh, a4
-1: movi xl, 0
- leaf_return
-
-.Ldiv_xexpzero:
- /* Clear the sign bit of x. */
- slli xh, xh, 1
- srli xh, xh, 1
-
- /* If x is zero, return zero. */
- or a10, xh, xl
- beqz a10, .Ldiv_return_zero
-
- /* Normalize x. Adjust the exponent in a8. */
- beqz xh, .Ldiv_xh_zero
- do_nsau a10, xh, a11, a8
- addi a10, a10, -11
- ssl a10
- src xh, xh, xl
- sll xl, xl
- movi a8, 1
- sub a8, a8, a10
- j .Ldiv_xnormalized
-.Ldiv_xh_zero:
- do_nsau a10, xl, a11, a8
- addi a10, a10, -11
- movi a8, -31
- sub a8, a8, a10
- ssl a10
- bltz a10, .Ldiv_xl_srl
- sll xh, xl
- movi xl, 0
- j .Ldiv_xnormalized
-.Ldiv_xl_srl:
- srl xh, xl
- sll xl, xl
- j .Ldiv_xnormalized
-
-.Ldiv_return_zero:
- /* Return zero with the appropriate sign bit. */
- srli xh, a7, 31
- slli xh, xh, 31
- movi xl, 0
- leaf_return
-
-.Ldiv_xnan_or_inf:
- /* Set the sign bit of the result. */
- srli a7, yh, 31
- slli a7, a7, 31
- xor xh, xh, a7
- /* If y is NaN or Inf, return NaN. */
- bnall yh, a6, 1f
- movi a4, 0x80000 /* make it a quiet NaN */
- or xh, xh, a4
-1: leaf_return
-
-.Ldiv_ynan_or_inf:
- /* If y is Infinity, return zero. */
- slli a8, yh, 12
- or a8, a8, yl
- beqz a8, .Ldiv_return_zero
- /* y is NaN; return it. */
- mov xh, yh
- mov xl, yl
- leaf_return
-
-.Ldiv_highequal1:
- bltu xl, yl, 2f
- j 3f
-
- .align 4
- .global __divdf3
- .type __divdf3, @function
-__divdf3:
- leaf_entry sp, 16
- movi a6, 0x7ff00000
-
- /* Get the sign of the result. */
- xor a7, xh, yh
-
- /* Check for NaN and infinity. */
- ball xh, a6, .Ldiv_xnan_or_inf
- ball yh, a6, .Ldiv_ynan_or_inf
-
- /* Extract the exponents. */
- extui a8, xh, 20, 11
- extui a9, yh, 20, 11
-
- beqz a9, .Ldiv_yexpzero
-.Ldiv_ynormalized:
- beqz a8, .Ldiv_xexpzero
-.Ldiv_xnormalized:
-
- /* Subtract the exponents. */
- sub a8, a8, a9
-
- /* Replace sign/exponent fields with explicit "1.0". */
- movi a10, 0x1fffff
- or xh, xh, a6
- and xh, xh, a10
- or yh, yh, a6
- and yh, yh, a10
-
- /* Set SAR for left shift by one. */
- ssai (32 - 1)
-
- /* The first digit of the mantissa division must be a one.
- Shift x (and adjust the exponent) as needed to make this true. */
- bltu yh, xh, 3f
- beq yh, xh, .Ldiv_highequal1
-2: src xh, xh, xl
- sll xl, xl
- addi a8, a8, -1
-3:
- /* Do the first subtraction and shift. */
- sub xh, xh, yh
- bgeu xl, yl, 1f
- addi xh, xh, -1
-1: sub xl, xl, yl
- src xh, xh, xl
- sll xl, xl
-
- /* Put the quotient into a10/a11. */
- movi a10, 0
- movi a11, 1
-
- /* Divide one bit at a time for 52 bits. */
- movi a9, 52
-#if XCHAL_HAVE_LOOPS
- loop a9, .Ldiv_loopend
-#endif
-.Ldiv_loop:
- /* Shift the quotient << 1. */
- src a10, a10, a11
- sll a11, a11
-
- /* Is this digit a 0 or 1? */
- bltu xh, yh, 3f
- beq xh, yh, .Ldiv_highequal2
-
- /* Output a 1 and subtract. */
-2: addi a11, a11, 1
- sub xh, xh, yh
- bgeu xl, yl, 1f
- addi xh, xh, -1
-1: sub xl, xl, yl
-
- /* Shift the dividend << 1. */
-3: src xh, xh, xl
- sll xl, xl
-
-#if !XCHAL_HAVE_LOOPS
- addi a9, a9, -1
- bnez a9, .Ldiv_loop
-#endif
-.Ldiv_loopend:
-
- /* Add the exponent bias (less one to account for the explicit "1.0"
- of the mantissa that will be added to the exponent in the final
- result). */
- movi a9, 0x3fe
- add a8, a8, a9
-
- /* Check for over/underflow. The value in a8 is one less than the
- final exponent, so values in the range 0..7fd are OK here. */
- addmi a9, a9, 0x400 /* 0x7fe */
- bgeu a8, a9, .Ldiv_overflow
-
-.Ldiv_round:
- /* Round. The remainder (<< 1) is in xh/xl. */
- bltu xh, yh, .Ldiv_rounded
- beq xh, yh, .Ldiv_highequal3
-.Ldiv_roundup:
- addi a11, a11, 1
- beqz a11, .Ldiv_roundcarry
-
-.Ldiv_rounded:
- mov xl, a11
- /* Add the exponent to the mantissa. */
- slli a8, a8, 20
- add xh, a10, a8
-
-.Ldiv_addsign:
- /* Add the sign bit. */
- srli a7, a7, 31
- slli a7, a7, 31
- or xh, xh, a7
- leaf_return
-
-.Ldiv_highequal2:
- bgeu xl, yl, 2b
- j 3b
-
-.Ldiv_highequal3:
- bltu xl, yl, .Ldiv_rounded
- bne xl, yl, .Ldiv_roundup
-
- /* Remainder is exactly half the divisor. Round even. */
- addi a11, a11, 1
- beqz a11, .Ldiv_roundcarry
- srli a11, a11, 1
- slli a11, a11, 1
- j .Ldiv_rounded
-
-.Ldiv_overflow:
- bltz a8, .Ldiv_underflow
- /* Return +/- Infinity. */
- addi a8, a9, 1 /* 0x7ff */
- slli xh, a8, 20
- movi xl, 0
- j .Ldiv_addsign
-
-.Ldiv_underflow:
- /* Create a subnormal value, where the exponent field contains zero,
- but the effective exponent is 1. The value of a8 is one less than
- the actual exponent, so just negate it to get the shift amount. */
- neg a8, a8
- ssr a8
- bgeui a8, 32, .Ldiv_bigshift
-
- /* Shift a10/a11 right. Any bits that are shifted out of a11 are
- saved in a6 for rounding the result. */
- sll a6, a11
- src a11, a10, a11
- srl a10, a10
- j 1f
-
-.Ldiv_bigshift:
- bgeui a8, 64, .Ldiv_flush_to_zero
- sll a9, a11 /* lost bits shifted out of a11 */
- src a6, a10, a11
- srl a11, a10
- movi a10, 0
- or xl, xl, a9
-
- /* Set the exponent to zero. */
-1: movi a8, 0
-
- /* Pack any nonzero remainder (in xh/xl) into a6. */
- or xh, xh, xl
- beqz xh, 1f
- movi a9, 1
- or a6, a6, a9
-
- /* Round a10/a11 based on the bits shifted out into a6. */
-1: bgez a6, .Ldiv_rounded
- addi a11, a11, 1
- beqz a11, .Ldiv_roundcarry
- slli a6, a6, 1
- bnez a6, .Ldiv_rounded
- srli a11, a11, 1
- slli a11, a11, 1
- j .Ldiv_rounded
-
-.Ldiv_roundcarry:
- /* a11 is always zero when the rounding increment overflows, so
- there's no need to round it to an even value. */
- addi a10, a10, 1
- /* Overflow to the exponent field is OK. */
- j .Ldiv_rounded
-
-.Ldiv_flush_to_zero:
- /* Return zero with the appropriate sign bit. */
- srli xh, a7, 31
- slli xh, xh, 31
- movi xl, 0
- leaf_return
-
-#endif /* L_divdf3 */
-
-#ifdef L_cmpdf2
-
- /* Equal and Not Equal */
-
- .align 4
- .global __eqdf2
- .global __nedf2
- .set __nedf2, __eqdf2
- .type __eqdf2, @function
-__eqdf2:
- leaf_entry sp, 16
- bne xl, yl, 2f
- bne xh, yh, 4f
-
- /* The values are equal but NaN != NaN. Check the exponent. */
- movi a6, 0x7ff00000
- ball xh, a6, 3f
-
- /* Equal. */
- movi a2, 0
- leaf_return
-
- /* Not equal. */
-2: movi a2, 1
- leaf_return
-
- /* Check if the mantissas are nonzero. */
-3: slli a7, xh, 12
- or a7, a7, xl
- j 5f
-
- /* Check if x and y are zero with different signs. */
-4: or a7, xh, yh
- slli a7, a7, 1
- or a7, a7, xl /* xl == yl here */
-
- /* Equal if a7 == 0, where a7 is either abs(x | y) or the mantissa
- or x when exponent(x) = 0x7ff and x == y. */
-5: movi a2, 0
- movi a3, 1
- movnez a2, a3, a7
- leaf_return
-
-
- /* Greater Than */
-
- .align 4
- .global __gtdf2
- .type __gtdf2, @function
-__gtdf2:
- leaf_entry sp, 16
- movi a6, 0x7ff00000
- ball xh, a6, 2f
-1: bnall yh, a6, .Lle_cmp
-
- /* Check if y is a NaN. */
- slli a7, yh, 12
- or a7, a7, yl
- beqz a7, .Lle_cmp
- movi a2, 0
- leaf_return
-
- /* Check if x is a NaN. */
-2: slli a7, xh, 12
- or a7, a7, xl
- beqz a7, 1b
- movi a2, 0
- leaf_return
-
-
- /* Less Than or Equal */
-
- .align 4
- .global __ledf2
- .type __ledf2, @function
-__ledf2:
- leaf_entry sp, 16
- movi a6, 0x7ff00000
- ball xh, a6, 2f
-1: bnall yh, a6, .Lle_cmp
-
- /* Check if y is a NaN. */
- slli a7, yh, 12
- or a7, a7, yl
- beqz a7, .Lle_cmp
- movi a2, 1
- leaf_return
-
- /* Check if x is a NaN. */
-2: slli a7, xh, 12
- or a7, a7, xl
- beqz a7, 1b
- movi a2, 1
- leaf_return
-
-.Lle_cmp:
- /* Check if x and y have different signs. */
- xor a7, xh, yh
- bltz a7, .Lle_diff_signs
-
- /* Check if x is negative. */
- bltz xh, .Lle_xneg
-
- /* Check if x <= y. */
- bltu xh, yh, 4f
- bne xh, yh, 5f
- bltu yl, xl, 5f
-4: movi a2, 0
- leaf_return
-
-.Lle_xneg:
- /* Check if y <= x. */
- bltu yh, xh, 4b
- bne yh, xh, 5f
- bgeu xl, yl, 4b
-5: movi a2, 1
- leaf_return
-
-.Lle_diff_signs:
- bltz xh, 4b
-
- /* Check if both x and y are zero. */
- or a7, xh, yh
- slli a7, a7, 1
- or a7, a7, xl
- or a7, a7, yl
- movi a2, 1
- movi a3, 0
- moveqz a2, a3, a7
- leaf_return
-
-
- /* Greater Than or Equal */
-
- .align 4
- .global __gedf2
- .type __gedf2, @function
-__gedf2:
- leaf_entry sp, 16
- movi a6, 0x7ff00000
- ball xh, a6, 2f
-1: bnall yh, a6, .Llt_cmp
-
- /* Check if y is a NaN. */
- slli a7, yh, 12
- or a7, a7, yl
- beqz a7, .Llt_cmp
- movi a2, -1
- leaf_return
-
- /* Check if x is a NaN. */
-2: slli a7, xh, 12
- or a7, a7, xl
- beqz a7, 1b
- movi a2, -1
- leaf_return
-
-
- /* Less Than */
-
- .align 4
- .global __ltdf2
- .type __ltdf2, @function
-__ltdf2:
- leaf_entry sp, 16
- movi a6, 0x7ff00000
- ball xh, a6, 2f
-1: bnall yh, a6, .Llt_cmp
-
- /* Check if y is a NaN. */
- slli a7, yh, 12
- or a7, a7, yl
- beqz a7, .Llt_cmp
- movi a2, 0
- leaf_return
-
- /* Check if x is a NaN. */
-2: slli a7, xh, 12
- or a7, a7, xl
- beqz a7, 1b
- movi a2, 0
- leaf_return
-
-.Llt_cmp:
- /* Check if x and y have different signs. */
- xor a7, xh, yh
- bltz a7, .Llt_diff_signs
-
- /* Check if x is negative. */
- bltz xh, .Llt_xneg
-
- /* Check if x < y. */
- bltu xh, yh, 4f
- bne xh, yh, 5f
- bgeu xl, yl, 5f
-4: movi a2, -1
- leaf_return
-
-.Llt_xneg:
- /* Check if y < x. */
- bltu yh, xh, 4b
- bne yh, xh, 5f
- bltu yl, xl, 4b
-5: movi a2, 0
- leaf_return
-
-.Llt_diff_signs:
- bgez xh, 5b
-
- /* Check if both x and y are nonzero. */
- or a7, xh, yh
- slli a7, a7, 1
- or a7, a7, xl
- or a7, a7, yl
- movi a2, 0
- movi a3, -1
- movnez a2, a3, a7
- leaf_return
-
-
- /* Unordered */
-
- .align 4
- .global __unorddf2
- .type __unorddf2, @function
-__unorddf2:
- leaf_entry sp, 16
- movi a6, 0x7ff00000
- ball xh, a6, 3f
-1: ball yh, a6, 4f
-2: movi a2, 0
- leaf_return
-
-3: slli a7, xh, 12
- or a7, a7, xl
- beqz a7, 1b
- movi a2, 1
- leaf_return
-
-4: slli a7, yh, 12
- or a7, a7, yl
- beqz a7, 2b
- movi a2, 1
- leaf_return
-
-#endif /* L_cmpdf2 */
-
-#ifdef L_fixdfsi
-
- .align 4
- .global __fixdfsi
- .type __fixdfsi, @function
-__fixdfsi:
- leaf_entry sp, 16
-
- /* Check for NaN and Infinity. */
- movi a6, 0x7ff00000
- ball xh, a6, .Lfixdfsi_nan_or_inf
-
- /* Extract the exponent and check if 0 < (exp - 0x3fe) < 32. */
- extui a4, xh, 20, 11
- extui a5, a6, 19, 10 /* 0x3fe */
- sub a4, a4, a5
- bgei a4, 32, .Lfixdfsi_maxint
- blti a4, 1, .Lfixdfsi_zero
-
- /* Add explicit "1.0" and shift << 11. */
- or a7, xh, a6
- ssai (32 - 11)
- src a5, a7, xl
-
- /* Shift back to the right, based on the exponent. */
- ssl a4 /* shift by 32 - a4 */
- srl a5, a5
-
- /* Negate the result if sign != 0. */
- neg a2, a5
- movgez a2, a5, a7
- leaf_return
-
-.Lfixdfsi_nan_or_inf:
- /* Handle Infinity and NaN. */
- slli a4, xh, 12
- or a4, a4, xl
- beqz a4, .Lfixdfsi_maxint
-
- /* Translate NaN to +maxint. */
- movi xh, 0
-
-.Lfixdfsi_maxint:
- slli a4, a6, 11 /* 0x80000000 */
- addi a5, a4, -1 /* 0x7fffffff */
- movgez a4, a5, xh
- mov a2, a4
- leaf_return
-
-.Lfixdfsi_zero:
- movi a2, 0
- leaf_return
-
-#endif /* L_fixdfsi */
-
-#ifdef L_fixdfdi
-
- .align 4
- .global __fixdfdi
- .type __fixdfdi, @function
-__fixdfdi:
- leaf_entry sp, 16
-
- /* Check for NaN and Infinity. */
- movi a6, 0x7ff00000
- ball xh, a6, .Lfixdfdi_nan_or_inf
-
- /* Extract the exponent and check if 0 < (exp - 0x3fe) < 64. */
- extui a4, xh, 20, 11
- extui a5, a6, 19, 10 /* 0x3fe */
- sub a4, a4, a5
- bgei a4, 64, .Lfixdfdi_maxint
- blti a4, 1, .Lfixdfdi_zero
-
- /* Add explicit "1.0" and shift << 11. */
- or a7, xh, a6
- ssai (32 - 11)
- src xh, a7, xl
- sll xl, xl
-
- /* Shift back to the right, based on the exponent. */
- ssl a4 /* shift by 64 - a4 */
- bgei a4, 32, .Lfixdfdi_smallshift
- srl xl, xh
- movi xh, 0
-
-.Lfixdfdi_shifted:
- /* Negate the result if sign != 0. */
- bgez a7, 1f
- neg xl, xl
- neg xh, xh
- beqz xl, 1f
- addi xh, xh, -1
-1: leaf_return
-
-.Lfixdfdi_smallshift:
- src xl, xh, xl
- srl xh, xh
- j .Lfixdfdi_shifted
-
-.Lfixdfdi_nan_or_inf:
- /* Handle Infinity and NaN. */
- slli a4, xh, 12
- or a4, a4, xl
- beqz a4, .Lfixdfdi_maxint
-
- /* Translate NaN to +maxint. */
- movi xh, 0
-
-.Lfixdfdi_maxint:
- slli a7, a6, 11 /* 0x80000000 */
- bgez xh, 1f
- mov xh, a7
- movi xl, 0
- leaf_return
-
-1: addi xh, a7, -1 /* 0x7fffffff */
- movi xl, -1
- leaf_return
-
-.Lfixdfdi_zero:
- movi xh, 0
- movi xl, 0
- leaf_return
-
-#endif /* L_fixdfdi */
-
-#ifdef L_fixunsdfsi
-
- .align 4
- .global __fixunsdfsi
- .type __fixunsdfsi, @function
-__fixunsdfsi:
- leaf_entry sp, 16
-
- /* Check for NaN and Infinity. */
- movi a6, 0x7ff00000
- ball xh, a6, .Lfixunsdfsi_nan_or_inf
-
- /* Extract the exponent and check if 0 <= (exp - 0x3ff) < 32. */
- extui a4, xh, 20, 11
- extui a5, a6, 20, 10 /* 0x3ff */
- sub a4, a4, a5
- bgei a4, 32, .Lfixunsdfsi_maxint
- bltz a4, .Lfixunsdfsi_zero
-
- /* Add explicit "1.0" and shift << 11. */
- or a7, xh, a6
- ssai (32 - 11)
- src a5, a7, xl
-
- /* Shift back to the right, based on the exponent. */
- addi a4, a4, 1
- beqi a4, 32, .Lfixunsdfsi_bigexp
- ssl a4 /* shift by 32 - a4 */
- srl a5, a5
-
- /* Negate the result if sign != 0. */
- neg a2, a5
- movgez a2, a5, a7
- leaf_return
-
-.Lfixunsdfsi_nan_or_inf:
- /* Handle Infinity and NaN. */
- slli a4, xh, 12
- or a4, a4, xl
- beqz a4, .Lfixunsdfsi_maxint
-
- /* Translate NaN to 0xffffffff. */
- movi a2, -1
- leaf_return
-
-.Lfixunsdfsi_maxint:
- slli a4, a6, 11 /* 0x80000000 */
- movi a5, -1 /* 0xffffffff */
- movgez a4, a5, xh
- mov a2, a4
- leaf_return
-
-.Lfixunsdfsi_zero:
- movi a2, 0
- leaf_return
-
-.Lfixunsdfsi_bigexp:
- /* Handle unsigned maximum exponent case. */
- bltz xh, 1f
- mov a2, a5 /* no shift needed */
- leaf_return
-
- /* Return 0x80000000 if negative. */
-1: slli a2, a6, 11
- leaf_return
-
-#endif /* L_fixunsdfsi */
-
-#ifdef L_fixunsdfdi
-
- .align 4
- .global __fixunsdfdi
- .type __fixunsdfdi, @function
-__fixunsdfdi:
- leaf_entry sp, 16
-
- /* Check for NaN and Infinity. */
- movi a6, 0x7ff00000
- ball xh, a6, .Lfixunsdfdi_nan_or_inf
-
- /* Extract the exponent and check if 0 <= (exp - 0x3ff) < 64. */
- extui a4, xh, 20, 11
- extui a5, a6, 20, 10 /* 0x3ff */
- sub a4, a4, a5
- bgei a4, 64, .Lfixunsdfdi_maxint
- bltz a4, .Lfixunsdfdi_zero
-
- /* Add explicit "1.0" and shift << 11. */
- or a7, xh, a6
- ssai (32 - 11)
- src xh, a7, xl
- sll xl, xl
-
- /* Shift back to the right, based on the exponent. */
- addi a4, a4, 1
- beqi a4, 64, .Lfixunsdfdi_bigexp
- ssl a4 /* shift by 64 - a4 */
- bgei a4, 32, .Lfixunsdfdi_smallshift
- srl xl, xh
- movi xh, 0
-
-.Lfixunsdfdi_shifted:
- /* Negate the result if sign != 0. */
- bgez a7, 1f
- neg xl, xl
- neg xh, xh
- beqz xl, 1f
- addi xh, xh, -1
-1: leaf_return
-
-.Lfixunsdfdi_smallshift:
- src xl, xh, xl
- srl xh, xh
- j .Lfixunsdfdi_shifted
-
-.Lfixunsdfdi_nan_or_inf:
- /* Handle Infinity and NaN. */
- slli a4, xh, 12
- or a4, a4, xl
- beqz a4, .Lfixunsdfdi_maxint
-
- /* Translate NaN to 0xffffffff.... */
-1: movi xh, -1
- movi xl, -1
- leaf_return
-
-.Lfixunsdfdi_maxint:
- bgez xh, 1b
-2: slli xh, a6, 11 /* 0x80000000 */
- movi xl, 0
- leaf_return
-
-.Lfixunsdfdi_zero:
- movi xh, 0
- movi xl, 0
- leaf_return
-
-.Lfixunsdfdi_bigexp:
- /* Handle unsigned maximum exponent case. */
- bltz a7, 2b
- leaf_return /* no shift needed */
-
-#endif /* L_fixunsdfdi */
-
-#ifdef L_floatsidf
-
- .align 4
- .global __floatunsidf
- .type __floatunsidf, @function
-__floatunsidf:
- leaf_entry sp, 16
- beqz a2, .Lfloatsidf_return_zero
-
- /* Set the sign to zero and jump to the floatsidf code. */
- movi a7, 0
- j .Lfloatsidf_normalize
-
- .align 4
- .global __floatsidf
- .type __floatsidf, @function
-__floatsidf:
- leaf_entry sp, 16
-
- /* Check for zero. */
- beqz a2, .Lfloatsidf_return_zero
-
- /* Save the sign. */
- extui a7, a2, 31, 1
-
- /* Get the absolute value. */
-#if XCHAL_HAVE_ABS
- abs a2, a2
-#else
- neg a4, a2
- movltz a2, a4, a2
-#endif
-
-.Lfloatsidf_normalize:
- /* Normalize with the first 1 bit in the msb. */
- do_nsau a4, a2, a5, a6
- ssl a4
- sll a5, a2
-
- /* Shift the mantissa into position. */
- srli xh, a5, 11
- slli xl, a5, (32 - 11)
-
- /* Set the exponent. */
- movi a5, 0x41d /* 0x3fe + 31 */
- sub a5, a5, a4
- slli a5, a5, 20
- add xh, xh, a5
-
- /* Add the sign and return. */
- slli a7, a7, 31
- or xh, xh, a7
- leaf_return
-
-.Lfloatsidf_return_zero:
- movi a3, 0
- leaf_return
-
-#endif /* L_floatsidf */
-
-#ifdef L_floatdidf
-
- .align 4
- .global __floatundidf
- .type __floatundidf, @function
-__floatundidf:
- leaf_entry sp, 16
-
- /* Check for zero. */
- or a4, xh, xl
- beqz a4, 2f
-
- /* Set the sign to zero and jump to the floatdidf code. */
- movi a7, 0
- j .Lfloatdidf_normalize
-
- .align 4
- .global __floatdidf
- .type __floatdidf, @function
-__floatdidf:
- leaf_entry sp, 16
-
- /* Check for zero. */
- or a4, xh, xl
- beqz a4, 2f
-
- /* Save the sign. */
- extui a7, xh, 31, 1
-
- /* Get the absolute value. */
- bgez xh, .Lfloatdidf_normalize
- neg xl, xl
- neg xh, xh
- beqz xl, .Lfloatdidf_normalize
- addi xh, xh, -1
-
-.Lfloatdidf_normalize:
- /* Normalize with the first 1 bit in the msb of xh. */
- beqz xh, .Lfloatdidf_bigshift
- do_nsau a4, xh, a5, a6
- ssl a4
- src xh, xh, xl
- sll xl, xl
-
-.Lfloatdidf_shifted:
- /* Shift the mantissa into position, with rounding bits in a6. */
- ssai 11
- sll a6, xl
- src xl, xh, xl
- srl xh, xh
-
- /* Set the exponent. */
- movi a5, 0x43d /* 0x3fe + 63 */
- sub a5, a5, a4
- slli a5, a5, 20
- add xh, xh, a5
-
- /* Add the sign. */
- slli a7, a7, 31
- or xh, xh, a7
-
- /* Round up if the leftover fraction is >= 1/2. */
- bgez a6, 2f
- addi xl, xl, 1
- beqz xl, .Lfloatdidf_roundcarry
-
- /* Check if the leftover fraction is exactly 1/2. */
- slli a6, a6, 1
- beqz a6, .Lfloatdidf_exactlyhalf
-2: leaf_return
-
-.Lfloatdidf_bigshift:
- /* xh is zero. Normalize with first 1 bit of xl in the msb of xh. */
- do_nsau a4, xl, a5, a6
- ssl a4
- sll xh, xl
- movi xl, 0
- addi a4, a4, 32
- j .Lfloatdidf_shifted
-
-.Lfloatdidf_exactlyhalf:
- /* Round down to the nearest even value. */
- srli xl, xl, 1
- slli xl, xl, 1
- leaf_return
-
-.Lfloatdidf_roundcarry:
- /* xl is always zero when the rounding increment overflows, so
- there's no need to round it to an even value. */
- addi xh, xh, 1
- /* Overflow to the exponent is OK. */
- leaf_return
-
-#endif /* L_floatdidf */
-
-#ifdef L_truncdfsf2
-
- .align 4
- .global __truncdfsf2
- .type __truncdfsf2, @function
-__truncdfsf2:
- leaf_entry sp, 16
-
- /* Adjust the exponent bias. */
- movi a4, (0x3ff - 0x7f) << 20
- sub a5, xh, a4
-
- /* Check for underflow. */
- xor a6, xh, a5
- bltz a6, .Ltrunc_underflow
- extui a6, a5, 20, 11
- beqz a6, .Ltrunc_underflow
-
- /* Check for overflow. */
- movi a4, 255
- bge a6, a4, .Ltrunc_overflow
-
- /* Shift a5/xl << 3 into a5/a4. */
- ssai (32 - 3)
- src a5, a5, xl
- sll a4, xl
-
-.Ltrunc_addsign:
- /* Add the sign bit. */
- extui a6, xh, 31, 1
- slli a6, a6, 31
- or a2, a6, a5
-
- /* Round up if the leftover fraction is >= 1/2. */
- bgez a4, 1f
- addi a2, a2, 1
- /* Overflow to the exponent is OK. The answer will be correct. */
-
- /* Check if the leftover fraction is exactly 1/2. */
- slli a4, a4, 1
- beqz a4, .Ltrunc_exactlyhalf
-1: leaf_return
-
-.Ltrunc_exactlyhalf:
- /* Round down to the nearest even value. */
- srli a2, a2, 1
- slli a2, a2, 1
- leaf_return
-
-.Ltrunc_overflow:
- /* Check if exponent == 0x7ff. */
- movi a4, 0x7ff00000
- bnall xh, a4, 1f
-
- /* Check if mantissa is nonzero. */
- slli a5, xh, 12
- or a5, a5, xl
- beqz a5, 1f
-
- /* Shift a4 to set a bit in the mantissa, making a quiet NaN. */
- srli a4, a4, 1
-
-1: slli a4, a4, 4 /* 0xff000000 or 0xff800000 */
- /* Add the sign bit. */
- extui a6, xh, 31, 1
- ssai 1
- src a2, a6, a4
- leaf_return
-
-.Ltrunc_underflow:
- /* Find shift count for a subnormal. Flush to zero if >= 32. */
- extui a6, xh, 20, 11
- movi a5, 0x3ff - 0x7f
- sub a6, a5, a6
- addi a6, a6, 1
- bgeui a6, 32, 1f
-
- /* Replace the exponent with an explicit "1.0". */
- slli a5, a5, 13 /* 0x700000 */
- or a5, a5, xh
- slli a5, a5, 11
- srli a5, a5, 11
-
- /* Shift the mantissa left by 3 bits (into a5/a4). */
- ssai (32 - 3)
- src a5, a5, xl
- sll a4, xl
-
- /* Shift right by a6. */
- ssr a6
- sll a7, a4
- src a4, a5, a4
- srl a5, a5
- beqz a7, .Ltrunc_addsign
- or a4, a4, a6 /* any positive, nonzero value will work */
- j .Ltrunc_addsign
-
- /* Return +/- zero. */
-1: extui a2, xh, 31, 1
- slli a2, a2, 31
- leaf_return
-
-#endif /* L_truncdfsf2 */
-
-#ifdef L_extendsfdf2
-
- .align 4
- .global __extendsfdf2
- .type __extendsfdf2, @function
-__extendsfdf2:
- leaf_entry sp, 16
-
- /* Save the sign bit and then shift it off. */
- extui a5, a2, 31, 1
- slli a5, a5, 31
- slli a4, a2, 1
-
- /* Extract and check the exponent. */
- extui a6, a2, 23, 8
- beqz a6, .Lextend_expzero
- addi a6, a6, 1
- beqi a6, 256, .Lextend_nan_or_inf
-
- /* Shift >> 3 into a4/xl. */
- srli a4, a4, 4
- slli xl, a2, (32 - 3)
-
- /* Adjust the exponent bias. */
- movi a6, (0x3ff - 0x7f) << 20
- add a4, a4, a6
-
- /* Add the sign bit. */
- or xh, a4, a5
- leaf_return
-
-.Lextend_nan_or_inf:
- movi a4, 0x7ff00000
-
- /* Check for NaN. */
- slli a7, a2, 9
- beqz a7, 1f
-
- slli a6, a6, 11 /* 0x80000 */
- or a4, a4, a6
-
- /* Add the sign and return. */
-1: or xh, a4, a5
- movi xl, 0
- leaf_return
-
-.Lextend_expzero:
- beqz a4, 1b
-
- /* Normalize it to have 8 zero bits before the first 1 bit. */
- do_nsau a7, a4, a2, a3
- addi a7, a7, -8
- ssl a7
- sll a4, a4
-
- /* Shift >> 3 into a4/xl. */
- slli xl, a4, (32 - 3)
- srli a4, a4, 3
-
- /* Set the exponent. */
- movi a6, 0x3fe - 0x7f
- sub a6, a6, a7
- slli a6, a6, 20
- add a4, a4, a6
-
- /* Add the sign and return. */
- or xh, a4, a5
- leaf_return
-
-#endif /* L_extendsfdf2 */
-
-
diff --git a/gcc/config/xtensa/ieee754-sf.S b/gcc/config/xtensa/ieee754-sf.S
deleted file mode 100644
index d75be0e5ae5..00000000000
--- a/gcc/config/xtensa/ieee754-sf.S
+++ /dev/null
@@ -1,1757 +0,0 @@
-/* IEEE-754 single-precision functions for Xtensa
- Copyright (C) 2006, 2007, 2009 Free Software Foundation, Inc.
- Contributed by Bob Wilson (bwilson@tensilica.com) at Tensilica.
-
- 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/>. */
-
-#ifdef __XTENSA_EB__
-#define xh a2
-#define xl a3
-#define yh a4
-#define yl a5
-#else
-#define xh a3
-#define xl a2
-#define yh a5
-#define yl a4
-#endif
-
-/* Warning! The branch displacements for some Xtensa branch instructions
- are quite small, and this code has been carefully laid out to keep
- branch targets in range. If you change anything, be sure to check that
- the assembler is not relaxing anything to branch over a jump. */
-
-#ifdef L_negsf2
-
- .align 4
- .global __negsf2
- .type __negsf2, @function
-__negsf2:
- leaf_entry sp, 16
- movi a4, 0x80000000
- xor a2, a2, a4
- leaf_return
-
-#endif /* L_negsf2 */
-
-#ifdef L_addsubsf3
-
- /* Addition */
-__addsf3_aux:
-
- /* Handle NaNs and Infinities. (This code is placed before the
- start of the function just to keep it in range of the limited
- branch displacements.) */
-
-.Ladd_xnan_or_inf:
- /* If y is neither Infinity nor NaN, return x. */
- bnall a3, a6, 1f
- /* If x is a NaN, return it. Otherwise, return y. */
- slli a7, a2, 9
- beqz a7, .Ladd_ynan_or_inf
-1: leaf_return
-
-.Ladd_ynan_or_inf:
- /* Return y. */
- mov a2, a3
- leaf_return
-
-.Ladd_opposite_signs:
- /* Operand signs differ. Do a subtraction. */
- slli a7, a6, 8
- xor a3, a3, a7
- j .Lsub_same_sign
-
- .align 4
- .global __addsf3
- .type __addsf3, @function
-__addsf3:
- leaf_entry sp, 16
- movi a6, 0x7f800000
-
- /* Check if the two operands have the same sign. */
- xor a7, a2, a3
- bltz a7, .Ladd_opposite_signs
-
-.Ladd_same_sign:
- /* Check if either exponent == 0x7f8 (i.e., NaN or Infinity). */
- ball a2, a6, .Ladd_xnan_or_inf
- ball a3, a6, .Ladd_ynan_or_inf
-
- /* Compare the exponents. The smaller operand will be shifted
- right by the exponent difference and added to the larger
- one. */
- extui a7, a2, 23, 9
- extui a8, a3, 23, 9
- bltu a7, a8, .Ladd_shiftx
-
-.Ladd_shifty:
- /* Check if the smaller (or equal) exponent is zero. */
- bnone a3, a6, .Ladd_yexpzero
-
- /* Replace y sign/exponent with 0x008. */
- or a3, a3, a6
- slli a3, a3, 8
- srli a3, a3, 8
-
-.Ladd_yexpdiff:
- /* Compute the exponent difference. */
- sub a10, a7, a8
-
- /* Exponent difference > 32 -- just return the bigger value. */
- bgeui a10, 32, 1f
-
- /* Shift y right by the exponent difference. Any bits that are
- shifted out of y are saved in a9 for rounding the result. */
- ssr a10
- movi a9, 0
- src a9, a3, a9
- srl a3, a3
-
- /* Do the addition. */
- add a2, a2, a3
-
- /* Check if the add overflowed into the exponent. */
- extui a10, a2, 23, 9
- beq a10, a7, .Ladd_round
- mov a8, a7
- j .Ladd_carry
-
-.Ladd_yexpzero:
- /* y is a subnormal value. Replace its sign/exponent with zero,
- i.e., no implicit "1.0", and increment the apparent exponent
- because subnormals behave as if they had the minimum (nonzero)
- exponent. Test for the case when both exponents are zero. */
- slli a3, a3, 9
- srli a3, a3, 9
- bnone a2, a6, .Ladd_bothexpzero
- addi a8, a8, 1
- j .Ladd_yexpdiff
-
-.Ladd_bothexpzero:
- /* Both exponents are zero. Handle this as a special case. There
- is no need to shift or round, and the normal code for handling
- a carry into the exponent field will not work because it
- assumes there is an implicit "1.0" that needs to be added. */
- add a2, a2, a3
-1: leaf_return
-
-.Ladd_xexpzero:
- /* Same as "yexpzero" except skip handling the case when both
- exponents are zero. */
- slli a2, a2, 9
- srli a2, a2, 9
- addi a7, a7, 1
- j .Ladd_xexpdiff
-
-.Ladd_shiftx:
- /* Same thing as the "shifty" code, but with x and y swapped. Also,
- because the exponent difference is always nonzero in this version,
- the shift sequence can use SLL and skip loading a constant zero. */
- bnone a2, a6, .Ladd_xexpzero
-
- or a2, a2, a6
- slli a2, a2, 8
- srli a2, a2, 8
-
-.Ladd_xexpdiff:
- sub a10, a8, a7
- bgeui a10, 32, .Ladd_returny
-
- ssr a10
- sll a9, a2
- srl a2, a2
-
- add a2, a2, a3
-
- /* Check if the add overflowed into the exponent. */
- extui a10, a2, 23, 9
- bne a10, a8, .Ladd_carry
-
-.Ladd_round:
- /* Round up if the leftover fraction is >= 1/2. */
- bgez a9, 1f
- addi a2, a2, 1
-
- /* Check if the leftover fraction is exactly 1/2. */
- slli a9, a9, 1
- beqz a9, .Ladd_exactlyhalf
-1: leaf_return
-
-.Ladd_returny:
- mov a2, a3
- leaf_return
-
-.Ladd_carry:
- /* The addition has overflowed into the exponent field, so the
- value needs to be renormalized. The mantissa of the result
- can be recovered by subtracting the original exponent and
- adding 0x800000 (which is the explicit "1.0" for the
- mantissa of the non-shifted operand -- the "1.0" for the
- shifted operand was already added). The mantissa can then
- be shifted right by one bit. The explicit "1.0" of the
- shifted mantissa then needs to be replaced by the exponent,
- incremented by one to account for the normalizing shift.
- It is faster to combine these operations: do the shift first
- and combine the additions and subtractions. If x is the
- original exponent, the result is:
- shifted mantissa - (x << 22) + (1 << 22) + (x << 23)
- or:
- shifted mantissa + ((x + 1) << 22)
- Note that the exponent is incremented here by leaving the
- explicit "1.0" of the mantissa in the exponent field. */
-
- /* Shift x right by one bit. Save the lsb. */
- mov a10, a2
- srli a2, a2, 1
-
- /* See explanation above. The original exponent is in a8. */
- addi a8, a8, 1
- slli a8, a8, 22
- add a2, a2, a8
-
- /* Return an Infinity if the exponent overflowed. */
- ball a2, a6, .Ladd_infinity
-
- /* Same thing as the "round" code except the msb of the leftover
- fraction is bit 0 of a10, with the rest of the fraction in a9. */
- bbci.l a10, 0, 1f
- addi a2, a2, 1
- beqz a9, .Ladd_exactlyhalf
-1: leaf_return
-
-.Ladd_infinity:
- /* Clear the mantissa. */
- srli a2, a2, 23
- slli a2, a2, 23
-
- /* The sign bit may have been lost in a carry-out. Put it back. */
- slli a8, a8, 1
- or a2, a2, a8
- leaf_return
-
-.Ladd_exactlyhalf:
- /* Round down to the nearest even value. */
- srli a2, a2, 1
- slli a2, a2, 1
- leaf_return
-
-
- /* Subtraction */
-__subsf3_aux:
-
- /* Handle NaNs and Infinities. (This code is placed before the
- start of the function just to keep it in range of the limited
- branch displacements.) */
-
-.Lsub_xnan_or_inf:
- /* If y is neither Infinity nor NaN, return x. */
- bnall a3, a6, 1f
- /* Both x and y are either NaN or Inf, so the result is NaN. */
- movi a4, 0x400000 /* make it a quiet NaN */
- or a2, a2, a4
-1: leaf_return
-
-.Lsub_ynan_or_inf:
- /* Negate y and return it. */
- slli a7, a6, 8
- xor a2, a3, a7
- leaf_return
-
-.Lsub_opposite_signs:
- /* Operand signs differ. Do an addition. */
- slli a7, a6, 8
- xor a3, a3, a7
- j .Ladd_same_sign
-
- .align 4
- .global __subsf3
- .type __subsf3, @function
-__subsf3:
- leaf_entry sp, 16
- movi a6, 0x7f800000
-
- /* Check if the two operands have the same sign. */
- xor a7, a2, a3
- bltz a7, .Lsub_opposite_signs
-
-.Lsub_same_sign:
- /* Check if either exponent == 0x7f8 (i.e., NaN or Infinity). */
- ball a2, a6, .Lsub_xnan_or_inf
- ball a3, a6, .Lsub_ynan_or_inf
-
- /* Compare the operands. In contrast to addition, the entire
- value matters here. */
- extui a7, a2, 23, 8
- extui a8, a3, 23, 8
- bltu a2, a3, .Lsub_xsmaller
-
-.Lsub_ysmaller:
- /* Check if the smaller (or equal) exponent is zero. */
- bnone a3, a6, .Lsub_yexpzero
-
- /* Replace y sign/exponent with 0x008. */
- or a3, a3, a6
- slli a3, a3, 8
- srli a3, a3, 8
-
-.Lsub_yexpdiff:
- /* Compute the exponent difference. */
- sub a10, a7, a8
-
- /* Exponent difference > 32 -- just return the bigger value. */
- bgeui a10, 32, 1f
-
- /* Shift y right by the exponent difference. Any bits that are
- shifted out of y are saved in a9 for rounding the result. */
- ssr a10
- movi a9, 0
- src a9, a3, a9
- srl a3, a3
-
- sub a2, a2, a3
-
- /* Subtract the leftover bits in a9 from zero and propagate any
- borrow from a2. */
- neg a9, a9
- addi a10, a2, -1
- movnez a2, a10, a9
-
- /* Check if the subtract underflowed into the exponent. */
- extui a10, a2, 23, 8
- beq a10, a7, .Lsub_round
- j .Lsub_borrow
-
-.Lsub_yexpzero:
- /* Return zero if the inputs are equal. (For the non-subnormal
- case, subtracting the "1.0" will cause a borrow from the exponent
- and this case can be detected when handling the borrow.) */
- beq a2, a3, .Lsub_return_zero
-
- /* y is a subnormal value. Replace its sign/exponent with zero,
- i.e., no implicit "1.0". Unless x is also a subnormal, increment
- y's apparent exponent because subnormals behave as if they had
- the minimum (nonzero) exponent. */
- slli a3, a3, 9
- srli a3, a3, 9
- bnone a2, a6, .Lsub_yexpdiff
- addi a8, a8, 1
- j .Lsub_yexpdiff
-
-.Lsub_returny:
- /* Negate and return y. */
- slli a7, a6, 8
- xor a2, a3, a7
-1: leaf_return
-
-.Lsub_xsmaller:
- /* Same thing as the "ysmaller" code, but with x and y swapped and
- with y negated. */
- bnone a2, a6, .Lsub_xexpzero
-
- or a2, a2, a6
- slli a2, a2, 8
- srli a2, a2, 8
-
-.Lsub_xexpdiff:
- sub a10, a8, a7
- bgeui a10, 32, .Lsub_returny
-
- ssr a10
- movi a9, 0
- src a9, a2, a9
- srl a2, a2
-
- /* Negate y. */
- slli a11, a6, 8
- xor a3, a3, a11
-
- sub a2, a3, a2
-
- neg a9, a9
- addi a10, a2, -1
- movnez a2, a10, a9
-
- /* Check if the subtract underflowed into the exponent. */
- extui a10, a2, 23, 8
- bne a10, a8, .Lsub_borrow
-
-.Lsub_round:
- /* Round up if the leftover fraction is >= 1/2. */
- bgez a9, 1f
- addi a2, a2, 1
-
- /* Check if the leftover fraction is exactly 1/2. */
- slli a9, a9, 1
- beqz a9, .Lsub_exactlyhalf
-1: leaf_return
-
-.Lsub_xexpzero:
- /* Same as "yexpzero". */
- beq a2, a3, .Lsub_return_zero
- slli a2, a2, 9
- srli a2, a2, 9
- bnone a3, a6, .Lsub_xexpdiff
- addi a7, a7, 1
- j .Lsub_xexpdiff
-
-.Lsub_return_zero:
- movi a2, 0
- leaf_return
-
-.Lsub_borrow:
- /* The subtraction has underflowed into the exponent field, so the
- value needs to be renormalized. Shift the mantissa left as
- needed to remove any leading zeros and adjust the exponent
- accordingly. If the exponent is not large enough to remove
- all the leading zeros, the result will be a subnormal value. */
-
- slli a8, a2, 9
- beqz a8, .Lsub_xzero
- do_nsau a6, a8, a7, a11
- srli a8, a8, 9
- bge a6, a10, .Lsub_subnormal
- addi a6, a6, 1
-
-.Lsub_normalize_shift:
- /* Shift the mantissa (a8/a9) left by a6. */
- ssl a6
- src a8, a8, a9
- sll a9, a9
-
- /* Combine the shifted mantissa with the sign and exponent,
- decrementing the exponent by a6. (The exponent has already
- been decremented by one due to the borrow from the subtraction,
- but adding the mantissa will increment the exponent by one.) */
- srli a2, a2, 23
- sub a2, a2, a6
- slli a2, a2, 23
- add a2, a2, a8
- j .Lsub_round
-
-.Lsub_exactlyhalf:
- /* Round down to the nearest even value. */
- srli a2, a2, 1
- slli a2, a2, 1
- leaf_return
-
-.Lsub_xzero:
- /* If there was a borrow from the exponent, and the mantissa and
- guard digits are all zero, then the inputs were equal and the
- result should be zero. */
- beqz a9, .Lsub_return_zero
-
- /* Only the guard digit is nonzero. Shift by min(24, a10). */
- addi a11, a10, -24
- movi a6, 24
- movltz a6, a10, a11
- j .Lsub_normalize_shift
-
-.Lsub_subnormal:
- /* The exponent is too small to shift away all the leading zeros.
- Set a6 to the current exponent (which has already been
- decremented by the borrow) so that the exponent of the result
- will be zero. Do not add 1 to a6 in this case, because: (1)
- adding the mantissa will not increment the exponent, so there is
- no need to subtract anything extra from the exponent to
- compensate, and (2) the effective exponent of a subnormal is 1
- not 0 so the shift amount must be 1 smaller than normal. */
- mov a6, a10
- j .Lsub_normalize_shift
-
-#endif /* L_addsubsf3 */
-
-#ifdef L_mulsf3
-
- /* Multiplication */
-#if !XCHAL_HAVE_MUL16 && !XCHAL_HAVE_MUL32 && !XCHAL_HAVE_MAC16
-#define XCHAL_NO_MUL 1
-#endif
-
-__mulsf3_aux:
-
- /* Handle unusual cases (zeros, subnormals, NaNs and Infinities).
- (This code is placed before the start of the function just to
- keep it in range of the limited branch displacements.) */
-
-.Lmul_xexpzero:
- /* Clear the sign bit of x. */
- slli a2, a2, 1
- srli a2, a2, 1
-
- /* If x is zero, return zero. */
- beqz a2, .Lmul_return_zero
-
- /* Normalize x. Adjust the exponent in a8. */
- do_nsau a10, a2, a11, a12
- addi a10, a10, -8
- ssl a10
- sll a2, a2
- movi a8, 1
- sub a8, a8, a10
- j .Lmul_xnormalized
-
-.Lmul_yexpzero:
- /* Clear the sign bit of y. */
- slli a3, a3, 1
- srli a3, a3, 1
-
- /* If y is zero, return zero. */
- beqz a3, .Lmul_return_zero
-
- /* Normalize y. Adjust the exponent in a9. */
- do_nsau a10, a3, a11, a12
- addi a10, a10, -8
- ssl a10
- sll a3, a3
- movi a9, 1
- sub a9, a9, a10
- j .Lmul_ynormalized
-
-.Lmul_return_zero:
- /* Return zero with the appropriate sign bit. */
- srli a2, a7, 31
- slli a2, a2, 31
- j .Lmul_done
-
-.Lmul_xnan_or_inf:
- /* If y is zero, return NaN. */
- slli a8, a3, 1
- bnez a8, 1f
- movi a4, 0x400000 /* make it a quiet NaN */
- or a2, a2, a4
- j .Lmul_done
-1:
- /* If y is NaN, return y. */
- bnall a3, a6, .Lmul_returnx
- slli a8, a3, 9
- beqz a8, .Lmul_returnx
-
-.Lmul_returny:
- mov a2, a3
-
-.Lmul_returnx:
- /* Set the sign bit and return. */
- extui a7, a7, 31, 1
- slli a2, a2, 1
- ssai 1
- src a2, a7, a2
- j .Lmul_done
-
-.Lmul_ynan_or_inf:
- /* If x is zero, return NaN. */
- slli a8, a2, 1
- bnez a8, .Lmul_returny
- movi a7, 0x400000 /* make it a quiet NaN */
- or a2, a3, a7
- j .Lmul_done
-
- .align 4
- .global __mulsf3
- .type __mulsf3, @function
-__mulsf3:
-#if __XTENSA_CALL0_ABI__
- leaf_entry sp, 32
- addi sp, sp, -32
- s32i a12, sp, 16
- s32i a13, sp, 20
- s32i a14, sp, 24
- s32i a15, sp, 28
-#elif XCHAL_NO_MUL
- /* This is not really a leaf function; allocate enough stack space
- to allow CALL12s to a helper function. */
- leaf_entry sp, 64
-#else
- leaf_entry sp, 32
-#endif
- movi a6, 0x7f800000
-
- /* Get the sign of the result. */
- xor a7, a2, a3
-
- /* Check for NaN and infinity. */
- ball a2, a6, .Lmul_xnan_or_inf
- ball a3, a6, .Lmul_ynan_or_inf
-
- /* Extract the exponents. */
- extui a8, a2, 23, 8
- extui a9, a3, 23, 8
-
- beqz a8, .Lmul_xexpzero
-.Lmul_xnormalized:
- beqz a9, .Lmul_yexpzero
-.Lmul_ynormalized:
-
- /* Add the exponents. */
- add a8, a8, a9
-
- /* Replace sign/exponent fields with explicit "1.0". */
- movi a10, 0xffffff
- or a2, a2, a6
- and a2, a2, a10
- or a3, a3, a6
- and a3, a3, a10
-
- /* Multiply 32x32 to 64 bits. The result ends up in a2/a6. */
-
-#if XCHAL_HAVE_MUL32_HIGH
-
- mull a6, a2, a3
- muluh a2, a2, a3
-
-#else
-
- /* Break the inputs into 16-bit chunks and compute 4 32-bit partial
- products. These partial products are:
-
- 0 xl * yl
-
- 1 xl * yh
- 2 xh * yl
-
- 3 xh * yh
-
- If using the Mul16 or Mul32 multiplier options, these input
- chunks must be stored in separate registers. For Mac16, the
- UMUL.AA.* opcodes can specify that the inputs come from either
- half of the registers, so there is no need to shift them out
- ahead of time. If there is no multiply hardware, the 16-bit
- chunks can be extracted when setting up the arguments to the
- separate multiply function. */
-
-#if __XTENSA_CALL0_ABI__ && XCHAL_NO_MUL
- /* Calling a separate multiply function will clobber a0 and requires
- use of a8 as a temporary, so save those values now. (The function
- uses a custom ABI so nothing else needs to be saved.) */
- s32i a0, sp, 0
- s32i a8, sp, 4
-#endif
-
-#if XCHAL_HAVE_MUL16 || XCHAL_HAVE_MUL32
-
-#define a2h a4
-#define a3h a5
-
- /* Get the high halves of the inputs into registers. */
- srli a2h, a2, 16
- srli a3h, a3, 16
-
-#define a2l a2
-#define a3l a3
-
-#if XCHAL_HAVE_MUL32 && !XCHAL_HAVE_MUL16
- /* Clear the high halves of the inputs. This does not matter
- for MUL16 because the high bits are ignored. */
- extui a2, a2, 0, 16
- extui a3, a3, 0, 16
-#endif
-#endif /* MUL16 || MUL32 */
-
-
-#if XCHAL_HAVE_MUL16
-
-#define do_mul(dst, xreg, xhalf, yreg, yhalf) \
- mul16u dst, xreg ## xhalf, yreg ## yhalf
-
-#elif XCHAL_HAVE_MUL32
-
-#define do_mul(dst, xreg, xhalf, yreg, yhalf) \
- mull dst, xreg ## xhalf, yreg ## yhalf
-
-#elif XCHAL_HAVE_MAC16
-
-/* The preprocessor insists on inserting a space when concatenating after
- a period in the definition of do_mul below. These macros are a workaround
- using underscores instead of periods when doing the concatenation. */
-#define umul_aa_ll umul.aa.ll
-#define umul_aa_lh umul.aa.lh
-#define umul_aa_hl umul.aa.hl
-#define umul_aa_hh umul.aa.hh
-
-#define do_mul(dst, xreg, xhalf, yreg, yhalf) \
- umul_aa_ ## xhalf ## yhalf xreg, yreg; \
- rsr dst, ACCLO
-
-#else /* no multiply hardware */
-
-#define set_arg_l(dst, src) \
- extui dst, src, 0, 16
-#define set_arg_h(dst, src) \
- srli dst, src, 16
-
-#if __XTENSA_CALL0_ABI__
-#define do_mul(dst, xreg, xhalf, yreg, yhalf) \
- set_arg_ ## xhalf (a13, xreg); \
- set_arg_ ## yhalf (a14, yreg); \
- call0 .Lmul_mulsi3; \
- mov dst, a12
-#else
-#define do_mul(dst, xreg, xhalf, yreg, yhalf) \
- set_arg_ ## xhalf (a14, xreg); \
- set_arg_ ## yhalf (a15, yreg); \
- call12 .Lmul_mulsi3; \
- mov dst, a14
-#endif /* __XTENSA_CALL0_ABI__ */
-
-#endif /* no multiply hardware */
-
- /* Add pp1 and pp2 into a6 with carry-out in a9. */
- do_mul(a6, a2, l, a3, h) /* pp 1 */
- do_mul(a11, a2, h, a3, l) /* pp 2 */
- movi a9, 0
- add a6, a6, a11
- bgeu a6, a11, 1f
- addi a9, a9, 1
-1:
- /* Shift the high half of a9/a6 into position in a9. Note that
- this value can be safely incremented without any carry-outs. */
- ssai 16
- src a9, a9, a6
-
- /* Compute the low word into a6. */
- do_mul(a11, a2, l, a3, l) /* pp 0 */
- sll a6, a6
- add a6, a6, a11
- bgeu a6, a11, 1f
- addi a9, a9, 1
-1:
- /* Compute the high word into a2. */
- do_mul(a2, a2, h, a3, h) /* pp 3 */
- add a2, a2, a9
-
-#if __XTENSA_CALL0_ABI__ && XCHAL_NO_MUL
- /* Restore values saved on the stack during the multiplication. */
- l32i a0, sp, 0
- l32i a8, sp, 4
-#endif
-#endif /* ! XCHAL_HAVE_MUL32_HIGH */
-
- /* Shift left by 9 bits, unless there was a carry-out from the
- multiply, in which case, shift by 8 bits and increment the
- exponent. */
- movi a4, 9
- srli a5, a2, 24 - 9
- beqz a5, 1f
- addi a4, a4, -1
- addi a8, a8, 1
-1: ssl a4
- src a2, a2, a6
- sll a6, a6
-
- /* Subtract the extra bias from the exponent sum (plus one to account
- for the explicit "1.0" of the mantissa that will be added to the
- exponent in the final result). */
- movi a4, 0x80
- sub a8, a8, a4
-
- /* Check for over/underflow. The value in a8 is one less than the
- final exponent, so values in the range 0..fd are OK here. */
- movi a4, 0xfe
- bgeu a8, a4, .Lmul_overflow
-
-.Lmul_round:
- /* Round. */
- bgez a6, .Lmul_rounded
- addi a2, a2, 1
- slli a6, a6, 1
- beqz a6, .Lmul_exactlyhalf
-
-.Lmul_rounded:
- /* Add the exponent to the mantissa. */
- slli a8, a8, 23
- add a2, a2, a8
-
-.Lmul_addsign:
- /* Add the sign bit. */
- srli a7, a7, 31
- slli a7, a7, 31
- or a2, a2, a7
-
-.Lmul_done:
-#if __XTENSA_CALL0_ABI__
- l32i a12, sp, 16
- l32i a13, sp, 20
- l32i a14, sp, 24
- l32i a15, sp, 28
- addi sp, sp, 32
-#endif
- leaf_return
-
-.Lmul_exactlyhalf:
- /* Round down to the nearest even value. */
- srli a2, a2, 1
- slli a2, a2, 1
- j .Lmul_rounded
-
-.Lmul_overflow:
- bltz a8, .Lmul_underflow
- /* Return +/- Infinity. */
- movi a8, 0xff
- slli a2, a8, 23
- j .Lmul_addsign
-
-.Lmul_underflow:
- /* Create a subnormal value, where the exponent field contains zero,
- but the effective exponent is 1. The value of a8 is one less than
- the actual exponent, so just negate it to get the shift amount. */
- neg a8, a8
- mov a9, a6
- ssr a8
- bgeui a8, 32, .Lmul_flush_to_zero
-
- /* Shift a2 right. Any bits that are shifted out of a2 are saved
- in a6 (combined with the shifted-out bits currently in a6) for
- rounding the result. */
- sll a6, a2
- srl a2, a2
-
- /* Set the exponent to zero. */
- movi a8, 0
-
- /* Pack any nonzero bits shifted out into a6. */
- beqz a9, .Lmul_round
- movi a9, 1
- or a6, a6, a9
- j .Lmul_round
-
-.Lmul_flush_to_zero:
- /* Return zero with the appropriate sign bit. */
- srli a2, a7, 31
- slli a2, a2, 31
- j .Lmul_done
-
-#if XCHAL_NO_MUL
-
- /* For Xtensa processors with no multiply hardware, this simplified
- version of _mulsi3 is used for multiplying 16-bit chunks of
- the floating-point mantissas. When using CALL0, this function
- uses a custom ABI: the inputs are passed in a13 and a14, the
- result is returned in a12, and a8 and a15 are clobbered. */
- .align 4
-.Lmul_mulsi3:
- leaf_entry sp, 16
- .macro mul_mulsi3_body dst, src1, src2, tmp1, tmp2
- movi \dst, 0
-1: add \tmp1, \src2, \dst
- extui \tmp2, \src1, 0, 1
- movnez \dst, \tmp1, \tmp2
-
- do_addx2 \tmp1, \src2, \dst, \tmp1
- extui \tmp2, \src1, 1, 1
- movnez \dst, \tmp1, \tmp2
-
- do_addx4 \tmp1, \src2, \dst, \tmp1
- extui \tmp2, \src1, 2, 1
- movnez \dst, \tmp1, \tmp2
-
- do_addx8 \tmp1, \src2, \dst, \tmp1
- extui \tmp2, \src1, 3, 1
- movnez \dst, \tmp1, \tmp2
-
- srli \src1, \src1, 4
- slli \src2, \src2, 4
- bnez \src1, 1b
- .endm
-#if __XTENSA_CALL0_ABI__
- mul_mulsi3_body a12, a13, a14, a15, a8
-#else
- /* The result will be written into a2, so save that argument in a4. */
- mov a4, a2
- mul_mulsi3_body a2, a4, a3, a5, a6
-#endif
- leaf_return
-#endif /* XCHAL_NO_MUL */
-#endif /* L_mulsf3 */
-
-#ifdef L_divsf3
-
- /* Division */
-__divsf3_aux:
-
- /* Handle unusual cases (zeros, subnormals, NaNs and Infinities).
- (This code is placed before the start of the function just to
- keep it in range of the limited branch displacements.) */
-
-.Ldiv_yexpzero:
- /* Clear the sign bit of y. */
- slli a3, a3, 1
- srli a3, a3, 1
-
- /* Check for division by zero. */
- beqz a3, .Ldiv_yzero
-
- /* Normalize y. Adjust the exponent in a9. */
- do_nsau a10, a3, a4, a5
- addi a10, a10, -8
- ssl a10
- sll a3, a3
- movi a9, 1
- sub a9, a9, a10
- j .Ldiv_ynormalized
-
-.Ldiv_yzero:
- /* y is zero. Return NaN if x is also zero; otherwise, infinity. */
- slli a4, a2, 1
- srli a4, a4, 1
- srli a2, a7, 31
- slli a2, a2, 31
- or a2, a2, a6
- bnez a4, 1f
- movi a4, 0x400000 /* make it a quiet NaN */
- or a2, a2, a4
-1: leaf_return
-
-.Ldiv_xexpzero:
- /* Clear the sign bit of x. */
- slli a2, a2, 1
- srli a2, a2, 1
-
- /* If x is zero, return zero. */
- beqz a2, .Ldiv_return_zero
-
- /* Normalize x. Adjust the exponent in a8. */
- do_nsau a10, a2, a4, a5
- addi a10, a10, -8
- ssl a10
- sll a2, a2
- movi a8, 1
- sub a8, a8, a10
- j .Ldiv_xnormalized
-
-.Ldiv_return_zero:
- /* Return zero with the appropriate sign bit. */
- srli a2, a7, 31
- slli a2, a2, 31
- leaf_return
-
-.Ldiv_xnan_or_inf:
- /* Set the sign bit of the result. */
- srli a7, a3, 31
- slli a7, a7, 31
- xor a2, a2, a7
- /* If y is NaN or Inf, return NaN. */
- bnall a3, a6, 1f
- movi a4, 0x400000 /* make it a quiet NaN */
- or a2, a2, a4
-1: leaf_return
-
-.Ldiv_ynan_or_inf:
- /* If y is Infinity, return zero. */
- slli a8, a3, 9
- beqz a8, .Ldiv_return_zero
- /* y is NaN; return it. */
- mov a2, a3
- leaf_return
-
- .align 4
- .global __divsf3
- .type __divsf3, @function
-__divsf3:
- leaf_entry sp, 16
- movi a6, 0x7f800000
-
- /* Get the sign of the result. */
- xor a7, a2, a3
-
- /* Check for NaN and infinity. */
- ball a2, a6, .Ldiv_xnan_or_inf
- ball a3, a6, .Ldiv_ynan_or_inf
-
- /* Extract the exponents. */
- extui a8, a2, 23, 8
- extui a9, a3, 23, 8
-
- beqz a9, .Ldiv_yexpzero
-.Ldiv_ynormalized:
- beqz a8, .Ldiv_xexpzero
-.Ldiv_xnormalized:
-
- /* Subtract the exponents. */
- sub a8, a8, a9
-
- /* Replace sign/exponent fields with explicit "1.0". */
- movi a10, 0xffffff
- or a2, a2, a6
- and a2, a2, a10
- or a3, a3, a6
- and a3, a3, a10
-
- /* The first digit of the mantissa division must be a one.
- Shift x (and adjust the exponent) as needed to make this true. */
- bltu a3, a2, 1f
- slli a2, a2, 1
- addi a8, a8, -1
-1:
- /* Do the first subtraction and shift. */
- sub a2, a2, a3
- slli a2, a2, 1
-
- /* Put the quotient into a10. */
- movi a10, 1
-
- /* Divide one bit at a time for 23 bits. */
- movi a9, 23
-#if XCHAL_HAVE_LOOPS
- loop a9, .Ldiv_loopend
-#endif
-.Ldiv_loop:
- /* Shift the quotient << 1. */
- slli a10, a10, 1
-
- /* Is this digit a 0 or 1? */
- bltu a2, a3, 1f
-
- /* Output a 1 and subtract. */
- addi a10, a10, 1
- sub a2, a2, a3
-
- /* Shift the dividend << 1. */
-1: slli a2, a2, 1
-
-#if !XCHAL_HAVE_LOOPS
- addi a9, a9, -1
- bnez a9, .Ldiv_loop
-#endif
-.Ldiv_loopend:
-
- /* Add the exponent bias (less one to account for the explicit "1.0"
- of the mantissa that will be added to the exponent in the final
- result). */
- addi a8, a8, 0x7e
-
- /* Check for over/underflow. The value in a8 is one less than the
- final exponent, so values in the range 0..fd are OK here. */
- movi a4, 0xfe
- bgeu a8, a4, .Ldiv_overflow
-
-.Ldiv_round:
- /* Round. The remainder (<< 1) is in a2. */
- bltu a2, a3, .Ldiv_rounded
- addi a10, a10, 1
- beq a2, a3, .Ldiv_exactlyhalf
-
-.Ldiv_rounded:
- /* Add the exponent to the mantissa. */
- slli a8, a8, 23
- add a2, a10, a8
-
-.Ldiv_addsign:
- /* Add the sign bit. */
- srli a7, a7, 31
- slli a7, a7, 31
- or a2, a2, a7
- leaf_return
-
-.Ldiv_overflow:
- bltz a8, .Ldiv_underflow
- /* Return +/- Infinity. */
- addi a8, a4, 1 /* 0xff */
- slli a2, a8, 23
- j .Ldiv_addsign
-
-.Ldiv_exactlyhalf:
- /* Remainder is exactly half the divisor. Round even. */
- srli a10, a10, 1
- slli a10, a10, 1
- j .Ldiv_rounded
-
-.Ldiv_underflow:
- /* Create a subnormal value, where the exponent field contains zero,
- but the effective exponent is 1. The value of a8 is one less than
- the actual exponent, so just negate it to get the shift amount. */
- neg a8, a8
- ssr a8
- bgeui a8, 32, .Ldiv_flush_to_zero
-
- /* Shift a10 right. Any bits that are shifted out of a10 are
- saved in a6 for rounding the result. */
- sll a6, a10
- srl a10, a10
-
- /* Set the exponent to zero. */
- movi a8, 0
-
- /* Pack any nonzero remainder (in a2) into a6. */
- beqz a2, 1f
- movi a9, 1
- or a6, a6, a9
-
- /* Round a10 based on the bits shifted out into a6. */
-1: bgez a6, .Ldiv_rounded
- addi a10, a10, 1
- slli a6, a6, 1
- bnez a6, .Ldiv_rounded
- srli a10, a10, 1
- slli a10, a10, 1
- j .Ldiv_rounded
-
-.Ldiv_flush_to_zero:
- /* Return zero with the appropriate sign bit. */
- srli a2, a7, 31
- slli a2, a2, 31
- leaf_return
-
-#endif /* L_divsf3 */
-
-#ifdef L_cmpsf2
-
- /* Equal and Not Equal */
-
- .align 4
- .global __eqsf2
- .global __nesf2
- .set __nesf2, __eqsf2
- .type __eqsf2, @function
-__eqsf2:
- leaf_entry sp, 16
- bne a2, a3, 4f
-
- /* The values are equal but NaN != NaN. Check the exponent. */
- movi a6, 0x7f800000
- ball a2, a6, 3f
-
- /* Equal. */
- movi a2, 0
- leaf_return
-
- /* Not equal. */
-2: movi a2, 1
- leaf_return
-
- /* Check if the mantissas are nonzero. */
-3: slli a7, a2, 9
- j 5f
-
- /* Check if x and y are zero with different signs. */
-4: or a7, a2, a3
- slli a7, a7, 1
-
- /* Equal if a7 == 0, where a7 is either abs(x | y) or the mantissa
- or x when exponent(x) = 0x7f8 and x == y. */
-5: movi a2, 0
- movi a3, 1
- movnez a2, a3, a7
- leaf_return
-
-
- /* Greater Than */
-
- .align 4
- .global __gtsf2
- .type __gtsf2, @function
-__gtsf2:
- leaf_entry sp, 16
- movi a6, 0x7f800000
- ball a2, a6, 2f
-1: bnall a3, a6, .Lle_cmp
-
- /* Check if y is a NaN. */
- slli a7, a3, 9
- beqz a7, .Lle_cmp
- movi a2, 0
- leaf_return
-
- /* Check if x is a NaN. */
-2: slli a7, a2, 9
- beqz a7, 1b
- movi a2, 0
- leaf_return
-
-
- /* Less Than or Equal */
-
- .align 4
- .global __lesf2
- .type __lesf2, @function
-__lesf2:
- leaf_entry sp, 16
- movi a6, 0x7f800000
- ball a2, a6, 2f
-1: bnall a3, a6, .Lle_cmp
-
- /* Check if y is a NaN. */
- slli a7, a3, 9
- beqz a7, .Lle_cmp
- movi a2, 1
- leaf_return
-
- /* Check if x is a NaN. */
-2: slli a7, a2, 9
- beqz a7, 1b
- movi a2, 1
- leaf_return
-
-.Lle_cmp:
- /* Check if x and y have different signs. */
- xor a7, a2, a3
- bltz a7, .Lle_diff_signs
-
- /* Check if x is negative. */
- bltz a2, .Lle_xneg
-
- /* Check if x <= y. */
- bltu a3, a2, 5f
-4: movi a2, 0
- leaf_return
-
-.Lle_xneg:
- /* Check if y <= x. */
- bgeu a2, a3, 4b
-5: movi a2, 1
- leaf_return
-
-.Lle_diff_signs:
- bltz a2, 4b
-
- /* Check if both x and y are zero. */
- or a7, a2, a3
- slli a7, a7, 1
- movi a2, 1
- movi a3, 0
- moveqz a2, a3, a7
- leaf_return
-
-
- /* Greater Than or Equal */
-
- .align 4
- .global __gesf2
- .type __gesf2, @function
-__gesf2:
- leaf_entry sp, 16
- movi a6, 0x7f800000
- ball a2, a6, 2f
-1: bnall a3, a6, .Llt_cmp
-
- /* Check if y is a NaN. */
- slli a7, a3, 9
- beqz a7, .Llt_cmp
- movi a2, -1
- leaf_return
-
- /* Check if x is a NaN. */
-2: slli a7, a2, 9
- beqz a7, 1b
- movi a2, -1
- leaf_return
-
-
- /* Less Than */
-
- .align 4
- .global __ltsf2
- .type __ltsf2, @function
-__ltsf2:
- leaf_entry sp, 16
- movi a6, 0x7f800000
- ball a2, a6, 2f
-1: bnall a3, a6, .Llt_cmp
-
- /* Check if y is a NaN. */
- slli a7, a3, 9
- beqz a7, .Llt_cmp
- movi a2, 0
- leaf_return
-
- /* Check if x is a NaN. */
-2: slli a7, a2, 9
- beqz a7, 1b
- movi a2, 0
- leaf_return
-
-.Llt_cmp:
- /* Check if x and y have different signs. */
- xor a7, a2, a3
- bltz a7, .Llt_diff_signs
-
- /* Check if x is negative. */
- bltz a2, .Llt_xneg
-
- /* Check if x < y. */
- bgeu a2, a3, 5f
-4: movi a2, -1
- leaf_return
-
-.Llt_xneg:
- /* Check if y < x. */
- bltu a3, a2, 4b
-5: movi a2, 0
- leaf_return
-
-.Llt_diff_signs:
- bgez a2, 5b
-
- /* Check if both x and y are nonzero. */
- or a7, a2, a3
- slli a7, a7, 1
- movi a2, 0
- movi a3, -1
- movnez a2, a3, a7
- leaf_return
-
-
- /* Unordered */
-
- .align 4
- .global __unordsf2
- .type __unordsf2, @function
-__unordsf2:
- leaf_entry sp, 16
- movi a6, 0x7f800000
- ball a2, a6, 3f
-1: ball a3, a6, 4f
-2: movi a2, 0
- leaf_return
-
-3: slli a7, a2, 9
- beqz a7, 1b
- movi a2, 1
- leaf_return
-
-4: slli a7, a3, 9
- beqz a7, 2b
- movi a2, 1
- leaf_return
-
-#endif /* L_cmpsf2 */
-
-#ifdef L_fixsfsi
-
- .align 4
- .global __fixsfsi
- .type __fixsfsi, @function
-__fixsfsi:
- leaf_entry sp, 16
-
- /* Check for NaN and Infinity. */
- movi a6, 0x7f800000
- ball a2, a6, .Lfixsfsi_nan_or_inf
-
- /* Extract the exponent and check if 0 < (exp - 0x7e) < 32. */
- extui a4, a2, 23, 8
- addi a4, a4, -0x7e
- bgei a4, 32, .Lfixsfsi_maxint
- blti a4, 1, .Lfixsfsi_zero
-
- /* Add explicit "1.0" and shift << 8. */
- or a7, a2, a6
- slli a5, a7, 8
-
- /* Shift back to the right, based on the exponent. */
- ssl a4 /* shift by 32 - a4 */
- srl a5, a5
-
- /* Negate the result if sign != 0. */
- neg a2, a5
- movgez a2, a5, a7
- leaf_return
-
-.Lfixsfsi_nan_or_inf:
- /* Handle Infinity and NaN. */
- slli a4, a2, 9
- beqz a4, .Lfixsfsi_maxint
-
- /* Translate NaN to +maxint. */
- movi a2, 0
-
-.Lfixsfsi_maxint:
- slli a4, a6, 8 /* 0x80000000 */
- addi a5, a4, -1 /* 0x7fffffff */
- movgez a4, a5, a2
- mov a2, a4
- leaf_return
-
-.Lfixsfsi_zero:
- movi a2, 0
- leaf_return
-
-#endif /* L_fixsfsi */
-
-#ifdef L_fixsfdi
-
- .align 4
- .global __fixsfdi
- .type __fixsfdi, @function
-__fixsfdi:
- leaf_entry sp, 16
-
- /* Check for NaN and Infinity. */
- movi a6, 0x7f800000
- ball a2, a6, .Lfixsfdi_nan_or_inf
-
- /* Extract the exponent and check if 0 < (exp - 0x7e) < 64. */
- extui a4, a2, 23, 8
- addi a4, a4, -0x7e
- bgei a4, 64, .Lfixsfdi_maxint
- blti a4, 1, .Lfixsfdi_zero
-
- /* Add explicit "1.0" and shift << 8. */
- or a7, a2, a6
- slli xh, a7, 8
-
- /* Shift back to the right, based on the exponent. */
- ssl a4 /* shift by 64 - a4 */
- bgei a4, 32, .Lfixsfdi_smallshift
- srl xl, xh
- movi xh, 0
-
-.Lfixsfdi_shifted:
- /* Negate the result if sign != 0. */
- bgez a7, 1f
- neg xl, xl
- neg xh, xh
- beqz xl, 1f
- addi xh, xh, -1
-1: leaf_return
-
-.Lfixsfdi_smallshift:
- movi xl, 0
- sll xl, xh
- srl xh, xh
- j .Lfixsfdi_shifted
-
-.Lfixsfdi_nan_or_inf:
- /* Handle Infinity and NaN. */
- slli a4, a2, 9
- beqz a4, .Lfixsfdi_maxint
-
- /* Translate NaN to +maxint. */
- movi a2, 0
-
-.Lfixsfdi_maxint:
- slli a7, a6, 8 /* 0x80000000 */
- bgez a2, 1f
- mov xh, a7
- movi xl, 0
- leaf_return
-
-1: addi xh, a7, -1 /* 0x7fffffff */
- movi xl, -1
- leaf_return
-
-.Lfixsfdi_zero:
- movi xh, 0
- movi xl, 0
- leaf_return
-
-#endif /* L_fixsfdi */
-
-#ifdef L_fixunssfsi
-
- .align 4
- .global __fixunssfsi
- .type __fixunssfsi, @function
-__fixunssfsi:
- leaf_entry sp, 16
-
- /* Check for NaN and Infinity. */
- movi a6, 0x7f800000
- ball a2, a6, .Lfixunssfsi_nan_or_inf
-
- /* Extract the exponent and check if 0 <= (exp - 0x7f) < 32. */
- extui a4, a2, 23, 8
- addi a4, a4, -0x7f
- bgei a4, 32, .Lfixunssfsi_maxint
- bltz a4, .Lfixunssfsi_zero
-
- /* Add explicit "1.0" and shift << 8. */
- or a7, a2, a6
- slli a5, a7, 8
-
- /* Shift back to the right, based on the exponent. */
- addi a4, a4, 1
- beqi a4, 32, .Lfixunssfsi_bigexp
- ssl a4 /* shift by 32 - a4 */
- srl a5, a5
-
- /* Negate the result if sign != 0. */
- neg a2, a5
- movgez a2, a5, a7
- leaf_return
-
-.Lfixunssfsi_nan_or_inf:
- /* Handle Infinity and NaN. */
- slli a4, a2, 9
- beqz a4, .Lfixunssfsi_maxint
-
- /* Translate NaN to 0xffffffff. */
- movi a2, -1
- leaf_return
-
-.Lfixunssfsi_maxint:
- slli a4, a6, 8 /* 0x80000000 */
- movi a5, -1 /* 0xffffffff */
- movgez a4, a5, a2
- mov a2, a4
- leaf_return
-
-.Lfixunssfsi_zero:
- movi a2, 0
- leaf_return
-
-.Lfixunssfsi_bigexp:
- /* Handle unsigned maximum exponent case. */
- bltz a2, 1f
- mov a2, a5 /* no shift needed */
- leaf_return
-
- /* Return 0x80000000 if negative. */
-1: slli a2, a6, 8
- leaf_return
-
-#endif /* L_fixunssfsi */
-
-#ifdef L_fixunssfdi
-
- .align 4
- .global __fixunssfdi
- .type __fixunssfdi, @function
-__fixunssfdi:
- leaf_entry sp, 16
-
- /* Check for NaN and Infinity. */
- movi a6, 0x7f800000
- ball a2, a6, .Lfixunssfdi_nan_or_inf
-
- /* Extract the exponent and check if 0 <= (exp - 0x7f) < 64. */
- extui a4, a2, 23, 8
- addi a4, a4, -0x7f
- bgei a4, 64, .Lfixunssfdi_maxint
- bltz a4, .Lfixunssfdi_zero
-
- /* Add explicit "1.0" and shift << 8. */
- or a7, a2, a6
- slli xh, a7, 8
-
- /* Shift back to the right, based on the exponent. */
- addi a4, a4, 1
- beqi a4, 64, .Lfixunssfdi_bigexp
- ssl a4 /* shift by 64 - a4 */
- bgei a4, 32, .Lfixunssfdi_smallshift
- srl xl, xh
- movi xh, 0
-
-.Lfixunssfdi_shifted:
- /* Negate the result if sign != 0. */
- bgez a7, 1f
- neg xl, xl
- neg xh, xh
- beqz xl, 1f
- addi xh, xh, -1
-1: leaf_return
-
-.Lfixunssfdi_smallshift:
- movi xl, 0
- src xl, xh, xl
- srl xh, xh
- j .Lfixunssfdi_shifted
-
-.Lfixunssfdi_nan_or_inf:
- /* Handle Infinity and NaN. */
- slli a4, a2, 9
- beqz a4, .Lfixunssfdi_maxint
-
- /* Translate NaN to 0xffffffff.... */
-1: movi xh, -1
- movi xl, -1
- leaf_return
-
-.Lfixunssfdi_maxint:
- bgez a2, 1b
-2: slli xh, a6, 8 /* 0x80000000 */
- movi xl, 0
- leaf_return
-
-.Lfixunssfdi_zero:
- movi xh, 0
- movi xl, 0
- leaf_return
-
-.Lfixunssfdi_bigexp:
- /* Handle unsigned maximum exponent case. */
- bltz a7, 2b
- movi xl, 0
- leaf_return /* no shift needed */
-
-#endif /* L_fixunssfdi */
-
-#ifdef L_floatsisf
-
- .align 4
- .global __floatunsisf
- .type __floatunsisf, @function
-__floatunsisf:
- leaf_entry sp, 16
- beqz a2, .Lfloatsisf_return
-
- /* Set the sign to zero and jump to the floatsisf code. */
- movi a7, 0
- j .Lfloatsisf_normalize
-
- .align 4
- .global __floatsisf
- .type __floatsisf, @function
-__floatsisf:
- leaf_entry sp, 16
-
- /* Check for zero. */
- beqz a2, .Lfloatsisf_return
-
- /* Save the sign. */
- extui a7, a2, 31, 1
-
- /* Get the absolute value. */
-#if XCHAL_HAVE_ABS
- abs a2, a2
-#else
- neg a4, a2
- movltz a2, a4, a2
-#endif
-
-.Lfloatsisf_normalize:
- /* Normalize with the first 1 bit in the msb. */
- do_nsau a4, a2, a5, a6
- ssl a4
- sll a5, a2
-
- /* Shift the mantissa into position, with rounding bits in a6. */
- srli a2, a5, 8
- slli a6, a5, (32 - 8)
-
- /* Set the exponent. */
- movi a5, 0x9d /* 0x7e + 31 */
- sub a5, a5, a4
- slli a5, a5, 23
- add a2, a2, a5
-
- /* Add the sign. */
- slli a7, a7, 31
- or a2, a2, a7
-
- /* Round up if the leftover fraction is >= 1/2. */
- bgez a6, .Lfloatsisf_return
- addi a2, a2, 1 /* Overflow to the exponent is OK. */
-
- /* Check if the leftover fraction is exactly 1/2. */
- slli a6, a6, 1
- beqz a6, .Lfloatsisf_exactlyhalf
-
-.Lfloatsisf_return:
- leaf_return
-
-.Lfloatsisf_exactlyhalf:
- /* Round down to the nearest even value. */
- srli a2, a2, 1
- slli a2, a2, 1
- leaf_return
-
-#endif /* L_floatsisf */
-
-#ifdef L_floatdisf
-
- .align 4
- .global __floatundisf
- .type __floatundisf, @function
-__floatundisf:
- leaf_entry sp, 16
-
- /* Check for zero. */
- or a4, xh, xl
- beqz a4, 2f
-
- /* Set the sign to zero and jump to the floatdisf code. */
- movi a7, 0
- j .Lfloatdisf_normalize
-
- .align 4
- .global __floatdisf
- .type __floatdisf, @function
-__floatdisf:
- leaf_entry sp, 16
-
- /* Check for zero. */
- or a4, xh, xl
- beqz a4, 2f
-
- /* Save the sign. */
- extui a7, xh, 31, 1
-
- /* Get the absolute value. */
- bgez xh, .Lfloatdisf_normalize
- neg xl, xl
- neg xh, xh
- beqz xl, .Lfloatdisf_normalize
- addi xh, xh, -1
-
-.Lfloatdisf_normalize:
- /* Normalize with the first 1 bit in the msb of xh. */
- beqz xh, .Lfloatdisf_bigshift
- do_nsau a4, xh, a5, a6
- ssl a4
- src xh, xh, xl
- sll xl, xl
-
-.Lfloatdisf_shifted:
- /* Shift the mantissa into position, with rounding bits in a6. */
- ssai 8
- sll a5, xl
- src a6, xh, xl
- srl xh, xh
- beqz a5, 1f
- movi a5, 1
- or a6, a6, a5
-1:
- /* Set the exponent. */
- movi a5, 0xbd /* 0x7e + 63 */
- sub a5, a5, a4
- slli a5, a5, 23
- add a2, xh, a5
-
- /* Add the sign. */
- slli a7, a7, 31
- or a2, a2, a7
-
- /* Round up if the leftover fraction is >= 1/2. */
- bgez a6, 2f
- addi a2, a2, 1 /* Overflow to the exponent is OK. */
-
- /* Check if the leftover fraction is exactly 1/2. */
- slli a6, a6, 1
- beqz a6, .Lfloatdisf_exactlyhalf
-2: leaf_return
-
-.Lfloatdisf_bigshift:
- /* xh is zero. Normalize with first 1 bit of xl in the msb of xh. */
- do_nsau a4, xl, a5, a6
- ssl a4
- sll xh, xl
- movi xl, 0
- addi a4, a4, 32
- j .Lfloatdisf_shifted
-
-.Lfloatdisf_exactlyhalf:
- /* Round down to the nearest even value. */
- srli a2, a2, 1
- slli a2, a2, 1
- leaf_return
-
-#endif /* L_floatdisf */
diff --git a/gcc/config/xtensa/lib1funcs.asm b/gcc/config/xtensa/lib1funcs.asm
deleted file mode 100644
index 071b9171177..00000000000
--- a/gcc/config/xtensa/lib1funcs.asm
+++ /dev/null
@@ -1,845 +0,0 @@
-/* Assembly functions for the Xtensa version of libgcc1.
- Copyright (C) 2001, 2002, 2003, 2005, 2006, 2007, 2009
- Free Software Foundation, Inc.
- Contributed by Bob Wilson (bwilson@tensilica.com) at Tensilica.
-
-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/>. */
-
-#include "xtensa-config.h"
-
-/* Define macros for the ABS and ADDX* instructions to handle cases
- where they are not included in the Xtensa processor configuration. */
-
- .macro do_abs dst, src, tmp
-#if XCHAL_HAVE_ABS
- abs \dst, \src
-#else
- neg \tmp, \src
- movgez \tmp, \src, \src
- mov \dst, \tmp
-#endif
- .endm
-
- .macro do_addx2 dst, as, at, tmp
-#if XCHAL_HAVE_ADDX
- addx2 \dst, \as, \at
-#else
- slli \tmp, \as, 1
- add \dst, \tmp, \at
-#endif
- .endm
-
- .macro do_addx4 dst, as, at, tmp
-#if XCHAL_HAVE_ADDX
- addx4 \dst, \as, \at
-#else
- slli \tmp, \as, 2
- add \dst, \tmp, \at
-#endif
- .endm
-
- .macro do_addx8 dst, as, at, tmp
-#if XCHAL_HAVE_ADDX
- addx8 \dst, \as, \at
-#else
- slli \tmp, \as, 3
- add \dst, \tmp, \at
-#endif
- .endm
-
-/* Define macros for leaf function entry and return, supporting either the
- standard register windowed ABI or the non-windowed call0 ABI. These
- macros do not allocate any extra stack space, so they only work for
- leaf functions that do not need to spill anything to the stack. */
-
- .macro leaf_entry reg, size
-#if XCHAL_HAVE_WINDOWED && !__XTENSA_CALL0_ABI__
- entry \reg, \size
-#else
- /* do nothing */
-#endif
- .endm
-
- .macro leaf_return
-#if XCHAL_HAVE_WINDOWED && !__XTENSA_CALL0_ABI__
- retw
-#else
- ret
-#endif
- .endm
-
-
-#ifdef L_mulsi3
- .align 4
- .global __mulsi3
- .type __mulsi3, @function
-__mulsi3:
- leaf_entry sp, 16
-
-#if XCHAL_HAVE_MUL32
- mull a2, a2, a3
-
-#elif XCHAL_HAVE_MUL16
- or a4, a2, a3
- srai a4, a4, 16
- bnez a4, .LMUL16
- mul16u a2, a2, a3
- leaf_return
-.LMUL16:
- srai a4, a2, 16
- srai a5, a3, 16
- mul16u a7, a4, a3
- mul16u a6, a5, a2
- mul16u a4, a2, a3
- add a7, a7, a6
- slli a7, a7, 16
- add a2, a7, a4
-
-#elif XCHAL_HAVE_MAC16
- mul.aa.hl a2, a3
- mula.aa.lh a2, a3
- rsr a5, ACCLO
- umul.aa.ll a2, a3
- rsr a4, ACCLO
- slli a5, a5, 16
- add a2, a4, a5
-
-#else /* !MUL32 && !MUL16 && !MAC16 */
-
- /* Multiply one bit at a time, but unroll the loop 4x to better
- exploit the addx instructions and avoid overhead.
- Peel the first iteration to save a cycle on init. */
-
- /* Avoid negative numbers. */
- xor a5, a2, a3 /* Top bit is 1 if one input is negative. */
- do_abs a3, a3, a6
- do_abs a2, a2, a6
-
- /* Swap so the second argument is smaller. */
- sub a7, a2, a3
- mov a4, a3
- movgez a4, a2, a7 /* a4 = max (a2, a3) */
- movltz a3, a2, a7 /* a3 = min (a2, a3) */
-
- movi a2, 0
- extui a6, a3, 0, 1
- movnez a2, a4, a6
-
- do_addx2 a7, a4, a2, a7
- extui a6, a3, 1, 1
- movnez a2, a7, a6
-
- do_addx4 a7, a4, a2, a7
- extui a6, a3, 2, 1
- movnez a2, a7, a6
-
- do_addx8 a7, a4, a2, a7
- extui a6, a3, 3, 1
- movnez a2, a7, a6
-
- bgeui a3, 16, .Lmult_main_loop
- neg a3, a2
- movltz a2, a3, a5
- leaf_return
-
- .align 4
-.Lmult_main_loop:
- srli a3, a3, 4
- slli a4, a4, 4
-
- add a7, a4, a2
- extui a6, a3, 0, 1
- movnez a2, a7, a6
-
- do_addx2 a7, a4, a2, a7
- extui a6, a3, 1, 1
- movnez a2, a7, a6
-
- do_addx4 a7, a4, a2, a7
- extui a6, a3, 2, 1
- movnez a2, a7, a6
-
- do_addx8 a7, a4, a2, a7
- extui a6, a3, 3, 1
- movnez a2, a7, a6
-
- bgeui a3, 16, .Lmult_main_loop
-
- neg a3, a2
- movltz a2, a3, a5
-
-#endif /* !MUL32 && !MUL16 && !MAC16 */
-
- leaf_return
- .size __mulsi3, . - __mulsi3
-
-#endif /* L_mulsi3 */
-
-
-#ifdef L_umulsidi3
-
-#if !XCHAL_HAVE_MUL16 && !XCHAL_HAVE_MUL32 && !XCHAL_HAVE_MAC16
-#define XCHAL_NO_MUL 1
-#endif
-
- .align 4
- .global __umulsidi3
- .type __umulsidi3, @function
-__umulsidi3:
-#if __XTENSA_CALL0_ABI__
- leaf_entry sp, 32
- addi sp, sp, -32
- s32i a12, sp, 16
- s32i a13, sp, 20
- s32i a14, sp, 24
- s32i a15, sp, 28
-#elif XCHAL_NO_MUL
- /* This is not really a leaf function; allocate enough stack space
- to allow CALL12s to a helper function. */
- leaf_entry sp, 48
-#else
- leaf_entry sp, 16
-#endif
-
-#ifdef __XTENSA_EB__
-#define wh a2
-#define wl a3
-#else
-#define wh a3
-#define wl a2
-#endif /* __XTENSA_EB__ */
-
- /* This code is taken from the mulsf3 routine in ieee754-sf.S.
- See more comments there. */
-
-#if XCHAL_HAVE_MUL32_HIGH
- mull a6, a2, a3
- muluh wh, a2, a3
- mov wl, a6
-
-#else /* ! MUL32_HIGH */
-
-#if __XTENSA_CALL0_ABI__ && XCHAL_NO_MUL
- /* a0 and a8 will be clobbered by calling the multiply function
- but a8 is not used here and need not be saved. */
- s32i a0, sp, 0
-#endif
-
-#if XCHAL_HAVE_MUL16 || XCHAL_HAVE_MUL32
-
-#define a2h a4
-#define a3h a5
-
- /* Get the high halves of the inputs into registers. */
- srli a2h, a2, 16
- srli a3h, a3, 16
-
-#define a2l a2
-#define a3l a3
-
-#if XCHAL_HAVE_MUL32 && !XCHAL_HAVE_MUL16
- /* Clear the high halves of the inputs. This does not matter
- for MUL16 because the high bits are ignored. */
- extui a2, a2, 0, 16
- extui a3, a3, 0, 16
-#endif
-#endif /* MUL16 || MUL32 */
-
-
-#if XCHAL_HAVE_MUL16
-
-#define do_mul(dst, xreg, xhalf, yreg, yhalf) \
- mul16u dst, xreg ## xhalf, yreg ## yhalf
-
-#elif XCHAL_HAVE_MUL32
-
-#define do_mul(dst, xreg, xhalf, yreg, yhalf) \
- mull dst, xreg ## xhalf, yreg ## yhalf
-
-#elif XCHAL_HAVE_MAC16
-
-/* The preprocessor insists on inserting a space when concatenating after
- a period in the definition of do_mul below. These macros are a workaround
- using underscores instead of periods when doing the concatenation. */
-#define umul_aa_ll umul.aa.ll
-#define umul_aa_lh umul.aa.lh
-#define umul_aa_hl umul.aa.hl
-#define umul_aa_hh umul.aa.hh
-
-#define do_mul(dst, xreg, xhalf, yreg, yhalf) \
- umul_aa_ ## xhalf ## yhalf xreg, yreg; \
- rsr dst, ACCLO
-
-#else /* no multiply hardware */
-
-#define set_arg_l(dst, src) \
- extui dst, src, 0, 16
-#define set_arg_h(dst, src) \
- srli dst, src, 16
-
-#if __XTENSA_CALL0_ABI__
-#define do_mul(dst, xreg, xhalf, yreg, yhalf) \
- set_arg_ ## xhalf (a13, xreg); \
- set_arg_ ## yhalf (a14, yreg); \
- call0 .Lmul_mulsi3; \
- mov dst, a12
-#else
-#define do_mul(dst, xreg, xhalf, yreg, yhalf) \
- set_arg_ ## xhalf (a14, xreg); \
- set_arg_ ## yhalf (a15, yreg); \
- call12 .Lmul_mulsi3; \
- mov dst, a14
-#endif /* __XTENSA_CALL0_ABI__ */
-
-#endif /* no multiply hardware */
-
- /* Add pp1 and pp2 into a6 with carry-out in a9. */
- do_mul(a6, a2, l, a3, h) /* pp 1 */
- do_mul(a11, a2, h, a3, l) /* pp 2 */
- movi a9, 0
- add a6, a6, a11
- bgeu a6, a11, 1f
- addi a9, a9, 1
-1:
- /* Shift the high half of a9/a6 into position in a9. Note that
- this value can be safely incremented without any carry-outs. */
- ssai 16
- src a9, a9, a6
-
- /* Compute the low word into a6. */
- do_mul(a11, a2, l, a3, l) /* pp 0 */
- sll a6, a6
- add a6, a6, a11
- bgeu a6, a11, 1f
- addi a9, a9, 1
-1:
- /* Compute the high word into wh. */
- do_mul(wh, a2, h, a3, h) /* pp 3 */
- add wh, wh, a9
- mov wl, a6
-
-#endif /* !MUL32_HIGH */
-
-#if __XTENSA_CALL0_ABI__ && XCHAL_NO_MUL
- /* Restore the original return address. */
- l32i a0, sp, 0
-#endif
-#if __XTENSA_CALL0_ABI__
- l32i a12, sp, 16
- l32i a13, sp, 20
- l32i a14, sp, 24
- l32i a15, sp, 28
- addi sp, sp, 32
-#endif
- leaf_return
-
-#if XCHAL_NO_MUL
-
- /* For Xtensa processors with no multiply hardware, this simplified
- version of _mulsi3 is used for multiplying 16-bit chunks of
- the floating-point mantissas. When using CALL0, this function
- uses a custom ABI: the inputs are passed in a13 and a14, the
- result is returned in a12, and a8 and a15 are clobbered. */
- .align 4
-.Lmul_mulsi3:
- leaf_entry sp, 16
- .macro mul_mulsi3_body dst, src1, src2, tmp1, tmp2
- movi \dst, 0
-1: add \tmp1, \src2, \dst
- extui \tmp2, \src1, 0, 1
- movnez \dst, \tmp1, \tmp2
-
- do_addx2 \tmp1, \src2, \dst, \tmp1
- extui \tmp2, \src1, 1, 1
- movnez \dst, \tmp1, \tmp2
-
- do_addx4 \tmp1, \src2, \dst, \tmp1
- extui \tmp2, \src1, 2, 1
- movnez \dst, \tmp1, \tmp2
-
- do_addx8 \tmp1, \src2, \dst, \tmp1
- extui \tmp2, \src1, 3, 1
- movnez \dst, \tmp1, \tmp2
-
- srli \src1, \src1, 4
- slli \src2, \src2, 4
- bnez \src1, 1b
- .endm
-#if __XTENSA_CALL0_ABI__
- mul_mulsi3_body a12, a13, a14, a15, a8
-#else
- /* The result will be written into a2, so save that argument in a4. */
- mov a4, a2
- mul_mulsi3_body a2, a4, a3, a5, a6
-#endif
- leaf_return
-#endif /* XCHAL_NO_MUL */
-
- .size __umulsidi3, . - __umulsidi3
-
-#endif /* L_umulsidi3 */
-
-
-/* Define a macro for the NSAU (unsigned normalize shift amount)
- instruction, which computes the number of leading zero bits,
- to handle cases where it is not included in the Xtensa processor
- configuration. */
-
- .macro do_nsau cnt, val, tmp, a
-#if XCHAL_HAVE_NSA
- nsau \cnt, \val
-#else
- mov \a, \val
- movi \cnt, 0
- extui \tmp, \a, 16, 16
- bnez \tmp, 0f
- movi \cnt, 16
- slli \a, \a, 16
-0:
- extui \tmp, \a, 24, 8
- bnez \tmp, 1f
- addi \cnt, \cnt, 8
- slli \a, \a, 8
-1:
- movi \tmp, __nsau_data
- extui \a, \a, 24, 8
- add \tmp, \tmp, \a
- l8ui \tmp, \tmp, 0
- add \cnt, \cnt, \tmp
-#endif /* !XCHAL_HAVE_NSA */
- .endm
-
-#ifdef L_clz
- .section .rodata
- .align 4
- .global __nsau_data
- .type __nsau_data, @object
-__nsau_data:
-#if !XCHAL_HAVE_NSA
- .byte 8, 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4
- .byte 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3
- .byte 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2
- .byte 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2
- .byte 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
- .byte 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
- .byte 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
- .byte 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
-#endif /* !XCHAL_HAVE_NSA */
- .size __nsau_data, . - __nsau_data
- .hidden __nsau_data
-#endif /* L_clz */
-
-
-#ifdef L_clzsi2
- .align 4
- .global __clzsi2
- .type __clzsi2, @function
-__clzsi2:
- leaf_entry sp, 16
- do_nsau a2, a2, a3, a4
- leaf_return
- .size __clzsi2, . - __clzsi2
-
-#endif /* L_clzsi2 */
-
-
-#ifdef L_ctzsi2
- .align 4
- .global __ctzsi2
- .type __ctzsi2, @function
-__ctzsi2:
- leaf_entry sp, 16
- neg a3, a2
- and a3, a3, a2
- do_nsau a2, a3, a4, a5
- neg a2, a2
- addi a2, a2, 31
- leaf_return
- .size __ctzsi2, . - __ctzsi2
-
-#endif /* L_ctzsi2 */
-
-
-#ifdef L_ffssi2
- .align 4
- .global __ffssi2
- .type __ffssi2, @function
-__ffssi2:
- leaf_entry sp, 16
- neg a3, a2
- and a3, a3, a2
- do_nsau a2, a3, a4, a5
- neg a2, a2
- addi a2, a2, 32
- leaf_return
- .size __ffssi2, . - __ffssi2
-
-#endif /* L_ffssi2 */
-
-
-#ifdef L_udivsi3
- .align 4
- .global __udivsi3
- .type __udivsi3, @function
-__udivsi3:
- leaf_entry sp, 16
-#if XCHAL_HAVE_DIV32
- quou a2, a2, a3
-#else
- bltui a3, 2, .Lle_one /* check if the divisor <= 1 */
-
- mov a6, a2 /* keep dividend in a6 */
- do_nsau a5, a6, a2, a7 /* dividend_shift = nsau (dividend) */
- do_nsau a4, a3, a2, a7 /* divisor_shift = nsau (divisor) */
- bgeu a5, a4, .Lspecial
-
- sub a4, a4, a5 /* count = divisor_shift - dividend_shift */
- ssl a4
- sll a3, a3 /* divisor <<= count */
- movi a2, 0 /* quotient = 0 */
-
- /* test-subtract-and-shift loop; one quotient bit on each iteration */
-#if XCHAL_HAVE_LOOPS
- loopnez a4, .Lloopend
-#endif /* XCHAL_HAVE_LOOPS */
-.Lloop:
- bltu a6, a3, .Lzerobit
- sub a6, a6, a3
- addi a2, a2, 1
-.Lzerobit:
- slli a2, a2, 1
- srli a3, a3, 1
-#if !XCHAL_HAVE_LOOPS
- addi a4, a4, -1
- bnez a4, .Lloop
-#endif /* !XCHAL_HAVE_LOOPS */
-.Lloopend:
-
- bltu a6, a3, .Lreturn
- addi a2, a2, 1 /* increment quotient if dividend >= divisor */
-.Lreturn:
- leaf_return
-
-.Lle_one:
- beqz a3, .Lerror /* if divisor == 1, return the dividend */
- leaf_return
-
-.Lspecial:
- /* return dividend >= divisor */
- bltu a6, a3, .Lreturn0
- movi a2, 1
- leaf_return
-
-.Lerror:
- /* Divide by zero: Use an illegal instruction to force an exception.
- The subsequent "DIV0" string can be recognized by the exception
- handler to identify the real cause of the exception. */
- ill
- .ascii "DIV0"
-
-.Lreturn0:
- movi a2, 0
-#endif /* XCHAL_HAVE_DIV32 */
- leaf_return
- .size __udivsi3, . - __udivsi3
-
-#endif /* L_udivsi3 */
-
-
-#ifdef L_divsi3
- .align 4
- .global __divsi3
- .type __divsi3, @function
-__divsi3:
- leaf_entry sp, 16
-#if XCHAL_HAVE_DIV32
- quos a2, a2, a3
-#else
- xor a7, a2, a3 /* sign = dividend ^ divisor */
- do_abs a6, a2, a4 /* udividend = abs (dividend) */
- do_abs a3, a3, a4 /* udivisor = abs (divisor) */
- bltui a3, 2, .Lle_one /* check if udivisor <= 1 */
- do_nsau a5, a6, a2, a8 /* udividend_shift = nsau (udividend) */
- do_nsau a4, a3, a2, a8 /* udivisor_shift = nsau (udivisor) */
- bgeu a5, a4, .Lspecial
-
- sub a4, a4, a5 /* count = udivisor_shift - udividend_shift */
- ssl a4
- sll a3, a3 /* udivisor <<= count */
- movi a2, 0 /* quotient = 0 */
-
- /* test-subtract-and-shift loop; one quotient bit on each iteration */
-#if XCHAL_HAVE_LOOPS
- loopnez a4, .Lloopend
-#endif /* XCHAL_HAVE_LOOPS */
-.Lloop:
- bltu a6, a3, .Lzerobit
- sub a6, a6, a3
- addi a2, a2, 1
-.Lzerobit:
- slli a2, a2, 1
- srli a3, a3, 1
-#if !XCHAL_HAVE_LOOPS
- addi a4, a4, -1
- bnez a4, .Lloop
-#endif /* !XCHAL_HAVE_LOOPS */
-.Lloopend:
-
- bltu a6, a3, .Lreturn
- addi a2, a2, 1 /* increment if udividend >= udivisor */
-.Lreturn:
- neg a5, a2
- movltz a2, a5, a7 /* return (sign < 0) ? -quotient : quotient */
- leaf_return
-
-.Lle_one:
- beqz a3, .Lerror
- neg a2, a6 /* if udivisor == 1, then return... */
- movgez a2, a6, a7 /* (sign < 0) ? -udividend : udividend */
- leaf_return
-
-.Lspecial:
- bltu a6, a3, .Lreturn0 /* if dividend < divisor, return 0 */
- movi a2, 1
- movi a4, -1
- movltz a2, a4, a7 /* else return (sign < 0) ? -1 : 1 */
- leaf_return
-
-.Lerror:
- /* Divide by zero: Use an illegal instruction to force an exception.
- The subsequent "DIV0" string can be recognized by the exception
- handler to identify the real cause of the exception. */
- ill
- .ascii "DIV0"
-
-.Lreturn0:
- movi a2, 0
-#endif /* XCHAL_HAVE_DIV32 */
- leaf_return
- .size __divsi3, . - __divsi3
-
-#endif /* L_divsi3 */
-
-
-#ifdef L_umodsi3
- .align 4
- .global __umodsi3
- .type __umodsi3, @function
-__umodsi3:
- leaf_entry sp, 16
-#if XCHAL_HAVE_DIV32
- remu a2, a2, a3
-#else
- bltui a3, 2, .Lle_one /* check if the divisor is <= 1 */
-
- do_nsau a5, a2, a6, a7 /* dividend_shift = nsau (dividend) */
- do_nsau a4, a3, a6, a7 /* divisor_shift = nsau (divisor) */
- bgeu a5, a4, .Lspecial
-
- sub a4, a4, a5 /* count = divisor_shift - dividend_shift */
- ssl a4
- sll a3, a3 /* divisor <<= count */
-
- /* test-subtract-and-shift loop */
-#if XCHAL_HAVE_LOOPS
- loopnez a4, .Lloopend
-#endif /* XCHAL_HAVE_LOOPS */
-.Lloop:
- bltu a2, a3, .Lzerobit
- sub a2, a2, a3
-.Lzerobit:
- srli a3, a3, 1
-#if !XCHAL_HAVE_LOOPS
- addi a4, a4, -1
- bnez a4, .Lloop
-#endif /* !XCHAL_HAVE_LOOPS */
-.Lloopend:
-
-.Lspecial:
- bltu a2, a3, .Lreturn
- sub a2, a2, a3 /* subtract once more if dividend >= divisor */
-.Lreturn:
- leaf_return
-
-.Lle_one:
- bnez a3, .Lreturn0
-
- /* Divide by zero: Use an illegal instruction to force an exception.
- The subsequent "DIV0" string can be recognized by the exception
- handler to identify the real cause of the exception. */
- ill
- .ascii "DIV0"
-
-.Lreturn0:
- movi a2, 0
-#endif /* XCHAL_HAVE_DIV32 */
- leaf_return
- .size __umodsi3, . - __umodsi3
-
-#endif /* L_umodsi3 */
-
-
-#ifdef L_modsi3
- .align 4
- .global __modsi3
- .type __modsi3, @function
-__modsi3:
- leaf_entry sp, 16
-#if XCHAL_HAVE_DIV32
- rems a2, a2, a3
-#else
- mov a7, a2 /* save original (signed) dividend */
- do_abs a2, a2, a4 /* udividend = abs (dividend) */
- do_abs a3, a3, a4 /* udivisor = abs (divisor) */
- bltui a3, 2, .Lle_one /* check if udivisor <= 1 */
- do_nsau a5, a2, a6, a8 /* udividend_shift = nsau (udividend) */
- do_nsau a4, a3, a6, a8 /* udivisor_shift = nsau (udivisor) */
- bgeu a5, a4, .Lspecial
-
- sub a4, a4, a5 /* count = udivisor_shift - udividend_shift */
- ssl a4
- sll a3, a3 /* udivisor <<= count */
-
- /* test-subtract-and-shift loop */
-#if XCHAL_HAVE_LOOPS
- loopnez a4, .Lloopend
-#endif /* XCHAL_HAVE_LOOPS */
-.Lloop:
- bltu a2, a3, .Lzerobit
- sub a2, a2, a3
-.Lzerobit:
- srli a3, a3, 1
-#if !XCHAL_HAVE_LOOPS
- addi a4, a4, -1
- bnez a4, .Lloop
-#endif /* !XCHAL_HAVE_LOOPS */
-.Lloopend:
-
-.Lspecial:
- bltu a2, a3, .Lreturn
- sub a2, a2, a3 /* subtract again if udividend >= udivisor */
-.Lreturn:
- bgez a7, .Lpositive
- neg a2, a2 /* if (dividend < 0), return -udividend */
-.Lpositive:
- leaf_return
-
-.Lle_one:
- bnez a3, .Lreturn0
-
- /* Divide by zero: Use an illegal instruction to force an exception.
- The subsequent "DIV0" string can be recognized by the exception
- handler to identify the real cause of the exception. */
- ill
- .ascii "DIV0"
-
-.Lreturn0:
- movi a2, 0
-#endif /* XCHAL_HAVE_DIV32 */
- leaf_return
- .size __modsi3, . - __modsi3
-
-#endif /* L_modsi3 */
-
-
-#ifdef __XTENSA_EB__
-#define uh a2
-#define ul a3
-#else
-#define uh a3
-#define ul a2
-#endif /* __XTENSA_EB__ */
-
-
-#ifdef L_ashldi3
- .align 4
- .global __ashldi3
- .type __ashldi3, @function
-__ashldi3:
- leaf_entry sp, 16
- ssl a4
- bgei a4, 32, .Llow_only
- src uh, uh, ul
- sll ul, ul
- leaf_return
-
-.Llow_only:
- sll uh, ul
- movi ul, 0
- leaf_return
- .size __ashldi3, . - __ashldi3
-
-#endif /* L_ashldi3 */
-
-
-#ifdef L_ashrdi3
- .align 4
- .global __ashrdi3
- .type __ashrdi3, @function
-__ashrdi3:
- leaf_entry sp, 16
- ssr a4
- bgei a4, 32, .Lhigh_only
- src ul, uh, ul
- sra uh, uh
- leaf_return
-
-.Lhigh_only:
- sra ul, uh
- srai uh, uh, 31
- leaf_return
- .size __ashrdi3, . - __ashrdi3
-
-#endif /* L_ashrdi3 */
-
-
-#ifdef L_lshrdi3
- .align 4
- .global __lshrdi3
- .type __lshrdi3, @function
-__lshrdi3:
- leaf_entry sp, 16
- ssr a4
- bgei a4, 32, .Lhigh_only1
- src ul, uh, ul
- srl uh, uh
- leaf_return
-
-.Lhigh_only1:
- srl ul, uh
- movi uh, 0
- leaf_return
- .size __lshrdi3, . - __lshrdi3
-
-#endif /* L_lshrdi3 */
-
-
-#include "ieee754-df.S"
-#include "ieee754-sf.S"
diff --git a/gcc/config/xtensa/lib2funcs.S b/gcc/config/xtensa/lib2funcs.S
deleted file mode 100644
index 65134e24ccf..00000000000
--- a/gcc/config/xtensa/lib2funcs.S
+++ /dev/null
@@ -1,186 +0,0 @@
-/* Assembly functions for libgcc2.
- Copyright (C) 2001, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
- Contributed by Bob Wilson (bwilson@tensilica.com) at Tensilica.
-
-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/>. */
-
-#include "xtensa-config.h"
-
-/* __xtensa_libgcc_window_spill: This function flushes out all but the
- current register window. This is used to set up the stack so that
- arbitrary frames can be accessed. */
-
- .align 4
- .global __xtensa_libgcc_window_spill
- .type __xtensa_libgcc_window_spill,@function
-__xtensa_libgcc_window_spill:
- entry sp, 32
- movi a2, 0
- syscall
- retw
- .size __xtensa_libgcc_window_spill, .-__xtensa_libgcc_window_spill
-
-
-/* __xtensa_nonlocal_goto: This code does all the hard work of a
- nonlocal goto on Xtensa. It is here in the library to avoid the
- code size bloat of generating it in-line. There are two
- arguments:
-
- a2 = frame pointer for the procedure containing the label
- a3 = goto handler address
-
- This function never returns to its caller but instead goes directly
- to the address of the specified goto handler. */
-
- .align 4
- .global __xtensa_nonlocal_goto
- .type __xtensa_nonlocal_goto,@function
-__xtensa_nonlocal_goto:
- entry sp, 32
-
- /* Flush registers. */
- mov a5, a2
- movi a2, 0
- syscall
- mov a2, a5
-
- /* Because the save area for a0-a3 is stored one frame below
- the one identified by a2, the only way to restore those
- registers is to unwind the stack. If alloca() were never
- called, we could just unwind until finding the sp value
- matching a2. However, a2 is a frame pointer, not a stack
- pointer, and may not be encountered during the unwinding.
- The solution is to unwind until going _past_ the value
- given by a2. This involves keeping three stack pointer
- values during the unwinding:
-
- next = sp of frame N-1
- cur = sp of frame N
- prev = sp of frame N+1
-
- When next > a2, the desired save area is stored relative
- to prev. At this point, cur will be the same as a2
- except in the alloca() case.
-
- Besides finding the values to be restored to a0-a3, we also
- need to find the current window size for the target
- function. This can be extracted from the high bits of the
- return address, initially in a0. As the unwinding
- proceeds, the window size is taken from the value of a0
- saved _two_ frames below the current frame. */
-
- addi a5, sp, -16 /* a5 = prev - save area */
- l32i a6, a5, 4
- addi a6, a6, -16 /* a6 = cur - save area */
- mov a8, a0 /* a8 = return address (for window size) */
- j .Lfirstframe
-
-.Lnextframe:
- l32i a8, a5, 0 /* next return address (for window size) */
- mov a5, a6 /* advance prev */
- addi a6, a7, -16 /* advance cur */
-.Lfirstframe:
- l32i a7, a6, 4 /* a7 = next */
- bgeu a2, a7, .Lnextframe
-
- /* At this point, prev (a5) points to the save area with the saved
- values of a0-a3. Copy those values into the save area at the
- current sp so they will be reloaded when the return from this
- function underflows. We don't have to worry about exceptions
- while updating the current save area, because the windows have
- already been flushed. */
-
- addi a4, sp, -16 /* a4 = save area of this function */
- l32i a6, a5, 0
- l32i a7, a5, 4
- s32i a6, a4, 0
- s32i a7, a4, 4
- l32i a6, a5, 8
- l32i a7, a5, 12
- s32i a6, a4, 8
- s32i a7, a4, 12
-
- /* Set return address to goto handler. Use the window size bits
- from the return address two frames below the target. */
- extui a8, a8, 30, 2 /* get window size from return addr. */
- slli a3, a3, 2 /* get goto handler addr. << 2 */
- ssai 2
- src a0, a8, a3 /* combine them with a funnel shift */
-
- retw
- .size __xtensa_nonlocal_goto, .-__xtensa_nonlocal_goto
-
-
-/* __xtensa_sync_caches: This function is called after writing a trampoline
- on the stack to force all the data writes to memory and invalidate the
- instruction cache. a2 is the address of the new trampoline.
-
- After the trampoline data is written out, it must be flushed out of
- the data cache into memory. We use DHWB in case we have a writeback
- cache. At least one DHWB instruction is needed for each data cache
- line which may be touched by the trampoline. An ISYNC instruction
- must follow the DHWBs.
-
- We have to flush the i-cache to make sure that the new values get used.
- At least one IHI instruction is needed for each i-cache line which may
- be touched by the trampoline. An ISYNC instruction is also needed to
- make sure that the modified instructions are loaded into the instruction
- fetch buffer. */
-
-/* Use the maximum trampoline size. Flushing a bit extra is OK. */
-#define TRAMPOLINE_SIZE 60
-
- .text
- .align 4
- .global __xtensa_sync_caches
- .type __xtensa_sync_caches,@function
-__xtensa_sync_caches:
- entry sp, 32
-#if XCHAL_DCACHE_SIZE > 0
- /* Flush the trampoline from the data cache. */
- extui a4, a2, 0, XCHAL_DCACHE_LINEWIDTH
- addi a4, a4, TRAMPOLINE_SIZE
- addi a4, a4, (1 << XCHAL_DCACHE_LINEWIDTH) - 1
- srli a4, a4, XCHAL_DCACHE_LINEWIDTH
- mov a3, a2
-.Ldcache_loop:
- dhwb a3, 0
- addi a3, a3, (1 << XCHAL_DCACHE_LINEWIDTH)
- addi a4, a4, -1
- bnez a4, .Ldcache_loop
- isync
-#endif
-#if XCHAL_ICACHE_SIZE > 0
- /* Invalidate the corresponding lines in the instruction cache. */
- extui a4, a2, 0, XCHAL_ICACHE_LINEWIDTH
- addi a4, a4, TRAMPOLINE_SIZE
- addi a4, a4, (1 << XCHAL_ICACHE_LINEWIDTH) - 1
- srli a4, a4, XCHAL_ICACHE_LINEWIDTH
-.Licache_loop:
- ihi a2, 0
- addi a2, a2, (1 << XCHAL_ICACHE_LINEWIDTH)
- addi a4, a4, -1
- bnez a4, .Licache_loop
-#endif
- isync
- retw
- .size __xtensa_sync_caches, .-__xtensa_sync_caches
diff --git a/gcc/config/xtensa/libgcc-xtensa.ver b/gcc/config/xtensa/libgcc-xtensa.ver
deleted file mode 100644
index 43e7d4fc7c7..00000000000
--- a/gcc/config/xtensa/libgcc-xtensa.ver
+++ /dev/null
@@ -1,3 +0,0 @@
-GCC_4.3.0 {
- __umulsidi3
-}
diff --git a/gcc/config/xtensa/t-elf b/gcc/config/xtensa/t-elf
deleted file mode 100644
index 7d6cd1a3a9b..00000000000
--- a/gcc/config/xtensa/t-elf
+++ /dev/null
@@ -1,6 +0,0 @@
-# Build CRT files and libgcc with the "longcalls" option
-CRTSTUFF_T_CFLAGS += -mlongcalls
-CRTSTUFF_T_CFLAGS_S += -mlongcalls
-TARGET_LIBGCC2_CFLAGS += -mlongcalls
-
-EXTRA_MULTILIB_PARTS = crti.o crtn.o crtbegin.o crtend.o
diff --git a/gcc/config/xtensa/t-linux b/gcc/config/xtensa/t-linux
deleted file mode 100644
index 7d535e155b4..00000000000
--- a/gcc/config/xtensa/t-linux
+++ /dev/null
@@ -1,3 +0,0 @@
-EXTRA_MULTILIB_PARTS = crtbegin.o crtend.o crtbeginS.o crtendS.o crtbeginT.o
-
-SHLIB_MAPFILES += $(srcdir)/config/xtensa/libgcc-xtensa.ver
diff --git a/gcc/config/xtensa/t-xtensa b/gcc/config/xtensa/t-xtensa
index 641e6fe7620..6ec56969fe4 100644
--- a/gcc/config/xtensa/t-xtensa
+++ b/gcc/config/xtensa/t-xtensa
@@ -17,25 +17,4 @@
# along with GCC; see the file COPYING3. If not see
# <http://www.gnu.org/licenses/>.
-LIB1ASMSRC = xtensa/lib1funcs.asm
-LIB1ASMFUNCS = _mulsi3 _divsi3 _modsi3 _udivsi3 _umodsi3 \
- _umulsidi3 _clz _clzsi2 _ctzsi2 _ffssi2 \
- _ashldi3 _ashrdi3 _lshrdi3 \
- _negsf2 _addsubsf3 _mulsf3 _divsf3 _cmpsf2 _fixsfsi _fixsfdi \
- _fixunssfsi _fixunssfdi _floatsisf _floatunsisf \
- _floatdisf _floatundisf \
- _negdf2 _addsubdf3 _muldf3 _divdf3 _cmpdf2 _fixdfsi _fixdfdi \
- _fixunsdfsi _fixunsdfdi _floatsidf _floatunsidf \
- _floatdidf _floatundidf \
- _truncdfsf2 _extendsfdf2
-
-LIB2FUNCS_EXTRA = $(srcdir)/config/xtensa/lib2funcs.S
-
-$(T)crti.o: $(srcdir)/config/xtensa/crti.asm $(GCC_PASSES)
- $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(MULTILIB_CFLAGS) $(INCLUDES) \
- -c -o $(T)crti.o -x assembler-with-cpp $(srcdir)/config/xtensa/crti.asm
-$(T)crtn.o: $(srcdir)/config/xtensa/crtn.asm $(GCC_PASSES)
- $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(MULTILIB_CFLAGS) $(INCLUDES) \
- -c -o $(T)crtn.o -x assembler-with-cpp $(srcdir)/config/xtensa/crtn.asm
-
$(out_object_file): gt-xtensa.h
diff --git a/gcc/configure b/gcc/configure
index 0540430dc20..99334ce44fd 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -618,12 +618,9 @@ xm_include_list
xm_file_list
tm_p_include_list
tm_p_file_list
-libgcc_tm_include_list
-libgcc_tm_file_list
tm_defines
tm_include_list
tm_file_list
-thread_file
common_out_object_file
common_out_file
out_object_file
@@ -645,7 +642,6 @@ gcc_config_arguments
float_h_file
extra_programs
extra_passes
-extra_parts
extra_objs
extra_headers_list
user_headers_inc_next_post
@@ -671,7 +667,6 @@ all_gtfiles
all_compilers
srcdir
subdirs
-slibdir
dollar
gcc_tooldir
enable_lto
@@ -728,7 +723,6 @@ LIBINTL
USE_NLS
extra_opt_files
extra_modes_file
-gthread_flags
NATIVE_SYSTEM_HEADER_DIR
objext
manext
@@ -777,6 +771,7 @@ valgrind_path_defines
valgrind_path
TREEBROWSER
nocommon_flag
+noexception_flags
warn_cxxflags
warn_cflags
c_strict_warn
@@ -918,7 +913,6 @@ with_gc
with_system_zlib
enable_maintainer_mode
enable_version_specific_runtime_libs
-with_slibdir
enable_plugin
enable_libquadmath_support
with_linker_hash_style
@@ -1674,7 +1668,6 @@ Optional Packages:
--with-gc={page,zone} choose the garbage collection mechanism to use with
the compiler
--with-system-zlib use installed libz
- --with-slibdir=DIR shared libraries in DIR [LIBDIR]
--with-linker-hash-style={sysv,gnu,both}
specify the linker hash style
@@ -6402,11 +6395,12 @@ fi
# * 'long long'
# * variadic macros
# * overlong strings
+# * C++11 narrowing conversions in { }
# So, we only use -pedantic if we can disable those warnings.
loose_warn=
save_CFLAGS="$CFLAGS"
-for option in -W -Wall -Wwrite-strings -Wcast-qual; do
+for option in -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual; do
as_acx_Woption=`$as_echo "acx_cv_prog_cc_warning_$option" | $as_tr_sh`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports $option" >&5
@@ -6620,6 +6614,47 @@ fi
+# Disable exceptions and RTTI if building with g++
+noexception_flags=
+save_CFLAGS="$CFLAGS"
+for option in -fno-exceptions -fno-rtti; do
+ as_acx_Woption=`$as_echo "acx_cv_prog_cc_warning_$option" | $as_tr_sh`
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports $option" >&5
+$as_echo_n "checking whether $CC supports $option... " >&6; }
+if { as_var=$as_acx_Woption; eval "test \"\${$as_var+set}\" = set"; }; then :
+ $as_echo_n "(cached) " >&6
+else
+ CFLAGS="$option"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ eval "$as_acx_Woption=yes"
+else
+ eval "$as_acx_Woption=no"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+fi
+eval ac_res=\$$as_acx_Woption
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+ if test `eval 'as_val=${'$as_acx_Woption'};$as_echo "$as_val"'` = yes; then :
+ noexception_flags="$noexception_flags${noexception_flags:+ }$option"
+fi
+ done
+CFLAGS="$save_CFLAGS"
+
+
# Enable expensive internal checks
is_release=
if test x"`cat $srcdir/DEV-PHASE`" != xexperimental; then
@@ -11359,19 +11394,6 @@ if test x${thread_file} = x; then
thread_file=${target_thread_file}
fi
-# Make gthr-default.h if we have a thread file.
-gthread_flags=
-if test $thread_file != single; then
- echo "#include \"gthr-${thread_file}.h\"" > gthr-default.h-t
- if diff gthr-default.h-t gthr-default.h 2>/dev/null; then
- rm -f gthr-default.h-t
- else
- mv -f gthr-default.h-t gthr-default.h
- fi
- gthread_flags=-DHAVE_GTHR_DEFAULT
-fi
-
-
# --------
# UNSORTED
# --------
@@ -11793,13 +11815,6 @@ for f in $tm_file; do
esac
done
-libgcc_tm_file_list=
-libgcc_tm_include_list=
-for f in $libgcc_tm_file; do
- libgcc_tm_file_list="${libgcc_tm_file_list} \$(srcdir)/../libgcc/config/$f"
- libgcc_tm_include_list="${libgcc_tm_include_list} ../libgcc/config/$f"
-done
-
tm_p_file_list=
tm_p_include_list=
for f in $tm_p_file; do
@@ -18072,7 +18087,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 18075 "configure"
+#line 18090 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -18178,7 +18193,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 18181 "configure"
+#line 18196 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -26957,22 +26972,6 @@ if test "${enable_version_specific_runtime_libs+set}" = set; then :
fi
-
-# Check whether --with-slibdir was given.
-if test "${with_slibdir+set}" = set; then :
- withval=$with_slibdir; slibdir="$with_slibdir"
-else
- if test "${enable_version_specific_runtime_libs+set}" = set; then
- slibdir='$(libsubdir)'
-elif test "$host" != "$target"; then
- slibdir='$(build_tooldir)/lib'
-else
- slibdir='$(libdir)'
-fi
-fi
-
-
-
# Substitute configuration variables
@@ -27036,10 +27035,6 @@ fi
-
-
-
-
# Echo link setup.
if test x${build} = x${host} ; then
if test x${host} = x${target} ; then
diff --git a/gcc/configure.ac b/gcc/configure.ac
index d63acea68f5..c7654259c4a 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -329,10 +329,11 @@ GCC_STDINT_TYPES
# * 'long long'
# * variadic macros
# * overlong strings
+# * C++11 narrowing conversions in { }
# So, we only use -pedantic if we can disable those warnings.
ACX_PROG_CC_WARNING_OPTS(
- m4_quote(m4_do([-W -Wall -Wwrite-strings -Wcast-qual])), [loose_warn])
+ m4_quote(m4_do([-W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual])), [loose_warn])
ACX_PROG_CC_WARNING_OPTS(
m4_quote(m4_do([-Wstrict-prototypes -Wmissing-prototypes])),
[c_loose_warn])
@@ -357,6 +358,10 @@ fi
AC_SUBST(warn_cflags)
AC_SUBST(warn_cxxflags)
+# Disable exceptions and RTTI if building with g++
+ACX_PROG_CC_WARNING_OPTS(
+ m4_quote(m4_do([-fno-exceptions -fno-rtti])), [noexception_flags])
+
# Enable expensive internal checks
is_release=
if test x"`cat $srcdir/DEV-PHASE`" != xexperimental; then
@@ -1416,19 +1421,6 @@ if test x${thread_file} = x; then
thread_file=${target_thread_file}
fi
-# Make gthr-default.h if we have a thread file.
-gthread_flags=
-if test $thread_file != single; then
- echo "#include \"gthr-${thread_file}.h\"" > gthr-default.h-t
- if diff gthr-default.h-t gthr-default.h 2>/dev/null; then
- rm -f gthr-default.h-t
- else
- mv -f gthr-default.h-t gthr-default.h
- fi
- gthread_flags=-DHAVE_GTHR_DEFAULT
-fi
-AC_SUBST(gthread_flags)
-
# --------
# UNSORTED
# --------
@@ -1715,13 +1707,6 @@ for f in $tm_file; do
esac
done
-libgcc_tm_file_list=
-libgcc_tm_include_list=
-for f in $libgcc_tm_file; do
- libgcc_tm_file_list="${libgcc_tm_file_list} \$(srcdir)/../libgcc/config/$f"
- libgcc_tm_include_list="${libgcc_tm_include_list} ../libgcc/config/$f"
-done
-
tm_p_file_list=
tm_p_include_list=
for f in $tm_p_file; do
@@ -4921,18 +4906,6 @@ AC_ARG_ENABLE(version-specific-runtime-libs,
[specify that runtime libraries should be
installed in a compiler-specific directory])])
-AC_ARG_WITH(slibdir,
-[AS_HELP_STRING([--with-slibdir=DIR], [shared libraries in DIR @<:@LIBDIR@:>@])],
-slibdir="$with_slibdir",
-if test "${enable_version_specific_runtime_libs+set}" = set; then
- slibdir='$(libsubdir)'
-elif test "$host" != "$target"; then
- slibdir='$(build_tooldir)/lib'
-else
- slibdir='$(libdir)'
-fi)
-AC_SUBST(slibdir)
-
# Substitute configuration variables
AC_SUBST(subdirs)
AC_SUBST(srcdir)
@@ -4959,7 +4932,6 @@ AC_SUBST(user_headers_inc_next_pre)
AC_SUBST(user_headers_inc_next_post)
AC_SUBST(extra_headers_list)
AC_SUBST(extra_objs)
-AC_SUBST(extra_parts)
AC_SUBST(extra_passes)
AC_SUBST(extra_programs)
AC_SUBST(float_h_file)
@@ -4981,12 +4953,9 @@ AC_SUBST(out_file)
AC_SUBST(out_object_file)
AC_SUBST(common_out_file)
AC_SUBST(common_out_object_file)
-AC_SUBST(thread_file)
AC_SUBST(tm_file_list)
AC_SUBST(tm_include_list)
AC_SUBST(tm_defines)
-AC_SUBST(libgcc_tm_file_list)
-AC_SUBST(libgcc_tm_include_list)
AC_SUBST(tm_p_file_list)
AC_SUBST(tm_p_include_list)
AC_SUBST(xm_file_list)
diff --git a/gcc/coretypes.h b/gcc/coretypes.h
index 45cdbbd6fd6..1374a98a810 100644
--- a/gcc/coretypes.h
+++ b/gcc/coretypes.h
@@ -181,5 +181,18 @@ union _dont_use_tree_here_;
#endif
+/* Memory model types for the __atomic* builtins.
+ This must match the order in libstdc++-v3/include/bits/atomic_base.h. */
+enum memmodel
+{
+ MEMMODEL_RELAXED = 0,
+ MEMMODEL_CONSUME = 1,
+ MEMMODEL_ACQUIRE = 2,
+ MEMMODEL_RELEASE = 3,
+ MEMMODEL_ACQ_REL = 4,
+ MEMMODEL_SEQ_CST = 5,
+ MEMMODEL_LAST = 6
+};
+
#endif /* coretypes.h */
diff --git a/gcc/coverage.c b/gcc/coverage.c
index 24e0e3d87f2..520652b1e71 100644
--- a/gcc/coverage.c
+++ b/gcc/coverage.c
@@ -1,6 +1,6 @@
/* Read and write coverage files, and associated functionality.
Copyright (C) 1990, 1991, 1992, 1993, 1994, 1996, 1997, 1998, 1999,
- 2000, 2001, 2003, 2004, 2005, 2007, 2008, 2009, 2010
+ 2000, 2001, 2003, 2004, 2005, 2007, 2008, 2009, 2010, 2011
Free Software Foundation, Inc.
Contributed by James E. Wilson, UC Berkeley/Cygnus Support;
based on some ideas from Dain Samples of UC Berkeley.
@@ -54,13 +54,14 @@ along with GCC; see the file COPYING3. If not see
#include "gcov-io.h"
#include "gcov-io.c"
-struct function_list
+struct GTY((chain_next ("%h.next"))) function_list
{
struct function_list *next; /* next function */
unsigned ident; /* function ident */
unsigned lineno_checksum; /* function lineno checksum */
unsigned cfg_checksum; /* function cfg checksum */
- unsigned n_ctrs[GCOV_COUNTERS];/* number of counters. */
+ tree fn_decl; /* the function decl */
+ tree ctr_vars[GCOV_COUNTERS]; /* counter variables. */
};
/* Counts information for a function. */
@@ -75,22 +76,18 @@ typedef struct counts_entry
unsigned cfg_checksum;
gcov_type *counts;
struct gcov_ctr_summary summary;
-
- /* Workspace */
- struct counts_entry *chain;
-
} counts_entry_t;
-static struct function_list *functions_head = 0;
+static GTY(()) struct function_list *functions_head = 0;
static struct function_list **functions_tail = &functions_head;
static unsigned no_coverage = 0;
/* Cumulative counter information for whole program. */
static unsigned prg_ctr_mask; /* Mask of counter types generated. */
-static unsigned prg_n_ctrs[GCOV_COUNTERS]; /* Total counters allocated. */
/* Counter information for current function. */
static unsigned fn_ctr_mask; /* Mask of counters used. */
+static GTY(()) tree fn_v_ctrs[GCOV_COUNTERS]; /* counter variables. */
static unsigned fn_n_ctrs[GCOV_COUNTERS]; /* Counters allocated. */
static unsigned fn_b_ctrs[GCOV_COUNTERS]; /* Allocation base. */
@@ -105,9 +102,6 @@ static char *da_file_name;
/* Hash table of count data. */
static htab_t counts_hash = NULL;
-/* Trees representing the counter table arrays. */
-static GTY(()) tree tree_ctr_tables[GCOV_COUNTERS];
-
/* The names of merge functions for counters. */
static const char *const ctr_merge_functions[GCOV_COUNTERS] = GCOV_MERGE_FUNCTIONS;
static const char *const ctr_names[GCOV_COUNTERS] = GCOV_COUNTER_NAMES;
@@ -117,11 +111,11 @@ static hashval_t htab_counts_entry_hash (const void *);
static int htab_counts_entry_eq (const void *, const void *);
static void htab_counts_entry_del (void *);
static void read_counts_file (void);
-static tree build_fn_info_type (unsigned);
-static tree build_fn_info_value (const struct function_list *, tree);
-static tree build_ctr_info_type (void);
-static tree build_ctr_info_value (unsigned, tree);
-static tree build_gcov_info (void);
+static tree build_var (tree, tree, int);
+static void build_fn_info_type (tree, unsigned, tree);
+static tree build_fn_info (const struct function_list *, tree, tree);
+static void build_info_type (tree, unsigned, tree);
+static tree build_info (tree, tree, tree, unsigned);
static void create_coverage (void);
/* Return the type node for gcov_type. */
@@ -172,8 +166,8 @@ static void
read_counts_file (void)
{
gcov_unsigned_t fn_ident = 0;
- counts_entry_t *summaried = NULL;
- unsigned seen_summary = 0;
+ struct gcov_summary summary;
+ unsigned new_summary = 1;
gcov_unsigned_t tag;
int is_error = 0;
unsigned lineno_checksum = 0;
@@ -216,42 +210,34 @@ read_counts_file (void)
offset = gcov_position ();
if (tag == GCOV_TAG_FUNCTION)
{
- fn_ident = gcov_read_unsigned ();
- lineno_checksum = gcov_read_unsigned ();
- cfg_checksum = gcov_read_unsigned ();
- if (seen_summary)
+ if (length)
{
- /* We have already seen a summary, this means that this
- new function begins a new set of program runs. We
- must unlink the summaried chain. */
- counts_entry_t *entry, *chain;
-
- for (entry = summaried; entry; entry = chain)
- {
- chain = entry->chain;
- entry->chain = NULL;
- }
- summaried = NULL;
- seen_summary = 0;
+ fn_ident = gcov_read_unsigned ();
+ lineno_checksum = gcov_read_unsigned ();
+ cfg_checksum = gcov_read_unsigned ();
}
+ else
+ fn_ident = lineno_checksum = cfg_checksum = 0;
+ new_summary = 1;
}
else if (tag == GCOV_TAG_PROGRAM_SUMMARY)
{
- counts_entry_t *entry;
- struct gcov_summary summary;
+ struct gcov_summary sum;
+ unsigned ix;
- gcov_read_summary (&summary);
- seen_summary = 1;
- for (entry = summaried; entry; entry = entry->chain)
- {
- struct gcov_ctr_summary *csum = &summary.ctrs[entry->ctr];
+ if (new_summary)
+ memset (&summary, 0, sizeof (summary));
- entry->summary.runs += csum->runs;
- entry->summary.sum_all += csum->sum_all;
- if (entry->summary.run_max < csum->run_max)
- entry->summary.run_max = csum->run_max;
- entry->summary.sum_max += csum->sum_max;
+ gcov_read_summary (&sum);
+ for (ix = 0; ix != GCOV_COUNTERS_SUMMABLE; ix++)
+ {
+ summary.ctrs[ix].runs += sum.ctrs[ix].runs;
+ summary.ctrs[ix].sum_all += sum.ctrs[ix].sum_all;
+ if (summary.ctrs[ix].run_max < sum.ctrs[ix].run_max)
+ summary.ctrs[ix].run_max = sum.ctrs[ix].run_max;
+ summary.ctrs[ix].sum_max += sum.ctrs[ix].sum_max;
}
+ new_summary = 0;
}
else if (GCOV_TAG_IS_COUNTER (tag) && fn_ident)
{
@@ -272,6 +258,7 @@ read_counts_file (void)
entry->ctr = elt.ctr;
entry->lineno_checksum = lineno_checksum;
entry->cfg_checksum = cfg_checksum;
+ entry->summary = summary.ctrs[elt.ctr];
entry->summary.num = n_counts;
entry->counts = XCNEWVEC (gcov_type, n_counts);
}
@@ -298,15 +285,13 @@ read_counts_file (void)
ctr_names[elt.ctr], fn_ident);
goto skip_merge;
}
-
- if (elt.ctr < GCOV_COUNTERS_SUMMABLE
- /* This should always be true for a just allocated entry,
- and always false for an existing one. Check this way, in
- case the gcov file is corrupt. */
- && (!entry->chain || summaried != entry))
+ else
{
- entry->chain = summaried;
- summaried = entry;
+ entry->summary.runs += summary.ctrs[elt.ctr].runs;
+ entry->summary.sum_all += summary.ctrs[elt.ctr].sum_all;
+ if (entry->summary.run_max < summary.ctrs[elt.ctr].run_max)
+ entry->summary.run_max = summary.ctrs[elt.ctr].run_max;
+ entry->summary.sum_max += summary.ctrs[elt.ctr].sum_max;
}
for (ix = 0; ix != n_counts; ix++)
entry->counts[ix] += gcov_read_counter ();
@@ -350,13 +335,12 @@ get_coverage_counts (unsigned counter, unsigned expected,
elt.ident = current_function_funcdef_no + 1;
elt.ctr = counter;
entry = (counts_entry_t *) htab_find (counts_hash, &elt);
- if (!entry)
- {
- warning (0, "no coverage for function %qE found",
- DECL_ASSEMBLER_NAME (current_function_decl));
- return NULL;
- }
-
+ if (!entry || !entry->summary.num)
+ /* The function was not emitted, or is weak and not chosen in the
+ final executable. Silently fail, because there's nothing we
+ can do about it. */
+ return NULL;
+
if (entry->cfg_checksum != cfg_checksum
|| entry->summary.num != expected)
{
@@ -366,11 +350,11 @@ get_coverage_counts (unsigned counter, unsigned expected,
warning_printed =
warning_at (input_location, OPT_Wcoverage_mismatch,
- "The control flow of function %qE does not match "
+ "the control flow of function %qE does not match "
"its profile data (counter %qs)", id, ctr_names[counter]);
if (warning_printed)
{
- inform (input_location, "Use -Wno-error=coverage-mismatch to tolerate "
+ inform (input_location, "use -Wno-error=coverage-mismatch to tolerate "
"the mismatch but performance may drop if the function is hot");
if (!seen_error ()
@@ -388,12 +372,12 @@ get_coverage_counts (unsigned counter, unsigned expected,
return NULL;
}
- else if (entry->lineno_checksum != lineno_checksum)
- {
- warning (0, "Source location for function %qE have changed,"
- " the profile data may be out of date",
- DECL_ASSEMBLER_NAME (current_function_decl));
- }
+ else if (entry->lineno_checksum != lineno_checksum)
+ {
+ warning (0, "source location for function %qE have changed,"
+ " the profile data may be out of date",
+ DECL_ASSEMBLER_NAME (current_function_decl));
+ }
if (summary)
*summary = &entry->summary;
@@ -413,28 +397,17 @@ coverage_counter_alloc (unsigned counter, unsigned num)
if (!num)
return 1;
- if (!tree_ctr_tables[counter])
+ if (!fn_v_ctrs[counter])
{
- /* Generate and save a copy of this so it can be shared. Leave
- the index type unspecified for now; it will be set after all
- functions have been compiled. */
- char buf[20];
- tree gcov_type_node = get_gcov_type ();
- tree gcov_type_array_type
- = build_array_type (gcov_type_node, NULL_TREE);
- tree_ctr_tables[counter]
- = build_decl (BUILTINS_LOCATION,
- VAR_DECL, NULL_TREE, gcov_type_array_type);
- TREE_STATIC (tree_ctr_tables[counter]) = 1;
- ASM_GENERATE_INTERNAL_LABEL (buf, "LPBX", counter + 1);
- DECL_NAME (tree_ctr_tables[counter]) = get_identifier (buf);
- DECL_ALIGN (tree_ctr_tables[counter]) = TYPE_ALIGN (gcov_type_node);
-
- if (dump_file)
- fprintf (dump_file, "Using data file %s\n", da_file_name);
+ tree array_type = build_array_type (get_gcov_type (), NULL_TREE);
+
+ fn_v_ctrs[counter]
+ = build_var (current_function_decl, array_type, counter);
}
+
fn_b_ctrs[counter] = fn_n_ctrs[counter];
fn_n_ctrs[counter] += num;
+
fn_ctr_mask |= 1 << counter;
return 1;
}
@@ -447,10 +420,11 @@ tree_coverage_counter_ref (unsigned counter, unsigned no)
tree gcov_type_node = get_gcov_type ();
gcc_assert (no < fn_n_ctrs[counter] - fn_b_ctrs[counter]);
- no += prg_n_ctrs[counter] + fn_b_ctrs[counter];
+ no += fn_b_ctrs[counter];
+
/* "no" here is an array index, scaled to bytes later. */
- return build4 (ARRAY_REF, gcov_type_node, tree_ctr_tables[counter],
+ return build4 (ARRAY_REF, gcov_type_node, fn_v_ctrs[counter],
build_int_cst (integer_type_node, no), NULL, NULL);
}
@@ -462,13 +436,11 @@ tree_coverage_counter_addr (unsigned counter, unsigned no)
tree gcov_type_node = get_gcov_type ();
gcc_assert (no < fn_n_ctrs[counter] - fn_b_ctrs[counter]);
- no += prg_n_ctrs[counter] + fn_b_ctrs[counter];
-
- TREE_ADDRESSABLE (tree_ctr_tables[counter]) = 1;
+ no += fn_b_ctrs[counter];
/* "no" here is an array index, scaled to bytes later. */
return build_fold_addr_expr (build4 (ARRAY_REF, gcov_type_node,
- tree_ctr_tables[counter],
+ fn_v_ctrs[counter],
build_int_cst (integer_type_node, no),
NULL, NULL));
}
@@ -647,78 +619,159 @@ coverage_end_function (unsigned lineno_checksum, unsigned cfg_checksum)
{
struct function_list *item;
- item = XCNEW (struct function_list);
-
- *functions_tail = item;
- functions_tail = &item->next;
-
+ item = ggc_alloc_function_list ();
item->next = 0;
item->ident = current_function_funcdef_no + 1;
item->lineno_checksum = lineno_checksum;
item->cfg_checksum = cfg_checksum;
+ item->fn_decl = current_function_decl;
for (i = 0; i != GCOV_COUNTERS; i++)
{
- item->n_ctrs[i] = fn_n_ctrs[i];
- prg_n_ctrs[i] += fn_n_ctrs[i];
- fn_n_ctrs[i] = fn_b_ctrs[i] = 0;
+ tree var = fn_v_ctrs[i];
+
+ item->ctr_vars[i] = var;
+ if (var)
+ {
+ tree array_type = build_index_type (size_int (fn_n_ctrs[i] - 1));
+ array_type = build_array_type (get_gcov_type (), array_type);
+ TREE_TYPE (var) = array_type;
+ DECL_SIZE (var) = TYPE_SIZE (array_type);
+ DECL_SIZE_UNIT (var) = TYPE_SIZE_UNIT (array_type);
+ varpool_finalize_decl (var);
+ }
+ fn_b_ctrs[i] = fn_n_ctrs[i] = 0;
+ fn_v_ctrs[i] = NULL_TREE;
}
prg_ctr_mask |= fn_ctr_mask;
fn_ctr_mask = 0;
+ /* If the function is extern (i.e. extern inline), then we won't
+ be outputting it, so don't chain it onto the function list. */
+ if (!DECL_EXTERNAL (item->fn_decl))
+ {
+ *functions_tail = item;
+ functions_tail = &item->next;
+ }
}
bbg_function_announced = 0;
}
-/* Creates the gcov_fn_info RECORD_TYPE. */
+/* Build a coverage variable of TYPE for function FN_DECL. If COUNTER
+ >= 0 it is a counter array, and thus local. Otherwise it is the
+ function structure and needs to be globalized. All cases must be
+ in the same comdat group as FN_DECL. */
static tree
-build_fn_info_type (unsigned int counters)
+build_var (tree fn_decl, tree type, int counter)
+{
+ tree var = build_decl (BUILTINS_LOCATION, VAR_DECL, NULL_TREE, type);
+ tree fn_name = DECL_ASSEMBLER_NAME (fn_decl);
+ char *buf = (char *)alloca (IDENTIFIER_LENGTH (fn_name) + 10);
+
+ if (counter >= 0)
+ TREE_STATIC (var) = 1;
+ else
+ {
+ TREE_PUBLIC (var) = TREE_PUBLIC (fn_decl);
+ TREE_STATIC (var) = TREE_STATIC (fn_decl);
+ }
+ TREE_ADDRESSABLE (var) = 1;
+ DECL_ALIGN (var) = TYPE_ALIGN (type);
+
+ if (counter < 0)
+ sprintf (buf, "__gcov__%s", IDENTIFIER_POINTER (fn_name));
+ else
+ sprintf (buf, "__gcov%u_%s", counter, IDENTIFIER_POINTER (fn_name));
+ DECL_NAME (var) = get_identifier (buf);
+
+ /* Initialize assembler name so we can stream out. */
+ if (TREE_PUBLIC (var))
+ DECL_ASSEMBLER_NAME (var);
+
+ DECL_WEAK (var) = TREE_PUBLIC (var) && DECL_WEAK (fn_decl);
+ DECL_COMDAT (var) = DECL_COMDAT (fn_decl);
+ DECL_COMDAT_GROUP (var) = DECL_COMDAT_GROUP (fn_decl);
+
+ return var;
+}
+
+/* Creates the gcov_fn_info RECORD_TYPE. */
+
+static void
+build_fn_info_type (tree type, unsigned counters, tree gcov_info_type)
{
- tree type = lang_hooks.types.make_type (RECORD_TYPE);
+ tree ctr_info = lang_hooks.types.make_type (RECORD_TYPE);
tree field, fields;
tree array_type;
+ gcc_assert (counters);
+
+ /* ctr_info::num */
+ field = build_decl (BUILTINS_LOCATION, FIELD_DECL, NULL_TREE,
+ get_gcov_unsigned_t ());
+ fields = field;
+
+ /* ctr_info::values */
+ field = build_decl (BUILTINS_LOCATION, FIELD_DECL, NULL_TREE,
+ build_pointer_type (get_gcov_type ()));
+ DECL_CHAIN (field) = fields;
+ fields = field;
+
+ finish_builtin_struct (ctr_info, "__gcov_ctr_info", fields, NULL_TREE);
+
+ /* key */
+ field = build_decl (BUILTINS_LOCATION, FIELD_DECL, NULL_TREE,
+ build_pointer_type (build_qualified_type
+ (gcov_info_type, TYPE_QUAL_CONST)));
+ fields = field;
+
/* ident */
- fields = build_decl (BUILTINS_LOCATION,
- FIELD_DECL, NULL_TREE, get_gcov_unsigned_t ());
+ field = build_decl (BUILTINS_LOCATION, FIELD_DECL, NULL_TREE,
+ get_gcov_unsigned_t ());
+ DECL_CHAIN (field) = fields;
+ fields = field;
+
/* lineno_checksum */
- field = build_decl (BUILTINS_LOCATION,
- FIELD_DECL, NULL_TREE, get_gcov_unsigned_t ());
+ field = build_decl (BUILTINS_LOCATION, FIELD_DECL, NULL_TREE,
+ get_gcov_unsigned_t ());
DECL_CHAIN (field) = fields;
fields = field;
/* cfg checksum */
- field = build_decl (BUILTINS_LOCATION,
- FIELD_DECL, NULL_TREE, get_gcov_unsigned_t ());
+ field = build_decl (BUILTINS_LOCATION, FIELD_DECL, NULL_TREE,
+ get_gcov_unsigned_t ());
DECL_CHAIN (field) = fields;
fields = field;
array_type = build_index_type (size_int (counters - 1));
- array_type = build_array_type (get_gcov_unsigned_t (), array_type);
+ array_type = build_array_type (ctr_info, array_type);
/* counters */
- field = build_decl (BUILTINS_LOCATION,
- FIELD_DECL, NULL_TREE, array_type);
+ field = build_decl (BUILTINS_LOCATION, FIELD_DECL, NULL_TREE, array_type);
DECL_CHAIN (field) = fields;
fields = field;
finish_builtin_struct (type, "__gcov_fn_info", fields, NULL_TREE);
-
- return type;
}
/* Creates a CONSTRUCTOR for a gcov_fn_info. FUNCTION is
the function being processed and TYPE is the gcov_fn_info
- RECORD_TYPE. */
+ RECORD_TYPE. KEY is the object file key. */
static tree
-build_fn_info_value (const struct function_list *function, tree type)
+build_fn_info (const struct function_list *function, tree type, tree key)
{
tree fields = TYPE_FIELDS (type);
+ tree ctr_type;
unsigned ix;
VEC(constructor_elt,gc) *v1 = NULL;
VEC(constructor_elt,gc) *v2 = NULL;
+ /* key */
+ CONSTRUCTOR_APPEND_ELT (v1, fields,
+ build1 (ADDR_EXPR, TREE_TYPE (fields), key));
+ fields = DECL_CHAIN (fields);
+
/* ident */
CONSTRUCTOR_APPEND_ELT (v1, fields,
build_int_cstu (get_gcov_unsigned_t (),
@@ -738,240 +791,194 @@ build_fn_info_value (const struct function_list *function, tree type)
fields = DECL_CHAIN (fields);
/* counters */
+ ctr_type = TREE_TYPE (TREE_TYPE (fields));
for (ix = 0; ix != GCOV_COUNTERS; ix++)
if (prg_ctr_mask & (1 << ix))
- CONSTRUCTOR_APPEND_ELT (v2, NULL,
- build_int_cstu (get_gcov_unsigned_t (),
- function->n_ctrs[ix]));
-
+ {
+ VEC(constructor_elt,gc) *ctr = NULL;
+ tree var = function->ctr_vars[ix];
+ unsigned count = 0;
+
+ if (var)
+ count
+ = tree_low_cst (TYPE_MAX_VALUE (TYPE_DOMAIN (TREE_TYPE (var))), 0)
+ + 1;
+
+ CONSTRUCTOR_APPEND_ELT (ctr, TYPE_FIELDS (ctr_type),
+ build_int_cstu (get_gcov_unsigned_t (),
+ count));
+
+ if (var)
+ CONSTRUCTOR_APPEND_ELT (ctr, DECL_CHAIN (TYPE_FIELDS (ctr_type)),
+ build_fold_addr_expr (var));
+
+ CONSTRUCTOR_APPEND_ELT (v2, NULL, build_constructor (ctr_type, ctr));
+ }
+
CONSTRUCTOR_APPEND_ELT (v1, fields,
build_constructor (TREE_TYPE (fields), v2));
return build_constructor (type, v1);
}
-/* Creates the gcov_ctr_info RECORD_TYPE. */
+/* Creaste gcov_info_struct. N_FUNCS is the number of functions in
+ the trailing array. */
-static tree
-build_ctr_info_type (void)
+static void
+build_info_type (tree type, unsigned n_funcs, tree fn_info_type)
{
- tree type = lang_hooks.types.make_type (RECORD_TYPE);
tree field, fields = NULL_TREE;
- tree gcov_ptr_type = build_pointer_type (get_gcov_type ());
- tree gcov_merge_fn_type;
+ tree merge_fn_type, fn_info_array;
- /* counters */
- field = build_decl (BUILTINS_LOCATION,
- FIELD_DECL, NULL_TREE, get_gcov_unsigned_t ());
+ gcc_assert (n_funcs);
+
+ /* Version ident */
+ field = build_decl (BUILTINS_LOCATION, FIELD_DECL, NULL_TREE,
+ get_gcov_unsigned_t ());
DECL_CHAIN (field) = fields;
fields = field;
- /* values */
- field = build_decl (BUILTINS_LOCATION,
- FIELD_DECL, NULL_TREE, gcov_ptr_type);
+ /* next pointer */
+ field = build_decl (BUILTINS_LOCATION, FIELD_DECL, NULL_TREE,
+ build_pointer_type (build_qualified_type
+ (type, TYPE_QUAL_CONST)));
DECL_CHAIN (field) = fields;
fields = field;
- /* merge */
- gcov_merge_fn_type =
- build_function_type_list (void_type_node,
- gcov_ptr_type, get_gcov_unsigned_t (),
- NULL_TREE);
- field = build_decl (BUILTINS_LOCATION,
- FIELD_DECL, NULL_TREE,
- build_pointer_type (gcov_merge_fn_type));
+ /* stamp */
+ field = build_decl (BUILTINS_LOCATION, FIELD_DECL, NULL_TREE,
+ get_gcov_unsigned_t ());
DECL_CHAIN (field) = fields;
fields = field;
- finish_builtin_struct (type, "__gcov_ctr_info", fields, NULL_TREE);
-
- return type;
-}
-
-/* Creates a CONSTRUCTOR for a gcov_ctr_info. COUNTER is
- the counter being processed and TYPE is the gcov_ctr_info
- RECORD_TYPE. */
-
-static tree
-build_ctr_info_value (unsigned int counter, tree type)
-{
- tree fields = TYPE_FIELDS (type);
- tree fn;
- VEC(constructor_elt,gc) *v = NULL;
-
- /* counters */
- CONSTRUCTOR_APPEND_ELT (v, fields,
- build_int_cstu (get_gcov_unsigned_t (),
- prg_n_ctrs[counter]));
- fields = DECL_CHAIN (fields);
+ /* Filename */
+ field = build_decl (BUILTINS_LOCATION, FIELD_DECL, NULL_TREE,
+ build_pointer_type (build_qualified_type
+ (char_type_node, TYPE_QUAL_CONST)));
+ DECL_CHAIN (field) = fields;
+ fields = field;
- if (prg_n_ctrs[counter])
- {
- tree array_type;
-
- array_type = build_int_cstu (get_gcov_unsigned_t (),
- prg_n_ctrs[counter] - 1);
- array_type = build_index_type (array_type);
- array_type = build_array_type (TREE_TYPE (TREE_TYPE (fields)),
- array_type);
-
- TREE_TYPE (tree_ctr_tables[counter]) = array_type;
- DECL_SIZE (tree_ctr_tables[counter]) = TYPE_SIZE (array_type);
- DECL_SIZE_UNIT (tree_ctr_tables[counter]) = TYPE_SIZE_UNIT (array_type);
- varpool_finalize_decl (tree_ctr_tables[counter]);
-
- CONSTRUCTOR_APPEND_ELT (v, fields,
- build1 (ADDR_EXPR, TREE_TYPE (fields),
- tree_ctr_tables[counter]));
- }
- else
- CONSTRUCTOR_APPEND_ELT (v, fields, null_pointer_node);
- fields = DECL_CHAIN (fields);
+ /* merge fn array */
+ merge_fn_type
+ = build_function_type_list (void_type_node,
+ build_pointer_type (get_gcov_type ()),
+ get_gcov_unsigned_t (), NULL_TREE);
+ merge_fn_type
+ = build_array_type (build_pointer_type (merge_fn_type),
+ build_index_type (size_int (GCOV_COUNTERS - 1)));
+ field = build_decl (BUILTINS_LOCATION, FIELD_DECL, NULL_TREE,
+ merge_fn_type);
+ DECL_CHAIN (field) = fields;
+ fields = field;
+
+ /* n_functions */
+ field = build_decl (BUILTINS_LOCATION, FIELD_DECL, NULL_TREE,
+ get_gcov_unsigned_t ());
+ DECL_CHAIN (field) = fields;
+ fields = field;
+
+ /* function_info pointer array */
+ fn_info_type = build_pointer_type
+ (build_qualified_type (fn_info_type, TYPE_QUAL_CONST));
+ fn_info_array = build_index_type (size_int (n_funcs));
+ fn_info_array = build_array_type (fn_info_type, fn_info_array);
+ field = build_decl (BUILTINS_LOCATION, FIELD_DECL, NULL_TREE,
+ fn_info_array);
+ DECL_CHAIN (field) = fields;
+ fields = field;
- fn = build_decl (BUILTINS_LOCATION,
- FUNCTION_DECL,
- get_identifier (ctr_merge_functions[counter]),
- TREE_TYPE (TREE_TYPE (fields)));
- DECL_EXTERNAL (fn) = 1;
- TREE_PUBLIC (fn) = 1;
- DECL_ARTIFICIAL (fn) = 1;
- TREE_NOTHROW (fn) = 1;
- DECL_ASSEMBLER_NAME (fn); /* Initialize assembler name so we can stream out. */
- CONSTRUCTOR_APPEND_ELT (v, fields, build1 (ADDR_EXPR, TREE_TYPE (fields), fn));
-
- return build_constructor (type, v);
+ finish_builtin_struct (type, "__gcov_info", fields, NULL_TREE);
}
-/* Creates the gcov_info RECORD_TYPE and initializer for it. Returns a
- CONSTRUCTOR. */
+/* Creates the gcov_info initializer. Returns a CONSTRUCTOR. */
static tree
-build_gcov_info (void)
+build_info (tree info_type, tree fn_type, tree key_var, unsigned n_funcs)
{
- unsigned n_ctr_types, ix;
- tree type, const_type;
- tree fn_info_type, fn_info_value = NULL_TREE;
- tree fn_info_ptr_type;
- tree ctr_info_type, ctr_info_ary_type, ctr_info_value = NULL_TREE;
- tree field, fields = NULL_TREE;
+ tree info_fields = TYPE_FIELDS (info_type);
+ tree merge_fn_type, fn_info_ptr_type;
+ unsigned ix;
tree filename_string;
int da_file_name_len;
- unsigned n_fns;
const struct function_list *fn;
- tree string_type;
VEC(constructor_elt,gc) *v1 = NULL;
VEC(constructor_elt,gc) *v2 = NULL;
-
- /* Count the number of active counters. */
- for (n_ctr_types = 0, ix = 0; ix != GCOV_COUNTERS; ix++)
- if (prg_ctr_mask & (1 << ix))
- n_ctr_types++;
-
- type = lang_hooks.types.make_type (RECORD_TYPE);
- const_type = build_qualified_type (type, TYPE_QUAL_CONST);
+ VEC(constructor_elt,gc) *v3 = NULL;
/* Version ident */
- field = build_decl (BUILTINS_LOCATION,
- FIELD_DECL, NULL_TREE, get_gcov_unsigned_t ());
- DECL_CHAIN (field) = fields;
- fields = field;
- CONSTRUCTOR_APPEND_ELT (v1, field,
- build_int_cstu (TREE_TYPE (field), GCOV_VERSION));
+ CONSTRUCTOR_APPEND_ELT (v1, info_fields,
+ build_int_cstu (TREE_TYPE (info_fields),
+ GCOV_VERSION));
+ info_fields = DECL_CHAIN (info_fields);
/* next -- NULL */
- field = build_decl (BUILTINS_LOCATION,
- FIELD_DECL, NULL_TREE, build_pointer_type (const_type));
- DECL_CHAIN (field) = fields;
- fields = field;
- CONSTRUCTOR_APPEND_ELT (v1, field, null_pointer_node);
-
+ CONSTRUCTOR_APPEND_ELT (v1, info_fields, null_pointer_node);
+ info_fields = DECL_CHAIN (info_fields);
+
/* stamp */
- field = build_decl (BUILTINS_LOCATION,
- FIELD_DECL, NULL_TREE, get_gcov_unsigned_t ());
- DECL_CHAIN (field) = fields;
- fields = field;
- CONSTRUCTOR_APPEND_ELT (v1, field,
- build_int_cstu (TREE_TYPE (field), local_tick));
+ CONSTRUCTOR_APPEND_ELT (v1, info_fields,
+ build_int_cstu (TREE_TYPE (info_fields),
+ local_tick));
+ info_fields = DECL_CHAIN (info_fields);
/* Filename */
- string_type = build_pointer_type (build_qualified_type (char_type_node,
- TYPE_QUAL_CONST));
- field = build_decl (BUILTINS_LOCATION,
- FIELD_DECL, NULL_TREE, string_type);
- DECL_CHAIN (field) = fields;
- fields = field;
da_file_name_len = strlen (da_file_name);
filename_string = build_string (da_file_name_len + 1, da_file_name);
TREE_TYPE (filename_string) = build_array_type
(char_type_node, build_index_type (size_int (da_file_name_len)));
- CONSTRUCTOR_APPEND_ELT (v1, field,
- build1 (ADDR_EXPR, string_type, filename_string));
+ CONSTRUCTOR_APPEND_ELT (v1, info_fields,
+ build1 (ADDR_EXPR, TREE_TYPE (info_fields),
+ filename_string));
+ info_fields = DECL_CHAIN (info_fields);
- /* Build the fn_info type and initializer. */
- fn_info_type = build_fn_info_type (n_ctr_types);
- fn_info_ptr_type = build_pointer_type (build_qualified_type
- (fn_info_type, TYPE_QUAL_CONST));
- for (fn = functions_head, n_fns = 0; fn; fn = fn->next, n_fns++)
- CONSTRUCTOR_APPEND_ELT (v2, NULL_TREE,
- build_fn_info_value (fn, fn_info_type));
-
- if (n_fns)
+ /* merge fn array -- NULL slots indicate unmeasured counters */
+ merge_fn_type = TREE_TYPE (TREE_TYPE (info_fields));
+ for (ix = 0; ix != GCOV_COUNTERS; ix++)
{
- tree array_type;
-
- array_type = build_index_type (size_int (n_fns - 1));
- array_type = build_array_type (fn_info_type, array_type);
+ tree ptr = null_pointer_node;
- fn_info_value = build_constructor (array_type, v2);
- fn_info_value = build1 (ADDR_EXPR, fn_info_ptr_type, fn_info_value);
+ if ((1u << ix) & prg_ctr_mask)
+ {
+ tree merge_fn = build_decl (BUILTINS_LOCATION,
+ FUNCTION_DECL,
+ get_identifier (ctr_merge_functions[ix]),
+ TREE_TYPE (merge_fn_type));
+ DECL_EXTERNAL (merge_fn) = 1;
+ TREE_PUBLIC (merge_fn) = 1;
+ DECL_ARTIFICIAL (merge_fn) = 1;
+ TREE_NOTHROW (merge_fn) = 1;
+ /* Initialize assembler name so we can stream out. */
+ DECL_ASSEMBLER_NAME (merge_fn);
+ ptr = build1 (ADDR_EXPR, merge_fn_type, merge_fn);
+ }
+ CONSTRUCTOR_APPEND_ELT (v2, NULL, ptr);
}
- else
- fn_info_value = null_pointer_node;
-
- /* number of functions */
- field = build_decl (BUILTINS_LOCATION,
- FIELD_DECL, NULL_TREE, get_gcov_unsigned_t ());
- DECL_CHAIN (field) = fields;
- fields = field;
- CONSTRUCTOR_APPEND_ELT (v1, field,
- build_int_cstu (get_gcov_unsigned_t (), n_fns));
-
- /* fn_info table */
- field = build_decl (BUILTINS_LOCATION,
- FIELD_DECL, NULL_TREE, fn_info_ptr_type);
- DECL_CHAIN (field) = fields;
- fields = field;
- CONSTRUCTOR_APPEND_ELT (v1, field, fn_info_value);
-
- /* counter_mask */
- field = build_decl (BUILTINS_LOCATION,
- FIELD_DECL, NULL_TREE, get_gcov_unsigned_t ());
- DECL_CHAIN (field) = fields;
- fields = field;
- CONSTRUCTOR_APPEND_ELT (v1, field,
- build_int_cstu (get_gcov_unsigned_t (),
- prg_ctr_mask));
-
- /* counters */
- ctr_info_type = build_ctr_info_type ();
- ctr_info_ary_type = build_index_type (size_int (n_ctr_types));
- ctr_info_ary_type = build_array_type (ctr_info_type, ctr_info_ary_type);
- v2 = NULL;
- for (ix = 0; ix != GCOV_COUNTERS; ix++)
- if (prg_ctr_mask & (1 << ix))
- CONSTRUCTOR_APPEND_ELT (v2, NULL_TREE,
- build_ctr_info_value (ix, ctr_info_type));
- ctr_info_value = build_constructor (ctr_info_ary_type, v2);
-
- field = build_decl (BUILTINS_LOCATION,
- FIELD_DECL, NULL_TREE, ctr_info_ary_type);
- DECL_CHAIN (field) = fields;
- fields = field;
- CONSTRUCTOR_APPEND_ELT (v1, field, ctr_info_value);
-
- finish_builtin_struct (type, "__gcov_info", fields, NULL_TREE);
-
- return build_constructor (type, v1);
+ CONSTRUCTOR_APPEND_ELT (v1, info_fields,
+ build_constructor (TREE_TYPE (info_fields), v2));
+ info_fields = DECL_CHAIN (info_fields);
+
+ /* n_functions */
+ CONSTRUCTOR_APPEND_ELT (v1, info_fields,
+ build_int_cstu (TREE_TYPE (info_fields), n_funcs));
+ info_fields = DECL_CHAIN (info_fields);
+
+ /* Build the fn_info type and initializer. */
+ fn_info_ptr_type = TREE_TYPE (TREE_TYPE (info_fields));
+
+ for (fn = functions_head; fn; fn = fn->next)
+ {
+ tree init = build_fn_info (fn, fn_type, key_var);
+ tree var = build_var (fn->fn_decl, fn_type, -1);
+
+ DECL_INITIAL (var) = init;
+ varpool_finalize_decl (var);
+
+ CONSTRUCTOR_APPEND_ELT (v3, NULL,
+ build1 (ADDR_EXPR, fn_info_ptr_type, var));
+ }
+ CONSTRUCTOR_APPEND_ELT (v1, info_fields,
+ build_constructor (TREE_TYPE (info_fields), v3));
+ return build_constructor (info_type, v1);
}
/* Write out the structure which libgcov uses to locate all the
@@ -982,6 +989,11 @@ static void
create_coverage (void)
{
tree gcov_info, gcov_init, body, t;
+ tree gcov_info_type, gcov_fn_type;
+ unsigned n_counters = 0, n_functions = 0;
+ struct function_list *fn;
+ struct function_list **fn_prev;
+ unsigned ix;
char name_buf[32];
no_coverage = 1; /* Disable any further coverage. */
@@ -989,14 +1001,37 @@ create_coverage (void)
if (!prg_ctr_mask)
return;
- t = build_gcov_info ();
+ if (cgraph_dump_file)
+ fprintf (cgraph_dump_file, "Using data file %s\n", da_file_name);
+ for (ix = 0; ix != GCOV_COUNTERS; ix++)
+ if ((1u << ix) & prg_ctr_mask)
+ n_counters++;
+ for (fn_prev = &functions_head; (fn = *fn_prev);)
+ if (DECL_STRUCT_FUNCTION (fn->fn_decl))
+ {
+ n_functions++;
+ fn_prev = &fn->next;
+ }
+ else
+ /* The function is not being emitted, remove from list. */
+ *fn_prev = fn->next;
+
+ /* Build the info and fn_info types. These are mutually recursive. */
+ gcov_info_type = lang_hooks.types.make_type (RECORD_TYPE);
+ gcov_fn_type = lang_hooks.types.make_type (RECORD_TYPE);
+ build_fn_info_type (gcov_fn_type, n_counters, gcov_info_type);
+ build_info_type (gcov_info_type, n_functions, gcov_fn_type);
+
+ /* Build the gcov info var, this is referred to in its own
+ initializer. */
gcov_info = build_decl (BUILTINS_LOCATION,
- VAR_DECL, NULL_TREE, TREE_TYPE (t));
+ VAR_DECL, NULL_TREE, gcov_info_type);
TREE_STATIC (gcov_info) = 1;
ASM_GENERATE_INTERNAL_LABEL (name_buf, "LPBX", 0);
DECL_NAME (gcov_info) = get_identifier (name_buf);
- DECL_INITIAL (gcov_info) = t;
+ DECL_INITIAL (gcov_info) = build_info (gcov_info_type, gcov_fn_type,
+ gcov_info, n_functions);
/* Build structure. */
varpool_finalize_decl (gcov_info);
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 1b40250b421..72aa0513d96 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,222 @@
+2011-11-07 Jason Merrill <jason@redhat.com>
+ Dodji Seketeli <dodji@redhat.com>
+
+ Support C++11 alias-declaration
+ PR c++/45114
+ * cp-tree.h (TYPE_DECL_ALIAS_P, TYPE_ALIAS_P)
+ (DECL_TYPE_TEMPLATE_P, DECL_ALIAS_TEMPLATE_P): New accessor
+ macros.
+ (TYPE_TEMPLATE_INFO): Get template info of an alias template
+ specializations from its TYPE_DECL.
+ (SET_TYPE_TEMPLATE_INFO): Set template info of alias template
+ specializations into its TYPE_DECL.
+ (DECL_CLASS_TEMPLATE_P): Re-write using the new
+ DECL_TYPE_TEMPLATE_P.
+ (enum cp_decl_spec): Add new ds_alias enumerator.
+ (alias_type_or_template_p, alias_template_specialization_p):
+ Declare new functions.
+ * parser.c (cp_parser_alias_declaration): New static function.
+ (cp_parser_check_decl_spec): Add "using" name for the `alias'
+ declspec.
+ (cp_parser_type_name): Update comment. Support simple-template-id
+ representing alias template specializations in c++0x mode.
+ (cp_parser_qualifying_entity): Update comment. Use
+ cp_parser_type_name.
+ (cp_parser_block_declaration): Handle alias-declaration in c++11.
+ Update comment.
+ (cp_parser_template_id): Handle specializations of alias
+ templates.
+ (cp_parser_member_declaration): Add alias-declaration production
+ to comment. Support alias-declarations.
+ (cp_parser_template_declaration_after_export): Handle alias
+ templates in c++11.
+ * decl.c (make_typename_type, make_unbound_class_template): Accept
+ alias templates.
+ (grokdeclarator): Set TYPE_DECL_ALIAS_P on alias
+ declarations.
+ * decl2.c (grokfield): Move template creation after setting up the
+ TYPE_DECL of the alias, so that the TEMPLATE_DECL of the alias
+ template actually carries the right type-id of the alias
+ declaration.
+ * pt.c (alias_type_or_template_p)
+ (alias_template_specialization_p): Define new public functions.
+ (maybe_process_partial_specialization): Reject partial
+ specializations of alias templates.
+ (primary_template_instantiation_p): Consider alias template
+ instantiations.
+ (push_template_decl_real): Assert that TYPE_DECLs of alias
+ templates are different from those of class template. Store
+ template info onto the TYPE_DECL of the alias template.
+ (convert_template_argument): Strip aliases from template
+ arguments.
+ (lookup_template_class_1): Handle the creation of the
+ specialization of an alias template.
+ (tsubst_decl): Create a substituted copy of the TYPE_DECL of an
+ member alias template.
+ (tsubst): Handle substituting into the type of an alias template.
+ Handle substituting UNBOUND_CLASS_TEMPLATE into
+ BOUND_TEMPLATE_TEMPLATE_PARM.
+ (do_type_instantiation): Better diagnostics when trying to
+ explicitely instantiate a non-class template.
+ * search.c (lookup_field_1, lookup_field_r): Support looking up
+ alias templates.
+ * semantics.c (finish_template_type): For instantiations of alias
+ templates, return the TYPE_DECL of the actual alias and not the
+ one of the aliased type.
+ * error.c (dump_alias_template_specialization): New static
+ function.
+ (dump_type): Handle printing of alias templates and their
+ specializations. templates.
+ (dump_aggr_type): For specialization of alias templates, fetch
+ arguments from the right place.
+ (dump_decl): Print an alias-declaration like `using decl = type;'
+ (dump_template_decl): Support printing of alias templates.
+
+2011-11-07 Jason Merrill <jason@redhat.com>
+
+ PR c++/35688
+ * decl2.c (constrain_visibility): Return void. Add tmpl parm
+ which gives the constraint priority over an attribute.
+ (constrain_visibility_for_template, determine_visibility): Adjust.
+ * pt.c (instantiate_class_template_1): Call determine_visibility.
+
+ PR c++/33255
+ * decl.c (save_function_data): Clear local_typedefs.
+
+ * decl.c (cp_finish_decl): Only make_tree_vector if we're calling
+ check_initializer.
+
+2011-11-06 Jason Merrill <jason@redhat.com>
+
+ PR c++/35688
+ * decl2.c (constrain_visibility): Check decl_has_visibility_attr
+ rather than DECL_VISIBILITY_SPECIFIED.
+
+2011-11-06 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/47695
+ * decl2.c (mark_used): Early return false after error or sorry.
+ * cp-tree.h (mark_used): Adjust declaration.
+ * semantics.c (finish_id_expression): Check mark_used return value.
+
+2011-11-05 Jason Merrill <jason@redhat.com>
+
+ PR c++/48370
+ * decl.c (cp_finish_decl): Mostly revert previous change.
+
+2011-11-04 Jason Merrill <jason@redhat.com>
+
+ PR c++/26714
+ * init.c (perform_member_init): Strip TARGET_EXPR around NSDMI.
+ Do temporary lifetime extension.
+
+ PR c++/48370
+ * decl.c (cp_finish_decl): Run cleanups in the right order.
+
+2011-11-04 Eric Botcazou <ebotcazou@adacore.com>
+
+ PR c++/50608
+ * semantics.c (finish_offsetof): Adjust call to fold_offsetof.
+ * typeck.c (cp_build_addr_expr_1): Call fold_offsetof_1.
+
+2011-11-04 Paolo Carlini <paolo.carlini@oracle.com>
+
+ * typeck.c (build_indirect_ref): Use ATTRIBUTE_UNUSED.
+ * mangle.c (write_unnamed_type_name): Likewise.
+
+2011-11-04 Magnus Fromreide <magfr@lysator.liu.se>
+
+ * parser.c (cp_parser_enumerator_list): Do not warn about
+ trailing commas in C++0x mode.
+
+2011-11-04 Olivier Goffart <olivier@woboq.com>
+ Jason Merrill <jason@redhat.com>
+
+ PR c++/50965
+ * class.c (check_field_decls): NSDMI makes a class non-aggregate.
+
+2011-11-04 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/48420
+ * call.c (conversion_null_warnings): For 'false' to NULL pointer,
+ just check that TREE_TYPE (expr) is a BOOLEAN_TYPE.
+
+2011-11-04 Ed Smith-Rowland <3dw4rd@verizon.net>
+
+ PR c++/50941
+ * parser.c (cp_parser_userdef_string_literal): Fix string length.
+
+2011-11-04 Jason Merrill <jason@redhat.com>
+
+ PR c++/48370
+ * call.c (extend_ref_init_temps, extend_ref_init_temps_1): New.
+ (set_up_extended_ref_temp): Use it. Change cleanup parm to VEC.
+ (initialize_reference): Just call convert_like.
+ * decl.c (grok_reference_init): Just call initialize_reference.
+ (build_init_list_var_init): Remove.
+ (check_initializer): Change cleanup parm to VEC. Handle references
+ like other types. Call perform_implicit_conversion instead
+ of build_init_list_var_init. Don't use build_aggr_init for
+ aggregate initialization of arrays.
+ (cp_finish_decl): Change cleanup to VEC.
+ * typeck2.c (store_init_value): Call extend_ref_init_temps.
+ Use build_vec_init for non-constant arrays.
+ * init.c (expand_aggr_init_1): Adjust.
+ (build_vec_init): Avoid re-converting an initializer
+ that's already digested.
+ * mangle.c (mangle_ref_init_variable): Add a discriminator.
+ * cp-tree.h: Adjust.
+ * typeck.c (convert_for_initialization): Adjust.
+ * decl2.c (maybe_emit_vtables): Adjust.
+
+2011-11-02 Jason Merrill <jason@redhat.com>
+
+ PR c++/50930
+ * init.c (build_aggr_init): Don't set LOOKUP_ONLYCONVERTING
+ if the initializer has TARGET_EXPR_DIRECT_INIT_P.
+ (expand_default_init): An initializer with TARGET_EXPR_DIRECT_INIT_P
+ or TARGET_EXPR_LIST_INIT_P doesn't need more processing.
+ * tree.c (bot_manip): Propagate TARGET_EXPR_IMPLICIT_P,
+ TARGET_EXPR_LIST_INIT_P, TARGET_EXPR_DIRECT_INIT_P.
+ * call.c (convert_like_real): Set TARGET_EXPR_DIRECT_INIT_P
+ as appropriate on list-value-initialization.
+
+ * parser.c (cp_parser_decl_specifier_seq): Change "C++0x" to
+ "C++11" in warnings.
+ (cp_lexer_get_preprocessor_token): Likewise.
+ (cp_parser_binary_expression): Likewise.
+
+2011-11-02 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/50810
+ * typeck2.c (check_narrowing): Adjust OPT_Wnarrowing diagnostics.
+ (digest_init_r): Call check_narrowing irrespective of the C++ dialect.
+ * decl.c (check_initializer): Likewise.
+ * semantics.c (finish_compound_literal): Likewise.
+
+2011-11-02 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/50956
+ * typeck.c (build_const_cast_1): Fix -Wcast-qual for false
+ comp_ptr_ttypes_const.
+
+2011-11-02 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
+
+ * Make-lang.in (g++spec.o): Pass SHLIB instead of SHLIB_LINK.
+
+2011-11-01 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/44277
+ * cvt.c (cp_convert_to_pointer): Warn for zero as null pointer
+ constant.
+ * typeck.c (cp_truthvalue_conversion): Handle pointers and member
+ function pointers under c_inhibit_evaluation_warnings; use
+ nullptr_node for data member pointers.
+ (cp_build_binary_op): Tweak, just forward to cp_convert op1,
+ either a nullptr_node or an integer_zero_node.
+ (build_ptrmemfunc): Use nullptr_node.
+ * init.c (build_zero_init_1): Likewise.
+
2011-11-01 Jason Merrill <jason@redhat.com>
PR c++/50500
diff --git a/gcc/cp/Make-lang.in b/gcc/cp/Make-lang.in
index 6944ce972a8..650fc385096 100644
--- a/gcc/cp/Make-lang.in
+++ b/gcc/cp/Make-lang.in
@@ -55,7 +55,7 @@ c++: cc1plus$(exeext)
g++spec.o: $(srcdir)/cp/g++spec.c $(SYSTEM_H) coretypes.h $(TM_H) $(GCC_H) \
$(CONFIG_H) $(OPTS_H)
- (SHLIB_LINK='$(SHLIB_LINK)'; \
+ (SHLIB='$(SHLIB)'; \
$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(DRIVER_DEFINES) \
$(INCLUDES) $(srcdir)/cp/g++spec.c)
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index c1b9018788c..578905e41e6 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -5547,7 +5547,8 @@ conversion_null_warnings (tree totype, tree expr, tree fn, int argnum)
}
/* Issue warnings if "false" is converted to a NULL pointer */
- else if (expr == boolean_false_node && TYPE_PTR_P (totype))
+ else if (TREE_CODE (TREE_TYPE (expr)) == BOOLEAN_TYPE
+ && TYPE_PTR_P (totype))
{
if (fn)
warning_at (input_location, OPT_Wconversion_null,
@@ -5658,10 +5659,14 @@ convert_like_real (conversion *convs, tree expr, tree fn, int argnum,
&& CONSTRUCTOR_NELTS (expr) == 0
&& TYPE_HAS_DEFAULT_CONSTRUCTOR (totype))
{
+ bool direct = CONSTRUCTOR_IS_DIRECT_INIT (expr);
expr = build_value_init (totype, complain);
expr = get_target_expr_sfinae (expr, complain);
if (expr != error_mark_node)
- TARGET_EXPR_LIST_INIT_P (expr) = true;
+ {
+ TARGET_EXPR_LIST_INIT_P (expr) = true;
+ TARGET_EXPR_DIRECT_INIT_P (expr) = direct;
+ }
return expr;
}
@@ -8501,6 +8506,44 @@ perform_direct_initialization_if_possible (tree type,
return expr;
}
+/* When initializing a reference that lasts longer than a full-expression,
+ this special rule applies:
+
+ [class.temporary]
+
+ The temporary to which the reference is bound or the temporary
+ that is the complete object to which the reference is bound
+ persists for the lifetime of the reference.
+
+ The temporaries created during the evaluation of the expression
+ initializing the reference, except the temporary to which the
+ reference is bound, are destroyed at the end of the
+ full-expression in which they are created.
+
+ In that case, we store the converted expression into a new
+ VAR_DECL in a new scope.
+
+ However, we want to be careful not to create temporaries when
+ they are not required. For example, given:
+
+ struct B {};
+ struct D : public B {};
+ D f();
+ const B& b = f();
+
+ there is no need to copy the return value from "f"; we can just
+ extend its lifetime. Similarly, given:
+
+ struct S {};
+ struct T { operator S(); };
+ T t;
+ const S& s = t;
+
+ we can extend the lifetime of the return value of the conversion
+ operator.
+
+ The next several functions are involved in this lifetime extension. */
+
/* DECL is a VAR_DECL whose type is a REFERENCE_TYPE. The reference
is being bound to a temporary. Create and return a new VAR_DECL
with the indicated TYPE; this variable will store the value to
@@ -8518,6 +8561,7 @@ make_temporary_var_for_ref_to_temp (tree decl, tree type)
if (TREE_STATIC (decl))
{
/* Namespace-scope or local static; give it a mangled name. */
+ /* FIXME share comdat with decl? */
tree name;
TREE_STATIC (var) = 1;
@@ -8539,8 +8583,9 @@ make_temporary_var_for_ref_to_temp (tree decl, tree type)
cleanup for the new variable is returned through CLEANUP, and the
code to initialize the new variable is returned through INITP. */
-tree
-set_up_extended_ref_temp (tree decl, tree expr, tree *cleanup, tree *initp)
+static tree
+set_up_extended_ref_temp (tree decl, tree expr, VEC(tree,gc) **cleanups,
+ tree *initp)
{
tree init;
tree type;
@@ -8561,6 +8606,10 @@ set_up_extended_ref_temp (tree decl, tree expr, tree *cleanup, tree *initp)
if (TREE_CODE (expr) != TARGET_EXPR)
expr = get_target_expr (expr);
+ /* Recursively extend temps in this initializer. */
+ TARGET_EXPR_INITIAL (expr)
+ = extend_ref_init_temps (decl, TARGET_EXPR_INITIAL (expr), cleanups);
+
/* If the initializer is constant, put it in DECL_INITIAL so we get
static initialization and use in constant expressions. */
init = maybe_constant_init (expr);
@@ -8594,7 +8643,11 @@ set_up_extended_ref_temp (tree decl, tree expr, tree *cleanup, tree *initp)
if (TREE_STATIC (var))
init = add_stmt_to_compound (init, register_dtor_fn (var));
else
- *cleanup = cxx_maybe_build_cleanup (var, tf_warning_or_error);
+ {
+ tree cleanup = cxx_maybe_build_cleanup (var, tf_warning_or_error);
+ if (cleanup)
+ VEC_safe_push (tree, gc, *cleanups, cleanup);
+ }
/* We must be careful to destroy the temporary only
after its initialization has taken place. If the
@@ -8628,18 +8681,10 @@ set_up_extended_ref_temp (tree decl, tree expr, tree *cleanup, tree *initp)
}
/* Convert EXPR to the indicated reference TYPE, in a way suitable for
- initializing a variable of that TYPE. If DECL is non-NULL, it is
- the VAR_DECL being initialized with the EXPR. (In that case, the
- type of DECL will be TYPE.) If DECL is non-NULL, then CLEANUP must
- also be non-NULL, and with *CLEANUP initialized to NULL. Upon
- return, if *CLEANUP is no longer NULL, it will be an expression
- that should be pushed as a cleanup after the returned expression
- is used to initialize DECL.
-
- Return the converted expression. */
+ initializing a variable of that TYPE. */
tree
-initialize_reference (tree type, tree expr, tree decl, tree *cleanup,
+initialize_reference (tree type, tree expr,
int flags, tsubst_flags_t complain)
{
conversion *conv;
@@ -8673,103 +8718,77 @@ initialize_reference (tree type, tree expr, tree decl, tree *cleanup,
return error_mark_node;
}
- /* If DECL is non-NULL, then this special rule applies:
-
- [class.temporary]
-
- The temporary to which the reference is bound or the temporary
- that is the complete object to which the reference is bound
- persists for the lifetime of the reference.
+ gcc_assert (conv->kind == ck_ref_bind);
- The temporaries created during the evaluation of the expression
- initializing the reference, except the temporary to which the
- reference is bound, are destroyed at the end of the
- full-expression in which they are created.
+ /* Perform the conversion. */
+ expr = convert_like (conv, expr, complain);
- In that case, we store the converted expression into a new
- VAR_DECL in a new scope.
+ /* Free all the conversions we allocated. */
+ obstack_free (&conversion_obstack, p);
- However, we want to be careful not to create temporaries when
- they are not required. For example, given:
+ return expr;
+}
- struct B {};
- struct D : public B {};
- D f();
- const B& b = f();
+/* Subroutine of extend_ref_init_temps. Possibly extend one initializer,
+ which is bound either to a reference or a std::initializer_list. */
- there is no need to copy the return value from "f"; we can just
- extend its lifetime. Similarly, given:
+static tree
+extend_ref_init_temps_1 (tree decl, tree init, VEC(tree,gc) **cleanups)
+{
+ tree sub = init;
+ tree *p;
+ STRIP_NOPS (sub);
+ if (TREE_CODE (sub) != ADDR_EXPR)
+ return init;
+ /* Deal with binding to a subobject. */
+ for (p = &TREE_OPERAND (sub, 0); TREE_CODE (*p) == COMPONENT_REF; )
+ p = &TREE_OPERAND (*p, 0);
+ if (TREE_CODE (*p) == TARGET_EXPR)
+ {
+ tree subinit = NULL_TREE;
+ *p = set_up_extended_ref_temp (decl, *p, cleanups, &subinit);
+ if (subinit)
+ init = build2 (COMPOUND_EXPR, TREE_TYPE (init), subinit, init);
+ }
+ return init;
+}
- struct S {};
- struct T { operator S(); };
- T t;
- const S& s = t;
+/* INIT is part of the initializer for DECL. If there are any
+ reference or initializer lists being initialized, extend their
+ lifetime to match that of DECL. */
- we can extend the lifetime of the return value of the conversion
- operator. */
- gcc_assert (conv->kind == ck_ref_bind);
- if (decl)
+tree
+extend_ref_init_temps (tree decl, tree init, VEC(tree,gc) **cleanups)
+{
+ tree type = TREE_TYPE (init);
+ if (processing_template_decl)
+ return init;
+ if (TREE_CODE (type) == REFERENCE_TYPE)
+ init = extend_ref_init_temps_1 (decl, init, cleanups);
+ else if (is_std_init_list (type))
{
- tree var;
- tree base_conv_type;
-
- gcc_assert (complain == tf_warning_or_error);
-
- /* Skip over the REF_BIND. */
- conv = conv->u.next;
- /* If the next conversion is a BASE_CONV, skip that too -- but
- remember that the conversion was required. */
- if (conv->kind == ck_base)
+ /* The temporary array underlying a std::initializer_list
+ is handled like a reference temporary. */
+ tree ctor = init;
+ if (TREE_CODE (ctor) == TARGET_EXPR)
+ ctor = TARGET_EXPR_INITIAL (ctor);
+ if (TREE_CODE (ctor) == CONSTRUCTOR)
{
- base_conv_type = conv->type;
- conv = conv->u.next;
- }
- else
- base_conv_type = NULL_TREE;
- /* Perform the remainder of the conversion. */
- expr = convert_like_real (conv, expr,
- /*fn=*/NULL_TREE, /*argnum=*/0,
- /*inner=*/-1,
- /*issue_conversion_warnings=*/true,
- /*c_cast_p=*/false,
- complain);
- if (error_operand_p (expr))
- expr = error_mark_node;
- else
- {
- if (!lvalue_or_rvalue_with_address_p (expr))
- {
- tree init;
- var = set_up_extended_ref_temp (decl, expr, cleanup, &init);
- /* Use its address to initialize the reference variable. */
- expr = build_address (var);
- if (base_conv_type)
- expr = convert_to_base (expr,
- build_pointer_type (base_conv_type),
- /*check_access=*/true,
- /*nonnull=*/true, complain);
- if (init)
- expr = build2 (COMPOUND_EXPR, TREE_TYPE (expr), init, expr);
- }
- else
- /* Take the address of EXPR. */
- expr = cp_build_addr_expr (expr, complain);
- /* If a BASE_CONV was required, perform it now. */
- if (base_conv_type)
- expr = (perform_implicit_conversion
- (build_pointer_type (base_conv_type), expr,
- complain));
- expr = build_nop (type, expr);
+ tree array = CONSTRUCTOR_ELT (ctor, 0)->value;
+ array = extend_ref_init_temps_1 (decl, array, cleanups);
+ CONSTRUCTOR_ELT (ctor, 0)->value = array;
}
}
- else
- /* Perform the conversion. */
- expr = convert_like (conv, expr, complain);
-
- /* Free all the conversions we allocated. */
- obstack_free (&conversion_obstack, p);
+ else if (TREE_CODE (init) == CONSTRUCTOR)
+ {
+ unsigned i;
+ constructor_elt *p;
+ VEC(constructor_elt,gc) *elts = CONSTRUCTOR_ELTS (init);
+ FOR_EACH_VEC_ELT (constructor_elt, elts, i, p)
+ p->value = extend_ref_init_temps (decl, p->value, cleanups);
+ }
- return expr;
+ return init;
}
/* Returns true iff TYPE is some variant of std::initializer_list. */
diff --git a/gcc/cp/class.c b/gcc/cp/class.c
index f3d87fca819..be632be64c8 100644
--- a/gcc/cp/class.c
+++ b/gcc/cp/class.c
@@ -3205,6 +3205,12 @@ check_field_decls (tree t, tree *access_decls,
no_const_asn_ref_p,
&any_default_members);
+ /* Now that we've removed bit-field widths from DECL_INITIAL,
+ anything left in DECL_INITIAL is an NSDMI that makes the class
+ non-aggregate. */
+ if (DECL_INITIAL (x))
+ CLASSTYPE_NON_AGGREGATE (t) = true;
+
/* If any field is const, the structure type is pseudo-const. */
if (CP_TYPE_CONST_P (type))
{
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index 1bb6d98d072..32d08caf9cc 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -140,6 +140,7 @@ c-common.h, not after.
5: DECL_INTERFACE_KNOWN.
6: DECL_THIS_STATIC (in VAR_DECL or FUNCTION_DECL).
DECL_FIELD_IS_BASE (in FIELD_DECL)
+ TYPE_DECL_ALIAS_P (in TYPE_DECL)
7: DECL_DEAD_FOR_LOCAL (in VAR_DECL).
DECL_THUNK_P (in a member FUNCTION_DECL)
DECL_NORMAL_CAPTURE_P (in FIELD_DECL)
@@ -2542,6 +2543,17 @@ extern void decl_shadowed_for_var_insert (tree, tree);
#define DECL_PENDING_INLINE_INFO(NODE) \
(LANG_DECL_FN_CHECK (NODE)->u.pending_inline_info)
+/* Nonzero for TYPE_DECL means that it was written 'using name = type'. */
+#define TYPE_DECL_ALIAS_P(NODE) \
+ DECL_LANG_FLAG_6 (TYPE_DECL_CHECK (NODE))
+
+/* Nonzero for a type which is an alias for another type; i.e, a type
+ which declaration was written 'using name-of-type =
+ another-type'. */
+#define TYPE_ALIAS_P(NODE) \
+ (TYPE_P (NODE) \
+ && TYPE_DECL_ALIAS_P (TYPE_NAME (NODE)))
+
/* For a class type: if this structure has many fields, we'll sort them
and put them into a TREE_VEC. */
#define CLASSTYPE_SORTED_FIELDS(NODE) \
@@ -2598,16 +2610,20 @@ extern void decl_shadowed_for_var_insert (tree, tree);
? ENUM_TEMPLATE_INFO (NODE) : \
(TREE_CODE (NODE) == BOUND_TEMPLATE_TEMPLATE_PARM \
? TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO (NODE) : \
- (TYPE_LANG_SPECIFIC (NODE) \
+ ((CLASS_TYPE_P (NODE) && !TYPE_ALIAS_P (NODE)) \
? CLASSTYPE_TEMPLATE_INFO (NODE) \
- : NULL_TREE)))
+ : (DECL_LANG_SPECIFIC (TYPE_NAME (NODE)) \
+ ? (DECL_TEMPLATE_INFO (TYPE_NAME (NODE))) \
+ : NULL_TREE))))
/* Set the template information for an ENUMERAL_, RECORD_, or
UNION_TYPE to VAL. */
-#define SET_TYPE_TEMPLATE_INFO(NODE, VAL) \
- (TREE_CODE (NODE) == ENUMERAL_TYPE \
- ? (ENUM_TEMPLATE_INFO (NODE) = (VAL)) \
- : (CLASSTYPE_TEMPLATE_INFO (NODE) = (VAL)))
+#define SET_TYPE_TEMPLATE_INFO(NODE, VAL) \
+ (TREE_CODE (NODE) == ENUMERAL_TYPE \
+ ? (ENUM_TEMPLATE_INFO (NODE) = (VAL)) \
+ : ((CLASS_TYPE_P (NODE) && !TYPE_ALIAS_P (NODE)) \
+ ? (CLASSTYPE_TEMPLATE_INFO (NODE) = (VAL)) \
+ : (DECL_TEMPLATE_INFO (TYPE_NAME (NODE)) = (VAL))))
#define TI_TEMPLATE(NODE) TREE_TYPE (TEMPLATE_INFO_CHECK (NODE))
#define TI_ARGS(NODE) TREE_CHAIN (TEMPLATE_INFO_CHECK (NODE))
@@ -3206,8 +3222,9 @@ more_aggr_init_expr_args_p (const aggr_init_expr_arg_iterator *iter)
/* [dcl.init.aggr]
- An aggregate is an array or a class with no user-declared
- constructors, no private or protected non-static data members, no
+ An aggregate is an array or a class with no user-provided
+ constructors, no brace-or-equal-initializers for non-static data
+ members, no private or protected non-static data members, no
base classes, and no virtual functions.
As an extension, we also treat vectors as aggregates. Keep these
@@ -3620,12 +3637,23 @@ more_aggr_init_expr_args_p (const aggr_init_expr_arg_iterator *iter)
&& !DECL_UNBOUND_CLASS_TEMPLATE_P (NODE) \
&& TREE_CODE (DECL_TEMPLATE_RESULT (NODE)) == FUNCTION_DECL)
-/* Nonzero for a DECL that represents a template class. */
-#define DECL_CLASS_TEMPLATE_P(NODE) \
+/* Nonzero for a DECL that represents a class template or alias
+ template. */
+#define DECL_TYPE_TEMPLATE_P(NODE) \
(TREE_CODE (NODE) == TEMPLATE_DECL \
&& DECL_TEMPLATE_RESULT (NODE) != NULL_TREE \
+ && TREE_CODE (DECL_TEMPLATE_RESULT (NODE)) == TYPE_DECL)
+
+/* Nonzero for a DECL that represents a class template. */
+#define DECL_CLASS_TEMPLATE_P(NODE) \
+ (DECL_TYPE_TEMPLATE_P (NODE) \
&& DECL_IMPLICIT_TYPEDEF_P (DECL_TEMPLATE_RESULT (NODE)))
+/* Nonzero for a TEMPLATE_DECL that represents an alias template. */
+#define DECL_ALIAS_TEMPLATE_P(NODE) \
+ (DECL_TYPE_TEMPLATE_P (NODE) \
+ && !DECL_ARTIFICIAL (DECL_TEMPLATE_RESULT (NODE)))
+
/* Nonzero for a NODE which declares a type. */
#define DECL_DECLARES_TYPE_P(NODE) \
(TREE_CODE (NODE) == TYPE_DECL || DECL_CLASS_TEMPLATE_P (NODE))
@@ -4584,6 +4612,7 @@ typedef enum cp_decl_spec {
ds_explicit,
ds_friend,
ds_typedef,
+ ds_alias,
ds_constexpr,
ds_complex,
ds_thread,
@@ -4815,9 +4844,9 @@ extern tree cxx_type_promotes_to (tree);
extern tree type_passed_as (tree);
extern tree convert_for_arg_passing (tree, tree);
extern bool is_properly_derived_from (tree, tree);
-extern tree set_up_extended_ref_temp (tree, tree, tree *, tree *);
-extern tree initialize_reference (tree, tree, tree, tree *, int,
+extern tree initialize_reference (tree, tree, int,
tsubst_flags_t);
+extern tree extend_ref_init_temps (tree, tree, VEC(tree,gc)**);
extern tree make_temporary_var_for_ref_to_temp (tree, tree);
extern tree strip_top_quals (tree);
extern bool reference_related_p (tree, tree);
@@ -5053,7 +5082,7 @@ extern tree build_offset_ref_call_from_tree (tree, VEC(tree,gc) **);
extern bool decl_constant_var_p (tree);
extern bool decl_maybe_constant_var_p (tree);
extern void check_default_args (tree);
-extern void mark_used (tree);
+extern bool mark_used (tree);
extern void finish_static_data_member_decl (tree, tree, bool, tree, int);
extern tree cp_build_parm_decl (tree, tree);
extern tree get_guard (tree);
@@ -5287,6 +5316,8 @@ extern tree build_non_dependent_expr (tree);
extern void make_args_non_dependent (VEC(tree,gc) *);
extern bool reregister_specialization (tree, tree, tree);
extern tree fold_non_dependent_expr (tree);
+extern bool alias_type_or_template_p (tree);
+extern bool alias_template_specialization_p (tree);
extern bool explicit_class_specialization_p (tree);
extern int push_tinst_level (tree);
extern void pop_tinst_level (void);
@@ -5801,7 +5832,7 @@ extern void complete_type_check_abstract (tree);
extern int abstract_virtuals_error (tree, tree);
extern int abstract_virtuals_error_sfinae (tree, tree, tsubst_flags_t);
-extern tree store_init_value (tree, tree, int);
+extern tree store_init_value (tree, tree, VEC(tree,gc)**, int);
extern void check_narrowing (tree, tree);
extern tree digest_init (tree, tree, tsubst_flags_t);
extern tree digest_init_flags (tree, tree, int);
diff --git a/gcc/cp/cvt.c b/gcc/cp/cvt.c
index 3e618d320ad..8570e3d4502 100644
--- a/gcc/cp/cvt.c
+++ b/gcc/cp/cvt.c
@@ -198,6 +198,11 @@ cp_convert_to_pointer (tree type, tree expr)
if (null_ptr_cst_p (expr))
{
+ if (c_inhibit_evaluation_warnings == 0
+ && !NULLPTR_TYPE_P (TREE_TYPE (expr)))
+ warning (OPT_Wzero_as_null_pointer_constant,
+ "zero as null pointer constant");
+
if (TYPE_PTRMEMFUNC_P (type))
return build_ptrmemfunc (TYPE_PTRMEMFUNC_FN_TYPE (type), expr, 0,
/*c_cast_p=*/false, tf_warning_or_error);
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index cf0429e3f18..de0cf25d640 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -71,7 +71,7 @@ static void require_complete_types_for_parms (tree);
static int ambi_op_p (enum tree_code);
static int unary_op_p (enum tree_code);
static void push_local_name (tree);
-static tree grok_reference_init (tree, tree, tree, tree *, int);
+static tree grok_reference_init (tree, tree, tree, int);
static tree grokvardecl (tree, tree, const cp_decl_specifier_seq *,
int, int, tree);
static int check_static_variable_definition (tree, tree);
@@ -91,7 +91,7 @@ static tree lookup_and_check_tag (enum tag_types, tree, tag_scope, bool);
static int walk_namespaces_r (tree, walk_namespaces_fn, void *);
static void maybe_deduce_size_from_array_init (tree, tree);
static void layout_var_decl (tree);
-static tree check_initializer (tree, tree, int, tree *);
+static tree check_initializer (tree, tree, int, VEC(tree,gc) **);
static void make_rtl_for_nonlocal_decl (tree, tree, const char *);
static void save_function_data (tree);
static void copy_type_enum (tree , tree);
@@ -3270,7 +3270,7 @@ make_typename_type (tree context, tree name, enum tag_types tag_type,
return error_mark_node;
}
- if (want_template && !DECL_CLASS_TEMPLATE_P (t))
+ if (want_template && !DECL_TYPE_TEMPLATE_P (t))
{
if (complain & tf_error)
error ("%<typename %T::%D%> names %q#T, which is not a class template",
@@ -3338,7 +3338,7 @@ make_unbound_class_template (tree context, tree name, tree parm_list,
if (tmpl && TREE_CODE (tmpl) == TYPE_DECL)
tmpl = maybe_get_template_decl_from_type_decl (tmpl);
- if (!tmpl || !DECL_CLASS_TEMPLATE_P (tmpl))
+ if (!tmpl || !DECL_TYPE_TEMPLATE_P (tmpl))
{
if (complain & tf_error)
error ("no class template named %q#T in %q#T", name, context);
@@ -4613,11 +4613,8 @@ start_decl_1 (tree decl, bool initialized)
Quotes on semantics can be found in ARM 8.4.3. */
static tree
-grok_reference_init (tree decl, tree type, tree init, tree *cleanup,
- int flags)
+grok_reference_init (tree decl, tree type, tree init, int flags)
{
- tree tmp;
-
if (init == NULL_TREE)
{
if ((DECL_LANG_SPECIFIC (decl) == 0
@@ -4643,62 +4640,8 @@ grok_reference_init (tree decl, tree type, tree init, tree *cleanup,
DECL_INITIAL for local references (instead assigning to them
explicitly); we need to allow the temporary to be initialized
first. */
- tmp = initialize_reference (type, init, decl, cleanup, flags,
- tf_warning_or_error);
- if (DECL_DECLARED_CONSTEXPR_P (decl))
- {
- tmp = cxx_constant_value (tmp);
- DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P (decl)
- = reduced_constant_expression_p (tmp);
- }
-
- if (tmp == error_mark_node)
- return NULL_TREE;
- else if (tmp == NULL_TREE)
- {
- error ("cannot initialize %qT from %qT", type, TREE_TYPE (init));
- return NULL_TREE;
- }
-
- if (TREE_STATIC (decl) && !TREE_CONSTANT (tmp))
- return tmp;
-
- DECL_INITIAL (decl) = tmp;
-
- return NULL_TREE;
-}
-
-/* Subroutine of check_initializer. We're initializing a DECL of
- std::initializer_list<T> TYPE from a braced-init-list INIT, and need to
- extend the lifetime of the underlying array to match that of the decl,
- just like for reference initialization. CLEANUP is as for
- grok_reference_init. */
-
-static tree
-build_init_list_var_init (tree decl, tree type, tree init, tree *array_init,
- tree *cleanup)
-{
- tree aggr_init, array, arrtype;
- init = perform_implicit_conversion (type, init, tf_warning_or_error);
- if (error_operand_p (init))
- return error_mark_node;
-
- aggr_init = TARGET_EXPR_INITIAL (init);
- array = CONSTRUCTOR_ELT (aggr_init, 0)->value;
- arrtype = TREE_TYPE (array);
- STRIP_NOPS (array);
- gcc_assert (TREE_CODE (array) == ADDR_EXPR);
- array = TREE_OPERAND (array, 0);
- /* If the array is constant, finish_compound_literal already made it a
- static variable and we don't need to do anything here. */
- if (decl && TREE_CODE (array) == TARGET_EXPR)
- {
- tree var = set_up_extended_ref_temp (decl, array, cleanup, array_init);
- var = build_address (var);
- var = convert (arrtype, var);
- CONSTRUCTOR_ELT (aggr_init, 0)->value = var;
- }
- return init;
+ return initialize_reference (type, init, flags,
+ tf_warning_or_error);
}
/* Designated initializers in arrays are not supported in GNU C++.
@@ -5442,7 +5385,7 @@ build_aggr_init_full_exprs (tree decl, tree init, int flags)
evaluated dynamically to initialize DECL. */
static tree
-check_initializer (tree decl, tree init, int flags, tree *cleanup)
+check_initializer (tree decl, tree init, int flags, VEC(tree,gc) **cleanups)
{
tree type = TREE_TYPE (decl);
tree init_code = NULL;
@@ -5511,19 +5454,26 @@ check_initializer (tree decl, tree init, int flags, tree *cleanup)
}
else if (!init && DECL_REALLY_EXTERN (decl))
;
- else if (TREE_CODE (type) == REFERENCE_TYPE)
- init = grok_reference_init (decl, type, init, cleanup, flags);
- else if (init || type_build_ctor_call (type))
+ else if (init || type_build_ctor_call (type)
+ || TREE_CODE (type) == REFERENCE_TYPE)
{
- if (!init)
+ if (TREE_CODE (type) == REFERENCE_TYPE)
+ {
+ init = grok_reference_init (decl, type, init, flags);
+ flags |= LOOKUP_ALREADY_DIGESTED;
+ }
+ else if (!init)
check_for_uninitialized_const_var (decl);
/* Do not reshape constructors of vectors (they don't need to be
reshaped. */
else if (BRACE_ENCLOSED_INITIALIZER_P (init))
{
if (is_std_init_list (type))
- init = build_init_list_var_init (decl, type, init,
- &extra_init, cleanup);
+ {
+ init = perform_implicit_conversion (type, init,
+ tf_warning_or_error);
+ flags |= LOOKUP_ALREADY_DIGESTED;
+ }
else if (TYPE_NON_AGGREGATE_CLASS (type))
{
/* Don't reshape if the class has constructors. */
@@ -5540,7 +5490,7 @@ check_initializer (tree decl, tree init, int flags, tree *cleanup)
else
{
init = reshape_init (type, init, tf_warning_or_error);
- if (cxx_dialect >= cxx0x && SCALAR_TYPE_P (type))
+ if (SCALAR_TYPE_P (type))
check_narrowing (type, init);
}
}
@@ -5552,9 +5502,10 @@ check_initializer (tree decl, tree init, int flags, tree *cleanup)
if (type == error_mark_node)
return NULL_TREE;
- if (type_build_ctor_call (type)
- || (CLASS_TYPE_P (type)
- && !(init && BRACE_ENCLOSED_INITIALIZER_P (init))))
+ if ((type_build_ctor_call (type) || CLASS_TYPE_P (type))
+ && !(flags & LOOKUP_ALREADY_DIGESTED)
+ && !(init && BRACE_ENCLOSED_INITIALIZER_P (init)
+ && CP_AGGREGATE_TYPE_P (type)))
{
init_code = build_aggr_init_full_exprs (decl, init, flags);
@@ -5596,7 +5547,7 @@ check_initializer (tree decl, tree init, int flags, tree *cleanup)
if (init && TREE_CODE (init) != TREE_VEC)
{
- init_code = store_init_value (decl, init, flags);
+ init_code = store_init_value (decl, init, cleanups, flags);
if (pedantic && TREE_CODE (type) == ARRAY_TYPE
&& DECL_INITIAL (decl)
&& TREE_CODE (DECL_INITIAL (decl)) == STRING_CST
@@ -5958,7 +5909,7 @@ cp_finish_decl (tree decl, tree init, bool init_const_expr_p,
tree asmspec_tree, int flags)
{
tree type;
- tree cleanup;
+ VEC(tree,gc) *cleanups = NULL;
const char *asmspec = NULL;
int was_readonly = 0;
bool var_definition_p = false;
@@ -5981,9 +5932,6 @@ cp_finish_decl (tree decl, tree init, bool init_const_expr_p,
if (type == error_mark_node)
return;
- /* Assume no cleanup is required. */
- cleanup = NULL_TREE;
-
/* If a name was specified, get the string. */
if (at_namespace_scope_p ())
asmspec_tree = maybe_apply_renaming_pragma (decl, asmspec_tree);
@@ -6103,9 +6051,12 @@ cp_finish_decl (tree decl, tree init, bool init_const_expr_p,
/* This variable seems to be a non-dependent constant, so process
its initializer. If check_initializer returns non-null the
initialization wasn't constant after all. */
- tree init_code = check_initializer (decl, init, flags, &cleanup);
+ tree init_code;
+ cleanups = make_tree_vector ();
+ init_code = check_initializer (decl, init, flags, &cleanups);
if (init_code == NULL_TREE)
init = NULL_TREE;
+ release_tree_vector (cleanups);
}
else if (!DECL_PRETTY_FUNCTION_P (decl))
/* Deduce array size even if the initializer is dependent. */
@@ -6204,7 +6155,8 @@ cp_finish_decl (tree decl, tree init, bool init_const_expr_p,
error ("Java object %qD not allocated with %<new%>", decl);
init = NULL_TREE;
}
- init = check_initializer (decl, init, flags, &cleanup);
+ cleanups = make_tree_vector ();
+ init = check_initializer (decl, init, flags, &cleanups);
/* Thread-local storage cannot be dynamically initialized. */
if (DECL_THREAD_LOCAL_P (decl) && init)
{
@@ -6369,8 +6321,13 @@ cp_finish_decl (tree decl, tree init, bool init_const_expr_p,
/* If a CLEANUP_STMT was created to destroy a temporary bound to a
reference, insert it in the statement-tree now. */
- if (cleanup)
- push_cleanup (decl, cleanup, false);
+ if (cleanups)
+ {
+ unsigned i; tree t;
+ FOR_EACH_VEC_ELT (tree, cleanups, i, t)
+ push_cleanup (decl, t, false);
+ release_tree_vector (cleanups);
+ }
if (was_readonly)
TREE_READONLY (decl) = 1;
@@ -9792,6 +9749,11 @@ grokdeclarator (const cp_declarator *declarator,
memfn_quals != TYPE_UNQUALIFIED,
inlinep, friendp, raises != NULL_TREE);
+ if (declspecs->specs[(int)ds_alias])
+ /* Acknowledge that this was written:
+ `using analias = atype;'. */
+ TYPE_DECL_ALIAS_P (decl) = 1;
+
return decl;
}
@@ -13066,6 +13028,7 @@ save_function_data (tree decl)
f->base.x_stmt_tree.x_cur_stmt_list = NULL;
f->bindings = NULL;
f->x_local_names = NULL;
+ f->base.local_typedefs = NULL;
}
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c
index be9044b9e67..3dc5a69df54 100644
--- a/gcc/cp/decl2.c
+++ b/gcc/cp/decl2.c
@@ -848,9 +848,6 @@ grokfield (const cp_declarator *declarator,
DECL_NONLOCAL (value) = 1;
DECL_CONTEXT (value) = current_class_type;
- if (processing_template_decl)
- value = push_template_decl (value);
-
if (attrlist)
{
int attrflags = 0;
@@ -869,6 +866,12 @@ grokfield (const cp_declarator *declarator,
&& TYPE_NAME (TYPE_MAIN_VARIANT (TREE_TYPE (value))) != value)
set_underlying_type (value);
+ /* It's important that push_template_decl below follows
+ set_underlying_type above so that the created template
+ carries the properly set type of VALUE. */
+ if (processing_template_decl)
+ value = push_template_decl (value);
+
record_locally_defined_typedef (value);
return value;
}
@@ -1877,10 +1880,12 @@ maybe_emit_vtables (tree ctype)
if (TREE_TYPE (DECL_INITIAL (vtbl)) == 0)
{
- tree expr = store_init_value (vtbl, DECL_INITIAL (vtbl), LOOKUP_NORMAL);
+ VEC(tree,gc)* cleanups = NULL;
+ tree expr = store_init_value (vtbl, DECL_INITIAL (vtbl), &cleanups,
+ LOOKUP_NORMAL);
/* It had better be all done at compile-time. */
- gcc_assert (!expr);
+ gcc_assert (!expr && !cleanups);
}
/* Write it out. */
@@ -1952,10 +1957,12 @@ type_visibility (tree type)
}
/* Limit the visibility of DECL to VISIBILITY, if not explicitly
- specified (or if VISIBILITY is static). */
+ specified (or if VISIBILITY is static). If TMPL is true, this
+ constraint is for a template argument, and takes precedence
+ over explicitly-specified visibility on the template. */
-static bool
-constrain_visibility (tree decl, int visibility)
+static void
+constrain_visibility (tree decl, int visibility, bool tmpl)
{
if (visibility == VISIBILITY_ANON)
{
@@ -1973,12 +1980,10 @@ constrain_visibility (tree decl, int visibility)
}
}
else if (visibility > DECL_VISIBILITY (decl)
- && !DECL_VISIBILITY_SPECIFIED (decl))
+ && (tmpl || !DECL_VISIBILITY_SPECIFIED (decl)))
{
DECL_VISIBILITY (decl) = (enum symbol_visibility) visibility;
- return true;
}
- return false;
}
/* Constrain the visibility of DECL based on the visibility of its template
@@ -2014,7 +2019,7 @@ constrain_visibility_for_template (tree decl, tree targs)
}
}
if (vis)
- constrain_visibility (decl, vis);
+ constrain_visibility (decl, vis, true);
}
}
@@ -2127,7 +2132,7 @@ determine_visibility (tree decl)
if (underlying_vis == VISIBILITY_ANON
|| (CLASS_TYPE_P (underlying_type)
&& CLASSTYPE_VISIBILITY_SPECIFIED (underlying_type)))
- constrain_visibility (decl, underlying_vis);
+ constrain_visibility (decl, underlying_vis, false);
else
DECL_VISIBILITY (decl) = VISIBILITY_DEFAULT;
}
@@ -2135,7 +2140,7 @@ determine_visibility (tree decl)
{
/* tinfo visibility is based on the type it's for. */
constrain_visibility
- (decl, type_visibility (TREE_TYPE (DECL_NAME (decl))));
+ (decl, type_visibility (TREE_TYPE (DECL_NAME (decl))), false);
/* Give the target a chance to override the visibility associated
with DECL. */
@@ -2202,14 +2207,14 @@ determine_visibility (tree decl)
if (decl_anon_ns_mem_p (decl))
/* Names in an anonymous namespace get internal linkage.
This might change once we implement export. */
- constrain_visibility (decl, VISIBILITY_ANON);
+ constrain_visibility (decl, VISIBILITY_ANON, false);
else if (TREE_CODE (decl) != TYPE_DECL)
{
/* Propagate anonymity from type to decl. */
int tvis = type_visibility (TREE_TYPE (decl));
if (tvis == VISIBILITY_ANON
|| ! DECL_VISIBILITY_SPECIFIED (decl))
- constrain_visibility (decl, tvis);
+ constrain_visibility (decl, tvis, false);
}
else if (no_linkage_check (TREE_TYPE (decl), /*relaxed_p=*/true))
/* DR 757: A type without linkage shall not be used as the type of a
@@ -2220,7 +2225,7 @@ determine_visibility (tree decl)
Since non-extern "C" decls need to be defined in the same
translation unit, we can make the type internal. */
- constrain_visibility (decl, VISIBILITY_ANON);
+ constrain_visibility (decl, VISIBILITY_ANON, false);
/* If visibility changed and DECL already has DECL_RTL, ensure
symbol flags are updated. */
@@ -4201,9 +4206,10 @@ possibly_inlined_p (tree decl)
/* Mark DECL (either a _DECL or a BASELINK) as "used" in the program.
If DECL is a specialization or implicitly declared class member,
- generate the actual definition. */
+ generate the actual definition. Return false if something goes
+ wrong, true otherwise. */
-void
+bool
mark_used (tree decl)
{
/* If DECL is a BASELINK for a single function, then treat it just
@@ -4214,7 +4220,7 @@ mark_used (tree decl)
{
decl = BASELINK_FUNCTIONS (decl);
if (really_overloaded_fn (decl))
- return;
+ return true;
decl = OVL_CURRENT (decl);
}
@@ -4235,13 +4241,13 @@ mark_used (tree decl)
generate it properly; see maybe_add_lambda_conv_op. */
sorry ("converting lambda which uses %<...%> to "
"function pointer");
- return;
+ return false;
}
}
error ("use of deleted function %qD", decl);
if (!maybe_explain_implicit_delete (decl))
error_at (DECL_SOURCE_LOCATION (decl), "declared here");
- return;
+ return false;
}
/* We can only check DECL_ODR_USED on variables or functions with
@@ -4250,20 +4256,20 @@ mark_used (tree decl)
if ((TREE_CODE (decl) != VAR_DECL && TREE_CODE (decl) != FUNCTION_DECL)
|| DECL_LANG_SPECIFIC (decl) == NULL
|| DECL_THUNK_P (decl))
- return;
+ return true;
/* We only want to do this processing once. We don't need to keep trying
to instantiate inline templates, because unit-at-a-time will make sure
we get them compiled before functions that want to inline them. */
if (DECL_ODR_USED (decl))
- return;
+ return true;
/* If within finish_function, defer the rest until that function
finishes, otherwise it might recurse. */
if (defer_mark_used_calls)
{
VEC_safe_push (tree, gc, deferred_mark_used_calls, decl);
- return;
+ return true;
}
if (TREE_CODE (decl) == FUNCTION_DECL)
@@ -4292,15 +4298,15 @@ mark_used (tree decl)
/* If we don't need a value, then we don't need to synthesize DECL. */
if (cp_unevaluated_operand != 0)
- return;
+ return true;
if (processing_template_decl)
- return;
+ return true;
/* Check this too in case we're within fold_non_dependent_expr. */
if (DECL_TEMPLATE_INFO (decl)
&& uses_template_parms (DECL_TI_ARGS (decl)))
- return;
+ return true;
DECL_ODR_USED (decl) = 1;
if (DECL_CLONED_FUNCTION_P (decl))
@@ -4378,6 +4384,8 @@ mark_used (tree decl)
/*expl_inst_class_mem_p=*/false);
--function_depth;
}
+
+ return true;
}
#include "gt-cp-decl2.h"
diff --git a/gcc/cp/error.c b/gcc/cp/error.c
index 0bee6b4105c..841366f58fa 100644
--- a/gcc/cp/error.c
+++ b/gcc/cp/error.c
@@ -61,6 +61,7 @@ static const char *op_to_string (enum tree_code);
static const char *parm_to_string (int);
static const char *type_to_string (tree, int);
+static void dump_alias_template_specialization (tree, int);
static void dump_type (tree, int);
static void dump_typename (tree, int);
static void dump_simple_decl (tree, tree, int);
@@ -330,6 +331,23 @@ dump_template_bindings (tree parms, tree args, VEC(tree,gc)* typenames)
}
}
+/* Dump a human-readable equivalent of the alias template
+ specialization of T. */
+
+static void
+dump_alias_template_specialization (tree t, int flags)
+{
+ tree name;
+
+ gcc_assert (alias_template_specialization_p (t));
+
+ name = TYPE_IDENTIFIER (t);
+ pp_cxx_tree_identifier (cxx_pp, name);
+ dump_template_parms (TYPE_TEMPLATE_INFO (t),
+ /*primary=*/false,
+ flags & ~TFF_TEMPLATE_HEADER);
+}
+
/* Dump a human-readable equivalent of TYPE. FLAGS controls the
format. */
@@ -344,10 +362,15 @@ dump_type (tree t, int flags)
{
tree decl = TYPE_NAME (t);
if ((flags & TFF_CHASE_TYPEDEF)
- || DECL_SELF_REFERENCE_P (decl)
- || (!flag_pretty_templates
- && DECL_LANG_SPECIFIC (decl) && DECL_TEMPLATE_INFO (decl)))
+ || DECL_SELF_REFERENCE_P (decl)
+ || (!flag_pretty_templates
+ && DECL_LANG_SPECIFIC (decl) && DECL_TEMPLATE_INFO (decl)))
t = strip_typedefs (t);
+ else if (alias_template_specialization_p (t))
+ {
+ dump_alias_template_specialization (t, flags);
+ return;
+ }
else if (same_type_p (t, TREE_TYPE (decl)))
t = decl;
else
@@ -588,7 +611,10 @@ dump_aggr_type (tree t, int flags)
if (name)
{
- typdef = !DECL_ARTIFICIAL (name);
+ typdef = (!DECL_ARTIFICIAL (name)
+ /* An alias specialization is not considered to be a
+ typedef. */
+ && !alias_template_specialization_p (t));
if ((typdef
&& ((flags & TFF_CHASE_TYPEDEF)
@@ -613,7 +639,7 @@ dump_aggr_type (tree t, int flags)
{
/* Because the template names are mangled, we have to locate
the most general template, and use that name. */
- tree tpl = CLASSTYPE_TI_TEMPLATE (t);
+ tree tpl = TYPE_TI_TEMPLATE (t);
while (DECL_TEMPLATE_INFO (tpl))
tpl = DECL_TI_TEMPLATE (tpl);
@@ -952,6 +978,18 @@ dump_decl (tree t, int flags)
dump_type (TREE_TYPE (t), flags);
break;
}
+ if (TYPE_DECL_ALIAS_P (t)
+ && (flags & TFF_DECL_SPECIFIERS
+ || flags & TFF_CLASS_KEY_OR_ENUM))
+ {
+ pp_cxx_ws_string (cxx_pp, "using");
+ dump_decl (DECL_NAME (t), flags);
+ pp_cxx_whitespace (cxx_pp);
+ pp_cxx_ws_string (cxx_pp, "=");
+ pp_cxx_whitespace (cxx_pp);
+ dump_type (DECL_ORIGINAL_TYPE (t), flags);
+ break;
+ }
if ((flags & TFF_DECL_SPECIFIERS)
&& !DECL_SELF_REFERENCE_P (t))
pp_cxx_ws_string (cxx_pp, "typedef");
@@ -1196,13 +1234,14 @@ dump_template_decl (tree t, int flags)
}
}
- if (DECL_TEMPLATE_RESULT (t)
- && TREE_CODE (DECL_TEMPLATE_RESULT (t)) == TYPE_DECL)
+ if (DECL_CLASS_TEMPLATE_P (t))
dump_type (TREE_TYPE (t),
((flags & ~TFF_CLASS_KEY_OR_ENUM) | TFF_TEMPLATE_NAME
| (flags & TFF_DECL_SPECIFIERS ? TFF_CLASS_KEY_OR_ENUM : 0)));
else if (DECL_TEMPLATE_RESULT (t)
- && TREE_CODE (DECL_TEMPLATE_RESULT (t)) == VAR_DECL)
+ && (TREE_CODE (DECL_TEMPLATE_RESULT (t)) == VAR_DECL
+ /* Alias template. */
+ || DECL_TYPE_TEMPLATE_P (t)))
dump_decl (DECL_TEMPLATE_RESULT (t), flags | TFF_TEMPLATE_NAME);
else
{
diff --git a/gcc/cp/init.c b/gcc/cp/init.c
index 9115df3dba6..ca4f590cc06 100644
--- a/gcc/cp/init.c
+++ b/gcc/cp/init.c
@@ -176,6 +176,8 @@ build_zero_init_1 (tree type, tree nelts, bool static_storage_p,
items with static storage duration that are not otherwise
initialized are initialized to zero. */
;
+ else if (TYPE_PTR_P (type) || TYPE_PTR_TO_MEMBER_P (type))
+ init = convert (type, nullptr_node);
else if (SCALAR_TYPE_P (type))
init = convert (type, integer_zero_node);
else if (CLASS_TYPE_P (type))
@@ -505,7 +507,15 @@ perform_member_init (tree member, tree init)
tf_warning_or_error, member, /*function_p=*/false,
/*integral_constant_expression_p=*/false));
else
- init = break_out_target_exprs (DECL_INITIAL (member));
+ {
+ init = DECL_INITIAL (member);
+ /* Strip redundant TARGET_EXPR so we don't need to remap it, and
+ so the aggregate init code below will see a CONSTRUCTOR. */
+ if (init && TREE_CODE (init) == TARGET_EXPR
+ && !VOID_TYPE_P (TREE_TYPE (TARGET_EXPR_INITIAL (init))))
+ init = TARGET_EXPR_INITIAL (init);
+ init = break_out_target_exprs (init);
+ }
}
/* Effective C++ rule 12 requires that all data members be
@@ -563,6 +573,42 @@ perform_member_init (tree member, tree init)
finish_expr_stmt (init);
}
}
+ else if (init
+ && (TREE_CODE (type) == REFERENCE_TYPE
+ /* Pre-digested NSDMI. */
+ || (((TREE_CODE (init) == CONSTRUCTOR
+ && TREE_TYPE (init) == type)
+ /* { } mem-initializer. */
+ || (TREE_CODE (init) == TREE_LIST
+ && TREE_CODE (TREE_VALUE (init)) == CONSTRUCTOR
+ && CONSTRUCTOR_IS_DIRECT_INIT (TREE_VALUE (init))))
+ && (CP_AGGREGATE_TYPE_P (type)
+ || is_std_init_list (type)))))
+ {
+ /* With references and list-initialization, we need to deal with
+ extending temporary lifetimes. 12.2p5: "A temporary bound to a
+ reference member in a constructor’s ctor-initializer (12.6.2)
+ persists until the constructor exits." */
+ unsigned i; tree t;
+ VEC(tree,gc) *cleanups = make_tree_vector ();
+ if (TREE_CODE (init) == TREE_LIST)
+ init = build_x_compound_expr_from_list (init, ELK_MEM_INIT,
+ tf_warning_or_error);
+ if (TREE_TYPE (init) != type)
+ init = digest_init (type, init, tf_warning_or_error);
+ if (init == error_mark_node)
+ return;
+ /* Use 'this' as the decl, as it has the lifetime we want. */
+ init = extend_ref_init_temps (current_class_ptr, init, &cleanups);
+ if (TREE_CODE (type) == ARRAY_TYPE
+ && TYPE_HAS_NONTRIVIAL_DESTRUCTOR (TREE_TYPE (type)))
+ init = build_vec_init_expr (type, init, tf_warning_or_error);
+ init = build2 (INIT_EXPR, type, decl, init);
+ finish_expr_stmt (init);
+ FOR_EACH_VEC_ELT (tree, cleanups, i, t)
+ push_cleanup (decl, t, false);
+ release_tree_vector (cleanups);
+ }
else if (type_build_ctor_call (type)
|| (init && CLASS_TYPE_P (strip_array_types (type))))
{
@@ -1375,6 +1421,8 @@ build_aggr_init (tree exp, tree init, int flags, tsubst_flags_t complain)
TREE_THIS_VOLATILE (exp) = 0;
if (init && TREE_CODE (init) != TREE_LIST
+ && !(TREE_CODE (init) == TARGET_EXPR
+ && TARGET_EXPR_DIRECT_INIT_P (init))
&& !(BRACE_ENCLOSED_INITIALIZER_P (init)
&& CONSTRUCTOR_IS_DIRECT_INIT (init)))
flags |= LOOKUP_ONLYCONVERTING;
@@ -1457,10 +1505,28 @@ expand_default_init (tree binfo, tree true_exp, tree exp, tree init, int flags,
if (init && BRACE_ENCLOSED_INITIALIZER_P (init)
&& CP_AGGREGATE_TYPE_P (type))
+ /* A brace-enclosed initializer for an aggregate. In C++0x this can
+ happen for direct-initialization, too. */
+ init = digest_init (type, init, complain);
+
+ /* A CONSTRUCTOR of the target's type is a previously digested
+ initializer, whether that happened just above or in
+ cp_parser_late_parsing_nsdmi.
+
+ A TARGET_EXPR with TARGET_EXPR_DIRECT_INIT_P or TARGET_EXPR_LIST_INIT_P
+ set represents the whole initialization, so we shouldn't build up
+ another ctor call. */
+ if (init
+ && (TREE_CODE (init) == CONSTRUCTOR
+ || (TREE_CODE (init) == TARGET_EXPR
+ && (TARGET_EXPR_DIRECT_INIT_P (init)
+ || TARGET_EXPR_LIST_INIT_P (init))))
+ && same_type_ignoring_top_level_qualifiers_p (TREE_TYPE (init), type))
{
- /* A brace-enclosed initializer for an aggregate. In C++0x this can
- happen for direct-initialization, too. */
- init = digest_init (type, init, complain);
+ /* Early initialization via a TARGET_EXPR only works for
+ complete objects. */
+ gcc_assert (TREE_CODE (init) == CONSTRUCTOR || true_exp == exp);
+
init = build2 (INIT_EXPR, TREE_TYPE (exp), exp, init);
TREE_SIDE_EFFECTS (init) = 1;
finish_expr_stmt (init);
@@ -1575,12 +1641,14 @@ expand_aggr_init_1 (tree binfo, tree true_exp, tree exp, tree init, int flags,
if (init && TREE_CODE (exp) == VAR_DECL
&& COMPOUND_LITERAL_P (init))
{
+ VEC(tree,gc)* cleanups = NULL;
/* If store_init_value returns NULL_TREE, the INIT has been
recorded as the DECL_INITIAL for EXP. That means there's
nothing more we have to do. */
- init = store_init_value (exp, init, flags);
+ init = store_init_value (exp, init, &cleanups, flags);
if (init)
finish_expr_stmt (init);
+ gcc_assert (!cleanups);
return;
}
@@ -3128,6 +3196,9 @@ build_vec_init (tree base, tree maxindex, tree init,
bool try_const = (TREE_CODE (atype) == ARRAY_TYPE
&& (literal_type_p (inner_elt_type)
|| TYPE_HAS_CONSTEXPR_CTOR (inner_elt_type)));
+ /* If the constructor already has the array type, it's been through
+ digest_init, so we shouldn't try to do anything more. */
+ bool digested = same_type_p (atype, TREE_TYPE (init));
bool saw_non_const = false;
bool saw_const = false;
/* If we're initializing a static array, we want to do static
@@ -3150,7 +3221,9 @@ build_vec_init (tree base, tree maxindex, tree init,
num_initialized_elts++;
current_stmt_tree ()->stmts_are_full_exprs_p = 1;
- if (MAYBE_CLASS_TYPE_P (type) || TREE_CODE (type) == ARRAY_TYPE)
+ if (digested)
+ one_init = build2 (INIT_EXPR, type, baseref, elt);
+ else if (MAYBE_CLASS_TYPE_P (type) || TREE_CODE (type) == ARRAY_TYPE)
one_init = build_aggr_init (baseref, elt, 0, complain);
else
one_init = cp_build_modify_expr (baseref, NOP_EXPR,
diff --git a/gcc/cp/mangle.c b/gcc/cp/mangle.c
index 69fe147f480..548998a086f 100644
--- a/gcc/cp/mangle.c
+++ b/gcc/cp/mangle.c
@@ -1339,7 +1339,7 @@ nested_anon_class_index (tree type)
/* <unnamed-type-name> ::= Ut [ <nonnegative number> ] _ */
static void
-write_unnamed_type_name (const tree type __attribute__ ((__unused__)))
+write_unnamed_type_name (const tree type ATTRIBUTE_UNUSED)
{
int discriminator;
MANGLE_TRACE_TREE ("unnamed-type-name", type);
@@ -3503,12 +3503,17 @@ mangle_guard_variable (const tree variable)
initialize a static reference. This isn't part of the ABI, but we might
as well call them something readable. */
+static GTY(()) int temp_count;
+
tree
mangle_ref_init_variable (const tree variable)
{
start_mangling (variable);
write_string ("_ZGR");
write_name (variable, /*ignore_local_scope=*/0);
+ /* Avoid name clashes with aggregate initialization of multiple
+ references at once. */
+ write_unsigned_number (temp_count++);
return finish_mangling_get_identifier (/*warn=*/false);
}
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index b7d99c803ab..7c86b1b41b6 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -749,7 +749,7 @@ cp_lexer_get_preprocessor_token (cp_lexer *lexer, cp_token *token)
/* Warn about the C++0x keyword (but still treat it as
an identifier). */
warning (OPT_Wc__0x_compat,
- "identifier %qE will become a keyword in C++0x",
+ "identifier %qE is a keyword in C++11",
token->u.value);
/* Clear out the C_RID_CODE so we don't warn about this
@@ -1940,6 +1940,8 @@ static bool cp_parser_using_declaration
(cp_parser *, bool);
static void cp_parser_using_directive
(cp_parser *);
+static tree cp_parser_alias_declaration
+ (cp_parser *);
static void cp_parser_asm_definition
(cp_parser *);
static void cp_parser_linkage_specification
@@ -2525,6 +2527,7 @@ cp_parser_check_decl_spec (cp_decl_specifier_seq *decl_specs,
"explicit",
"friend",
"typedef",
+ "using",
"constexpr",
"__complex",
"__thread"
@@ -3701,8 +3704,8 @@ cp_parser_userdef_string_literal (cp_token *token)
suffix_id = USERDEF_LITERAL_SUFFIX_ID (literal);
name = cp_literal_operator_id (IDENTIFIER_POINTER (suffix_id));
value = USERDEF_LITERAL_VALUE (literal);
- len = TREE_STRING_LENGTH (value) - 1;
-
+ len = TREE_STRING_LENGTH (value)
+ / TREE_INT_CST_LOW (TYPE_SIZE_UNIT (TREE_TYPE (TREE_TYPE (value)))) - 1;
/* Build up a call to the user-defined operator */
/* Lookup the name we got back from the id-expression. */
vec = make_tree_vector ();
@@ -5155,7 +5158,7 @@ cp_parser_nested_name_specifier (cp_parser *parser,
this is either a class-name or a namespace-name (which corresponds
to the class-or-namespace-name production in the grammar). For
C++0x, it can also be a type-name that refers to an enumeration
- type.
+ type or a simple-template-id.
TYPENAME_KEYWORD_P is TRUE iff the `typename' keyword is in effect.
TEMPLATE_KEYWORD_P is TRUE iff the `template' keyword is in effect.
@@ -5231,8 +5234,8 @@ cp_parser_qualifying_entity (cp_parser *parser,
/* Parse tentatively. */
cp_parser_parse_tentatively (parser);
- /* Parse a typedef-name or enum-name. */
- scope = cp_parser_nonclass_name (parser);
+ /* Parse a type-name */
+ scope = cp_parser_type_name (parser);
/* "If the name found does not designate a namespace or a class,
enumeration, or dependent type, the program is ill-formed."
@@ -7222,8 +7225,8 @@ cp_parser_binary_expression (cp_parser* parser, bool cast_p,
&& !parser->greater_than_is_operator_p)
{
if (warning_at (token->location, OPT_Wc__0x_compat,
- "%<>>%> operator will be treated as"
- " two right angle brackets in C++0x"))
+ "%<>>%> operator is treated as"
+ " two right angle brackets in C++11"))
inform (token->location,
"suggest parentheses around %<>>%> expression");
}
@@ -10187,8 +10190,8 @@ cp_parser_block_declaration (cp_parser *parser,
namespace-alias-definition. */
else if (token1->keyword == RID_NAMESPACE)
cp_parser_namespace_alias_definition (parser);
- /* If the next keyword is `using', we have either a
- using-declaration or a using-directive. */
+ /* If the next keyword is `using', we have a
+ using-declaration, a using-directive, or an alias-declaration. */
else if (token1->keyword == RID_USING)
{
cp_token *token2;
@@ -10200,6 +10203,14 @@ cp_parser_block_declaration (cp_parser *parser,
token2 = cp_lexer_peek_nth_token (parser->lexer, 2);
if (token2->keyword == RID_NAMESPACE)
cp_parser_using_directive (parser);
+ /* If the second token after 'using' is '=', then we have an
+ alias-declaration. */
+ else if (cxx_dialect >= cxx0x
+ && token2->type == CPP_NAME
+ && ((cp_lexer_peek_nth_token (parser->lexer, 3)->type == CPP_EQ)
+ || (cp_lexer_peek_nth_token (parser->lexer, 3)->keyword
+ == RID_ATTRIBUTE)))
+ cp_parser_alias_declaration (parser);
/* Otherwise, it's a using-declaration. */
else
cp_parser_using_declaration (parser,
@@ -10565,7 +10576,7 @@ cp_parser_decl_specifier_seq (cp_parser* parser,
/* Complain about `auto' as a storage specifier, if
we're complaining about C++0x compatibility. */
warning_at (token->location, OPT_Wc__0x_compat, "%<auto%>"
- " will change meaning in C++0x; please remove it");
+ " changes meaning in C++11; please remove it");
/* Set the storage class anyway. */
cp_parser_set_storage_class (parser, decl_specs, RID_AUTO,
@@ -12380,7 +12391,7 @@ cp_parser_template_id (cp_parser *parser,
/* Build a representation of the specialization. */
if (TREE_CODE (templ) == IDENTIFIER_NODE)
template_id = build_min_nt (TEMPLATE_ID_EXPR, templ, arguments);
- else if (DECL_CLASS_TEMPLATE_P (templ)
+ else if (DECL_TYPE_TEMPLATE_P (templ)
|| DECL_TEMPLATE_TEMPLATE_PARM_P (templ))
{
bool entering_scope;
@@ -13648,6 +13659,7 @@ cp_parser_simple_type_specifier (cp_parser* parser,
class-name
enum-name
typedef-name
+ simple-template-id [in c++0x]
enum-name:
identifier
@@ -13675,8 +13687,37 @@ cp_parser_type_name (cp_parser* parser)
/* If it's not a class-name, keep looking. */
if (!cp_parser_parse_definitely (parser))
{
- /* It must be a typedef-name or an enum-name. */
- return cp_parser_nonclass_name (parser);
+ if (cxx_dialect < cxx0x)
+ /* It must be a typedef-name or an enum-name. */
+ return cp_parser_nonclass_name (parser);
+
+ cp_parser_parse_tentatively (parser);
+ /* It is either a simple-template-id representing an
+ instantiation of an alias template... */
+ type_decl = cp_parser_template_id (parser,
+ /*template_keyword_p=*/false,
+ /*check_dependency_p=*/false,
+ /*is_declaration=*/false);
+ /* Note that this must be an instantiation of an alias template
+ because [temp.names]/6 says:
+
+ A template-id that names an alias template specialization
+ is a type-name.
+
+ Whereas [temp.names]/7 says:
+
+ A simple-template-id that names a class template
+ specialization is a class-name. */
+ if (type_decl != NULL_TREE
+ && TREE_CODE (type_decl) == TYPE_DECL
+ && TYPE_DECL_ALIAS_P (type_decl))
+ gcc_assert (DECL_TEMPLATE_INSTANTIATION (type_decl));
+ else
+ cp_parser_simulate_error (parser);
+
+ if (!cp_parser_parse_definitely (parser))
+ /* ... Or a typedef-name or an enum-name. */
+ return cp_parser_nonclass_name (parser);
}
return type_decl;
@@ -14095,6 +14136,7 @@ cp_parser_elaborated_type_specifier (cp_parser* parser,
enum-specifier:
enum-head { enumerator-list [opt] }
+ enum-head { enumerator-list , } [C++0x]
enum-head:
enum-key identifier [opt] enum-base [opt]
@@ -14114,6 +14156,8 @@ cp_parser_elaborated_type_specifier (cp_parser* parser,
GNU Extensions:
enum-key attributes[opt] identifier [opt] enum-base [opt]
{ enumerator-list [opt] }attributes[opt]
+ enum-key attributes[opt] identifier [opt] enum-base [opt]
+ { enumerator-list, }attributes[opt] [C++0x]
Returns an ENUM_TYPE representing the enumeration, or NULL_TREE
if the token stream isn't an enum-specifier after all. */
@@ -14453,8 +14497,9 @@ cp_parser_enumerator_list (cp_parser* parser, tree type)
/* If the next token is a `}', there is a trailing comma. */
if (cp_lexer_next_token_is (parser->lexer, CPP_CLOSE_BRACE))
{
- if (!in_system_header)
- pedwarn (input_location, OPT_pedantic, "comma at end of enumerator list");
+ if (cxx_dialect < cxx0x && !in_system_header)
+ pedwarn (input_location, OPT_pedantic,
+ "comma at end of enumerator list");
break;
}
}
@@ -14868,6 +14913,63 @@ cp_parser_using_declaration (cp_parser* parser,
return true;
}
+/* Parse an alias-declaration.
+
+ alias-declaration:
+ using identifier attribute-specifier-seq [opt] = type-id */
+
+static tree
+cp_parser_alias_declaration (cp_parser* parser)
+{
+ tree id, type, decl, dummy, attributes;
+ location_t id_location;
+ cp_declarator *declarator;
+ cp_decl_specifier_seq decl_specs;
+
+ /* Look for the `using' keyword. */
+ cp_parser_require_keyword (parser, RID_USING, RT_USING);
+ id_location = cp_lexer_peek_token (parser->lexer)->location;
+ id = cp_parser_identifier (parser);
+ attributes = cp_parser_attributes_opt (parser);
+ cp_parser_require (parser, CPP_EQ, RT_EQ);
+
+ type = cp_parser_type_id (parser);
+
+ /* A typedef-name can also be introduced by an alias-declaration. The
+ identifier following the using keyword becomes a typedef-name. It has
+ the same semantics as if it were introduced by the typedef
+ specifier. In particular, it does not define a new type and it shall
+ not appear in the type-id. */
+
+ clear_decl_specs (&decl_specs);
+ decl_specs.type = type;
+ decl_specs.attributes = attributes;
+ ++decl_specs.specs[(int) ds_typedef];
+ ++decl_specs.specs[(int) ds_alias];
+
+ declarator = make_id_declarator (NULL_TREE, id, sfk_none);
+ declarator->id_loc = id_location;
+
+ if (at_class_scope_p ())
+ decl = grokfield (declarator, &decl_specs, NULL_TREE, false,
+ NULL_TREE, attributes);
+ else
+ decl = start_decl (declarator, &decl_specs, 0,
+ attributes, NULL_TREE, &dummy);
+ if (decl == error_mark_node)
+ return decl;
+
+ cp_finish_decl (decl, NULL_TREE, 0, NULL_TREE, 0);
+
+ /* If decl is a template, return its TEMPLATE_DECL so that it gets
+ added into the symbol table; otherwise, return the TYPE_DECL. */
+ if (DECL_LANG_SPECIFIC (decl)
+ && DECL_TEMPLATE_INFO (decl)
+ && PRIMARY_TEMPLATE_P (DECL_TI_TEMPLATE (decl)))
+ decl = DECL_TI_TEMPLATE (decl);
+ return decl;
+}
+
/* Parse a using-directive.
using-directive:
@@ -18570,6 +18672,7 @@ cp_parser_member_specification_opt (cp_parser* parser)
:: [opt] nested-name-specifier template [opt] unqualified-id ;
using-declaration
template-declaration
+ alias-declaration
member-declarator-list:
member-declarator
@@ -18637,10 +18740,25 @@ cp_parser_member_declaration (cp_parser* parser)
/* Check for a using-declaration. */
if (cp_lexer_next_token_is_keyword (parser->lexer, RID_USING))
{
- /* Parse the using-declaration. */
- cp_parser_using_declaration (parser,
- /*access_declaration_p=*/false);
- return;
+ if (cxx_dialect < cxx0x)
+ {
+ /* Parse the using-declaration. */
+ cp_parser_using_declaration (parser,
+ /*access_declaration_p=*/false);
+ return;
+ }
+ else
+ {
+ tree decl;
+ cp_parser_parse_tentatively (parser);
+ decl = cp_parser_alias_declaration (parser);
+ if (cp_parser_parse_definitely (parser))
+ finish_member_declaration (decl);
+ else
+ cp_parser_using_declaration (parser,
+ /*access_declaration_p=*/false);
+ return;
+ }
}
/* Check for @defs. */
@@ -20938,6 +21056,9 @@ cp_parser_template_declaration_after_export (cp_parser* parser, bool member_p)
if (cp_lexer_next_token_is_keyword (parser->lexer,
RID_TEMPLATE))
cp_parser_template_declaration_after_export (parser, member_p);
+ else if (cxx_dialect >= cxx0x
+ && cp_lexer_next_token_is_keyword (parser->lexer, RID_USING))
+ decl = cp_parser_alias_declaration (parser);
else
{
/* There are no access checks when parsing a template, as we do not
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 3196d123ce3..d08a792e2e0 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -814,7 +814,13 @@ maybe_process_partial_specialization (tree type)
context = TYPE_CONTEXT (type);
- if (CLASS_TYPE_P (type) && CLASSTYPE_USE_TEMPLATE (type))
+ if ((CLASS_TYPE_P (type) && CLASSTYPE_USE_TEMPLATE (type))
+ /* Consider non-class instantiations of alias templates as
+ well. */
+ || (TYPE_P (type)
+ && TYPE_TEMPLATE_INFO (type)
+ && DECL_LANG_SPECIFIC (TYPE_NAME (type))
+ && DECL_USE_TEMPLATE (TYPE_NAME (type))))
{
/* This is for ordinary explicit specialization and partial
specialization of a template class such as:
@@ -827,7 +833,8 @@ maybe_process_partial_specialization (tree type)
Make sure that `C<int>' and `C<T*>' are implicit instantiations. */
- if (CLASSTYPE_IMPLICIT_INSTANTIATION (type)
+ if (CLASS_TYPE_P (type)
+ && CLASSTYPE_IMPLICIT_INSTANTIATION (type)
&& !COMPLETE_TYPE_P (type))
{
check_specialization_namespace (CLASSTYPE_TI_TEMPLATE (type));
@@ -839,8 +846,16 @@ maybe_process_partial_specialization (tree type)
return error_mark_node;
}
}
- else if (CLASSTYPE_TEMPLATE_INSTANTIATION (type))
+ else if (CLASS_TYPE_P (type)
+ && CLASSTYPE_TEMPLATE_INSTANTIATION (type))
error ("specialization of %qT after instantiation", type);
+
+ if (DECL_ALIAS_TEMPLATE_P (TYPE_TI_TEMPLATE (type)))
+ {
+ error ("partial specialization of alias template %qD",
+ TYPE_TI_TEMPLATE (type));
+ return error_mark_node;
+ }
}
else if (CLASS_TYPE_P (type)
&& !CLASSTYPE_USE_TEMPLATE (type)
@@ -2842,8 +2857,8 @@ make_ith_pack_parameter_name (tree name, int i)
return get_identifier (newname);
}
-/* Return true if T is a primary function
- or class template instantiation. */
+/* Return true if T is a primary function, class or alias template
+ instantiation. */
bool
primary_template_instantiation_p (const_tree t)
@@ -2858,6 +2873,11 @@ primary_template_instantiation_p (const_tree t)
else if (CLASS_TYPE_P (t))
return CLASSTYPE_TEMPLATE_INSTANTIATION (t)
&& PRIMARY_TEMPLATE_P (CLASSTYPE_TI_TEMPLATE (t));
+ else if (TYPE_P (t)
+ && TYPE_TEMPLATE_INFO (t)
+ && PRIMARY_TEMPLATE_P (TYPE_TI_TEMPLATE (t))
+ && DECL_TEMPLATE_INSTANTIATION (TYPE_NAME (t)))
+ return true;
return false;
}
@@ -4831,6 +4851,10 @@ push_template_decl_real (tree decl, bool is_friend)
else if (DECL_IMPLICIT_TYPEDEF_P (decl)
&& CLASS_TYPE_P (TREE_TYPE (decl)))
/* OK */;
+ else if (TREE_CODE (decl) == TYPE_DECL
+ && TYPE_DECL_ALIAS_P (decl))
+ /* alias-declaration */
+ gcc_assert (!DECL_ARTIFICIAL (decl));
else
{
error ("template declaration of %q#D", decl);
@@ -5095,8 +5119,13 @@ template arguments to %qD do not match original template %qD",
if (DECL_IMPLICIT_TYPEDEF_P (decl))
SET_TYPE_TEMPLATE_INFO (TREE_TYPE (tmpl), info);
- else if (DECL_LANG_SPECIFIC (decl))
- DECL_TEMPLATE_INFO (decl) = info;
+ else
+ {
+ if (primary && !DECL_LANG_SPECIFIC (decl))
+ retrofit_lang_decl (decl);
+ if (DECL_LANG_SPECIFIC (decl))
+ DECL_TEMPLATE_INFO (decl) = info;
+ }
return DECL_TEMPLATE_RESULT (tmpl);
}
@@ -5259,6 +5288,32 @@ fold_non_dependent_expr (tree expr)
return fold_non_dependent_expr_sfinae (expr, tf_error);
}
+/* Return TRUE iff T is a type alias, a TEMPLATE_DECL for an alias
+ template declaration, or a TYPE_DECL for an alias declaration. */
+
+bool
+alias_type_or_template_p (tree t)
+{
+ if (t == NULL_TREE)
+ return false;
+ return ((TREE_CODE (t) == TYPE_DECL && TYPE_DECL_ALIAS_P (t))
+ || (TYPE_P (t)
+ && TYPE_NAME (t)
+ && TYPE_DECL_ALIAS_P (TYPE_NAME (t)))
+ || DECL_ALIAS_TEMPLATE_P (t));
+}
+
+/* Return TRUE iff is a specialization of an alias template. */
+
+bool
+alias_template_specialization_p (tree t)
+{
+ if (t == NULL_TREE)
+ return false;
+ return (primary_template_instantiation_p (t)
+ && DECL_ALIAS_TEMPLATE_P (TYPE_TI_TEMPLATE (t)));
+}
+
/* Subroutine of convert_nontype_argument. Converts EXPR to TYPE, which
must be a function or a pointer-to-function type, as specified
in [temp.arg.nontype]: disambiguate EXPR if it is an overload set,
@@ -7355,7 +7410,31 @@ lookup_template_class_1 (tree d1, tree arglist, tree in_decl, tree context,
ENUM_FIXED_UNDERLYING_TYPE_P (t)
= ENUM_FIXED_UNDERLYING_TYPE_P (template_type);
}
- else
+ else if (DECL_ALIAS_TEMPLATE_P (gen_tmpl))
+ {
+ /* The user referred to a specialization of an alias
+ template represented by GEN_TMPL.
+
+ [temp.alias]/2 says:
+
+ When a template-id refers to the specialization of an
+ alias template, it is equivalent to the associated
+ type obtained by substitution of its
+ template-arguments for the template-parameters in the
+ type-id of the alias template. */
+
+ t = tsubst (TREE_TYPE (gen_tmpl), arglist, complain, in_decl);
+ /* Note that the call above (by indirectly calling
+ register_specialization in tsubst_decl) registers the
+ TYPE_DECL representing the specialization of the alias
+ template. So next time someone substitutes ARGLIST for
+ the template parms into the alias template (GEN_TMPL),
+ she'll get that TYPE_DECL back. */
+
+ if (t == error_mark_node)
+ return t;
+ }
+ else if (CLASS_TYPE_P (template_type))
{
t = make_class_type (TREE_CODE (template_type));
CLASSTYPE_DECLARED_CLASS (t)
@@ -7378,6 +7457,8 @@ lookup_template_class_1 (tree d1, tree arglist, tree in_decl, tree context,
structural equality testing. */
SET_TYPE_STRUCTURAL_EQUALITY (t);
}
+ else
+ gcc_unreachable ();
/* If we called start_enum or pushtag above, this information
will already be set up. */
@@ -7393,14 +7474,17 @@ lookup_template_class_1 (tree d1, tree arglist, tree in_decl, tree context,
else
type_decl = TYPE_NAME (t);
- TREE_PRIVATE (type_decl)
- = TREE_PRIVATE (TYPE_STUB_DECL (template_type));
- TREE_PROTECTED (type_decl)
- = TREE_PROTECTED (TYPE_STUB_DECL (template_type));
- if (CLASSTYPE_VISIBILITY_SPECIFIED (template_type))
+ if (CLASS_TYPE_P (template_type))
{
- DECL_VISIBILITY_SPECIFIED (type_decl) = 1;
- DECL_VISIBILITY (type_decl) = CLASSTYPE_VISIBILITY (template_type);
+ TREE_PRIVATE (type_decl)
+ = TREE_PRIVATE (TYPE_STUB_DECL (template_type));
+ TREE_PROTECTED (type_decl)
+ = TREE_PROTECTED (TYPE_STUB_DECL (template_type));
+ if (CLASSTYPE_VISIBILITY_SPECIFIED (template_type))
+ {
+ DECL_VISIBILITY_SPECIFIED (type_decl) = 1;
+ DECL_VISIBILITY (type_decl) = CLASSTYPE_VISIBILITY (template_type);
+ }
}
/* Let's consider the explicit specialization of a member
@@ -7456,7 +7540,7 @@ lookup_template_class_1 (tree d1, tree arglist, tree in_decl, tree context,
++processing_template_decl;
partial_inst_args =
tsubst (INNERMOST_TEMPLATE_ARGS
- (CLASSTYPE_TI_ARGS (TREE_TYPE (gen_tmpl))),
+ (TYPE_TI_ARGS (TREE_TYPE (gen_tmpl))),
arglist, complain, NULL_TREE);
--processing_template_decl;
TREE_VEC_LENGTH (arglist)++;
@@ -7480,7 +7564,15 @@ lookup_template_class_1 (tree d1, tree arglist, tree in_decl, tree context,
TREE_VEC_LENGTH (arglist)--;
found = tsubst (gen_tmpl, arglist, complain, NULL_TREE);
TREE_VEC_LENGTH (arglist)++;
- found = CLASSTYPE_TI_TEMPLATE (found);
+ /* FOUND is either a proper class type, or an alias
+ template specialization. In the later case, it's a
+ TYPE_DECL, resulting from the substituting of arguments
+ for parameters in the TYPE_DECL of the alias template
+ done earlier. So be careful while getting the template
+ of FOUND. */
+ found = TREE_CODE (found) == TYPE_DECL
+ ? TYPE_TI_TEMPLATE (TREE_TYPE (found))
+ : CLASSTYPE_TI_TEMPLATE (found);
}
SET_TYPE_TEMPLATE_INFO (t, build_template_info (found, arglist));
@@ -7508,7 +7600,7 @@ lookup_template_class_1 (tree d1, tree arglist, tree in_decl, tree context,
the instantiation and exit above. */
tsubst_enum (template_type, t, arglist);
- if (is_dependent_type)
+ if (CLASS_TYPE_P (template_type) && is_dependent_type)
/* If the type makes use of template parameters, the
code that generates debugging information will crash. */
DECL_IGNORED_P (TYPE_STUB_DECL (t)) = 1;
@@ -8600,6 +8692,8 @@ instantiate_class_template_1 (tree type)
{
CLASSTYPE_VISIBILITY_SPECIFIED (type) = 1;
CLASSTYPE_VISIBILITY (type) = CLASSTYPE_VISIBILITY (pattern);
+ /* Adjust visibility for template arguments. */
+ determine_visibility (TYPE_MAIN_DECL (type));
}
CLASSTYPE_FINAL (type) = CLASSTYPE_FINAL (pattern);
@@ -9843,7 +9937,8 @@ tsubst_decl (tree t, tree args, tsubst_flags_t complain)
DECL_TEMPLATE_INFO (r) = build_template_info (t, args);
- if (TREE_CODE (decl) == TYPE_DECL)
+ if (TREE_CODE (decl) == TYPE_DECL
+ && !TYPE_DECL_ALIAS_P (decl))
{
tree new_type;
++processing_template_decl;
@@ -10376,8 +10471,15 @@ tsubst_decl (tree t, tree args, tsubst_flags_t complain)
referencing a static data member within in its own
class. We can use pointer equality, rather than
same_type_p, because DECL_CONTEXT is always
- canonical. */
- if (ctx == DECL_CONTEXT (t))
+ canonical... */
+ if (ctx == DECL_CONTEXT (t)
+ && (TREE_CODE (t) != TYPE_DECL
+ /* ... unless T is a member template; in which
+ case our caller can be willing to create a
+ specialization of that template represented
+ by T. */
+ || !(DECL_TI_TEMPLATE (t)
+ && DECL_MEMBER_TEMPLATE_P (DECL_TI_TEMPLATE (t)))))
spec = t;
}
@@ -10858,7 +10960,7 @@ tree
tsubst (tree t, tree args, tsubst_flags_t complain, tree in_decl)
{
enum tree_code code;
- tree type, r;
+ tree type, r = NULL_TREE;
if (t == NULL_TREE || t == error_mark_node
|| t == integer_type_node
@@ -10890,10 +10992,21 @@ tsubst (tree t, tree args, tsubst_flags_t complain, tree in_decl)
&& typedef_variant_p (t))
{
tree decl = TYPE_NAME (t);
-
- if (DECL_CLASS_SCOPE_P (decl)
- && CLASSTYPE_TEMPLATE_INFO (DECL_CONTEXT (decl))
- && uses_template_parms (DECL_CONTEXT (decl)))
+
+ if (TYPE_DECL_ALIAS_P (decl)
+ && DECL_LANG_SPECIFIC (decl)
+ && DECL_TEMPLATE_INFO (decl)
+ && PRIMARY_TEMPLATE_P (DECL_TI_TEMPLATE (decl)))
+ {
+ /* DECL represents an alias template and we want to
+ instantiate it. Let's substitute our arguments for the
+ template parameters into the declaration and get the
+ resulting type. */
+ r = tsubst (decl, args, complain, decl);
+ }
+ else if (DECL_CLASS_SCOPE_P (decl)
+ && CLASSTYPE_TEMPLATE_INFO (DECL_CONTEXT (decl))
+ && uses_template_parms (DECL_CONTEXT (decl)))
{
tree tmpl = most_general_template (DECL_TI_TEMPLATE (decl));
tree gen_args = tsubst (DECL_TI_ARGS (decl), args, complain, in_decl);
@@ -11043,6 +11156,46 @@ tsubst (tree t, tree args, tsubst_flags_t complain, tree in_decl)
if (argvec == error_mark_node)
return error_mark_node;
+ gcc_assert (TREE_CODE (arg) == TEMPLATE_TEMPLATE_PARM
+ || TREE_CODE (arg) == TEMPLATE_DECL
+ || TREE_CODE (arg) == UNBOUND_CLASS_TEMPLATE);
+
+ if (TREE_CODE (arg) == UNBOUND_CLASS_TEMPLATE)
+ /* Consider this code:
+
+ template <template <class> class Template>
+ struct Internal {
+ template <class Arg> using Bind = Template<Arg>;
+ };
+
+ template <template <class> class Template, class Arg>
+ using Instantiate = Template<Arg>; //#0
+
+ template <template <class> class Template,
+ class Argument>
+ using Bind =
+ Instantiate<Internal<Template>::template Bind,
+ Argument>; //#1
+
+ When #1 is parsed, the
+ BOUND_TEMPLATE_TEMPLATE_PARM representing the
+ parameter `Template' in #0 matches the
+ UNBOUND_CLASS_TEMPLATE representing the argument
+ `Internal<Template>::template Bind'; We then want
+ to assemble the type `Bind<Argument>' that can't
+ be fully created right now, because
+ `Internal<Template>' not being complete, the Bind
+ template cannot be looked up in that context. So
+ we need to "store" `Bind<Argument>' for later
+ when the context of Bind becomes complete. Let's
+ store that in a TYPENAME_TYPE. */
+ return make_typename_type (TYPE_CONTEXT (arg),
+ build_nt (TEMPLATE_ID_EXPR,
+ TYPE_IDENTIFIER (arg),
+ argvec),
+ typename_type,
+ complain);
+
/* We can get a TEMPLATE_TEMPLATE_PARM here when we
are resolving nested-types in the signature of a
member function templates. Otherwise ARG is a
@@ -17630,7 +17783,12 @@ do_type_instantiation (tree t, tree storage, tsubst_flags_t complain)
if (! CLASS_TYPE_P (t) || ! CLASSTYPE_TEMPLATE_INFO (t))
{
- error ("explicit instantiation of non-template type %qT", t);
+ tree tmpl =
+ (TYPE_TEMPLATE_INFO (t)) ? TYPE_TI_TEMPLATE (t) : NULL;
+ if (tmpl)
+ error ("explicit instantiation of non-class template %qD", tmpl);
+ else
+ error ("explicit instantiation of non-template type %qT", t);
return;
}
diff --git a/gcc/cp/search.c b/gcc/cp/search.c
index 5f60eeedf4e..40af661e953 100644
--- a/gcc/cp/search.c
+++ b/gcc/cp/search.c
@@ -427,7 +427,7 @@ lookup_field_1 (tree type, tree name, bool want_type)
field = fields[i--];
while (i >= lo && DECL_NAME (fields[i]) == name);
if (TREE_CODE (field) != TYPE_DECL
- && !DECL_CLASS_TEMPLATE_P (field))
+ && !DECL_TYPE_TEMPLATE_P (field))
field = NULL_TREE;
}
else
@@ -478,7 +478,7 @@ lookup_field_1 (tree type, tree name, bool want_type)
if (DECL_NAME (field) == name
&& (!want_type
|| TREE_CODE (field) == TYPE_DECL
- || DECL_CLASS_TEMPLATE_P (field)))
+ || DECL_TYPE_TEMPLATE_P (field)))
return field;
}
/* Not found. */
@@ -1046,7 +1046,7 @@ lookup_field_r (tree binfo, void *data)
/* If we're looking up a type (as with an elaborated type specifier)
we ignore all non-types we find. */
if (lfi->want_type && TREE_CODE (nval) != TYPE_DECL
- && !DECL_CLASS_TEMPLATE_P (nval))
+ && !DECL_TYPE_TEMPLATE_P (nval))
{
if (lfi->name == TYPE_IDENTIFIER (type))
{
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index 068754a6a53..508e2529fbe 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -2369,7 +2369,7 @@ finish_compound_literal (tree type, tree compound_literal,
&& check_array_initializer (NULL_TREE, type, compound_literal))
return error_mark_node;
compound_literal = reshape_init (type, compound_literal, complain);
- if (cxx_dialect >= cxx0x && SCALAR_TYPE_P (type)
+ if (SCALAR_TYPE_P (type)
&& !BRACE_ENCLOSED_INITIALIZER_P (compound_literal))
check_narrowing (type, compound_literal);
if (TREE_CODE (type) == ARRAY_TYPE
@@ -2733,15 +2733,17 @@ finish_template_decl (tree parms)
tree
finish_template_type (tree name, tree args, int entering_scope)
{
- tree decl;
+ tree type;
- decl = lookup_template_class (name, args,
+ type = lookup_template_class (name, args,
NULL_TREE, NULL_TREE, entering_scope,
tf_warning_or_error | tf_user);
- if (decl != error_mark_node)
- decl = TYPE_STUB_DECL (decl);
-
- return decl;
+ if (type == error_mark_node)
+ return type;
+ else if (CLASS_TYPE_P (type) && !alias_type_or_template_p (type))
+ return TYPE_STUB_DECL (type);
+ else
+ return TYPE_NAME (type);
}
/* Finish processing a BASE_CLASS with the indicated ACCESS_SPECIFIER.
@@ -3286,8 +3288,9 @@ finish_id_expression (tree id_expression,
if (TREE_CODE (first_fn) == TEMPLATE_DECL)
first_fn = DECL_TEMPLATE_RESULT (first_fn);
- if (!really_overloaded_fn (decl))
- mark_used (first_fn);
+ if (!really_overloaded_fn (decl)
+ && !mark_used (first_fn))
+ return error_mark_node;
if (!template_arg_p
&& TREE_CODE (first_fn) == FUNCTION_DECL
@@ -3568,7 +3571,7 @@ finish_offsetof (tree expr)
if (!complete_type_or_else (TREE_TYPE (object), object))
return error_mark_node;
}
- return fold_offsetof (expr, NULL_TREE);
+ return fold_offsetof (expr);
}
/* Replace the AGGR_INIT_EXPR at *TP with an equivalent CALL_EXPR. This
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
index 707f2c8aeba..dc9fc954e41 100644
--- a/gcc/cp/tree.c
+++ b/gcc/cp/tree.c
@@ -1889,6 +1889,10 @@ bot_manip (tree* tp, int* walk_subtrees, void* data)
u = build_target_expr_with_type (TREE_OPERAND (t, 1), TREE_TYPE (t),
tf_warning_or_error);
+ TARGET_EXPR_IMPLICIT_P (u) = TARGET_EXPR_IMPLICIT_P (t);
+ TARGET_EXPR_LIST_INIT_P (u) = TARGET_EXPR_LIST_INIT_P (t);
+ TARGET_EXPR_DIRECT_INIT_P (u) = TARGET_EXPR_DIRECT_INIT_P (t);
+
/* Map the old variable to the new one. */
splay_tree_insert (target_remap,
(splay_tree_key) TREE_OPERAND (t, 0),
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index ec14934a823..386f3b89d48 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -2726,7 +2726,7 @@ build_x_indirect_ref (tree expr, ref_operator errorstring,
/* Helper function called from c-common. */
tree
-build_indirect_ref (location_t loc __attribute__ ((__unused__)),
+build_indirect_ref (location_t loc ATTRIBUTE_UNUSED,
tree ptr, ref_operator errorstring)
{
return cp_build_indirect_ref (ptr, errorstring, tf_warning_or_error);
@@ -4058,7 +4058,7 @@ cp_build_binary_op (location_t location,
else
{
op0 = build_ptrmemfunc_access_expr (op0, pfn_identifier);
- op1 = cp_convert (TREE_TYPE (op0), integer_zero_node);
+ op1 = cp_convert (TREE_TYPE (op0), op1);
}
result_type = TREE_TYPE (op0);
}
@@ -4668,7 +4668,17 @@ cp_truthvalue_conversion (tree expr)
tree type = TREE_TYPE (expr);
if (TYPE_PTRMEM_P (type))
return build_binary_op (EXPR_LOCATION (expr),
- NE_EXPR, expr, integer_zero_node, 1);
+ NE_EXPR, expr, nullptr_node, 1);
+ else if (TYPE_PTR_P (type) || TYPE_PTRMEMFUNC_P (type))
+ {
+ /* With -Wzero-as-null-pointer-constant do not warn for an
+ 'if (p)' or a 'while (!p)', where p is a pointer. */
+ tree ret;
+ ++c_inhibit_evaluation_warnings;
+ ret = c_common_truthvalue_conversion (input_location, expr);
+ --c_inhibit_evaluation_warnings;
+ return ret;
+ }
else
return c_common_truthvalue_conversion (input_location, expr);
}
@@ -4871,9 +4881,7 @@ cp_build_addr_expr_1 (tree arg, bool strict_lvalue, tsubst_flags_t complain)
&& TREE_CONSTANT (TREE_OPERAND (val, 0)))
{
tree type = build_pointer_type (argtype);
- tree op0 = fold_convert (type, TREE_OPERAND (val, 0));
- tree op1 = fold_offsetof (arg, val);
- return fold_build_pointer_plus (op0, op1);
+ return fold_convert (type, fold_offsetof_1 (arg));
}
/* Handle complex lvalues (when permitted)
@@ -6335,34 +6343,41 @@ build_const_cast_1 (tree dst_type, tree expr, tsubst_flags_t complain,
return error_mark_node;
}
- if ((TYPE_PTR_P (src_type) || TYPE_PTRMEM_P (src_type))
- && comp_ptr_ttypes_const (dst_type, src_type))
+ if (TYPE_PTR_P (src_type) || TYPE_PTRMEM_P (src_type))
{
- if (valid_p)
- {
- *valid_p = true;
- /* This cast is actually a C-style cast. Issue a warning if
- the user is making a potentially unsafe cast. */
- check_for_casting_away_constness (src_type, dst_type, CAST_EXPR,
- complain);
- }
- if (reference_type)
- {
- expr = cp_build_addr_expr (expr, complain);
- expr = build_nop (reference_type, expr);
- return convert_from_reference (expr);
- }
- else
+ if (comp_ptr_ttypes_const (dst_type, src_type))
{
- expr = decay_conversion (expr);
- /* build_c_cast puts on a NOP_EXPR to make the result not an
- lvalue. Strip such NOP_EXPRs if VALUE is being used in
- non-lvalue context. */
- if (TREE_CODE (expr) == NOP_EXPR
- && TREE_TYPE (expr) == TREE_TYPE (TREE_OPERAND (expr, 0)))
- expr = TREE_OPERAND (expr, 0);
- return build_nop (dst_type, expr);
+ if (valid_p)
+ {
+ *valid_p = true;
+ /* This cast is actually a C-style cast. Issue a warning if
+ the user is making a potentially unsafe cast. */
+ check_for_casting_away_constness (src_type, dst_type,
+ CAST_EXPR, complain);
+ }
+ if (reference_type)
+ {
+ expr = cp_build_addr_expr (expr, complain);
+ expr = build_nop (reference_type, expr);
+ return convert_from_reference (expr);
+ }
+ else
+ {
+ expr = decay_conversion (expr);
+ /* build_c_cast puts on a NOP_EXPR to make the result not an
+ lvalue. Strip such NOP_EXPRs if VALUE is being used in
+ non-lvalue context. */
+ if (TREE_CODE (expr) == NOP_EXPR
+ && TREE_TYPE (expr) == TREE_TYPE (TREE_OPERAND (expr, 0)))
+ expr = TREE_OPERAND (expr, 0);
+ return build_nop (dst_type, expr);
+ }
}
+ else if (valid_p
+ && !at_least_as_qualified_p (TREE_TYPE (dst_type),
+ TREE_TYPE (src_type)))
+ check_for_casting_away_constness (src_type, dst_type, CAST_EXPR,
+ complain);
}
if (complain & tf_error)
@@ -7148,7 +7163,7 @@ build_ptrmemfunc (tree type, tree pfn, int force, bool c_cast_p,
/* Handle null pointer to member function conversions. */
if (null_ptr_cst_p (pfn))
{
- pfn = build_c_cast (input_location, type, integer_zero_node);
+ pfn = build_c_cast (input_location, type, nullptr_node);
return build_ptrmemfunc1 (to_type,
integer_zero_node,
pfn);
@@ -7544,8 +7559,7 @@ convert_for_initialization (tree exp, tree type, tree rhs, int flags,
if (fndecl)
savew = warningcount, savee = errorcount;
- rhs = initialize_reference (type, rhs, /*decl=*/NULL_TREE,
- /*cleanup=*/NULL, flags, complain);
+ rhs = initialize_reference (type, rhs, flags, complain);
if (fndecl)
{
if (warningcount > savew)
diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c
index 57cd5e01d8c..70edc2f5a4d 100644
--- a/gcc/cp/typeck2.c
+++ b/gcc/cp/typeck2.c
@@ -655,7 +655,7 @@ split_nonconstant_init (tree dest, tree init)
for static variable. In that case, caller must emit the code. */
tree
-store_init_value (tree decl, tree init, int flags)
+store_init_value (tree decl, tree init, VEC(tree,gc)** cleanups, int flags)
{
tree value, type;
@@ -699,6 +699,8 @@ store_init_value (tree decl, tree init, int flags)
/* Digest the specified initializer into an expression. */
value = digest_init_flags (type, init, flags);
+ value = extend_ref_init_temps (decl, value, cleanups);
+
/* In C++0x constant expression is a semantic, not syntactic, property.
In C++98, make sure that what we thought was a constant expression at
template definition time is still constant. */
@@ -725,7 +727,16 @@ store_init_value (tree decl, tree init, int flags)
if (value != error_mark_node
&& (TREE_SIDE_EFFECTS (value)
|| ! initializer_constant_valid_p (value, TREE_TYPE (value))))
- return split_nonconstant_init (decl, value);
+ {
+ if (TREE_CODE (type) == ARRAY_TYPE
+ && TYPE_HAS_NONTRIVIAL_DESTRUCTOR (TREE_TYPE (type)))
+ /* For an array, we only need/want a single cleanup region rather
+ than one per element. */
+ return build_vec_init (decl, NULL_TREE, value, false, 1,
+ tf_warning_or_error);
+ else
+ return split_nonconstant_init (decl, value);
+ }
/* 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
dynamic initialization later. */
@@ -804,8 +815,16 @@ check_narrowing (tree type, tree init)
}
if (!ok)
- pedwarn (input_location, OPT_Wnarrowing, "narrowing conversion of %qE "
- "from %qT to %qT inside { }", init, ftype, type);
+ {
+ if (cxx_dialect >= cxx0x)
+ pedwarn (EXPR_LOC_OR_HERE (init), OPT_Wnarrowing,
+ "narrowing conversion of %qE from %qT to %qT inside { }",
+ init, ftype, type);
+ else
+ warning_at (EXPR_LOC_OR_HERE (init), OPT_Wnarrowing,
+ "narrowing conversion of %qE from %qT to %qT inside { } "
+ "is ill-formed in C++11", init, ftype, type);
+ }
}
/* Process the initializer INIT for a variable of type TYPE, emitting
@@ -902,7 +921,7 @@ digest_init_r (tree type, tree init, bool nested, int flags,
{
tree *exp;
- if (cxx_dialect != cxx98 && nested)
+ if (nested)
check_narrowing (type, init);
init = convert_for_initialization (0, type, init, flags,
ICR_INIT, NULL_TREE, 0,
diff --git a/gcc/cppbuiltin.c b/gcc/cppbuiltin.c
index cf7d2ff12fd..05d82f5df49 100644
--- a/gcc/cppbuiltin.c
+++ b/gcc/cppbuiltin.c
@@ -66,6 +66,12 @@ define__GNUC__ (cpp_reader *pfile)
cpp_define_formatted (pfile, "__GNUC_MINOR__=%d", minor);
cpp_define_formatted (pfile, "__GNUC_PATCHLEVEL__=%d", patchlevel);
cpp_define_formatted (pfile, "__VERSION__=\"%s\"", version_string);
+ cpp_define_formatted (pfile, "__ATOMIC_RELAXED=%d", MEMMODEL_RELAXED);
+ cpp_define_formatted (pfile, "__ATOMIC_SEQ_CST=%d", MEMMODEL_SEQ_CST);
+ cpp_define_formatted (pfile, "__ATOMIC_ACQUIRE=%d", MEMMODEL_ACQUIRE);
+ cpp_define_formatted (pfile, "__ATOMIC_RELEASE=%d", MEMMODEL_RELEASE);
+ cpp_define_formatted (pfile, "__ATOMIC_ACQ_REL=%d", MEMMODEL_ACQ_REL);
+ cpp_define_formatted (pfile, "__ATOMIC_CONSUME=%d", MEMMODEL_CONSUME);
}
diff --git a/gcc/cprop.c b/gcc/cprop.c
index 584ffd202ba..d90f769e546 100644
--- a/gcc/cprop.c
+++ b/gcc/cprop.c
@@ -712,8 +712,8 @@ find_used_regs (rtx *xptr, void *data ATTRIBUTE_UNUSED)
}
}
-/* Try to replace all non-SET_DEST occurrences of FROM in INSN with TO.
- Returns nonzero is successful. */
+/* Try to replace all uses of FROM in INSN with TO.
+ Return nonzero if successful. */
static int
try_replace_reg (rtx from, rtx to, rtx insn)
@@ -764,6 +764,18 @@ try_replace_reg (rtx from, rtx to, rtx insn)
note = set_unique_reg_note (insn, REG_EQUAL, copy_rtx (src));
}
+ if (set && MEM_P (SET_DEST (set)) && reg_mentioned_p (from, SET_DEST (set)))
+ {
+ /* Registers can also appear as uses in SET_DEST if it is a MEM.
+ We could perhaps try this for multiple SETs, but it probably
+ won't buy us anything. */
+ rtx dest = simplify_replace_rtx (SET_DEST (set), from, to);
+
+ if (!rtx_equal_p (dest, SET_DEST (set))
+ && validate_change (insn, &SET_DEST (set), dest, 0))
+ success = 1;
+ }
+
/* REG_EQUAL may get simplified into register.
We don't allow that. Remove that note. This code ought
not to happen, because previous code ought to synthesize
diff --git a/gcc/doc/contrib.texi b/gcc/doc/contrib.texi
index 939f6dea1dd..f76cce8d234 100644
--- a/gcc/doc/contrib.texi
+++ b/gcc/doc/contrib.texi
@@ -746,7 +746,7 @@ Volker Reichelt for keeping up with the problem reports.
@item
Joern Rennecke for maintaining the sh port, loop, regmove & reload
-hacking.
+hacking and developing and maintaining the Epiphany port.
@item
Loren J. Rittle for improvements to libstdc++-v3 including the FreeBSD
diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
index 7c773882423..c7e8ede9cb0 100644
--- a/gcc/doc/extend.texi
+++ b/gcc/doc/extend.texi
@@ -79,7 +79,8 @@ extensions, accepted by GCC in C90 mode and in C++.
* Return Address:: Getting the return or frame address of a function.
* Vector Extensions:: Using vector instructions through built-in functions.
* Offsetof:: Special syntax for implementing @code{offsetof}.
-* Atomic Builtins:: Built-in functions for atomic memory access.
+* __sync Builtins:: Legacy built-in functions for atomic memory access.
+* __atomic Builtins:: Atomic built-in functions with memory model.
* Object Size Checking:: Built-in functions for limited buffer overflow
checking.
* Other Builtins:: Other built-in functions.
@@ -2192,7 +2193,7 @@ types (@pxref{Variable Attributes}, @pxref{Type Attributes}.)
@item disinterrupt
@cindex @code{disinterrupt} attribute
-On MeP targets, this attribute causes the compiler to emit
+On Epiphany and MeP targets, this attribute causes the compiler to emit
instructions to disable interrupts for the duration of the given
function.
@@ -2551,7 +2552,7 @@ This attribute is ignored for R8C target.
@item interrupt
@cindex interrupt handler functions
-Use this attribute on the ARM, AVR, M32C, M32R/D, m68k, MeP, MIPS,
+Use this attribute on the ARM, AVR, Epiphany, M32C, M32R/D, m68k, MeP, MIPS,
RX and Xstormy16 ports to indicate that the specified function is an
interrupt handler. The compiler will generate function entry and exit
sequences suitable for use in an interrupt handler when this attribute
@@ -2723,7 +2724,8 @@ attribute is not allowed on types to annotate indirect calls.
@item long_call/short_call
@cindex indirect calls on ARM
This attribute specifies how a particular function is called on
-ARM@. Both attributes override the @option{-mlong-calls} (@pxref{ARM Options})
+ARM and Epiphany. Both attributes override the
+@option{-mlong-calls} (@pxref{ARM Options})
command-line switch and @code{#pragma long_calls} settings. The
@code{long_call} attribute indicates that the function might be far
away from the call site and require a different (more expensive)
@@ -6682,8 +6684,8 @@ is a suitable definition of the @code{offsetof} macro. In C++, @var{type}
may be dependent. In either case, @var{member} may consist of a single
identifier, or a sequence of member accesses and array references.
-@node Atomic Builtins
-@section Built-in functions for atomic memory access
+@node __sync Builtins
+@section Legacy __sync built-in functions for atomic memory access
The following builtins are intended to be compatible with those described
in the @cite{Intel Itanium Processor-specific Application Binary Interface},
@@ -6815,6 +6817,232 @@ previous memory loads have been satisfied, but following memory reads
are not prevented from being speculated to before the barrier.
@end table
+@node __atomic Builtins
+@section Built-in functions for memory model aware atomic operations
+
+The following built-in functions approximately match the requirements for
+C++11 memory model. Many are similar to the @samp{__sync} prefixed built-in
+functions, but all also have a memory model parameter. These are all
+identified by being prefixed with @samp{__atomic}, and most are overloaded
+such that they work with multiple types.
+
+GCC will allow any integral scalar or pointer type that is 1, 2, 4, or 8
+bytes in length. 16-byte integral types are also allowed if
+@samp{__int128} (@pxref{__int128}) is supported by the architecture.
+
+Target architectures are encouraged to provide their own patterns for
+each of these built-in functions. If no target is provided, the original
+non-memory model set of @samp{__sync} atomic built-in functions will be
+utilized, along with any required synchronization fences surrounding it in
+order to achieve the proper behaviour. Execution in this case is subject
+to the same restrictions as those built-in functions.
+
+If there is no pattern or mechanism to provide a lock free instruction
+sequence, a call is made to an external routine with the same parameters
+to be resolved at runtime.
+
+The four non-arithmetic functions (load, store, exchange, and
+compare_exchange) all have a generic version as well. This generic
+version will work on any data type. If the data type size maps to one
+of the integral sizes which may have lock free support, the generic
+version will utilize the lock free built-in function. Otherwise an
+external call is left to be resolved at runtime. This external call will
+be the same format with the addition of a @samp{size_t} parameter inserted
+as the first parameter indicating the size of the object being pointed to.
+All objects must be the same size.
+
+There are 6 different memory models which can be specified. These map
+to the same names in the C++11 standard. Refer there or to the
+@uref{http://gcc.gnu.org/wiki/Atomic/GCCMM/AtomicSync,GCC wiki on
+atomic synchronization} for more detailed definitions. These memory
+models integrate both barriers to code motion as well as synchronization
+requirements with other threads. These are listed in approximately
+ascending order of strength.
+
+@table @code
+@item __ATOMIC_RELAXED
+No barriers or synchronization.
+@item __ATOMIC_CONSUME
+Data dependency only for both barrier and synchronization with another
+thread.
+@item __ATOMIC_ACQUIRE
+Barrier to hoisting of code and synchronizes with release (or stronger)
+semantic stores from another thread.
+@item __ATOMIC_RELEASE
+Barrier to sinking of code and synchronizes with acquire (or stronger)
+semantic loads from another thread.
+@item __ATOMIC_ACQ_REL
+Full barrier in both directions and synchronizes with acquire loads and
+release stores in another thread.
+@item __ATOMIC_SEQ_CST
+Full barrier in both directions and synchronizes with acquire loads and
+release stores in all threads.
+@end table
+
+When implementing patterns for these built-in functions , the memory model
+parameter can be ignored as long as the pattern implements the most
+restrictive @code{__ATOMIC_SEQ_CST} model. Any of the other memory models
+will execute correctly with this memory model but they may not execute as
+efficiently as they could with a more appropriate implemention of the
+relaxed requirements.
+
+Note that the C++11 standard allows for the memory model parameter to be
+determined at runtime rather than at compile time. These built-in
+functions will map any runtime value to @code{__ATOMIC_SEQ_CST} rather
+than invoke a runtime library call or inline a switch statement. This is
+standard compliant, safe, and the simplest approach for now.
+
+@deftypefn {Built-in Function} @var{type} __atomic_load_n (@var{type} *ptr, int memmodel)
+This built-in function implements an atomic load operation. It returns the
+contents of @code{*@var{ptr}}.
+
+The valid memory model variants are
+@code{__ATOMIC_RELAXED}, @code{__ATOMIC_SEQ_CST}, @code{__ATOMIC_ACQUIRE},
+and @code{__ATOMIC_CONSUME}.
+
+@end deftypefn
+
+@deftypefn {Built-in Function} void __atomic_load (@var{type} *ptr, @var{type} *ret, int memmodel)
+This is the generic version of an atomic load. It will return the
+contents of @code{*@var{ptr}} in @code{*@var{ret}}.
+
+@end deftypefn
+
+@deftypefn {Built-in Function} void __atomic_store_n (@var{type} *ptr, @var{type} val, int memmodel)
+This built-in function implements an atomic store operation. It writes
+@code{@var{val}} into @code{*@var{ptr}}.
+
+The valid memory model variants are
+@code{__ATOMIC_RELAXED}, @code{__ATOMIC_SEQ_CST}, and @code{__ATOMIC_RELEASE}.
+
+@end deftypefn
+
+@deftypefn {Built-in Function} void __atomic_store (@var{type} *ptr, @var{type} *val, int memmodel)
+This is the generic version of an atomic store. It will store the value
+of @code{*@var{val}} into @code{*@var{ptr}}.
+
+@end deftypefn
+
+@deftypefn {Built-in Function} @var{type} __atomic_exchange_n (@var{type} *ptr, @var{type} val, int memmodel)
+This built-in function implements an atomic exchange operation. It writes
+@var{val} into @code{*@var{ptr}}, and returns the previous contents of
+@code{*@var{ptr}}.
+
+The valid memory model variants are
+@code{__ATOMIC_RELAXED}, @code{__ATOMIC_SEQ_CST}, @code{__ATOMIC_ACQUIRE},
+@code{__ATOMIC_RELEASE}, and @code{__ATOMIC_ACQ_REL}.
+
+@end deftypefn
+
+@deftypefn {Built-in Function} void __atomic_exchange (@var{type} *ptr, @var{type} *val, @var{type} *ret, int memmodel)
+This is the generic version of an atomic exchange. It will store the
+contents of @code{*@var{val}} into @code{*@var{ptr}}. The original value
+of @code{*@var{ptr}} will be copied into @code{*@var{ret}}.
+
+@end deftypefn
+
+@deftypefn {Built-in Function} bool __atomic_compare_exchange_n (@var{type} *ptr, @var{type} *expected, @var{type} desired, bool weak, int success_memmodel, int failure_memmodel)
+This built-in function implements an atomic compare and exchange operation.
+This compares the contents of @code{*@var{ptr}} with the contents of
+@code{*@var{expected}} and if equal, writes @var{desired} into
+@code{*@var{ptr}}. If they are not equal, the current contents of
+@code{*@var{ptr}} is written into @code{*@var{expected}}.
+
+True is returned if @code{*@var{desired}} is written into
+@code{*@var{ptr}} and the execution is considered to conform to the
+memory model specified by @var{success_memmodel}. There are no
+restrictions on what memory model can be used here.
+
+False is returned otherwise, and the execution is considered to conform
+to @var{failure_memmodel}. This memory model cannot be
+@code{__ATOMIC_RELEASE} nor @code{__ATOMIC_ACQ_REL}. It also cannot be a
+stronger model than that specified by @var{success_memmodel}.
+
+@end deftypefn
+
+@deftypefn {Built-in Function} bool __atomic_compare_exchange (@var{type} *ptr, @var{type} *expected, @var{type} *desired, bool weak, int success_memmodel, int failure_memmodel)
+This built-in function implements the generic version of
+@code{__atomic_compare_exchange}. The function is virtually identical to
+@code{__atomic_compare_exchange_n}, except the desired value is also a
+pointer.
+
+@end deftypefn
+
+@deftypefn {Built-in Function} @var{type} __atomic_add_fetch (@var{type} *ptr, @var{type} val, int memmodel)
+@deftypefnx {Built-in Function} @var{type} __atomic_sub_fetch (@var{type} *ptr, @var{type} val, int memmodel)
+@deftypefnx {Built-in Function} @var{type} __atomic_and_fetch (@var{type} *ptr, @var{type} val, int memmodel)
+@deftypefnx {Built-in Function} @var{type} __atomic_xor_fetch (@var{type} *ptr, @var{type} val, int memmodel)
+@deftypefnx {Built-in Function} @var{type} __atomic_or_fetch (@var{type} *ptr, @var{type} val, int memmodel)
+@deftypefnx {Built-in Function} @var{type} __atomic_nand_fetch (@var{type} *ptr, @var{type} val, int memmodel)
+These built-in functions perform the operation suggested by the name, and
+return the result of the operation. That is,
+
+@smallexample
+@{ *ptr @var{op}= val; return *ptr; @}
+@end smallexample
+
+All memory models are valid.
+
+@end deftypefn
+
+@deftypefn {Built-in Function} @var{type} __atomic_fetch_add (@var{type} *ptr, @var{type} val, int memmodel)
+@deftypefnx {Built-in Function} @var{type} __atomic_fetch_sub (@var{type} *ptr, @var{type} val, int memmodel)
+@deftypefnx {Built-in Function} @var{type} __atomic_fetch_and (@var{type} *ptr, @var{type} val, int memmodel)
+@deftypefnx {Built-in Function} @var{type} __atomic_fetch_xor (@var{type} *ptr, @var{type} val, int memmodel)
+@deftypefnx {Built-in Function} @var{type} __atomic_fetch_or (@var{type} *ptr, @var{type} val, int memmodel)
+@deftypefnx {Built-in Function} @var{type} __atomic_fetch_nand (@var{type} *ptr, @var{type} val, int memmodel)
+These built-in functions perform the operation suggested by the name, and
+return the value that had previously been in @code{*@var{ptr}}. That is,
+
+@smallexample
+@{ tmp = *ptr; *ptr @var{op}= val; return tmp; @}
+@end smallexample
+
+All memory models are valid.
+
+@end deftypefn
+
+@deftypefn {Built-in Function} void __atomic_thread_fence (int memmodel)
+
+This built-in function acts as a synchronization fence between threads
+based on the specified memory model.
+
+All memory orders are valid.
+
+@end deftypefn
+
+@deftypefn {Built-in Function} void __atomic_signal_fence (int memmodel)
+
+This built-in function acts as a synchronization fence between a thread
+and signal handlers based in the same thread.
+
+All memory orders are valid.
+
+@end deftypefn
+
+@deftypefn {Built-in Function} bool __atomic_always_lock_free (size_t size)
+
+This built-in function returns true if objects of size bytes will always
+generate lock free atomic instructions for the target architecture.
+Otherwise false is returned.
+
+size must resolve to a compile time constant.
+
+@smallexample
+if (_atomic_always_lock_free (sizeof (long long)))
+@end smallexample
+
+@end deftypefn
+
+@deftypefn {Built-in Function} bool __atomic_is_lock_free (size_t size)
+
+This built-in function returns true if objects of size bytes will always
+generate lock free atomic instructions for the target architecture. If
+it is not known to be lock free a call is made to a runtime routine named
+@code{__atomic_is_lock_free}.
+
+@end deftypefn
+
@node Object Size Checking
@section Object Size Checking Builtins
@findex __builtin_object_size
diff --git a/gcc/doc/install.texi b/gcc/doc/install.texi
index 730f82baff8..643ba7208e6 100644
--- a/gcc/doc/install.texi
+++ b/gcc/doc/install.texi
@@ -1208,6 +1208,11 @@ of the arguments depend on the target.
Specify if the compiler should default to @option{-marm} or @option{-mthumb}.
This option is only supported on ARM targets.
+@item --with-stack-offset=@var{num}
+This option sets the default for the -mstack-offset=@var{num} option,
+and will thus generally also control the setting of this option for
+libraries. This option is only supported on Epiphany targets.
+
@item --with-fpmath=@var{isa}
This options sets @option{-mfpmath=sse} by default and specifies the default
ISA for floating-point arithmetics. You can select either @samp{sse} which
@@ -3315,6 +3320,13 @@ and includes all the necessary compilation tools and libraries.
@html
<hr />
@end html
+@heading @anchor{epiphany-x-elf}epiphany-*-elf
+Adapteva Epiphany.
+This configuration is intended for embedded systems.
+
+@html
+<hr />
+@end html
@heading @anchor{x-x-freebsd}*-*-freebsd*
Support for FreeBSD 1 was discontinued in GCC 3.2. Support for
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 47b49bf5c6b..3a5a3414cd9 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -458,6 +458,14 @@ Objective-C and Objective-C++ Dialects}.
@c Try and put the significant identifier (CPU or system) first,
@c so users have a clue at guessing where the ones they want will be.
+@emph{Adapteva Epiphany Options}
+@gccoptlist{-mhalf-reg-file -mprefer-short-insn-regs @gol
+-mbranch-cost=@var{num} -mcmove -mnops=@var{num} -msoft-cmpsf @gol
+-msplit-lohi -mpost-inc -mpost-modify -mstack-offset=@var{num} @gol
+-mround-nearest -mlong-calls -mshort-calls -msmall16 @gol
+-mfp-mode=@var{mode} -mvect-double -max-vect-align=@var{num} @gol
+-msplit-vecmove-early -m1reg-@var{reg}}
+
@emph{ARM Options}
@gccoptlist{-mapcs-frame -mno-apcs-frame @gol
-mabi=@var{name} @gol
@@ -2376,17 +2384,22 @@ an instance of a derived class through a pointer to a base class if the
base class does not have a virtual destructor. This warning is enabled
by @option{-Wall}.
-@item -Wno-narrowing @r{(C++ and Objective-C++ only)}
+@item -Wnarrowing @r{(C++ and Objective-C++ only)}
@opindex Wnarrowing
@opindex Wno-narrowing
-With -std=c++11, suppress the diagnostic required by the standard for
-narrowing conversions within @samp{@{ @}}, e.g.
+Warn when a narrowing conversion prohibited by C++11 occurs within
+@samp{@{ @}}, e.g.
@smallexample
int i = @{ 2.2 @}; // error: narrowing from double to int
@end smallexample
-This flag can be useful for compiling valid C++98 code in C++11 mode.
+This flag is included in @option{-Wall} and @option{-Wc++11-compat}.
+
+With -std=c++11, @option{-Wno-narrowing} suppresses the diagnostic
+required by the standard. Note that this does not affect the meaning
+of well-formed code; narrowing conversions are still considered
+ill-formed in SFINAE context.
@item -Wnoexcept @r{(C++ and Objective-C++ only)}
@opindex Wnoexcept
@@ -4075,9 +4088,10 @@ ISO C and ISO C++, e.g.@: request for implicit conversion from
@code{void *} to a pointer to non-@code{void} type.
@item -Wc++11-compat @r{(C++ and Objective-C++ only)}
-Warn about C++ constructs whose meaning differs between ISO C++ 1998 and
-ISO C++ 2011, e.g., identifiers in ISO C++ 1998 that will become keywords
-in ISO C++ 2011. This warning is enabled by @option{-Wall}.
+Warn about C++ constructs whose meaning differs between ISO C++ 1998
+and ISO C++ 2011, e.g., identifiers in ISO C++ 1998 that are keywords
+in ISO C++ 2011. This warning turns on @option{-Wnarrowing} and is
+enabled by @option{-Wall}.
@item -Wcast-qual
@opindex Wcast-qual
@@ -4155,6 +4169,12 @@ unsigned integers are disabled by default in C++ unless
Do not warn for conversions between @code{NULL} and non-pointer
types. @option{-Wconversion-null} is enabled by default.
+@item -Wzero-as-null-pointer-constant @r{(C++ and Objective-C++ only)}
+@opindex Wzero-as-null-pointer-constant
+@opindex Wno-zero-as-null-pointer-constant
+Warn when a literal '0' is used as null pointer constant. This can
+be useful to facilitate the conversion to @code{nullptr} in C++11.
+
@item -Wempty-body
@opindex Wempty-body
@opindex Wno-empty-body
@@ -9163,11 +9183,26 @@ The maximum number of conditional stores paires that can be sunk. Set to 0
if either vectorization (@option{-ftree-vectorize}) or if-conversion
(@option{-ftree-loop-if-convert}) is disabled. The default is 2.
+@item allow-load-data-races
+Allow optimizers to introduce new data races on loads.
+Set to 1 to allow, otherwise to 0. This option is enabled by default
+unless implicitly set by the @option{-fmemory-model=} option.
+
@item allow-store-data-races
Allow optimizers to introduce new data races on stores.
Set to 1 to allow, otherwise to 0. This option is enabled by default
unless implicitly set by the @option{-fmemory-model=} option.
+@item allow-packed-load-data-races
+Allow optimizers to introduce new data races on packed data loads.
+Set to 1 to allow, otherwise to 0. This option is enabled by default
+unless implicitly set by the @option{-fmemory-model=} option.
+
+@item allow-packed-store-data-races
+Allow optimizers to introduce new data races on packed data stores.
+Set to 1 to allow, otherwise to 0. This option is enabled by default
+unless implicitly set by the @option{-fmemory-model=} option.
+
@item case-values-threshold
The smallest number of different values for which it is best to use a
jump-table instead of a tree of conditional branches. If the value is
@@ -10234,6 +10269,7 @@ platform.
@c in Machine Dependent Options
@menu
+* Adapteva Epiphany Options::
* ARM Options::
* AVR Options::
* Blackfin Options::
@@ -10282,6 +10318,161 @@ platform.
* zSeries Options::
@end menu
+@node Adapteva Epiphany Options
+@subsection Adapteva Epiphany Options
+
+These @samp{-m} options are defined for Adapteva Epiphany:
+
+@table @gcctabopt
+@item -mhalf-reg-file
+@opindex mhalf-reg-file
+Don't allocate any register in the range @code{r32}@dots{}@code{r63}.
+That allows code to run on hardware variants that lack these registers.
+
+@item -mprefer-short-insn-regs
+@opindex mprefer-short-insn-regs
+Preferrentially allocate registers that allow short instruction generation.
+This can result in increasesd instruction count, so if this reduces or
+increases code size might vary from case to case.
+
+@item -mbranch-cost=@var{num}
+@opindex mbranch-cost
+Set the cost of branches to roughly @var{num} ``simple'' instructions.
+This cost is only a heuristic and is not guaranteed to produce
+consistent results across releases.
+
+@item -mcmove
+@opindex mcmove
+Enable the generation of conditional moves.
+
+@item -mnops=@var{num}
+@opindex mnops
+Emit @var{num} nops before every other generated instruction.
+
+@item -mno-soft-cmpsf
+@opindex mno-soft-cmpsf
+For single-precision floating point comparisons, emit an fsub instruction
+and test the flags. This is faster than a software comparison, but can
+get incorrect results in the presence of NaNs, or when two different small
+numbers are compared such that their difference is calculated as zero.
+The default is @option{-msoft-cmpsf}, which uses slower, but IEEE-compliant,
+software comparisons.
+
+@item -mstack-offset=@var{num}
+@opindex mstack-offset
+Set the offset between the top of the stack and the stack pointer.
+E.g., a value of 8 means that the eight bytes in the range sp+0@dots{}sp+7
+can be used by leaf functions without stack allocation.
+Values other than @samp{8} or @samp{16} are untested and unlikely to work.
+Note also that this option changes the ABI, compiling a program with a
+different stack offset than the libraries have been compiled with
+will generally not work.
+This option can be useful if you want to evaluate if a different stack
+offset would give you better code, but to actually use a different stack
+offset to build working programs, it is recommended to configure the
+toolchain with the appropriate @samp{--with-stack-offset=@var{num}} option.
+
+@item -mno-round-nearest
+@opindex mno-round-nearest
+Make the scheduler assume that the rounding mode has been set to
+truncating. The default is @option{-mround-nearest}.
+
+@item -mlong-calls
+@opindex mlong-calls
+If not otherwise specified by an attribute, assume all calls might be beyond
+the offset range of the b / bl instructions, and therefore load the
+function address into a register before performing a (otherwise direct) call.
+This is the default.
+
+@item -mshort-calls
+@opindex short-calls
+If not otherwise specified by an attribute, assume all direct calls are
+in the range of the b / bl instructions, so use these instructions
+for direct calls. The default is @option{-mlong-calls}.
+
+@item -msmall16
+@opindex msmall16
+Assume addresses can be loaded as 16 bit unsigned values. This does not
+apply to function addresses for which @option{-mlong-calls} semantics
+are in effect.
+
+@item -mfp-mode=@var{mode}
+@opindex mfp-mode
+Set the prevailing mode of the floating point unit.
+This determines the floating point mode that is provided and expected
+at function call and return time. Making this mode match the mode you
+predominantly need at function start can make your programs smaller and
+faster by avoiding unnecessary mode switches.
+
+@var{mode} can be set to one the following values:
+
+@table @samp
+@item caller
+Any mode at function entry is valid, and retained or restored when
+the function returns, and when it calls other functions.
+This mode is useful for compiling libraries or other compilation units
+you might want to incorporate into different programs with different
+prevailing FPU modes, and the convenience of being able to use a single
+object file outweighs the size and speed overhead for any extra
+mode switching that might be needed, compared with what would be needed
+with a more specific choice of prevailing FPU mode.
+
+@item truncate
+This is the mode used for floating point calculations with
+truncating (i.e.@: round towards zero) rounding mode. That includes
+conversion from floating point to integer.
+
+@item round-nearest
+This is the mode used for floating point calculations with
+round-to-nearest-or-even rounding mode.
+
+@item int
+This is the mode used to perform integer calculations in the FPU, e.g.@:
+integer multiply, or integer multiply-and-accumulate.
+@end table
+
+The default is @option{-mfp-mode=caller}
+
+@item -mnosplit-lohi
+@opindex mnosplit-lohi
+@item -mno-postinc
+@opindex mno-postinc
+@item -mno-postmodify
+@opindex mno-postmodify
+Code generation tweaks that disable, respectively, splitting of 32
+bit loads, generation of post-increment addresses, and generation of
+post-modify addresses. The defaults are @option{msplit-lohi},
+@option{-mpost-inc}, and @option{-mpost-modify}.
+
+@item -mnovect-double
+@opindex mno-vect-double
+Change the preferred SIMD mode to SImode. The default is
+@option{-mvect-double}, which uses DImode as preferred SIMD mode.
+
+@item -max-vect-align=@var{num}
+@opindex max-vect-align
+The maximum alignment for SIMD vector mode types.
+@var{num} may be 4 or 8. The default is 8.
+Note that this is an ABI change, even though many library function
+interfaces will be unaffected, if they don't use SIMD vector modes
+in places where they affect size and/or alignment of relevant types.
+
+@item -msplit-vecmove-early
+@opindex msplit-vecmove-early
+Split vector moves into single word moves before reload. In theory this
+could give better register allocation, but so far the reverse seems to be
+generally the case.
+
+@item -m1reg-@var{reg}
+@opindex m1reg-
+Specify a register to hold the constant @minus{}1, which makes loading small negative
+constants and certain bitmasks faster.
+Allowable values for reg are r43 and r63, which specify to use that register
+as a fixed register, and none, which means that no register is used for this
+purpose. The default is @option{-m1reg-none}.
+
+@end table
+
@node ARM Options
@subsection ARM Options
@cindex ARM options
@@ -13024,7 +13215,8 @@ This option will enable GCC to use CMPXCHG16B instruction in generated code.
CMPXCHG16B allows for atomic operations on 128-bit double quadword (or oword)
data types. This is useful for high resolution counters that could be updated
by multiple processors (or cores). This instruction is generated as part of
-atomic built-in functions: see @ref{Atomic Builtins} for details.
+atomic built-in functions: see @ref{__sync Builtins} or
+@ref{__atomic Builtins} for details.
@item -msahf
@opindex msahf
diff --git a/gcc/doc/md.texi b/gcc/doc/md.texi
index 4a0bcfa1bf1..6b75f2bce28 100644
--- a/gcc/doc/md.texi
+++ b/gcc/doc/md.texi
@@ -1,5 +1,5 @@
@c Copyright (C) 1988, 1989, 1992, 1993, 1994, 1996, 1998, 1999, 2000, 2001,
-@c 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+@c 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
@c Free Software Foundation, Inc.
@c This is part of the GCC manual.
@c For copying conditions, see the file gcc.texi.
@@ -1778,6 +1778,77 @@ A memory address based on Y or Z pointer with displacement.
Constant integer 4
@end table
+@item Epiphany---@file{config/epiphany/constraints.md}
+@table @code
+@item U16
+An unsigned 16-bit constant.
+
+@item K
+An unsigned 5-bit constant.
+
+@item L
+A signed 11-bit constant.
+
+@item Cm1
+A signed 11-bit constant added to @minus{}1.
+Can only match when the @option{-m1reg-@var{reg}} option is active.
+
+@item Cl1
+Left-shift of @minus{}1, i.e., a bit mask with a block of leading ones, the rest
+being a block of trailing zeroes.
+Can only match when the @option{-m1reg-@var{reg}} option is active.
+
+@item Cr1
+Right-shift of @minus{}1, i.e., a bit mask with a trailing block of ones, the
+rest being zeroes. Or to put it another way, one less than a power of two.
+Can only match when the @option{-m1reg-@var{reg}} option is active.
+
+@item Cal
+Constant for arithmetic/logical operations.
+This is like @code{i}, except that for position independent code,
+no symbols / expressions needing relocations are allowed.
+
+@item Csy
+Symbolic constant for call/jump instruction.
+
+@item Rcs
+The register class usable in short insns. This is a register class
+constraint, and can thus drive register allocation.
+This constraint won't match unless @option{-mprefer-short-insn-regs} is
+in effect.
+
+@item Rsc
+The the register class of registers that can be used to hold a
+sibcall call address. I.e., a caller-saved register.
+
+@item Rct
+Core control register class.
+
+@item Rgs
+The register group usable in short insns.
+This constraint does not use a register class, so that it only
+passively matches suitable registers, and doesn't drive register allocation.
+
+@ifset INTERNALS
+@item Car
+Constant suitable for the addsi3_r pattern. This is a valid offset
+For byte, halfword, or word addressing.
+@end ifset
+
+@item Rra
+Matches the return address if it can be replaced with the link register.
+
+@item Rcc
+Matches the integer condition code register.
+
+@item Sra
+Matches the return address if it is in a stack slot.
+
+@item Cfm
+Matches control register values to switch fp mode, which are encapsulated in
+@code{UNSPEC_FP_MODE}.
+@end table
+
@item Hewlett-Packard PA-RISC---@file{config/pa/pa.h}
@table @code
@item a
@@ -5628,6 +5699,155 @@ released only after all previous memory operations have completed.
If this pattern is not defined, then a @code{memory_barrier} pattern
will be emitted, followed by a store of the value to the memory operand.
+@cindex @code{atomic_compare_and_swap@var{mode}} instruction pattern
+@item @samp{atomic_compare_and_swap@var{mode}}
+This pattern, if defined, emits code for an atomic compare-and-swap
+operation with memory model semantics. Operand 2 is the memory on which
+the atomic operation is performed. Operand 0 is an output operand which
+is set to true or false based on whether the operation succeeded. Operand
+1 is an output operand which is set to the contents of the memory before
+the operation was attempted. Operand 3 is the value that is expected to
+be in memory. Operand 4 is the value to put in memory if the expected
+value is found there. Operand 5 is set to 1 if this compare and swap is to
+be treated as a weak operation. Operand 6 is the memory model to be used
+if the operation is a success. Operand 7 is the memory model to be used
+if the operation fails.
+
+If memory referred to in operand 2 contains the value in operand 3, then
+operand 4 is stored in memory pointed to by operand 2 and fencing based on
+the memory model in operand 6 is issued.
+
+If memory referred to in operand 2 does not contain the value in operand 3,
+then fencing based on the memory model in operand 7 is issued.
+
+If a target does not support weak compare-and-swap operations, or the port
+elects not to implement weak operations, the argument in operand 5 can be
+ignored. Note a strong implementation must be provided.
+
+If this pattern is not provided, the @code{__atomic_compare_exchange}
+built-in functions will utilize the legacy @code{sync_compare_and_swap}
+pattern with an @code{__ATOMIC_SEQ_CST} memory model.
+
+@cindex @code{atomic_load@var{mode}} instruction pattern
+@item @samp{atomic_load@var{mode}}
+This pattern implements an atomic load operation with memory model
+semantics. Operand 1 is the memory address being loaded from. Operand 0
+is the result of the load. Operand 2 is the memory model to be used for
+the load operation.
+
+If not present, the @code{__atomic_load} built-in function will either
+resort to a normal load with memory barriers, or a compare-and-swap
+operation if a normal load would not be atomic.
+
+@cindex @code{atomic_store@var{mode}} instruction pattern
+@item @samp{atomic_store@var{mode}}
+This pattern implements an atomic store operation with memory model
+semantics. Operand 0 is the memory address being stored to. Operand 1
+is the value to be written. Operand 2 is the memory model to be used for
+the operation.
+
+If not present, the @code{__atomic_store} built-in function will attempt to
+perform a normal store and surround it with any required memory fences. If
+the store would not be atomic, then an @code{__atomic_exchange} is
+attempted with the result being ignored.
+
+@cindex @code{atomic_exchange@var{mode}} instruction pattern
+@item @samp{atomic_exchange@var{mode}}
+This pattern implements an atomic exchange operation with memory model
+semantics. Operand 1 is the memory location the operation is performed on.
+Operand 0 is an output operand which is set to the original value contained
+in the memory pointed to by operand 1. Operand 2 is the value to be
+stored. Operand 3 is the memory model to be used.
+
+If this pattern is not present, the built-in function
+@code{__atomic_exchange} will attempt to preform the operation with a
+compare and swap loop.
+
+@cindex @code{atomic_add@var{mode}} instruction pattern
+@cindex @code{atomic_sub@var{mode}} instruction pattern
+@cindex @code{atomic_or@var{mode}} instruction pattern
+@cindex @code{atomic_and@var{mode}} instruction pattern
+@cindex @code{atomic_xor@var{mode}} instruction pattern
+@cindex @code{atomic_nand@var{mode}} instruction pattern
+@item @samp{atomic_add@var{mode}}, @samp{atomic_sub@var{mode}}
+@itemx @samp{atomic_or@var{mode}}, @samp{atomic_and@var{mode}}
+@itemx @samp{atomic_xor@var{mode}}, @samp{atomic_nand@var{mode}}
+
+These patterns emit code for an atomic operation on memory with memory
+model semantics. Operand 0 is the memory on which the atomic operation is
+performed. Operand 1 is the second operand to the binary operator.
+Operand 2 is the memory model to be used by the operation.
+
+If these patterns are not defined, attempts will be made to use legacy
+@code{sync} patterns, or equivilent patterns which return a result. If
+none of these are available a compare-and-swap loop will be used.
+
+@cindex @code{atomic_fetch_add@var{mode}} instruction pattern
+@cindex @code{atomic_fetch_sub@var{mode}} instruction pattern
+@cindex @code{atomic_fetch_or@var{mode}} instruction pattern
+@cindex @code{atomic_fetch_and@var{mode}} instruction pattern
+@cindex @code{atomic_fetch_xor@var{mode}} instruction pattern
+@cindex @code{atomic_fetch_nand@var{mode}} instruction pattern
+@item @samp{atomic_fetch_add@var{mode}}, @samp{atomic_fetch_sub@var{mode}}
+@itemx @samp{atomic_fetch_or@var{mode}}, @samp{atomic_fetch_and@var{mode}}
+@itemx @samp{atomic_fetch_xor@var{mode}}, @samp{atomic_fetch_nand@var{mode}}
+
+These patterns emit code for an atomic operation on memory with memory
+model semantics, and return the original value. Operand 0 is an output
+operand which contains the value of the memory location before the
+operation was performed. Operand 1 is the memory on which the atomic
+operation is performed. Operand 2 is the second operand to the binary
+operator. Operand 3 is the memory model to be used by the operation.
+
+If these patterns are not defined, attempts will be made to use legacy
+@code{sync} patterns. If none of these are available a compare-and-swap
+loop will be used.
+
+@cindex @code{atomic_add_fetch@var{mode}} instruction pattern
+@cindex @code{atomic_sub_fetch@var{mode}} instruction pattern
+@cindex @code{atomic_or_fetch@var{mode}} instruction pattern
+@cindex @code{atomic_and_fetch@var{mode}} instruction pattern
+@cindex @code{atomic_xor_fetch@var{mode}} instruction pattern
+@cindex @code{atomic_nand_fetch@var{mode}} instruction pattern
+@item @samp{atomic_add_fetch@var{mode}}, @samp{atomic_sub_fetch@var{mode}}
+@itemx @samp{atomic_or_fetch@var{mode}}, @samp{atomic_and_fetch@var{mode}}
+@itemx @samp{atomic_xor_fetch@var{mode}}, @samp{atomic_nand_fetch@var{mode}}
+
+These patterns emit code for an atomic operation on memory with memory
+model semantics and return the result after the operation is performed.
+Operand 0 is an output operand which contains the value after the
+operation. Operand 1 is the memory on which the atomic operation is
+performed. Operand 2 is the second operand to the binary operator.
+Operand 3 is the memory model to be used by the operation.
+
+If these patterns are not defined, attempts will be made to use legacy
+@code{sync} patterns, or equivilent patterns which return the result before
+the operation followed by the arithmetic operation required to produce the
+result. If none of these are available a compare-and-swap loop will be
+used.
+
+@cindex @code{mem_thread_fence@var{mode}} instruction pattern
+@item @samp{mem_thread_fence@var{mode}}
+This pattern emits code required to implement a thread fence with
+memory model semantics. Operand 0 is the memory model to be used.
+
+If this pattern is not specified, all memory models except
+@code{__ATOMIC_RELAXED} will result in issuing a @code{sync_synchronize}
+barrier pattern.
+
+@cindex @code{mem_signal_fence@var{mode}} instruction pattern
+@item @samp{mem_signal_fence@var{mode}}
+This pattern emits code required to implement a signal fence with
+memory model semantics. Operand 0 is the memory model to be used.
+
+This pattern should impact the compiler optimizers the same way that
+mem_signal_fence does, but it does not need to issue any barrier
+instructions.
+
+If this pattern is not specified, all memory models except
+@code{__ATOMIC_RELAXED} will result in issuing a @code{sync_synchronize}
+barrier pattern.
+
@cindex @code{stack_protect_set} instruction pattern
@item @samp{stack_protect_set}
diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi
index 737b48e0de8..d96932b4e48 100644
--- a/gcc/doc/tm.texi
+++ b/gcc/doc/tm.texi
@@ -5766,6 +5766,14 @@ This hook should return the built-in decl needed to load a vector of the given t
This hook should return the built-in decl needed to store a vector of the given type within a transaction.
@end deftypefn
+@deftypefn {Target Hook} tree TARGET_VECTORIZE_BUILTIN_GATHER (const_tree @var{mem_vectype}, const_tree @var{index_type}, int @var{scale})
+Target builtin that implements vector gather operation. @var{mem_vectype}
+is the vector type of the load and @var{index_type} is scalar type of
+the index, scaled by @var{scale}.
+The default is @code{NULL_TREE} which means to not vectorize gather
+loads.
+@end deftypefn
+
@node Anchored Addresses
@section Anchored Addresses
@cindex anchored addresses
diff --git a/gcc/doc/tm.texi.in b/gcc/doc/tm.texi.in
index 348b7e6dee5..146e38a35e1 100644
--- a/gcc/doc/tm.texi.in
+++ b/gcc/doc/tm.texi.in
@@ -5700,6 +5700,14 @@ The default is zero which means to not iterate over other vector sizes.
@hook TARGET_VECTORIZE_BUILTIN_TM_STORE
+@hook TARGET_VECTORIZE_BUILTIN_GATHER
+Target builtin that implements vector gather operation. @var{mem_vectype}
+is the vector type of the load and @var{index_type} is scalar type of
+the index, scaled by @var{scale}.
+The default is @code{NULL_TREE} which means to not vectorize gather
+loads.
+@end deftypefn
+
@node Anchored Addresses
@section Anchored Addresses
@cindex anchored addresses
diff --git a/gcc/dse.c b/gcc/dse.c
index ef1b50c5315..ddabd3de0c6 100644
--- a/gcc/dse.c
+++ b/gcc/dse.c
@@ -33,6 +33,7 @@ along with GCC; see the file COPYING3. If not see
#include "tm_p.h"
#include "regs.h"
#include "hard-reg-set.h"
+#include "regset.h"
#include "flags.h"
#include "df.h"
#include "cselib.h"
@@ -377,6 +378,13 @@ struct insn_info
created. */
read_info_t read_rec;
+ /* The live fixed registers. We assume only fixed registers can
+ cause trouble by being clobbered from an expanded pattern;
+ storing only the live fixed registers (rather than all registers)
+ means less memory needs to be allocated / copied for the individual
+ stores. */
+ regset fixed_regs_live;
+
/* The prev insn in the basic block. */
struct insn_info * prev_insn;
@@ -448,9 +456,9 @@ struct bb_info
/* The following bitvector is indexed by the reg number. It
contains the set of regs that are live at the current instruction
being processed. While it contains info for all of the
- registers, only the pseudos are actually examined. It is used to
- assure that shift sequences that are inserted do not accidently
- clobber live hard regs. */
+ registers, only the hard registers are actually examined. It is used
+ to assure that shift and/or add sequences that are inserted do not
+ accidently clobber live hard regs. */
bitmap regs_live;
};
@@ -827,6 +835,51 @@ free_store_info (insn_info_t insn_info)
insn_info->store_rec = NULL;
}
+typedef struct
+{
+ rtx first, current;
+ regset fixed_regs_live;
+ bool failure;
+} note_add_store_info;
+
+/* Callback for emit_inc_dec_insn_before via note_stores.
+ Check if a register is clobbered which is live afterwards. */
+
+static void
+note_add_store (rtx loc, const_rtx expr ATTRIBUTE_UNUSED, void *data)
+{
+ rtx insn;
+ note_add_store_info *info = (note_add_store_info *) data;
+ int r, n;
+
+ if (!REG_P (loc))
+ return;
+
+ /* If this register is referenced by the current or an earlier insn,
+ that's OK. E.g. this applies to the register that is being incremented
+ with this addition. */
+ for (insn = info->first;
+ insn != NEXT_INSN (info->current);
+ insn = NEXT_INSN (insn))
+ if (reg_referenced_p (loc, PATTERN (insn)))
+ return;
+
+ /* If we come here, we have a clobber of a register that's only OK
+ if that register is not live. If we don't have liveness information
+ available, fail now. */
+ if (!info->fixed_regs_live)
+ {
+ info->failure = true;
+ return;
+ }
+ /* Now check if this is a live fixed register. */
+ r = REGNO (loc);
+ n = hard_regno_nregs[r][GET_MODE (loc)];
+ while (--n >= 0)
+ if (REGNO_REG_SET_P (info->fixed_regs_live, r+n))
+ info->failure = true;
+}
+
/* Callback for for_each_inc_dec that emits an INSN that sets DEST to
SRC + SRCOFF before insn ARG. */
@@ -835,31 +888,68 @@ emit_inc_dec_insn_before (rtx mem ATTRIBUTE_UNUSED,
rtx op ATTRIBUTE_UNUSED,
rtx dest, rtx src, rtx srcoff, void *arg)
{
- rtx insn = (rtx)arg;
-
- if (srcoff)
- src = gen_rtx_PLUS (GET_MODE (src), src, srcoff);
+ insn_info_t insn_info = (insn_info_t) arg;
+ rtx insn = insn_info->insn, new_insn, cur;
+ note_add_store_info info;
/* We can reuse all operands without copying, because we are about
to delete the insn that contained it. */
+ if (srcoff)
+ new_insn = gen_add3_insn (dest, src, srcoff);
+ else
+ new_insn = gen_move_insn (dest, src);
+ info.first = new_insn;
+ info.fixed_regs_live = insn_info->fixed_regs_live;
+ info.failure = false;
+ for (cur = new_insn; cur; cur = NEXT_INSN (cur))
+ {
+ info.current = cur;
+ note_stores (PATTERN (cur), note_add_store, &info);
+ }
- emit_insn_before (gen_rtx_SET (VOIDmode, dest, src), insn);
+ /* If a failure was flagged above, return 1 so that for_each_inc_dec will
+ return it immediately, communicating the failure to its caller. */
+ if (info.failure)
+ return 1;
+
+ emit_insn_before (new_insn, insn);
return -1;
}
-/* Before we delete INSN, make sure that the auto inc/dec, if it is
- there, is split into a separate insn. */
+/* Before we delete INSN_INFO->INSN, make sure that the auto inc/dec, if it
+ is there, is split into a separate insn.
+ Return true on success (or if there was nothing to do), false on failure. */
-void
-check_for_inc_dec (rtx insn)
+static bool
+check_for_inc_dec_1 (insn_info_t insn_info)
{
+ rtx insn = insn_info->insn;
rtx note = find_reg_note (insn, REG_INC, NULL_RTX);
if (note)
- for_each_inc_dec (&insn, emit_inc_dec_insn_before, insn);
+ return for_each_inc_dec (&insn, emit_inc_dec_insn_before, insn_info) == 0;
+ return true;
}
+/* Entry point for postreload. If you work on reload_cse, or you need this
+ anywhere else, consider if you can provide register liveness information
+ and add a parameter to this function so that it can be passed down in
+ insn_info.fixed_regs_live. */
+bool
+check_for_inc_dec (rtx insn)
+{
+ struct insn_info insn_info;
+ rtx note;
+
+ insn_info.insn = insn;
+ insn_info.fixed_regs_live = NULL;
+ note = find_reg_note (insn, REG_INC, NULL_RTX);
+ if (note)
+ return for_each_inc_dec (&insn, emit_inc_dec_insn_before, &insn_info) == 0;
+ return true;
+}
+
/* Delete the insn and free all of the fields inside INSN_INFO. */
static void
@@ -870,7 +960,8 @@ delete_dead_store_insn (insn_info_t insn_info)
if (!dbg_cnt (dse))
return;
- check_for_inc_dec (insn_info->insn);
+ if (!check_for_inc_dec_1 (insn_info))
+ return;
if (dump_file)
{
fprintf (dump_file, "Locally deleting insn %d ",
@@ -2375,6 +2466,17 @@ get_call_args (rtx call_insn, tree fn, rtx *args, int nargs)
return true;
}
+/* Return a bitmap of the fixed registers contained in IN. */
+
+static bitmap
+copy_fixed_regs (const_bitmap in)
+{
+ bitmap ret;
+
+ ret = ALLOC_REG_SET (NULL);
+ bitmap_and (ret, in, fixed_reg_set_regset);
+ return ret;
+}
/* Apply record_store to all candidate stores in INSN. Mark INSN
if some part of it is not a candidate store and assigns to a
@@ -2529,6 +2631,8 @@ scan_insn (bb_info_t bb_info, rtx insn)
active_local_stores_len = 1;
active_local_stores = NULL;
}
+ insn_info->fixed_regs_live
+ = copy_fixed_regs (bb_info->regs_live);
insn_info->next_local_store = active_local_stores;
active_local_stores = insn_info;
}
@@ -2579,6 +2683,7 @@ scan_insn (bb_info_t bb_info, rtx insn)
active_local_stores_len = 1;
active_local_stores = NULL;
}
+ insn_info->fixed_regs_live = copy_fixed_regs (bb_info->regs_live);
insn_info->next_local_store = active_local_stores;
active_local_stores = insn_info;
}
@@ -3622,9 +3727,9 @@ dse_step5_nospill (void)
}
if (deleted)
{
- if (dbg_cnt (dse))
+ if (dbg_cnt (dse)
+ && check_for_inc_dec_1 (insn_info))
{
- check_for_inc_dec (insn_info->insn);
delete_insn (insn_info->insn);
insn_info->insn = NULL;
globally_deleted++;
@@ -3702,12 +3807,12 @@ dse_step5_spill (void)
deleted = false;
store_info = store_info->next;
}
- if (deleted && dbg_cnt (dse))
+ if (deleted && dbg_cnt (dse)
+ && check_for_inc_dec_1 (insn_info))
{
if (dump_file)
fprintf (dump_file, "Spill deleting insn %d\n",
INSN_UID (insn_info->insn));
- check_for_inc_dec (insn_info->insn);
delete_insn (insn_info->insn);
spill_deleted++;
insn_info->insn = NULL;
diff --git a/gcc/dwarf2cfi.c b/gcc/dwarf2cfi.c
index 4f44c7744b3..69e6f21719b 100644
--- a/gcc/dwarf2cfi.c
+++ b/gcc/dwarf2cfi.c
@@ -1757,7 +1757,8 @@ dwarf2out_frame_debug_expr (rtx expr)
regiser. */
if (fde
&& fde->stack_realign
- && src == hard_frame_pointer_rtx)
+ && REG_P (src)
+ && REGNO (src) == HARD_FRAME_POINTER_REGNUM)
{
gcc_assert (cur_cfa->reg != dw_frame_pointer_regnum);
cur_trace->cfa_store.offset = 0;
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index e6f86a49854..39be9a16e9c 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -18020,6 +18020,14 @@ gen_label_die (tree decl, dw_die_ref context_die)
ASM_GENERATE_INTERNAL_LABEL (label, "L", CODE_LABEL_NUMBER (insn));
add_AT_lbl_id (lbl_die, DW_AT_low_pc, label);
}
+ else if (insn
+ && NOTE_P (insn)
+ && NOTE_KIND (insn) == NOTE_INSN_DELETED_DEBUG_LABEL
+ && CODE_LABEL_NUMBER (insn) != -1)
+ {
+ ASM_GENERATE_INTERNAL_LABEL (label, "LDL", CODE_LABEL_NUMBER (insn));
+ add_AT_lbl_id (lbl_die, DW_AT_low_pc, label);
+ }
}
}
diff --git a/gcc/expr.h b/gcc/expr.h
index 1bf1369ac96..2cc8152c740 100644
--- a/gcc/expr.h
+++ b/gcc/expr.h
@@ -212,11 +212,17 @@ int can_conditionally_move_p (enum machine_mode mode);
rtx emit_conditional_add (rtx, enum rtx_code, rtx, rtx, enum machine_mode,
rtx, rtx, enum machine_mode, int);
-rtx expand_val_compare_and_swap (rtx, rtx, rtx, rtx);
-rtx expand_bool_compare_and_swap (rtx, rtx, rtx, rtx);
rtx expand_sync_operation (rtx, rtx, enum rtx_code);
rtx expand_sync_fetch_operation (rtx, rtx, enum rtx_code, bool, rtx);
-rtx expand_sync_lock_test_and_set (rtx, rtx, rtx);
+
+rtx expand_atomic_exchange (rtx, rtx, rtx, enum memmodel, bool);
+rtx expand_atomic_load (rtx, rtx, enum memmodel);
+rtx expand_atomic_store (rtx, rtx, enum memmodel, bool);
+rtx expand_atomic_fetch_op (rtx, rtx, rtx, enum rtx_code, enum memmodel,
+ bool);
+void expand_atomic_thread_fence (enum memmodel);
+void expand_atomic_signal_fence (enum memmodel);
+
/* Functions from expmed.c: */
@@ -248,6 +254,7 @@ extern void expand_builtin_setjmp_receiver (rtx);
extern rtx expand_builtin_saveregs (void);
extern void expand_builtin_trap (void);
extern rtx builtin_strncpy_read_str (void *, HOST_WIDE_INT, enum machine_mode);
+extern void expand_builtin_mem_thread_fence (enum memmodel);
/* Functions from expr.c: */
diff --git a/gcc/final.c b/gcc/final.c
index e6d288639b7..bd4e7a762a7 100644
--- a/gcc/final.c
+++ b/gcc/final.c
@@ -2080,6 +2080,12 @@ final_scan_insn (rtx insn, FILE *file, int optimize_p ATTRIBUTE_UNUSED,
ASM_OUTPUT_DEBUG_LABEL (file, "L", CODE_LABEL_NUMBER (insn));
break;
+ case NOTE_INSN_DELETED_DEBUG_LABEL:
+ /* Similarly, but need to use different namespace for it. */
+ if (CODE_LABEL_NUMBER (insn) != -1)
+ ASM_OUTPUT_DEBUG_LABEL (file, "LDL", CODE_LABEL_NUMBER (insn));
+ break;
+
case NOTE_INSN_VAR_LOCATION:
case NOTE_INSN_CALL_ARG_LOCATION:
if (!DECL_IGNORED_P (current_function_decl))
@@ -4369,7 +4375,8 @@ rest_of_clean_state (void)
(NOTE_KIND (insn) != NOTE_INSN_VAR_LOCATION
&& NOTE_KIND (insn) != NOTE_INSN_CALL_ARG_LOCATION
&& NOTE_KIND (insn) != NOTE_INSN_BLOCK_BEG
- && NOTE_KIND (insn) != NOTE_INSN_BLOCK_END)))
+ && NOTE_KIND (insn) != NOTE_INSN_BLOCK_END
+ && NOTE_KIND (insn) != NOTE_INSN_DELETED_DEBUG_LABEL)))
print_rtl_single (final_output, insn);
}
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 40d2a304bd5..1dae389d361 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,564 @@
+2011-11-07 Janus Weil <janus@gcc.gnu.org>
+
+ PR fortran/50919
+ * class.c (add_proc_comp): Don't add non-overridable procedures to the
+ vtable.
+ * resolve.c (resolve_typebound_function,resolve_typebound_subroutine):
+ Don't generate a dynamic _vptr call for non-overridable procedures.
+
+2011-11-07 Janne Blomqvist <jb@gcc.gnu.org>
+
+ * intrinsic.texi (MCLOCK, MCLOCK8, TIME, TIME8): Functions clock
+ and time are part of the C standard library.
+
+2011-11-06 Janus Weil <janus@gcc.gnu.org>
+
+ * gfortran.h (gfc_extend_expr): Modified prototype.
+ * interface.c (gfc_extend_expr): Return 'match' instead of 'gfc_try'.
+ Remove argument 'real_error'.
+ * resolve.c (resolve_operator): Modified call to 'gfc_extend_expr'.
+
+2011-11-06 Andrew MacLeod <amacleod@redhat.com>
+ Aldy Hernandez <aldyh@redhat.com>
+
+ Merged from cxx-mem-model.
+
+ * types.def: (BT_SIZE, BT_CONST_VOLATILE_PTR, BT_FN_VOID_INT,
+ BT_FN_I{1,2,4,8,16}_CONST_VPTR_INT, BT_FN_VOID_VPTR_INT,
+ BT_FN_BOOL_VPTR_INT, BT_FN_BOOL_SIZE_CONST_VPTR,
+ BT_FN_VOID_VPTR_I{1,2,4,8,16}_INT, BT_FN_VOID_SIZE_VPTR_PTR_INT,
+ BT_FN_VOID_SIZE_CONST_VPTR_PTR_INT, BT_FN_VOID_SIZE_VPTR_PTR_PTR_INT,
+ BT_FN_BOOL_VPTR_PTR_I{1,2,4,8,16}_BOOL_INT_INT,
+ BT_FN_I{1,2,4,8,16}_VPTR_I{1,2,4,8,16}_INT): New types.
+
+2011-11-04 Mikael Morin <mikael@gcc.gnu.org>
+
+ PR fortran/43829
+ * trans-array.c (gfc_conv_expr_descriptor): Accept the inline intrinsic
+ case in the assertion.
+ * trans-intrinsic (enter_nested_loop): New function.
+ (gfc_conv_intrinsic_arith): Support non-scalar cases.
+ (nest_loop_dimension, walk_inline_intrinsic_arith): New functions.
+ (walk_inline_intrinsic_function): Handle sum and product.
+ (gfc_inline_intrinsic_function_p): Ditto.
+ * trans.h (gfc_get_loopinfo): New macro.
+
+2011-11-04 Mikael Morin <mikael@gcc.gnu.org>
+
+ * trans-intrinsic.c (gfc_conv_intrinsic_arith): Introduce parent
+ expression variable. Use it.
+
+2011-11-04 Mikael Morin <mikael@gcc.gnu.org>
+
+ * trans-intrinsic.c (gfc_conv_intrinsic.c): Introduce current loop
+ pointer. Use it.
+
+2011-11-04 Mikael Morin <mikael@gcc.gnu.org>
+
+ * trans-intrinsic.c (gfc_conv_intrinsic_arith): Small argument handling
+ cleanup.
+
+2011-11-04 Mikael Morin <mikael@gcc.gnu.org>
+
+ * trans-intrinsic.c (gfc_conv_intrinsic_arith): Update conditions.
+
+2011-11-04 Mikael Morin <mikael@gcc.gnu.org>
+
+ * frontend-passes.c (cfe_register_funcs): Return early in the case
+ of an inline intrinsic function.
+ (optimize_binop_array_assignment): Skip optimization in the case of
+ an inline intrinsic function.
+
+2011-11-04 Mikael Morin <mikael@gcc.gnu.org>
+
+ * array.c (match_subscript): Skip whitespaces before setting locus.
+ * matchexp.c (match_level_1): Ditto.
+
+2011-11-04 Mikael Morin <mikael@gcc.gnu.org>
+
+ * trans-intrinsic.c (gfc_conv_intrinsic_minmaxval): Set loop's
+ temporary rank to the loop rank. Mark ss chains for multiple loop
+ if necessary. Use gfc_trans_scalarized_loop_boundary to end one loop
+ and start another.
+
+2011-11-04 Mikael Morin <mikael@gcc.gnu.org>
+
+ * trans-intrinsic.c (gfc_conv_intrinsic_minmaxloc): Set loop's
+ temporary rank to the loop rank. Mark ss chains for multiple loop
+ if necessary. Use gfc_trans_scalarized_loop_boundary to end one loop
+ and start another.
+
+2011-11-04 Mikael Morin <mikael@gcc.gnu.org>
+
+ * trans-intrinsic.c (gfc_conv_intrinsic_minmaxloc): Don't calculate
+ offset twice in generated code.
+
+2011-11-04 Mikael Morin <mikael@gcc.gnu.org>
+
+ * trans-expr.c (gfc_conv_procedure_call): Handle temporaries for
+ arguments to elemental calls.
+ * trans-stmt.c (replace_ss): New function.
+ (gfc_conv_elemental_dependencies): Remove temporary loop handling.
+ Create a new ss for the temporary and replace the original one with it.
+ Remove fake array references. Recalculate all offsets.
+
+2011-11-04 Mikael Morin <mikael@gcc.gnu.org>
+
+ * trans-array.h (gfc_free_ss, gfc_set_delta): New prototypes.
+ * trans-array.c (gfc_free_ss): Remove forward declaration.
+ Make non-static.
+ (set_delta, gfc_set_delta): Remove forward declaration.
+ Make non-static and rename the former to the later. Update uses.
+
+2011-11-03 Mikael Morin <mikael@gcc.gnu.org>
+
+ * trans.h (gfc_inline_intrinsic_function_p): Move prototype...
+ * gfortran.h (gfc_inline_intrinsic_function_p): ... here.
+ * dependency.c (gfc_check_argument_var_dependency): Check dependencies
+ of inline intrinsics' arguments.
+
+2011-11-03 Mikael Morin <mikael@gcc.gnu.org>
+
+ * trans-array.c (gfc_trans_preloop_setup): New pointers to outer
+ dimension's ss and loop. Use them.
+
+2011-11-03 Mikael Morin <mikael@gcc.gnu.org>
+
+ * trans-array.c (outermost_loop): New function.
+ (gfc_trans_array_constructor, gfc_set_vector_loop_bounds,
+ gfc_add_loop_ss_code): Put generated code out of the outermost loop.
+
+2011-11-03 Mikael Morin <mikael@gcc.gnu.org>
+
+ * trans-array.c (constant_array_constructor_loop_size):
+ Handle multiple loops.
+
+2011-11-03 Mikael Morin <mikael@gcc.gnu.org>
+
+ * trans-array.c (get_rank, get_loop_upper_bound_for_array):
+ New functions.
+ (gfc_trans_array_constructor): Handle multiple loops.
+
+2011-11-03 Mikael Morin <mikael@gcc.gnu.org>
+
+ * trans.h (struct gfc_loopinfo): New field parent.
+ * trans-array.c (gfc_cleanup_loop): Free nested loops.
+ (gfc_add_ss_to_loop): Set nested_loop's parent loop.
+ (gfc_trans_array_constructor): Update assertion.
+ (gfc_conv_loop_setup): Ditto.
+
+2011-11-03 Mikael Morin <mikael@gcc.gnu.org>
+
+ * trans-array.c (gfc_add_loop_ss_code): Skip non-nestedmost ss.
+ Call recursively gfc_add_loop_ss_code for all the nested loops.
+ (gfc_conv_ss_startstride): Only get the descriptor for the outermost
+ ss. Call recursively gfc_conv_ss_startstride for all the nested loops.
+ (set_loop_bounds): Call recursively for all the nested loops.
+ (set_delta): Ditto.
+
+2011-11-03 Mikael Morin <mikael@gcc.gnu.org>
+
+ * trans.h (struct gfc_loopinfo): New fields nested and next.
+ * trans-array.c (gfc_add_ss_to_loop): Update list of nested list if
+ ss has non-null nested_ss field.
+
+2011-11-03 Mikael Morin <mikael@gcc.gnu.org>
+
+ * trans-array.c (gfc_trans_create_temp_array): Loop over the parents.
+
+2011-11-03 Mikael Morin <mikael@gcc.gnu.org>
+
+ * trans-array.c (get_array_ref_dim, get_scalarizer_dim_for_array_dim):
+ Rename the former to the latter and loop over the parents.
+ (innermost_ss): New function.
+ (get_array_ref_dim_for_loop_dim): New function.
+ (gfc_trans_create_temp_array): Use get_scalarizer_dim_for_array_dim.
+ (set_loop_bounds): Use get_array_dim_for_loop_dim).
+
+2011-11-03 Mikael Morin <mikael@gcc.gnu.org>
+
+ * trans.h (struct gfc_ss): New field nested_ss.
+ * trans-expr.c (gfc_advance_se_ss_chain): Update assertion.
+
+2011-11-03 Mikael Morin <mikael@gcc.gnu.org>
+
+ * trans-array.c (set_vector_loop_bounds): Loop over the parents.
+
+2011-11-03 Mikael Morin <mikael@gcc.gnu.org>
+
+ * trans-array.c (gfc_trans_array_constructor): Loop over the parents.
+
+2011-11-03 Mikael Morin <mikael@gcc.gnu.org>
+
+ * trans-array.c (gfc_set_loop_bounds_from_array_spec): Loop over the
+ parents.
+
+2011-11-03 Mikael Morin <mikael@gcc.gnu.org>
+
+ * trans.h (struct gfc_ss): New field parent.
+ * trans-array.c (gfc_trans_scalarizing_loops): Skip clearing if a
+ parent exists.
+ * trans-expr.c (gfc_advance_se_ss_chain): Move to parent ss at the
+ end of the chain.
+
+2011-11-03 Mikael Morin <mikael@gcc.gnu.org>
+
+ * trans-array.h (gfc_trans_create_temp_array): Remove loop argument.
+ * trans-array.c (gfc_trans_create_temp_array): Ditto. Get loop from ss.
+ Update reference to loop. Remove loop argument.
+ (gfc_trans_array_constructor, gfc_conv_loop_setup): Update calls to
+ gfc_trans_create_temp_array.
+ * trans-expr.c (gfc_conv_procedure_call): Ditto.
+ * trans-intrinsic.c (gfc_conv_intrinsic_transfer): Ditto.
+ * trans-stmt.c (gfc_conv_elemental_dependencies): Ditto.
+ Set loop before calling gfc_trans_create_temp_array.
+
+2011-11-03 Mikael Morin <mikael@gcc.gnu.org>
+
+ * trans-array.c (gfc_trans_create_temp_array): New variable total_dim.
+ Set total_dim to loop's rank. Replace usages of loop's rank.
+
+2011-11-03 Mikael Morin <mikael@gcc.gnu.org>
+
+ * trans-array.c (gfc_trans_array_constructor, trans_array_constructor):
+ Rename the former to the later. Get loop from ss.
+ Remove loop argument.
+ (gfc_add_loop_ss_code): Update call.
+
+2011-11-03 Mikael Morin <mikael@gcc.gnu.org>
+
+ * trans-array.c (gfc_set_vector_loop_bounds): Get loop from ss.
+ Remove loop argument.
+ (gfc_add_loop_ss_code): Update call.
+
+2011-11-03 Mikael Morin <mikael@gcc.gnu.org>
+
+ * trans.h (struct gfc_ss): New field loop.
+ * trans-array.c (set_ss_loop): New function.
+ (gfc_add_ss_to_loop): Call set_ss_loop.
+
+2011-11-03 Mikael Morin <mikael@gcc.gnu.org>
+
+ * trans.h (struct gfc_ss_info): New field refcount.
+ * trans-array.c (free_ss_info): Decrement refcount. Return early if
+ still non-zero.
+ (gfc_get_array_ss, gfc_get_temp_ss, gfc_get_scalar_ss): Increment
+ refcount.
+
+2011-11-03 Mikael Morin <mikael@gcc.gnu.org>
+
+ * trans-array.c (gfc_trans_create_temp_array): Move invariant condition
+ out of the containing loop.
+
+2011-11-03 Mikael Morin <mikael@gcc.gnu.org>
+
+ * trans-array.c (gfc_conv_loop_setup, gfc_trans_create_temp_array):
+ Move specloop arrays clearing from the former to the latter.
+
+2011-11-03 Mikael Morin <mikael@gcc.gnu.org>
+
+ * trans-array.c (set_loop_bounds): Separate the beginning of
+ gfc_conv_loop_setup into a function of its own.
+ (set_delta): Separate the end of gfc_conv_loop_setup into a function
+ of its own.
+ (gfc_conv_loop_setup): Call set_loop_bounds and set delta.
+ (set_loop_bounds, set_delta, gfc_conv_loop_setup): Make loopspec a
+ pointer to the specloop field from the loop struct.
+
+2011-11-03 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/50933
+ * interface.c (gfc_compare_derived_types): Fix check for BIND(C).
+
+2011-11-03 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/50960
+ * trans-decl.c (gfc_finish_var_decl): Mark PARAMETER as TREE_READONLY.
+
+2011-11-03 Mikael Morin <mikael@gcc.gnu.org>
+
+ * trans.h (struct gfc_ss, struct gfc_ss_info): Move field
+ gfc_ss::where into gfc_ss_info.
+ * trans-array.c (gfc_add_loop_ss_code):
+ Update reference chains.
+ * trans-stmt.c (gfc_trans_where_assign, gfc_trans_where_3): Ditto.
+
+2011-11-03 Mikael Morin <mikael@gcc.gnu.org>
+
+ * trans.h (struct gfc_ss, struct gfc_ss_info): Move field
+ gfc_ss::useflags into gfc_ss_info.
+ * trans-array.c (gfc_mark_ss_chain_used, gfc_trans_preloop_setup,
+ gfc_trans_scalarizing_loops, gfc_trans_scalarized_boundary):
+ Update reference chains.
+ * trans-expr.c (gfc_conv_procedure_call): Ditto.
+ * trans-intrinsic.c (gfc_conv_intrinsic_function): Ditto.
+
+2011-11-03 Mikael Morin <mikael@gcc.gnu.org>
+
+ * trans.h (struct gfc_ss, struct gfc_ss_info): Move field
+ gfc_ss::data::info into gfc_ss_info::data and remove empty union
+ gfc_ss::data.
+ * trans-array.c (gfc_free_ss, gfc_trans_create_temp_array,
+ gfc_trans_constant_array_constructor, gfc_trans_array_constructor,
+ gfc_set_vector_loop_bounds, gfc_add_loop_ss_code,
+ gfc_conv_ss_descriptor, gfc_trans_array_bound_check,
+ gfc_conv_array_index_offset, gfc_conv_scalarized_array_ref,
+ add_array_offset, gfc_trans_preloop_setup,
+ gfc_trans_scalarized_boundary, gfc_conv_section_startstride,
+ gfc_conv_ss_startstride, gfc_could_be_alias,
+ gfc_conv_loop_setup, gfc_conv_expr_descriptor,
+ gfc_alloc_allocatable_for_assignment, gfc_walk_array_ref):
+ Update reference chains and factor them where possible.
+ * trans-expr.c (gfc_conv_variable, gfc_conv_subref_array_arg,
+ gfc_conv_procedure_call, gfc_trans_subarray_assign): Updata reference
+ chains.
+ * trans-intrinsic.c (gfc_conv_intrinsic_transfer): Ditto.
+ * trans-io.c (transfer_array_component): Ditto.
+ * trans-stmt.c (gfc_conv_elemental_dependencies,
+ gfc_trans_pointer_assign_need_temp): Ditto.
+
+2011-11-03 Mikael Morin <mikael@gcc.gnu.org>
+
+ * trans.h (struct gfc_ss, struct gfc_ss_info): Move member struct
+ gfc_ss::data::temp into gfc_ss_info::data.
+ * trans-array.c (gfc_get_temp_ss, gfc_conv_loop_setup): Update reference
+ chains.
+
+2011-11-03 Mikael Morin <mikael@gcc.gnu.org>
+
+ * trans.h (struct gfc_ss, struct gfc_ss_info): Move member struct
+ gfc_ss::data::scalar into newly created union gfc_ss_info::data,
+ and rename subfield expr to value.
+ * trans-array.c (gfc_add_loop_ss_code, gfc_conv_array_index_offset,
+ gfc_conv_expr_descriptor): Update reference chains.
+ * trans-const.c (gfc_conv_constant): Ditto.
+ * trans-expr.c (gfc_conv_expr): Ditto.
+
+2011-11-03 Mikael Morin <mikael@gcc.gnu.org>
+
+ * trans.h (struct gfc_ss, struct gfc_ss_info): Move field
+ string_length from the former struct to the latter.
+ * trans-array.c
+ (gfc_get_temp_ss, gfc_trans_array_constructor, gfc_add_loop_ss_code,
+ gfc_conv_ss_descriptor, gfc_conv_scalarized_array_ref,
+ gfc_conv_resolve_dependencies, gfc_conv_loop_setup,
+ gfc_conv_expr_descriptor): Update references to string_length and
+ factor common reference chains where possible.
+ * trans-const.c (gfc_conv_constant): Ditto.
+ * trans-expr.c (gfc_conv_variable, gfc_conv_subref_array_arg,
+ gfc_conv_expr): Ditto.
+
+2011-11-03 Mikael Morin <mikael@gcc.gnu.org>
+
+ * trans.h (struct gfc_ss, struct gfc_ss_info): Move field expr from
+ the former struct to the latter.
+ * trans-array.c
+ (gfc_get_array_ss, gfc_get_scalar_ss,
+ gfc_trans_constant_array_constructor, gfc_trans_array_constructor,
+ gfc_add_loop_ss_code, gfc_conv_ss_descriptor,
+ gfc_trans_array_bound_check, gfc_conv_array_index_offset,
+ gfc_conv_scalarized_array_ref, gfc_conv_ss_startstride,
+ gfc_could_be_alias, gfc_conv_resolve_dependencies,
+ gfc_conv_loop_setup, gfc_conv_expr_descriptor,
+ gfc_alloc_allocatable_for_assignment): Update references to expr and
+ factor common reference chains where possible.
+ * trans-const.c (gfc_conv_constant): Ditto.
+ * trans-expr.c (gfc_conv_variable, gfc_conv_procedure_call,
+ gfc_conv_array_constructor_expr, gfc_conv_expr,
+ gfc_conv_expr_reference): Ditto.
+ * trans-intrinsic.c (trans_this_image, gfc_conv_intrinsic_bound,
+ gfc_conv_intrinsic_cobound, gfc_conv_intrinsic_funcall,
+ gfc_add_intrinsic_ss_code): Ditto.
+ * trans-stmt.c (gfc_conv_elemental_dependencies): Ditto.
+
+2011-11-03 Mikael Morin <mikael@gcc.gnu.org>
+
+ * trans.h (struct gfc_ss_info): New struct.
+ (gfc_get_ss_info): New macro.
+ (struct gfc_ss): Move type field to struct gfc_ss_info.
+ Add an info field of type gfc_ss_info.
+ * trans-array.c (free_ss_info): New function.
+ (gfc_free_ss): Call free_ss_info.
+ (gfc_get_array_ss, gfc_get_temp_ss, gfc_get_scalar_ss):
+ Allocate gfc_ss_info field.
+ (gfc_get_array_ss, gfc_get_temp_ss, gfc_get_scalar_ss,
+ gfc_set_vector_loop_bounds, gfc_add_loop_ss_code,
+ gfc_conv_array_index_offset, gfc_trans_preloop_setup,
+ gfc_trans_scalarized_loop_boundary, gfc_conv_section_startstride,
+ gfc_conv_ss_startstride, gfc_conv_resolve_dependencies,
+ gfc_conv_loop_setup, transposed_dims, gfc_conv_expr_descriptor,
+ gfc_walk_elemental_function_args): Update references to type.
+ * trans-const.c (gfc_conv_constant): Factor common reference chains
+ and update reference to type.
+ * trans-expr.c (gfc_conv_procedure_call, gfc_trans_assignment_1):
+ Update reference to type.
+ (gfc_conv_array_constructor_expr, gfc_conv_expr,
+ gfc_conv_expr_reference): Ditto. Factor common reference chains.
+ * trans-intrinsic.c (walk_inline_intrinsic_transpose): Update references
+ to type
+ * trans-stmt.c (gfc_trans_where_assign): Ditto.
+
+2011-11-03 Mikael Morin <mikael@gcc.gnu.org>
+
+ * trans.h (struct gfc_ss, struct gfc_array_info): Move shape field
+ from the former struct to the latter.
+ * trans-array.c (gfc_conv_ss_startstride, gfc_conv_loop_setup):
+ Update field references.
+ * trans-expr.c (gfc_trans_subarray_assign): Update field references
+ and factor common reference chains.
+ * trans-io.c (transfer_array_component): Ditto.
+
+2011-11-03 Mikael Morin <mikael@gcc.gnu.org>
+
+ * trans.h (struct gfc_array_info): Move dim and dimen fields...
+ (struct gfc_ss): ... here. Remove gfc_ss::data::temp::dimen field.
+ * trans-array.c (gfc_conv_loop_setup): Remove temp_ss dim array
+ initialization.
+ (gfc_get_temp_ss): Initialize dim and dimen.
+ (gfc_free_ss, gfc_get_array_ss, gfc_get_temp_ss,
+ gfc_set_loop_bounds_from_array_spec, get_array_ref_dim,
+ gfc_trans_create_temp_array, gfc_trans_constant_array_constructor,
+ gfc_set_vector_loop_bounds, gfc_conv_scalarized_array_ref,
+ gfc_trans_preloop_setup, gfc_conv_ss_startstride,
+ gfc_conv_resolve_dependencies, gfc_conv_loop_setup, transposed_dims,
+ gfc_conv_expr_descriptor, gfc_alloc_allocatable_for_assignment,
+ gfc_walk_array_ref): Update field references.
+ * trans-expr.c (gfc_conv_subref_array_arg, gfc_conv_procedure_call):
+ Ditto.
+ * trans-intrinsic.c (walk_inline_intrinsic_transpose): Ditto.
+ * trans-stmt.c (gfc_conv_elemental_dependencies): Ditto.
+
+2011-11-03 Mikael Morin <mikael@gcc.gnu.org>
+
+ * trans.h (struct gfc_ss_info, struct gfc_array_info):
+ Rename the former to the latter.
+ * trans-array.c (gfc_get_array_ss, gfc_trans_allocate_array_storage,
+ get_array_ref_dim, gfc_trans_create_temp_array,
+ gfc_trans_constant_array_constructor, gfc_set_vector_loop_bounds,
+ gfc_conv_array_index_offset, gfc_conv_scalarized_array_ref,
+ add_array_offset, gfc_trans_preloop_setup, gfc_conv_section_startstride,
+ gfc_conv_ss_startstride, gfc_conv_loop_setup, transposed_dims,
+ gfc_conv_expr_descriptor): Update all uses.
+ * trans-expr.c (gfc_conv_subref_array_arg, gfc_conv_procedure_call):
+ Ditto.
+ * trans-intrinsic.c (gfc_conv_intrinsic_transfer,
+ walk_inline_intrinsic_transpose): Ditto.
+ * trans-stmt.c (gfc_conv_elemental_dependencies,
+ gfc_trans_pointer_assign_need_temp): Ditto.
+
+2011-11-03 Mikael Morin <mikael@gcc.gnu.org>
+
+ * trans-array.c (dim_ok, transposed_dims): Rename the former to the
+ latter. Change argument type. Invert return value.
+ (gfc_conv_expr_descriptor): Update calls.
+
+2011-11-03 Mikael Morin <mikael@gcc.gnu.org>
+
+ * trans-array.c (get_array_ref_dim): Change argument type and name.
+ Obtain previous argument from the new argument in the body.
+ (gfc_trans_create_temp_arry, gfc_conv_loop_setup): Update calls.
+
+2011-11-03 Mikael Morin <mikael@gcc.gnu.org>
+
+ * trans-array.c (gfc_set_vector_loop_bounds, set_vector_loop_bounds):
+ Rename the former to the latter. Change type and name of argument.
+ Get previous argument from the new one.
+ (gfc_add_loop_ss_code): Update call.
+
+2011-11-03 Mikael Morin <mikael@gcc.gnu.org>
+
+ * trans-array.h (gfc_trans_create_temp_array): Replace info argument
+ with ss argument.
+ * trans-array.c (gfc_trans_create_temp_array): Ditto. Get info from ss.
+ (gfc_trans_array_constructor, gfc_conv_loop_setup): Update call to
+ gfc_trans_create_temp_array.
+ * trans-expr.c (gfc_conv_procedure_call): Ditto.
+ * trans-intrinsic.c (gfc_conv_intrinsic_transfer): Ditto.
+ * trans-stmt.c (gfc_conv_elemental_dependencies): Ditto.
+
+2011-11-03 Mikael Morin <mikael@gcc.gnu.org>
+
+ * trans-array.c (gfc_trans_array_bound_check): Use ss argument
+ to get name.
+
+2011-11-03 Mikael Morin <mikael@gcc.gnu.org>
+
+ * trans-array.c (gfc_trans_array_bound_check,
+ trans_array_bound_check): Rename the former to the latter.
+ Replace descriptor argument with ss argument. Get descriptor from ss.
+ (gfc_conv_array_index_offset, conv_array_index_offset): Rename the
+ former to the latter. Update call to trans_array_bound_check.
+ Replace info argument with ss argument. Get info from ss.
+ (gfc_conv_scalarized_array_ref): Update call to conv_array_index_offset.
+ (add_array_offset): Ditto
+
+2011-11-03 Mikael Morin <mikael@gcc.gnu.org>
+
+ * trans-array.c (gfc_trans_constant_array_constructor,
+ trans_constant_array_constructor): Rename the former to the latter.
+ Don't set the rank of the temporary for the loop. Remove then unused
+ loop argument.
+ (gfc_trans_array_constructor): Update call.
+
+2011-11-03 Mikael Morin <mikael@gcc.gnu.org>
+
+ * trans-array.c (gfc_trans_scalarizing_loops): Stop loop before end
+ marker, not after it.
+
+2011-11-03 Mikael Morin <mikael@gcc.gnu.org>
+
+ * trans-array.c (gfc_conv_loop_setup): Also skip temporary arrays.
+
+2011-11-03 Mikael Morin <mikael@gcc.gnu.org>
+
+ * trans-array.c (gfc_conv_ss_startstride): Access array bounds along
+ array dimensions instead of loop dimensions.
+
+2011-11-03 Mikael Morin <mikael@gcc.gnu.org>
+
+ * trans-array.c (gfc_trans_preloop_setup): Assertify one condition.
+
+2011-11-03 Mikael Morin <mikael@gcc.gnu.org>
+
+ * trans-array.c (gfc_walk_array_ref): Skip coarray dimensions.
+
+2011-11-03 Mikael Morin <mikael@gcc.gnu.org>
+
+ * trans-array.c (get_array_ref_dim): Remove redundant condition.
+
+2011-11-03 Mikael Morin <mikael@gcc.gnu.org>
+
+ * trans-array.c (gfc_trans_preloop_setup): Move common code...
+ (add_array_offset): ...into that new function.
+
+2011-11-03 Mikael Morin <mikael@gcc.gnu.org>
+
+ * trans-array.c (gfc_trans_preloop_setup): Use loop's dimension instead
+ of array's dimention. Check that it is indeed the same.
+
+2011-11-03 Mikael Morin <mikael@gcc.gnu.org>
+
+ * trans-array.c (gfc_trans_preloop_setup): Remove redundant assertion.
+ Special case outermost loop.
+
+2011-11-03 Mikael Morin <mikael@gcc.gnu.org>
+
+ * trans-array.c (gfc_trans_preloop_setup): Factor loop index
+ initialization.
+
+2011-11-03 Mikael Morin <mikael@gcc.gnu.org>
+
+ * trans-array.c (gfc_trans_preloop_setup): Move code earlier.
+
+2011-11-03 Mikael Morin <mikael@gcc.gnu.org>
+
+ * trans-array.c (gfc_trans_preloop_setup): Move array reference
+ initialisation earlier. Factor subsequent array references.
+
+2011-11-02 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
+
+ * Makef-lang.in (gfortranspec.o): Pass SHLIB instead of SHLIB_LINK.
+
2011-10-30 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/50573
diff --git a/gcc/fortran/Make-lang.in b/gcc/fortran/Make-lang.in
index b766da651a2..2602b157ab8 100644
--- a/gcc/fortran/Make-lang.in
+++ b/gcc/fortran/Make-lang.in
@@ -79,7 +79,7 @@ fortran: f951$(exeext)
gfortranspec.o: $(srcdir)/fortran/gfortranspec.c $(SYSTEM_H) $(TM_H) $(GCC_H) \
$(CONFIG_H) coretypes.h intl.h $(OPTS_H)
- (SHLIB_LINK='$(SHLIB_LINK)'; \
+ (SHLIB='$(SHLIB)'; \
$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(DRIVER_DEFINES) \
$(INCLUDES) $(srcdir)/fortran/gfortranspec.c)
diff --git a/gcc/fortran/array.c b/gcc/fortran/array.c
index 3e6b9d2591c..a1449fd8c9e 100644
--- a/gcc/fortran/array.c
+++ b/gcc/fortran/array.c
@@ -70,6 +70,7 @@ match_subscript (gfc_array_ref *ar, int init, bool match_star)
i = ar->dimen + ar->codimen;
+ gfc_gobble_whitespace ();
ar->c_where[i] = gfc_current_locus;
ar->start[i] = ar->end[i] = ar->stride[i] = NULL;
diff --git a/gcc/fortran/class.c b/gcc/fortran/class.c
index f64cc1b2a81..574d22b0b12 100644
--- a/gcc/fortran/class.c
+++ b/gcc/fortran/class.c
@@ -288,6 +288,10 @@ static void
add_proc_comp (gfc_symbol *vtype, const char *name, gfc_typebound_proc *tb)
{
gfc_component *c;
+
+ if (tb->non_overridable)
+ return;
+
c = gfc_find_component (vtype, name, true, true);
if (c == NULL)
diff --git a/gcc/fortran/dependency.c b/gcc/fortran/dependency.c
index c43af00c727..fd7fa734426 100644
--- a/gcc/fortran/dependency.c
+++ b/gcc/fortran/dependency.c
@@ -713,6 +713,17 @@ gfc_check_argument_var_dependency (gfc_expr *var, sym_intent intent,
return gfc_check_fncall_dependency (var, intent, NULL,
expr->value.function.actual,
ELEM_CHECK_VARIABLE);
+
+ if (gfc_inline_intrinsic_function_p (expr))
+ {
+ /* The TRANSPOSE case should have been caught in the
+ noncopying intrinsic case above. */
+ gcc_assert (expr->value.function.isym->id != GFC_ISYM_TRANSPOSE);
+
+ return gfc_check_fncall_dependency (var, intent, NULL,
+ expr->value.function.actual,
+ ELEM_CHECK_VARIABLE);
+ }
}
return 0;
diff --git a/gcc/fortran/frontend-passes.c b/gcc/fortran/frontend-passes.c
index 5b1a644e247..a19f22deac5 100644
--- a/gcc/fortran/frontend-passes.c
+++ b/gcc/fortran/frontend-passes.c
@@ -203,8 +203,8 @@ cfe_register_funcs (gfc_expr **e, int *walk_subtrees ATTRIBUTE_UNUSED,
/* Conversions are handled on the fly by the middle end,
transpose during trans-* stages and TRANSFER by the middle end. */
if ((*e)->value.function.isym->id == GFC_ISYM_CONVERSION
- || (*e)->value.function.isym->id == GFC_ISYM_TRANSPOSE
- || (*e)->value.function.isym->id == GFC_ISYM_TRANSFER)
+ || (*e)->value.function.isym->id == GFC_ISYM_TRANSFER
+ || gfc_inline_intrinsic_function_p (*e))
return 0;
/* Don't create an array temporary for elemental functions,
@@ -567,7 +567,8 @@ optimize_binop_array_assignment (gfc_code *c, gfc_expr **rhs, bool seen_op)
&& ! (e->value.function.isym
&& (e->value.function.isym->elemental
|| e->ts.type != c->expr1->ts.type
- || e->ts.kind != c->expr1->ts.kind)))
+ || e->ts.kind != c->expr1->ts.kind))
+ && ! gfc_inline_intrinsic_function_p (e))
{
gfc_code *n;
diff --git a/gcc/fortran/gfortran.h b/gcc/fortran/gfortran.h
index da3477d7a0b..17ebd58e50f 100644
--- a/gcc/fortran/gfortran.h
+++ b/gcc/fortran/gfortran.h
@@ -2831,7 +2831,7 @@ void gfc_procedure_use (gfc_symbol *, gfc_actual_arglist **, locus *);
void gfc_ppc_use (gfc_component *, gfc_actual_arglist **, locus *);
gfc_symbol *gfc_search_interface (gfc_interface *, int,
gfc_actual_arglist **);
-gfc_try gfc_extend_expr (gfc_expr *, bool *);
+match gfc_extend_expr (gfc_expr *);
void gfc_free_formal_arglist (gfc_formal_arglist *);
gfc_try gfc_extend_assign (gfc_code *, gfc_namespace *);
gfc_try gfc_add_interface (gfc_symbol *);
@@ -2880,6 +2880,9 @@ void gfc_generate_code (gfc_namespace *);
void gfc_generate_module_code (gfc_namespace *);
void gfc_init_coarray_decl (bool);
+/* trans-intrinsic.c */
+bool gfc_inline_intrinsic_function_p (gfc_expr *);
+
/* bbt.c */
typedef int (*compare_fn) (void *, void *);
void gfc_insert_bbt (void *, void *, compare_fn);
diff --git a/gcc/fortran/interface.c b/gcc/fortran/interface.c
index 5308513b774..90d98c759dd 100644
--- a/gcc/fortran/interface.c
+++ b/gcc/fortran/interface.c
@@ -405,7 +405,7 @@ gfc_compare_derived_types (gfc_symbol *derived1, gfc_symbol *derived2)
return 1;
/* Compare type via the rules of the standard. Both types must have
- the SEQUENCE attribute to be equal. */
+ the SEQUENCE or BIND(C) attribute to be equal. */
if (strcmp (derived1->name, derived2->name))
return 0;
@@ -414,7 +414,8 @@ gfc_compare_derived_types (gfc_symbol *derived1, gfc_symbol *derived2)
|| derived2->component_access == ACCESS_PRIVATE)
return 0;
- if (derived1->attr.sequence == 0 || derived2->attr.sequence == 0)
+ if (!(derived1->attr.sequence && derived2->attr.sequence)
+ && !(derived1->attr.is_bind_c && derived2->attr.is_bind_c))
return 0;
dt1 = derived1->components;
@@ -3220,12 +3221,11 @@ build_compcall_for_operator (gfc_expr* e, gfc_actual_arglist* actual,
with the operator. This subroutine builds an actual argument list
corresponding to the operands, then searches for a compatible
interface. If one is found, the expression node is replaced with
- the appropriate function call.
- real_error is an additional output argument that specifies if FAILURE
- is because of some real error and not because no match was found. */
+ the appropriate function call. We use the 'match' enum to specify
+ whether a replacement has been made or not, or if an error occurred. */
-gfc_try
-gfc_extend_expr (gfc_expr *e, bool *real_error)
+match
+gfc_extend_expr (gfc_expr *e)
{
gfc_actual_arglist *actual;
gfc_symbol *sym;
@@ -3239,7 +3239,6 @@ gfc_extend_expr (gfc_expr *e, bool *real_error)
actual = gfc_get_actual_arglist ();
actual->expr = e->value.op.op1;
- *real_error = false;
gname = NULL;
if (e->value.op.op2 != NULL)
@@ -3343,16 +3342,16 @@ gfc_extend_expr (gfc_expr *e, bool *real_error)
result = gfc_resolve_expr (e);
if (result == FAILURE)
- *real_error = true;
+ return MATCH_ERROR;
- return result;
+ return MATCH_YES;
}
/* Don't use gfc_free_actual_arglist(). */
free (actual->next);
free (actual);
- return FAILURE;
+ return MATCH_NO;
}
/* Change the expression node to a function call. */
@@ -3365,12 +3364,9 @@ gfc_extend_expr (gfc_expr *e, bool *real_error)
e->user_operator = 1;
if (gfc_resolve_expr (e) == FAILURE)
- {
- *real_error = true;
- return FAILURE;
- }
+ return MATCH_ERROR;
- return SUCCESS;
+ return MATCH_YES;
}
diff --git a/gcc/fortran/intrinsic.texi b/gcc/fortran/intrinsic.texi
index 24af4d5ac7d..f7d5a193e56 100644
--- a/gcc/fortran/intrinsic.texi
+++ b/gcc/fortran/intrinsic.texi
@@ -8639,7 +8639,7 @@ cases, the result is of the same type and kind as @var{ARRAY}.
@table @asis
@item @emph{Description}:
Returns the number of clock ticks since the start of the process, based
-on the UNIX function @code{clock(3)}.
+on the function @code{clock(3)} in the C standard library.
This intrinsic is not fully portable, such as to systems with 32-bit
@code{INTEGER} types but supporting times wider than 32 bits. Therefore,
@@ -8677,7 +8677,7 @@ the system does not support @code{clock(3)}.
@table @asis
@item @emph{Description}:
Returns the number of clock ticks since the start of the process, based
-on the UNIX function @code{clock(3)}.
+on the function @code{clock(3)} in the C standard library.
@emph{Warning:} this intrinsic does not increase the range of the timing
values over that returned by @code{clock(3)}. On a system with a 32-bit
@@ -12222,8 +12222,8 @@ END IF
@table @asis
@item @emph{Description}:
Returns the current time encoded as an integer (in the manner of the
-UNIX function @code{time(3)}). This value is suitable for passing to
-@code{CTIME}, @code{GMTIME}, and @code{LTIME}.
+function @code{time(3)} in the C standard library). This value is
+suitable for passing to @code{CTIME}, @code{GMTIME}, and @code{LTIME}.
This intrinsic is not fully portable, such as to systems with 32-bit
@code{INTEGER} types but supporting times wider than 32 bits. Therefore,
@@ -12263,8 +12263,8 @@ The return value is a scalar of type @code{INTEGER(4)}.
@table @asis
@item @emph{Description}:
Returns the current time encoded as an integer (in the manner of the
-UNIX function @code{time(3)}). This value is suitable for passing to
-@code{CTIME}, @code{GMTIME}, and @code{LTIME}.
+function @code{time(3)} in the C standard library). This value is
+suitable for passing to @code{CTIME}, @code{GMTIME}, and @code{LTIME}.
@emph{Warning:} this intrinsic does not increase the range of the timing
values over that returned by @code{time(3)}. On a system with a 32-bit
diff --git a/gcc/fortran/matchexp.c b/gcc/fortran/matchexp.c
index 8b99ce98692..cd70dc0f758 100644
--- a/gcc/fortran/matchexp.c
+++ b/gcc/fortran/matchexp.c
@@ -201,6 +201,7 @@ match_level_1 (gfc_expr **result)
locus where;
match m;
+ gfc_gobble_whitespace ();
where = gfc_current_locus;
uop = NULL;
m = match_defined_operator (&uop);
diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c
index 30f5f55e214..0e882399902 100644
--- a/gcc/fortran/resolve.c
+++ b/gcc/fortran/resolve.c
@@ -4034,11 +4034,10 @@ resolve_operator (gfc_expr *e)
bad_op:
{
- bool real_error;
- if (gfc_extend_expr (e, &real_error) == SUCCESS)
+ match m = gfc_extend_expr (e);
+ if (m == MATCH_YES)
return SUCCESS;
-
- if (real_error)
+ if (m == MATCH_ERROR)
return FAILURE;
}
@@ -5869,11 +5868,13 @@ resolve_typebound_function (gfc_expr* e)
const char *name;
gfc_typespec ts;
gfc_expr *expr;
+ bool overridable;
st = e->symtree;
/* Deal with typebound operators for CLASS objects. */
expr = e->value.compcall.base_object;
+ overridable = !e->value.compcall.tbp->non_overridable;
if (expr && expr->ts.type == BT_CLASS && e->value.compcall.name)
{
/* Since the typebound operators are generic, we have to ensure
@@ -5924,22 +5925,26 @@ resolve_typebound_function (gfc_expr* e)
return FAILURE;
ts = e->ts;
- /* Then convert the expression to a procedure pointer component call. */
- e->value.function.esym = NULL;
- e->symtree = st;
+ if (overridable)
+ {
+ /* Convert the expression to a procedure pointer component call. */
+ e->value.function.esym = NULL;
+ e->symtree = st;
+
+ if (new_ref)
+ e->ref = new_ref;
- if (new_ref)
- e->ref = new_ref;
+ /* '_vptr' points to the vtab, which contains the procedure pointers. */
+ gfc_add_vptr_component (e);
+ gfc_add_component_ref (e, name);
- /* '_vptr' points to the vtab, which contains the procedure pointers. */
- gfc_add_vptr_component (e);
- gfc_add_component_ref (e, name);
+ /* Recover the typespec for the expression. This is really only
+ necessary for generic procedures, where the additional call
+ to gfc_add_component_ref seems to throw the collection of the
+ correct typespec. */
+ e->ts = ts;
+ }
- /* Recover the typespec for the expression. This is really only
- necessary for generic procedures, where the additional call
- to gfc_add_component_ref seems to throw the collection of the
- correct typespec. */
- e->ts = ts;
return SUCCESS;
}
@@ -5958,11 +5963,13 @@ resolve_typebound_subroutine (gfc_code *code)
const char *name;
gfc_typespec ts;
gfc_expr *expr;
+ bool overridable;
st = code->expr1->symtree;
/* Deal with typebound operators for CLASS objects. */
expr = code->expr1->value.compcall.base_object;
+ overridable = !code->expr1->value.compcall.tbp->non_overridable;
if (expr && expr->ts.type == BT_CLASS && code->expr1->value.compcall.name)
{
/* Since the typebound operators are generic, we have to ensure
@@ -6007,22 +6014,26 @@ resolve_typebound_subroutine (gfc_code *code)
return FAILURE;
ts = code->expr1->ts;
- /* Then convert the expression to a procedure pointer component call. */
- code->expr1->value.function.esym = NULL;
- code->expr1->symtree = st;
+ if (overridable)
+ {
+ /* Convert the expression to a procedure pointer component call. */
+ code->expr1->value.function.esym = NULL;
+ code->expr1->symtree = st;
- if (new_ref)
- code->expr1->ref = new_ref;
+ if (new_ref)
+ code->expr1->ref = new_ref;
- /* '_vptr' points to the vtab, which contains the procedure pointers. */
- gfc_add_vptr_component (code->expr1);
- gfc_add_component_ref (code->expr1, name);
+ /* '_vptr' points to the vtab, which contains the procedure pointers. */
+ gfc_add_vptr_component (code->expr1);
+ gfc_add_component_ref (code->expr1, name);
+
+ /* Recover the typespec for the expression. This is really only
+ necessary for generic procedures, where the additional call
+ to gfc_add_component_ref seems to throw the collection of the
+ correct typespec. */
+ code->expr1->ts = ts;
+ }
- /* Recover the typespec for the expression. This is really only
- necessary for generic procedures, where the additional call
- to gfc_add_component_ref seems to throw the collection of the
- correct typespec. */
- code->expr1->ts = ts;
return SUCCESS;
}
diff --git a/gcc/fortran/trans-array.c b/gcc/fortran/trans-array.c
index 3472804e4c6..262743d0d37 100644
--- a/gcc/fortran/trans-array.c
+++ b/gcc/fortran/trans-array.c
@@ -463,11 +463,9 @@ void
gfc_mark_ss_chain_used (gfc_ss * ss, unsigned flags)
{
for (; ss != gfc_ss_terminator; ss = ss->next)
- ss->useflags = flags;
+ ss->info->useflags = flags;
}
-static void gfc_free_ss (gfc_ss *);
-
/* Free a gfc_ss chain. */
@@ -486,20 +484,35 @@ gfc_free_ss_chain (gfc_ss * ss)
}
+static void
+free_ss_info (gfc_ss_info *ss_info)
+{
+ ss_info->refcount--;
+ if (ss_info->refcount > 0)
+ return;
+
+ gcc_assert (ss_info->refcount == 0);
+ free (ss_info);
+}
+
+
/* Free a SS. */
-static void
+void
gfc_free_ss (gfc_ss * ss)
{
+ gfc_ss_info *ss_info;
int n;
- switch (ss->type)
+ ss_info = ss->info;
+
+ switch (ss_info->type)
{
case GFC_SS_SECTION:
- for (n = 0; n < ss->data.info.dimen; n++)
+ for (n = 0; n < ss->dimen; n++)
{
- if (ss->data.info.subscript[ss->data.info.dim[n]])
- gfc_free_ss_chain (ss->data.info.subscript[ss->data.info.dim[n]]);
+ if (ss_info->data.array.subscript[ss->dim[n]])
+ gfc_free_ss_chain (ss_info->data.array.subscript[ss->dim[n]]);
}
break;
@@ -507,6 +520,7 @@ gfc_free_ss (gfc_ss * ss)
break;
}
+ free_ss_info (ss_info);
free (ss);
}
@@ -517,17 +531,20 @@ gfc_ss *
gfc_get_array_ss (gfc_ss *next, gfc_expr *expr, int dimen, gfc_ss_type type)
{
gfc_ss *ss;
- gfc_ss_info *info;
+ gfc_ss_info *ss_info;
int i;
+ ss_info = gfc_get_ss_info ();
+ ss_info->refcount++;
+ ss_info->type = type;
+ ss_info->expr = expr;
+
ss = gfc_get_ss ();
+ ss->info = ss_info;
ss->next = next;
- ss->type = type;
- ss->expr = expr;
- info = &ss->data.info;
- info->dimen = dimen;
- for (i = 0; i < info->dimen; i++)
- info->dim[i] = i;
+ ss->dimen = dimen;
+ for (i = 0; i < ss->dimen; i++)
+ ss->dim[i] = i;
return ss;
}
@@ -539,13 +556,21 @@ gfc_ss *
gfc_get_temp_ss (tree type, tree string_length, int dimen)
{
gfc_ss *ss;
+ gfc_ss_info *ss_info;
+ int i;
+
+ ss_info = gfc_get_ss_info ();
+ ss_info->refcount++;
+ ss_info->type = GFC_SS_TEMP;
+ ss_info->string_length = string_length;
+ ss_info->data.temp.type = type;
ss = gfc_get_ss ();
+ ss->info = ss_info;
ss->next = gfc_ss_terminator;
- ss->type = GFC_SS_TEMP;
- ss->string_length = string_length;
- ss->data.temp.dimen = dimen;
- ss->data.temp.type = type;
+ ss->dimen = dimen;
+ for (i = 0; i < ss->dimen; i++)
+ ss->dim[i] = i;
return ss;
}
@@ -557,11 +582,16 @@ gfc_ss *
gfc_get_scalar_ss (gfc_ss *next, gfc_expr *expr)
{
gfc_ss *ss;
+ gfc_ss_info *ss_info;
+
+ ss_info = gfc_get_ss_info ();
+ ss_info->refcount++;
+ ss_info->type = GFC_SS_SCALAR;
+ ss_info->expr = expr;
ss = gfc_get_ss ();
+ ss->info = ss_info;
ss->next = next;
- ss->type = GFC_SS_SCALAR;
- ss->expr = expr;
return ss;
}
@@ -572,6 +602,7 @@ gfc_get_scalar_ss (gfc_ss *next, gfc_expr *expr)
void
gfc_cleanup_loop (gfc_loopinfo * loop)
{
+ gfc_loopinfo *loop_next, **ploop;
gfc_ss *ss;
gfc_ss *next;
@@ -583,6 +614,44 @@ gfc_cleanup_loop (gfc_loopinfo * loop)
gfc_free_ss (ss);
ss = next;
}
+
+ /* Remove reference to self in the parent loop. */
+ if (loop->parent)
+ for (ploop = &loop->parent->nested; *ploop; ploop = &(*ploop)->next)
+ if (*ploop == loop)
+ {
+ *ploop = loop->next;
+ break;
+ }
+
+ /* Free non-freed nested loops. */
+ for (loop = loop->nested; loop; loop = loop_next)
+ {
+ loop_next = loop->next;
+ gfc_cleanup_loop (loop);
+ free (loop);
+ }
+}
+
+
+static void
+set_ss_loop (gfc_ss *ss, gfc_loopinfo *loop)
+{
+ int n;
+
+ for (; ss != gfc_ss_terminator; ss = ss->next)
+ {
+ ss->loop = loop;
+
+ if (ss->info->type == GFC_SS_SCALAR
+ || ss->info->type == GFC_SS_REFERENCE
+ || ss->info->type == GFC_SS_TEMP)
+ continue;
+
+ for (n = 0; n < GFC_MAX_DIMENSIONS; n++)
+ if (ss->info->data.array.subscript[n] != NULL)
+ set_ss_loop (ss->info->data.array.subscript[n], loop);
+ }
}
@@ -592,13 +661,36 @@ void
gfc_add_ss_to_loop (gfc_loopinfo * loop, gfc_ss * head)
{
gfc_ss *ss;
+ gfc_loopinfo *nested_loop;
if (head == gfc_ss_terminator)
return;
+ set_ss_loop (head, loop);
+
ss = head;
for (; ss && ss != gfc_ss_terminator; ss = ss->next)
{
+ if (ss->nested_ss)
+ {
+ nested_loop = ss->nested_ss->loop;
+
+ /* More than one ss can belong to the same loop. Hence, we add the
+ loop to the chain only if it is different from the previously
+ added one, to avoid duplicate nested loops. */
+ if (nested_loop != loop->nested)
+ {
+ gcc_assert (nested_loop->parent == NULL);
+ nested_loop->parent = loop;
+
+ gcc_assert (nested_loop->next == NULL);
+ nested_loop->next = loop->nested;
+ loop->nested = nested_loop;
+ }
+ else
+ gcc_assert (nested_loop->parent == loop);
+ }
+
if (ss->next == gfc_ss_terminator)
ss->loop_chain = loop->ss;
else
@@ -633,41 +725,54 @@ void
gfc_set_loop_bounds_from_array_spec (gfc_interface_mapping * mapping,
gfc_se * se, gfc_array_spec * as)
{
- int n, dim;
+ int n, dim, total_dim;
gfc_se tmpse;
+ gfc_ss *ss;
tree lower;
tree upper;
tree tmp;
- if (as && as->type == AS_EXPLICIT)
- for (n = 0; n < se->loop->dimen; n++)
- {
- dim = se->ss->data.info.dim[n];
- gcc_assert (dim < as->rank);
- gcc_assert (se->loop->dimen == as->rank);
- if (se->loop->to[n] == NULL_TREE)
- {
- /* Evaluate the lower bound. */
- gfc_init_se (&tmpse, NULL);
- gfc_apply_interface_mapping (mapping, &tmpse, as->lower[dim]);
- gfc_add_block_to_block (&se->pre, &tmpse.pre);
- gfc_add_block_to_block (&se->post, &tmpse.post);
- lower = fold_convert (gfc_array_index_type, tmpse.expr);
-
- /* ...and the upper bound. */
- gfc_init_se (&tmpse, NULL);
- gfc_apply_interface_mapping (mapping, &tmpse, as->upper[dim]);
- gfc_add_block_to_block (&se->pre, &tmpse.pre);
- gfc_add_block_to_block (&se->post, &tmpse.post);
- upper = fold_convert (gfc_array_index_type, tmpse.expr);
-
- /* Set the upper bound of the loop to UPPER - LOWER. */
- tmp = fold_build2_loc (input_location, MINUS_EXPR,
- gfc_array_index_type, upper, lower);
- tmp = gfc_evaluate_now (tmp, &se->pre);
- se->loop->to[n] = tmp;
- }
- }
+ total_dim = 0;
+
+ if (!as || as->type != AS_EXPLICIT)
+ return;
+
+ for (ss = se->ss; ss; ss = ss->parent)
+ {
+ total_dim += ss->loop->dimen;
+ for (n = 0; n < ss->loop->dimen; n++)
+ {
+ /* The bound is known, nothing to do. */
+ if (ss->loop->to[n] != NULL_TREE)
+ continue;
+
+ dim = ss->dim[n];
+ gcc_assert (dim < as->rank);
+ gcc_assert (ss->loop->dimen <= as->rank);
+
+ /* Evaluate the lower bound. */
+ gfc_init_se (&tmpse, NULL);
+ gfc_apply_interface_mapping (mapping, &tmpse, as->lower[dim]);
+ gfc_add_block_to_block (&se->pre, &tmpse.pre);
+ gfc_add_block_to_block (&se->post, &tmpse.post);
+ lower = fold_convert (gfc_array_index_type, tmpse.expr);
+
+ /* ...and the upper bound. */
+ gfc_init_se (&tmpse, NULL);
+ gfc_apply_interface_mapping (mapping, &tmpse, as->upper[dim]);
+ gfc_add_block_to_block (&se->pre, &tmpse.pre);
+ gfc_add_block_to_block (&se->post, &tmpse.post);
+ upper = fold_convert (gfc_array_index_type, tmpse.expr);
+
+ /* Set the upper bound of the loop to UPPER - LOWER. */
+ tmp = fold_build2_loc (input_location, MINUS_EXPR,
+ gfc_array_index_type, upper, lower);
+ tmp = gfc_evaluate_now (tmp, &se->pre);
+ ss->loop->to[n] = tmp;
+ }
+ }
+
+ gcc_assert (total_dim == as->rank);
}
@@ -685,7 +790,7 @@ gfc_set_loop_bounds_from_array_spec (gfc_interface_mapping * mapping,
static void
gfc_trans_allocate_array_storage (stmtblock_t * pre, stmtblock_t * post,
- gfc_ss_info * info, tree size, tree nelem,
+ gfc_array_info * info, tree size, tree nelem,
tree initial, bool dynamic, bool dealloc)
{
tree tmp;
@@ -800,28 +905,62 @@ gfc_trans_allocate_array_storage (stmtblock_t * pre, stmtblock_t * post,
}
-/* Get the array reference dimension corresponding to the given loop dimension.
- It is different from the true array dimension given by the dim array in
- the case of a partial array reference
- It is different from the loop dimension in the case of a transposed array.
- */
+/* Get the scalarizer array dimension corresponding to actual array dimension
+ given by ARRAY_DIM.
+
+ For example, if SS represents the array ref a(1,:,:,1), it is a
+ bidimensional scalarizer array, and the result would be 0 for ARRAY_DIM=1,
+ and 1 for ARRAY_DIM=2.
+ If SS represents transpose(a(:,1,1,:)), it is again a bidimensional
+ scalarizer array, and the result would be 1 for ARRAY_DIM=0 and 0 for
+ ARRAY_DIM=3.
+ If SS represents sum(a(:,:,:,1), dim=1), it is a 2+1-dimensional scalarizer
+ array. If called on the inner ss, the result would be respectively 0,1,2 for
+ ARRAY_DIM=0,1,2. If called on the outer ss, the result would be 0,1
+ for ARRAY_DIM=1,2. */
static int
-get_array_ref_dim (gfc_ss_info *info, int loop_dim)
+get_scalarizer_dim_for_array_dim (gfc_ss *ss, int array_dim)
{
- int n, array_dim, array_ref_dim;
+ int array_ref_dim;
+ int n;
array_ref_dim = 0;
- array_dim = info->dim[loop_dim];
- for (n = 0; n < info->dimen; n++)
- if (n != loop_dim && info->dim[n] < array_dim)
- array_ref_dim++;
+ for (; ss; ss = ss->parent)
+ for (n = 0; n < ss->dimen; n++)
+ if (ss->dim[n] < array_dim)
+ array_ref_dim++;
return array_ref_dim;
}
+static gfc_ss *
+innermost_ss (gfc_ss *ss)
+{
+ while (ss->nested_ss != NULL)
+ ss = ss->nested_ss;
+
+ return ss;
+}
+
+
+
+/* Get the array reference dimension corresponding to the given loop dimension.
+ It is different from the true array dimension given by the dim array in
+ the case of a partial array reference (i.e. a(:,:,1,:) for example)
+ It is different from the loop dimension in the case of a transposed array.
+ */
+
+static int
+get_array_ref_dim_for_loop_dim (gfc_ss *ss, int loop_dim)
+{
+ return get_scalarizer_dim_for_array_dim (innermost_ss (ss),
+ ss->dim[loop_dim]);
+}
+
+
/* Generate code to create and initialize the descriptor for a temporary
array. This is used for both temporaries needed by the scalarizer, and
functions returning arrays. Adjusts the loop variables to be
@@ -833,15 +972,16 @@ get_array_ref_dim (gfc_ss_info *info, int loop_dim)
callee allocated array.
PRE, POST, INITIAL, DYNAMIC and DEALLOC are as for
- gfc_trans_allocate_array_storage.
- */
+ gfc_trans_allocate_array_storage. */
tree
-gfc_trans_create_temp_array (stmtblock_t * pre, stmtblock_t * post,
- gfc_loopinfo * loop, gfc_ss_info * info,
+gfc_trans_create_temp_array (stmtblock_t * pre, stmtblock_t * post, gfc_ss * ss,
tree eltype, tree initial, bool dynamic,
bool dealloc, bool callee_alloc, locus * where)
{
+ gfc_loopinfo *loop;
+ gfc_ss *s;
+ gfc_array_info *info;
tree from[GFC_MAX_DIMENSIONS], to[GFC_MAX_DIMENSIONS];
tree type;
tree desc;
@@ -851,49 +991,63 @@ gfc_trans_create_temp_array (stmtblock_t * pre, stmtblock_t * post,
tree cond;
tree or_expr;
int n, dim, tmp_dim;
+ int total_dim = 0;
memset (from, 0, sizeof (from));
memset (to, 0, sizeof (to));
- gcc_assert (info->dimen > 0);
- gcc_assert (loop->dimen == info->dimen);
+ info = &ss->info->data.array;
+
+ gcc_assert (ss->dimen > 0);
+ gcc_assert (ss->loop->dimen == ss->dimen);
if (gfc_option.warn_array_temp && where)
gfc_warning ("Creating array temporary at %L", where);
/* Set the lower bound to zero. */
- for (n = 0; n < loop->dimen; n++)
+ for (s = ss; s; s = s->parent)
{
- dim = info->dim[n];
+ loop = s->loop;
+
+ total_dim += loop->dimen;
+ for (n = 0; n < loop->dimen; n++)
+ {
+ dim = s->dim[n];
- /* Callee allocated arrays may not have a known bound yet. */
- if (loop->to[n])
- loop->to[n] = gfc_evaluate_now (
+ /* Callee allocated arrays may not have a known bound yet. */
+ if (loop->to[n])
+ loop->to[n] = gfc_evaluate_now (
fold_build2_loc (input_location, MINUS_EXPR,
gfc_array_index_type,
loop->to[n], loop->from[n]),
pre);
- loop->from[n] = gfc_index_zero_node;
-
- /* We are constructing the temporary's descriptor based on the loop
- dimensions. As the dimensions may be accessed in arbitrary order
- (think of transpose) the size taken from the n'th loop may not map
- to the n'th dimension of the array. We need to reconstruct loop infos
- in the right order before using it to set the descriptor
- bounds. */
- tmp_dim = get_array_ref_dim (info, n);
- from[tmp_dim] = loop->from[n];
- to[tmp_dim] = loop->to[n];
-
- info->delta[dim] = gfc_index_zero_node;
- info->start[dim] = gfc_index_zero_node;
- info->end[dim] = gfc_index_zero_node;
- info->stride[dim] = gfc_index_one_node;
+ loop->from[n] = gfc_index_zero_node;
+
+ /* We have just changed the loop bounds, we must clear the
+ corresponding specloop, so that delta calculation is not skipped
+ later in gfc_set_delta. */
+ loop->specloop[n] = NULL;
+
+ /* We are constructing the temporary's descriptor based on the loop
+ dimensions. As the dimensions may be accessed in arbitrary order
+ (think of transpose) the size taken from the n'th loop may not map
+ to the n'th dimension of the array. We need to reconstruct loop
+ infos in the right order before using it to set the descriptor
+ bounds. */
+ tmp_dim = get_scalarizer_dim_for_array_dim (ss, dim);
+ from[tmp_dim] = loop->from[n];
+ to[tmp_dim] = loop->to[n];
+
+ info->delta[dim] = gfc_index_zero_node;
+ info->start[dim] = gfc_index_zero_node;
+ info->end[dim] = gfc_index_zero_node;
+ info->stride[dim] = gfc_index_one_node;
+ }
}
/* Initialize the descriptor. */
type =
- gfc_get_array_type_bounds (eltype, info->dimen, 0, from, to, 1,
+ gfc_get_array_type_bounds (eltype, total_dim, 0, from, to, 1,
GFC_ARRAY_UNKNOWN, true);
desc = gfc_create_var (type, "atmp");
GFC_DECL_PACKED_ARRAY (desc) = 1;
@@ -922,59 +1076,61 @@ gfc_trans_create_temp_array (stmtblock_t * pre, stmtblock_t * post,
/* If there is at least one null loop->to[n], it is a callee allocated
array. */
- for (n = 0; n < loop->dimen; n++)
- if (loop->to[n] == NULL_TREE)
+ for (n = 0; n < total_dim; n++)
+ if (to[n] == NULL_TREE)
{
size = NULL_TREE;
break;
}
- for (n = 0; n < loop->dimen; n++)
- {
- dim = info->dim[n];
-
- if (size == NULL_TREE)
+ if (size == NULL_TREE)
+ for (s = ss; s; s = s->parent)
+ for (n = 0; n < s->loop->dimen; n++)
{
+ dim = get_scalarizer_dim_for_array_dim (ss, ss->dim[n]);
+
/* For a callee allocated array express the loop bounds in terms
of the descriptor fields. */
tmp = fold_build2_loc (input_location,
MINUS_EXPR, gfc_array_index_type,
gfc_conv_descriptor_ubound_get (desc, gfc_rank_cst[dim]),
gfc_conv_descriptor_lbound_get (desc, gfc_rank_cst[dim]));
- loop->to[n] = tmp;
- continue;
+ s->loop->to[n] = tmp;
}
-
- /* Store the stride and bound components in the descriptor. */
- gfc_conv_descriptor_stride_set (pre, desc, gfc_rank_cst[n], size);
+ else
+ {
+ for (n = 0; n < total_dim; n++)
+ {
+ /* Store the stride and bound components in the descriptor. */
+ gfc_conv_descriptor_stride_set (pre, desc, gfc_rank_cst[n], size);
- gfc_conv_descriptor_lbound_set (pre, desc, gfc_rank_cst[n],
- gfc_index_zero_node);
+ gfc_conv_descriptor_lbound_set (pre, desc, gfc_rank_cst[n],
+ gfc_index_zero_node);
- gfc_conv_descriptor_ubound_set (pre, desc, gfc_rank_cst[n],
- to[n]);
+ gfc_conv_descriptor_ubound_set (pre, desc, gfc_rank_cst[n], to[n]);
- tmp = fold_build2_loc (input_location, PLUS_EXPR, gfc_array_index_type,
- to[n], gfc_index_one_node);
+ tmp = fold_build2_loc (input_location, PLUS_EXPR,
+ gfc_array_index_type,
+ to[n], gfc_index_one_node);
- /* Check whether the size for this dimension is negative. */
- cond = fold_build2_loc (input_location, LE_EXPR, boolean_type_node, tmp,
- gfc_index_zero_node);
- cond = gfc_evaluate_now (cond, pre);
+ /* Check whether the size for this dimension is negative. */
+ cond = fold_build2_loc (input_location, LE_EXPR, boolean_type_node,
+ tmp, gfc_index_zero_node);
+ cond = gfc_evaluate_now (cond, pre);
- if (n == 0)
- or_expr = cond;
- else
- or_expr = fold_build2_loc (input_location, TRUTH_OR_EXPR,
- boolean_type_node, or_expr, cond);
+ if (n == 0)
+ or_expr = cond;
+ else
+ or_expr = fold_build2_loc (input_location, TRUTH_OR_EXPR,
+ boolean_type_node, or_expr, cond);
- size = fold_build2_loc (input_location, MULT_EXPR, gfc_array_index_type,
- size, tmp);
- size = gfc_evaluate_now (size, pre);
+ size = fold_build2_loc (input_location, MULT_EXPR,
+ gfc_array_index_type, size, tmp);
+ size = gfc_evaluate_now (size, pre);
+ }
}
/* Get the size of the array. */
-
if (size && !callee_alloc)
{
/* If or_expr is true, then the extent in at least one
@@ -997,8 +1153,11 @@ gfc_trans_create_temp_array (stmtblock_t * pre, stmtblock_t * post,
gfc_trans_allocate_array_storage (pre, post, info, size, nelem, initial,
dynamic, dealloc);
- if (info->dimen > loop->temp_dim)
- loop->temp_dim = info->dimen;
+ while (ss->parent)
+ ss = ss->parent;
+
+ if (ss->dimen > ss->loop->temp_dim)
+ ss->loop->temp_dim = ss->dimen;
return size;
}
@@ -1849,77 +2008,120 @@ gfc_build_constant_array_constructor (gfc_expr * expr, tree type)
gfc_build_constant_array_constructor. */
static void
-gfc_trans_constant_array_constructor (gfc_loopinfo * loop,
- gfc_ss * ss, tree type)
+trans_constant_array_constructor (gfc_ss * ss, tree type)
{
- gfc_ss_info *info;
+ gfc_array_info *info;
tree tmp;
int i;
- tmp = gfc_build_constant_array_constructor (ss->expr, type);
+ tmp = gfc_build_constant_array_constructor (ss->info->expr, type);
- info = &ss->data.info;
+ info = &ss->info->data.array;
info->descriptor = tmp;
info->data = gfc_build_addr_expr (NULL_TREE, tmp);
info->offset = gfc_index_zero_node;
- for (i = 0; i < info->dimen; i++)
+ for (i = 0; i < ss->dimen; i++)
{
info->delta[i] = gfc_index_zero_node;
info->start[i] = gfc_index_zero_node;
info->end[i] = gfc_index_zero_node;
info->stride[i] = gfc_index_one_node;
}
+}
+
+
+static int
+get_rank (gfc_loopinfo *loop)
+{
+ int rank;
+
+ rank = 0;
+ for (; loop; loop = loop->parent)
+ rank += loop->dimen;
- if (info->dimen > loop->temp_dim)
- loop->temp_dim = info->dimen;
+ return rank;
}
+
/* Helper routine of gfc_trans_array_constructor to determine if the
bounds of the loop specified by LOOP are constant and simple enough
- to use with gfc_trans_constant_array_constructor. Returns the
+ to use with trans_constant_array_constructor. Returns the
iteration count of the loop if suitable, and NULL_TREE otherwise. */
static tree
-constant_array_constructor_loop_size (gfc_loopinfo * loop)
+constant_array_constructor_loop_size (gfc_loopinfo * l)
{
+ gfc_loopinfo *loop;
tree size = gfc_index_one_node;
tree tmp;
- int i;
+ int i, total_dim;
+
+ total_dim = get_rank (l);
- for (i = 0; i < loop->dimen; i++)
+ for (loop = l; loop; loop = loop->parent)
{
- /* If the bounds aren't constant, return NULL_TREE. */
- if (!INTEGER_CST_P (loop->from[i]) || !INTEGER_CST_P (loop->to[i]))
- return NULL_TREE;
- if (!integer_zerop (loop->from[i]))
+ for (i = 0; i < loop->dimen; i++)
{
- /* Only allow nonzero "from" in one-dimensional arrays. */
- if (loop->dimen != 1)
+ /* If the bounds aren't constant, return NULL_TREE. */
+ if (!INTEGER_CST_P (loop->from[i]) || !INTEGER_CST_P (loop->to[i]))
return NULL_TREE;
- tmp = fold_build2_loc (input_location, MINUS_EXPR,
- gfc_array_index_type,
- loop->to[i], loop->from[i]);
+ if (!integer_zerop (loop->from[i]))
+ {
+ /* Only allow nonzero "from" in one-dimensional arrays. */
+ if (total_dim != 1)
+ return NULL_TREE;
+ tmp = fold_build2_loc (input_location, MINUS_EXPR,
+ gfc_array_index_type,
+ loop->to[i], loop->from[i]);
+ }
+ else
+ tmp = loop->to[i];
+ tmp = fold_build2_loc (input_location, PLUS_EXPR,
+ gfc_array_index_type, tmp, gfc_index_one_node);
+ size = fold_build2_loc (input_location, MULT_EXPR,
+ gfc_array_index_type, size, tmp);
}
- else
- tmp = loop->to[i];
- tmp = fold_build2_loc (input_location, PLUS_EXPR, gfc_array_index_type,
- tmp, gfc_index_one_node);
- size = fold_build2_loc (input_location, MULT_EXPR, gfc_array_index_type,
- size, tmp);
}
return size;
}
+static tree *
+get_loop_upper_bound_for_array (gfc_ss *array, int array_dim)
+{
+ gfc_ss *ss;
+ int n;
+
+ gcc_assert (array->nested_ss == NULL);
+
+ for (ss = array; ss; ss = ss->parent)
+ for (n = 0; n < ss->loop->dimen; n++)
+ if (array_dim == get_array_ref_dim_for_loop_dim (ss, n))
+ return &(ss->loop->to[n]);
+
+ gcc_unreachable ();
+}
+
+
+static gfc_loopinfo *
+outermost_loop (gfc_loopinfo * loop)
+{
+ while (loop->parent != NULL)
+ loop = loop->parent;
+
+ return loop;
+}
+
+
/* Array constructors are handled by constructing a temporary, then using that
within the scalarization loop. This is not optimal, but seems by far the
simplest method. */
static void
-gfc_trans_array_constructor (gfc_loopinfo * loop, gfc_ss * ss, locus * where)
+trans_array_constructor (gfc_ss * ss, locus * where)
{
gfc_constructor_base c;
tree offset;
@@ -1927,90 +2129,107 @@ gfc_trans_array_constructor (gfc_loopinfo * loop, gfc_ss * ss, locus * where)
tree desc;
tree type;
tree tmp;
+ tree *loop_ubound0;
bool dynamic;
bool old_first_len, old_typespec_chararray_ctor;
tree old_first_len_val;
+ gfc_loopinfo *loop, *outer_loop;
+ gfc_ss_info *ss_info;
+ gfc_expr *expr;
+ gfc_ss *s;
/* Save the old values for nested checking. */
old_first_len = first_len;
old_first_len_val = first_len_val;
old_typespec_chararray_ctor = typespec_chararray_ctor;
+ loop = ss->loop;
+ outer_loop = outermost_loop (loop);
+ ss_info = ss->info;
+ expr = ss_info->expr;
+
/* Do bounds-checking here and in gfc_trans_array_ctor_element only if no
typespec was given for the array constructor. */
- typespec_chararray_ctor = (ss->expr->ts.u.cl
- && ss->expr->ts.u.cl->length_from_typespec);
+ typespec_chararray_ctor = (expr->ts.u.cl
+ && expr->ts.u.cl->length_from_typespec);
if ((gfc_option.rtcheck & GFC_RTCHECK_BOUNDS)
- && ss->expr->ts.type == BT_CHARACTER && !typespec_chararray_ctor)
+ && expr->ts.type == BT_CHARACTER && !typespec_chararray_ctor)
{
first_len_val = gfc_create_var (gfc_charlen_type_node, "len");
first_len = true;
}
- gcc_assert (ss->data.info.dimen == loop->dimen);
+ gcc_assert (ss->dimen == ss->loop->dimen);
- c = ss->expr->value.constructor;
- if (ss->expr->ts.type == BT_CHARACTER)
+ c = expr->value.constructor;
+ if (expr->ts.type == BT_CHARACTER)
{
bool const_string;
/* get_array_ctor_strlen walks the elements of the constructor, if a
typespec was given, we already know the string length and want the one
specified there. */
- if (typespec_chararray_ctor && ss->expr->ts.u.cl->length
- && ss->expr->ts.u.cl->length->expr_type != EXPR_CONSTANT)
+ if (typespec_chararray_ctor && expr->ts.u.cl->length
+ && expr->ts.u.cl->length->expr_type != EXPR_CONSTANT)
{
gfc_se length_se;
const_string = false;
gfc_init_se (&length_se, NULL);
- gfc_conv_expr_type (&length_se, ss->expr->ts.u.cl->length,
+ gfc_conv_expr_type (&length_se, expr->ts.u.cl->length,
gfc_charlen_type_node);
- ss->string_length = length_se.expr;
- gfc_add_block_to_block (&loop->pre, &length_se.pre);
- gfc_add_block_to_block (&loop->post, &length_se.post);
+ ss_info->string_length = length_se.expr;
+ gfc_add_block_to_block (&outer_loop->pre, &length_se.pre);
+ gfc_add_block_to_block (&outer_loop->post, &length_se.post);
}
else
- const_string = get_array_ctor_strlen (&loop->pre, c,
- &ss->string_length);
+ const_string = get_array_ctor_strlen (&outer_loop->pre, c,
+ &ss_info->string_length);
/* Complex character array constructors should have been taken care of
and not end up here. */
- gcc_assert (ss->string_length);
+ gcc_assert (ss_info->string_length);
- ss->expr->ts.u.cl->backend_decl = ss->string_length;
+ expr->ts.u.cl->backend_decl = ss_info->string_length;
- type = gfc_get_character_type_len (ss->expr->ts.kind, ss->string_length);
+ type = gfc_get_character_type_len (expr->ts.kind, ss_info->string_length);
if (const_string)
type = build_pointer_type (type);
}
else
- type = gfc_typenode_for_spec (&ss->expr->ts);
+ type = gfc_typenode_for_spec (&expr->ts);
/* See if the constructor determines the loop bounds. */
dynamic = false;
- if (ss->expr->shape && loop->dimen > 1 && loop->to[0] == NULL_TREE)
+ loop_ubound0 = get_loop_upper_bound_for_array (ss, 0);
+
+ if (expr->shape && get_rank (loop) > 1 && *loop_ubound0 == NULL_TREE)
{
/* We have a multidimensional parameter. */
- int n;
- for (n = 0; n < ss->expr->rank; n++)
- {
- loop->from[n] = gfc_index_zero_node;
- loop->to[n] = gfc_conv_mpz_to_tree (ss->expr->shape [n],
- gfc_index_integer_kind);
- loop->to[n] = fold_build2_loc (input_location, MINUS_EXPR,
- gfc_array_index_type,
- loop->to[n], gfc_index_one_node);
- }
+ for (s = ss; s; s = s->parent)
+ {
+ int n;
+ for (n = 0; n < s->loop->dimen; n++)
+ {
+ s->loop->from[n] = gfc_index_zero_node;
+ s->loop->to[n] = gfc_conv_mpz_to_tree (expr->shape[s->dim[n]],
+ gfc_index_integer_kind);
+ s->loop->to[n] = fold_build2_loc (input_location, MINUS_EXPR,
+ gfc_array_index_type,
+ s->loop->to[n],
+ gfc_index_one_node);
+ }
+ }
}
- if (loop->to[0] == NULL_TREE)
+ if (*loop_ubound0 == NULL_TREE)
{
mpz_t size;
/* We should have a 1-dimensional, zero-based loop. */
+ gcc_assert (loop->parent == NULL && loop->nested == NULL);
gcc_assert (loop->dimen == 1);
gcc_assert (integer_zerop (loop->from[0]));
@@ -2033,24 +2252,24 @@ gfc_trans_array_constructor (gfc_loopinfo * loop, gfc_ss * ss, locus * where)
tree size = constant_array_constructor_loop_size (loop);
if (size && compare_tree_int (size, nelem) == 0)
{
- gfc_trans_constant_array_constructor (loop, ss, type);
+ trans_constant_array_constructor (ss, type);
goto finish;
}
}
}
- if (TREE_CODE (loop->to[0]) == VAR_DECL)
+ if (TREE_CODE (*loop_ubound0) == VAR_DECL)
dynamic = true;
- gfc_trans_create_temp_array (&loop->pre, &loop->post, loop, &ss->data.info,
- type, NULL_TREE, dynamic, true, false, where);
+ gfc_trans_create_temp_array (&outer_loop->pre, &outer_loop->post, ss, type,
+ NULL_TREE, dynamic, true, false, where);
- desc = ss->data.info.descriptor;
+ desc = ss_info->data.array.descriptor;
offset = gfc_index_zero_node;
offsetvar = gfc_create_var_np (gfc_array_index_type, "offset");
TREE_NO_WARNING (offsetvar) = 1;
TREE_USED (offsetvar) = 0;
- gfc_trans_array_constructor_value (&loop->pre, type, desc, c,
+ gfc_trans_array_constructor_value (&outer_loop->pre, type, desc, c,
&offset, &offsetvar, dynamic);
/* If the array grows dynamically, the upper bound of the loop variable
@@ -2060,12 +2279,12 @@ gfc_trans_array_constructor (gfc_loopinfo * loop, gfc_ss * ss, locus * where)
tmp = fold_build2_loc (input_location, MINUS_EXPR,
gfc_array_index_type,
offsetvar, gfc_index_one_node);
- tmp = gfc_evaluate_now (tmp, &loop->pre);
+ tmp = gfc_evaluate_now (tmp, &outer_loop->pre);
gfc_conv_descriptor_ubound_set (&loop->pre, desc, gfc_rank_cst[0], tmp);
- if (loop->to[0] && TREE_CODE (loop->to[0]) == VAR_DECL)
- gfc_add_modify (&loop->pre, loop->to[0], tmp);
+ if (*loop_ubound0 && TREE_CODE (*loop_ubound0) == VAR_DECL)
+ gfc_add_modify (&outer_loop->pre, *loop_ubound0, tmp);
else
- loop->to[0] = tmp;
+ *loop_ubound0 = tmp;
}
if (TREE_USED (offsetvar))
@@ -2095,8 +2314,10 @@ finish:
loop bounds. */
static void
-gfc_set_vector_loop_bounds (gfc_loopinfo * loop, gfc_ss_info * info)
+set_vector_loop_bounds (gfc_ss * ss)
{
+ gfc_loopinfo *loop, *outer_loop;
+ gfc_array_info *info;
gfc_se se;
tree tmp;
tree desc;
@@ -2104,27 +2325,36 @@ gfc_set_vector_loop_bounds (gfc_loopinfo * loop, gfc_ss_info * info)
int n;
int dim;
- for (n = 0; n < loop->dimen; n++)
+ outer_loop = outermost_loop (ss->loop);
+
+ info = &ss->info->data.array;
+
+ for (; ss; ss = ss->parent)
{
- dim = info->dim[n];
- if (info->ref->u.ar.dimen_type[dim] == DIMEN_VECTOR
- && loop->to[n] == NULL)
+ loop = ss->loop;
+
+ for (n = 0; n < loop->dimen; n++)
{
+ dim = ss->dim[n];
+ if (info->ref->u.ar.dimen_type[dim] != DIMEN_VECTOR
+ || loop->to[n] != NULL)
+ continue;
+
/* Loop variable N indexes vector dimension DIM, and we don't
yet know the upper bound of loop variable N. Set it to the
difference between the vector's upper and lower bounds. */
gcc_assert (loop->from[n] == gfc_index_zero_node);
gcc_assert (info->subscript[dim]
- && info->subscript[dim]->type == GFC_SS_VECTOR);
+ && info->subscript[dim]->info->type == GFC_SS_VECTOR);
gfc_init_se (&se, NULL);
- desc = info->subscript[dim]->data.info.descriptor;
+ desc = info->subscript[dim]->info->data.array.descriptor;
zero = gfc_rank_cst[0];
tmp = fold_build2_loc (input_location, MINUS_EXPR,
gfc_array_index_type,
gfc_conv_descriptor_ubound_get (desc, zero),
gfc_conv_descriptor_lbound_get (desc, zero));
- tmp = gfc_evaluate_now (tmp, &loop->pre);
+ tmp = gfc_evaluate_now (tmp, &outer_loop->pre);
loop->to[n] = tmp;
}
}
@@ -2139,9 +2369,16 @@ static void
gfc_add_loop_ss_code (gfc_loopinfo * loop, gfc_ss * ss, bool subscript,
locus * where)
{
+ gfc_loopinfo *nested_loop, *outer_loop;
gfc_se se;
+ gfc_ss_info *ss_info;
+ gfc_array_info *info;
+ gfc_expr *expr;
+ bool skip_nested = false;
int n;
+ outer_loop = outermost_loop (loop);
+
/* TODO: This can generate bad code if there are ordering dependencies,
e.g., a callee allocated function and an unknown size constructor. */
gcc_assert (ss != NULL);
@@ -2150,61 +2387,74 @@ gfc_add_loop_ss_code (gfc_loopinfo * loop, gfc_ss * ss, bool subscript,
{
gcc_assert (ss);
- switch (ss->type)
+ /* Cross loop arrays are handled from within the most nested loop. */
+ if (ss->nested_ss != NULL)
+ continue;
+
+ ss_info = ss->info;
+ expr = ss_info->expr;
+ info = &ss_info->data.array;
+
+ switch (ss_info->type)
{
case GFC_SS_SCALAR:
/* Scalar expression. Evaluate this now. This includes elemental
dimension indices, but not array section bounds. */
gfc_init_se (&se, NULL);
- gfc_conv_expr (&se, ss->expr);
- gfc_add_block_to_block (&loop->pre, &se.pre);
+ gfc_conv_expr (&se, expr);
+ gfc_add_block_to_block (&outer_loop->pre, &se.pre);
- if (ss->expr->ts.type != BT_CHARACTER)
+ if (expr->ts.type != BT_CHARACTER)
{
/* Move the evaluation of scalar expressions outside the
scalarization loop, except for WHERE assignments. */
if (subscript)
se.expr = convert(gfc_array_index_type, se.expr);
- if (!ss->where)
- se.expr = gfc_evaluate_now (se.expr, &loop->pre);
- gfc_add_block_to_block (&loop->pre, &se.post);
+ if (!ss_info->where)
+ se.expr = gfc_evaluate_now (se.expr, &outer_loop->pre);
+ gfc_add_block_to_block (&outer_loop->pre, &se.post);
}
else
- gfc_add_block_to_block (&loop->post, &se.post);
+ gfc_add_block_to_block (&outer_loop->post, &se.post);
- ss->data.scalar.expr = se.expr;
- ss->string_length = se.string_length;
+ ss_info->data.scalar.value = se.expr;
+ ss_info->string_length = se.string_length;
break;
case GFC_SS_REFERENCE:
/* Scalar argument to elemental procedure. Evaluate this
now. */
gfc_init_se (&se, NULL);
- gfc_conv_expr (&se, ss->expr);
- gfc_add_block_to_block (&loop->pre, &se.pre);
- gfc_add_block_to_block (&loop->post, &se.post);
+ gfc_conv_expr (&se, expr);
+ gfc_add_block_to_block (&outer_loop->pre, &se.pre);
+ gfc_add_block_to_block (&outer_loop->post, &se.post);
- ss->data.scalar.expr = gfc_evaluate_now (se.expr, &loop->pre);
- ss->string_length = se.string_length;
+ ss_info->data.scalar.value = gfc_evaluate_now (se.expr,
+ &outer_loop->pre);
+ ss_info->string_length = se.string_length;
break;
case GFC_SS_SECTION:
/* Add the expressions for scalar and vector subscripts. */
for (n = 0; n < GFC_MAX_DIMENSIONS; n++)
- if (ss->data.info.subscript[n])
- gfc_add_loop_ss_code (loop, ss->data.info.subscript[n], true,
- where);
-
- gfc_set_vector_loop_bounds (loop, &ss->data.info);
+ if (info->subscript[n])
+ {
+ gfc_add_loop_ss_code (loop, info->subscript[n], true, where);
+ /* The recursive call will have taken care of the nested loops.
+ No need to do it twice. */
+ skip_nested = true;
+ }
+
+ set_vector_loop_bounds (ss);
break;
case GFC_SS_VECTOR:
/* Get the vector's descriptor and store it in SS. */
gfc_init_se (&se, NULL);
- gfc_conv_expr_descriptor (&se, ss->expr, gfc_walk_expr (ss->expr));
- gfc_add_block_to_block (&loop->pre, &se.pre);
- gfc_add_block_to_block (&loop->post, &se.post);
- ss->data.info.descriptor = se.expr;
+ gfc_conv_expr_descriptor (&se, expr, gfc_walk_expr (expr));
+ gfc_add_block_to_block (&outer_loop->pre, &se.pre);
+ gfc_add_block_to_block (&outer_loop->post, &se.post);
+ info->descriptor = se.expr;
break;
case GFC_SS_INTRINSIC:
@@ -2217,26 +2467,26 @@ gfc_add_loop_ss_code (gfc_loopinfo * loop, gfc_ss * ss, bool subscript,
gfc_init_se (&se, NULL);
se.loop = loop;
se.ss = ss;
- gfc_conv_expr (&se, ss->expr);
- gfc_add_block_to_block (&loop->pre, &se.pre);
- gfc_add_block_to_block (&loop->post, &se.post);
- ss->string_length = se.string_length;
+ gfc_conv_expr (&se, expr);
+ gfc_add_block_to_block (&outer_loop->pre, &se.pre);
+ gfc_add_block_to_block (&outer_loop->post, &se.post);
+ ss_info->string_length = se.string_length;
break;
case GFC_SS_CONSTRUCTOR:
- if (ss->expr->ts.type == BT_CHARACTER
- && ss->string_length == NULL
- && ss->expr->ts.u.cl
- && ss->expr->ts.u.cl->length)
+ if (expr->ts.type == BT_CHARACTER
+ && ss_info->string_length == NULL
+ && expr->ts.u.cl
+ && expr->ts.u.cl->length)
{
gfc_init_se (&se, NULL);
- gfc_conv_expr_type (&se, ss->expr->ts.u.cl->length,
+ gfc_conv_expr_type (&se, expr->ts.u.cl->length,
gfc_charlen_type_node);
- ss->string_length = se.expr;
- gfc_add_block_to_block (&loop->pre, &se.pre);
- gfc_add_block_to_block (&loop->post, &se.post);
+ ss_info->string_length = se.expr;
+ gfc_add_block_to_block (&outer_loop->pre, &se.pre);
+ gfc_add_block_to_block (&outer_loop->post, &se.post);
}
- gfc_trans_array_constructor (loop, ss, where);
+ trans_array_constructor (ss, where);
break;
case GFC_SS_TEMP:
@@ -2248,6 +2498,11 @@ gfc_add_loop_ss_code (gfc_loopinfo * loop, gfc_ss * ss, bool subscript,
gcc_unreachable ();
}
}
+
+ if (!skip_nested)
+ for (nested_loop = loop->nested; nested_loop;
+ nested_loop = nested_loop->next)
+ gfc_add_loop_ss_code (nested_loop, nested_loop->ss, subscript, where);
}
@@ -2258,16 +2513,21 @@ static void
gfc_conv_ss_descriptor (stmtblock_t * block, gfc_ss * ss, int base)
{
gfc_se se;
+ gfc_ss_info *ss_info;
+ gfc_array_info *info;
tree tmp;
+ ss_info = ss->info;
+ info = &ss_info->data.array;
+
/* Get the descriptor for the array to be scalarized. */
- gcc_assert (ss->expr->expr_type == EXPR_VARIABLE);
+ gcc_assert (ss_info->expr->expr_type == EXPR_VARIABLE);
gfc_init_se (&se, NULL);
se.descriptor_only = 1;
- gfc_conv_expr_lhs (&se, ss->expr);
+ gfc_conv_expr_lhs (&se, ss_info->expr);
gfc_add_block_to_block (block, &se.pre);
- ss->data.info.descriptor = se.expr;
- ss->string_length = se.string_length;
+ info->descriptor = se.expr;
+ ss_info->string_length = se.string_length;
if (base)
{
@@ -2281,15 +2541,15 @@ gfc_conv_ss_descriptor (stmtblock_t * block, gfc_ss * ss, int base)
|| (TREE_CODE (tmp) == ADDR_EXPR
&& DECL_P (TREE_OPERAND (tmp, 0)))))
tmp = gfc_evaluate_now (tmp, block);
- ss->data.info.data = tmp;
+ info->data = tmp;
tmp = gfc_conv_array_offset (se.expr);
- ss->data.info.offset = gfc_evaluate_now (tmp, block);
+ info->offset = gfc_evaluate_now (tmp, block);
/* Make absolutely sure that the saved_offset is indeed saved
so that the variable is still accessible after the loops
are translated. */
- ss->data.info.saved_offset = ss->data.info.offset;
+ info->saved_offset = info->offset;
}
}
@@ -2430,42 +2690,25 @@ gfc_conv_array_ubound (tree descriptor, int dim)
/* Generate code to perform an array index bound check. */
static tree
-gfc_trans_array_bound_check (gfc_se * se, tree descriptor, tree index, int n,
- locus * where, bool check_upper)
+trans_array_bound_check (gfc_se * se, gfc_ss *ss, tree index, int n,
+ locus * where, bool check_upper)
{
tree fault;
tree tmp_lo, tmp_up;
+ tree descriptor;
char *msg;
const char * name = NULL;
if (!(gfc_option.rtcheck & GFC_RTCHECK_BOUNDS))
return index;
+ descriptor = ss->info->data.array.descriptor;
+
index = gfc_evaluate_now (index, &se->pre);
/* We find a name for the error message. */
- if (se->ss)
- name = se->ss->expr->symtree->name;
-
- if (!name && se->loop && se->loop->ss && se->loop->ss->expr
- && se->loop->ss->expr->symtree)
- name = se->loop->ss->expr->symtree->name;
-
- if (!name && se->loop && se->loop->ss && se->loop->ss->loop_chain
- && se->loop->ss->loop_chain->expr
- && se->loop->ss->loop_chain->expr->symtree)
- name = se->loop->ss->loop_chain->expr->symtree->name;
-
- if (!name && se->loop && se->loop->ss && se->loop->ss->expr)
- {
- if (se->loop->ss->expr->expr_type == EXPR_FUNCTION
- && se->loop->ss->expr->value.function.name)
- name = se->loop->ss->expr->value.function.name;
- else
- if (se->loop->ss->type == GFC_SS_CONSTRUCTOR
- || se->loop->ss->type == GFC_SS_SCALAR)
- name = "unnamed constant";
- }
+ name = ss->info->expr->symtree->n.sym->name;
+ gcc_assert (name != NULL);
if (TREE_CODE (descriptor) == VAR_DECL)
name = IDENTIFIER_POINTER (DECL_NAME (descriptor));
@@ -2525,13 +2768,16 @@ gfc_trans_array_bound_check (gfc_se * se, tree descriptor, tree index, int n,
DIM is the array dimension, I is the loop dimension. */
static tree
-gfc_conv_array_index_offset (gfc_se * se, gfc_ss_info * info, int dim, int i,
- gfc_array_ref * ar, tree stride)
+conv_array_index_offset (gfc_se * se, gfc_ss * ss, int dim, int i,
+ gfc_array_ref * ar, tree stride)
{
+ gfc_array_info *info;
tree index;
tree desc;
tree data;
+ info = &ss->info->data.array;
+
/* Get the index into the array for this dimension. */
if (ar)
{
@@ -2544,21 +2790,20 @@ gfc_conv_array_index_offset (gfc_se * se, gfc_ss_info * info, int dim, int i,
case DIMEN_ELEMENT:
/* Elemental dimension. */
gcc_assert (info->subscript[dim]
- && info->subscript[dim]->type == GFC_SS_SCALAR);
+ && info->subscript[dim]->info->type == GFC_SS_SCALAR);
/* We've already translated this value outside the loop. */
- index = info->subscript[dim]->data.scalar.expr;
+ index = info->subscript[dim]->info->data.scalar.value;
- index = gfc_trans_array_bound_check (se, info->descriptor,
- index, dim, &ar->where,
- ar->as->type != AS_ASSUMED_SIZE
- || dim < ar->dimen - 1);
+ index = trans_array_bound_check (se, ss, index, dim, &ar->where,
+ ar->as->type != AS_ASSUMED_SIZE
+ || dim < ar->dimen - 1);
break;
case DIMEN_VECTOR:
gcc_assert (info && se->loop);
gcc_assert (info->subscript[dim]
- && info->subscript[dim]->type == GFC_SS_VECTOR);
- desc = info->subscript[dim]->data.info.descriptor;
+ && info->subscript[dim]->info->type == GFC_SS_VECTOR);
+ desc = info->subscript[dim]->info->data.array.descriptor;
/* Get a zero-based index into the vector. */
index = fold_build2_loc (input_location, MINUS_EXPR,
@@ -2578,10 +2823,9 @@ gfc_conv_array_index_offset (gfc_se * se, gfc_ss_info * info, int dim, int i,
index = fold_convert (gfc_array_index_type, index);
/* Do any bounds checking on the final info->descriptor index. */
- index = gfc_trans_array_bound_check (se, info->descriptor,
- index, dim, &ar->where,
- ar->as->type != AS_ASSUMED_SIZE
- || dim < ar->dimen - 1);
+ index = trans_array_bound_check (se, ss, index, dim, &ar->where,
+ ar->as->type != AS_ASSUMED_SIZE
+ || dim < ar->dimen - 1);
break;
case DIMEN_RANGE:
@@ -2613,11 +2857,11 @@ gfc_conv_array_index_offset (gfc_se * se, gfc_ss_info * info, int dim, int i,
/* Pointer functions can have stride[0] different from unity.
Use the stride returned by the function call and stored in
the descriptor for the temporary. */
- if (se->ss && se->ss->type == GFC_SS_FUNCTION
- && se->ss->expr
- && se->ss->expr->symtree
- && se->ss->expr->symtree->n.sym->result
- && se->ss->expr->symtree->n.sym->result->attr.pointer)
+ if (se->ss && se->ss->info->type == GFC_SS_FUNCTION
+ && se->ss->info->expr
+ && se->ss->info->expr->symtree
+ && se->ss->info->expr->symtree->n.sym->result
+ && se->ss->info->expr->symtree->n.sym->result->attr.pointer)
stride = gfc_conv_descriptor_stride_get (info->descriptor,
gfc_rank_cst[dim]);
@@ -2640,31 +2884,33 @@ gfc_conv_array_index_offset (gfc_se * se, gfc_ss_info * info, int dim, int i,
static void
gfc_conv_scalarized_array_ref (gfc_se * se, gfc_array_ref * ar)
{
- gfc_ss_info *info;
+ gfc_array_info *info;
tree decl = NULL_TREE;
tree index;
tree tmp;
+ gfc_ss *ss;
+ gfc_expr *expr;
int n;
- info = &se->ss->data.info;
+ ss = se->ss;
+ expr = ss->info->expr;
+ info = &ss->info->data.array;
if (ar)
n = se->loop->order[0];
else
n = 0;
- index = gfc_conv_array_index_offset (se, info, info->dim[n], n, ar,
- info->stride0);
+ index = conv_array_index_offset (se, ss, ss->dim[n], n, ar, info->stride0);
/* Add the offset for this dimension to the stored offset for all other
dimensions. */
if (!integer_zerop (info->offset))
index = fold_build2_loc (input_location, PLUS_EXPR, gfc_array_index_type,
index, info->offset);
- if (se->ss->expr && is_subref_array (se->ss->expr))
- decl = se->ss->expr->symtree->n.sym->backend_decl;
+ if (expr && is_subref_array (expr))
+ decl = expr->symtree->n.sym->backend_decl;
- tmp = build_fold_indirect_ref_loc (input_location,
- info->data);
+ tmp = build_fold_indirect_ref_loc (input_location, info->data);
se->expr = gfc_build_array_ref (tmp, index, decl);
}
@@ -2674,7 +2920,7 @@ gfc_conv_scalarized_array_ref (gfc_se * se, gfc_array_ref * ar)
void
gfc_conv_tmp_array_ref (gfc_se * se)
{
- se->string_length = se->ss->string_length;
+ se->string_length = se->ss->info->string_length;
gfc_conv_scalarized_array_ref (se, NULL);
gfc_advance_se_ss_chain (se);
}
@@ -2830,6 +3076,33 @@ gfc_conv_array_ref (gfc_se * se, gfc_array_ref * ar, gfc_symbol * sym,
}
+/* Add the offset corresponding to array's ARRAY_DIM dimension and loop's
+ LOOP_DIM dimension (if any) to array's offset. */
+
+static void
+add_array_offset (stmtblock_t *pblock, gfc_loopinfo *loop, gfc_ss *ss,
+ gfc_array_ref *ar, int array_dim, int loop_dim)
+{
+ gfc_se se;
+ gfc_array_info *info;
+ tree stride, index;
+
+ info = &ss->info->data.array;
+
+ gfc_init_se (&se, NULL);
+ se.loop = loop;
+ se.expr = info->descriptor;
+ stride = gfc_conv_array_stride (info->descriptor, array_dim);
+ index = conv_array_index_offset (&se, ss, array_dim, loop_dim, ar, stride);
+ gfc_add_block_to_block (pblock, &se.pre);
+
+ info->offset = fold_build2_loc (input_location, PLUS_EXPR,
+ gfc_array_index_type,
+ info->offset, index);
+ info->offset = gfc_evaluate_now (info->offset, pblock);
+}
+
+
/* Generate the code to be executed immediately before entering a
scalarization loop. */
@@ -2837,100 +3110,98 @@ static void
gfc_trans_preloop_setup (gfc_loopinfo * loop, int dim, int flag,
stmtblock_t * pblock)
{
- tree index;
tree stride;
- gfc_ss_info *info;
- gfc_ss *ss;
- gfc_se se;
+ gfc_ss_info *ss_info;
+ gfc_array_info *info;
+ gfc_ss_type ss_type;
+ gfc_ss *ss, *pss;
+ gfc_loopinfo *ploop;
+ gfc_array_ref *ar;
int i;
/* This code will be executed before entering the scalarization loop
for this dimension. */
for (ss = loop->ss; ss != gfc_ss_terminator; ss = ss->loop_chain)
{
- if ((ss->useflags & flag) == 0)
+ ss_info = ss->info;
+
+ if ((ss_info->useflags & flag) == 0)
continue;
- if (ss->type != GFC_SS_SECTION
- && ss->type != GFC_SS_FUNCTION && ss->type != GFC_SS_CONSTRUCTOR
- && ss->type != GFC_SS_COMPONENT)
+ ss_type = ss_info->type;
+ if (ss_type != GFC_SS_SECTION
+ && ss_type != GFC_SS_FUNCTION
+ && ss_type != GFC_SS_CONSTRUCTOR
+ && ss_type != GFC_SS_COMPONENT)
continue;
- info = &ss->data.info;
+ info = &ss_info->data.array;
- if (dim >= info->dimen)
- continue;
+ gcc_assert (dim < ss->dimen);
+ gcc_assert (ss->dimen == loop->dimen);
- if (dim == info->dimen - 1)
+ if (info->ref)
+ ar = &info->ref->u.ar;
+ else
+ ar = NULL;
+
+ if (dim == loop->dimen - 1 && loop->parent != NULL)
{
- /* For the outermost loop calculate the offset due to any
- elemental dimensions. It will have been initialized with the
- base offset of the array. */
- if (info->ref)
- {
- for (i = 0; i < info->ref->u.ar.dimen; i++)
- {
- if (info->ref->u.ar.dimen_type[i] != DIMEN_ELEMENT)
- continue;
+ /* If we are in the outermost dimension of this loop, the previous
+ dimension shall be in the parent loop. */
+ gcc_assert (ss->parent != NULL);
- gfc_init_se (&se, NULL);
- se.loop = loop;
- se.expr = info->descriptor;
- stride = gfc_conv_array_stride (info->descriptor, i);
- index = gfc_conv_array_index_offset (&se, info, i, -1,
- &info->ref->u.ar,
- stride);
- gfc_add_block_to_block (pblock, &se.pre);
-
- info->offset = fold_build2_loc (input_location, PLUS_EXPR,
- gfc_array_index_type,
- info->offset, index);
- info->offset = gfc_evaluate_now (info->offset, pblock);
- }
- }
+ pss = ss->parent;
+ ploop = loop->parent;
+
+ /* ss and ss->parent are about the same array. */
+ gcc_assert (ss_info == pss->info);
+ }
+ else
+ {
+ ploop = loop;
+ pss = ss;
+ }
+
+ if (dim == loop->dimen - 1)
+ i = 0;
+ else
+ i = dim + 1;
- i = loop->order[0];
- /* For the time being, the innermost loop is unconditionally on
- the first dimension of the scalarization loop. */
- gcc_assert (i == 0);
- stride = gfc_conv_array_stride (info->descriptor, info->dim[i]);
+ /* For the time being, there is no loop reordering. */
+ gcc_assert (i == ploop->order[i]);
+ i = ploop->order[i];
+
+ if (dim == loop->dimen - 1 && loop->parent == NULL)
+ {
+ stride = gfc_conv_array_stride (info->descriptor,
+ innermost_ss (ss)->dim[i]);
/* Calculate the stride of the innermost loop. Hopefully this will
allow the backend optimizers to do their stuff more effectively.
*/
info->stride0 = gfc_evaluate_now (stride, pblock);
- }
- else
- {
- /* Add the offset for the previous loop dimension. */
- gfc_array_ref *ar;
+ /* For the outermost loop calculate the offset due to any
+ elemental dimensions. It will have been initialized with the
+ base offset of the array. */
if (info->ref)
{
- ar = &info->ref->u.ar;
- i = loop->order[dim + 1];
- }
- else
- {
- ar = NULL;
- i = dim + 1;
- }
+ for (i = 0; i < ar->dimen; i++)
+ {
+ if (ar->dimen_type[i] != DIMEN_ELEMENT)
+ continue;
- gfc_init_se (&se, NULL);
- se.loop = loop;
- se.expr = info->descriptor;
- stride = gfc_conv_array_stride (info->descriptor, info->dim[i]);
- index = gfc_conv_array_index_offset (&se, info, info->dim[i], i,
- ar, stride);
- gfc_add_block_to_block (pblock, &se.pre);
- info->offset = fold_build2_loc (input_location, PLUS_EXPR,
- gfc_array_index_type, info->offset,
- index);
- info->offset = gfc_evaluate_now (info->offset, pblock);
+ add_array_offset (pblock, loop, ss, ar, i, /* unused */ -1);
+ }
+ }
}
+ else
+ /* Add the offset for the previous loop dimension. */
+ add_array_offset (pblock, ploop, ss, ar, pss->dim[i], i);
/* Remember this offset for the second loop. */
- if (dim == loop->temp_dim - 1)
+ if (dim == loop->temp_dim - 1 && loop->parent == NULL)
info->saved_offset = info->offset;
}
}
@@ -3114,8 +3385,9 @@ gfc_trans_scalarizing_loops (gfc_loopinfo * loop, stmtblock_t * body)
gfc_add_expr_to_block (&loop->pre, tmp);
/* Clear all the used flags. */
- for (ss = loop->ss; ss; ss = ss->loop_chain)
- ss->useflags = 0;
+ for (ss = loop->ss; ss != gfc_ss_terminator; ss = ss->loop_chain)
+ if (ss->parent == NULL)
+ ss->info->useflags = 0;
}
@@ -3147,15 +3419,22 @@ gfc_trans_scalarized_loop_boundary (gfc_loopinfo * loop, stmtblock_t * body)
/* Restore the initial offsets. */
for (ss = loop->ss; ss != gfc_ss_terminator; ss = ss->loop_chain)
{
- if ((ss->useflags & 2) == 0)
+ gfc_ss_type ss_type;
+ gfc_ss_info *ss_info;
+
+ ss_info = ss->info;
+
+ if ((ss_info->useflags & 2) == 0)
continue;
- if (ss->type != GFC_SS_SECTION
- && ss->type != GFC_SS_FUNCTION && ss->type != GFC_SS_CONSTRUCTOR
- && ss->type != GFC_SS_COMPONENT)
+ ss_type = ss_info->type;
+ if (ss_type != GFC_SS_SECTION
+ && ss_type != GFC_SS_FUNCTION
+ && ss_type != GFC_SS_CONSTRUCTOR
+ && ss_type != GFC_SS_COMPONENT)
continue;
- ss->data.info.offset = ss->data.info.saved_offset;
+ ss_info->data.array.offset = ss_info->data.array.saved_offset;
}
/* Restart all the inner loops we just finished. */
@@ -3217,12 +3496,12 @@ gfc_conv_section_startstride (gfc_loopinfo * loop, gfc_ss * ss, int dim)
gfc_expr *stride = NULL;
tree desc;
gfc_se se;
- gfc_ss_info *info;
+ gfc_array_info *info;
gfc_array_ref *ar;
- gcc_assert (ss->type == GFC_SS_SECTION);
+ gcc_assert (ss->info->type == GFC_SS_SECTION);
- info = &ss->data.info;
+ info = &ss->info->data.array;
ar = &info->ref->u.ar;
if (ar->dimen_type[dim] == DIMEN_VECTOR)
@@ -3277,25 +3556,25 @@ gfc_conv_ss_startstride (gfc_loopinfo * loop)
/* Determine the rank of the loop. */
for (ss = loop->ss; ss != gfc_ss_terminator; ss = ss->loop_chain)
{
- switch (ss->type)
+ switch (ss->info->type)
{
case GFC_SS_SECTION:
case GFC_SS_CONSTRUCTOR:
case GFC_SS_FUNCTION:
case GFC_SS_COMPONENT:
- loop->dimen = ss->data.info.dimen;
+ loop->dimen = ss->dimen;
goto done;
/* As usual, lbound and ubound are exceptions!. */
case GFC_SS_INTRINSIC:
- switch (ss->expr->value.function.isym->id)
+ switch (ss->info->expr->value.function.isym->id)
{
case GFC_ISYM_LBOUND:
case GFC_ISYM_UBOUND:
case GFC_ISYM_LCOBOUND:
case GFC_ISYM_UCOBOUND:
case GFC_ISYM_THIS_IMAGE:
- loop->dimen = ss->data.info.dimen;
+ loop->dimen = ss->dimen;
goto done;
default:
@@ -3315,21 +3594,31 @@ done:
/* Loop over all the SS in the chain. */
for (ss = loop->ss; ss != gfc_ss_terminator; ss = ss->loop_chain)
{
- if (ss->expr && ss->expr->shape && !ss->shape)
- ss->shape = ss->expr->shape;
+ gfc_ss_info *ss_info;
+ gfc_array_info *info;
+ gfc_expr *expr;
+
+ ss_info = ss->info;
+ expr = ss_info->expr;
+ info = &ss_info->data.array;
- switch (ss->type)
+ if (expr && expr->shape && !info->shape)
+ info->shape = expr->shape;
+
+ switch (ss_info->type)
{
case GFC_SS_SECTION:
- /* Get the descriptor for the array. */
- gfc_conv_ss_descriptor (&loop->pre, ss, !loop->array_parameter);
+ /* Get the descriptor for the array. If it is a cross loops array,
+ we got the descriptor already in the outermost loop. */
+ if (ss->parent == NULL)
+ gfc_conv_ss_descriptor (&loop->pre, ss, !loop->array_parameter);
- for (n = 0; n < ss->data.info.dimen; n++)
- gfc_conv_section_startstride (loop, ss, ss->data.info.dim[n]);
+ for (n = 0; n < ss->dimen; n++)
+ gfc_conv_section_startstride (loop, ss, ss->dim[n]);
break;
case GFC_SS_INTRINSIC:
- switch (ss->expr->value.function.isym->id)
+ switch (expr->value.function.isym->id)
{
/* Fall through to supply start and stride. */
case GFC_ISYM_LBOUND:
@@ -3345,11 +3634,13 @@ done:
case GFC_SS_CONSTRUCTOR:
case GFC_SS_FUNCTION:
- for (n = 0; n < ss->data.info.dimen; n++)
+ for (n = 0; n < ss->dimen; n++)
{
- ss->data.info.start[n] = gfc_index_zero_node;
- ss->data.info.end[n] = gfc_index_zero_node;
- ss->data.info.stride[n] = gfc_index_one_node;
+ int dim = ss->dim[n];
+
+ info->start[dim] = gfc_index_zero_node;
+ info->end[dim] = gfc_index_zero_node;
+ info->stride[dim] = gfc_index_one_node;
}
break;
@@ -3366,7 +3657,7 @@ done:
tree end;
tree size[GFC_MAX_DIMENSIONS];
tree stride_pos, stride_neg, non_zerosized, tmp2, tmp3;
- gfc_ss_info *info;
+ gfc_array_info *info;
char *msg;
int dim;
@@ -3378,18 +3669,27 @@ done:
for (ss = loop->ss; ss != gfc_ss_terminator; ss = ss->loop_chain)
{
stmtblock_t inner;
+ gfc_ss_info *ss_info;
+ gfc_expr *expr;
+ locus *expr_loc;
+ const char *expr_name;
- if (ss->type != GFC_SS_SECTION)
+ ss_info = ss->info;
+ if (ss_info->type != GFC_SS_SECTION)
continue;
/* Catch allocatable lhs in f2003. */
if (gfc_option.flag_realloc_lhs && ss->is_alloc_lhs)
continue;
+ expr = ss_info->expr;
+ expr_loc = &expr->where;
+ expr_name = expr->symtree->name;
+
gfc_start_block (&inner);
/* TODO: range checking for mapped dimensions. */
- info = &ss->data.info;
+ info = &ss_info->data.array;
/* This code only checks ranges. Elemental and vector
dimensions are checked later. */
@@ -3397,7 +3697,7 @@ done:
{
bool check_upper;
- dim = info->dim[n];
+ dim = ss->dim[n];
if (info->ref->u.ar.dimen_type[dim] != DIMEN_RANGE)
continue;
@@ -3411,12 +3711,12 @@ done:
tmp = fold_build2_loc (input_location, EQ_EXPR, boolean_type_node,
info->stride[dim], gfc_index_zero_node);
asprintf (&msg, "Zero stride is not allowed, for dimension %d "
- "of array '%s'", dim + 1, ss->expr->symtree->name);
+ "of array '%s'", dim + 1, expr_name);
gfc_trans_runtime_check (true, false, tmp, &inner,
- &ss->expr->where, msg);
+ expr_loc, msg);
free (msg);
- desc = ss->data.info.descriptor;
+ desc = info->descriptor;
/* This is the run-time equivalent of resolve.c's
check_dimension(). The logical is more readable there
@@ -3470,14 +3770,14 @@ done:
non_zerosized, tmp2);
asprintf (&msg, "Index '%%ld' of dimension %d of array '%s' "
"outside of expected range (%%ld:%%ld)",
- dim + 1, ss->expr->symtree->name);
+ dim + 1, expr_name);
gfc_trans_runtime_check (true, false, tmp, &inner,
- &ss->expr->where, msg,
+ expr_loc, msg,
fold_convert (long_integer_type_node, info->start[dim]),
fold_convert (long_integer_type_node, lbound),
fold_convert (long_integer_type_node, ubound));
gfc_trans_runtime_check (true, false, tmp2, &inner,
- &ss->expr->where, msg,
+ expr_loc, msg,
fold_convert (long_integer_type_node, info->start[dim]),
fold_convert (long_integer_type_node, lbound),
fold_convert (long_integer_type_node, ubound));
@@ -3492,9 +3792,9 @@ done:
boolean_type_node, non_zerosized, tmp);
asprintf (&msg, "Index '%%ld' of dimension %d of array '%s' "
"below lower bound of %%ld",
- dim + 1, ss->expr->symtree->name);
+ dim + 1, expr_name);
gfc_trans_runtime_check (true, false, tmp, &inner,
- &ss->expr->where, msg,
+ expr_loc, msg,
fold_convert (long_integer_type_node, info->start[dim]),
fold_convert (long_integer_type_node, lbound));
free (msg);
@@ -3524,14 +3824,14 @@ done:
boolean_type_node, non_zerosized, tmp3);
asprintf (&msg, "Index '%%ld' of dimension %d of array '%s' "
"outside of expected range (%%ld:%%ld)",
- dim + 1, ss->expr->symtree->name);
+ dim + 1, expr_name);
gfc_trans_runtime_check (true, false, tmp2, &inner,
- &ss->expr->where, msg,
+ expr_loc, msg,
fold_convert (long_integer_type_node, tmp),
fold_convert (long_integer_type_node, ubound),
fold_convert (long_integer_type_node, lbound));
gfc_trans_runtime_check (true, false, tmp3, &inner,
- &ss->expr->where, msg,
+ expr_loc, msg,
fold_convert (long_integer_type_node, tmp),
fold_convert (long_integer_type_node, ubound),
fold_convert (long_integer_type_node, lbound));
@@ -3541,9 +3841,9 @@ done:
{
asprintf (&msg, "Index '%%ld' of dimension %d of array '%s' "
"below lower bound of %%ld",
- dim + 1, ss->expr->symtree->name);
+ dim + 1, expr_name);
gfc_trans_runtime_check (true, false, tmp2, &inner,
- &ss->expr->where, msg,
+ expr_loc, msg,
fold_convert (long_integer_type_node, tmp),
fold_convert (long_integer_type_node, lbound));
free (msg);
@@ -3570,10 +3870,10 @@ done:
boolean_type_node, tmp, size[n]);
asprintf (&msg, "Array bound mismatch for dimension %d "
"of array '%s' (%%ld/%%ld)",
- dim + 1, ss->expr->symtree->name);
+ dim + 1, expr_name);
gfc_trans_runtime_check (true, false, tmp3, &inner,
- &ss->expr->where, msg,
+ expr_loc, msg,
fold_convert (long_integer_type_node, tmp),
fold_convert (long_integer_type_node, size[n]));
@@ -3587,10 +3887,10 @@ done:
/* For optional arguments, only check bounds if the argument is
present. */
- if (ss->expr->symtree->n.sym->attr.optional
- || ss->expr->symtree->n.sym->attr.not_always_present)
+ if (expr->symtree->n.sym->attr.optional
+ || expr->symtree->n.sym->attr.not_always_present)
tmp = build3_v (COND_EXPR,
- gfc_conv_expr_present (ss->expr->symtree->n.sym),
+ gfc_conv_expr_present (expr->symtree->n.sym),
tmp, build_empty_stmt (input_location));
gfc_add_expr_to_block (&block, tmp);
@@ -3600,6 +3900,9 @@ done:
tmp = gfc_finish_block (&block);
gfc_add_expr_to_block (&loop->pre, tmp);
}
+
+ for (loop = loop->nested; loop; loop = loop->next)
+ gfc_conv_ss_startstride (loop);
}
/* Return true if both symbols could refer to the same data object. Does
@@ -3643,12 +3946,16 @@ gfc_could_be_alias (gfc_ss * lss, gfc_ss * rss)
{
gfc_ref *lref;
gfc_ref *rref;
+ gfc_expr *lexpr, *rexpr;
gfc_symbol *lsym;
gfc_symbol *rsym;
bool lsym_pointer, lsym_target, rsym_pointer, rsym_target;
- lsym = lss->expr->symtree->n.sym;
- rsym = rss->expr->symtree->n.sym;
+ lexpr = lss->info->expr;
+ rexpr = rss->info->expr;
+
+ lsym = lexpr->symtree->n.sym;
+ rsym = rexpr->symtree->n.sym;
lsym_pointer = lsym->attr.pointer;
lsym_target = lsym->attr.target;
@@ -3666,7 +3973,7 @@ gfc_could_be_alias (gfc_ss * lss, gfc_ss * rss)
/* For derived types we must check all the component types. We can ignore
array references as these will have the same base type as the previous
component ref. */
- for (lref = lss->expr->ref; lref != lss->data.info.ref; lref = lref->next)
+ for (lref = lexpr->ref; lref != lss->info->data.array.ref; lref = lref->next)
{
if (lref->type != REF_COMPONENT)
continue;
@@ -3686,7 +3993,7 @@ gfc_could_be_alias (gfc_ss * lss, gfc_ss * rss)
return 1;
}
- for (rref = rss->expr->ref; rref != rss->data.info.ref;
+ for (rref = rexpr->ref; rref != rss->info->data.array.ref;
rref = rref->next)
{
if (rref->type != REF_COMPONENT)
@@ -3721,7 +4028,7 @@ gfc_could_be_alias (gfc_ss * lss, gfc_ss * rss)
lsym_pointer = lsym->attr.pointer;
lsym_target = lsym->attr.target;
- for (rref = rss->expr->ref; rref != rss->data.info.ref; rref = rref->next)
+ for (rref = rexpr->ref; rref != rss->info->data.array.ref; rref = rref->next)
{
if (rref->type != REF_COMPONENT)
break;
@@ -3757,20 +4064,25 @@ gfc_conv_resolve_dependencies (gfc_loopinfo * loop, gfc_ss * dest,
gfc_ss *ss;
gfc_ref *lref;
gfc_ref *rref;
+ gfc_expr *dest_expr;
+ gfc_expr *ss_expr;
int nDepend = 0;
int i, j;
loop->temp_ss = NULL;
+ dest_expr = dest->info->expr;
for (ss = rss; ss != gfc_ss_terminator; ss = ss->next)
{
- if (ss->type != GFC_SS_SECTION)
+ if (ss->info->type != GFC_SS_SECTION)
continue;
- if (dest->expr->symtree->n.sym != ss->expr->symtree->n.sym)
+ ss_expr = ss->info->expr;
+
+ if (dest_expr->symtree->n.sym != ss_expr->symtree->n.sym)
{
if (gfc_could_be_alias (dest, ss)
- || gfc_are_equivalenced_arrays (dest->expr, ss->expr))
+ || gfc_are_equivalenced_arrays (dest_expr, ss_expr))
{
nDepend = 1;
break;
@@ -3778,18 +4090,18 @@ gfc_conv_resolve_dependencies (gfc_loopinfo * loop, gfc_ss * dest,
}
else
{
- lref = dest->expr->ref;
- rref = ss->expr->ref;
+ lref = dest_expr->ref;
+ rref = ss_expr->ref;
nDepend = gfc_dep_resolver (lref, rref, &loop->reverse[0]);
if (nDepend == 1)
break;
- for (i = 0; i < dest->data.info.dimen; i++)
- for (j = 0; j < ss->data.info.dimen; j++)
+ for (i = 0; i < dest->dimen; i++)
+ for (j = 0; j < ss->dimen; j++)
if (i != j
- && dest->data.info.dim[i] == ss->data.info.dim[j])
+ && dest->dim[i] == ss->dim[j])
{
/* If we don't access array elements in the same order,
there is a dependency. */
@@ -3838,11 +4150,11 @@ temporary:
if (nDepend == 1)
{
- tree base_type = gfc_typenode_for_spec (&dest->expr->ts);
+ tree base_type = gfc_typenode_for_spec (&dest_expr->ts);
if (GFC_ARRAY_TYPE_P (base_type)
|| GFC_DESCRIPTOR_TYPE_P (base_type))
base_type = gfc_get_element_type (base_type);
- loop->temp_ss = gfc_get_temp_ss (base_type, dest->string_length,
+ loop->temp_ss = gfc_get_temp_ss (base_type, dest->info->string_length,
loop->dimen);
gfc_add_ss_to_loop (loop, loop->temp_ss);
}
@@ -3851,25 +4163,25 @@ temporary:
}
-/* Initialize the scalarization loop. Creates the loop variables. Determines
- the range of the loop variables. Creates a temporary if required.
- Calculates how to transform from loop variables to array indices for each
- expression. Also generates code for scalar expressions which have been
- moved outside the loop. */
+/* Browse through each array's information from the scalarizer and set the loop
+ bounds according to the "best" one (per dimension), i.e. the one which
+ provides the most information (constant bounds, shape, etc). */
-void
-gfc_conv_loop_setup (gfc_loopinfo * loop, locus * where)
+static void
+set_loop_bounds (gfc_loopinfo *loop)
{
int n, dim, spec_dim;
- gfc_ss_info *info;
- gfc_ss_info *specinfo;
+ gfc_array_info *info;
+ gfc_array_info *specinfo;
gfc_ss *ss;
tree tmp;
- gfc_ss *loopspec[GFC_MAX_DIMENSIONS];
+ gfc_ss **loopspec;
bool dynamic[GFC_MAX_DIMENSIONS];
mpz_t *cshape;
mpz_t i;
+ loopspec = loop->specloop;
+
mpz_init (i);
for (n = 0; n < loop->dimen; n++)
{
@@ -3879,16 +4191,21 @@ gfc_conv_loop_setup (gfc_loopinfo * loop, locus * where)
loop for this dimension. We try to pick the simplest term. */
for (ss = loop->ss; ss != gfc_ss_terminator; ss = ss->loop_chain)
{
- if (ss->type == GFC_SS_SCALAR || ss->type == GFC_SS_REFERENCE)
+ gfc_ss_type ss_type;
+
+ ss_type = ss->info->type;
+ if (ss_type == GFC_SS_SCALAR
+ || ss_type == GFC_SS_TEMP
+ || ss_type == GFC_SS_REFERENCE)
continue;
- info = &ss->data.info;
- dim = info->dim[n];
+ info = &ss->info->data.array;
+ dim = ss->dim[n];
if (loopspec[n] != NULL)
{
- specinfo = &loopspec[n]->data.info;
- spec_dim = specinfo->dim[n];
+ specinfo = &loopspec[n]->info->data.array;
+ spec_dim = loopspec[n]->dim[n];
}
else
{
@@ -3897,19 +4214,19 @@ gfc_conv_loop_setup (gfc_loopinfo * loop, locus * where)
spec_dim = 0;
}
- if (ss->shape)
+ if (info->shape)
{
- gcc_assert (ss->shape[dim]);
+ gcc_assert (info->shape[dim]);
/* The frontend has worked out the size for us. */
if (!loopspec[n]
- || !loopspec[n]->shape
+ || !specinfo->shape
|| !integer_zerop (specinfo->start[spec_dim]))
/* Prefer zero-based descriptors if possible. */
loopspec[n] = ss;
continue;
}
- if (ss->type == GFC_SS_CONSTRUCTOR)
+ if (ss_type == GFC_SS_CONSTRUCTOR)
{
gfc_constructor_base base;
/* An unknown size constructor will always be rank one.
@@ -3921,7 +4238,7 @@ gfc_conv_loop_setup (gfc_loopinfo * loop, locus * where)
can be determined at compile time. Prefer not to otherwise,
since the general case involves realloc, and it's better to
avoid that overhead if possible. */
- base = ss->expr->value.constructor;
+ base = ss->info->expr->value.constructor;
dynamic[n] = gfc_get_array_constructor_size (&i, base);
if (!dynamic[n] || !loopspec[n])
loopspec[n] = ss;
@@ -3930,7 +4247,7 @@ gfc_conv_loop_setup (gfc_loopinfo * loop, locus * where)
/* TODO: Pick the best bound if we have a choice between a
function and something else. */
- if (ss->type == GFC_SS_FUNCTION)
+ if (ss_type == GFC_SS_FUNCTION)
{
loopspec[n] = ss;
continue;
@@ -3941,7 +4258,7 @@ gfc_conv_loop_setup (gfc_loopinfo * loop, locus * where)
if (loopspec[n] && ss->is_alloc_lhs)
continue;
- if (ss->type != GFC_SS_SECTION)
+ if (ss_type != GFC_SS_SECTION)
continue;
if (!loopspec[n])
@@ -3953,7 +4270,7 @@ gfc_conv_loop_setup (gfc_loopinfo * loop, locus * where)
known lower bound
known upper bound
*/
- else if ((loopspec[n]->type == GFC_SS_CONSTRUCTOR && dynamic[n])
+ else if ((loopspec[n]->info->type == GFC_SS_CONSTRUCTOR && dynamic[n])
|| n >= loop->dimen)
loopspec[n] = ss;
else if (integer_onep (info->stride[dim])
@@ -3975,16 +4292,16 @@ gfc_conv_loop_setup (gfc_loopinfo * loop, locus * where)
that's bad news. */
gcc_assert (loopspec[n]);
- info = &loopspec[n]->data.info;
- dim = info->dim[n];
+ info = &loopspec[n]->info->data.array;
+ dim = loopspec[n]->dim[n];
/* Set the extents of this range. */
- cshape = loopspec[n]->shape;
+ cshape = info->shape;
if (cshape && INTEGER_CST_P (info->start[dim])
&& INTEGER_CST_P (info->stride[dim]))
{
loop->from[n] = info->start[dim];
- mpz_set (i, cshape[get_array_ref_dim (info, n)]);
+ mpz_set (i, cshape[get_array_ref_dim_for_loop_dim (loopspec[n], n)]);
mpz_sub_ui (i, i, 1);
/* To = from + (size - 1) * stride. */
tmp = gfc_conv_mpz_to_tree (i, gfc_index_integer_kind);
@@ -3999,7 +4316,7 @@ gfc_conv_loop_setup (gfc_loopinfo * loop, locus * where)
else
{
loop->from[n] = info->start[dim];
- switch (loopspec[n]->type)
+ switch (loopspec[n]->info->type)
{
case GFC_SS_CONSTRUCTOR:
/* The upper bound is calculated when we expand the
@@ -4046,65 +4363,98 @@ gfc_conv_loop_setup (gfc_loopinfo * loop, locus * where)
loop->from[n] = gfc_index_zero_node;
}
}
+ mpz_clear (i);
+
+ for (loop = loop->nested; loop; loop = loop->next)
+ set_loop_bounds (loop);
+}
+
+
+/* Initialize the scalarization loop. Creates the loop variables. Determines
+ the range of the loop variables. Creates a temporary if required.
+ Also generates code for scalar expressions which have been
+ moved outside the loop. */
+
+void
+gfc_conv_loop_setup (gfc_loopinfo * loop, locus * where)
+{
+ gfc_ss *tmp_ss;
+ tree tmp;
+
+ set_loop_bounds (loop);
/* Add all the scalar code that can be taken out of the loops.
This may include calculating the loop bounds, so do it before
allocating the temporary. */
gfc_add_loop_ss_code (loop, loop->ss, false, where);
+ tmp_ss = loop->temp_ss;
/* If we want a temporary then create it. */
- if (loop->temp_ss != NULL)
+ if (tmp_ss != NULL)
{
- gcc_assert (loop->temp_ss->type == GFC_SS_TEMP);
+ gfc_ss_info *tmp_ss_info;
+
+ tmp_ss_info = tmp_ss->info;
+ gcc_assert (tmp_ss_info->type == GFC_SS_TEMP);
+ gcc_assert (loop->parent == NULL);
/* Make absolutely sure that this is a complete type. */
- if (loop->temp_ss->string_length)
- loop->temp_ss->data.temp.type
+ if (tmp_ss_info->string_length)
+ tmp_ss_info->data.temp.type
= gfc_get_character_type_len_for_eltype
- (TREE_TYPE (loop->temp_ss->data.temp.type),
- loop->temp_ss->string_length);
+ (TREE_TYPE (tmp_ss_info->data.temp.type),
+ tmp_ss_info->string_length);
- tmp = loop->temp_ss->data.temp.type;
- n = loop->temp_ss->data.temp.dimen;
- memset (&loop->temp_ss->data.info, 0, sizeof (gfc_ss_info));
- loop->temp_ss->type = GFC_SS_SECTION;
- loop->temp_ss->data.info.dimen = n;
+ tmp = tmp_ss_info->data.temp.type;
+ memset (&tmp_ss_info->data.array, 0, sizeof (gfc_array_info));
+ tmp_ss_info->type = GFC_SS_SECTION;
- gcc_assert (loop->temp_ss->data.info.dimen != 0);
- for (n = 0; n < loop->temp_ss->data.info.dimen; n++)
- loop->temp_ss->data.info.dim[n] = n;
+ gcc_assert (tmp_ss->dimen != 0);
- gfc_trans_create_temp_array (&loop->pre, &loop->post, loop,
- &loop->temp_ss->data.info, tmp, NULL_TREE,
- false, true, false, where);
+ gfc_trans_create_temp_array (&loop->pre, &loop->post, tmp_ss, tmp,
+ NULL_TREE, false, true, false, where);
}
- for (n = 0; n < loop->temp_dim; n++)
- loopspec[loop->order[n]] = NULL;
-
- mpz_clear (i);
-
/* For array parameters we don't have loop variables, so don't calculate the
translations. */
- if (loop->array_parameter)
- return;
+ if (!loop->array_parameter)
+ gfc_set_delta (loop);
+}
+
+
+/* Calculates how to transform from loop variables to array indices for each
+ array: once loop bounds are chosen, sets the difference (DELTA field) between
+ loop bounds and array reference bounds, for each array info. */
+
+void
+gfc_set_delta (gfc_loopinfo *loop)
+{
+ gfc_ss *ss, **loopspec;
+ gfc_array_info *info;
+ tree tmp;
+ int n, dim;
+
+ loopspec = loop->specloop;
/* Calculate the translation from loop variables to array indices. */
for (ss = loop->ss; ss != gfc_ss_terminator; ss = ss->loop_chain)
{
- if (ss->type != GFC_SS_SECTION && ss->type != GFC_SS_COMPONENT
- && ss->type != GFC_SS_CONSTRUCTOR)
+ gfc_ss_type ss_type;
+ ss_type = ss->info->type;
+ if (ss_type != GFC_SS_SECTION
+ && ss_type != GFC_SS_COMPONENT
+ && ss_type != GFC_SS_CONSTRUCTOR)
continue;
- info = &ss->data.info;
+ info = &ss->info->data.array;
- for (n = 0; n < info->dimen; n++)
+ for (n = 0; n < ss->dimen; n++)
{
/* If we are specifying the range the delta is already set. */
if (loopspec[n] != ss)
{
- dim = ss->data.info.dim[n];
+ dim = ss->dim[n];
/* Calculate the offset relative to the loop variable.
First multiply by the stride. */
@@ -4123,6 +4473,9 @@ gfc_conv_loop_setup (gfc_loopinfo * loop, locus * where)
}
}
}
+
+ for (loop = loop->nested; loop; loop = loop->next)
+ gfc_set_delta (loop);
}
@@ -5662,15 +6015,17 @@ get_array_charlen (gfc_expr *expr, gfc_se *se)
}
}
+
/* Helper function to check dimensions. */
static bool
-dim_ok (gfc_ss_info *info)
+transposed_dims (gfc_ss *ss)
{
int n;
- for (n = 0; n < info->dimen; n++)
- if (info->dim[n] != n)
- return false;
- return true;
+
+ for (n = 0; n < ss->dimen; n++)
+ if (ss->dim[n] != n)
+ return true;
+ return false;
}
/* Convert an array for passing as an actual argument. Expressions and
@@ -5705,8 +6060,10 @@ dim_ok (gfc_ss_info *info)
void
gfc_conv_expr_descriptor (gfc_se * se, gfc_expr * expr, gfc_ss * ss)
{
+ gfc_ss_type ss_type;
+ gfc_ss_info *ss_info;
gfc_loopinfo loop;
- gfc_ss_info *info;
+ gfc_array_info *info;
int need_tmp;
int n;
tree tmp;
@@ -5716,11 +6073,15 @@ gfc_conv_expr_descriptor (gfc_se * se, gfc_expr * expr, gfc_ss * ss)
tree offset;
int full;
bool subref_array_target = false;
- gfc_expr *arg;
+ gfc_expr *arg, *ss_expr;
gcc_assert (ss != NULL);
gcc_assert (ss != gfc_ss_terminator);
+ ss_info = ss->info;
+ ss_type = ss_info->type;
+ ss_expr = ss_info->expr;
+
/* Special case things we know we can pass easily. */
switch (expr->expr_type)
{
@@ -5728,9 +6089,9 @@ gfc_conv_expr_descriptor (gfc_se * se, gfc_expr * expr, gfc_ss * ss)
/* If we have a linear array section, we can pass it directly.
Otherwise we need to copy it into a temporary. */
- gcc_assert (ss->type == GFC_SS_SECTION);
- gcc_assert (ss->expr == expr);
- info = &ss->data.info;
+ gcc_assert (ss_type == GFC_SS_SECTION);
+ gcc_assert (ss_expr == expr);
+ info = &ss_info->data.array;
/* Get the descriptor for the array. */
gfc_conv_ss_descriptor (&se->pre, ss, 0);
@@ -5757,7 +6118,7 @@ gfc_conv_expr_descriptor (gfc_se * se, gfc_expr * expr, gfc_ss * ss)
else
full = gfc_full_array_ref_p (info->ref, NULL);
- if (full && dim_ok (info))
+ if (full && !transposed_dims (ss))
{
if (se->direct_byref && !se->byref_noassign)
{
@@ -5807,7 +6168,7 @@ gfc_conv_expr_descriptor (gfc_se * se, gfc_expr * expr, gfc_ss * ss)
if (se->direct_byref)
{
- gcc_assert (ss->type == GFC_SS_FUNCTION && ss->expr == expr);
+ gcc_assert (ss_type == GFC_SS_FUNCTION && ss_expr == expr);
/* For pointer assignments pass the descriptor directly. */
if (se->ss == NULL)
@@ -5819,16 +6180,17 @@ gfc_conv_expr_descriptor (gfc_se * se, gfc_expr * expr, gfc_ss * ss)
return;
}
- if (ss->expr != expr || ss->type != GFC_SS_FUNCTION)
+ if (ss_expr != expr || ss_type != GFC_SS_FUNCTION)
{
- if (ss->expr != expr)
+ if (ss_expr != expr)
/* Elemental function. */
gcc_assert ((expr->value.function.esym != NULL
&& expr->value.function.esym->attr.elemental)
|| (expr->value.function.isym != NULL
- && expr->value.function.isym->elemental));
+ && expr->value.function.isym->elemental)
+ || gfc_inline_intrinsic_function_p (expr));
else
- gcc_assert (ss->type == GFC_SS_INTRINSIC);
+ gcc_assert (ss_type == GFC_SS_INTRINSIC);
need_tmp = 1;
if (expr->ts.type == BT_CHARACTER
@@ -5840,19 +6202,19 @@ gfc_conv_expr_descriptor (gfc_se * se, gfc_expr * expr, gfc_ss * ss)
else
{
/* Transformational function. */
- info = &ss->data.info;
+ info = &ss_info->data.array;
need_tmp = 0;
}
break;
case EXPR_ARRAY:
/* Constant array constructors don't need a temporary. */
- if (ss->type == GFC_SS_CONSTRUCTOR
+ if (ss_type == GFC_SS_CONSTRUCTOR
&& expr->ts.type != BT_CHARACTER
&& gfc_constant_array_constructor_p (expr->value.constructor))
{
need_tmp = 0;
- info = &ss->data.info;
+ info = &ss_info->data.array;
}
else
{
@@ -5900,8 +6262,8 @@ gfc_conv_expr_descriptor (gfc_se * se, gfc_expr * expr, gfc_ss * ss)
: NULL),
loop.dimen);
- se->string_length = loop.temp_ss->string_length;
- gcc_assert (loop.temp_ss->data.temp.dimen == loop.dimen);
+ se->string_length = loop.temp_ss->info->string_length;
+ gcc_assert (loop.temp_ss->dimen == loop.dimen);
gfc_add_ss_to_loop (&loop, loop.temp_ss);
}
@@ -5952,12 +6314,12 @@ gfc_conv_expr_descriptor (gfc_se * se, gfc_expr * expr, gfc_ss * ss)
/* Finish the copying loops. */
gfc_trans_scalarizing_loops (&loop, &block);
- desc = loop.temp_ss->data.info.descriptor;
+ desc = loop.temp_ss->info->data.array.descriptor;
}
- else if (expr->expr_type == EXPR_FUNCTION && dim_ok (info))
+ else if (expr->expr_type == EXPR_FUNCTION && !transposed_dims (ss))
{
desc = info->descriptor;
- se->string_length = ss->string_length;
+ se->string_length = ss_info->string_length;
}
else
{
@@ -5974,7 +6336,7 @@ gfc_conv_expr_descriptor (gfc_se * se, gfc_expr * expr, gfc_ss * ss)
tree to;
tree base;
- ndim = info->ref ? info->ref->u.ar.dimen : info->dimen;
+ ndim = info->ref ? info->ref->u.ar.dimen : ss->dimen;
if (se->want_coarray)
{
@@ -6058,8 +6420,8 @@ gfc_conv_expr_descriptor (gfc_se * se, gfc_expr * expr, gfc_ss * ss)
&& info->ref->u.ar.dimen_type[n] == DIMEN_ELEMENT)
{
gcc_assert (info->subscript[n]
- && info->subscript[n]->type == GFC_SS_SCALAR);
- start = info->subscript[n]->data.scalar.expr;
+ && info->subscript[n]->info->type == GFC_SS_SCALAR);
+ start = info->subscript[n]->info->data.scalar.value;
}
else
{
@@ -6089,7 +6451,7 @@ gfc_conv_expr_descriptor (gfc_se * se, gfc_expr * expr, gfc_ss * ss)
/* look for the corresponding scalarizer dimension: dim. */
for (dim = 0; dim < ndim; dim++)
- if (info->dim[dim] == n)
+ if (ss->dim[dim] == n)
break;
/* loop exited early: the DIM being looked for has been found. */
@@ -7145,6 +7507,7 @@ gfc_alloc_allocatable_for_assignment (gfc_loopinfo *loop,
stmtblock_t fblock;
gfc_ss *rss;
gfc_ss *lss;
+ gfc_array_info *linfo;
tree realloc_expr;
tree alloc_expr;
tree size1;
@@ -7175,11 +7538,11 @@ gfc_alloc_allocatable_for_assignment (gfc_loopinfo *loop,
/* Find the ss for the lhs. */
lss = loop->ss;
for (; lss && lss != gfc_ss_terminator; lss = lss->loop_chain)
- if (lss->expr && lss->expr->expr_type == EXPR_VARIABLE)
+ if (lss->info->expr && lss->info->expr->expr_type == EXPR_VARIABLE)
break;
if (lss == gfc_ss_terminator)
return NULL_TREE;
- expr1 = lss->expr;
+ expr1 = lss->info->expr;
}
/* Bail out if this is not a valid allocate on assignment. */
@@ -7190,17 +7553,19 @@ gfc_alloc_allocatable_for_assignment (gfc_loopinfo *loop,
/* Find the ss for the lhs. */
lss = loop->ss;
for (; lss && lss != gfc_ss_terminator; lss = lss->loop_chain)
- if (lss->expr == expr1)
+ if (lss->info->expr == expr1)
break;
if (lss == gfc_ss_terminator)
return NULL_TREE;
+ linfo = &lss->info->data.array;
+
/* Find an ss for the rhs. For operator expressions, we see the
ss's for the operands. Any one of these will do. */
rss = loop->ss;
for (; rss && rss != gfc_ss_terminator; rss = rss->loop_chain)
- if (rss->expr != expr1 && rss != loop->temp_ss)
+ if (rss->info->expr != expr1 && rss != loop->temp_ss)
break;
if (expr2 && rss == gfc_ss_terminator)
@@ -7210,7 +7575,7 @@ gfc_alloc_allocatable_for_assignment (gfc_loopinfo *loop,
/* Since the lhs is allocatable, this must be a descriptor type.
Get the data and array size. */
- desc = lss->data.info.descriptor;
+ desc = linfo->descriptor;
gcc_assert (GFC_DESCRIPTOR_TYPE_P (TREE_TYPE (desc)));
array1 = gfc_conv_descriptor_data_get (desc);
@@ -7280,7 +7645,7 @@ gfc_alloc_allocatable_for_assignment (gfc_loopinfo *loop,
/* Get the rhs size. Fix both sizes. */
if (expr2)
- desc2 = rss->data.info.descriptor;
+ desc2 = rss->info->data.array.descriptor;
else
desc2 = NULL_TREE;
size2 = gfc_index_one_node;
@@ -7370,21 +7735,21 @@ gfc_alloc_allocatable_for_assignment (gfc_loopinfo *loop,
running offset. Use the saved_offset instead. */
tmp = gfc_conv_descriptor_offset (desc);
gfc_add_modify (&fblock, tmp, offset);
- if (lss->data.info.saved_offset
- && TREE_CODE (lss->data.info.saved_offset) == VAR_DECL)
- gfc_add_modify (&fblock, lss->data.info.saved_offset, tmp);
+ if (linfo->saved_offset
+ && TREE_CODE (linfo->saved_offset) == VAR_DECL)
+ gfc_add_modify (&fblock, linfo->saved_offset, tmp);
/* Now set the deltas for the lhs. */
for (n = 0; n < expr1->rank; n++)
{
tmp = gfc_conv_descriptor_lbound_get (desc, gfc_rank_cst[n]);
- dim = lss->data.info.dim[n];
+ dim = lss->dim[n];
tmp = fold_build2_loc (input_location, MINUS_EXPR,
gfc_array_index_type, tmp,
loop->from[dim]);
- if (lss->data.info.delta[dim]
- && TREE_CODE (lss->data.info.delta[dim]) == VAR_DECL)
- gfc_add_modify (&fblock, lss->data.info.delta[dim], tmp);
+ if (linfo->delta[dim]
+ && TREE_CODE (linfo->delta[dim]) == VAR_DECL)
+ gfc_add_modify (&fblock, linfo->delta[dim], tmp);
}
/* Get the new lhs size in bytes. */
@@ -7448,11 +7813,11 @@ gfc_alloc_allocatable_for_assignment (gfc_loopinfo *loop,
gfc_add_expr_to_block (&fblock, tmp);
/* Make sure that the scalarizer data pointer is updated. */
- if (lss->data.info.data
- && TREE_CODE (lss->data.info.data) == VAR_DECL)
+ if (linfo->data
+ && TREE_CODE (linfo->data) == VAR_DECL)
{
tmp = gfc_conv_descriptor_data_get (desc);
- gfc_add_modify (&fblock, lss->data.info.data, tmp);
+ gfc_add_modify (&fblock, linfo->data, tmp);
}
/* Add the exit label. */
@@ -7636,13 +8001,13 @@ gfc_walk_array_ref (gfc_ss * ss, gfc_expr * expr, gfc_ref * ref)
switch (ar->type)
{
case AR_ELEMENT:
- for (n = ar->dimen + ar->codimen - 1; n >= 0; n--)
+ for (n = ar->dimen - 1; n >= 0; n--)
ss = gfc_get_scalar_ss (ss, ar->start[n]);
break;
case AR_FULL:
newss = gfc_get_array_ss (ss, expr, ar->as->rank, GFC_SS_SECTION);
- newss->data.info.ref = ref;
+ newss->info->data.array.ref = ref;
/* Make sure array is the same as array(:,:), this way
we don't need to special case all the time. */
@@ -7660,7 +8025,7 @@ gfc_walk_array_ref (gfc_ss * ss, gfc_expr * expr, gfc_ref * ref)
case AR_SECTION:
newss = gfc_get_array_ss (ss, expr, 0, GFC_SS_SECTION);
- newss->data.info.ref = ref;
+ newss->info->data.array.ref = ref;
/* We add SS chains for all the subscripts in the section. */
for (n = 0; n < ar->dimen; n++)
@@ -7674,14 +8039,14 @@ gfc_walk_array_ref (gfc_ss * ss, gfc_expr * expr, gfc_ref * ref)
gcc_assert (ar->start[n]);
indexss = gfc_get_scalar_ss (gfc_ss_terminator, ar->start[n]);
indexss->loop_chain = gfc_ss_terminator;
- newss->data.info.subscript[n] = indexss;
+ newss->info->data.array.subscript[n] = indexss;
break;
case DIMEN_RANGE:
/* We don't add anything for sections, just remember this
dimension for later. */
- newss->data.info.dim[newss->data.info.dimen] = n;
- newss->data.info.dimen++;
+ newss->dim[newss->dimen] = n;
+ newss->dimen++;
break;
case DIMEN_VECTOR:
@@ -7690,9 +8055,9 @@ gfc_walk_array_ref (gfc_ss * ss, gfc_expr * expr, gfc_ref * ref)
indexss = gfc_get_array_ss (gfc_ss_terminator, ar->start[n],
1, GFC_SS_VECTOR);
indexss->loop_chain = gfc_ss_terminator;
- newss->data.info.subscript[n] = indexss;
- newss->data.info.dim[newss->data.info.dimen] = n;
- newss->data.info.dimen++;
+ newss->info->data.array.subscript[n] = indexss;
+ newss->dim[newss->dimen] = n;
+ newss->dimen++;
break;
default:
@@ -7702,8 +8067,8 @@ gfc_walk_array_ref (gfc_ss * ss, gfc_expr * expr, gfc_ref * ref)
}
/* We should have at least one non-elemental dimension,
unless we are creating a descriptor for a (scalar) coarray. */
- gcc_assert (newss->data.info.dimen > 0
- || newss->data.info.ref->u.ar.as->corank > 0);
+ gcc_assert (newss->dimen > 0
+ || newss->info->data.array.ref->u.ar.as->corank > 0);
ss = newss;
break;
@@ -7814,7 +8179,7 @@ gfc_walk_elemental_function_args (gfc_ss * ss, gfc_actual_arglist *arg,
/* Scalar argument. */
gcc_assert (type == GFC_SS_SCALAR || type == GFC_SS_REFERENCE);
newss = gfc_get_scalar_ss (head, arg->expr);
- newss->type = type;
+ newss->info->type = type;
}
else
scalar = 0;
diff --git a/gcc/fortran/trans-array.h b/gcc/fortran/trans-array.h
index 4d737bde94f..bd593bdb487 100644
--- a/gcc/fortran/trans-array.h
+++ b/gcc/fortran/trans-array.h
@@ -31,9 +31,8 @@ void gfc_set_loop_bounds_from_array_spec (gfc_interface_mapping *,
gfc_se *, gfc_array_spec *);
/* Generate code to create a temporary array. */
-tree gfc_trans_create_temp_array (stmtblock_t *, stmtblock_t *, gfc_loopinfo *,
- gfc_ss_info *, tree, tree, bool, bool, bool,
- locus *);
+tree gfc_trans_create_temp_array (stmtblock_t *, stmtblock_t *, gfc_ss *,
+ tree, tree, bool, bool, bool, locus *);
/* Generate function entry code for allocation of compiler allocated array
variables. */
@@ -89,6 +88,8 @@ void gfc_add_ss_to_loop (gfc_loopinfo *, gfc_ss *);
void gfc_mark_ss_chain_used (gfc_ss *, unsigned);
/* Free a gfc_ss chain. */
void gfc_free_ss_chain (gfc_ss *);
+/* Free a single gfc_ss element. */
+void gfc_free_ss (gfc_ss *);
/* Allocate a new array type ss. */
gfc_ss *gfc_get_array_ss (gfc_ss *, gfc_expr *, int, gfc_ss_type);
/* Allocate a new temporary type ss. */
@@ -112,6 +113,8 @@ void gfc_trans_scalarizing_loops (gfc_loopinfo *, stmtblock_t *);
void gfc_trans_scalarized_loop_boundary (gfc_loopinfo *, stmtblock_t *);
/* Initialize the scalarization loop parameters. */
void gfc_conv_loop_setup (gfc_loopinfo *, locus *);
+/* Set each array's delta. */
+void gfc_set_delta (gfc_loopinfo *);
/* Resolve array assignment dependencies. */
void gfc_conv_resolve_dependencies (gfc_loopinfo *, gfc_ss *, gfc_ss *);
/* Build a null array descriptor constructor. */
diff --git a/gcc/fortran/trans-const.c b/gcc/fortran/trans-const.c
index 5fbe765c493..fa820ef10de 100644
--- a/gcc/fortran/trans-const.c
+++ b/gcc/fortran/trans-const.c
@@ -358,6 +358,8 @@ gfc_conv_constant_to_tree (gfc_expr * expr)
void
gfc_conv_constant (gfc_se * se, gfc_expr * expr)
{
+ gfc_ss *ss;
+
/* We may be receiving an expression for C_NULL_PTR or C_NULL_FUNPTR. If
so, the expr_type will not yet be an EXPR_CONSTANT. We need to make
it so here. */
@@ -380,14 +382,18 @@ gfc_conv_constant (gfc_se * se, gfc_expr * expr)
return;
}
- if (se->ss != NULL)
+ ss = se->ss;
+ if (ss != NULL)
{
- gcc_assert (se->ss != gfc_ss_terminator);
- gcc_assert (se->ss->type == GFC_SS_SCALAR);
- gcc_assert (se->ss->expr == expr);
+ gfc_ss_info *ss_info;
+
+ ss_info = ss->info;
+ gcc_assert (ss != gfc_ss_terminator);
+ gcc_assert (ss_info->type == GFC_SS_SCALAR);
+ gcc_assert (ss_info->expr == expr);
- se->expr = se->ss->data.scalar.expr;
- se->string_length = se->ss->string_length;
+ se->expr = ss_info->data.scalar.value;
+ se->string_length = ss_info->string_length;
gfc_advance_se_ss_chain (se);
return;
}
diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c
index b7460b779e2..b90b0ab25b6 100644
--- a/gcc/fortran/trans-decl.c
+++ b/gcc/fortran/trans-decl.c
@@ -517,6 +517,10 @@ gfc_finish_var_decl (tree decl, gfc_symbol * sym)
/* If it wasn't used we wouldn't be getting it. */
TREE_USED (decl) = 1;
+ if (sym->attr.flavor == FL_PARAMETER
+ && (sym->attr.dimension || sym->ts.type == BT_DERIVED))
+ TREE_READONLY (decl) = 1;
+
/* Chain this decl to the pending declarations. Don't do pushdecl()
because this would add them to the current scope rather than the
function scope. */
diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c
index 09b98d03faf..cf9f0f7cdb9 100644
--- a/gcc/fortran/trans-expr.c
+++ b/gcc/fortran/trans-expr.c
@@ -83,6 +83,7 @@ void
gfc_advance_se_ss_chain (gfc_se * se)
{
gfc_se *p;
+ gfc_ss *ss;
gcc_assert (se != NULL && se->ss != NULL && se->ss != gfc_ss_terminator);
@@ -91,9 +92,18 @@ gfc_advance_se_ss_chain (gfc_se * se)
while (p != NULL)
{
/* Simple consistency check. */
- gcc_assert (p->parent == NULL || p->parent->ss == p->ss);
+ gcc_assert (p->parent == NULL || p->parent->ss == p->ss
+ || p->parent->ss->nested_ss == p->ss);
+
+ /* If we were in a nested loop, the next scalarized expression can be
+ on the parent ss' next pointer. Thus we should not take the next
+ pointer blindly, but rather go up one nest level as long as next
+ is the end of chain. */
+ ss = p->ss;
+ while (ss->next == gfc_ss_terminator && ss->parent != NULL)
+ ss = ss->parent;
- p->ss = p->ss->next;
+ p->ss = ss->next;
p = p->parent;
}
@@ -613,6 +623,7 @@ conv_parent_component_references (gfc_se * se, gfc_ref * ref)
static void
gfc_conv_variable (gfc_se * se, gfc_expr * expr)
{
+ gfc_ss *ss;
gfc_ref *ref;
gfc_symbol *sym;
tree parent_decl = NULL_TREE;
@@ -622,16 +633,19 @@ gfc_conv_variable (gfc_se * se, gfc_expr * expr)
bool entry_master;
sym = expr->symtree->n.sym;
- if (se->ss != NULL)
+ ss = se->ss;
+ if (ss != NULL)
{
+ gfc_ss_info *ss_info = ss->info;
+
/* Check that something hasn't gone horribly wrong. */
- gcc_assert (se->ss != gfc_ss_terminator);
- gcc_assert (se->ss->expr == expr);
+ gcc_assert (ss != gfc_ss_terminator);
+ gcc_assert (ss_info->expr == expr);
/* A scalarized term. We already know the descriptor. */
- se->expr = se->ss->data.info.descriptor;
- se->string_length = se->ss->string_length;
- for (ref = se->ss->data.info.ref; ref; ref = ref->next)
+ se->expr = ss_info->data.array.descriptor;
+ se->string_length = ss_info->string_length;
+ for (ref = ss_info->data.array.ref; ref; ref = ref->next)
if (ref->type == REF_ARRAY && ref->u.ar.type != AR_ELEMENT)
break;
}
@@ -2359,7 +2373,7 @@ gfc_conv_subref_array_arg (gfc_se * parmse, gfc_expr * expr, int g77,
gfc_ss *rss;
gfc_loopinfo loop;
gfc_loopinfo loop2;
- gfc_ss_info *info;
+ gfc_array_info *info;
tree offset;
tree tmp_index;
tree tmp;
@@ -2400,7 +2414,7 @@ gfc_conv_subref_array_arg (gfc_se * parmse, gfc_expr * expr, int g77,
: NULL),
loop.dimen);
- parmse->string_length = loop.temp_ss->string_length;
+ parmse->string_length = loop.temp_ss->info->string_length;
/* Associate the SS with the loop. */
gfc_add_ss_to_loop (&loop, loop.temp_ss);
@@ -2409,7 +2423,7 @@ gfc_conv_subref_array_arg (gfc_se * parmse, gfc_expr * expr, int g77,
gfc_conv_loop_setup (&loop, &expr->where);
/* Pass the temporary descriptor back to the caller. */
- info = &loop.temp_ss->data.info;
+ info = &loop.temp_ss->info->data.array;
parmse->expr = info->descriptor;
/* Setup the gfc_se structures. */
@@ -2488,8 +2502,8 @@ gfc_conv_subref_array_arg (gfc_se * parmse, gfc_expr * expr, int g77,
dimensions, so this is very simple. The offset is only computed
outside the innermost loop, so the overall transfer could be
optimized further. */
- info = &rse.ss->data.info;
- dimen = info->dimen;
+ info = &rse.ss->info->data.array;
+ dimen = rse.ss->dimen;
tmp_index = gfc_index_zero_node;
for (n = dimen - 1; n > 0; n--)
@@ -2854,7 +2868,7 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym,
tree fntype;
gfc_se parmse;
gfc_ss *argss;
- gfc_ss_info *info;
+ gfc_array_info *info;
int byref;
int parm_kind;
tree type;
@@ -2893,8 +2907,8 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym,
{
if (!sym->attr.elemental)
{
- gcc_assert (se->ss->type == GFC_SS_FUNCTION);
- if (se->ss->useflags)
+ gcc_assert (se->ss->info->type == GFC_SS_FUNCTION);
+ if (se->ss->info->useflags)
{
gcc_assert ((!comp && gfc_return_by_reference (sym)
&& sym->result->attr.dimension)
@@ -2906,7 +2920,7 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym,
return 0;
}
}
- info = &se->ss->data.info;
+ info = &se->ss->info->data.array;
}
else
info = NULL;
@@ -2979,12 +2993,23 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym,
gfc_init_se (&parmse, se);
gfc_conv_derived_to_class (&parmse, e, fsym->ts);
}
- else if (se->ss && se->ss->useflags)
+ else if (se->ss && se->ss->info->useflags)
{
/* An elemental function inside a scalarized loop. */
gfc_init_se (&parmse, se);
- gfc_conv_expr_reference (&parmse, e);
parm_kind = ELEMENTAL;
+
+ if (se->ss->dimen > 0
+ && se->ss->info->data.array.ref == NULL)
+ {
+ gfc_conv_tmp_array_ref (&parmse);
+ if (e->ts.type == BT_CHARACTER)
+ gfc_conv_string_parameter (&parmse);
+ else
+ parmse.expr = gfc_build_addr_expr (NULL_TREE, parmse.expr);
+ }
+ else
+ gfc_conv_expr_reference (&parmse, e);
}
else
{
@@ -3582,7 +3607,7 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym,
/* Set the type of the array. */
tmp = gfc_typenode_for_spec (&comp->ts);
- gcc_assert (info->dimen == se->loop->dimen);
+ gcc_assert (se->ss->dimen == se->loop->dimen);
/* Evaluate the bounds of the result, if known. */
gfc_set_loop_bounds_from_array_spec (&mapping, se, comp->as);
@@ -3602,9 +3627,10 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym,
returns a pointer, the temporary will be a shallow copy and
mustn't be deallocated. */
callee_alloc = comp->attr.allocatable || comp->attr.pointer;
- gfc_trans_create_temp_array (&se->pre, &se->post, se->loop, info, tmp,
- NULL_TREE, false, !comp->attr.pointer,
- callee_alloc, &se->ss->expr->where);
+ gfc_trans_create_temp_array (&se->pre, &se->post, se->ss,
+ tmp, NULL_TREE, false,
+ !comp->attr.pointer, callee_alloc,
+ &se->ss->info->expr->where);
/* Pass the temporary as the first argument. */
result = info->descriptor;
@@ -3617,7 +3643,7 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym,
/* Set the type of the array. */
tmp = gfc_typenode_for_spec (&ts);
- gcc_assert (info->dimen == se->loop->dimen);
+ gcc_assert (se->ss->dimen == se->loop->dimen);
/* Evaluate the bounds of the result, if known. */
gfc_set_loop_bounds_from_array_spec (&mapping, se, sym->result->as);
@@ -3637,9 +3663,10 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym,
returns a pointer, the temporary will be a shallow copy and
mustn't be deallocated. */
callee_alloc = sym->attr.allocatable || sym->attr.pointer;
- gfc_trans_create_temp_array (&se->pre, &se->post, se->loop, info, tmp,
- NULL_TREE, false, !sym->attr.pointer,
- callee_alloc, &se->ss->expr->where);
+ gfc_trans_create_temp_array (&se->pre, &se->post, se->ss,
+ tmp, NULL_TREE, false,
+ !sym->attr.pointer, callee_alloc,
+ &se->ss->info->expr->where);
/* Pass the temporary as the first argument. */
result = info->descriptor;
@@ -4237,8 +4264,11 @@ is_zero_initializer_p (gfc_expr * expr)
static void
gfc_conv_array_constructor_expr (gfc_se * se, gfc_expr * expr)
{
- gcc_assert (se->ss != NULL && se->ss != gfc_ss_terminator);
- gcc_assert (se->ss->expr == expr && se->ss->type == GFC_SS_CONSTRUCTOR);
+ gfc_ss *ss;
+
+ ss = se->ss;
+ gcc_assert (ss != NULL && ss != gfc_ss_terminator);
+ gcc_assert (ss->info->expr == expr && ss->info->type == GFC_SS_CONSTRUCTOR);
gfc_conv_tmp_array_ref (se);
}
@@ -4342,6 +4372,7 @@ gfc_trans_subarray_assign (tree dest, gfc_component * cm, gfc_expr * expr)
gfc_se lse;
gfc_ss *rss;
gfc_ss *lss;
+ gfc_array_info *lss_array;
stmtblock_t body;
stmtblock_t block;
gfc_loopinfo loop;
@@ -4365,19 +4396,20 @@ gfc_trans_subarray_assign (tree dest, gfc_component * cm, gfc_expr * expr)
/* Create a SS for the destination. */
lss = gfc_get_array_ss (gfc_ss_terminator, NULL, cm->as->rank,
GFC_SS_COMPONENT);
- lss->shape = gfc_get_shape (cm->as->rank);
- lss->data.info.descriptor = dest;
- lss->data.info.data = gfc_conv_array_data (dest);
- lss->data.info.offset = gfc_conv_array_offset (dest);
+ lss_array = &lss->info->data.array;
+ lss_array->shape = gfc_get_shape (cm->as->rank);
+ lss_array->descriptor = dest;
+ lss_array->data = gfc_conv_array_data (dest);
+ lss_array->offset = gfc_conv_array_offset (dest);
for (n = 0; n < cm->as->rank; n++)
{
- lss->data.info.start[n] = gfc_conv_array_lbound (dest, n);
- lss->data.info.stride[n] = gfc_index_one_node;
+ lss_array->start[n] = gfc_conv_array_lbound (dest, n);
+ lss_array->stride[n] = gfc_index_one_node;
- mpz_init (lss->shape[n]);
- mpz_sub (lss->shape[n], cm->as->upper[n]->value.integer,
+ mpz_init (lss_array->shape[n]);
+ mpz_sub (lss_array->shape[n], cm->as->upper[n]->value.integer,
cm->as->lower[n]->value.integer);
- mpz_add_ui (lss->shape[n], lss->shape[n], 1);
+ mpz_add_ui (lss_array->shape[n], lss_array->shape[n], 1);
}
/* Associate the SS with the loop. */
@@ -4420,8 +4452,8 @@ gfc_trans_subarray_assign (tree dest, gfc_component * cm, gfc_expr * expr)
gfc_add_block_to_block (&block, &loop.pre);
gfc_add_block_to_block (&block, &loop.post);
- gcc_assert (lss->shape != NULL);
- gfc_free_shape (&lss->shape, cm->as->rank);
+ gcc_assert (lss_array->shape != NULL);
+ gfc_free_shape (&lss_array->shape, cm->as->rank);
gfc_cleanup_loop (&loop);
return gfc_finish_block (&block);
@@ -4817,15 +4849,22 @@ gfc_conv_substring_expr (gfc_se * se, gfc_expr * expr)
void
gfc_conv_expr (gfc_se * se, gfc_expr * expr)
{
- if (se->ss && se->ss->expr == expr
- && (se->ss->type == GFC_SS_SCALAR || se->ss->type == GFC_SS_REFERENCE))
+ gfc_ss *ss;
+
+ ss = se->ss;
+ if (ss && ss->info->expr == expr
+ && (ss->info->type == GFC_SS_SCALAR
+ || ss->info->type == GFC_SS_REFERENCE))
{
+ gfc_ss_info *ss_info;
+
+ ss_info = ss->info;
/* Substitute a scalar expression evaluated outside the scalarization
loop. */
- se->expr = se->ss->data.scalar.expr;
- if (se->ss->type == GFC_SS_REFERENCE)
+ se->expr = ss_info->data.scalar.value;
+ if (ss_info->type == GFC_SS_REFERENCE)
se->expr = gfc_build_addr_expr (NULL_TREE, se->expr);
- se->string_length = se->ss->string_length;
+ se->string_length = ss_info->string_length;
gfc_advance_se_ss_chain (se);
return;
}
@@ -4942,10 +4981,12 @@ gfc_conv_expr_type (gfc_se * se, gfc_expr * expr, tree type)
void
gfc_conv_expr_reference (gfc_se * se, gfc_expr * expr)
{
+ gfc_ss *ss;
tree var;
- if (se->ss && se->ss->expr == expr
- && se->ss->type == GFC_SS_REFERENCE)
+ ss = se->ss;
+ if (ss && ss->info->expr == expr
+ && ss->info->type == GFC_SS_REFERENCE)
{
/* Returns a reference to the scalar evaluated outside the loop
for this case. */
@@ -6150,7 +6191,7 @@ gfc_trans_assignment_1 (gfc_expr * expr1, gfc_expr * expr2, bool init_flag,
/* Find a non-scalar SS from the lhs. */
while (lss_section != gfc_ss_terminator
- && lss_section->type != GFC_SS_SECTION)
+ && lss_section->info->type != GFC_SS_SECTION)
lss_section = lss_section->next;
gcc_assert (lss_section != gfc_ss_terminator);
diff --git a/gcc/fortran/trans-intrinsic.c b/gcc/fortran/trans-intrinsic.c
index 83fc4fc52ef..4244570a7e9 100644
--- a/gcc/fortran/trans-intrinsic.c
+++ b/gcc/fortran/trans-intrinsic.c
@@ -1004,7 +1004,7 @@ trans_this_image (gfc_se * se, gfc_expr *expr)
gcc_assert (!expr->value.function.actual->next->expr);
gcc_assert (corank > 0);
gcc_assert (se->loop->dimen == 1);
- gcc_assert (se->ss->expr == expr);
+ gcc_assert (se->ss->info->expr == expr);
dim_arg = se->loop->loopvar[0];
dim_arg = fold_build2_loc (input_location, PLUS_EXPR,
@@ -1321,7 +1321,7 @@ gfc_conv_intrinsic_bound (gfc_se * se, gfc_expr * expr, int upper)
/* Create an implicit second parameter from the loop variable. */
gcc_assert (!arg2->expr);
gcc_assert (se->loop->dimen == 1);
- gcc_assert (se->ss->expr == expr);
+ gcc_assert (se->ss->info->expr == expr);
gfc_advance_se_ss_chain (se);
bound = se->loop->loopvar[0];
bound = fold_build2_loc (input_location, MINUS_EXPR,
@@ -1515,7 +1515,7 @@ conv_intrinsic_cobound (gfc_se * se, gfc_expr * expr)
gcc_assert (!arg2->expr);
gcc_assert (corank > 0);
gcc_assert (se->loop->dimen == 1);
- gcc_assert (se->ss->expr == expr);
+ gcc_assert (se->ss->info->expr == expr);
bound = se->loop->loopvar[0];
bound = fold_build2_loc (input_location, PLUS_EXPR, gfc_array_index_type,
@@ -2323,7 +2323,7 @@ gfc_conv_intrinsic_funcall (gfc_se * se, gfc_expr * expr)
gfc_symbol *sym;
VEC(tree,gc) *append_args;
- gcc_assert (!se->ss || se->ss->expr == expr);
+ gcc_assert (!se->ss || se->ss->info->expr == expr);
if (se->ss)
gcc_assert (expr->rank > 0);
@@ -2557,6 +2557,20 @@ gfc_conv_intrinsic_count (gfc_se * se, gfc_expr * expr)
se->expr = resvar;
}
+
+/* Update given gfc_se to have ss component pointing to the nested gfc_ss
+ struct and return the corresponding loopinfo. */
+
+static gfc_loopinfo *
+enter_nested_loop (gfc_se *se)
+{
+ se->ss = se->ss->nested_ss;
+ gcc_assert (se->ss == se->ss->loop->ss);
+
+ return se->ss->loop;
+}
+
+
/* Inline implementation of the sum and product intrinsics. */
static void
gfc_conv_intrinsic_arith (gfc_se * se, gfc_expr * expr, enum tree_code op,
@@ -2568,20 +2582,23 @@ gfc_conv_intrinsic_arith (gfc_se * se, gfc_expr * expr, enum tree_code op,
stmtblock_t body;
stmtblock_t block;
tree tmp;
- gfc_loopinfo loop;
- gfc_actual_arglist *actual;
- gfc_ss *arrayss;
- gfc_ss *maskss;
+ gfc_loopinfo loop, *ploop;
+ gfc_actual_arglist *arg_array, *arg_mask;
+ gfc_ss *arrayss = NULL;
+ gfc_ss *maskss = NULL;
gfc_se arrayse;
gfc_se maskse;
+ gfc_se *parent_se;
gfc_expr *arrayexpr;
gfc_expr *maskexpr;
- if (se->ss)
+ if (expr->rank > 0)
{
- gfc_conv_intrinsic_funcall (se, expr);
- return;
+ gcc_assert (gfc_inline_intrinsic_function_p (expr));
+ parent_se = se;
}
+ else
+ parent_se = NULL;
type = gfc_typenode_for_spec (&expr->ts);
/* Initialize the result. */
@@ -2608,52 +2625,66 @@ gfc_conv_intrinsic_arith (gfc_se * se, gfc_expr * expr, enum tree_code op,
gfc_add_modify (&se->pre, resvar, tmp);
- /* Walk the arguments. */
- actual = expr->value.function.actual;
- arrayexpr = actual->expr;
- arrayss = gfc_walk_expr (arrayexpr);
- gcc_assert (arrayss != gfc_ss_terminator);
+ arg_array = expr->value.function.actual;
+
+ arrayexpr = arg_array->expr;
if (op == NE_EXPR || norm2)
/* PARITY and NORM2. */
maskexpr = NULL;
else
{
- actual = actual->next->next;
- gcc_assert (actual);
- maskexpr = actual->expr;
+ arg_mask = arg_array->next->next;
+ gcc_assert (arg_mask != NULL);
+ maskexpr = arg_mask->expr;
}
- if (maskexpr && maskexpr->rank != 0)
+ if (expr->rank == 0)
{
- maskss = gfc_walk_expr (maskexpr);
- gcc_assert (maskss != gfc_ss_terminator);
+ /* Walk the arguments. */
+ arrayss = gfc_walk_expr (arrayexpr);
+ gcc_assert (arrayss != gfc_ss_terminator);
+
+ if (maskexpr && maskexpr->rank > 0)
+ {
+ maskss = gfc_walk_expr (maskexpr);
+ gcc_assert (maskss != gfc_ss_terminator);
+ }
+ else
+ maskss = NULL;
+
+ /* Initialize the scalarizer. */
+ gfc_init_loopinfo (&loop);
+ gfc_add_ss_to_loop (&loop, arrayss);
+ if (maskexpr && maskexpr->rank > 0)
+ gfc_add_ss_to_loop (&loop, maskss);
+
+ /* Initialize the loop. */
+ gfc_conv_ss_startstride (&loop);
+ gfc_conv_loop_setup (&loop, &expr->where);
+
+ gfc_mark_ss_chain_used (arrayss, 1);
+ if (maskexpr && maskexpr->rank > 0)
+ gfc_mark_ss_chain_used (maskss, 1);
+
+ ploop = &loop;
}
else
- maskss = NULL;
-
- /* Initialize the scalarizer. */
- gfc_init_loopinfo (&loop);
- gfc_add_ss_to_loop (&loop, arrayss);
- if (maskss)
- gfc_add_ss_to_loop (&loop, maskss);
+ /* All the work has been done in the parent loops. */
+ ploop = enter_nested_loop (se);
- /* Initialize the loop. */
- gfc_conv_ss_startstride (&loop);
- gfc_conv_loop_setup (&loop, &expr->where);
+ gcc_assert (ploop);
- gfc_mark_ss_chain_used (arrayss, 1);
- if (maskss)
- gfc_mark_ss_chain_used (maskss, 1);
/* Generate the loop body. */
- gfc_start_scalarized_body (&loop, &body);
+ gfc_start_scalarized_body (ploop, &body);
/* If we have a mask, only add this element if the mask is set. */
- if (maskss)
+ if (maskexpr && maskexpr->rank > 0)
{
- gfc_init_se (&maskse, NULL);
- gfc_copy_loopinfo_to_se (&maskse, &loop);
- maskse.ss = maskss;
+ gfc_init_se (&maskse, parent_se);
+ gfc_copy_loopinfo_to_se (&maskse, ploop);
+ if (expr->rank == 0)
+ maskse.ss = maskss;
gfc_conv_expr_val (&maskse, maskexpr);
gfc_add_block_to_block (&body, &maskse.pre);
@@ -2663,9 +2694,10 @@ gfc_conv_intrinsic_arith (gfc_se * se, gfc_expr * expr, enum tree_code op,
gfc_init_block (&block);
/* Do the actual summation/product. */
- gfc_init_se (&arrayse, NULL);
- gfc_copy_loopinfo_to_se (&arrayse, &loop);
- arrayse.ss = arrayss;
+ gfc_init_se (&arrayse, parent_se);
+ gfc_copy_loopinfo_to_se (&arrayse, ploop);
+ if (expr->rank == 0)
+ arrayse.ss = arrayss;
gfc_conv_expr_val (&arrayse, arrayexpr);
gfc_add_block_to_block (&block, &arrayse.pre);
@@ -2740,7 +2772,7 @@ gfc_conv_intrinsic_arith (gfc_se * se, gfc_expr * expr, enum tree_code op,
gfc_add_block_to_block (&block, &arrayse.post);
- if (maskss)
+ if (maskexpr && maskexpr->rank > 0)
{
/* We enclose the above in if (mask) {...} . */
@@ -2752,30 +2784,43 @@ gfc_conv_intrinsic_arith (gfc_se * se, gfc_expr * expr, enum tree_code op,
tmp = gfc_finish_block (&block);
gfc_add_expr_to_block (&body, tmp);
- gfc_trans_scalarizing_loops (&loop, &body);
+ gfc_trans_scalarizing_loops (ploop, &body);
/* For a scalar mask, enclose the loop in an if statement. */
- if (maskexpr && maskss == NULL)
+ if (maskexpr && maskexpr->rank == 0)
{
- gfc_init_se (&maskse, NULL);
- gfc_conv_expr_val (&maskse, maskexpr);
gfc_init_block (&block);
- gfc_add_block_to_block (&block, &loop.pre);
- gfc_add_block_to_block (&block, &loop.post);
+ gfc_add_block_to_block (&block, &ploop->pre);
+ gfc_add_block_to_block (&block, &ploop->post);
tmp = gfc_finish_block (&block);
- tmp = build3_v (COND_EXPR, maskse.expr, tmp,
- build_empty_stmt (input_location));
+ if (expr->rank > 0)
+ {
+ tmp = build3_v (COND_EXPR, se->ss->info->data.scalar.value, tmp,
+ build_empty_stmt (input_location));
+ gfc_advance_se_ss_chain (se);
+ }
+ else
+ {
+ gcc_assert (expr->rank == 0);
+ gfc_init_se (&maskse, NULL);
+ gfc_conv_expr_val (&maskse, maskexpr);
+ tmp = build3_v (COND_EXPR, maskse.expr, tmp,
+ build_empty_stmt (input_location));
+ }
+
gfc_add_expr_to_block (&block, tmp);
gfc_add_block_to_block (&se->pre, &block);
+ gcc_assert (se->post.head == NULL);
}
else
{
- gfc_add_block_to_block (&se->pre, &loop.pre);
- gfc_add_block_to_block (&se->pre, &loop.post);
+ gfc_add_block_to_block (&se->pre, &ploop->pre);
+ gfc_add_block_to_block (&se->pre, &ploop->post);
}
- gfc_cleanup_loop (&loop);
+ if (expr->rank == 0)
+ gfc_cleanup_loop (ploop);
if (norm2)
{
@@ -3061,6 +3106,23 @@ gfc_conv_intrinsic_minmaxloc (gfc_se * se, gfc_expr * expr, enum tree_code op)
/* Initialize the loop. */
gfc_conv_ss_startstride (&loop);
+
+ /* The code generated can have more than one loop in sequence (see the
+ comment at the function header). This doesn't work well with the
+ scalarizer, which changes arrays' offset when the scalarization loops
+ are generated (see gfc_trans_preloop_setup). Fortunately, {min,max}loc
+ are currently inlined in the scalar case only (for which loop is of rank
+ one). As there is no dependency to care about in that case, there is no
+ temporary, so that we can use the scalarizer temporary code to handle
+ multiple loops. Thus, we set temp_dim here, we call gfc_mark_ss_chain_used
+ with flag=3 later, and we use gfc_trans_scalarized_loop_boundary even later
+ to restore offset.
+ TODO: this prevents inlining of rank > 0 minmaxloc calls, so this
+ should eventually go away. We could either create two loops properly,
+ or find another way to save/restore the array offsets between the two
+ loops (without conflicting with temporary management), or use a single
+ loop minmaxloc implementation. See PR 31067. */
+ loop.temp_dim = loop.dimen;
gfc_conv_loop_setup (&loop, &expr->where);
gcc_assert (loop.dimen == 1);
@@ -3090,9 +3152,17 @@ gfc_conv_intrinsic_minmaxloc (gfc_se * se, gfc_expr * expr, enum tree_code op)
TREE_USED (lab2) = 1;
}
- gfc_mark_ss_chain_used (arrayss, 1);
+ /* An offset must be added to the loop
+ counter to obtain the required position. */
+ gcc_assert (loop.from[0]);
+
+ tmp = fold_build2_loc (input_location, MINUS_EXPR, gfc_array_index_type,
+ gfc_index_one_node, loop.from[0]);
+ gfc_add_modify (&loop.pre, offset, tmp);
+
+ gfc_mark_ss_chain_used (arrayss, lab1 ? 3 : 1);
if (maskss)
- gfc_mark_ss_chain_used (maskss, 1);
+ gfc_mark_ss_chain_used (maskss, lab1 ? 3 : 1);
/* Generate the loop body. */
gfc_start_scalarized_body (&loop, &body);
@@ -3123,16 +3193,6 @@ gfc_conv_intrinsic_minmaxloc (gfc_se * se, gfc_expr * expr, enum tree_code op)
/* Assign the value to the limit... */
gfc_add_modify (&ifblock, limit, arrayse.expr);
- /* Remember where we are. An offset must be added to the loop
- counter to obtain the required position. */
- if (loop.from[0])
- tmp = fold_build2_loc (input_location, MINUS_EXPR, gfc_array_index_type,
- gfc_index_one_node, loop.from[0]);
- else
- tmp = gfc_index_one_node;
-
- gfc_add_modify (&block, offset, tmp);
-
if (nonempty == NULL && HONOR_NANS (DECL_MODE (limit)))
{
stmtblock_t ifblock2;
@@ -3188,7 +3248,7 @@ gfc_conv_intrinsic_minmaxloc (gfc_se * se, gfc_expr * expr, enum tree_code op)
if (lab1)
{
- gfc_trans_scalarized_loop_end (&loop, 0, &body);
+ gfc_trans_scalarized_loop_boundary (&loop, &body);
if (HONOR_NANS (DECL_MODE (limit)))
{
@@ -3203,7 +3263,6 @@ gfc_conv_intrinsic_minmaxloc (gfc_se * se, gfc_expr * expr, enum tree_code op)
gfc_add_expr_to_block (&loop.code[0], build1_v (GOTO_EXPR, lab2));
gfc_add_expr_to_block (&loop.code[0], build1_v (LABEL_EXPR, lab1));
- gfc_start_block (&body);
/* If we have a mask, only check this element if the mask is set. */
if (maskss)
@@ -3232,16 +3291,6 @@ gfc_conv_intrinsic_minmaxloc (gfc_se * se, gfc_expr * expr, enum tree_code op)
/* Assign the value to the limit... */
gfc_add_modify (&ifblock, limit, arrayse.expr);
- /* Remember where we are. An offset must be added to the loop
- counter to obtain the required position. */
- if (loop.from[0])
- tmp = fold_build2_loc (input_location, MINUS_EXPR, gfc_array_index_type,
- gfc_index_one_node, loop.from[0]);
- else
- tmp = gfc_index_one_node;
-
- gfc_add_modify (&block, offset, tmp);
-
tmp = fold_build2_loc (input_location, PLUS_EXPR, TREE_TYPE (pos),
loop.loopvar[0], offset);
gfc_add_modify (&ifblock, pos, tmp);
@@ -3518,6 +3567,22 @@ gfc_conv_intrinsic_minmaxval (gfc_se * se, gfc_expr * expr, enum tree_code op)
/* Initialize the loop. */
gfc_conv_ss_startstride (&loop);
+
+ /* The code generated can have more than one loop in sequence (see the
+ comment at the function header). This doesn't work well with the
+ scalarizer, which changes arrays' offset when the scalarization loops
+ are generated (see gfc_trans_preloop_setup). Fortunately, {min,max}val
+ are currently inlined in the scalar case only. As there is no dependency
+ to care about in that case, there is no temporary, so that we can use the
+ scalarizer temporary code to handle multiple loops. Thus, we set temp_dim
+ here, we call gfc_mark_ss_chain_used with flag=3 later, and we use
+ gfc_trans_scalarized_loop_boundary even later to restore offset.
+ TODO: this prevents inlining of rank > 0 minmaxval calls, so this
+ should eventually go away. We could either create two loops properly,
+ or find another way to save/restore the array offsets between the two
+ loops (without conflicting with temporary management), or use a single
+ loop minmaxval implementation. See PR 31067. */
+ loop.temp_dim = loop.dimen;
gfc_conv_loop_setup (&loop, &expr->where);
if (nonempty == NULL && maskss == NULL
@@ -3549,9 +3614,9 @@ gfc_conv_intrinsic_minmaxval (gfc_se * se, gfc_expr * expr, enum tree_code op)
}
}
- gfc_mark_ss_chain_used (arrayss, 1);
+ gfc_mark_ss_chain_used (arrayss, lab ? 3 : 1);
if (maskss)
- gfc_mark_ss_chain_used (maskss, 1);
+ gfc_mark_ss_chain_used (maskss, lab ? 3 : 1);
/* Generate the loop body. */
gfc_start_scalarized_body (&loop, &body);
@@ -3661,15 +3726,13 @@ gfc_conv_intrinsic_minmaxval (gfc_se * se, gfc_expr * expr, enum tree_code op)
if (lab)
{
- gfc_trans_scalarized_loop_end (&loop, 0, &body);
+ gfc_trans_scalarized_loop_boundary (&loop, &body);
tmp = fold_build3_loc (input_location, COND_EXPR, type, nonempty,
nan_cst, huge_cst);
gfc_add_modify (&loop.code[0], limit, tmp);
gfc_add_expr_to_block (&loop.code[0], build1_v (LABEL_EXPR, lab));
- gfc_start_block (&body);
-
/* If we have a mask, only add this element if the mask is set. */
if (maskss)
{
@@ -5269,14 +5332,14 @@ gfc_conv_intrinsic_transfer (gfc_se * se, gfc_expr * expr)
gfc_actual_arglist *arg;
gfc_se argse;
gfc_ss *ss;
- gfc_ss_info *info;
+ gfc_array_info *info;
stmtblock_t block;
int n;
bool scalar_mold;
info = NULL;
if (se->loop)
- info = &se->ss->data.info;
+ info = &se->ss->info->data.array;
/* Convert SOURCE. The output from this stage is:-
source_bytes = length of the source in bytes
@@ -5501,9 +5564,8 @@ gfc_conv_intrinsic_transfer (gfc_se * se, gfc_expr * expr)
/* Build a destination descriptor, using the pointer, source, as the
data field. */
- gfc_trans_create_temp_array (&se->pre, &se->post, se->loop,
- info, mold_type, NULL_TREE, false, true, false,
- &expr->where);
+ gfc_trans_create_temp_array (&se->pre, &se->post, se->ss, mold_type,
+ NULL_TREE, false, true, false, &expr->where);
/* Cast the pointer to the result. */
tmp = gfc_conv_descriptor_data_get (info->descriptor);
@@ -6634,7 +6696,7 @@ gfc_conv_intrinsic_function (gfc_se * se, gfc_expr * expr)
break;
case GFC_ISYM_TRANSFER:
- if (se->ss && se->ss->useflags)
+ if (se->ss && se->ss->info->useflags)
/* Access the previously obtained result. */
gfc_conv_tmp_array_ref (se);
else
@@ -6753,19 +6815,17 @@ walk_inline_intrinsic_transpose (gfc_ss *ss, gfc_expr *expr)
for (tmp_ss = arg_ss; ; tmp_ss = tmp_ss->next)
{
- if (tmp_ss->type != GFC_SS_SCALAR
- && tmp_ss->type != GFC_SS_REFERENCE)
+ if (tmp_ss->info->type != GFC_SS_SCALAR
+ && tmp_ss->info->type != GFC_SS_REFERENCE)
{
int tmp_dim;
- gfc_ss_info *info;
- info = &tmp_ss->data.info;
- gcc_assert (info->dimen == 2);
+ gcc_assert (tmp_ss->dimen == 2);
/* We just invert dimensions. */
- tmp_dim = info->dim[0];
- info->dim[0] = info->dim[1];
- info->dim[1] = tmp_dim;
+ tmp_dim = tmp_ss->dim[0];
+ tmp_ss->dim[0] = tmp_ss->dim[1];
+ tmp_ss->dim[1] = tmp_dim;
}
/* Stop when tmp_ss points to the last valid element of the chain... */
@@ -6780,12 +6840,127 @@ walk_inline_intrinsic_transpose (gfc_ss *ss, gfc_expr *expr)
}
+/* Move the given dimension of the given gfc_ss list to a nested gfc_ss list.
+ This has the side effect of reversing the nested list, so there is no
+ need to call gfc_reverse_ss on it (the given list is assumed not to be
+ reversed yet). */
+
+static gfc_ss *
+nest_loop_dimension (gfc_ss *ss, int dim)
+{
+ int ss_dim, i;
+ gfc_ss *new_ss, *prev_ss = gfc_ss_terminator;
+ gfc_loopinfo *new_loop;
+
+ gcc_assert (ss != gfc_ss_terminator);
+
+ for (; ss != gfc_ss_terminator; ss = ss->next)
+ {
+ new_ss = gfc_get_ss ();
+ new_ss->next = prev_ss;
+ new_ss->parent = ss;
+ new_ss->info = ss->info;
+ new_ss->info->refcount++;
+ if (ss->dimen != 0)
+ {
+ gcc_assert (ss->info->type != GFC_SS_SCALAR
+ && ss->info->type != GFC_SS_REFERENCE);
+
+ new_ss->dimen = 1;
+ new_ss->dim[0] = ss->dim[dim];
+
+ gcc_assert (dim < ss->dimen);
+
+ ss_dim = --ss->dimen;
+ for (i = dim; i < ss_dim; i++)
+ ss->dim[i] = ss->dim[i + 1];
+
+ ss->dim[ss_dim] = 0;
+ }
+ prev_ss = new_ss;
+
+ if (ss->nested_ss)
+ {
+ ss->nested_ss->parent = new_ss;
+ new_ss->nested_ss = ss->nested_ss;
+ }
+ ss->nested_ss = new_ss;
+ }
+
+ new_loop = gfc_get_loopinfo ();
+ gfc_init_loopinfo (new_loop);
+
+ gcc_assert (prev_ss != NULL);
+ gcc_assert (prev_ss != gfc_ss_terminator);
+ gfc_add_ss_to_loop (new_loop, prev_ss);
+ return new_ss->parent;
+}
+
+
+/* Create the gfc_ss list for the SUM/PRODUCT arguments when the function
+ is to be inlined. */
+
+static gfc_ss *
+walk_inline_intrinsic_arith (gfc_ss *ss, gfc_expr *expr)
+{
+ gfc_ss *tmp_ss, *tail, *array_ss;
+ gfc_actual_arglist *arg1, *arg2, *arg3;
+ int sum_dim;
+ bool scalar_mask = false;
+
+ /* The rank of the result will be determined later. */
+ arg1 = expr->value.function.actual;
+ arg2 = arg1->next;
+ arg3 = arg2->next;
+ gcc_assert (arg3 != NULL);
+
+ if (expr->rank == 0)
+ return ss;
+
+ tmp_ss = gfc_ss_terminator;
+
+ if (arg3->expr)
+ {
+ gfc_ss *mask_ss;
+
+ mask_ss = gfc_walk_subexpr (tmp_ss, arg3->expr);
+ if (mask_ss == tmp_ss)
+ scalar_mask = 1;
+
+ tmp_ss = mask_ss;
+ }
+
+ array_ss = gfc_walk_subexpr (tmp_ss, arg1->expr);
+ gcc_assert (array_ss != tmp_ss);
+
+ /* Odd thing: If the mask is scalar, it is used by the frontend after
+ the array (to make an if around the nested loop). Thus it shall
+ be after array_ss once the gfc_ss list is reversed. */
+ if (scalar_mask)
+ tmp_ss = gfc_get_scalar_ss (array_ss, arg3->expr);
+ else
+ tmp_ss = array_ss;
+
+ /* "Hide" the dimension on which we will sum in the first arg's scalarization
+ chain. */
+ sum_dim = mpz_get_si (arg2->expr->value.integer) - 1;
+ tail = nest_loop_dimension (tmp_ss, sum_dim);
+ tail->next = ss;
+
+ return tmp_ss;
+}
+
+
static gfc_ss *
walk_inline_intrinsic_function (gfc_ss * ss, gfc_expr * expr)
{
switch (expr->value.function.isym->id)
{
+ case GFC_ISYM_PRODUCT:
+ case GFC_ISYM_SUM:
+ return walk_inline_intrinsic_arith (ss, expr);
+
case GFC_ISYM_TRANSPOSE:
return walk_inline_intrinsic_transpose (ss, expr);
@@ -6802,7 +6977,7 @@ walk_inline_intrinsic_function (gfc_ss * ss, gfc_expr * expr)
void
gfc_add_intrinsic_ss_code (gfc_loopinfo * loop ATTRIBUTE_UNUSED, gfc_ss * ss)
{
- switch (ss->expr->value.function.isym->id)
+ switch (ss->info->expr->value.function.isym->id)
{
case GFC_ISYM_UBOUND:
case GFC_ISYM_LBOUND:
@@ -6847,11 +7022,26 @@ gfc_walk_intrinsic_libfunc (gfc_ss * ss, gfc_expr * expr)
bool
gfc_inline_intrinsic_function_p (gfc_expr *expr)
{
+ gfc_actual_arglist *args;
+
if (!expr->value.function.isym)
return false;
switch (expr->value.function.isym->id)
{
+ case GFC_ISYM_PRODUCT:
+ case GFC_ISYM_SUM:
+ /* Disable inline expansion if code size matters. */
+ if (optimize_size)
+ return false;
+
+ args = expr->value.function.actual;
+ /* We need to be able to subset the SUM argument at compile-time. */
+ if (args->next->expr && args->next->expr->expr_type != EXPR_CONSTANT)
+ return false;
+
+ return true;
+
case GFC_ISYM_TRANSPOSE:
return true;
diff --git a/gcc/fortran/trans-io.c b/gcc/fortran/trans-io.c
index bbf5a02eff4..12dfcf82333 100644
--- a/gcc/fortran/trans-io.c
+++ b/gcc/fortran/trans-io.c
@@ -1937,6 +1937,7 @@ transfer_array_component (tree expr, gfc_component * cm, locus * where)
int n;
gfc_ss *ss;
gfc_se se;
+ gfc_array_info *ss_array;
gfc_start_block (&block);
gfc_init_se (&se, NULL);
@@ -1948,19 +1949,20 @@ transfer_array_component (tree expr, gfc_component * cm, locus * where)
ss = gfc_get_array_ss (gfc_ss_terminator, NULL, cm->as->rank,
GFC_SS_COMPONENT);
- ss->shape = gfc_get_shape (cm->as->rank);
- ss->data.info.descriptor = expr;
- ss->data.info.data = gfc_conv_array_data (expr);
- ss->data.info.offset = gfc_conv_array_offset (expr);
+ ss_array = &ss->info->data.array;
+ ss_array->shape = gfc_get_shape (cm->as->rank);
+ ss_array->descriptor = expr;
+ ss_array->data = gfc_conv_array_data (expr);
+ ss_array->offset = gfc_conv_array_offset (expr);
for (n = 0; n < cm->as->rank; n++)
{
- ss->data.info.start[n] = gfc_conv_array_lbound (expr, n);
- ss->data.info.stride[n] = gfc_index_one_node;
+ ss_array->start[n] = gfc_conv_array_lbound (expr, n);
+ ss_array->stride[n] = gfc_index_one_node;
- mpz_init (ss->shape[n]);
- mpz_sub (ss->shape[n], cm->as->upper[n]->value.integer,
+ mpz_init (ss_array->shape[n]);
+ mpz_sub (ss_array->shape[n], cm->as->upper[n]->value.integer,
cm->as->lower[n]->value.integer);
- mpz_add_ui (ss->shape[n], ss->shape[n], 1);
+ mpz_add_ui (ss_array->shape[n], ss_array->shape[n], 1);
}
/* Once we got ss, we use scalarizer to create the loop. */
@@ -1995,8 +1997,8 @@ transfer_array_component (tree expr, gfc_component * cm, locus * where)
gfc_add_block_to_block (&block, &loop.pre);
gfc_add_block_to_block (&block, &loop.post);
- gcc_assert (ss->shape != NULL);
- gfc_free_shape (&ss->shape, cm->as->rank);
+ gcc_assert (ss_array->shape != NULL);
+ gfc_free_shape (&ss_array->shape, cm->as->rank);
gfc_cleanup_loop (&loop);
return gfc_finish_block (&block);
diff --git a/gcc/fortran/trans-stmt.c b/gcc/fortran/trans-stmt.c
index c71eeec400f..0d793f96858 100644
--- a/gcc/fortran/trans-stmt.c
+++ b/gcc/fortran/trans-stmt.c
@@ -178,6 +178,41 @@ gfc_trans_entry (gfc_code * code)
}
+/* Replace a gfc_ss structure by another both in the gfc_se struct
+ and the gfc_loopinfo struct. This is used in gfc_conv_elemental_dependencies
+ to replace a variable ss by the corresponding temporary. */
+
+static void
+replace_ss (gfc_se *se, gfc_ss *old_ss, gfc_ss *new_ss)
+{
+ gfc_ss **sess, **loopss;
+
+ /* The old_ss is a ss for a single variable. */
+ gcc_assert (old_ss->info->type == GFC_SS_SECTION);
+
+ for (sess = &(se->ss); *sess != gfc_ss_terminator; sess = &((*sess)->next))
+ if (*sess == old_ss)
+ break;
+ gcc_assert (*sess != gfc_ss_terminator);
+
+ *sess = new_ss;
+ new_ss->next = old_ss->next;
+
+
+ for (loopss = &(se->loop->ss); *loopss != gfc_ss_terminator;
+ loopss = &((*loopss)->loop_chain))
+ if (*loopss == old_ss)
+ break;
+ gcc_assert (*loopss != gfc_ss_terminator);
+
+ *loopss = new_ss;
+ new_ss->loop_chain = old_ss->loop_chain;
+ new_ss->loop = old_ss->loop;
+
+ gfc_free_ss (old_ss);
+}
+
+
/* Check for dependencies between INTENT(IN) and INTENT(OUT) arguments of
elemental subroutines. Make temporaries for output arguments if any such
dependencies are found. Output arguments are chosen because internal_unpack
@@ -190,15 +225,10 @@ gfc_conv_elemental_dependencies (gfc_se * se, gfc_se * loopse,
gfc_actual_arglist *arg0;
gfc_expr *e;
gfc_formal_arglist *formal;
- gfc_loopinfo tmp_loop;
gfc_se parmse;
gfc_ss *ss;
- gfc_ss_info *info;
gfc_symbol *fsym;
- gfc_ref *ref;
- int n;
tree data;
- tree offset;
tree size;
tree tmp;
@@ -217,14 +247,9 @@ gfc_conv_elemental_dependencies (gfc_se * se, gfc_se * loopse,
continue;
/* Obtain the info structure for the current argument. */
- info = NULL;
for (ss = loopse->ss; ss && ss != gfc_ss_terminator; ss = ss->next)
- {
- if (ss->expr != e)
- continue;
- info = &ss->data.info;
+ if (ss->info->expr == e)
break;
- }
/* If there is a dependency, create a temporary and use it
instead of the variable. */
@@ -237,49 +262,17 @@ gfc_conv_elemental_dependencies (gfc_se * se, gfc_se * loopse,
{
tree initial, temptype;
stmtblock_t temp_post;
+ gfc_ss *tmp_ss;
- /* Make a local loopinfo for the temporary creation, so that
- none of the other ss->info's have to be renormalized. */
- gfc_init_loopinfo (&tmp_loop);
- tmp_loop.dimen = info->dimen;
- for (n = 0; n < info->dimen; n++)
- {
- tmp_loop.to[n] = loopse->loop->to[n];
- tmp_loop.from[n] = loopse->loop->from[n];
- tmp_loop.order[n] = loopse->loop->order[n];
- }
+ tmp_ss = gfc_get_array_ss (gfc_ss_terminator, NULL, ss->dimen,
+ GFC_SS_SECTION);
+ gfc_mark_ss_chain_used (tmp_ss, 1);
+ tmp_ss->info->expr = ss->info->expr;
+ replace_ss (loopse, ss, tmp_ss);
/* Obtain the argument descriptor for unpacking. */
gfc_init_se (&parmse, NULL);
parmse.want_pointer = 1;
-
- /* The scalarizer introduces some specific peculiarities when
- handling elemental subroutines; the stride can be needed up to
- the dim_array - 1, rather than dim_loop - 1 to calculate
- offsets outside the loop. For this reason, we make sure that
- the descriptor has the dimensionality of the array by converting
- trailing elements into ranges with end = start. */
- for (ref = e->ref; ref; ref = ref->next)
- if (ref->type == REF_ARRAY && ref->u.ar.type == AR_SECTION)
- break;
-
- if (ref)
- {
- bool seen_range = false;
- for (n = 0; n < ref->u.ar.dimen; n++)
- {
- if (ref->u.ar.dimen_type[n] == DIMEN_RANGE)
- seen_range = true;
-
- if (!seen_range
- || ref->u.ar.dimen_type[n] != DIMEN_ELEMENT)
- continue;
-
- ref->u.ar.end[n] = gfc_copy_expr (ref->u.ar.start[n]);
- ref->u.ar.dimen_type[n] = DIMEN_RANGE;
- }
- }
-
gfc_conv_expr_descriptor (&parmse, e, gfc_walk_expr (e));
gfc_add_block_to_block (&se->pre, &parmse.pre);
@@ -309,29 +302,15 @@ gfc_conv_elemental_dependencies (gfc_se * se, gfc_se * loopse,
size = gfc_create_var (gfc_array_index_type, NULL);
data = gfc_create_var (pvoid_type_node, NULL);
gfc_init_block (&temp_post);
- tmp = gfc_trans_create_temp_array (&se->pre, &temp_post,
- &tmp_loop, info, temptype,
- initial,
- false, true, false,
- &arg->expr->where);
+ tmp = gfc_trans_create_temp_array (&se->pre, &temp_post, tmp_ss,
+ temptype, initial, false, true,
+ false, &arg->expr->where);
gfc_add_modify (&se->pre, size, tmp);
- tmp = fold_convert (pvoid_type_node, info->data);
+ tmp = fold_convert (pvoid_type_node, tmp_ss->info->data.array.data);
gfc_add_modify (&se->pre, data, tmp);
- /* Calculate the offset for the temporary. */
- offset = gfc_index_zero_node;
- for (n = 0; n < info->dimen; n++)
- {
- tmp = gfc_conv_descriptor_stride_get (info->descriptor,
- gfc_rank_cst[n]);
- tmp = fold_build2_loc (input_location, MULT_EXPR,
- gfc_array_index_type,
- loopse->loop->from[n], tmp);
- offset = fold_build2_loc (input_location, MINUS_EXPR,
- gfc_array_index_type, offset, tmp);
- }
- info->offset = gfc_create_var (gfc_array_index_type, NULL);
- gfc_add_modify (&se->pre, info->offset, offset);
+ /* Update other ss' delta. */
+ gfc_set_delta (loopse->loop);
/* Copy the result back using unpack. */
tmp = build_call_expr_loc (input_location,
@@ -3306,7 +3285,7 @@ gfc_trans_pointer_assign_need_temp (gfc_expr * expr1, gfc_expr * expr2,
gfc_ss *lss, *rss;
gfc_se lse;
gfc_se rse;
- gfc_ss_info *info;
+ gfc_array_info *info;
gfc_loopinfo loop;
tree desc;
tree parm;
@@ -3388,7 +3367,7 @@ gfc_trans_pointer_assign_need_temp (gfc_expr * expr1, gfc_expr * expr2,
gfc_conv_loop_setup (&loop, &expr2->where);
- info = &rss->data.info;
+ info = &rss->info->data.array;
desc = info->descriptor;
/* Make a new descriptor. */
@@ -4048,7 +4027,7 @@ gfc_trans_where_assign (gfc_expr *expr1, gfc_expr *expr2,
/* Find a non-scalar SS from the lhs. */
while (lss_section != gfc_ss_terminator
- && lss_section->type != GFC_SS_SECTION)
+ && lss_section->info->type != GFC_SS_SECTION)
lss_section = lss_section->next;
gcc_assert (lss_section != gfc_ss_terminator);
@@ -4062,7 +4041,7 @@ gfc_trans_where_assign (gfc_expr *expr1, gfc_expr *expr2,
{
/* The rhs is scalar. Add a ss for the expression. */
rss = gfc_get_scalar_ss (gfc_ss_terminator, expr2);
- rss->where = 1;
+ rss->info->where = 1;
}
/* Associate the SS with the loop. */
@@ -4501,7 +4480,7 @@ gfc_trans_where_3 (gfc_code * cblock, gfc_code * eblock)
if (tsss == gfc_ss_terminator)
{
tsss = gfc_get_scalar_ss (gfc_ss_terminator, tsrc);
- tsss->where = 1;
+ tsss->info->where = 1;
}
gfc_add_ss_to_loop (&loop, tdss);
gfc_add_ss_to_loop (&loop, tsss);
@@ -4516,7 +4495,7 @@ gfc_trans_where_3 (gfc_code * cblock, gfc_code * eblock)
if (esss == gfc_ss_terminator)
{
esss = gfc_get_scalar_ss (gfc_ss_terminator, esrc);
- esss->where = 1;
+ esss->info->where = 1;
}
gfc_add_ss_to_loop (&loop, edss);
gfc_add_ss_to_loop (&loop, esss);
diff --git a/gcc/fortran/trans.h b/gcc/fortran/trans.h
index 535c207fcd4..22033d38d15 100644
--- a/gcc/fortran/trans.h
+++ b/gcc/fortran/trans.h
@@ -108,17 +108,13 @@ typedef enum
gfc_coarray_type;
-/* Scalarization State chain. Created by walking an expression tree before
- creating the scalarization loops. Then passed as part of a gfc_se structure
- to translate the expression inside the loop. Note that these chains are
- terminated by gfc_se_terminator, not NULL. A NULL pointer in a gfc_se
- indicates to gfc_conv_* that this is a scalar expression.
- Note that some member arrays correspond to scalarizer rank and others
- are the variable rank. */
+/* The array-specific scalarization informations. The array members of
+ this struct are indexed by actual array index, and thus can be sparse. */
-typedef struct gfc_ss_info
+typedef struct gfc_array_info
{
- int dimen;
+ mpz_t *shape;
+
/* The ref that holds information on this section. */
gfc_ref *ref;
/* The descriptor of this array. */
@@ -139,12 +135,8 @@ typedef struct gfc_ss_info
tree end[GFC_MAX_DIMENSIONS];
tree stride[GFC_MAX_DIMENSIONS];
tree delta[GFC_MAX_DIMENSIONS];
-
- /* Translation from loop dimensions to actual dimensions.
- actual_dim = dim[loop_dim] */
- int dim[GFC_MAX_DIMENSIONS];
}
-gfc_ss_info;
+gfc_array_info;
typedef enum
{
@@ -190,47 +182,82 @@ typedef enum
}
gfc_ss_type;
-/* SS structures can only belong to a single loopinfo. They must be added
- otherwise they will not get freed. */
-typedef struct gfc_ss
+
+typedef struct gfc_ss_info
{
+ int refcount;
gfc_ss_type type;
gfc_expr *expr;
- mpz_t *shape;
tree string_length;
+
union
{
/* If type is GFC_SS_SCALAR or GFC_SS_REFERENCE. */
struct
{
- tree expr;
+ tree value;
}
scalar;
/* GFC_SS_TEMP. */
struct
{
- /* The rank of the temporary. May be less than the rank of the
- assigned expression. */
- int dimen;
tree type;
}
temp;
+
/* All other types. */
- gfc_ss_info info;
+ gfc_array_info array;
}
data;
+ /* This is used by assignments requiring temporaries. The bits specify which
+ loops the terms appear in. This will be 1 for the RHS expressions,
+ 2 for the LHS expressions, and 3(=1|2) for the temporary. */
+ unsigned useflags:2;
+
+ /* Suppresses precalculation of scalars in WHERE assignments. */
+ unsigned where:1;
+}
+gfc_ss_info;
+
+#define gfc_get_ss_info() XCNEW (gfc_ss_info)
+
+
+/* Scalarization State chain. Created by walking an expression tree before
+ creating the scalarization loops. Then passed as part of a gfc_se structure
+ to translate the expression inside the loop. Note that these chains are
+ terminated by gfc_ss_terminator, not NULL. A NULL pointer in a gfc_se
+ indicates to gfc_conv_* that this is a scalar expression.
+ SS structures can only belong to a single loopinfo. They must be added
+ otherwise they will not get freed. */
+
+typedef struct gfc_ss
+{
+ gfc_ss_info *info;
+
+ int dimen;
+ /* Translation from loop dimensions to actual array dimensions.
+ actual_dim = dim[loop_dim] */
+ int dim[GFC_MAX_DIMENSIONS];
+
/* All the SS in a loop and linked through loop_chain. The SS for an
expression are linked by the next pointer. */
struct gfc_ss *loop_chain;
struct gfc_ss *next;
- /* This is used by assignments requiring temporaries. The bits specify which
- loops the terms appear in. This will be 1 for the RHS expressions,
- 2 for the LHS expressions, and 3(=1|2) for the temporary. The bit
- 'where' suppresses precalculation of scalars in WHERE assignments. */
- unsigned useflags:2, where:1, is_alloc_lhs:1;
+ /* Non-null if the ss is part of a nested loop. */
+ struct gfc_ss *parent;
+
+ /* If the evaluation of an expression requires a nested loop (for example
+ if the sum intrinsic is evaluated inline), this points to the nested
+ loop's gfc_ss. */
+ struct gfc_ss *nested_ss;
+
+ /* The loop this gfc_ss is in. */
+ struct gfc_loopinfo *loop;
+
+ unsigned is_alloc_lhs:1;
}
gfc_ss;
#define gfc_get_ss() XCNEW (gfc_ss)
@@ -252,6 +279,12 @@ typedef struct gfc_loopinfo
/* The SS describing the temporary used in an assignment. */
gfc_ss *temp_ss;
+ /* Non-null if this loop is nested in another one. */
+ struct gfc_loopinfo *parent;
+
+ /* Chain of nested loops. */
+ struct gfc_loopinfo *nested, *next;
+
/* The scalarization loop index variables. */
tree loopvar[GFC_MAX_DIMENSIONS];
@@ -277,6 +310,7 @@ typedef struct gfc_loopinfo
}
gfc_loopinfo;
+#define gfc_get_loopinfo() XCNEW (gfc_loopinfo)
/* Information about a symbol that has been shadowed by a temporary. */
typedef struct
@@ -363,9 +397,6 @@ tree gfc_builtin_decl_for_float_kind (enum built_in_function, int);
tree gfc_conv_intrinsic_subroutine (gfc_code *);
void gfc_conv_intrinsic_function (gfc_se *, gfc_expr *);
-/* Is the intrinsic expanded inline. */
-bool gfc_inline_intrinsic_function_p (gfc_expr *);
-
/* Does an intrinsic map directly to an external library call
This is true for array-returning intrinsics, unless
gfc_inline_intrinsic_function_p returns true. */
diff --git a/gcc/fortran/types.def b/gcc/fortran/types.def
index 5bcdb5261d9..a2762c6257b 100644
--- a/gcc/fortran/types.def
+++ b/gcc/fortran/types.def
@@ -57,6 +57,7 @@ DEF_PRIMITIVE_TYPE (BT_UINT, unsigned_type_node)
DEF_PRIMITIVE_TYPE (BT_LONG, long_integer_type_node)
DEF_PRIMITIVE_TYPE (BT_ULONGLONG, long_long_unsigned_type_node)
DEF_PRIMITIVE_TYPE (BT_WORD, (*lang_hooks.types.type_for_mode) (word_mode, 1))
+DEF_PRIMITIVE_TYPE (BT_SIZE, size_type_node)
DEF_PRIMITIVE_TYPE (BT_I1, builtin_type_for_size (BITS_PER_UNIT*1, 1))
DEF_PRIMITIVE_TYPE (BT_I2, builtin_type_for_size (BITS_PER_UNIT*2, 1))
@@ -70,7 +71,10 @@ DEF_PRIMITIVE_TYPE (BT_VOLATILE_PTR,
build_pointer_type
(build_qualified_type (void_type_node,
TYPE_QUAL_VOLATILE)))
-
+DEF_PRIMITIVE_TYPE (BT_CONST_VOLATILE_PTR,
+ build_pointer_type
+ (build_qualified_type (void_type_node,
+ TYPE_QUAL_VOLATILE|TYPE_QUAL_CONST)))
DEF_POINTER_TYPE (BT_PTR_LONG, BT_LONG)
DEF_POINTER_TYPE (BT_PTR_ULONGLONG, BT_ULONGLONG)
DEF_POINTER_TYPE (BT_PTR_PTR, BT_PTR)
@@ -85,6 +89,8 @@ DEF_FUNCTION_TYPE_1 (BT_FN_VOID_PTRPTR, BT_VOID, BT_PTR_PTR)
DEF_FUNCTION_TYPE_1 (BT_FN_VOID_VPTR, BT_VOID, BT_VOLATILE_PTR)
DEF_FUNCTION_TYPE_1 (BT_FN_UINT_UINT, BT_UINT, BT_UINT)
DEF_FUNCTION_TYPE_1 (BT_FN_PTR_PTR, BT_PTR, BT_PTR)
+DEF_FUNCTION_TYPE_1 (BT_FN_VOID_INT, BT_VOID, BT_INT)
+
DEF_POINTER_TYPE (BT_PTR_FN_VOID_PTR, BT_FN_VOID_PTR)
@@ -98,6 +104,21 @@ DEF_FUNCTION_TYPE_2 (BT_FN_I4_VPTR_I4, BT_I4, BT_VOLATILE_PTR, BT_I4)
DEF_FUNCTION_TYPE_2 (BT_FN_I8_VPTR_I8, BT_I8, BT_VOLATILE_PTR, BT_I8)
DEF_FUNCTION_TYPE_2 (BT_FN_I16_VPTR_I16, BT_I16, BT_VOLATILE_PTR, BT_I16)
DEF_FUNCTION_TYPE_2 (BT_FN_VOID_PTR_PTR, BT_VOID, BT_PTR, BT_PTR)
+DEF_FUNCTION_TYPE_2 (BT_FN_I1_CONST_VPTR_INT, BT_I1, BT_CONST_VOLATILE_PTR,
+ BT_INT)
+DEF_FUNCTION_TYPE_2 (BT_FN_I2_CONST_VPTR_INT, BT_I2, BT_CONST_VOLATILE_PTR,
+ BT_INT)
+DEF_FUNCTION_TYPE_2 (BT_FN_I4_CONST_VPTR_INT, BT_I4, BT_CONST_VOLATILE_PTR,
+ BT_INT)
+DEF_FUNCTION_TYPE_2 (BT_FN_I8_CONST_VPTR_INT, BT_I8, BT_CONST_VOLATILE_PTR,
+ BT_INT)
+DEF_FUNCTION_TYPE_2 (BT_FN_I16_CONST_VPTR_INT, BT_I16, BT_CONST_VOLATILE_PTR,
+ BT_INT)
+DEF_FUNCTION_TYPE_2 (BT_FN_VOID_VPTR_INT, BT_VOID, BT_VOLATILE_PTR, BT_INT)
+DEF_FUNCTION_TYPE_2 (BT_FN_BOOL_VPTR_INT, BT_BOOL, BT_VOLATILE_PTR, BT_INT)
+DEF_FUNCTION_TYPE_2 (BT_FN_BOOL_SIZE_CONST_VPTR, BT_BOOL, BT_SIZE,
+ BT_CONST_VOLATILE_PTR)
+
DEF_POINTER_TYPE (BT_PTR_FN_VOID_PTR_PTR, BT_FN_VOID_PTR_PTR)
@@ -119,15 +140,31 @@ DEF_FUNCTION_TYPE_3 (BT_FN_I16_VPTR_I16_I16, BT_I16, BT_VOLATILE_PTR,
BT_I16, BT_I16)
DEF_FUNCTION_TYPE_3 (BT_FN_VOID_OMPFN_PTR_UINT, BT_VOID, BT_PTR_FN_VOID_PTR,
BT_PTR, BT_UINT)
+DEF_FUNCTION_TYPE_3 (BT_FN_I1_VPTR_I1_INT, BT_I1, BT_VOLATILE_PTR, BT_I1, BT_INT)
+DEF_FUNCTION_TYPE_3 (BT_FN_I2_VPTR_I2_INT, BT_I2, BT_VOLATILE_PTR, BT_I2, BT_INT)
+DEF_FUNCTION_TYPE_3 (BT_FN_I4_VPTR_I4_INT, BT_I4, BT_VOLATILE_PTR, BT_I4, BT_INT)
+DEF_FUNCTION_TYPE_3 (BT_FN_I8_VPTR_I8_INT, BT_I8, BT_VOLATILE_PTR, BT_I8, BT_INT)
+DEF_FUNCTION_TYPE_3 (BT_FN_I16_VPTR_I16_INT, BT_I16, BT_VOLATILE_PTR, BT_I16, BT_INT)
+DEF_FUNCTION_TYPE_3 (BT_FN_VOID_VPTR_I1_INT, BT_VOID, BT_VOLATILE_PTR, BT_I1, BT_INT)
+DEF_FUNCTION_TYPE_3 (BT_FN_VOID_VPTR_I2_INT, BT_VOID, BT_VOLATILE_PTR, BT_I2, BT_INT)
+DEF_FUNCTION_TYPE_3 (BT_FN_VOID_VPTR_I4_INT, BT_VOID, BT_VOLATILE_PTR, BT_I4, BT_INT)
+DEF_FUNCTION_TYPE_3 (BT_FN_VOID_VPTR_I8_INT, BT_VOID, BT_VOLATILE_PTR, BT_I8, BT_INT)
+DEF_FUNCTION_TYPE_3 (BT_FN_VOID_VPTR_I16_INT, BT_VOID, BT_VOLATILE_PTR, BT_I16, BT_INT)
DEF_FUNCTION_TYPE_4 (BT_FN_VOID_OMPFN_PTR_UINT_UINT,
BT_VOID, BT_PTR_FN_VOID_PTR, BT_PTR, BT_UINT, BT_UINT)
DEF_FUNCTION_TYPE_4 (BT_FN_VOID_PTR_WORD_WORD_PTR,
BT_VOID, BT_PTR, BT_WORD, BT_WORD, BT_PTR)
+DEF_FUNCTION_TYPE_4 (BT_FN_VOID_SIZE_VPTR_PTR_INT, BT_VOID, BT_SIZE,
+ BT_VOLATILE_PTR, BT_PTR, BT_INT)
+DEF_FUNCTION_TYPE_4 (BT_FN_VOID_SIZE_CONST_VPTR_PTR_INT, BT_VOID, BT_SIZE,
+ BT_CONST_VOLATILE_PTR, BT_PTR, BT_INT)
DEF_FUNCTION_TYPE_5 (BT_FN_BOOL_LONG_LONG_LONG_LONGPTR_LONGPTR,
BT_BOOL, BT_LONG, BT_LONG, BT_LONG,
BT_PTR_LONG, BT_PTR_LONG)
+DEF_FUNCTION_TYPE_5 (BT_FN_VOID_SIZE_VPTR_PTR_PTR_INT, BT_VOID, BT_SIZE,
+ BT_VOLATILE_PTR, BT_PTR, BT_PTR, BT_INT)
DEF_FUNCTION_TYPE_6 (BT_FN_BOOL_LONG_LONG_LONG_LONG_LONGPTR_LONGPTR,
BT_BOOL, BT_LONG, BT_LONG, BT_LONG, BT_LONG,
@@ -138,6 +175,23 @@ DEF_FUNCTION_TYPE_6 (BT_FN_VOID_OMPFN_PTR_UINT_LONG_LONG_LONG,
DEF_FUNCTION_TYPE_6 (BT_FN_BOOL_BOOL_ULL_ULL_ULL_ULLPTR_ULLPTR,
BT_BOOL, BT_BOOL, BT_ULONGLONG, BT_ULONGLONG,
BT_ULONGLONG, BT_PTR_ULONGLONG, BT_PTR_ULONGLONG)
+DEF_FUNCTION_TYPE_6 (BT_FN_BOOL_VPTR_PTR_I1_BOOL_INT_INT,
+ BT_BOOL, BT_VOLATILE_PTR, BT_PTR, BT_I1, BT_BOOL, BT_INT,
+ BT_INT)
+DEF_FUNCTION_TYPE_6 (BT_FN_BOOL_VPTR_PTR_I2_BOOL_INT_INT,
+ BT_BOOL, BT_VOLATILE_PTR, BT_PTR, BT_I2, BT_BOOL, BT_INT,
+ BT_INT)
+DEF_FUNCTION_TYPE_6 (BT_FN_BOOL_VPTR_PTR_I4_BOOL_INT_INT,
+ BT_BOOL, BT_VOLATILE_PTR, BT_PTR, BT_I4, BT_BOOL, BT_INT,
+ BT_INT)
+DEF_FUNCTION_TYPE_6 (BT_FN_BOOL_VPTR_PTR_I8_BOOL_INT_INT,
+ BT_BOOL, BT_VOLATILE_PTR, BT_PTR, BT_I8, BT_BOOL, BT_INT,
+ BT_INT)
+DEF_FUNCTION_TYPE_6 (BT_FN_BOOL_VPTR_PTR_I16_BOOL_INT_INT,
+ BT_BOOL, BT_VOLATILE_PTR, BT_PTR, BT_I16, BT_BOOL, BT_INT,
+ BT_INT)
+DEF_FUNCTION_TYPE_6 (BT_FN_BOOL_SIZE_VPTR_PTR_PTR_INT_INT, BT_BOOL, BT_SIZE,
+ BT_VOLATILE_PTR, BT_PTR, BT_PTR, BT_INT, BT_INT)
DEF_FUNCTION_TYPE_7 (BT_FN_VOID_OMPFN_PTR_UINT_LONG_LONG_LONG_LONG,
BT_VOID, BT_PTR_FN_VOID_PTR, BT_PTR, BT_UINT,
diff --git a/gcc/gbl-ctors.h b/gcc/gbl-ctors.h
deleted file mode 100644
index ac4faae1292..00000000000
--- a/gcc/gbl-ctors.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/* Definitions relating to the special __do_global_init function used
- for getting g++ file-scope static objects constructed. This file
- will get included either by libgcc2.c (for systems that don't support
- a .init section) or by crtstuff.c (for those that do).
- Copyright (C) 1991, 1995, 1996, 1998, 1999, 2000, 2003, 2009
- Free Software Foundation, Inc.
- Contributed by Ron Guilmette (rfg@segfault.us.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.
-
-Under Section 7 of GPL version 3, you are granted additional
-permissions described in the GCC Runtime Library Exception, version
-3.1, as published by the Free Software Foundation.
-
-You should have received a copy of the GNU General Public License and
-a copy of the GCC Runtime Library Exception along with this program;
-see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
-<http://www.gnu.org/licenses/>. */
-
-/* This file contains definitions and declarations of things
- relating to the normal start-up-time invocation of C++
- file-scope static object constructors. These declarations
- and definitions are used by *both* libgcc2.c and by crtstuff.c.
-
- Note that this file should only be compiled with GCC.
-*/
-
-#ifndef GCC_GBL_CTORS_H
-#define GCC_GBL_CTORS_H
-
-/* Declare a pointer to void function type. */
-
-typedef void (*func_ptr) (void);
-
-/* Declare the set of symbols use as begin and end markers for the lists
- of global object constructors and global object destructors. */
-
-extern func_ptr __CTOR_LIST__[];
-extern func_ptr __DTOR_LIST__[];
-
-/* Declare the routine which needs to get invoked at program start time. */
-
-extern void __do_global_ctors (void);
-
-/* Declare the routine which needs to get invoked at program exit time. */
-
-extern void __do_global_dtors (void);
-
-/* Define a macro with the code which needs to be executed at program
- start-up time. This macro is used in two places in crtstuff.c (for
- systems which support a .init section) and in one place in libgcc2.c
- (for those system which do *not* support a .init section). For all
- three places where this code might appear, it must be identical, so
- we define it once here as a macro to avoid various instances getting
- out-of-sync with one another. */
-
-/* Some systems place the number of pointers
- in the first word of the table.
- On other systems, that word is -1.
- In all cases, the table is null-terminated.
- If the length is not recorded, count up to the null. */
-
-/* Some systems use a different strategy for finding the ctors.
- For example, svr3. */
-#ifndef DO_GLOBAL_CTORS_BODY
-#define DO_GLOBAL_CTORS_BODY \
-do { \
- __SIZE_TYPE__ nptrs = (__SIZE_TYPE__) __CTOR_LIST__[0]; \
- unsigned i; \
- if (nptrs == (__SIZE_TYPE__)-1) \
- for (nptrs = 0; __CTOR_LIST__[nptrs + 1] != 0; nptrs++); \
- for (i = nptrs; i >= 1; i--) \
- __CTOR_LIST__[i] (); \
-} while (0)
-#endif
-
-#endif /* GCC_GBL_CTORS_H */
diff --git a/gcc/gcc.c b/gcc/gcc.c
index 0fd4edda28f..46130dc1001 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -3137,16 +3137,6 @@ driver_wrong_lang_callback (const struct cl_decoded_option *decoded,
&decoded->canonical_option[1], false);
}
-/* Note that an option (index OPT_INDEX, argument ARG, value VALUE)
- has been successfully handled with a handler for mask MASK. */
-
-static void
-driver_post_handling_callback (const struct cl_decoded_option *decoded ATTRIBUTE_UNUSED,
- unsigned int mask ATTRIBUTE_UNUSED)
-{
- /* Nothing to do here. */
-}
-
static const char *spec_lang = 0;
static int last_language_n_infiles;
@@ -3533,7 +3523,6 @@ set_option_handlers (struct cl_option_handlers *handlers)
{
handlers->unknown_option_callback = driver_unknown_option_callback;
handlers->wrong_lang_callback = driver_wrong_lang_callback;
- handlers->post_handling_callback = driver_post_handling_callback;
handlers->num_handlers = 3;
handlers->handlers[0].handler = driver_handle_option;
handlers->handlers[0].mask = CL_DRIVER;
diff --git a/gcc/gcov-dump.c b/gcc/gcov-dump.c
index 200917053fb..a6c5b33c622 100644
--- a/gcc/gcov-dump.c
+++ b/gcc/gcov-dump.c
@@ -276,23 +276,28 @@ dump_file (const char *filename)
static void
tag_function (const char *filename ATTRIBUTE_UNUSED,
- unsigned tag ATTRIBUTE_UNUSED, unsigned length ATTRIBUTE_UNUSED)
+ unsigned tag ATTRIBUTE_UNUSED, unsigned length)
{
unsigned long pos = gcov_position ();
- printf (" ident=%u", gcov_read_unsigned ());
- printf (", lineno_checksum=0x%08x", gcov_read_unsigned ());
- printf (", cfg_checksum_checksum=0x%08x", gcov_read_unsigned ());
-
- if (gcov_position () - pos < length)
+ if (!length)
+ printf (" placeholder");
+ else
{
- const char *name;
+ printf (" ident=%u", gcov_read_unsigned ());
+ printf (", lineno_checksum=0x%08x", gcov_read_unsigned ());
+ printf (", cfg_checksum_checksum=0x%08x", gcov_read_unsigned ());
- name = gcov_read_string ();
- printf (", `%s'", name ? name : "NULL");
- name = gcov_read_string ();
- printf (" %s", name ? name : "NULL");
- printf (":%u", gcov_read_unsigned ());
+ if (gcov_position () - pos < length)
+ {
+ const char *name;
+
+ name = gcov_read_string ();
+ printf (", `%s'", name ? name : "NULL");
+ name = gcov_read_string ();
+ printf (" %s", name ? name : "NULL");
+ printf (":%u", gcov_read_unsigned ());
+ }
}
}
diff --git a/gcc/gcov-io.h b/gcc/gcov-io.h
index 4f5013e1156..3ff9fcd22f0 100644
--- a/gcc/gcov-io.h
+++ b/gcc/gcov-io.h
@@ -130,26 +130,26 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
blocks they are for.
The data file contains the following records.
- data: {unit function-data* summary:object summary:program*}*
+ data: {unit summary:object summary:program* function-data*}*
unit: header int32:checksum
- function-data: announce_function arc_counts
+ function-data: announce_function present counts
announce_function: header int32:ident
int32:lineno_checksum int32:cfg_checksum
- arc_counts: header int64:count*
- summary: int32:checksum {count-summary}GCOV_COUNTERS
+ present: header int32:present
+ counts: header int64:count*
+ summary: int32:checksum {count-summary}GCOV_COUNTERS_SUMMABLE
count-summary: int32:num int32:runs int64:sum
int64:max int64:sum_max
The ANNOUNCE_FUNCTION record is the same as that in the note file,
- but without the source location. The ARC_COUNTS gives the counter
- values for those arcs that are instrumented. The SUMMARY records
- give information about the whole object file and about the whole
+ but without the source location. The COUNTS gives the
+ counter values for instrumented features. The about the whole
program. The checksum is used for whole program summaries, and
disambiguates different programs which include the same
instrumented object file. There may be several program summaries,
- each with a unique checksum. The object summary's checksum is zero.
- Note that the data file might contain information from several runs
- concatenated, or the data might be merged.
+ each with a unique checksum. The object summary's checksum is
+ zero. Note that the data file might contain information from
+ several runs concatenated, or the data might be merged.
This file is included by both the compiler, gcov tools and the
runtime support library libgcov. IN_LIBGCOV and IN_GCOV are used to
@@ -307,7 +307,7 @@ typedef HOST_WIDEST_INT gcov_type;
#define GCOV_TAG_COUNTER_BASE ((gcov_unsigned_t)0x01a10000)
#define GCOV_TAG_COUNTER_LENGTH(NUM) ((NUM) * 2)
#define GCOV_TAG_COUNTER_NUM(LENGTH) ((LENGTH) / 2)
-#define GCOV_TAG_OBJECT_SUMMARY ((gcov_unsigned_t)0xa1000000)
+#define GCOV_TAG_OBJECT_SUMMARY ((gcov_unsigned_t)0xa1000000) /* Obsolete */
#define GCOV_TAG_PROGRAM_SUMMARY ((gcov_unsigned_t)0xa3000000)
#define GCOV_TAG_SUMMARY_LENGTH \
(1 + GCOV_COUNTERS_SUMMABLE * (2 + 3 * 2))
@@ -343,7 +343,7 @@ typedef HOST_WIDEST_INT gcov_type;
/* A list of human readable names of the counters */
#define GCOV_COUNTER_NAMES {"arcs", "interval", "pow2", "single", \
- "delta","indirect_call", "average", "ior"}
+ "delta", "indirect_call", "average", "ior"}
/* Names of merge functions for counters. */
#define GCOV_MERGE_FUNCTIONS {"__gcov_merge_add", \
@@ -410,30 +410,31 @@ struct gcov_summary
by write_profile must match these. */
#if IN_LIBGCOV
+/* Information about counters for a single function. */
+struct gcov_ctr_info
+{
+ gcov_unsigned_t num; /* number of counters. */
+ gcov_type *values; /* their values. */
+};
+
/* Information about a single function. This uses the trailing array
- idiom. The number of counters is determined from the counter_mask
- in gcov_info. We hold an array of function info, so have to
- explicitly calculate the correct array stride. */
+ idiom. The number of counters is determined from the merge pointer
+ array in gcov_info. The key is used to detect which of a set of
+ comdat functions was selected -- it points to the gcov_info object
+ of the object file containing the selected comdat function. */
struct gcov_fn_info
{
- gcov_unsigned_t ident; /* unique ident of function */
+ const struct gcov_info *key; /* comdat key */
+ gcov_unsigned_t ident; /* unique ident of function */
gcov_unsigned_t lineno_checksum; /* function lineo_checksum */
- gcov_unsigned_t cfg_checksum; /* function cfg checksum */
- unsigned n_ctrs[0]; /* instrumented counters */
+ gcov_unsigned_t cfg_checksum; /* function cfg checksum */
+ struct gcov_ctr_info ctrs[0]; /* instrumented counters */
};
/* Type of function used to merge counters. */
typedef void (*gcov_merge_fn) (gcov_type *, gcov_unsigned_t);
-/* Information about counters. */
-struct gcov_ctr_info
-{
- gcov_unsigned_t num; /* number of counters. */
- gcov_type *values; /* their values. */
- gcov_merge_fn merge; /* The function used to merge them. */
-};
-
/* Information about a single object file. */
struct gcov_info
{
@@ -443,14 +444,12 @@ struct gcov_info
gcov_unsigned_t stamp; /* uniquifying time stamp */
const char *filename; /* output file name */
+ gcov_merge_fn merge[GCOV_COUNTERS]; /* merge functions (null for
+ unused) */
+
unsigned n_functions; /* number of functions */
- const struct gcov_fn_info *functions; /* table of functions */
-
- unsigned ctr_mask; /* mask of counters instrumented. */
- struct gcov_ctr_info counts[0]; /* count data. The number of bits
- set in the ctr_mask field
- determines how big this array
- is. */
+ const struct gcov_fn_info *functions[0]; /* pointers to function
+ information */
};
/* Register a new object file module. */
diff --git a/gcc/gcov.c b/gcc/gcov.c
index 94a1c350c80..6711f7e6a47 100644
--- a/gcc/gcov.c
+++ b/gcc/gcov.c
@@ -265,7 +265,7 @@ static unsigned source_index;
/* This holds data summary information. */
-static struct gcov_summary object_summary;
+static unsigned object_runs;
static unsigned program_count;
/* Modification time of graph file. */
@@ -362,6 +362,7 @@ static int output_branch_count (FILE *, int, const arc_t *);
static void output_lines (FILE *, const source_t *);
static char *make_gcov_file_name (const char *, const char *);
static void release_structures (void);
+static void release_function (function_t *);
extern int main (int, char **);
int
@@ -537,7 +538,7 @@ static void
process_file (const char *file_name)
{
function_t *fn;
- function_t *fn_p;
+ function_t **fn_p;
function_t *old_functions;
/* Save and clear the list of current functions. They will be appended
@@ -558,11 +559,25 @@ process_file (const char *file_name)
if (read_count_file ())
return;
- for (fn_p = NULL, fn = functions; fn; fn_p = fn, fn = fn->next)
- solve_flow_graph (fn);
+ fn_p = &functions;
+ while ((fn = *fn_p) != NULL)
+ {
+ if (fn->counts)
+ {
+ solve_flow_graph (fn);
+ fn_p = &fn->next;
+ }
+ else
+ {
+ /* The function was not in the executable -- some other
+ instance must have been selected. */
+ function_t *next = fn->next;
+ release_function (fn);
+ *fn_p = next;
+ }
+ }
- if (fn_p)
- fn_p->next = old_functions;
+ *fn_p = old_functions;
}
static void
@@ -591,7 +606,7 @@ generate_results (const char *file_name)
{
accumulate_line_counts (src);
function_summary (&src->coverage, "File");
- if (flag_gcov_file)
+ if (flag_gcov_file && src->coverage.lines)
{
char *gcov_file_name = make_gcov_file_name (file_name, src->name);
FILE *gcov_file = fopen (gcov_file_name, "w");
@@ -615,6 +630,28 @@ generate_results (const char *file_name)
}
}
+/* Release a function structure */
+
+static void
+release_function (function_t *fn)
+{
+ unsigned ix;
+ block_t *block;
+
+ for (ix = fn->num_blocks, block = fn->blocks; ix--; block++)
+ {
+ arc_t *arc, *arc_n;
+
+ for (arc = block->succ; arc; arc = arc_n)
+ {
+ arc_n = arc->succ_next;
+ free (arc);
+ }
+ }
+ free (fn->blocks);
+ free (fn->counts);
+}
+
/* Release all memory used. */
static void
@@ -633,22 +670,8 @@ release_structures (void)
while ((fn = functions))
{
- unsigned ix;
- block_t *block;
-
functions = fn->next;
- for (ix = fn->num_blocks, block = fn->blocks; ix--; block++)
- {
- arc_t *arc, *arc_n;
-
- for (arc = block->succ; arc; arc = arc_n)
- {
- arc_n = arc->succ_next;
- free (arc);
- }
- }
- free (fn->blocks);
- free (fn->counts);
+ release_function (fn);
}
}
@@ -1085,35 +1108,39 @@ read_count_file (void)
unsigned length = gcov_read_unsigned ();
unsigned long base = gcov_position ();
- if (tag == GCOV_TAG_OBJECT_SUMMARY)
- gcov_read_summary (&object_summary);
- else if (tag == GCOV_TAG_PROGRAM_SUMMARY)
- program_count++;
- else if (tag == GCOV_TAG_FUNCTION)
+ if (tag == GCOV_TAG_PROGRAM_SUMMARY)
{
- {
- unsigned ident = gcov_read_unsigned ();
- struct function_info *fn_n = functions;
+ struct gcov_summary summary;
+ gcov_read_summary (&summary);
+ object_runs += summary.ctrs[GCOV_COUNTER_ARCS].runs;
+ program_count++;
+ }
+ else if (tag == GCOV_TAG_FUNCTION && !length)
+ ; /* placeholder */
+ else if (tag == GCOV_TAG_FUNCTION && length == GCOV_TAG_FUNCTION_LENGTH)
+ {
+ unsigned ident;
+ struct function_info *fn_n;
- /* Try to find the function in the list.
- To speed up the search, first start from the last function
- found. */
- for (fn = fn ? fn->next : NULL; ; fn = fn->next)
- {
- if (fn)
- ;
- else if ((fn = fn_n))
- fn_n = NULL;
- else
- {
- fnotice (stderr, "%s:unknown function '%u'\n",
- da_file_name, ident);
- break;
- }
- if (fn->ident == ident)
+ /* Try to find the function in the list. To speed up the
+ search, first start from the last function found. */
+ ident = gcov_read_unsigned ();
+ fn_n = functions;
+ for (fn = fn ? fn->next : NULL; ; fn = fn->next)
+ {
+ if (fn)
+ ;
+ else if ((fn = fn_n))
+ fn_n = NULL;
+ else
+ {
+ fnotice (stderr, "%s:unknown function '%u'\n",
+ da_file_name, ident);
break;
- }
- }
+ }
+ if (fn->ident == ident)
+ break;
+ }
if (!fn)
;
@@ -1908,8 +1935,7 @@ output_lines (FILE *gcov_file, const source_t *src)
fprintf (gcov_file, "%9s:%5d:Graph:%s\n", "-", 0, bbg_file_name);
fprintf (gcov_file, "%9s:%5d:Data:%s\n", "-", 0,
no_data_file ? "-" : da_file_name);
- fprintf (gcov_file, "%9s:%5d:Runs:%u\n", "-", 0,
- object_summary.ctrs[GCOV_COUNTER_ARCS].runs);
+ fprintf (gcov_file, "%9s:%5d:Runs:%u\n", "-", 0, object_runs);
}
fprintf (gcov_file, "%9s:%5d:Programs:%u\n", "-", 0, program_count);
diff --git a/gcc/gcse.c b/gcc/gcse.c
index 8adbc38bc0b..4806753f4a7 100644
--- a/gcc/gcse.c
+++ b/gcc/gcse.c
@@ -23,10 +23,6 @@ along with GCC; see the file COPYING3. If not see
- do rough calc of how many regs are needed in each block, and a rough
calc of how many regs are available in each class and use that to
throttle back the code in cases where RTX_COST is minimal.
- - a store to the same address as a load does not kill the load if the
- source of the store is also the destination of the load. Handling this
- allows more load motion, particularly out of loops.
-
*/
/* References searched while implementing this.
@@ -267,7 +263,7 @@ struct reg_use {rtx reg_rtx; };
struct expr
{
- /* The expression (SET_SRC for expressions, PATTERN for assignments). */
+ /* The expression. */
rtx expr;
/* Index in the available expression bitmaps. */
int bitmap_index;
@@ -346,14 +342,12 @@ static struct hash_table_d expr_hash_table;
/* This is a list of expressions which are MEMs and will be used by load
or store motion.
- Load motion tracks MEMs which aren't killed by
- anything except itself. (i.e., loads and stores to a single location).
+ Load motion tracks MEMs which aren't killed by anything except itself,
+ i.e. loads and stores to a single location.
We can then allow movement of these MEM refs with a little special
allowance. (all stores copy the same value to the reaching reg used
for the loads). This means all values used to store into memory must have
- no side effects so we can re-issue the setter value.
- Store Motion uses this structure as an expression table to track stores
- which look interesting, and might be moveable towards the exit block. */
+ no side effects so we can re-issue the setter value. */
struct ls_expr
{
@@ -454,14 +448,14 @@ static int load_killed_in_block_p (const_basic_block, int, const_rtx, int);
static void canon_list_insert (rtx, const_rtx, void *);
static void alloc_pre_mem (int, int);
static void free_pre_mem (void);
-static void compute_pre_data (void);
+static struct edge_list *compute_pre_data (void);
static int pre_expr_reaches_here_p (basic_block, struct expr *,
basic_block);
static void insert_insn_end_basic_block (struct expr *, basic_block);
static void pre_insert_copy_insn (struct expr *, rtx);
static void pre_insert_copies (void);
static int pre_delete (void);
-static int pre_gcse (void);
+static int pre_gcse (struct edge_list *);
static int one_pre_gcse_pass (void);
static void add_label_notes (rtx, rtx);
static void alloc_code_hoist_mem (int, int);
@@ -478,11 +472,9 @@ static int pre_expr_reaches_here_p_work (basic_block, struct expr *,
basic_block, char *);
static struct ls_expr * ldst_entry (rtx);
static void free_ldst_entry (struct ls_expr *);
-static void free_ldst_mems (void);
+static void free_ld_motion_mems (void);
static void print_ldst_list (FILE *);
static struct ls_expr * find_rtx_in_ldst (rtx);
-static inline struct ls_expr * first_ls_expr (void);
-static inline struct ls_expr * next_ls_expr (struct ls_expr *);
static int simple_mem (const_rtx);
static void invalidate_any_buried_refs (rtx);
static void compute_ld_motion_mems (void);
@@ -555,7 +547,6 @@ can_copy_p (enum machine_mode mode)
return can_copy[mode] != 0;
}
-
/* Cover function to xmalloc to record bytes allocated. */
@@ -714,7 +705,6 @@ struct reg_avail_info
static struct reg_avail_info *reg_avail_info;
static basic_block current_bb;
-
/* See whether X, the source of a set, is something we want to consider for
GCSE. */
@@ -935,25 +925,29 @@ oprs_unchanged_p (const_rtx x, const_rtx insn, int avail_p)
return 1;
}
-/* Used for communication between mems_conflict_for_gcse_p and
- load_killed_in_block_p. Nonzero if mems_conflict_for_gcse_p finds a
- conflict between two memory references. */
-static int gcse_mems_conflict_p;
+/* Info passed from load_killed_in_block_p to mems_conflict_for_gcse_p. */
-/* Used for communication between mems_conflict_for_gcse_p and
- load_killed_in_block_p. A memory reference for a load instruction,
- mems_conflict_for_gcse_p will see if a memory store conflicts with
- this memory load. */
-static const_rtx gcse_mem_operand;
+struct mem_conflict_info
+{
+ /* A memory reference for a load instruction, mems_conflict_for_gcse_p will
+ see if a memory store conflicts with this memory load. */
+ const_rtx mem;
-/* DEST is the output of an instruction. If it is a memory reference, and
- possibly conflicts with the load found in gcse_mem_operand, then set
- gcse_mems_conflict_p to a nonzero value. */
+ /* True if mems_conflict_for_gcse_p finds a conflict between two memory
+ references. */
+ bool conflict;
+};
+
+/* DEST is the output of an instruction. If it is a memory reference and
+ possibly conflicts with the load found in DATA, then communicate this
+ information back through DATA. */
static void
mems_conflict_for_gcse_p (rtx dest, const_rtx setter ATTRIBUTE_UNUSED,
- void *data ATTRIBUTE_UNUSED)
+ void *data)
{
+ struct mem_conflict_info *mci = (struct mem_conflict_info *) data;
+
while (GET_CODE (dest) == SUBREG
|| GET_CODE (dest) == ZERO_EXTRACT
|| GET_CODE (dest) == STRICT_LOW_PART)
@@ -967,17 +961,15 @@ mems_conflict_for_gcse_p (rtx dest, const_rtx setter ATTRIBUTE_UNUSED,
/* If we are setting a MEM in our list of specially recognized MEMs,
don't mark as killed this time. */
-
- if (expr_equiv_p (dest, gcse_mem_operand) && pre_ldst_mems != NULL)
+ if (pre_ldst_mems != NULL && expr_equiv_p (dest, mci->mem))
{
if (!find_rtx_in_ldst (dest))
- gcse_mems_conflict_p = 1;
+ mci->conflict = true;
return;
}
- if (true_dependence (dest, GET_MODE (dest), gcse_mem_operand,
- rtx_addr_varies_p))
- gcse_mems_conflict_p = 1;
+ if (true_dependence (dest, GET_MODE (dest), mci->mem, rtx_addr_varies_p))
+ mci->conflict = true;
}
/* Return nonzero if the expression in X (a memory reference) is killed
@@ -989,7 +981,8 @@ mems_conflict_for_gcse_p (rtx dest, const_rtx setter ATTRIBUTE_UNUSED,
AVAIL_P to 0. */
static int
-load_killed_in_block_p (const_basic_block bb, int uid_limit, const_rtx x, int avail_p)
+load_killed_in_block_p (const_basic_block bb, int uid_limit, const_rtx x,
+ int avail_p)
{
VEC (rtx,heap) *list = modify_mem_list[bb->index];
rtx setter;
@@ -1001,6 +994,8 @@ load_killed_in_block_p (const_basic_block bb, int uid_limit, const_rtx x, int av
FOR_EACH_VEC_ELT_REVERSE (rtx, list, ix, setter)
{
+ struct mem_conflict_info mci;
+
/* Ignore entries in the list that do not apply. */
if ((avail_p
&& DF_INSN_LUID (setter) < uid_limit)
@@ -1015,14 +1010,11 @@ load_killed_in_block_p (const_basic_block bb, int uid_limit, const_rtx x, int av
return 1;
/* SETTER must be an INSN of some kind that sets memory. Call
- note_stores to examine each hunk of memory that is modified.
-
- The note_stores interface is pretty limited, so we have to
- communicate via global variables. Yuk. */
- gcse_mem_operand = x;
- gcse_mems_conflict_p = 0;
- note_stores (PATTERN (setter), mems_conflict_for_gcse_p, NULL);
- if (gcse_mems_conflict_p)
+ note_stores to examine each hunk of memory that is modified. */
+ mci.mem = x;
+ mci.conflict = false;
+ note_stores (PATTERN (setter), mems_conflict_for_gcse_p, &mci);
+ if (mci.conflict)
return 1;
}
return 0;
@@ -1061,8 +1053,7 @@ hash_expr (const_rtx x, enum machine_mode mode, int *do_not_record_p,
*do_not_record_p = 0;
- hash = hash_rtx (x, mode, do_not_record_p,
- NULL, /*have_reg_qty=*/false);
+ hash = hash_rtx (x, mode, do_not_record_p, NULL, /*have_reg_qty=*/false);
return hash % hash_table_size;
}
@@ -1190,13 +1181,13 @@ insert_expr_in_table (rtx x, enum machine_mode mode, rtx insn, int antic_p,
}
}
-/* Scan pattern PAT of INSN and add an entry to the hash TABLE. */
+/* Scan SET present in INSN and add an entry to the hash TABLE. */
static void
-hash_scan_set (rtx pat, rtx insn, struct hash_table_d *table)
+hash_scan_set (rtx set, rtx insn, struct hash_table_d *table)
{
- rtx src = SET_SRC (pat);
- rtx dest = SET_DEST (pat);
+ rtx src = SET_SRC (set);
+ rtx dest = SET_DEST (set);
rtx note;
if (GET_CODE (src) == CALL)
@@ -1227,7 +1218,7 @@ hash_scan_set (rtx pat, rtx insn, struct hash_table_d *table)
&& REG_NOTE_KIND (note) == REG_EQUAL
&& !REG_P (src)
&& want_to_gcse_p (XEXP (note, 0), NULL))
- src = XEXP (note, 0), pat = gen_rtx_SET (VOIDmode, dest, src);
+ src = XEXP (note, 0), set = gen_rtx_SET (VOIDmode, dest, src);
/* Only record sets of pseudo-regs in the hash table. */
if (regno >= FIRST_PSEUDO_REGISTER
@@ -1242,7 +1233,7 @@ hash_scan_set (rtx pat, rtx insn, struct hash_table_d *table)
/* Is SET_SRC something we want to gcse? */
&& want_to_gcse_p (src, &max_distance)
/* Don't CSE a nop. */
- && ! set_noop_p (pat)
+ && ! set_noop_p (set)
/* Don't GCSE if it has attached REG_EQUIV note.
At this point this only function parameters should have
REG_EQUIV notes and if the argument slot is used somewhere
@@ -1286,7 +1277,7 @@ hash_scan_set (rtx pat, rtx insn, struct hash_table_d *table)
/* Is SET_DEST something we want to gcse? */
&& want_to_gcse_p (dest, &max_distance)
/* Don't CSE a nop. */
- && ! set_noop_p (pat)
+ && ! set_noop_p (set)
/* Don't GCSE if it has attached REG_EQUIV note.
At this point this only function parameters should have
REG_EQUIV notes and if the argument slot is used somewhere
@@ -1325,16 +1316,7 @@ hash_scan_call (rtx x ATTRIBUTE_UNUSED, rtx insn ATTRIBUTE_UNUSED,
/* Currently nothing to do. */
}
-/* Process INSN and add hash table entries as appropriate.
-
- Only available expressions that set a single pseudo-reg are recorded.
-
- Single sets in a PARALLEL could be handled, but it's an extra complication
- that isn't dealt with right now. The trick is handling the CLOBBERs that
- are also in the PARALLEL. Later.
-
- If SET_P is nonzero, this is for the assignment hash table,
- otherwise it is for the expression hash table. */
+/* Process INSN and add hash table entries as appropriate. */
static void
hash_scan_insn (rtx insn, struct hash_table_d *table)
@@ -1347,6 +1329,13 @@ hash_scan_insn (rtx insn, struct hash_table_d *table)
if (GET_CODE (pat) == SET)
hash_scan_set (pat, insn, table);
+
+ else if (GET_CODE (pat) == CLOBBER)
+ hash_scan_clobber (pat, insn, table);
+
+ else if (GET_CODE (pat) == CALL)
+ hash_scan_call (pat, insn, table);
+
else if (GET_CODE (pat) == PARALLEL)
for (i = 0; i < XVECLEN (pat, 0); i++)
{
@@ -1359,13 +1348,10 @@ hash_scan_insn (rtx insn, struct hash_table_d *table)
else if (GET_CODE (x) == CALL)
hash_scan_call (x, insn, table);
}
-
- else if (GET_CODE (pat) == CLOBBER)
- hash_scan_clobber (pat, insn, table);
- else if (GET_CODE (pat) == CALL)
- hash_scan_call (pat, insn, table);
}
+/* Dump the hash table TABLE to file FILE under the name NAME. */
+
static void
dump_hash_table (FILE *file, const char *name, struct hash_table_d *table)
{
@@ -1429,13 +1415,12 @@ record_last_reg_set_info (rtx insn, int regno)
}
}
-
/* Record all of the canonicalized MEMs of record_last_mem_set_info's insn.
Note we store a pair of elements in the list, so they have to be
taken off pairwise. */
static void
-canon_list_insert (rtx dest ATTRIBUTE_UNUSED, const_rtx unused1 ATTRIBUTE_UNUSED,
+canon_list_insert (rtx dest ATTRIBUTE_UNUSED, const_rtx x ATTRIBUTE_UNUSED,
void * v_insn)
{
rtx dest_addr, insn;
@@ -1634,7 +1619,6 @@ free_modify_mem_tables (void)
modify_mem_list = 0;
canon_modify_mem_list = 0;
}
-
/* For each block, compute whether X is transparent. X is either an
expression or an assignment [though we don't care which, for this context
@@ -1745,11 +1729,11 @@ compute_transp (const_rtx x, int indx, sbitmap *bmap)
compute_transp (XVECEXP (x, i, j), indx, bmap);
}
}
-
/* Compute PRE+LCM working variables. */
/* Local properties of expressions. */
+
/* Nonzero for expressions that are transparent in the block. */
static sbitmap *transp;
@@ -1772,9 +1756,6 @@ static sbitmap *pre_insert_map;
/* Nonzero for expressions which should be deleted in a specific block. */
static sbitmap *pre_delete_map;
-/* Contains the edge_list returned by pre_edge_lcm. */
-static struct edge_list *edge_list;
-
/* Allocate vars used for PRE analysis. */
static void
@@ -1826,6 +1807,7 @@ static void
prune_expressions (bool pre_p)
{
sbitmap prune_exprs;
+ struct expr *expr;
unsigned int ui;
basic_block bb;
@@ -1833,17 +1815,16 @@ prune_expressions (bool pre_p)
sbitmap_zero (prune_exprs);
for (ui = 0; ui < expr_hash_table.size; ui++)
{
- struct expr *e;
- for (e = expr_hash_table.table[ui]; e != NULL; e = e->next_same_hash)
+ for (expr = expr_hash_table.table[ui]; expr; expr = expr->next_same_hash)
{
/* Note potentially trapping expressions. */
- if (may_trap_p (e->expr))
+ if (may_trap_p (expr->expr))
{
- SET_BIT (prune_exprs, e->bitmap_index);
+ SET_BIT (prune_exprs, expr->bitmap_index);
continue;
}
- if (!pre_p && MEM_P (e->expr))
+ if (!pre_p && MEM_P (expr->expr))
/* Note memory references that can be clobbered by a call.
We do not split abnormal edges in hoisting, so would
a memory reference get hoisted along an abnormal edge,
@@ -1851,13 +1832,13 @@ prune_expressions (bool pre_p)
constant memory references can be hoisted along abnormal
edges. */
{
- if (GET_CODE (XEXP (e->expr, 0)) == SYMBOL_REF
- && CONSTANT_POOL_ADDRESS_P (XEXP (e->expr, 0)))
+ if (GET_CODE (XEXP (expr->expr, 0)) == SYMBOL_REF
+ && CONSTANT_POOL_ADDRESS_P (XEXP (expr->expr, 0)))
continue;
- if (MEM_READONLY_P (e->expr)
- && !MEM_VOLATILE_P (e->expr)
- && MEM_NOTRAP_P (e->expr))
+ if (MEM_READONLY_P (expr->expr)
+ && !MEM_VOLATILE_P (expr->expr)
+ && MEM_NOTRAP_P (expr->expr))
/* Constant memory reference, e.g., a PIC address. */
continue;
@@ -1865,7 +1846,7 @@ prune_expressions (bool pre_p)
analysis to determine if this mem is actually killed
by this call. */
- SET_BIT (prune_exprs, e->bitmap_index);
+ SET_BIT (prune_exprs, expr->bitmap_index);
}
}
}
@@ -1976,9 +1957,10 @@ prune_insertions_deletions (int n_elems)
/* Top level routine to do the dataflow analysis needed by PRE. */
-static void
+static struct edge_list *
compute_pre_data (void)
{
+ struct edge_list *edge_list;
basic_block bb;
compute_local_properties (transp, comp, antloc, &expr_hash_table);
@@ -2004,6 +1986,8 @@ compute_pre_data (void)
ae_kill = NULL;
prune_insertions_deletions (expr_hash_table.n_elems);
+
+ return edge_list;
}
/* PRE utilities */
@@ -2022,7 +2006,8 @@ compute_pre_data (void)
the closest such expression. */
static int
-pre_expr_reaches_here_p_work (basic_block occr_bb, struct expr *expr, basic_block bb, char *visited)
+pre_expr_reaches_here_p_work (basic_block occr_bb, struct expr *expr,
+ basic_block bb, char *visited)
{
edge pred;
edge_iterator ei;
@@ -2079,15 +2064,13 @@ pre_expr_reaches_here_p (basic_block occr_bb, struct expr *expr, basic_block bb)
return rval;
}
-
-/* Given an expr, generate RTL which we can insert at the end of a BB,
- or on an edge. Set the block number of any insns generated to
- the value of BB. */
+/* Generate RTL to copy an EXPR to its `reaching_reg' and return it. */
static rtx
process_insert_insn (struct expr *expr)
{
rtx reg = expr->reaching_reg;
+ /* Copy the expression to make sure we don't have any sharing issues. */
rtx exp = copy_rtx (expr->expr);
rtx pat;
@@ -2099,8 +2082,7 @@ process_insert_insn (struct expr *expr)
emit_move_insn (reg, exp);
/* Otherwise, make a new insn to compute this expression and make sure the
- insn will be recognized (this also adds any needed CLOBBERs). Copy the
- expression to make sure we don't have any sharing issues. */
+ insn will be recognized (this also adds any needed CLOBBERs). */
else
{
rtx insn = emit_insn (gen_rtx_SET (VOIDmode, reg, exp));
@@ -2109,7 +2091,6 @@ process_insert_insn (struct expr *expr)
gcc_unreachable ();
}
-
pat = get_insns ();
end_sequence ();
@@ -2254,7 +2235,9 @@ pre_edge_insert (struct edge_list *edge_list, struct expr **index_map)
{
SBITMAP_ELT_TYPE insert = pre_insert_map[e]->elms[i];
- for (j = indx; insert && j < (int) expr_hash_table.n_elems; j++, insert >>= 1)
+ for (j = indx;
+ insert && j < (int) expr_hash_table.n_elems;
+ j++, insert >>= 1)
if ((insert & 1) != 0 && index_map[j]->reaching_reg != NULL_RTX)
{
struct expr *expr = index_map[j];
@@ -2430,7 +2413,7 @@ pre_insert_copies (void)
Need to do some profiling. */
for (i = 0; i < expr_hash_table.size; i++)
- for (expr = expr_hash_table.table[i]; expr != NULL; expr = expr->next_same_hash)
+ for (expr = expr_hash_table.table[i]; expr; expr = expr->next_same_hash)
{
/* If the basic block isn't reachable, PPOUT will be TRUE. However,
we don't want to insert a copy here because the expression may not
@@ -2481,8 +2464,9 @@ pre_insert_copies (void)
/* Emit move from SRC to DEST noting the equivalence with expression computed
in INSN. */
+
static rtx
-gcse_emit_move_after (rtx src, rtx dest, rtx insn)
+gcse_emit_move_after (rtx dest, rtx src, rtx insn)
{
rtx new_rtx;
rtx set = single_set (insn), set2;
@@ -2513,7 +2497,7 @@ gcse_emit_move_after (rtx src, rtx dest, rtx insn)
the expression into the result of the SET. It is left to later passes
(cprop, cse2, flow, combine, regmove) to propagate the copy or eliminate it.
- Returns nonzero if a change is made. */
+ Return nonzero if a change is made. */
static int
pre_delete (void)
@@ -2525,15 +2509,11 @@ pre_delete (void)
changed = 0;
for (i = 0; i < expr_hash_table.size; i++)
- for (expr = expr_hash_table.table[i];
- expr != NULL;
- expr = expr->next_same_hash)
+ for (expr = expr_hash_table.table[i]; expr; expr = expr->next_same_hash)
{
int indx = expr->bitmap_index;
- /* We only need to search antic_occr since we require
- ANTLOC != 0. */
-
+ /* We only need to search antic_occr since we require ANTLOC != 0. */
for (occr = expr->antic_occr; occr != NULL; occr = occr->next)
{
rtx insn = occr->insn;
@@ -2551,7 +2531,7 @@ pre_delete (void)
if (expr->reaching_reg == NULL)
expr->reaching_reg = gen_reg_rtx_and_attrs (SET_DEST (set));
- gcse_emit_move_after (expr->reaching_reg, SET_DEST (set), insn);
+ gcse_emit_move_after (SET_DEST (set), expr->reaching_reg, insn);
delete_insn (insn);
occr->deleted_p = 1;
changed = 1;
@@ -2593,7 +2573,7 @@ pre_delete (void)
redundancies. */
static int
-pre_gcse (void)
+pre_gcse (struct edge_list *edge_list)
{
unsigned int i;
int did_insert, changed;
@@ -2605,7 +2585,7 @@ pre_gcse (void)
index_map = XCNEWVEC (struct expr *, expr_hash_table.n_elems);
for (i = 0; i < expr_hash_table.size; i++)
- for (expr = expr_hash_table.table[i]; expr != NULL; expr = expr->next_same_hash)
+ for (expr = expr_hash_table.table[i]; expr; expr = expr->next_same_hash)
index_map[expr->bitmap_index] = expr;
/* Delete the redundant insns first so that
@@ -2659,20 +2639,23 @@ one_pre_gcse_pass (void)
compute_ld_motion_mems ();
compute_hash_table (&expr_hash_table);
- trim_ld_motion_mems ();
+ if (flag_gcse_lm)
+ trim_ld_motion_mems ();
if (dump_file)
dump_hash_table (dump_file, "Expression", &expr_hash_table);
if (expr_hash_table.n_elems > 0)
{
+ struct edge_list *edge_list;
alloc_pre_mem (last_basic_block, expr_hash_table.n_elems);
- compute_pre_data ();
- changed |= pre_gcse ();
+ edge_list = compute_pre_data ();
+ changed |= pre_gcse (edge_list);
free_edge_list (edge_list);
free_pre_mem ();
}
- free_ldst_mems ();
+ if (flag_gcse_lm)
+ free_ld_motion_mems ();
remove_fake_exit_edges ();
free_hash_table (&expr_hash_table);
@@ -2924,6 +2907,7 @@ hoist_expr_reaches_here_p (basic_block expr_bb, int expr_index, basic_block bb,
}
/* Find occurence in BB. */
+
static struct occr *
find_occr_in_bb (struct occr *occr, basic_block bb)
{
@@ -2955,7 +2939,7 @@ hoist_code (void)
index_map = XCNEWVEC (struct expr *, expr_hash_table.n_elems);
for (i = 0; i < expr_hash_table.size; i++)
- for (expr = expr_hash_table.table[i]; expr != NULL; expr = expr->next_same_hash)
+ for (expr = expr_hash_table.table[i]; expr; expr = expr->next_same_hash)
index_map[expr->bitmap_index] = expr;
/* Calculate sizes of basic blocks and note how far
@@ -3145,7 +3129,7 @@ hoist_code (void)
expr->reaching_reg
= gen_reg_rtx_and_attrs (SET_DEST (set));
- gcse_emit_move_after (expr->reaching_reg, SET_DEST (set),
+ gcse_emit_move_after (SET_DEST (set), expr->reaching_reg,
insn);
delete_insn (insn);
occr->deleted_p = 1;
@@ -3233,9 +3217,9 @@ one_code_hoisting_pass (void)
return changed;
}
-/* Here we provide the things required to do store motion towards
- the exit. In order for this to be effective, gcse also needed to
- be taught how to move a load when it is kill only by a store to itself.
+/* Here we provide the things required to do store motion towards the exit.
+ In order for this to be effective, gcse also needed to be taught how to
+ move a load when it is killed only by a store to itself.
int i;
float a[10];
@@ -3251,7 +3235,7 @@ one_code_hoisting_pass (void)
of the loop.
The 'Load Motion' referred to and implemented in this file is
- an enhancement to gcse which when using edge based lcm, recognizes
+ an enhancement to gcse which when using edge based LCM, recognizes
this situation and allows gcse to move the load out of the loop.
Once gcse has hoisted the load, store motion can then push this
@@ -3263,7 +3247,8 @@ pre_ldst_expr_hash (const void *p)
{
int do_not_record_p = 0;
const struct ls_expr *const x = (const struct ls_expr *) p;
- return hash_rtx (x->pattern, GET_MODE (x->pattern), &do_not_record_p, NULL, false);
+ return
+ hash_rtx (x->pattern, GET_MODE (x->pattern), &do_not_record_p, NULL, false);
}
static int
@@ -3326,7 +3311,7 @@ free_ldst_entry (struct ls_expr * ptr)
/* Free up all memory associated with the ldst list. */
static void
-free_ldst_mems (void)
+free_ld_motion_mems (void)
{
if (pre_ldst_table)
htab_delete (pre_ldst_table);
@@ -3353,7 +3338,7 @@ print_ldst_list (FILE * file)
fprintf (file, "LDST list: \n");
- for (ptr = first_ls_expr (); ptr != NULL; ptr = next_ls_expr (ptr))
+ for (ptr = pre_ldst_mems; ptr != NULL; ptr = ptr->next)
{
fprintf (file, " Pattern (%3d): ", ptr->index);
@@ -3394,35 +3379,16 @@ find_rtx_in_ldst (rtx x)
return NULL;
return (struct ls_expr *) *slot;
}
-
-/* Return first item in the list. */
-
-static inline struct ls_expr *
-first_ls_expr (void)
-{
- return pre_ldst_mems;
-}
-
-/* Return the next item in the list after the specified one. */
-
-static inline struct ls_expr *
-next_ls_expr (struct ls_expr * ptr)
-{
- return ptr->next;
-}
/* Load Motion for loads which only kill themselves. */
-/* Return true if x is a simple MEM operation, with no registers or
- side effects. These are the types of loads we consider for the
- ld_motion list, otherwise we let the usual aliasing take care of it. */
+/* Return true if x, a MEM, is a simple access with no side effects.
+ These are the types of loads we consider for the ld_motion list,
+ otherwise we let the usual aliasing take care of it. */
static int
simple_mem (const_rtx x)
{
- if (! MEM_P (x))
- return 0;
-
if (MEM_VOLATILE_P (x))
return 0;
@@ -3499,8 +3465,8 @@ compute_ld_motion_mems (void)
rtx insn;
pre_ldst_mems = NULL;
- pre_ldst_table = htab_create (13, pre_ldst_expr_hash,
- pre_ldst_expr_eq, NULL);
+ pre_ldst_table
+ = htab_create (13, pre_ldst_expr_hash, pre_ldst_expr_eq, NULL);
FOR_EACH_BB (bb)
{
@@ -3641,7 +3607,7 @@ update_ld_motion_stores (struct expr * expr)
if (dump_file)
{
fprintf (dump_file, "PRE: store updated with reaching reg ");
- print_rtl (dump_file, expr->reaching_reg);
+ print_rtl (dump_file, reg);
fprintf (dump_file, ":\n ");
print_inline_rtx (dump_file, insn, 8);
fprintf (dump_file, "\n");
@@ -3698,7 +3664,6 @@ is_too_expensive (const char *pass)
return false;
}
-
/* All the passes implemented in this file. Each pass has its
own gate and execute function, and at the end of the file a
diff --git a/gcc/gengtype.c b/gcc/gengtype.c
index 6063d81daa5..c9c08a4db31 100644
--- a/gcc/gengtype.c
+++ b/gcc/gengtype.c
@@ -1015,6 +1015,7 @@ adjust_field_rtx_def (type_p t, options_p ARG_UNUSED (opt))
{
case NOTE_INSN_MAX:
case NOTE_INSN_DELETED_LABEL:
+ case NOTE_INSN_DELETED_DEBUG_LABEL:
note_flds = create_field (note_flds, &string_type, "rt_str");
break;
diff --git a/gcc/genopinit.c b/gcc/genopinit.c
index 4c64842ea27..44eba24f11a 100644
--- a/gcc/genopinit.c
+++ b/gcc/genopinit.c
@@ -243,6 +243,28 @@ static const char * const optabs[] =
"set_direct_optab_handler (sync_compare_and_swap_optab, $A, CODE_FOR_$(sync_compare_and_swap$I$a$))",
"set_direct_optab_handler (sync_lock_test_and_set_optab, $A, CODE_FOR_$(sync_lock_test_and_set$I$a$))",
"set_direct_optab_handler (sync_lock_release_optab, $A, CODE_FOR_$(sync_lock_release$I$a$))",
+ "set_direct_optab_handler (atomic_exchange_optab, $A, CODE_FOR_$(atomic_exchange$I$a$))",
+ "set_direct_optab_handler (atomic_compare_and_swap_optab, $A, CODE_FOR_$(atomic_compare_and_swap$I$a$))",
+ "set_direct_optab_handler (atomic_load_optab, $A, CODE_FOR_$(atomic_load$I$a$))",
+ "set_direct_optab_handler (atomic_store_optab, $A, CODE_FOR_$(atomic_store$I$a$))",
+ "set_direct_optab_handler (atomic_add_fetch_optab, $A, CODE_FOR_$(atomic_add_fetch$I$a$))",
+ "set_direct_optab_handler (atomic_sub_fetch_optab, $A, CODE_FOR_$(atomic_sub_fetch$I$a$))",
+ "set_direct_optab_handler (atomic_and_fetch_optab, $A, CODE_FOR_$(atomic_and_fetch$I$a$))",
+ "set_direct_optab_handler (atomic_nand_fetch_optab, $A, CODE_FOR_$(atomic_nand_fetch$I$a$))",
+ "set_direct_optab_handler (atomic_xor_fetch_optab, $A, CODE_FOR_$(atomic_xor_fetch$I$a$))",
+ "set_direct_optab_handler (atomic_or_fetch_optab, $A, CODE_FOR_$(atomic_or_fetch$I$a$))",
+ "set_direct_optab_handler (atomic_fetch_add_optab, $A, CODE_FOR_$(atomic_fetch_add$I$a$))",
+ "set_direct_optab_handler (atomic_fetch_sub_optab, $A, CODE_FOR_$(atomic_fetch_sub$I$a$))",
+ "set_direct_optab_handler (atomic_fetch_and_optab, $A, CODE_FOR_$(atomic_fetch_and$I$a$))",
+ "set_direct_optab_handler (atomic_fetch_nand_optab, $A, CODE_FOR_$(atomic_fetch_nand$I$a$))",
+ "set_direct_optab_handler (atomic_fetch_xor_optab, $A, CODE_FOR_$(atomic_fetch_xor$I$a$))",
+ "set_direct_optab_handler (atomic_fetch_or_optab, $A, CODE_FOR_$(atomic_fetch_or$I$a$))",
+ "set_direct_optab_handler (atomic_add_optab, $A, CODE_FOR_$(atomic_add$I$a$))",
+ "set_direct_optab_handler (atomic_sub_optab, $A, CODE_FOR_$(atomic_sub$I$a$))",
+ "set_direct_optab_handler (atomic_and_optab, $A, CODE_FOR_$(atomic_and$I$a$))",
+ "set_direct_optab_handler (atomic_nand_optab, $A, CODE_FOR_$(atomic_nand$I$a$))",
+ "set_direct_optab_handler (atomic_xor_optab, $A, CODE_FOR_$(atomic_xor$I$a$))",
+ "set_direct_optab_handler (atomic_or_optab, $A, CODE_FOR_$(atomic_or$I$a$))",
"set_optab_handler (vec_set_optab, $A, CODE_FOR_$(vec_set$a$))",
"set_optab_handler (vec_extract_optab, $A, CODE_FOR_$(vec_extract$a$))",
"set_optab_handler (vec_extract_even_optab, $A, CODE_FOR_$(vec_extract_even$a$))",
diff --git a/gcc/gimple-fold.c b/gcc/gimple-fold.c
index aa67d248c53..53bfb9641f8 100644
--- a/gcc/gimple-fold.c
+++ b/gcc/gimple-fold.c
@@ -1057,53 +1057,82 @@ gimple_extract_devirt_binfo_from_cst (tree cst)
simplifies to a constant value. Return true if any changes were made.
It is assumed that the operands have been previously folded. */
-bool
+static bool
gimple_fold_call (gimple_stmt_iterator *gsi, bool inplace)
{
gimple stmt = gsi_stmt (*gsi);
tree callee;
+ bool changed = false;
+ unsigned i;
- /* Check for builtins that CCP can handle using information not
- available in the generic fold routines. */
- callee = gimple_call_fndecl (stmt);
- if (!inplace && callee && DECL_BUILT_IN (callee))
- {
- tree result = gimple_fold_builtin (stmt);
-
- if (result)
- {
- if (!update_call_from_tree (gsi, result))
- gimplify_and_update_call_from_tree (gsi, result);
- return true;
- }
- }
+ /* Fold *& in call arguments. */
+ for (i = 0; i < gimple_call_num_args (stmt); ++i)
+ if (REFERENCE_CLASS_P (gimple_call_arg (stmt, i)))
+ {
+ tree tmp = maybe_fold_reference (gimple_call_arg (stmt, i), false);
+ if (tmp)
+ {
+ gimple_call_set_arg (stmt, i, tmp);
+ changed = true;
+ }
+ }
/* Check for virtual calls that became direct calls. */
callee = gimple_call_fn (stmt);
if (callee && TREE_CODE (callee) == OBJ_TYPE_REF)
{
- tree binfo, fndecl, obj;
- HOST_WIDE_INT token;
-
if (gimple_call_addr_fndecl (OBJ_TYPE_REF_EXPR (callee)) != NULL_TREE)
{
gimple_call_set_fn (stmt, OBJ_TYPE_REF_EXPR (callee));
- return true;
+ changed = true;
}
+ else
+ {
+ tree obj = OBJ_TYPE_REF_OBJECT (callee);
+ tree binfo = gimple_extract_devirt_binfo_from_cst (obj);
+ if (binfo)
+ {
+ HOST_WIDE_INT token
+ = TREE_INT_CST_LOW (OBJ_TYPE_REF_TOKEN (callee));
+ tree fndecl = gimple_get_virt_method_for_binfo (token, binfo);
+ if (fndecl)
+ {
+ gimple_call_set_fndecl (stmt, fndecl);
+ changed = true;
+ }
+ }
+ }
+ }
- obj = OBJ_TYPE_REF_OBJECT (callee);
- binfo = gimple_extract_devirt_binfo_from_cst (obj);
- if (!binfo)
- return false;
- token = TREE_INT_CST_LOW (OBJ_TYPE_REF_TOKEN (callee));
- fndecl = gimple_get_virt_method_for_binfo (token, binfo);
- if (!fndecl)
- return false;
- gimple_call_set_fndecl (stmt, fndecl);
- return true;
+ /* Check whether propagating into the function address made the
+ call direct, and thus possibly non-inlineable.
+ ??? This asks for a more conservative setting of the non-inlinable
+ flag, namely true for all indirect calls. But that would require
+ that we can re-compute the flag conservatively, thus it isn't
+ ever initialized from something else than return/argument type
+ checks . */
+ callee = gimple_call_fndecl (stmt);
+ if (callee
+ && !gimple_check_call_matching_types (stmt, callee))
+ gimple_call_set_cannot_inline (stmt, true);
+
+ if (inplace)
+ return changed;
+
+ /* Check for builtins that CCP can handle using information not
+ available in the generic fold routines. */
+ if (callee && DECL_BUILT_IN (callee))
+ {
+ tree result = gimple_fold_builtin (stmt);
+ if (result)
+ {
+ if (!update_call_from_tree (gsi, result))
+ gimplify_and_update_call_from_tree (gsi, result);
+ changed = true;
+ }
}
- return false;
+ return changed;
}
/* Worker for both fold_stmt and fold_stmt_inplace. The INPLACE argument
@@ -1162,17 +1191,6 @@ fold_stmt_1 (gimple_stmt_iterator *gsi, bool inplace)
break;
case GIMPLE_CALL:
- /* Fold *& in call arguments. */
- for (i = 0; i < gimple_call_num_args (stmt); ++i)
- if (REFERENCE_CLASS_P (gimple_call_arg (stmt, i)))
- {
- tree tmp = maybe_fold_reference (gimple_call_arg (stmt, i), false);
- if (tmp)
- {
- gimple_call_set_arg (stmt, i, tmp);
- changed = true;
- }
- }
changed |= gimple_fold_call (gsi, inplace);
break;
diff --git a/gcc/gimple.h b/gcc/gimple.h
index 4b78ff5270d..ffecc2617af 100644
--- a/gcc/gimple.h
+++ b/gcc/gimple.h
@@ -959,7 +959,6 @@ unsigned get_gimple_rhs_num_ops (enum tree_code);
#define gimple_alloc(c, n) gimple_alloc_stat (c, n MEM_STAT_INFO)
gimple gimple_alloc_stat (enum gimple_code, unsigned MEM_STAT_DECL);
const char *gimple_decl_printable_name (tree, int);
-bool gimple_fold_call (gimple_stmt_iterator *gsi, bool inplace);
tree gimple_get_virt_method_for_binfo (HOST_WIDE_INT, tree);
void gimple_adjust_this_by_delta (gimple_stmt_iterator *, tree);
tree gimple_extract_devirt_binfo_from_cst (tree);
diff --git a/gcc/config/bfin/crtlibid.s b/gcc/ginclude/stdalign.h
index beab8093810..fd55ed3010a 100644
--- a/gcc/config/bfin/crtlibid.s
+++ b/gcc/ginclude/stdalign.h
@@ -1,6 +1,4 @@
-/* Provide a weak definition of the library ID, for the benefit of certain
- configure scripts.
- Copyright (C) 2005, 2008, 2009 Free Software Foundation, Inc.
+/* Copyright (C) 2011 Free Software Foundation, Inc.
This file is part of GCC.
@@ -23,7 +21,19 @@ a copy of the GCC Runtime Library Exception along with this program;
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
- .ident "GNU C crtlibid.o"
+/* ISO C1X: 7.15 Alignment <stdalign.h>. */
-.weak _current_shared_library_p5_offset_
-.set _current_shared_library_p5_offset_, 0
+#ifndef _STDALIGN_H
+#define _STDALIGN_H
+
+#ifndef __cplusplus
+
+#define alignas _Alignas
+#define alignof _Alignof
+
+#define __alignas_is_defined 1
+#define __alignof_is_defined 1
+
+#endif
+
+#endif /* stdalign.h */
diff --git a/gcc/ginclude/stddef.h b/gcc/ginclude/stddef.h
index 565ef7b8f84..1cc3cb4e75a 100644
--- a/gcc/ginclude/stddef.h
+++ b/gcc/ginclude/stddef.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1989, 1997, 1998, 1999, 2000, 2002, 2004, 2009
+/* Copyright (C) 1989, 1997, 1998, 1999, 2000, 2002, 2004, 2009, 2011
Free Software Foundation, Inc.
This file is part of GCC.
@@ -412,6 +412,20 @@ typedef __WINT_TYPE__ wint_t;
/* Offset of member MEMBER in a struct of type TYPE. */
#define offsetof(TYPE, MEMBER) __builtin_offsetof (TYPE, MEMBER)
+#if (defined (__STDC_VERSION__) && __STDC_VERSION__ > 199901L) \
+ || (defined(__cplusplus) && __cplusplus >= 201103L)
+#ifndef _GCC_MAX_ALIGN_T
+#define _GCC_MAX_ALIGN_T
+/* Type whose alignment is supported in every context and is at least
+ as great as that of any standard type not using alignment
+ specifiers. */
+typedef struct {
+ long long __max_align_ll __attribute__((__aligned__(__alignof__(long long))));
+ long double __max_align_ld __attribute__((__aligned__(__alignof__(long double))));
+} max_align_t;
+#endif
+#endif /* C1X or C++11. */
+
#endif /* _STDDEF_H was defined this time */
#endif /* !_STDDEF_H && !_STDDEF_H_ && !_ANSI_STDDEF_H && !__STDDEF_H__
diff --git a/gcc/go/ChangeLog b/gcc/go/ChangeLog
index 3802fa8e463..2eaf210c94f 100644
--- a/gcc/go/ChangeLog
+++ b/gcc/go/ChangeLog
@@ -1,3 +1,7 @@
+2011-11-02 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
+
+ * Make-lang.in (gospec.o): Pass SHLIB instead of SHLIB_LINK.
+
2011-08-24 Roberto Lublinerman <rluble@gmail.com>
* lang.opt: Add fgo-optimize-.
diff --git a/gcc/go/Make-lang.in b/gcc/go/Make-lang.in
index d7ae7aee6fb..62a4d6f0dee 100644
--- a/gcc/go/Make-lang.in
+++ b/gcc/go/Make-lang.in
@@ -32,7 +32,7 @@ go: go1$(exeext)
gospec.o: $(srcdir)/go/gospec.c $(SYSTEM_H) coretypes.h $(TM_H) $(GCC_H) \
$(CONFIG_H) opts.h
- (SHLIB_LINK='$(SHLIB_LINK)'; \
+ (SHLIB='$(SHLIB)'; \
$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(DRIVER_DEFINES) \
$(INCLUDES) $(srcdir)/go/gospec.c)
diff --git a/gcc/go/gofrontend/statements.cc b/gcc/go/gofrontend/statements.cc
index abc629e12c3..156977d3f5d 100644
--- a/gcc/go/gofrontend/statements.cc
+++ b/gcc/go/gofrontend/statements.cc
@@ -4559,10 +4559,26 @@ Select_clauses::Select_clause::lower(Gogo* gogo, Named_object* function,
loc);
Statement* s = Statement::make_tuple_receive_assignment(val, closed, ref,
true, loc);
+
// We have to put S in STATEMENTS_, because that is where the
// variables are declared.
+
go_assert(this->statements_ != NULL);
- this->statements_->add_statement_at_front(s);
+
+ // Skip the variable declaration statements themselves.
+ size_t skip = 1;
+ if (this->var_ != NULL)
+ skip = 2;
+
+ // Verify that we are only skipping variable declarations.
+ size_t i = 0;
+ for (Block::iterator p = this->statements_->begin();
+ i < skip && p != this->statements_->end();
+ ++p, ++i)
+ go_assert((*p)->variable_declaration_statement() != NULL);
+
+ this->statements_->insert_statement_before(skip, s);
+
// We have to lower STATEMENTS_ again, to lower the tuple
// receive assignment we just added.
gogo->lower_block(function, this->statements_);
@@ -4655,7 +4671,8 @@ Select_clauses::Select_clause::dump_clause(
{
ast_dump_context->dump_expression(this->channel_);
ast_dump_context->ostream() << " <- " ;
- ast_dump_context->dump_expression(this->val_);
+ if (this->val_ != NULL)
+ ast_dump_context->dump_expression(this->val_);
}
else
{
@@ -4667,8 +4684,7 @@ Select_clauses::Select_clause::dump_clause(
ast_dump_context->ostream() << " , " ;
ast_dump_context->dump_expression(this->closed_);
}
- if (this->closedvar_ != NULL ||
- this->var_ != NULL)
+ if (this->closedvar_ != NULL || this->var_ != NULL)
ast_dump_context->ostream() << " := " ;
ast_dump_context->ostream() << " <- " ;
diff --git a/gcc/godump.c b/gcc/godump.c
index f9f767c8113..a42e641d181 100644
--- a/gcc/godump.c
+++ b/gcc/godump.c
@@ -62,7 +62,47 @@ static GTY(()) VEC(tree,gc) *queue;
static htab_t macro_hash;
-/* For the hash tables. */
+/* The type of a value in macro_hash. */
+
+struct macro_hash_value
+{
+ /* The name stored in the hash table. */
+ char *name;
+ /* The value of the macro. */
+ char *value;
+};
+
+/* Calculate the hash value for an entry in the macro hash table. */
+
+static hashval_t
+macro_hash_hashval (const void *val)
+{
+ const struct macro_hash_value *mhval = (const struct macro_hash_value *) val;
+ return htab_hash_string (mhval->name);
+}
+
+/* Compare values in the macro hash table for equality. */
+
+static int
+macro_hash_eq (const void *v1, const void *v2)
+{
+ const struct macro_hash_value *mhv1 = (const struct macro_hash_value *) v1;
+ const struct macro_hash_value *mhv2 = (const struct macro_hash_value *) v2;
+ return strcmp (mhv1->name, mhv2->name) == 0;
+}
+
+/* Free values deleted from the macro hash table. */
+
+static void
+macro_hash_del (void *v)
+{
+ struct macro_hash_value *mhv = (struct macro_hash_value *) v;
+ XDELETEVEC (mhv->name);
+ XDELETEVEC (mhv->value);
+ XDELETE (mhv);
+}
+
+/* For the string hash tables. */
static int
string_hash_eq (const void *y1, const void *y2)
@@ -77,10 +117,12 @@ go_define (unsigned int lineno, const char *buffer)
{
const char *p;
const char *name_end;
+ size_t out_len;
char *out_buffer;
char *q;
bool saw_operand;
bool need_operand;
+ struct macro_hash_value *mhval;
char *copy;
hashval_t hashval;
void **slot;
@@ -105,17 +147,17 @@ go_define (unsigned int lineno, const char *buffer)
memcpy (copy, buffer, name_end - buffer);
copy[name_end - buffer] = '\0';
+ mhval = XNEW (struct macro_hash_value);
+ mhval->name = copy;
+ mhval->value = NULL;
+
hashval = htab_hash_string (copy);
- slot = htab_find_slot_with_hash (macro_hash, copy, hashval, NO_INSERT);
- if (slot != NULL)
- {
- XDELETEVEC (copy);
- return;
- }
+ slot = htab_find_slot_with_hash (macro_hash, mhval, hashval, NO_INSERT);
/* For simplicity, we force all names to be hidden by adding an
initial underscore, and let the user undo this as needed. */
- out_buffer = XNEWVEC (char, strlen (p) * 2 + 1);
+ out_len = strlen (p) * 2 + 1;
+ out_buffer = XNEWVEC (char, out_len);
q = out_buffer;
saw_operand = false;
need_operand = false;
@@ -141,6 +183,7 @@ go_define (unsigned int lineno, const char *buffer)
don't worry about them. */
const char *start;
char *n;
+ struct macro_hash_value idval;
if (saw_operand)
goto unknown;
@@ -151,8 +194,9 @@ go_define (unsigned int lineno, const char *buffer)
n = XALLOCAVEC (char, p - start + 1);
memcpy (n, start, p - start);
n[p - start] = '\0';
- slot = htab_find_slot (macro_hash, n, NO_INSERT);
- if (slot == NULL || *slot == NULL)
+ idval.name = n;
+ idval.value = NULL;
+ if (htab_find (macro_hash, &idval) == NULL)
{
/* This is a reference to a name which was not defined
as a macro. */
@@ -382,18 +426,30 @@ go_define (unsigned int lineno, const char *buffer)
if (need_operand)
goto unknown;
+ gcc_assert ((size_t) (q - out_buffer) < out_len);
*q = '\0';
- slot = htab_find_slot_with_hash (macro_hash, copy, hashval, INSERT);
- *slot = copy;
+ mhval->value = out_buffer;
- fprintf (go_dump_file, "const _%s = %s\n", copy, out_buffer);
+ if (slot == NULL)
+ {
+ slot = htab_find_slot_with_hash (macro_hash, mhval, hashval, INSERT);
+ gcc_assert (slot != NULL && *slot == NULL);
+ }
+ else
+ {
+ if (*slot != NULL)
+ macro_hash_del (*slot);
+ }
+
+ *slot = mhval;
- XDELETEVEC (out_buffer);
return;
unknown:
fprintf (go_dump_file, "// unknowndefine %s\n", buffer);
+ if (slot != NULL)
+ htab_clear_slot (macro_hash, slot);
XDELETEVEC (out_buffer);
XDELETEVEC (copy);
}
@@ -403,16 +459,16 @@ go_define (unsigned int lineno, const char *buffer)
static void
go_undef (unsigned int lineno, const char *buffer)
{
+ struct macro_hash_value mhval;
void **slot;
real_debug_hooks->undef (lineno, buffer);
- slot = htab_find_slot (macro_hash, buffer, NO_INSERT);
- if (slot == NULL)
- return;
- fprintf (go_dump_file, "// undef _%s\n", buffer);
- /* We don't delete the slot from the hash table because that will
- cause a duplicate const definition. */
+ mhval.name = CONST_CAST (char *, buffer);
+ mhval.value = NULL;
+ slot = htab_find_slot (macro_hash, &mhval, NO_INSERT);
+ if (slot != NULL)
+ htab_clear_slot (macro_hash, slot);
}
/* A function or variable decl. */
@@ -909,32 +965,37 @@ go_output_typedef (struct godump_container *container, tree decl)
element = TREE_CHAIN (element))
{
const char *name;
+ struct macro_hash_value *mhval;
void **slot;
+ char buf[100];
name = IDENTIFIER_POINTER (TREE_PURPOSE (element));
/* Sometimes a name will be defined as both an enum constant
and a macro. Avoid duplicate definition errors by
treating enum constants as macros. */
- slot = htab_find_slot (macro_hash, name, INSERT);
- if (*slot == NULL)
- {
- *slot = CONST_CAST (char *, name);
- fprintf (go_dump_file, "const _%s = ", name);
- if (host_integerp (TREE_VALUE (element), 0))
- fprintf (go_dump_file, HOST_WIDE_INT_PRINT_DEC,
- tree_low_cst (TREE_VALUE (element), 0));
- else if (host_integerp (TREE_VALUE (element), 1))
- fprintf (go_dump_file, HOST_WIDE_INT_PRINT_UNSIGNED,
- ((unsigned HOST_WIDE_INT)
- tree_low_cst (TREE_VALUE (element), 1)));
- else
- fprintf (go_dump_file, HOST_WIDE_INT_PRINT_DOUBLE_HEX,
- ((unsigned HOST_WIDE_INT)
- TREE_INT_CST_HIGH (TREE_VALUE (element))),
- TREE_INT_CST_LOW (TREE_VALUE (element)));
- fprintf (go_dump_file, "\n");
- }
+ mhval = XNEW (struct macro_hash_value);
+ mhval->name = xstrdup (name);
+ mhval->value = NULL;
+ slot = htab_find_slot (macro_hash, mhval, INSERT);
+ if (*slot != NULL)
+ macro_hash_del (*slot);
+
+ if (host_integerp (TREE_VALUE (element), 0))
+ snprintf (buf, sizeof buf, HOST_WIDE_INT_PRINT_DEC,
+ tree_low_cst (TREE_VALUE (element), 0));
+ else if (host_integerp (TREE_VALUE (element), 1))
+ snprintf (buf, sizeof buf, HOST_WIDE_INT_PRINT_UNSIGNED,
+ ((unsigned HOST_WIDE_INT)
+ tree_low_cst (TREE_VALUE (element), 1)));
+ else
+ snprintf (buf, sizeof buf, HOST_WIDE_INT_PRINT_DOUBLE_HEX,
+ ((unsigned HOST_WIDE_INT)
+ TREE_INT_CST_HIGH (TREE_VALUE (element))),
+ TREE_INT_CST_LOW (TREE_VALUE (element)));
+
+ mhval->value = xstrdup (buf);
+ *slot = mhval;
}
pointer_set_insert (container->decls_seen, TREE_TYPE (decl));
if (TYPE_CANONICAL (TREE_TYPE (decl)) != NULL_TREE)
@@ -1039,6 +1100,17 @@ go_output_var (struct godump_container *container, tree decl)
}
}
+/* Output the final value of a preprocessor macro or enum constant.
+ This is called via htab_traverse_noresize. */
+
+static int
+go_print_macro (void **slot, void *arg ATTRIBUTE_UNUSED)
+{
+ struct macro_hash_value *mhval = (struct macro_hash_value *) *slot;
+ fprintf (go_dump_file, "const _%s = %s\n", mhval->name, mhval->value);
+ return 1;
+}
+
/* Build a hash table with the Go keywords. */
static const char * const keywords[] = {
@@ -1123,6 +1195,8 @@ go_finish (const char *filename)
}
}
+ htab_traverse_noresize (macro_hash, go_print_macro, NULL);
+
/* To emit dummy definitions. */
pointer_set_traverse (container.pot_dummy_types, find_dummy_types,
(void *) &container);
@@ -1163,7 +1237,8 @@ dump_go_spec_init (const char *filename, const struct gcc_debug_hooks *hooks)
go_debug_hooks.global_decl = go_global_decl;
go_debug_hooks.type_decl = go_type_decl;
- macro_hash = htab_create (100, htab_hash_string, string_hash_eq, NULL);
+ macro_hash = htab_create (100, macro_hash_hashval, macro_hash_eq,
+ macro_hash_del);
return &go_debug_hooks;
}
diff --git a/gcc/gthr-aix.h b/gcc/gthr-aix.h
deleted file mode 100644
index 6827e8f316d..00000000000
--- a/gcc/gthr-aix.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/* Threads compatibility routines for libgcc2 and libobjc. */
-/* Compile this one with gcc. */
-/* Copyright (C) 2000, 2009 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 GCC_GTHR_AIX_H
-#define GCC_GTHR_AIX_H
-
-#ifdef _THREAD_SAFE
-#include "gthr-posix.h"
-#else
-#include "gthr-single.h"
-#endif
-
-#endif /* GCC_GTHR_AIX_H */
diff --git a/gcc/gthr-dce.h b/gcc/gthr-dce.h
deleted file mode 100644
index d32155a9352..00000000000
--- a/gcc/gthr-dce.h
+++ /dev/null
@@ -1,563 +0,0 @@
-/* Threads compatibility routines for libgcc2 and libobjc. */
-/* Compile this one with gcc. */
-/* Copyright (C) 1997, 1999, 2000, 2001, 2004, 2005, 2008, 2009
- 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 GCC_GTHR_DCE_H
-#define GCC_GTHR_DCE_H
-
-/* If _DCE_THREADS is not defined, then we're building the single
- threaded version of the libraries and do not want to reference
- anything related to pthreads or dce. */
-#ifndef _DCE_THREADS
-#include "gthr-single.h"
-#else
-/* DCE threads interface.
- DCE threads are based on POSIX threads draft 4, and many things
- have changed since then. */
-
-/* Make sure CONST_CAST2 (original in system.h) is defined. */
-#ifndef CONST_CAST2
-#ifdef __cplusplus
-#define CONST_CAST2(TOTYPE,FROMTYPE,X) (const_cast<TOTYPE> (X))
-#else
-#define CONST_CAST2(TOTYPE,FROMTYPE,X) ((__extension__(union {FROMTYPE _q; TOTYPE _nq;})(X))._nq)
-#endif
-#endif
-
-#define __GTHREADS 1
-
-#include <pthread.h>
-
-typedef pthread_key_t __gthread_key_t;
-typedef pthread_once_t __gthread_once_t;
-typedef pthread_mutex_t __gthread_mutex_t;
-typedef pthread_mutex_t __gthread_recursive_mutex_t;
-
-#define __GTHREAD_ONCE_INIT pthread_once_init
-
-#define __GTHREAD_MUTEX_INIT_FUNCTION __gthread_mutex_init_function
-#define __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION __gthread_recursive_mutex_init_function
-
-#define __GTHREAD_MUTEX_INIT_DEFAULT pthread_once_init
-
-#if SUPPORTS_WEAK && GTHREAD_USE_WEAK
-# define __gthrw(name) \
- static __typeof(name) __gthrw_ ## name __attribute__ ((__weakref__(#name)));
-# define __gthrw_(name) __gthrw_ ## name
-#else
-# define __gthrw(name)
-# define __gthrw_(name) name
-#endif
-
-__gthrw(pthread_once)
-__gthrw(pthread_keycreate)
-__gthrw(pthread_getspecific)
-__gthrw(pthread_setspecific)
-__gthrw(pthread_create)
-__gthrw(pthread_mutex_init)
-__gthrw(pthread_mutex_destroy)
-__gthrw(pthread_mutex_lock)
-__gthrw(pthread_mutex_trylock)
-__gthrw(pthread_mutex_unlock)
-__gthrw(pthread_mutexattr_create)
-__gthrw(pthread_mutexattr_setkind_np)
-__gthrw(pthread_mutexattr_delete)
-
-#ifdef _LIBOBJC
-/* Objective-C. */
-__gthrw(pthread_cond_broadcast)
-__gthrw(pthread_cond_destroy)
-__gthrw(pthread_cond_init)
-__gthrw(pthread_cond_signal)
-__gthrw(pthread_cond_wait)
-__gthrw(pthread_exit)
-
-#ifdef pthread_getunique_np
-# define __gthrw_pthread_getunique_np pthread_getunique_np
-#else
-__gthrw(pthread_getunique_np)
-# define __gthrw_pthread_getunique_np __gthrw_(pthread_getunique_np)
-#endif
-
-__gthrw(pthread_mutex_destroy)
-__gthrw(pthread_self)
-__gthrw(pthread_yield)
-#endif
-
-#if SUPPORTS_WEAK && GTHREAD_USE_WEAK
-
-static inline int
-__gthread_active_p (void)
-{
- static void *const __gthread_active_ptr = (void *) &__gthrw_(pthread_create);
- return __gthread_active_ptr != 0;
-}
-
-#else /* not SUPPORTS_WEAK */
-
-static inline int
-__gthread_active_p (void)
-{
- return 1;
-}
-
-#endif /* SUPPORTS_WEAK */
-
-#ifdef _LIBOBJC
-
-/* Key structure for maintaining thread specific storage */
-static pthread_key_t _objc_thread_storage;
-
-/* Thread local storage for a single thread */
-static void *thread_local_storage = NULL;
-
-/* Backend initialization functions */
-
-/* Initialize the threads subsystem. */
-static inline int
-__gthread_objc_init_thread_system (void)
-{
- if (__gthread_active_p ())
- /* Initialize the thread storage key. */
- return __gthrw_(pthread_keycreate) (&_objc_thread_storage, NULL);
- else
- return -1;
-}
-
-/* Close the threads subsystem. */
-static inline int
-__gthread_objc_close_thread_system (void)
-{
- if (__gthread_active_p ())
- return 0;
- else
- return -1;
-}
-
-/* Backend thread functions */
-
-/* Create a new thread of execution. */
-static inline objc_thread_t
-__gthread_objc_thread_detach (void (*func)(void *), void *arg)
-{
- objc_thread_t thread_id;
- pthread_t new_thread_handle;
-
- if (!__gthread_active_p ())
- return NULL;
-
- if (!(__gthrw_(pthread_create) (&new_thread_handle, pthread_attr_default,
- (void *) func, arg)))
- {
- /* ??? May not work! (64bit) */
- thread_id = *(objc_thread_t *) &new_thread_handle;
- pthread_detach (&new_thread_handle); /* Fully detach thread. */
- }
- else
- thread_id = NULL;
-
- return thread_id;
-}
-
-/* Set the current thread's priority. */
-static inline int
-__gthread_objc_thread_set_priority (int priority)
-{
- int sys_priority = 0;
-
- if (!__gthread_active_p ())
- return -1;
-
- switch (priority)
- {
- case OBJC_THREAD_INTERACTIVE_PRIORITY:
- sys_priority = (PRI_FG_MIN_NP + PRI_FG_MAX_NP) / 2;
- break;
- default:
- case OBJC_THREAD_BACKGROUND_PRIORITY:
- sys_priority = (PRI_BG_MIN_NP + PRI_BG_MAX_NP) / 2;
- break;
- case OBJC_THREAD_LOW_PRIORITY:
- sys_priority = (PRI_BG_MIN_NP + PRI_BG_MAX_NP) / 2;
- break;
- }
-
- /* Change the priority. */
- if (pthread_setprio (__gthrw_(pthread_self) (), sys_priority) >= 0)
- return 0;
- else
- /* Failed */
- return -1;
-}
-
-/* Return the current thread's priority. */
-static inline int
-__gthread_objc_thread_get_priority (void)
-{
- int sys_priority;
-
- if (__gthread_active_p ())
- {
- if ((sys_priority = pthread_getprio (__gthrw_(pthread_self) ())) >= 0)
- {
- if (sys_priority >= PRI_FG_MIN_NP
- && sys_priority <= PRI_FG_MAX_NP)
- return OBJC_THREAD_INTERACTIVE_PRIORITY;
- if (sys_priority >= PRI_BG_MIN_NP
- && sys_priority <= PRI_BG_MAX_NP)
- return OBJC_THREAD_BACKGROUND_PRIORITY;
- return OBJC_THREAD_LOW_PRIORITY;
- }
-
- /* Failed */
- return -1;
- }
- else
- return OBJC_THREAD_INTERACTIVE_PRIORITY;
-}
-
-/* Yield our process time to another thread. */
-static inline void
-__gthread_objc_thread_yield (void)
-{
- if (__gthread_active_p ())
- __gthrw_(pthread_yield) ();
-}
-
-/* Terminate the current thread. */
-static inline int
-__gthread_objc_thread_exit (void)
-{
- if (__gthread_active_p ())
- /* exit the thread */
- __gthrw_(pthread_exit) (&__objc_thread_exit_status);
-
- /* Failed if we reached here */
- return -1;
-}
-
-/* Returns an integer value which uniquely describes a thread. */
-static inline objc_thread_t
-__gthread_objc_thread_id (void)
-{
- if (__gthread_active_p ())
- {
- pthread_t self = __gthrw_(pthread_self) ();
-
- return (objc_thread_t) __gthrw_pthread_getunique_np (&self);
- }
- else
- return (objc_thread_t) 1;
-}
-
-/* Sets the thread's local storage pointer. */
-static inline int
-__gthread_objc_thread_set_data (void *value)
-{
- if (__gthread_active_p ())
- return __gthrw_(pthread_setspecific) (_objc_thread_storage, value);
- else
- {
- thread_local_storage = value;
- return 0;
- }
-}
-
-/* Returns the thread's local storage pointer. */
-static inline void *
-__gthread_objc_thread_get_data (void)
-{
- void *value = NULL;
-
- if (__gthread_active_p ())
- {
- if (!(__gthrw_(pthread_getspecific) (_objc_thread_storage, &value)))
- return value;
-
- return NULL;
- }
- else
- return thread_local_storage;
-}
-
-/* Backend mutex functions */
-
-/* Allocate a mutex. */
-static inline int
-__gthread_objc_mutex_allocate (objc_mutex_t mutex)
-{
- if (__gthread_active_p ())
- {
- mutex->backend = objc_malloc (sizeof (pthread_mutex_t));
-
- if (__gthrw_(pthread_mutex_init) ((pthread_mutex_t *) mutex->backend,
- pthread_mutexattr_default))
- {
- objc_free (mutex->backend);
- mutex->backend = NULL;
- return -1;
- }
- }
-
- return 0;
-}
-
-/* Deallocate a mutex. */
-static inline int
-__gthread_objc_mutex_deallocate (objc_mutex_t mutex)
-{
- if (__gthread_active_p ())
- {
- if (__gthrw_(pthread_mutex_destroy) ((pthread_mutex_t *) mutex->backend))
- return -1;
-
- objc_free (mutex->backend);
- mutex->backend = NULL;
- }
-
- return 0;
-}
-
-/* Grab a lock on a mutex. */
-static inline int
-__gthread_objc_mutex_lock (objc_mutex_t mutex)
-{
- if (__gthread_active_p ())
- return __gthrw_(pthread_mutex_lock) ((pthread_mutex_t *) mutex->backend);
- else
- return 0;
-}
-
-/* Try to grab a lock on a mutex. */
-static inline int
-__gthread_objc_mutex_trylock (objc_mutex_t mutex)
-{
- if (__gthread_active_p ()
- && __gthrw_(pthread_mutex_trylock) ((pthread_mutex_t *) mutex->backend) != 1)
- return -1;
-
- return 0;
-}
-
-/* Unlock the mutex */
-static inline int
-__gthread_objc_mutex_unlock (objc_mutex_t mutex)
-{
- if (__gthread_active_p ())
- return __gthrw_(pthread_mutex_unlock) ((pthread_mutex_t *) mutex->backend);
- else
- return 0;
-}
-
-/* Backend condition mutex functions */
-
-/* Allocate a condition. */
-static inline int
-__gthread_objc_condition_allocate (objc_condition_t condition
- __attribute__ ((__unused__)))
-{
- if (__gthread_active_p ())
- /* Unimplemented. */
- return -1;
- else
- return 0;
-}
-
-/* Deallocate a condition. */
-static inline int
-__gthread_objc_condition_deallocate (objc_condition_t condition
- __attribute__ ((__unused__)))
-{
- if (__gthread_active_p ())
- /* Unimplemented. */
- return -1;
- else
- return 0;
-}
-
-/* Wait on the condition */
-static inline int
-__gthread_objc_condition_wait (objc_condition_t condition
- __attribute__ ((__unused__)),
- objc_mutex_t mutex __attribute__ ((__unused__)))
-{
- if (__gthread_active_p ())
- /* Unimplemented. */
- return -1;
- else
- return 0;
-}
-
-/* Wake up all threads waiting on this condition. */
-static inline int
-__gthread_objc_condition_broadcast (objc_condition_t condition
- __attribute__ ((__unused__)))
-{
- if (__gthread_active_p ())
- /* Unimplemented. */
- return -1;
- else
- return 0;
-}
-
-/* Wake up one thread waiting on this condition. */
-static inline int
-__gthread_objc_condition_signal (objc_condition_t condition
- __attribute__ ((__unused__)))
-{
- if (__gthread_active_p ())
- /* Unimplemented. */
- return -1;
- else
- return 0;
-}
-
-#else /* _LIBOBJC */
-
-static inline int
-__gthread_once (__gthread_once_t *__once, void (*__func) (void))
-{
- if (__gthread_active_p ())
- return __gthrw_(pthread_once) (__once, __func);
- else
- return -1;
-}
-
-static inline int
-__gthread_key_create (__gthread_key_t *__key, void (*__dtor) (void *))
-{
- return __gthrw_(pthread_keycreate) (__key, __dtor);
-}
-
-static inline int
-__gthread_key_delete (__gthread_key_t __key __attribute__ ((__unused__)))
-{
- /* Operation is not supported. */
- return -1;
-}
-
-static inline void *
-__gthread_getspecific (__gthread_key_t __key)
-{
- void *__ptr;
- if (__gthrw_(pthread_getspecific) (__key, &__ptr) == 0)
- return __ptr;
- else
- return 0;
-}
-
-static inline int
-__gthread_setspecific (__gthread_key_t __key, const void *__ptr)
-{
- return __gthrw_(pthread_setspecific)
- (__key, CONST_CAST2(void *, const void *, __ptr));
-}
-
-static inline void
-__gthread_mutex_init_function (__gthread_mutex_t *__mutex)
-{
- if (__gthread_active_p ())
- __gthrw_(pthread_mutex_init) (__mutex, pthread_mutexattr_default);
-}
-
-static inline int
-__gthread_mutex_destroy (__gthread_mutex_t *__mutex)
-{
- if (__gthread_active_p ())
- return __gthrw_(pthread_mutex_destroy) (__mutex);
- else
- return 0;
-}
-
-static inline int
-__gthread_mutex_lock (__gthread_mutex_t *__mutex)
-{
- if (__gthread_active_p ())
- return __gthrw_(pthread_mutex_lock) (__mutex);
- else
- return 0;
-}
-
-static inline int
-__gthread_mutex_trylock (__gthread_mutex_t *__mutex)
-{
- if (__gthread_active_p ())
- return __gthrw_(pthread_mutex_trylock) (__mutex);
- else
- return 0;
-}
-
-static inline int
-__gthread_mutex_unlock (__gthread_mutex_t *__mutex)
-{
- if (__gthread_active_p ())
- return __gthrw_(pthread_mutex_unlock) (__mutex);
- else
- return 0;
-}
-
-static inline int
-__gthread_recursive_mutex_init_function (__gthread_recursive_mutex_t *__mutex)
-{
- if (__gthread_active_p ())
- {
- pthread_mutexattr_t __attr;
- int __r;
-
- __r = __gthrw_(pthread_mutexattr_create) (&__attr);
- if (!__r)
- __r = __gthrw_(pthread_mutexattr_setkind_np) (&__attr,
- MUTEX_RECURSIVE_NP);
- if (!__r)
- __r = __gthrw_(pthread_mutex_init) (__mutex, __attr);
- if (!__r)
- __r = __gthrw_(pthread_mutexattr_delete) (&__attr);
- return __r;
- }
- return 0;
-}
-
-static inline int
-__gthread_recursive_mutex_lock (__gthread_recursive_mutex_t *__mutex)
-{
- return __gthread_mutex_lock (__mutex);
-}
-
-static inline int
-__gthread_recursive_mutex_trylock (__gthread_recursive_mutex_t *__mutex)
-{
- return __gthread_mutex_trylock (__mutex);
-}
-
-static inline int
-__gthread_recursive_mutex_unlock (__gthread_recursive_mutex_t *__mutex)
-{
- return __gthread_mutex_unlock (__mutex);
-}
-
-#endif /* _LIBOBJC */
-
-#endif
-#endif /* ! GCC_GTHR_DCE_H */
diff --git a/gcc/gthr-lynx.h b/gcc/gthr-lynx.h
deleted file mode 100644
index 13b81d2fedb..00000000000
--- a/gcc/gthr-lynx.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/* Threads compatibility routines for libgcc2 and libobjc for
- LynxOS. */
-/* Compile this one with gcc. */
-/* Copyright (C) 2004, 2008, 2009 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 GCC_GTHR_LYNX_H
-#define GCC_GTHR_LYNX_H
-
-#ifdef _MULTITHREADED
-
-/* Using the macro version of pthread_setspecific leads to a
- compilation error. Instead we have two choices either kill all
- macros in pthread.h with defining _POSIX_THREADS_CALLS or undefine
- individual macros where we should fall back on the function
- implementation. We choose the second approach. */
-
-#include <pthread.h>
-#undef pthread_setspecific
-
-/* When using static libc on LynxOS, we cannot define pthread_create
- weak. If the multi-threaded application includes iostream.h,
- gthr-posix.h is included and pthread_create will be defined weak.
- If pthread_create is weak its defining module in libc is not
- necessarily included in the link and the symbol is resolved to zero.
- Therefore the first call to it will crash.
-
- Since -mthreads is a multilib switch on LynxOS we know that at this
- point we are compiling for multi-threaded. Omitting the weak
- definitions at this point should have no effect. */
-
-#undef GTHREAD_USE_WEAK
-#define GTHREAD_USE_WEAK 0
-
-#include "gthr-posix.h"
-
-#else
-#include "gthr-single.h"
-#endif
-
-#endif /* GCC_GTHR_LYNX_H */
diff --git a/gcc/gthr-mipssde.h b/gcc/gthr-mipssde.h
deleted file mode 100644
index 34f9b6cf54b..00000000000
--- a/gcc/gthr-mipssde.h
+++ /dev/null
@@ -1,230 +0,0 @@
-/* MIPS SDE threads compatibility routines for libgcc2 and libobjc. */
-/* Compile this one with gcc. */
-/* Copyright (C) 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
- Contributed by Nigel Stephens <nigel@mips.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.
-
-Under Section 7 of GPL version 3, you are granted additional
-permissions described in the GCC Runtime Library Exception, version
-3.1, as published by the Free Software Foundation.
-
-You should have received a copy of the GNU General Public License and
-a copy of the 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 GCC_GTHR_MIPSSDE_H
-#define GCC_GTHR_MIPSSDE_H
-
-/* MIPS SDE threading API specific definitions.
- Easy, since the interface is pretty much one-to-one. */
-
-#define __GTHREADS 1
-
-#include <sdethread.h>
-#include <unistd.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef __sdethread_key_t __gthread_key_t;
-typedef __sdethread_once_t __gthread_once_t;
-typedef __sdethread_mutex_t __gthread_mutex_t;
-
-typedef struct {
- long depth;
- __sdethread_t owner;
- __sdethread_mutex_t actual;
-} __gthread_recursive_mutex_t;
-
-#define __GTHREAD_MUTEX_INIT __SDETHREAD_MUTEX_INITIALIZER("gthr")
-#define __GTHREAD_ONCE_INIT __SDETHREAD_ONCE_INIT
-static inline int
-__gthread_recursive_mutex_init_function(__gthread_recursive_mutex_t *__mutex);
-#define __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION __gthread_recursive_mutex_init_function
-
-#if SUPPORTS_WEAK && GTHREAD_USE_WEAK
-# define __gthrw(name) \
- static __typeof(name) __gthrw_ ## name __attribute__ ((__weakref__(#name)));
-# define __gthrw_(name) __gthrw_ ## name
-#else
-# define __gthrw(name)
-# define __gthrw_(name) name
-#endif
-
-__gthrw(__sdethread_once)
-__gthrw(__sdethread_key_create)
-__gthrw(__sdethread_key_delete)
-__gthrw(__sdethread_getspecific)
-__gthrw(__sdethread_setspecific)
-
-__gthrw(__sdethread_self)
-
-__gthrw(__sdethread_mutex_lock)
-__gthrw(__sdethread_mutex_trylock)
-__gthrw(__sdethread_mutex_unlock)
-
-__gthrw(__sdethread_mutex_init)
-
-__gthrw(__sdethread_threading)
-
-#if SUPPORTS_WEAK && GTHREAD_USE_WEAK
-
-static inline int
-__gthread_active_p (void)
-{
- return !!(void *)&__sdethread_threading;
-}
-
-#else /* not SUPPORTS_WEAK */
-
-static inline int
-__gthread_active_p (void)
-{
- return 1;
-}
-
-#endif /* SUPPORTS_WEAK */
-
-static inline int
-__gthread_once (__gthread_once_t *__once, void (*__func) (void))
-{
- if (__gthread_active_p ())
- return __gthrw_(__sdethread_once) (__once, __func);
- else
- return -1;
-}
-
-static inline int
-__gthread_key_create (__gthread_key_t *__key, void (*__dtor) (void *))
-{
- return __gthrw_(__sdethread_key_create) (__key, __dtor);
-}
-
-static inline int
-__gthread_key_delete (__gthread_key_t __key)
-{
- return __gthrw_(__sdethread_key_delete) (__key);
-}
-
-static inline void *
-__gthread_getspecific (__gthread_key_t __key)
-{
- return __gthrw_(__sdethread_getspecific) (__key);
-}
-
-static inline int
-__gthread_setspecific (__gthread_key_t __key, const void *__ptr)
-{
- return __gthrw_(__sdethread_setspecific) (__key, __ptr);
-}
-
-static inline int
-__gthread_mutex_destroy (__gthread_mutex_t * UNUSED(__mutex))
-{
- return 0;
-}
-
-static inline int
-__gthread_mutex_lock (__gthread_mutex_t *__mutex)
-{
- if (__gthread_active_p ())
- return __gthrw_(__sdethread_mutex_lock) (__mutex);
- else
- return 0;
-}
-
-static inline int
-__gthread_mutex_trylock (__gthread_mutex_t *__mutex)
-{
- if (__gthread_active_p ())
- return __gthrw_(__sdethread_mutex_trylock) (__mutex);
- else
- return 0;
-}
-
-static inline int
-__gthread_mutex_unlock (__gthread_mutex_t *__mutex)
-{
- if (__gthread_active_p ())
- return __gthrw_(__sdethread_mutex_unlock) (__mutex);
- else
- return 0;
-}
-
-static inline int
-__gthread_recursive_mutex_init_function (__gthread_recursive_mutex_t *__mutex)
-{
- __mutex->depth = 0;
- __mutex->owner = __gthrw_(__sdethread_self) ();
- return __gthrw_(__sdethread_mutex_init) (&__mutex->actual, NULL);
-}
-
-static inline int
-__gthread_recursive_mutex_lock (__gthread_recursive_mutex_t *__mutex)
-{
- if (__gthread_active_p ())
- {
- __sdethread_t __me = __gthrw_(__sdethread_self) ();
-
- if (__mutex->owner != __me)
- {
- __gthrw_(__sdethread_mutex_lock) (&__mutex->actual);
- __mutex->owner = __me;
- }
-
- __mutex->depth++;
- }
- return 0;
-}
-
-static inline int
-__gthread_recursive_mutex_trylock (__gthread_recursive_mutex_t *__mutex)
-{
- if (__gthread_active_p ())
- {
- __sdethread_t __me = __gthrw_(__sdethread_self) ();
-
- if (__mutex->owner != __me)
- {
- if (__gthrw_(__sdethread_mutex_trylock) (&__mutex->actual))
- return 1;
- __mutex->owner = __me;
- }
-
- __mutex->depth++;
- }
- return 0;
-}
-
-static inline int
-__gthread_recursive_mutex_unlock (__gthread_recursive_mutex_t *__mutex)
-{
- if (__gthread_active_p ())
- {
- if (--__mutex->depth == 0)
- {
- __mutex->owner = (__sdethread_t) 0;
- __gthrw_(__sdethread_mutex_unlock) (&__mutex->actual);
- }
- }
- return 0;
-}
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* ! GCC_GTHR_MIPSSDE_H */
diff --git a/gcc/gthr-posix.c b/gcc/gthr-posix.c
deleted file mode 100644
index 1987ba738c2..00000000000
--- a/gcc/gthr-posix.c
+++ /dev/null
@@ -1,264 +0,0 @@
-/* POSIX threads dummy routines for systems without weak definitions. */
-/* Compile this one with gcc. */
-/* Copyright (C) 2003, 2004, 2005, 2007, 2008, 2009 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/>. */
-
-#include "tconfig.h"
-#include "tm.h"
-# define __gthrw_pragma(pragma) _Pragma (#pragma)
-/* Define so we provide weak definitions of functions used by libobjc only. */
-#define _LIBOBJC_WEAK
-#include "gthr.h"
-
-int
-pthread_once (pthread_once_t *once ATTRIBUTE_UNUSED,
- void (*func) (void) ATTRIBUTE_UNUSED)
-{
- return -1;
-}
-
-int
-pthread_key_create (pthread_key_t *key ATTRIBUTE_UNUSED,
- void (*dtor) (void *) ATTRIBUTE_UNUSED)
-{
- return -1;
-}
-
-int
-pthread_key_delete (pthread_key_t key ATTRIBUTE_UNUSED)
-{
- return 0;
-}
-
-void *
-pthread_getspecific (pthread_key_t key ATTRIBUTE_UNUSED)
-{
- return 0;
-}
-
-int
-pthread_setspecific (pthread_key_t key ATTRIBUTE_UNUSED,
- const void *ptr ATTRIBUTE_UNUSED)
-{
- return 0;
-}
-
-int
-pthread_create (pthread_t *thread ATTRIBUTE_UNUSED,
- const pthread_attr_t *attr ATTRIBUTE_UNUSED,
- void *(*start_routine) (void *) ATTRIBUTE_UNUSED,
- void *arg ATTRIBUTE_UNUSED)
-{
- return 0;
-}
-
-int
-pthread_join (pthread_t thread ATTRIBUTE_UNUSED,
- void **value_ptr ATTRIBUTE_UNUSED)
-{
- return 0;
-}
-
-void
-pthread_exit (void *value_ptr ATTRIBUTE_UNUSED)
-{
-}
-
-int
-pthread_detach (pthread_t thread ATTRIBUTE_UNUSED)
-{
- return 0;
-}
-
-int
-pthread_cancel (pthread_t thread ATTRIBUTE_UNUSED)
-{
- return 0;
-}
-
-int
-pthread_mutex_lock (pthread_mutex_t *mutex ATTRIBUTE_UNUSED)
-{
- return 0;
-}
-
-int
-pthread_mutex_trylock (pthread_mutex_t *mutex ATTRIBUTE_UNUSED)
-{
- return 0;
-}
-
-#ifdef _POSIX_TIMEOUTS
-#if _POSIX_TIMEOUTS >= 0
-int
-pthread_mutex_timedlock (pthread_mutex_t *mutex ATTRIBUTE_UNUSED,
- const struct timespec *abs_timeout ATTRIBUTE_UNUSED)
-{
- return 0;
-}
-#endif
-#endif /* _POSIX_TIMEOUTS */
-
-int
-pthread_mutex_unlock (pthread_mutex_t *mutex ATTRIBUTE_UNUSED)
-{
- return 0;
-}
-
-int
-pthread_mutexattr_init (pthread_mutexattr_t *attr ATTRIBUTE_UNUSED)
-{
- return 0;
-}
-
-int
-pthread_mutexattr_settype (pthread_mutexattr_t *attr ATTRIBUTE_UNUSED,
- int type ATTRIBUTE_UNUSED)
-{
- return 0;
-}
-
-int
-pthread_mutexattr_destroy (pthread_mutexattr_t *attr ATTRIBUTE_UNUSED)
-{
- return 0;
-}
-
-int
-pthread_cond_broadcast (pthread_cond_t *cond ATTRIBUTE_UNUSED)
-{
- return 0;
-}
-
-int
-pthread_cond_destroy (pthread_cond_t *cond ATTRIBUTE_UNUSED)
-{
- return 0;
-}
-
-int
-pthread_cond_init (pthread_cond_t *cond ATTRIBUTE_UNUSED,
- const pthread_condattr_t *attr ATTRIBUTE_UNUSED)
-{
- return 0;
-}
-
-int
-pthread_cond_signal (pthread_cond_t *cond ATTRIBUTE_UNUSED)
-{
- return 0;
-}
-
-int
-pthread_cond_wait (pthread_cond_t *cond ATTRIBUTE_UNUSED,
- pthread_mutex_t *mutex ATTRIBUTE_UNUSED)
-{
- return 0;
-}
-
-int
-pthread_cond_timedwait (pthread_cond_t *cond ATTRIBUTE_UNUSED,
- pthread_mutex_t *mutex ATTRIBUTE_UNUSED,
- const struct timespec *abstime ATTRIBUTE_UNUSED)
-{
- return 0;
-}
-
-int
-pthread_mutex_init (pthread_mutex_t *mutex ATTRIBUTE_UNUSED,
- const pthread_mutexattr_t *attr ATTRIBUTE_UNUSED)
-{
- return 0;
-}
-
-int
-pthread_mutex_destroy (pthread_mutex_t *mutex ATTRIBUTE_UNUSED)
-{
- return 0;
-}
-
-pthread_t
-pthread_self (void)
-{
- return (pthread_t) 0;
-}
-
-#ifdef _POSIX_PRIORITY_SCHEDULING
-#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING
-int
-sched_get_priority_max (int policy ATTRIBUTE_UNUSED)
-{
- return 0;
-}
-
-int
-sched_get_priority_min (int policy ATTRIBUTE_UNUSED)
-{
- return 0;
-}
-#endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */
-#endif /* _POSIX_PRIORITY_SCHEDULING */
-
-int
-sched_yield (void)
-{
- return 0;
-}
-
-int
-pthread_attr_destroy (pthread_attr_t *attr ATTRIBUTE_UNUSED)
-{
- return 0;
-}
-
-int
-pthread_attr_init (pthread_attr_t *attr ATTRIBUTE_UNUSED)
-{
- return 0;
-}
-
-int
-pthread_attr_setdetachstate (pthread_attr_t *attr ATTRIBUTE_UNUSED,
- int detachstate ATTRIBUTE_UNUSED)
-{
- return 0;
-}
-
-#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING
-int
-pthread_getschedparam (pthread_t thread ATTRIBUTE_UNUSED,
- int *policy ATTRIBUTE_UNUSED,
- struct sched_param *param ATTRIBUTE_UNUSED)
-{
- return 0;
-}
-
-int
-pthread_setschedparam (pthread_t thread ATTRIBUTE_UNUSED,
- int policy ATTRIBUTE_UNUSED,
- const struct sched_param *param ATTRIBUTE_UNUSED)
-{
- return 0;
-}
-#endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */
-
diff --git a/gcc/gthr-posix.h b/gcc/gthr-posix.h
deleted file mode 100644
index 46054f6a7c2..00000000000
--- a/gcc/gthr-posix.h
+++ /dev/null
@@ -1,879 +0,0 @@
-/* Threads compatibility routines for libgcc2 and libobjc. */
-/* Compile this one with gcc. */
-/* Copyright (C) 1997, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
- 2008, 2009, 2010, 2011 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 GCC_GTHR_POSIX_H
-#define GCC_GTHR_POSIX_H
-
-/* POSIX threads specific definitions.
- Easy, since the interface is just one-to-one mapping. */
-
-#define __GTHREADS 1
-#define __GTHREADS_CXX0X 1
-
-/* Some implementations of <pthread.h> require this to be defined. */
-#if !defined(_REENTRANT) && defined(__osf__)
-#define _REENTRANT 1
-#endif
-
-#include <pthread.h>
-
-#if ((defined(_LIBOBJC) || defined(_LIBOBJC_WEAK)) \
- || !defined(_GTHREAD_USE_MUTEX_TIMEDLOCK))
-# include <unistd.h>
-# if defined(_POSIX_TIMEOUTS) && _POSIX_TIMEOUTS >= 0
-# define _GTHREAD_USE_MUTEX_TIMEDLOCK 1
-# else
-# define _GTHREAD_USE_MUTEX_TIMEDLOCK 0
-# endif
-#endif
-
-typedef pthread_t __gthread_t;
-typedef pthread_key_t __gthread_key_t;
-typedef pthread_once_t __gthread_once_t;
-typedef pthread_mutex_t __gthread_mutex_t;
-typedef pthread_mutex_t __gthread_recursive_mutex_t;
-typedef pthread_cond_t __gthread_cond_t;
-typedef struct timespec __gthread_time_t;
-
-/* POSIX like conditional variables are supported. Please look at comments
- in gthr.h for details. */
-#define __GTHREAD_HAS_COND 1
-
-#define __GTHREAD_MUTEX_INIT PTHREAD_MUTEX_INITIALIZER
-#define __GTHREAD_ONCE_INIT PTHREAD_ONCE_INIT
-#if defined(PTHREAD_RECURSIVE_MUTEX_INITIALIZER)
-#define __GTHREAD_RECURSIVE_MUTEX_INIT PTHREAD_RECURSIVE_MUTEX_INITIALIZER
-#elif defined(PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP)
-#define __GTHREAD_RECURSIVE_MUTEX_INIT PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
-#else
-#define __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION __gthread_recursive_mutex_init_function
-#endif
-#define __GTHREAD_COND_INIT PTHREAD_COND_INITIALIZER
-#define __GTHREAD_TIME_INIT {0,0}
-
-#if SUPPORTS_WEAK && GTHREAD_USE_WEAK
-# ifndef __gthrw_pragma
-# define __gthrw_pragma(pragma)
-# endif
-# define __gthrw2(name,name2,type) \
- static __typeof(type) name __attribute__ ((__weakref__(#name2))); \
- __gthrw_pragma(weak type)
-# define __gthrw_(name) __gthrw_ ## name
-#else
-# define __gthrw2(name,name2,type)
-# define __gthrw_(name) name
-#endif
-
-/* Typically, __gthrw_foo is a weak reference to symbol foo. */
-#define __gthrw(name) __gthrw2(__gthrw_ ## name,name,name)
-
-/* On Tru64, /usr/include/pthread.h uses #pragma extern_prefix "__" to
- map a subset of the POSIX pthread API to mangled versions of their
- names. */
-#if defined(__osf__) && defined(_PTHREAD_USE_MANGLED_NAMES_)
-#define __gthrw3(name) __gthrw2(__gthrw_ ## name, __ ## name, name)
-__gthrw3(pthread_once)
-__gthrw3(pthread_getspecific)
-__gthrw3(pthread_setspecific)
-
-__gthrw3(pthread_create)
-__gthrw3(pthread_join)
-__gthrw3(pthread_detach)
-__gthrw3(pthread_equal)
-__gthrw3(pthread_self)
-__gthrw3(pthread_cancel)
-__gthrw3(sched_yield)
-
-__gthrw3(pthread_mutex_lock)
-__gthrw3(pthread_mutex_trylock)
-#if _GTHREAD_USE_MUTEX_TIMEDLOCK
-__gthrw3(pthread_mutex_timedlock)
-#endif
-__gthrw3(pthread_mutex_unlock)
-__gthrw3(pthread_mutex_init)
-__gthrw3(pthread_mutex_destroy)
-
-__gthrw3(pthread_cond_broadcast)
-__gthrw3(pthread_cond_signal)
-__gthrw3(pthread_cond_wait)
-__gthrw3(pthread_cond_timedwait)
-__gthrw3(pthread_cond_destroy)
-#else
-__gthrw(pthread_once)
-__gthrw(pthread_getspecific)
-__gthrw(pthread_setspecific)
-
-__gthrw(pthread_create)
-__gthrw(pthread_join)
-__gthrw(pthread_equal)
-__gthrw(pthread_self)
-__gthrw(pthread_detach)
-#ifndef __BIONIC__
-__gthrw(pthread_cancel)
-#endif
-__gthrw(sched_yield)
-
-__gthrw(pthread_mutex_lock)
-__gthrw(pthread_mutex_trylock)
-#if _GTHREAD_USE_MUTEX_TIMEDLOCK
-__gthrw(pthread_mutex_timedlock)
-#endif
-__gthrw(pthread_mutex_unlock)
-__gthrw(pthread_mutex_init)
-__gthrw(pthread_mutex_destroy)
-
-__gthrw(pthread_cond_broadcast)
-__gthrw(pthread_cond_signal)
-__gthrw(pthread_cond_wait)
-__gthrw(pthread_cond_timedwait)
-__gthrw(pthread_cond_destroy)
-#endif
-
-__gthrw(pthread_key_create)
-__gthrw(pthread_key_delete)
-__gthrw(pthread_mutexattr_init)
-__gthrw(pthread_mutexattr_settype)
-__gthrw(pthread_mutexattr_destroy)
-
-
-#if defined(_LIBOBJC) || defined(_LIBOBJC_WEAK)
-/* Objective-C. */
-#if defined(__osf__) && defined(_PTHREAD_USE_MANGLED_NAMES_)
-__gthrw3(pthread_cond_init)
-__gthrw3(pthread_exit)
-#else
-__gthrw(pthread_cond_init)
-__gthrw(pthread_exit)
-#endif /* __osf__ && _PTHREAD_USE_MANGLED_NAMES_ */
-#ifdef _POSIX_PRIORITY_SCHEDULING
-#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING
-__gthrw(sched_get_priority_max)
-__gthrw(sched_get_priority_min)
-#endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */
-#endif /* _POSIX_PRIORITY_SCHEDULING */
-__gthrw(pthread_attr_destroy)
-__gthrw(pthread_attr_init)
-__gthrw(pthread_attr_setdetachstate)
-#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING
-__gthrw(pthread_getschedparam)
-__gthrw(pthread_setschedparam)
-#endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */
-#endif /* _LIBOBJC || _LIBOBJC_WEAK */
-
-#if SUPPORTS_WEAK && GTHREAD_USE_WEAK
-
-/* On Solaris 2.6 up to 9, the libc exposes a POSIX threads interface even if
- -pthreads is not specified. The functions are dummies and most return an
- error value. However pthread_once returns 0 without invoking the routine
- it is passed so we cannot pretend that the interface is active if -pthreads
- is not specified. On Solaris 2.5.1, the interface is not exposed at all so
- we need to play the usual game with weak symbols. On Solaris 10 and up, a
- working interface is always exposed. On FreeBSD 6 and later, libc also
- exposes a dummy POSIX threads interface, similar to what Solaris 2.6 up
- to 9 does. FreeBSD >= 700014 even provides a pthread_cancel stub in libc,
- which means the alternate __gthread_active_p below cannot be used there. */
-
-#if defined(__FreeBSD__) || (defined(__sun) && defined(__svr4__))
-
-static volatile int __gthread_active = -1;
-
-static void
-__gthread_trigger (void)
-{
- __gthread_active = 1;
-}
-
-static inline int
-__gthread_active_p (void)
-{
- static pthread_mutex_t __gthread_active_mutex = PTHREAD_MUTEX_INITIALIZER;
- static pthread_once_t __gthread_active_once = PTHREAD_ONCE_INIT;
-
- /* Avoid reading __gthread_active twice on the main code path. */
- int __gthread_active_latest_value = __gthread_active;
-
- /* This test is not protected to avoid taking a lock on the main code
- path so every update of __gthread_active in a threaded program must
- be atomic with regard to the result of the test. */
- if (__builtin_expect (__gthread_active_latest_value < 0, 0))
- {
- if (__gthrw_(pthread_once))
- {
- /* If this really is a threaded program, then we must ensure that
- __gthread_active has been set to 1 before exiting this block. */
- __gthrw_(pthread_mutex_lock) (&__gthread_active_mutex);
- __gthrw_(pthread_once) (&__gthread_active_once, __gthread_trigger);
- __gthrw_(pthread_mutex_unlock) (&__gthread_active_mutex);
- }
-
- /* Make sure we'll never enter this block again. */
- if (__gthread_active < 0)
- __gthread_active = 0;
-
- __gthread_active_latest_value = __gthread_active;
- }
-
- return __gthread_active_latest_value != 0;
-}
-
-#else /* neither FreeBSD nor Solaris */
-
-static inline int
-__gthread_active_p (void)
-{
-/* Android's C library does not provide pthread_cancel, check for
- `pthread_create' instead. */
-#ifndef __BIONIC__
- static void *const __gthread_active_ptr
- = __extension__ (void *) &__gthrw_(pthread_cancel);
-#else
- static void *const __gthread_active_ptr
- = __extension__ (void *) &__gthrw_(pthread_create);
-#endif
- return __gthread_active_ptr != 0;
-}
-
-#endif /* FreeBSD or Solaris */
-
-#else /* not SUPPORTS_WEAK */
-
-/* Similar to Solaris, HP-UX 11 for PA-RISC provides stubs for pthread
- calls in shared flavors of the HP-UX C library. Most of the stubs
- have no functionality. The details are described in the "libc cumulative
- patch" for each subversion of HP-UX 11. There are two special interfaces
- provided for checking whether an application is linked to a shared pthread
- library or not. However, these interfaces aren't available in early
- libpthread libraries. We also need a test that works for archive
- libraries. We can't use pthread_once as some libc versions call the
- init function. We also can't use pthread_create or pthread_attr_init
- as these create a thread and thereby prevent changing the default stack
- size. The function pthread_default_stacksize_np is available in both
- the archive and shared versions of libpthread. It can be used to
- determine the default pthread stack size. There is a stub in some
- shared libc versions which returns a zero size if pthreads are not
- active. We provide an equivalent stub to handle cases where libc
- doesn't provide one. */
-
-#if defined(__hppa__) && defined(__hpux__)
-
-static volatile int __gthread_active = -1;
-
-static inline int
-__gthread_active_p (void)
-{
- /* Avoid reading __gthread_active twice on the main code path. */
- int __gthread_active_latest_value = __gthread_active;
- size_t __s;
-
- if (__builtin_expect (__gthread_active_latest_value < 0, 0))
- {
- pthread_default_stacksize_np (0, &__s);
- __gthread_active = __s ? 1 : 0;
- __gthread_active_latest_value = __gthread_active;
- }
-
- return __gthread_active_latest_value != 0;
-}
-
-#else /* not hppa-hpux */
-
-static inline int
-__gthread_active_p (void)
-{
- return 1;
-}
-
-#endif /* hppa-hpux */
-
-#endif /* SUPPORTS_WEAK */
-
-#ifdef _LIBOBJC
-
-/* This is the config.h file in libobjc/ */
-#include <config.h>
-
-#ifdef HAVE_SCHED_H
-# include <sched.h>
-#endif
-
-/* Key structure for maintaining thread specific storage */
-static pthread_key_t _objc_thread_storage;
-static pthread_attr_t _objc_thread_attribs;
-
-/* Thread local storage for a single thread */
-static void *thread_local_storage = NULL;
-
-/* Backend initialization functions */
-
-/* Initialize the threads subsystem. */
-static inline int
-__gthread_objc_init_thread_system (void)
-{
- if (__gthread_active_p ())
- {
- /* Initialize the thread storage key. */
- if (__gthrw_(pthread_key_create) (&_objc_thread_storage, NULL) == 0)
- {
- /* The normal default detach state for threads is
- * PTHREAD_CREATE_JOINABLE which causes threads to not die
- * when you think they should. */
- if (__gthrw_(pthread_attr_init) (&_objc_thread_attribs) == 0
- && __gthrw_(pthread_attr_setdetachstate) (&_objc_thread_attribs,
- PTHREAD_CREATE_DETACHED) == 0)
- return 0;
- }
- }
-
- return -1;
-}
-
-/* Close the threads subsystem. */
-static inline int
-__gthread_objc_close_thread_system (void)
-{
- if (__gthread_active_p ()
- && __gthrw_(pthread_key_delete) (_objc_thread_storage) == 0
- && __gthrw_(pthread_attr_destroy) (&_objc_thread_attribs) == 0)
- return 0;
-
- return -1;
-}
-
-/* Backend thread functions */
-
-/* Create a new thread of execution. */
-static inline objc_thread_t
-__gthread_objc_thread_detach (void (*func)(void *), void *arg)
-{
- objc_thread_t thread_id;
- pthread_t new_thread_handle;
-
- if (!__gthread_active_p ())
- return NULL;
-
- if (!(__gthrw_(pthread_create) (&new_thread_handle, &_objc_thread_attribs,
- (void *) func, arg)))
- thread_id = (objc_thread_t) new_thread_handle;
- else
- thread_id = NULL;
-
- return thread_id;
-}
-
-/* Set the current thread's priority. */
-static inline int
-__gthread_objc_thread_set_priority (int priority)
-{
- if (!__gthread_active_p ())
- return -1;
- else
- {
-#ifdef _POSIX_PRIORITY_SCHEDULING
-#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING
- pthread_t thread_id = __gthrw_(pthread_self) ();
- int policy;
- struct sched_param params;
- int priority_min, priority_max;
-
- if (__gthrw_(pthread_getschedparam) (thread_id, &policy, &params) == 0)
- {
- if ((priority_max = __gthrw_(sched_get_priority_max) (policy)) == -1)
- return -1;
-
- if ((priority_min = __gthrw_(sched_get_priority_min) (policy)) == -1)
- return -1;
-
- if (priority > priority_max)
- priority = priority_max;
- else if (priority < priority_min)
- priority = priority_min;
- params.sched_priority = priority;
-
- /*
- * The solaris 7 and several other man pages incorrectly state that
- * this should be a pointer to policy but pthread.h is universally
- * at odds with this.
- */
- if (__gthrw_(pthread_setschedparam) (thread_id, policy, &params) == 0)
- return 0;
- }
-#endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */
-#endif /* _POSIX_PRIORITY_SCHEDULING */
- return -1;
- }
-}
-
-/* Return the current thread's priority. */
-static inline int
-__gthread_objc_thread_get_priority (void)
-{
-#ifdef _POSIX_PRIORITY_SCHEDULING
-#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING
- if (__gthread_active_p ())
- {
- int policy;
- struct sched_param params;
-
- if (__gthrw_(pthread_getschedparam) (__gthrw_(pthread_self) (), &policy, &params) == 0)
- return params.sched_priority;
- else
- return -1;
- }
- else
-#endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */
-#endif /* _POSIX_PRIORITY_SCHEDULING */
- return OBJC_THREAD_INTERACTIVE_PRIORITY;
-}
-
-/* Yield our process time to another thread. */
-static inline void
-__gthread_objc_thread_yield (void)
-{
- if (__gthread_active_p ())
- __gthrw_(sched_yield) ();
-}
-
-/* Terminate the current thread. */
-static inline int
-__gthread_objc_thread_exit (void)
-{
- if (__gthread_active_p ())
- /* exit the thread */
- __gthrw_(pthread_exit) (&__objc_thread_exit_status);
-
- /* Failed if we reached here */
- return -1;
-}
-
-/* Returns an integer value which uniquely describes a thread. */
-static inline objc_thread_t
-__gthread_objc_thread_id (void)
-{
- if (__gthread_active_p ())
- return (objc_thread_t) __gthrw_(pthread_self) ();
- else
- return (objc_thread_t) 1;
-}
-
-/* Sets the thread's local storage pointer. */
-static inline int
-__gthread_objc_thread_set_data (void *value)
-{
- if (__gthread_active_p ())
- return __gthrw_(pthread_setspecific) (_objc_thread_storage, value);
- else
- {
- thread_local_storage = value;
- return 0;
- }
-}
-
-/* Returns the thread's local storage pointer. */
-static inline void *
-__gthread_objc_thread_get_data (void)
-{
- if (__gthread_active_p ())
- return __gthrw_(pthread_getspecific) (_objc_thread_storage);
- else
- return thread_local_storage;
-}
-
-/* Backend mutex functions */
-
-/* Allocate a mutex. */
-static inline int
-__gthread_objc_mutex_allocate (objc_mutex_t mutex)
-{
- if (__gthread_active_p ())
- {
- mutex->backend = objc_malloc (sizeof (pthread_mutex_t));
-
- if (__gthrw_(pthread_mutex_init) ((pthread_mutex_t *) mutex->backend, NULL))
- {
- objc_free (mutex->backend);
- mutex->backend = NULL;
- return -1;
- }
- }
-
- return 0;
-}
-
-/* Deallocate a mutex. */
-static inline int
-__gthread_objc_mutex_deallocate (objc_mutex_t mutex)
-{
- if (__gthread_active_p ())
- {
- int count;
-
- /*
- * Posix Threads specifically require that the thread be unlocked
- * for __gthrw_(pthread_mutex_destroy) to work.
- */
-
- do
- {
- count = __gthrw_(pthread_mutex_unlock) ((pthread_mutex_t *) mutex->backend);
- if (count < 0)
- return -1;
- }
- while (count);
-
- if (__gthrw_(pthread_mutex_destroy) ((pthread_mutex_t *) mutex->backend))
- return -1;
-
- objc_free (mutex->backend);
- mutex->backend = NULL;
- }
- return 0;
-}
-
-/* Grab a lock on a mutex. */
-static inline int
-__gthread_objc_mutex_lock (objc_mutex_t mutex)
-{
- if (__gthread_active_p ()
- && __gthrw_(pthread_mutex_lock) ((pthread_mutex_t *) mutex->backend) != 0)
- {
- return -1;
- }
-
- return 0;
-}
-
-/* Try to grab a lock on a mutex. */
-static inline int
-__gthread_objc_mutex_trylock (objc_mutex_t mutex)
-{
- if (__gthread_active_p ()
- && __gthrw_(pthread_mutex_trylock) ((pthread_mutex_t *) mutex->backend) != 0)
- {
- return -1;
- }
-
- return 0;
-}
-
-/* Unlock the mutex */
-static inline int
-__gthread_objc_mutex_unlock (objc_mutex_t mutex)
-{
- if (__gthread_active_p ()
- && __gthrw_(pthread_mutex_unlock) ((pthread_mutex_t *) mutex->backend) != 0)
- {
- return -1;
- }
-
- return 0;
-}
-
-/* Backend condition mutex functions */
-
-/* Allocate a condition. */
-static inline int
-__gthread_objc_condition_allocate (objc_condition_t condition)
-{
- if (__gthread_active_p ())
- {
- condition->backend = objc_malloc (sizeof (pthread_cond_t));
-
- if (__gthrw_(pthread_cond_init) ((pthread_cond_t *) condition->backend, NULL))
- {
- objc_free (condition->backend);
- condition->backend = NULL;
- return -1;
- }
- }
-
- return 0;
-}
-
-/* Deallocate a condition. */
-static inline int
-__gthread_objc_condition_deallocate (objc_condition_t condition)
-{
- if (__gthread_active_p ())
- {
- if (__gthrw_(pthread_cond_destroy) ((pthread_cond_t *) condition->backend))
- return -1;
-
- objc_free (condition->backend);
- condition->backend = NULL;
- }
- return 0;
-}
-
-/* Wait on the condition */
-static inline int
-__gthread_objc_condition_wait (objc_condition_t condition, objc_mutex_t mutex)
-{
- if (__gthread_active_p ())
- return __gthrw_(pthread_cond_wait) ((pthread_cond_t *) condition->backend,
- (pthread_mutex_t *) mutex->backend);
- else
- return 0;
-}
-
-/* Wake up all threads waiting on this condition. */
-static inline int
-__gthread_objc_condition_broadcast (objc_condition_t condition)
-{
- if (__gthread_active_p ())
- return __gthrw_(pthread_cond_broadcast) ((pthread_cond_t *) condition->backend);
- else
- return 0;
-}
-
-/* Wake up one thread waiting on this condition. */
-static inline int
-__gthread_objc_condition_signal (objc_condition_t condition)
-{
- if (__gthread_active_p ())
- return __gthrw_(pthread_cond_signal) ((pthread_cond_t *) condition->backend);
- else
- return 0;
-}
-
-#else /* _LIBOBJC */
-
-static inline int
-__gthread_create (__gthread_t *__threadid, void *(*__func) (void*),
- void *__args)
-{
- return __gthrw_(pthread_create) (__threadid, NULL, __func, __args);
-}
-
-static inline int
-__gthread_join (__gthread_t __threadid, void **__value_ptr)
-{
- return __gthrw_(pthread_join) (__threadid, __value_ptr);
-}
-
-static inline int
-__gthread_detach (__gthread_t __threadid)
-{
- return __gthrw_(pthread_detach) (__threadid);
-}
-
-static inline int
-__gthread_equal (__gthread_t __t1, __gthread_t __t2)
-{
- return __gthrw_(pthread_equal) (__t1, __t2);
-}
-
-static inline __gthread_t
-__gthread_self (void)
-{
- return __gthrw_(pthread_self) ();
-}
-
-static inline int
-__gthread_yield (void)
-{
- return __gthrw_(sched_yield) ();
-}
-
-static inline int
-__gthread_once (__gthread_once_t *__once, void (*__func) (void))
-{
- if (__gthread_active_p ())
- return __gthrw_(pthread_once) (__once, __func);
- else
- return -1;
-}
-
-static inline int
-__gthread_key_create (__gthread_key_t *__key, void (*__dtor) (void *))
-{
- return __gthrw_(pthread_key_create) (__key, __dtor);
-}
-
-static inline int
-__gthread_key_delete (__gthread_key_t __key)
-{
- return __gthrw_(pthread_key_delete) (__key);
-}
-
-static inline void *
-__gthread_getspecific (__gthread_key_t __key)
-{
- return __gthrw_(pthread_getspecific) (__key);
-}
-
-static inline int
-__gthread_setspecific (__gthread_key_t __key, const void *__ptr)
-{
- return __gthrw_(pthread_setspecific) (__key, __ptr);
-}
-
-static inline int
-__gthread_mutex_destroy (__gthread_mutex_t *__mutex)
-{
- if (__gthread_active_p ())
- return __gthrw_(pthread_mutex_destroy) (__mutex);
- else
- return 0;
-}
-
-static inline int
-__gthread_mutex_lock (__gthread_mutex_t *__mutex)
-{
- if (__gthread_active_p ())
- return __gthrw_(pthread_mutex_lock) (__mutex);
- else
- return 0;
-}
-
-static inline int
-__gthread_mutex_trylock (__gthread_mutex_t *__mutex)
-{
- if (__gthread_active_p ())
- return __gthrw_(pthread_mutex_trylock) (__mutex);
- else
- return 0;
-}
-
-#if _GTHREAD_USE_MUTEX_TIMEDLOCK
-static inline int
-__gthread_mutex_timedlock (__gthread_mutex_t *__mutex,
- const __gthread_time_t *__abs_timeout)
-{
- if (__gthread_active_p ())
- return __gthrw_(pthread_mutex_timedlock) (__mutex, __abs_timeout);
- else
- return 0;
-}
-#endif
-
-static inline int
-__gthread_mutex_unlock (__gthread_mutex_t *__mutex)
-{
- if (__gthread_active_p ())
- return __gthrw_(pthread_mutex_unlock) (__mutex);
- else
- return 0;
-}
-
-#ifndef PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
-static inline int
-__gthread_recursive_mutex_init_function (__gthread_recursive_mutex_t *__mutex)
-{
- if (__gthread_active_p ())
- {
- pthread_mutexattr_t __attr;
- int __r;
-
- __r = __gthrw_(pthread_mutexattr_init) (&__attr);
- if (!__r)
- __r = __gthrw_(pthread_mutexattr_settype) (&__attr,
- PTHREAD_MUTEX_RECURSIVE);
- if (!__r)
- __r = __gthrw_(pthread_mutex_init) (__mutex, &__attr);
- if (!__r)
- __r = __gthrw_(pthread_mutexattr_destroy) (&__attr);
- return __r;
- }
- return 0;
-}
-#endif
-
-static inline int
-__gthread_recursive_mutex_lock (__gthread_recursive_mutex_t *__mutex)
-{
- return __gthread_mutex_lock (__mutex);
-}
-
-static inline int
-__gthread_recursive_mutex_trylock (__gthread_recursive_mutex_t *__mutex)
-{
- return __gthread_mutex_trylock (__mutex);
-}
-
-#if _GTHREAD_USE_MUTEX_TIMEDLOCK
-static inline int
-__gthread_recursive_mutex_timedlock (__gthread_recursive_mutex_t *__mutex,
- const __gthread_time_t *__abs_timeout)
-{
- return __gthread_mutex_timedlock (__mutex, __abs_timeout);
-}
-#endif
-
-static inline int
-__gthread_recursive_mutex_unlock (__gthread_recursive_mutex_t *__mutex)
-{
- return __gthread_mutex_unlock (__mutex);
-}
-
-static inline int
-__gthread_cond_broadcast (__gthread_cond_t *__cond)
-{
- return __gthrw_(pthread_cond_broadcast) (__cond);
-}
-
-static inline int
-__gthread_cond_signal (__gthread_cond_t *__cond)
-{
- return __gthrw_(pthread_cond_signal) (__cond);
-}
-
-static inline int
-__gthread_cond_wait (__gthread_cond_t *__cond, __gthread_mutex_t *__mutex)
-{
- return __gthrw_(pthread_cond_wait) (__cond, __mutex);
-}
-
-static inline int
-__gthread_cond_timedwait (__gthread_cond_t *__cond, __gthread_mutex_t *__mutex,
- const __gthread_time_t *__abs_timeout)
-{
- return __gthrw_(pthread_cond_timedwait) (__cond, __mutex, __abs_timeout);
-}
-
-static inline int
-__gthread_cond_wait_recursive (__gthread_cond_t *__cond,
- __gthread_recursive_mutex_t *__mutex)
-{
- return __gthread_cond_wait (__cond, __mutex);
-}
-
-static inline int
-__gthread_cond_timedwait_recursive (__gthread_cond_t *__cond,
- __gthread_recursive_mutex_t *__mutex,
- const __gthread_time_t *__abs_timeout)
-{
- return __gthread_cond_timedwait (__cond, __mutex, __abs_timeout);
-}
-
-static inline int
-__gthread_cond_destroy (__gthread_cond_t* __cond)
-{
- return __gthrw_(pthread_cond_destroy) (__cond);
-}
-
-#endif /* _LIBOBJC */
-
-#endif /* ! GCC_GTHR_POSIX_H */
diff --git a/gcc/gthr-rtems.h b/gcc/gthr-rtems.h
deleted file mode 100644
index c5bd52292cf..00000000000
--- a/gcc/gthr-rtems.h
+++ /dev/null
@@ -1,157 +0,0 @@
-/* RTEMS threads compatibility routines for libgcc2 and libobjc.
- by: Rosimildo da Silva( rdasilva@connecttel.com ) */
-/* Compile this one with gcc. */
-/* Copyright (C) 1997, 1999, 2000, 2002, 2003, 2005, 2008, 2009
- 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 GCC_GTHR_RTEMS_H
-#define GCC_GTHR_RTEMS_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define __GTHREADS 1
-
-#define __GTHREAD_ONCE_INIT 0
-#define __GTHREAD_MUTEX_INIT_FUNCTION rtems_gxx_mutex_init
-#define __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION rtems_gxx_recursive_mutex_init
-
-/* Avoid dependency on rtems specific headers. */
-typedef void *__gthread_key_t;
-typedef int __gthread_once_t;
-typedef void *__gthread_mutex_t;
-typedef void *__gthread_recursive_mutex_t;
-
-/*
- * External functions provided by RTEMS. They are very similar to their POSIX
- * counterparts. A "Wrapper API" is being use to avoid dependency on any RTEMS
- * header files.
- */
-
-/* generic per task variables */
-extern int rtems_gxx_once (__gthread_once_t *__once, void (*__func) (void));
-extern int rtems_gxx_key_create (__gthread_key_t *__key, void (*__dtor) (void *));
-extern int rtems_gxx_key_delete (__gthread_key_t __key);
-extern void *rtems_gxx_getspecific (__gthread_key_t __key);
-extern int rtems_gxx_setspecific (__gthread_key_t __key, const void *__ptr);
-
-/* mutex support */
-extern void rtems_gxx_mutex_init (__gthread_mutex_t *__mutex);
-extern int rtems_gxx_mutex_destroy (__gthread_mutex_t *__mutex);
-extern int rtems_gxx_mutex_lock (__gthread_mutex_t *__mutex);
-extern int rtems_gxx_mutex_trylock (__gthread_mutex_t *__mutex);
-extern int rtems_gxx_mutex_unlock (__gthread_mutex_t *__mutex);
-
-/* recursive mutex support */
-extern void rtems_gxx_recursive_mutex_init (__gthread_recursive_mutex_t *__mutex);
-extern int rtems_gxx_recursive_mutex_lock (__gthread_recursive_mutex_t *__mutex);
-extern int rtems_gxx_recursive_mutex_trylock (__gthread_recursive_mutex_t *__mutex);
-extern int rtems_gxx_recursive_mutex_unlock (__gthread_recursive_mutex_t *__mutex);
-
-/* RTEMS threading is always active */
-static inline int
-__gthread_active_p (void)
-{
- return 1;
-}
-
-/* Wrapper calls */
-static inline int
-__gthread_once (__gthread_once_t *__once, void (*__func) (void))
-{
- return rtems_gxx_once( __once, __func );
-}
-
-static inline int
-__gthread_key_create (__gthread_key_t *__key, void (*__dtor) (void *))
-{
- return rtems_gxx_key_create( __key, __dtor );
-}
-
-static inline int
-__gthread_key_delete (__gthread_key_t __key)
-{
- return rtems_gxx_key_delete (__key);
-}
-
-static inline void *
-__gthread_getspecific (__gthread_key_t __key)
-{
- return rtems_gxx_getspecific (__key);
-}
-
-static inline int
-__gthread_setspecific (__gthread_key_t __key, const void *__ptr)
-{
- return rtems_gxx_setspecific (__key, __ptr);
-}
-
-static inline int
-__gthread_mutex_destroy (__gthread_mutex_t *__mutex)
-{
- return rtems_gxx_mutex_destroy (__mutex);
-}
-
-static inline int
-__gthread_mutex_lock (__gthread_mutex_t *__mutex)
-{
- return rtems_gxx_mutex_lock (__mutex);
-}
-
-static inline int
-__gthread_mutex_trylock (__gthread_mutex_t *__mutex)
-{
- return rtems_gxx_mutex_trylock (__mutex);
-}
-
-static inline int
-__gthread_mutex_unlock (__gthread_mutex_t *__mutex)
-{
- return rtems_gxx_mutex_unlock( __mutex );
-}
-
-static inline int
-__gthread_recursive_mutex_lock (__gthread_recursive_mutex_t *__mutex)
-{
- return rtems_gxx_recursive_mutex_lock (__mutex);
-}
-
-static inline int
-__gthread_recursive_mutex_trylock (__gthread_recursive_mutex_t *__mutex)
-{
- return rtems_gxx_recursive_mutex_trylock (__mutex);
-}
-
-static inline int
-__gthread_recursive_mutex_unlock (__gthread_recursive_mutex_t *__mutex)
-{
- return rtems_gxx_recursive_mutex_unlock( __mutex );
-}
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* ! GCC_GTHR_RTEMS_H */
diff --git a/gcc/gthr-single.h b/gcc/gthr-single.h
deleted file mode 100644
index 357528ad1f1..00000000000
--- a/gcc/gthr-single.h
+++ /dev/null
@@ -1,292 +0,0 @@
-/* Threads compatibility routines for libgcc2 and libobjc. */
-/* Compile this one with gcc. */
-/* Copyright (C) 1997, 1999, 2000, 2004, 2008, 2009
- 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 GCC_GTHR_SINGLE_H
-#define GCC_GTHR_SINGLE_H
-
-/* Just provide compatibility for mutex handling. */
-
-typedef int __gthread_key_t;
-typedef int __gthread_once_t;
-typedef int __gthread_mutex_t;
-typedef int __gthread_recursive_mutex_t;
-
-#define __GTHREAD_ONCE_INIT 0
-#define __GTHREAD_MUTEX_INIT 0
-#define __GTHREAD_RECURSIVE_MUTEX_INIT 0
-
-#define UNUSED __attribute__((unused))
-
-#ifdef _LIBOBJC
-
-/* Thread local storage for a single thread */
-static void *thread_local_storage = NULL;
-
-/* Backend initialization functions */
-
-/* Initialize the threads subsystem. */
-static inline int
-__gthread_objc_init_thread_system (void)
-{
- /* No thread support available */
- return -1;
-}
-
-/* Close the threads subsystem. */
-static inline int
-__gthread_objc_close_thread_system (void)
-{
- /* No thread support available */
- return -1;
-}
-
-/* Backend thread functions */
-
-/* Create a new thread of execution. */
-static inline objc_thread_t
-__gthread_objc_thread_detach (void (* func)(void *), void * arg UNUSED)
-{
- /* No thread support available */
- return NULL;
-}
-
-/* Set the current thread's priority. */
-static inline int
-__gthread_objc_thread_set_priority (int priority UNUSED)
-{
- /* No thread support available */
- return -1;
-}
-
-/* Return the current thread's priority. */
-static inline int
-__gthread_objc_thread_get_priority (void)
-{
- return OBJC_THREAD_INTERACTIVE_PRIORITY;
-}
-
-/* Yield our process time to another thread. */
-static inline void
-__gthread_objc_thread_yield (void)
-{
- return;
-}
-
-/* Terminate the current thread. */
-static inline int
-__gthread_objc_thread_exit (void)
-{
- /* No thread support available */
- /* Should we really exit the program */
- /* exit (&__objc_thread_exit_status); */
- return -1;
-}
-
-/* Returns an integer value which uniquely describes a thread. */
-static inline objc_thread_t
-__gthread_objc_thread_id (void)
-{
- /* No thread support, use 1. */
- return (objc_thread_t) 1;
-}
-
-/* Sets the thread's local storage pointer. */
-static inline int
-__gthread_objc_thread_set_data (void *value)
-{
- thread_local_storage = value;
- return 0;
-}
-
-/* Returns the thread's local storage pointer. */
-static inline void *
-__gthread_objc_thread_get_data (void)
-{
- return thread_local_storage;
-}
-
-/* Backend mutex functions */
-
-/* Allocate a mutex. */
-static inline int
-__gthread_objc_mutex_allocate (objc_mutex_t mutex UNUSED)
-{
- return 0;
-}
-
-/* Deallocate a mutex. */
-static inline int
-__gthread_objc_mutex_deallocate (objc_mutex_t mutex UNUSED)
-{
- return 0;
-}
-
-/* Grab a lock on a mutex. */
-static inline int
-__gthread_objc_mutex_lock (objc_mutex_t mutex UNUSED)
-{
- /* There can only be one thread, so we always get the lock */
- return 0;
-}
-
-/* Try to grab a lock on a mutex. */
-static inline int
-__gthread_objc_mutex_trylock (objc_mutex_t mutex UNUSED)
-{
- /* There can only be one thread, so we always get the lock */
- return 0;
-}
-
-/* Unlock the mutex */
-static inline int
-__gthread_objc_mutex_unlock (objc_mutex_t mutex UNUSED)
-{
- return 0;
-}
-
-/* Backend condition mutex functions */
-
-/* Allocate a condition. */
-static inline int
-__gthread_objc_condition_allocate (objc_condition_t condition UNUSED)
-{
- return 0;
-}
-
-/* Deallocate a condition. */
-static inline int
-__gthread_objc_condition_deallocate (objc_condition_t condition UNUSED)
-{
- return 0;
-}
-
-/* Wait on the condition */
-static inline int
-__gthread_objc_condition_wait (objc_condition_t condition UNUSED,
- objc_mutex_t mutex UNUSED)
-{
- return 0;
-}
-
-/* Wake up all threads waiting on this condition. */
-static inline int
-__gthread_objc_condition_broadcast (objc_condition_t condition UNUSED)
-{
- return 0;
-}
-
-/* Wake up one thread waiting on this condition. */
-static inline int
-__gthread_objc_condition_signal (objc_condition_t condition UNUSED)
-{
- return 0;
-}
-
-#else /* _LIBOBJC */
-
-static inline int
-__gthread_active_p (void)
-{
- return 0;
-}
-
-static inline int
-__gthread_once (__gthread_once_t *__once UNUSED, void (*__func) (void) UNUSED)
-{
- return 0;
-}
-
-static inline int UNUSED
-__gthread_key_create (__gthread_key_t *__key UNUSED, void (*__func) (void *) UNUSED)
-{
- return 0;
-}
-
-static int UNUSED
-__gthread_key_delete (__gthread_key_t __key UNUSED)
-{
- return 0;
-}
-
-static inline void *
-__gthread_getspecific (__gthread_key_t __key UNUSED)
-{
- return 0;
-}
-
-static inline int
-__gthread_setspecific (__gthread_key_t __key UNUSED, const void *__v UNUSED)
-{
- return 0;
-}
-
-static inline int
-__gthread_mutex_destroy (__gthread_mutex_t *__mutex UNUSED)
-{
- return 0;
-}
-
-static inline int
-__gthread_mutex_lock (__gthread_mutex_t *__mutex UNUSED)
-{
- return 0;
-}
-
-static inline int
-__gthread_mutex_trylock (__gthread_mutex_t *__mutex UNUSED)
-{
- return 0;
-}
-
-static inline int
-__gthread_mutex_unlock (__gthread_mutex_t *__mutex UNUSED)
-{
- return 0;
-}
-
-static inline int
-__gthread_recursive_mutex_lock (__gthread_recursive_mutex_t *__mutex)
-{
- return __gthread_mutex_lock (__mutex);
-}
-
-static inline int
-__gthread_recursive_mutex_trylock (__gthread_recursive_mutex_t *__mutex)
-{
- return __gthread_mutex_trylock (__mutex);
-}
-
-static inline int
-__gthread_recursive_mutex_unlock (__gthread_recursive_mutex_t *__mutex)
-{
- return __gthread_mutex_unlock (__mutex);
-}
-
-#endif /* _LIBOBJC */
-
-#undef UNUSED
-
-#endif /* ! GCC_GTHR_SINGLE_H */
diff --git a/gcc/gthr-tpf.h b/gcc/gthr-tpf.h
deleted file mode 100644
index fb23e91cfcd..00000000000
--- a/gcc/gthr-tpf.h
+++ /dev/null
@@ -1,229 +0,0 @@
-/* Threads compatibility routines for libgcc2 and libobjc.
- Compile this one with gcc.
- Copyright (C) 2004, 2005, 2008, 2009 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/>. */
-
-/* TPF needs its own version of gthr-*.h because TPF always links to
- the thread library. However, for performance reasons we still do not
- want to issue thread api calls unless a check is made to see that we
- are running as a thread. */
-
-#ifndef GCC_GTHR_TPF_H
-#define GCC_GTHR_TPF_H
-
-/* POSIX threads specific definitions.
- Easy, since the interface is just one-to-one mapping. */
-
-#define __GTHREADS 1
-
-/* Some implementations of <pthread.h> require this to be defined. */
-#ifndef _REENTRANT
-#define _REENTRANT 1
-#endif
-
-#include <pthread.h>
-#include <unistd.h>
-
-typedef pthread_key_t __gthread_key_t;
-typedef pthread_once_t __gthread_once_t;
-typedef pthread_mutex_t __gthread_mutex_t;
-typedef pthread_mutex_t __gthread_recursive_mutex_t;
-
-#if defined(PTHREAD_RECURSIVE_MUTEX_INITIALIZER)
-#define __GTHREAD_RECURSIVE_MUTEX_INIT PTHREAD_RECURSIVE_MUTEX_INITIALIZER
-#elif defined(PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP)
-#define __GTHREAD_RECURSIVE_MUTEX_INIT PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
-#endif
-
-#define __GTHREAD_MUTEX_INIT PTHREAD_MUTEX_INITIALIZER
-#define __GTHREAD_ONCE_INIT PTHREAD_ONCE_INIT
-#define __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION __gthread_recursive_mutex_init_function
-
-#define NOTATHREAD 00
-#define ECBBASEPTR (unsigned long int) *(unsigned int *)0x00000514u
-#define ECBPG2PTR ECBBASEPTR + 0x1000
-#define CE2THRCPTR *((unsigned char *)(ECBPG2PTR + 16))
-#define __tpf_pthread_active() (CE2THRCPTR != NOTATHREAD)
-
-#if SUPPORTS_WEAK && GTHREAD_USE_WEAK
-# define __gthrw(name) \
- static __typeof(name) __gthrw_ ## name __attribute__ ((__weakref__(#name)));
-# define __gthrw_(name) __gthrw_ ## name
-#else
-# define __gthrw(name)
-# define __gthrw_(name) name
-#endif
-
-__gthrw(pthread_once)
-__gthrw(pthread_key_create)
-__gthrw(pthread_key_delete)
-__gthrw(pthread_getspecific)
-__gthrw(pthread_setspecific)
-__gthrw(pthread_create)
-
-__gthrw(pthread_mutex_lock)
-__gthrw(pthread_mutex_trylock)
-__gthrw(pthread_mutex_unlock)
-__gthrw(pthread_mutexattr_init)
-__gthrw(pthread_mutexattr_settype)
-__gthrw(pthread_mutexattr_destroy)
-__gthrw(pthread_mutex_init)
-__gthrw(pthread_mutex_destroy)
-
-static inline int
-__gthread_active_p (void)
-{
- return 1;
-}
-
-static inline int
-__gthread_once (__gthread_once_t *__once, void (*__func) (void))
-{
- if (__tpf_pthread_active ())
- return __gthrw_(pthread_once) (__once, __func);
- else
- return -1;
-}
-
-static inline int
-__gthread_key_create (__gthread_key_t *__key, void (*__dtor) (void *))
-{
- if (__tpf_pthread_active ())
- return __gthrw_(pthread_key_create) (__key, __dtor);
- else
- return -1;
-}
-
-static inline int
-__gthread_key_delete (__gthread_key_t __key)
-{
- if (__tpf_pthread_active ())
- return __gthrw_(pthread_key_delete) (__key);
- else
- return -1;
-}
-
-static inline void *
-__gthread_getspecific (__gthread_key_t __key)
-{
- if (__tpf_pthread_active ())
- return __gthrw_(pthread_getspecific) (__key);
- else
- return NULL;
-}
-
-static inline int
-__gthread_setspecific (__gthread_key_t __key, const void *__ptr)
-{
- if (__tpf_pthread_active ())
- return __gthrw_(pthread_setspecific) (__key, __ptr);
- else
- return -1;
-}
-
-static inline int
-__gthread_mutex_destroy (__gthread_mutex_t *__mutex)
-{
- if (__tpf_pthread_active ())
- return __gthrw_(pthread_mutex_destroy) (__mutex);
- else
- return 0;
-}
-
-static inline int
-__gthread_mutex_lock (__gthread_mutex_t *__mutex)
-{
- if (__tpf_pthread_active ())
- return __gthrw_(pthread_mutex_lock) (__mutex);
- else
- return 0;
-}
-
-static inline int
-__gthread_mutex_trylock (__gthread_mutex_t *__mutex)
-{
- if (__tpf_pthread_active ())
- return __gthrw_(pthread_mutex_trylock) (__mutex);
- else
- return 0;
-}
-
-static inline int
-__gthread_mutex_unlock (__gthread_mutex_t *__mutex)
-{
- if (__tpf_pthread_active ())
- return __gthrw_(pthread_mutex_unlock) (__mutex);
- else
- return 0;
-}
-
-static inline int
-__gthread_recursive_mutex_lock (__gthread_recursive_mutex_t *__mutex)
-{
- if (__tpf_pthread_active ())
- return __gthread_mutex_lock (__mutex);
- else
- return 0;
-}
-
-static inline int
-__gthread_recursive_mutex_trylock (__gthread_recursive_mutex_t *__mutex)
-{
- if (__tpf_pthread_active ())
- return __gthread_mutex_trylock (__mutex);
- else
- return 0;
-}
-
-static inline int
-__gthread_recursive_mutex_unlock (__gthread_recursive_mutex_t *__mutex)
-{
- if (__tpf_pthread_active ())
- return __gthread_mutex_unlock (__mutex);
- else
- return 0;
-}
-
-static inline int
-__gthread_recursive_mutex_init_function (__gthread_recursive_mutex_t *__mutex)
-{
- if (__tpf_pthread_active ())
- {
- pthread_mutexattr_t __attr;
- int __r;
-
- __r = __gthrw_(pthread_mutexattr_init) (&__attr);
- if (!__r)
- __r = __gthrw_(pthread_mutexattr_settype) (&__attr,
- PTHREAD_MUTEX_RECURSIVE);
- if (!__r)
- __r = __gthrw_(pthread_mutex_init) (__mutex, &__attr);
- if (!__r)
- __r = __gthrw_(pthread_mutexattr_destroy) (&__attr);
- return __r;
- }
- return 0;
-}
-
-
-#endif /* ! GCC_GTHR_TPF_H */
diff --git a/gcc/gthr-vxworks.h b/gcc/gthr-vxworks.h
deleted file mode 100644
index d4da14ef492..00000000000
--- a/gcc/gthr-vxworks.h
+++ /dev/null
@@ -1,169 +0,0 @@
-/* Threads compatibility routines for libgcc2 and libobjc for VxWorks. */
-/* Compile this one with gcc. */
-/* Copyright (C) 1997, 1999, 2000, 2008, 2009 Free Software Foundation, Inc.
- Contributed by Mike Stump <mrs@wrs.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.
-
-Under Section 7 of GPL version 3, you are granted additional
-permissions described in the GCC Runtime Library Exception, version
-3.1, as published by the Free Software Foundation.
-
-You should have received a copy of the GNU General Public License and
-a copy of the 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 GCC_GTHR_VXWORKS_H
-#define GCC_GTHR_VXWORKS_H
-
-#ifdef _LIBOBJC
-
-/* libobjc requires the optional pthreads component. */
-#include "gthr-posix.h"
-
-#else
-#ifdef __cplusplus
-#define UNUSED(x)
-#else
-#define UNUSED(x) x __attribute__((unused))
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define __GTHREADS 1
-#define __gthread_active_p() 1
-
-/* Mutexes are easy, except that they need to be initialized at runtime. */
-
-#include <semLib.h>
-
-typedef SEM_ID __gthread_mutex_t;
-/* All VxWorks mutexes are recursive. */
-typedef SEM_ID __gthread_recursive_mutex_t;
-#define __GTHREAD_MUTEX_INIT_FUNCTION __gthread_mutex_init_function
-#define __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION __gthread_recursive_mutex_init_function
-
-static inline void
-__gthread_mutex_init_function (__gthread_mutex_t *mutex)
-{
- *mutex = semMCreate (SEM_Q_PRIORITY | SEM_INVERSION_SAFE | SEM_DELETE_SAFE);
-}
-
-static inline int
-__gthread_mutex_destroy (__gthread_mutex_t * UNUSED(mutex))
-{
- return 0;
-}
-
-static inline int
-__gthread_mutex_lock (__gthread_mutex_t *mutex)
-{
- return semTake (*mutex, WAIT_FOREVER);
-}
-
-static inline int
-__gthread_mutex_trylock (__gthread_mutex_t *mutex)
-{
- return semTake (*mutex, NO_WAIT);
-}
-
-static inline int
-__gthread_mutex_unlock (__gthread_mutex_t *mutex)
-{
- return semGive (*mutex);
-}
-
-static inline void
-__gthread_recursive_mutex_init_function (__gthread_recursive_mutex_t *mutex)
-{
- __gthread_mutex_init_function (mutex);
-}
-
-static inline int
-__gthread_recursive_mutex_lock (__gthread_recursive_mutex_t *mutex)
-{
- return __gthread_mutex_lock (mutex);
-}
-
-static inline int
-__gthread_recursive_mutex_trylock (__gthread_recursive_mutex_t *mutex)
-{
- return __gthread_mutex_trylock (mutex);
-}
-
-static inline int
-__gthread_recursive_mutex_unlock (__gthread_recursive_mutex_t *mutex)
-{
- return __gthread_mutex_unlock (mutex);
-}
-
-/* pthread_once is complicated enough that it's implemented
- out-of-line. See config/vxlib.c. */
-
-typedef struct
-{
-#if !defined(__RTP__)
-#if defined(__PPC__)
- __attribute ((aligned (__alignof (unsigned))))
-#endif
- volatile unsigned char busy;
-#endif
- volatile unsigned char done;
-#if !defined(__RTP__) && defined(__PPC__)
- /* PPC's test-and-set implementation requires a 4 byte aligned
- object, of which it only sets the first byte. We use padding
- here, in order to maintain some amount of backwards
- compatibility. Without this padding, gthread_once objects worked
- by accident because they happen to be static objects and the ppc
- port automatically increased their alignment to 4 bytes. */
- unsigned char pad1;
- unsigned char pad2;
-#endif
-}
-__gthread_once_t;
-
-#if defined (__RTP__)
-# define __GTHREAD_ONCE_INIT { 0 }
-#elif defined (__PPC__)
-# define __GTHREAD_ONCE_INIT { 0, 0, 0, 0 }
-#else
-# define __GTHREAD_ONCE_INIT { 0, 0 }
-#endif
-
-extern int __gthread_once (__gthread_once_t *__once, void (*__func)(void));
-
-/* Thread-specific data requires a great deal of effort, since VxWorks
- is not really set up for it. See config/vxlib.c for the gory
- details. All the TSD routines are sufficiently complex that they
- need to be implemented out of line. */
-
-typedef unsigned int __gthread_key_t;
-
-extern int __gthread_key_create (__gthread_key_t *__keyp, void (*__dtor)(void *));
-extern int __gthread_key_delete (__gthread_key_t __key);
-
-extern void *__gthread_getspecific (__gthread_key_t __key);
-extern int __gthread_setspecific (__gthread_key_t __key, void *__ptr);
-
-#undef UNUSED
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* not _LIBOBJC */
-
-#endif /* gthr-vxworks.h */
diff --git a/gcc/gthr-win32.h b/gcc/gthr-win32.h
deleted file mode 100644
index 53f8396cc81..00000000000
--- a/gcc/gthr-win32.h
+++ /dev/null
@@ -1,772 +0,0 @@
-/* Threads compatibility routines for libgcc2 and libobjc. */
-/* Compile this one with gcc. */
-
-/* Copyright (C) 1999, 2000, 2002, 2003, 2004, 2005, 2008, 2009
- Free Software Foundation, Inc.
- Contributed by Mumit Khan <khan@xraylith.wisc.edu>.
-
-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 GCC_GTHR_WIN32_H
-#define GCC_GTHR_WIN32_H
-
-/* Make sure CONST_CAST2 (origin in system.h) is declared. */
-#ifndef CONST_CAST2
-#define CONST_CAST2(TOTYPE,FROMTYPE,X) ((__extension__(union {FROMTYPE _q; TOTYPE _nq;})(X))._nq)
-#endif
-
-/* Windows32 threads specific definitions. The windows32 threading model
- does not map well into pthread-inspired gcc's threading model, and so
- there are caveats one needs to be aware of.
-
- 1. The destructor supplied to __gthread_key_create is ignored for
- generic x86-win32 ports. This will certainly cause memory leaks
- due to unreclaimed eh contexts (sizeof (eh_context) is at least
- 24 bytes for x86 currently).
-
- This memory leak may be significant for long-running applications
- that make heavy use of C++ EH.
-
- However, Mingw runtime (version 0.3 or newer) provides a mechanism
- to emulate pthreads key dtors; the runtime provides a special DLL,
- linked in if -mthreads option is specified, that runs the dtors in
- the reverse order of registration when each thread exits. If
- -mthreads option is not given, a stub is linked in instead of the
- DLL, which results in memory leak. Other x86-win32 ports can use
- the same technique of course to avoid the leak.
-
- 2. The error codes returned are non-POSIX like, and cast into ints.
- This may cause incorrect error return due to truncation values on
- hw where sizeof (DWORD) > sizeof (int).
-
- 3. We are currently using a special mutex instead of the Critical
- Sections, since Win9x does not support TryEnterCriticalSection
- (while NT does).
-
- The basic framework should work well enough. In the long term, GCC
- needs to use Structured Exception Handling on Windows32. */
-
-#define __GTHREADS 1
-
-#include <errno.h>
-#ifdef __MINGW32__
-#include <_mingw.h>
-#endif
-
-#ifndef __UNUSED_PARAM
-#define __UNUSED_PARAM(x) x
-#endif
-
-#ifdef _LIBOBJC
-
-/* This is necessary to prevent windef.h (included from windows.h) from
- defining its own BOOL as a typedef. */
-#ifndef __OBJC__
-#define __OBJC__
-#endif
-#include <windows.h>
-/* Now undef the windows BOOL. */
-#undef BOOL
-
-/* Key structure for maintaining thread specific storage */
-static DWORD __gthread_objc_data_tls = (DWORD) -1;
-
-/* Backend initialization functions */
-
-/* Initialize the threads subsystem. */
-int
-__gthread_objc_init_thread_system (void)
-{
- /* Initialize the thread storage key. */
- if ((__gthread_objc_data_tls = TlsAlloc ()) != (DWORD) -1)
- return 0;
- else
- return -1;
-}
-
-/* Close the threads subsystem. */
-int
-__gthread_objc_close_thread_system (void)
-{
- if (__gthread_objc_data_tls != (DWORD) -1)
- TlsFree (__gthread_objc_data_tls);
- return 0;
-}
-
-/* Backend thread functions */
-
-/* Create a new thread of execution. */
-objc_thread_t
-__gthread_objc_thread_detach (void (*func)(void *arg), void *arg)
-{
- DWORD thread_id = 0;
- HANDLE win32_handle;
-
- if (!(win32_handle = CreateThread (NULL, 0, (LPTHREAD_START_ROUTINE) func,
- arg, 0, &thread_id)))
- thread_id = 0;
-
- return (objc_thread_t) (INT_PTR) thread_id;
-}
-
-/* Set the current thread's priority. */
-int
-__gthread_objc_thread_set_priority (int priority)
-{
- int sys_priority = 0;
-
- switch (priority)
- {
- case OBJC_THREAD_INTERACTIVE_PRIORITY:
- sys_priority = THREAD_PRIORITY_NORMAL;
- break;
- default:
- case OBJC_THREAD_BACKGROUND_PRIORITY:
- sys_priority = THREAD_PRIORITY_BELOW_NORMAL;
- break;
- case OBJC_THREAD_LOW_PRIORITY:
- sys_priority = THREAD_PRIORITY_LOWEST;
- break;
- }
-
- /* Change priority */
- if (SetThreadPriority (GetCurrentThread (), sys_priority))
- return 0;
- else
- return -1;
-}
-
-/* Return the current thread's priority. */
-int
-__gthread_objc_thread_get_priority (void)
-{
- int sys_priority;
-
- sys_priority = GetThreadPriority (GetCurrentThread ());
-
- switch (sys_priority)
- {
- case THREAD_PRIORITY_HIGHEST:
- case THREAD_PRIORITY_TIME_CRITICAL:
- case THREAD_PRIORITY_ABOVE_NORMAL:
- case THREAD_PRIORITY_NORMAL:
- return OBJC_THREAD_INTERACTIVE_PRIORITY;
-
- default:
- case THREAD_PRIORITY_BELOW_NORMAL:
- return OBJC_THREAD_BACKGROUND_PRIORITY;
-
- case THREAD_PRIORITY_IDLE:
- case THREAD_PRIORITY_LOWEST:
- return OBJC_THREAD_LOW_PRIORITY;
- }
-
- /* Couldn't get priority. */
- return -1;
-}
-
-/* Yield our process time to another thread. */
-void
-__gthread_objc_thread_yield (void)
-{
- Sleep (0);
-}
-
-/* Terminate the current thread. */
-int
-__gthread_objc_thread_exit (void)
-{
- /* exit the thread */
- ExitThread (__objc_thread_exit_status);
-
- /* Failed if we reached here */
- return -1;
-}
-
-/* Returns an integer value which uniquely describes a thread. */
-objc_thread_t
-__gthread_objc_thread_id (void)
-{
- return (objc_thread_t) (INT_PTR) GetCurrentThreadId ();
-}
-
-/* Sets the thread's local storage pointer. */
-int
-__gthread_objc_thread_set_data (void *value)
-{
- if (TlsSetValue (__gthread_objc_data_tls, value))
- return 0;
- else
- return -1;
-}
-
-/* Returns the thread's local storage pointer. */
-void *
-__gthread_objc_thread_get_data (void)
-{
- DWORD lasterror;
- void *ptr;
-
- lasterror = GetLastError ();
-
- ptr = TlsGetValue (__gthread_objc_data_tls); /* Return thread data. */
-
- SetLastError (lasterror);
-
- return ptr;
-}
-
-/* Backend mutex functions */
-
-/* Allocate a mutex. */
-int
-__gthread_objc_mutex_allocate (objc_mutex_t mutex)
-{
- if ((mutex->backend = (void *) CreateMutex (NULL, 0, NULL)) == NULL)
- return -1;
- else
- return 0;
-}
-
-/* Deallocate a mutex. */
-int
-__gthread_objc_mutex_deallocate (objc_mutex_t mutex)
-{
- CloseHandle ((HANDLE) (mutex->backend));
- return 0;
-}
-
-/* Grab a lock on a mutex. */
-int
-__gthread_objc_mutex_lock (objc_mutex_t mutex)
-{
- int status;
-
- status = WaitForSingleObject ((HANDLE) (mutex->backend), INFINITE);
- if (status != WAIT_OBJECT_0 && status != WAIT_ABANDONED)
- return -1;
- else
- return 0;
-}
-
-/* Try to grab a lock on a mutex. */
-int
-__gthread_objc_mutex_trylock (objc_mutex_t mutex)
-{
- int status;
-
- status = WaitForSingleObject ((HANDLE) (mutex->backend), 0);
- if (status != WAIT_OBJECT_0 && status != WAIT_ABANDONED)
- return -1;
- else
- return 0;
-}
-
-/* Unlock the mutex */
-int
-__gthread_objc_mutex_unlock (objc_mutex_t mutex)
-{
- if (ReleaseMutex ((HANDLE) (mutex->backend)) == 0)
- return -1;
- else
- return 0;
-}
-
-/* Backend condition mutex functions */
-
-/* Allocate a condition. */
-int
-__gthread_objc_condition_allocate (objc_condition_t __UNUSED_PARAM(condition))
-{
- /* Unimplemented. */
- return -1;
-}
-
-/* Deallocate a condition. */
-int
-__gthread_objc_condition_deallocate (objc_condition_t __UNUSED_PARAM(condition))
-{
- /* Unimplemented. */
- return -1;
-}
-
-/* Wait on the condition */
-int
-__gthread_objc_condition_wait (objc_condition_t __UNUSED_PARAM(condition),
- objc_mutex_t __UNUSED_PARAM(mutex))
-{
- /* Unimplemented. */
- return -1;
-}
-
-/* Wake up all threads waiting on this condition. */
-int
-__gthread_objc_condition_broadcast (objc_condition_t __UNUSED_PARAM(condition))
-{
- /* Unimplemented. */
- return -1;
-}
-
-/* Wake up one thread waiting on this condition. */
-int
-__gthread_objc_condition_signal (objc_condition_t __UNUSED_PARAM(condition))
-{
- /* Unimplemented. */
- return -1;
-}
-
-#else /* _LIBOBJC */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef unsigned long __gthread_key_t;
-
-typedef struct {
- int done;
- long started;
-} __gthread_once_t;
-
-typedef struct {
- long counter;
- void *sema;
-} __gthread_mutex_t;
-
-typedef struct {
- long counter;
- long depth;
- unsigned long owner;
- void *sema;
-} __gthread_recursive_mutex_t;
-
-#define __GTHREAD_ONCE_INIT {0, -1}
-#define __GTHREAD_MUTEX_INIT_FUNCTION __gthread_mutex_init_function
-#define __GTHREAD_MUTEX_INIT_DEFAULT {-1, 0}
-#define __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION \
- __gthread_recursive_mutex_init_function
-#define __GTHREAD_RECURSIVE_MUTEX_INIT_DEFAULT {-1, 0, 0, 0}
-
-#if defined (_WIN32) && !defined(__CYGWIN__)
-#define MINGW32_SUPPORTS_MT_EH 1
-/* Mingw runtime >= v0.3 provides a magic variable that is set to nonzero
- if -mthreads option was specified, or 0 otherwise. This is to get around
- the lack of weak symbols in PE-COFF. */
-extern int _CRT_MT;
-extern int __mingwthr_key_dtor (unsigned long, void (*) (void *));
-#endif /* _WIN32 && !__CYGWIN__ */
-
-/* The Windows95 kernel does not export InterlockedCompareExchange.
- This provides a substitute. When building apps that reference
- gthread_mutex_try_lock, the __GTHREAD_I486_INLINE_LOCK_PRIMITIVES
- macro must be defined if Windows95 is a target. Currently
- gthread_mutex_try_lock is not referenced by libgcc or libstdc++. */
-#ifdef __GTHREAD_I486_INLINE_LOCK_PRIMITIVES
-static inline long
-__gthr_i486_lock_cmp_xchg(long *__dest, long __xchg, long __comperand)
-{
- long result;
- __asm__ __volatile__ ("\n\
- lock\n\
- cmpxchg{l} {%4, %1|%1, %4}\n"
- : "=a" (result), "=m" (*__dest)
- : "0" (__comperand), "m" (*__dest), "r" (__xchg)
- : "cc");
- return result;
-}
-#define __GTHR_W32_InterlockedCompareExchange __gthr_i486_lock_cmp_xchg
-#else /* __GTHREAD_I486_INLINE_LOCK_PRIMITIVES */
-#define __GTHR_W32_InterlockedCompareExchange InterlockedCompareExchange
-#endif /* __GTHREAD_I486_INLINE_LOCK_PRIMITIVES */
-
-static inline int
-__gthread_active_p (void)
-{
-#ifdef MINGW32_SUPPORTS_MT_EH
- return _CRT_MT;
-#else
- return 1;
-#endif
-}
-
-#if __GTHREAD_HIDE_WIN32API
-
-/* The implementations are in config/i386/gthr-win32.c in libgcc.a.
- Only stubs are exposed to avoid polluting the C++ namespace with
- windows api definitions. */
-
-extern int __gthr_win32_once (__gthread_once_t *, void (*) (void));
-extern int __gthr_win32_key_create (__gthread_key_t *, void (*) (void*));
-extern int __gthr_win32_key_delete (__gthread_key_t);
-extern void * __gthr_win32_getspecific (__gthread_key_t);
-extern int __gthr_win32_setspecific (__gthread_key_t, const void *);
-extern void __gthr_win32_mutex_init_function (__gthread_mutex_t *);
-extern int __gthr_win32_mutex_lock (__gthread_mutex_t *);
-extern int __gthr_win32_mutex_trylock (__gthread_mutex_t *);
-extern int __gthr_win32_mutex_unlock (__gthread_mutex_t *);
-extern void
- __gthr_win32_recursive_mutex_init_function (__gthread_recursive_mutex_t *);
-extern int __gthr_win32_recursive_mutex_lock (__gthread_recursive_mutex_t *);
-extern int
- __gthr_win32_recursive_mutex_trylock (__gthread_recursive_mutex_t *);
-extern int __gthr_win32_recursive_mutex_unlock (__gthread_recursive_mutex_t *);
-extern void __gthr_win32_mutex_destroy (__gthread_mutex_t *);
-
-static inline int
-__gthread_once (__gthread_once_t *__once, void (*__func) (void))
-{
- if (__gthread_active_p ())
- return __gthr_win32_once (__once, __func);
- else
- return -1;
-}
-
-static inline int
-__gthread_key_create (__gthread_key_t *__key, void (*__dtor) (void *))
-{
- return __gthr_win32_key_create (__key, __dtor);
-}
-
-static inline int
-__gthread_key_delete (__gthread_key_t __key)
-{
- return __gthr_win32_key_delete (__key);
-}
-
-static inline void *
-__gthread_getspecific (__gthread_key_t __key)
-{
- return __gthr_win32_getspecific (__key);
-}
-
-static inline int
-__gthread_setspecific (__gthread_key_t __key, const void *__ptr)
-{
- return __gthr_win32_setspecific (__key, __ptr);
-}
-
-static inline void
-__gthread_mutex_init_function (__gthread_mutex_t *__mutex)
-{
- __gthr_win32_mutex_init_function (__mutex);
-}
-
-static inline void
-__gthread_mutex_destroy (__gthread_mutex_t *__mutex)
-{
- __gthr_win32_mutex_destroy (__mutex);
-}
-
-static inline int
-__gthread_mutex_lock (__gthread_mutex_t *__mutex)
-{
- if (__gthread_active_p ())
- return __gthr_win32_mutex_lock (__mutex);
- else
- return 0;
-}
-
-static inline int
-__gthread_mutex_trylock (__gthread_mutex_t *__mutex)
-{
- if (__gthread_active_p ())
- return __gthr_win32_mutex_trylock (__mutex);
- else
- return 0;
-}
-
-static inline int
-__gthread_mutex_unlock (__gthread_mutex_t *__mutex)
-{
- if (__gthread_active_p ())
- return __gthr_win32_mutex_unlock (__mutex);
- else
- return 0;
-}
-
-static inline void
-__gthread_recursive_mutex_init_function (__gthread_recursive_mutex_t *__mutex)
-{
- __gthr_win32_recursive_mutex_init_function (__mutex);
-}
-
-static inline int
-__gthread_recursive_mutex_lock (__gthread_recursive_mutex_t *__mutex)
-{
- if (__gthread_active_p ())
- return __gthr_win32_recursive_mutex_lock (__mutex);
- else
- return 0;
-}
-
-static inline int
-__gthread_recursive_mutex_trylock (__gthread_recursive_mutex_t *__mutex)
-{
- if (__gthread_active_p ())
- return __gthr_win32_recursive_mutex_trylock (__mutex);
- else
- return 0;
-}
-
-static inline int
-__gthread_recursive_mutex_unlock (__gthread_recursive_mutex_t *__mutex)
-{
- if (__gthread_active_p ())
- return __gthr_win32_recursive_mutex_unlock (__mutex);
- else
- return 0;
-}
-
-#else /* ! __GTHREAD_HIDE_WIN32API */
-
-#include <windows.h>
-#include <errno.h>
-
-static inline int
-__gthread_once (__gthread_once_t *__once, void (*__func) (void))
-{
- if (! __gthread_active_p ())
- return -1;
- else if (__once == NULL || __func == NULL)
- return EINVAL;
-
- if (! __once->done)
- {
- if (InterlockedIncrement (&(__once->started)) == 0)
- {
- (*__func) ();
- __once->done = TRUE;
- }
- else
- {
- /* Another thread is currently executing the code, so wait for it
- to finish; yield the CPU in the meantime. If performance
- does become an issue, the solution is to use an Event that
- we wait on here (and set above), but that implies a place to
- create the event before this routine is called. */
- while (! __once->done)
- Sleep (0);
- }
- }
-
- return 0;
-}
-
-/* Windows32 thread local keys don't support destructors; this leads to
- leaks, especially in threaded applications making extensive use of
- C++ EH. Mingw uses a thread-support DLL to work-around this problem. */
-static inline int
-__gthread_key_create (__gthread_key_t *__key,
- void (*__dtor) (void *) __attribute__((unused)))
-{
- int __status = 0;
- DWORD __tls_index = TlsAlloc ();
- if (__tls_index != 0xFFFFFFFF)
- {
- *__key = __tls_index;
-#ifdef MINGW32_SUPPORTS_MT_EH
- /* Mingw runtime will run the dtors in reverse order for each thread
- when the thread exits. */
- __status = __mingwthr_key_dtor (*__key, __dtor);
-#endif
- }
- else
- __status = (int) GetLastError ();
- return __status;
-}
-
-static inline int
-__gthread_key_delete (__gthread_key_t __key)
-{
- return (TlsFree (__key) != 0) ? 0 : (int) GetLastError ();
-}
-
-static inline void *
-__gthread_getspecific (__gthread_key_t __key)
-{
- DWORD __lasterror;
- void *__ptr;
-
- __lasterror = GetLastError ();
-
- __ptr = TlsGetValue (__key);
-
- SetLastError (__lasterror);
-
- return __ptr;
-}
-
-static inline int
-__gthread_setspecific (__gthread_key_t __key, const void *__ptr)
-{
- if (TlsSetValue (__key, CONST_CAST2(void *, const void *, __ptr)) != 0)
- return 0;
- else
- return GetLastError ();
-}
-
-static inline void
-__gthread_mutex_init_function (__gthread_mutex_t *__mutex)
-{
- __mutex->counter = -1;
- __mutex->sema = CreateSemaphore (NULL, 0, 65535, NULL);
-}
-
-static inline void
-__gthread_mutex_destroy (__gthread_mutex_t *__mutex)
-{
- CloseHandle ((HANDLE) __mutex->sema);
-}
-
-static inline int
-__gthread_mutex_lock (__gthread_mutex_t *__mutex)
-{
- int __status = 0;
-
- if (__gthread_active_p ())
- {
- if (InterlockedIncrement (&__mutex->counter) == 0 ||
- WaitForSingleObject (__mutex->sema, INFINITE) == WAIT_OBJECT_0)
- __status = 0;
- else
- {
- /* WaitForSingleObject returns WAIT_FAILED, and we can only do
- some best-effort cleanup here. */
- InterlockedDecrement (&__mutex->counter);
- __status = 1;
- }
- }
- return __status;
-}
-
-static inline int
-__gthread_mutex_trylock (__gthread_mutex_t *__mutex)
-{
- int __status = 0;
-
- if (__gthread_active_p ())
- {
- if (__GTHR_W32_InterlockedCompareExchange (&__mutex->counter, 0, -1) < 0)
- __status = 0;
- else
- __status = 1;
- }
- return __status;
-}
-
-static inline int
-__gthread_mutex_unlock (__gthread_mutex_t *__mutex)
-{
- if (__gthread_active_p ())
- {
- if (InterlockedDecrement (&__mutex->counter) >= 0)
- return ReleaseSemaphore (__mutex->sema, 1, NULL) ? 0 : 1;
- }
- return 0;
-}
-
-static inline void
-__gthread_recursive_mutex_init_function (__gthread_recursive_mutex_t *__mutex)
-{
- __mutex->counter = -1;
- __mutex->depth = 0;
- __mutex->owner = 0;
- __mutex->sema = CreateSemaphore (NULL, 0, 65535, NULL);
-}
-
-static inline int
-__gthread_recursive_mutex_lock (__gthread_recursive_mutex_t *__mutex)
-{
- if (__gthread_active_p ())
- {
- DWORD __me = GetCurrentThreadId();
- if (InterlockedIncrement (&__mutex->counter) == 0)
- {
- __mutex->depth = 1;
- __mutex->owner = __me;
- }
- else if (__mutex->owner == __me)
- {
- InterlockedDecrement (&__mutex->counter);
- ++(__mutex->depth);
- }
- else if (WaitForSingleObject (__mutex->sema, INFINITE) == WAIT_OBJECT_0)
- {
- __mutex->depth = 1;
- __mutex->owner = __me;
- }
- else
- {
- /* WaitForSingleObject returns WAIT_FAILED, and we can only do
- some best-effort cleanup here. */
- InterlockedDecrement (&__mutex->counter);
- return 1;
- }
- }
- return 0;
-}
-
-static inline int
-__gthread_recursive_mutex_trylock (__gthread_recursive_mutex_t *__mutex)
-{
- if (__gthread_active_p ())
- {
- DWORD __me = GetCurrentThreadId();
- if (__GTHR_W32_InterlockedCompareExchange (&__mutex->counter, 0, -1) < 0)
- {
- __mutex->depth = 1;
- __mutex->owner = __me;
- }
- else if (__mutex->owner == __me)
- ++(__mutex->depth);
- else
- return 1;
- }
- return 0;
-}
-
-static inline int
-__gthread_recursive_mutex_unlock (__gthread_recursive_mutex_t *__mutex)
-{
- if (__gthread_active_p ())
- {
- --(__mutex->depth);
- if (__mutex->depth == 0)
- {
- __mutex->owner = 0;
-
- if (InterlockedDecrement (&__mutex->counter) >= 0)
- return ReleaseSemaphore (__mutex->sema, 1, NULL) ? 0 : 1;
- }
- }
- return 0;
-}
-
-#endif /* __GTHREAD_HIDE_WIN32API */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _LIBOBJC */
-
-#endif /* ! GCC_GTHR_WIN32_H */
diff --git a/gcc/gthr.h b/gcc/gthr.h
deleted file mode 100644
index 0c7bfb17aa3..00000000000
--- a/gcc/gthr.h
+++ /dev/null
@@ -1,168 +0,0 @@
-/* Threads compatibility routines for libgcc2. */
-/* Compile this one with gcc. */
-/* Copyright (C) 1997, 1998, 2004, 2008, 2009, 2011
- 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 GCC_GTHR_H
-#define GCC_GTHR_H
-
-#ifndef HIDE_EXPORTS
-#pragma GCC visibility push(default)
-#endif
-
-/* If this file is compiled with threads support, it must
- #define __GTHREADS 1
- to indicate that threads support is present. Also it has define
- function
- int __gthread_active_p ()
- that returns 1 if thread system is active, 0 if not.
-
- The threads interface must define the following types:
- __gthread_key_t
- __gthread_once_t
- __gthread_mutex_t
- __gthread_recursive_mutex_t
-
- The threads interface must define the following macros:
-
- __GTHREAD_ONCE_INIT
- to initialize __gthread_once_t
- __GTHREAD_MUTEX_INIT
- to initialize __gthread_mutex_t to get a fast
- non-recursive mutex.
- __GTHREAD_MUTEX_INIT_FUNCTION
- some systems can't initialize a mutex without a
- function call. On such systems, define this to a
- function which looks like this:
- void __GTHREAD_MUTEX_INIT_FUNCTION (__gthread_mutex_t *)
- Don't define __GTHREAD_MUTEX_INIT in this case
- __GTHREAD_RECURSIVE_MUTEX_INIT
- __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION
- as above, but for a recursive mutex.
-
- The threads interface must define the following static functions:
-
- int __gthread_once (__gthread_once_t *once, void (*func) ())
-
- int __gthread_key_create (__gthread_key_t *keyp, void (*dtor) (void *))
- int __gthread_key_delete (__gthread_key_t key)
-
- void *__gthread_getspecific (__gthread_key_t key)
- int __gthread_setspecific (__gthread_key_t key, const void *ptr)
-
- int __gthread_mutex_destroy (__gthread_mutex_t *mutex);
-
- int __gthread_mutex_lock (__gthread_mutex_t *mutex);
- int __gthread_mutex_trylock (__gthread_mutex_t *mutex);
- int __gthread_mutex_unlock (__gthread_mutex_t *mutex);
-
- int __gthread_recursive_mutex_lock (__gthread_recursive_mutex_t *mutex);
- int __gthread_recursive_mutex_trylock (__gthread_recursive_mutex_t *mutex);
- int __gthread_recursive_mutex_unlock (__gthread_recursive_mutex_t *mutex);
-
- The following are supported in POSIX threads only. They are required to
- fix a deadlock in static initialization inside libsupc++. The header file
- gthr-posix.h defines a symbol __GTHREAD_HAS_COND to signify that these extra
- features are supported.
-
- Types:
- __gthread_cond_t
-
- Macros:
- __GTHREAD_COND_INIT
- __GTHREAD_COND_INIT_FUNCTION
-
- Interface:
- int __gthread_cond_broadcast (__gthread_cond_t *cond);
- int __gthread_cond_wait (__gthread_cond_t *cond, __gthread_mutex_t *mutex);
- int __gthread_cond_wait_recursive (__gthread_cond_t *cond,
- __gthread_recursive_mutex_t *mutex);
-
- All functions returning int should return zero on success or the error
- number. If the operation is not supported, -1 is returned.
-
- If the following are also defined, you should
- #define __GTHREADS_CXX0X 1
- to enable the c++0x thread library.
-
- Types:
- __gthread_t
- __gthread_time_t
-
- Interface:
- int __gthread_create (__gthread_t *thread, void *(*func) (void*),
- void *args);
- int __gthread_join (__gthread_t thread, void **value_ptr);
- int __gthread_detach (__gthread_t thread);
- int __gthread_equal (__gthread_t t1, __gthread_t t2);
- __gthread_t __gthread_self (void);
- int __gthread_yield (void);
-
- int __gthread_mutex_timedlock (__gthread_mutex_t *m,
- const __gthread_time_t *abs_timeout);
- int __gthread_recursive_mutex_timedlock (__gthread_recursive_mutex_t *m,
- const __gthread_time_t *abs_time);
-
- int __gthread_cond_signal (__gthread_cond_t *cond);
- int __gthread_cond_timedwait (__gthread_cond_t *cond,
- __gthread_mutex_t *mutex,
- const __gthread_time_t *abs_timeout);
- int __gthread_cond_timedwait_recursive (__gthread_cond_t *cond,
- __gthread_recursive_mutex_t *mutex,
- const __gthread_time_t *abs_time)
-
- Currently supported threads packages are
- TPF threads with -D__tpf__
- POSIX/Unix98 threads with -D_PTHREADS
- DCE threads with -D_DCE_THREADS
-
-*/
-
-/* Check first for thread specific defines. */
-#if defined (__tpf__)
-#include "gthr-tpf.h"
-#elif _PTHREADS
-#include "gthr-posix.h"
-#elif _DCE_THREADS
-#include "gthr-dce.h"
-
-/* Include GTHREAD_FILE if one is defined. */
-#elif defined(HAVE_GTHR_DEFAULT)
-#if SUPPORTS_WEAK
-#ifndef GTHREAD_USE_WEAK
-#define GTHREAD_USE_WEAK 1
-#endif
-#endif
-#include "gthr-default.h"
-
-/* Fallback to single thread definitions. */
-#else
-#include "gthr-single.h"
-#endif
-
-#ifndef HIDE_EXPORTS
-#pragma GCC visibility pop
-#endif
-
-#endif /* ! GCC_GTHR_H */
diff --git a/gcc/ifcvt.c b/gcc/ifcvt.c
index 784e2e8b106..3b05c2a8ad8 100644
--- a/gcc/ifcvt.c
+++ b/gcc/ifcvt.c
@@ -2329,12 +2329,12 @@ noce_operand_ok (const_rtx op)
{
/* We special-case memories, so handle any of them with
no address side effects. */
- if (MEM_P (op))
- return ! side_effects_p (XEXP (op, 0));
-
if (side_effects_p (op))
return FALSE;
+ if (MEM_P (op))
+ return ! side_effects_p (XEXP (op, 0));
+
return ! may_trap_p (op);
}
diff --git a/gcc/insn-notes.def b/gcc/insn-notes.def
index 2ea673f05e6..c1d621a1d16 100644
--- a/gcc/insn-notes.def
+++ b/gcc/insn-notes.def
@@ -36,6 +36,10 @@ INSN_NOTE (DELETED)
/* Generated in place of user-declared labels when they are deleted. */
INSN_NOTE (DELETED_LABEL)
+/* Similarly, but for labels that have been present in debug stmts
+ earlier and thus will only appear with -g. These must use different
+ label namespace. */
+INSN_NOTE (DELETED_DEBUG_LABEL)
/* These are used to mark the beginning and end of a lexical block.
See NOTE_BLOCK and reorder_blocks. */
diff --git a/gcc/ipa-inline.c b/gcc/ipa-inline.c
index 18efc02e9d5..3dadf8d12d7 100644
--- a/gcc/ipa-inline.c
+++ b/gcc/ipa-inline.c
@@ -1957,6 +1957,8 @@ early_inliner (void)
= estimate_num_insns (edge->call_stmt, &eni_size_weights);
es->call_stmt_time
= estimate_num_insns (edge->call_stmt, &eni_time_weights);
+ edge->call_stmt_cannot_inline_p
+ = gimple_call_cannot_inline_p (edge->call_stmt);
}
timevar_pop (TV_INTEGRATION);
iterations++;
diff --git a/gcc/ipa-prop.c b/gcc/ipa-prop.c
index e624426d698..7946aca0bff 100644
--- a/gcc/ipa-prop.c
+++ b/gcc/ipa-prop.c
@@ -271,8 +271,20 @@ ipa_print_all_jump_functions (FILE *f)
struct type_change_info
{
+ /* Offset into the object where there is the virtual method pointer we are
+ looking for. */
+ HOST_WIDE_INT offset;
+ /* The declaration or SSA_NAME pointer of the base that we are checking for
+ type change. */
+ tree object;
+ /* If we actually can tell the type that the object has changed to, it is
+ stored in this field. Otherwise it remains NULL_TREE. */
+ tree known_current_type;
/* Set to true if dynamic type change has been detected. */
bool type_maybe_changed;
+ /* Set to true if multiple types have been encountered. known_current_type
+ must be disregarded in that case. */
+ bool multiple_types_encountered;
};
/* Return true if STMT can modify a virtual method table pointer.
@@ -338,6 +350,50 @@ stmt_may_be_vtbl_ptr_store (gimple stmt)
return true;
}
+/* If STMT can be proved to be an assignment to the virtual method table
+ pointer of ANALYZED_OBJ and the type associated with the new table
+ identified, return the type. Otherwise return NULL_TREE. */
+
+static tree
+extr_type_from_vtbl_ptr_store (gimple stmt, struct type_change_info *tci)
+{
+ HOST_WIDE_INT offset, size, max_size;
+ tree lhs, rhs, base;
+
+ if (!gimple_assign_single_p (stmt))
+ return NULL_TREE;
+
+ lhs = gimple_assign_lhs (stmt);
+ rhs = gimple_assign_rhs1 (stmt);
+ if (TREE_CODE (lhs) != COMPONENT_REF
+ || !DECL_VIRTUAL_P (TREE_OPERAND (lhs, 1))
+ || TREE_CODE (rhs) != ADDR_EXPR)
+ return NULL_TREE;
+ rhs = get_base_address (TREE_OPERAND (rhs, 0));
+ if (!rhs
+ || TREE_CODE (rhs) != VAR_DECL
+ || !DECL_VIRTUAL_P (rhs))
+ return NULL_TREE;
+
+ base = get_ref_base_and_extent (lhs, &offset, &size, &max_size);
+ if (offset != tci->offset
+ || size != POINTER_SIZE
+ || max_size != POINTER_SIZE)
+ return NULL_TREE;
+ if (TREE_CODE (base) == MEM_REF)
+ {
+ if (TREE_CODE (tci->object) != MEM_REF
+ || TREE_OPERAND (tci->object, 0) != TREE_OPERAND (base, 0)
+ || !tree_int_cst_equal (TREE_OPERAND (tci->object, 1),
+ TREE_OPERAND (base, 1)))
+ return NULL_TREE;
+ }
+ else if (tci->object != base)
+ return NULL_TREE;
+
+ return DECL_CONTEXT (rhs);
+}
+
/* Callback of walk_aliased_vdefs and a helper function for
detect_type_change to check whether a particular statement may modify
the virtual table pointer, and if possible also determine the new type of
@@ -352,6 +408,12 @@ check_stmt_for_type_change (ao_ref *ao ATTRIBUTE_UNUSED, tree vdef, void *data)
if (stmt_may_be_vtbl_ptr_store (stmt))
{
+ tree type;
+ type = extr_type_from_vtbl_ptr_store (stmt, tci);
+ if (tci->type_maybe_changed
+ && type != tci->known_current_type)
+ tci->multiple_types_encountered = true;
+ tci->known_current_type = type;
tci->type_maybe_changed = true;
return true;
}
@@ -359,16 +421,15 @@ check_stmt_for_type_change (ao_ref *ao ATTRIBUTE_UNUSED, tree vdef, void *data)
return false;
}
-/* Detect whether the dynamic type of ARG has changed (before callsite CALL) by
- looking for assignments to its virtual table pointer. If it is, return true
- and fill in the jump function JFUNC with relevant type information or set it
- to unknown. ARG is the object itself (not a pointer to it, unless
- dereferenced). BASE is the base of the memory access as returned by
- get_ref_base_and_extent, as is the offset. */
+
+
+/* Like detect_type_change but with extra argument COMP_TYPE which will become
+ the component type part of new JFUNC of dynamic type change is detected and
+ the new base type is identified. */
static bool
-detect_type_change (tree arg, tree base, gimple call,
- struct ipa_jump_func *jfunc, HOST_WIDE_INT offset)
+detect_type_change_1 (tree arg, tree base, tree comp_type, gimple call,
+ struct ipa_jump_func *jfunc, HOST_WIDE_INT offset)
{
struct type_change_info tci;
ao_ref ao;
@@ -381,8 +442,6 @@ detect_type_change (tree arg, tree base, gimple call,
if (!flag_devirtualize || !gimple_vuse (call))
return false;
- tci.type_maybe_changed = false;
-
ao.ref = arg;
ao.base = base;
ao.offset = offset;
@@ -391,15 +450,45 @@ detect_type_change (tree arg, tree base, gimple call,
ao.ref_alias_set = -1;
ao.base_alias_set = -1;
+ tci.offset = offset;
+ tci.object = get_base_address (arg);
+ tci.known_current_type = NULL_TREE;
+ tci.type_maybe_changed = false;
+ tci.multiple_types_encountered = false;
+
walk_aliased_vdefs (&ao, gimple_vuse (call), check_stmt_for_type_change,
&tci, NULL);
if (!tci.type_maybe_changed)
return false;
- jfunc->type = IPA_JF_UNKNOWN;
+ if (!tci.known_current_type
+ || tci.multiple_types_encountered
+ || offset != 0)
+ jfunc->type = IPA_JF_UNKNOWN;
+ else
+ {
+ jfunc->type = IPA_JF_KNOWN_TYPE;
+ jfunc->value.known_type.base_type = tci.known_current_type;
+ jfunc->value.known_type.component_type = comp_type;
+ }
+
return true;
}
+/* Detect whether the dynamic type of ARG has changed (before callsite CALL) by
+ looking for assignments to its virtual table pointer. If it is, return true
+ and fill in the jump function JFUNC with relevant type information or set it
+ to unknown. ARG is the object itself (not a pointer to it, unless
+ dereferenced). BASE is the base of the memory access as returned by
+ get_ref_base_and_extent, as is the offset. */
+
+static bool
+detect_type_change (tree arg, tree base, gimple call,
+ struct ipa_jump_func *jfunc, HOST_WIDE_INT offset)
+{
+ return detect_type_change_1 (arg, base, TREE_TYPE (arg), call, jfunc, offset);
+}
+
/* Like detect_type_change but ARG is supposed to be a non-dereferenced pointer
SSA name (its dereference will become the base and the offset is assumed to
be zero). */
@@ -407,16 +496,19 @@ detect_type_change (tree arg, tree base, gimple call,
static bool
detect_type_change_ssa (tree arg, gimple call, struct ipa_jump_func *jfunc)
{
+ tree comp_type;
+
gcc_checking_assert (TREE_CODE (arg) == SSA_NAME);
if (!flag_devirtualize
|| !POINTER_TYPE_P (TREE_TYPE (arg))
|| TREE_CODE (TREE_TYPE (TREE_TYPE (arg))) != RECORD_TYPE)
return false;
+ comp_type = TREE_TYPE (TREE_TYPE (arg));
arg = build2 (MEM_REF, ptr_type_node, arg,
- build_int_cst (ptr_type_node, 0));
+ build_int_cst (ptr_type_node, 0));
- return detect_type_change (arg, arg, call, jfunc, 0);
+ return detect_type_change_1 (arg, arg, comp_type, call, jfunc, 0);
}
/* Callback of walk_aliased_vdefs. Flags that it has been invoked to the
@@ -2476,8 +2568,11 @@ ipa_modify_call_arguments (struct cgraph_edge *cs, gimple stmt,
gimple_set_block (new_stmt, gimple_block (stmt));
if (gimple_has_location (stmt))
gimple_set_location (new_stmt, gimple_location (stmt));
- gimple_call_copy_flags (new_stmt, stmt);
gimple_call_set_chain (new_stmt, gimple_call_chain (stmt));
+ gimple_call_copy_flags (new_stmt, stmt);
+ if (gimple_call_cannot_inline_p (stmt))
+ gimple_call_set_cannot_inline
+ (new_stmt, !gimple_check_call_matching_types (new_stmt, callee_decl));
if (dump_file && (dump_flags & TDF_DETAILS))
{
diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog
index ac83a40c50b..715d1f5885c 100644
--- a/gcc/java/ChangeLog
+++ b/gcc/java/ChangeLog
@@ -1,3 +1,7 @@
+2011-11-02 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
+
+ * Make-lang.in (jvspec.o): Pass SHLIB instead of SHLIB_LINK.
+
2011-10-15 Tom Tromey <tromey@redhat.com>
Dodji Seketeli <dodji@redhat.com>
diff --git a/gcc/java/Make-lang.in b/gcc/java/Make-lang.in
index 1d9fd2b2988..4d6b63b3708 100644
--- a/gcc/java/Make-lang.in
+++ b/gcc/java/Make-lang.in
@@ -58,7 +58,7 @@ JAVA_TARGET_INDEPENDENT_BIN_TOOLS = jcf-dump
jvspec.o: $(srcdir)/java/jvspec.c $(SYSTEM_H) coretypes.h $(TM_H) \
$(GCC_H) $(CONFIG_H) java/jcf.h java/javaop.h $(OPTS_H)
- (SHLIB_LINK='$(SHLIB_LINK)'; \
+ (SHLIB='$(SHLIB)'; \
$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(DRIVER_DEFINES) \
$(INCLUDES) $(srcdir)/java/jvspec.c $(OUTPUT_OPTION))
diff --git a/gcc/libgcc-libsystem.ver b/gcc/libgcc-libsystem.ver
deleted file mode 100644
index 47631749dc2..00000000000
--- a/gcc/libgcc-libsystem.ver
+++ /dev/null
@@ -1 +0,0 @@
-_darwin10_Unwind_FindEnclosingFunction
diff --git a/gcc/libgcc2.c b/gcc/libgcc2.c
deleted file mode 100644
index 57c40c5800f..00000000000
--- a/gcc/libgcc2.c
+++ /dev/null
@@ -1,2252 +0,0 @@
-/* More subroutines needed by GCC output code on some machines. */
-/* Compile this one with gcc. */
-/* Copyright (C) 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010, 2011
- 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/>. */
-
-#include "tconfig.h"
-#include "tsystem.h"
-#include "coretypes.h"
-#include "tm.h"
-
-#ifdef HAVE_GAS_HIDDEN
-#define ATTRIBUTE_HIDDEN __attribute__ ((__visibility__ ("hidden")))
-#else
-#define ATTRIBUTE_HIDDEN
-#endif
-
-/* Work out the largest "word" size that we can deal with on this target. */
-#if MIN_UNITS_PER_WORD > 4
-# define LIBGCC2_MAX_UNITS_PER_WORD 8
-#elif (MIN_UNITS_PER_WORD > 2 \
- || (MIN_UNITS_PER_WORD > 1 && __SIZEOF_LONG_LONG__ > 4))
-# define LIBGCC2_MAX_UNITS_PER_WORD 4
-#else
-# define LIBGCC2_MAX_UNITS_PER_WORD MIN_UNITS_PER_WORD
-#endif
-
-/* Work out what word size we are using for this compilation.
- The value can be set on the command line. */
-#ifndef LIBGCC2_UNITS_PER_WORD
-#define LIBGCC2_UNITS_PER_WORD LIBGCC2_MAX_UNITS_PER_WORD
-#endif
-
-#if LIBGCC2_UNITS_PER_WORD <= LIBGCC2_MAX_UNITS_PER_WORD
-
-#include "libgcc2.h"
-
-#ifdef DECLARE_LIBRARY_RENAMES
- DECLARE_LIBRARY_RENAMES
-#endif
-
-#if defined (L_negdi2)
-DWtype
-__negdi2 (DWtype u)
-{
- const DWunion uu = {.ll = u};
- const DWunion w = { {.low = -uu.s.low,
- .high = -uu.s.high - ((UWtype) -uu.s.low > 0) } };
-
- return w.ll;
-}
-#endif
-
-#ifdef L_addvsi3
-Wtype
-__addvSI3 (Wtype a, Wtype b)
-{
- const Wtype w = (UWtype) a + (UWtype) b;
-
- if (b >= 0 ? w < a : w > a)
- abort ();
-
- return w;
-}
-#ifdef COMPAT_SIMODE_TRAPPING_ARITHMETIC
-SItype
-__addvsi3 (SItype a, SItype b)
-{
- const SItype w = (USItype) a + (USItype) b;
-
- if (b >= 0 ? w < a : w > a)
- abort ();
-
- return w;
-}
-#endif /* COMPAT_SIMODE_TRAPPING_ARITHMETIC */
-#endif
-
-#ifdef L_addvdi3
-DWtype
-__addvDI3 (DWtype a, DWtype b)
-{
- const DWtype w = (UDWtype) a + (UDWtype) b;
-
- if (b >= 0 ? w < a : w > a)
- abort ();
-
- return w;
-}
-#endif
-
-#ifdef L_subvsi3
-Wtype
-__subvSI3 (Wtype a, Wtype b)
-{
- const Wtype w = (UWtype) a - (UWtype) b;
-
- if (b >= 0 ? w > a : w < a)
- abort ();
-
- return w;
-}
-#ifdef COMPAT_SIMODE_TRAPPING_ARITHMETIC
-SItype
-__subvsi3 (SItype a, SItype b)
-{
- const SItype w = (USItype) a - (USItype) b;
-
- if (b >= 0 ? w > a : w < a)
- abort ();
-
- return w;
-}
-#endif /* COMPAT_SIMODE_TRAPPING_ARITHMETIC */
-#endif
-
-#ifdef L_subvdi3
-DWtype
-__subvDI3 (DWtype a, DWtype b)
-{
- const DWtype w = (UDWtype) a - (UDWtype) b;
-
- if (b >= 0 ? w > a : w < a)
- abort ();
-
- return w;
-}
-#endif
-
-#ifdef L_mulvsi3
-Wtype
-__mulvSI3 (Wtype a, Wtype b)
-{
- const DWtype w = (DWtype) a * (DWtype) b;
-
- if ((Wtype) (w >> W_TYPE_SIZE) != (Wtype) w >> (W_TYPE_SIZE - 1))
- abort ();
-
- return w;
-}
-#ifdef COMPAT_SIMODE_TRAPPING_ARITHMETIC
-#undef WORD_SIZE
-#define WORD_SIZE (sizeof (SItype) * BITS_PER_UNIT)
-SItype
-__mulvsi3 (SItype a, SItype b)
-{
- const DItype w = (DItype) a * (DItype) b;
-
- if ((SItype) (w >> WORD_SIZE) != (SItype) w >> (WORD_SIZE-1))
- abort ();
-
- return w;
-}
-#endif /* COMPAT_SIMODE_TRAPPING_ARITHMETIC */
-#endif
-
-#ifdef L_negvsi2
-Wtype
-__negvSI2 (Wtype a)
-{
- const Wtype w = -(UWtype) a;
-
- if (a >= 0 ? w > 0 : w < 0)
- abort ();
-
- return w;
-}
-#ifdef COMPAT_SIMODE_TRAPPING_ARITHMETIC
-SItype
-__negvsi2 (SItype a)
-{
- const SItype w = -(USItype) a;
-
- if (a >= 0 ? w > 0 : w < 0)
- abort ();
-
- return w;
-}
-#endif /* COMPAT_SIMODE_TRAPPING_ARITHMETIC */
-#endif
-
-#ifdef L_negvdi2
-DWtype
-__negvDI2 (DWtype a)
-{
- const DWtype w = -(UDWtype) a;
-
- if (a >= 0 ? w > 0 : w < 0)
- abort ();
-
- return w;
-}
-#endif
-
-#ifdef L_absvsi2
-Wtype
-__absvSI2 (Wtype a)
-{
- Wtype w = a;
-
- if (a < 0)
-#ifdef L_negvsi2
- w = __negvSI2 (a);
-#else
- w = -(UWtype) a;
-
- if (w < 0)
- abort ();
-#endif
-
- return w;
-}
-#ifdef COMPAT_SIMODE_TRAPPING_ARITHMETIC
-SItype
-__absvsi2 (SItype a)
-{
- SItype w = a;
-
- if (a < 0)
-#ifdef L_negvsi2
- w = __negvsi2 (a);
-#else
- w = -(USItype) a;
-
- if (w < 0)
- abort ();
-#endif
-
- return w;
-}
-#endif /* COMPAT_SIMODE_TRAPPING_ARITHMETIC */
-#endif
-
-#ifdef L_absvdi2
-DWtype
-__absvDI2 (DWtype a)
-{
- DWtype w = a;
-
- if (a < 0)
-#ifdef L_negvdi2
- w = __negvDI2 (a);
-#else
- w = -(UDWtype) a;
-
- if (w < 0)
- abort ();
-#endif
-
- return w;
-}
-#endif
-
-#ifdef L_mulvdi3
-DWtype
-__mulvDI3 (DWtype u, DWtype v)
-{
- /* The unchecked multiplication needs 3 Wtype x Wtype multiplications,
- but the checked multiplication needs only two. */
- const DWunion uu = {.ll = u};
- const DWunion vv = {.ll = v};
-
- if (__builtin_expect (uu.s.high == uu.s.low >> (W_TYPE_SIZE - 1), 1))
- {
- /* u fits in a single Wtype. */
- if (__builtin_expect (vv.s.high == vv.s.low >> (W_TYPE_SIZE - 1), 1))
- {
- /* v fits in a single Wtype as well. */
- /* A single multiplication. No overflow risk. */
- return (DWtype) uu.s.low * (DWtype) vv.s.low;
- }
- else
- {
- /* Two multiplications. */
- DWunion w0 = {.ll = (UDWtype) (UWtype) uu.s.low
- * (UDWtype) (UWtype) vv.s.low};
- DWunion w1 = {.ll = (UDWtype) (UWtype) uu.s.low
- * (UDWtype) (UWtype) vv.s.high};
-
- if (vv.s.high < 0)
- w1.s.high -= uu.s.low;
- if (uu.s.low < 0)
- w1.ll -= vv.ll;
- w1.ll += (UWtype) w0.s.high;
- if (__builtin_expect (w1.s.high == w1.s.low >> (W_TYPE_SIZE - 1), 1))
- {
- w0.s.high = w1.s.low;
- return w0.ll;
- }
- }
- }
- else
- {
- if (__builtin_expect (vv.s.high == vv.s.low >> (W_TYPE_SIZE - 1), 1))
- {
- /* v fits into a single Wtype. */
- /* Two multiplications. */
- DWunion w0 = {.ll = (UDWtype) (UWtype) uu.s.low
- * (UDWtype) (UWtype) vv.s.low};
- DWunion w1 = {.ll = (UDWtype) (UWtype) uu.s.high
- * (UDWtype) (UWtype) vv.s.low};
-
- if (uu.s.high < 0)
- w1.s.high -= vv.s.low;
- if (vv.s.low < 0)
- w1.ll -= uu.ll;
- w1.ll += (UWtype) w0.s.high;
- if (__builtin_expect (w1.s.high == w1.s.low >> (W_TYPE_SIZE - 1), 1))
- {
- w0.s.high = w1.s.low;
- return w0.ll;
- }
- }
- else
- {
- /* A few sign checks and a single multiplication. */
- if (uu.s.high >= 0)
- {
- if (vv.s.high >= 0)
- {
- if (uu.s.high == 0 && vv.s.high == 0)
- {
- const DWtype w = (UDWtype) (UWtype) uu.s.low
- * (UDWtype) (UWtype) vv.s.low;
- if (__builtin_expect (w >= 0, 1))
- return w;
- }
- }
- else
- {
- if (uu.s.high == 0 && vv.s.high == (Wtype) -1)
- {
- DWunion ww = {.ll = (UDWtype) (UWtype) uu.s.low
- * (UDWtype) (UWtype) vv.s.low};
-
- ww.s.high -= uu.s.low;
- if (__builtin_expect (ww.s.high < 0, 1))
- return ww.ll;
- }
- }
- }
- else
- {
- if (vv.s.high >= 0)
- {
- if (uu.s.high == (Wtype) -1 && vv.s.high == 0)
- {
- DWunion ww = {.ll = (UDWtype) (UWtype) uu.s.low
- * (UDWtype) (UWtype) vv.s.low};
-
- ww.s.high -= vv.s.low;
- if (__builtin_expect (ww.s.high < 0, 1))
- return ww.ll;
- }
- }
- else
- {
- if (uu.s.high == (Wtype) -1 && vv.s.high == (Wtype) - 1)
- {
- DWunion ww = {.ll = (UDWtype) (UWtype) uu.s.low
- * (UDWtype) (UWtype) vv.s.low};
-
- ww.s.high -= uu.s.low;
- ww.s.high -= vv.s.low;
- if (__builtin_expect (ww.s.high >= 0, 1))
- return ww.ll;
- }
- }
- }
- }
- }
-
- /* Overflow. */
- abort ();
-}
-#endif
-
-
-/* Unless shift functions are defined with full ANSI prototypes,
- parameter b will be promoted to int if shift_count_type is smaller than an int. */
-#ifdef L_lshrdi3
-DWtype
-__lshrdi3 (DWtype u, shift_count_type b)
-{
- if (b == 0)
- return u;
-
- const DWunion uu = {.ll = u};
- const shift_count_type bm = W_TYPE_SIZE - b;
- DWunion w;
-
- if (bm <= 0)
- {
- w.s.high = 0;
- w.s.low = (UWtype) uu.s.high >> -bm;
- }
- else
- {
- const UWtype carries = (UWtype) uu.s.high << bm;
-
- w.s.high = (UWtype) uu.s.high >> b;
- w.s.low = ((UWtype) uu.s.low >> b) | carries;
- }
-
- return w.ll;
-}
-#endif
-
-#ifdef L_ashldi3
-DWtype
-__ashldi3 (DWtype u, shift_count_type b)
-{
- if (b == 0)
- return u;
-
- const DWunion uu = {.ll = u};
- const shift_count_type bm = W_TYPE_SIZE - b;
- DWunion w;
-
- if (bm <= 0)
- {
- w.s.low = 0;
- w.s.high = (UWtype) uu.s.low << -bm;
- }
- else
- {
- const UWtype carries = (UWtype) uu.s.low >> bm;
-
- w.s.low = (UWtype) uu.s.low << b;
- w.s.high = ((UWtype) uu.s.high << b) | carries;
- }
-
- return w.ll;
-}
-#endif
-
-#ifdef L_ashrdi3
-DWtype
-__ashrdi3 (DWtype u, shift_count_type b)
-{
- if (b == 0)
- return u;
-
- const DWunion uu = {.ll = u};
- const shift_count_type bm = W_TYPE_SIZE - b;
- DWunion w;
-
- if (bm <= 0)
- {
- /* w.s.high = 1..1 or 0..0 */
- w.s.high = uu.s.high >> (W_TYPE_SIZE - 1);
- w.s.low = uu.s.high >> -bm;
- }
- else
- {
- const UWtype carries = (UWtype) uu.s.high << bm;
-
- w.s.high = uu.s.high >> b;
- w.s.low = ((UWtype) uu.s.low >> b) | carries;
- }
-
- return w.ll;
-}
-#endif
-
-#ifdef L_bswapsi2
-SItype
-__bswapsi2 (SItype u)
-{
- return ((((u) & 0xff000000) >> 24)
- | (((u) & 0x00ff0000) >> 8)
- | (((u) & 0x0000ff00) << 8)
- | (((u) & 0x000000ff) << 24));
-}
-#endif
-#ifdef L_bswapdi2
-DItype
-__bswapdi2 (DItype u)
-{
- return ((((u) & 0xff00000000000000ull) >> 56)
- | (((u) & 0x00ff000000000000ull) >> 40)
- | (((u) & 0x0000ff0000000000ull) >> 24)
- | (((u) & 0x000000ff00000000ull) >> 8)
- | (((u) & 0x00000000ff000000ull) << 8)
- | (((u) & 0x0000000000ff0000ull) << 24)
- | (((u) & 0x000000000000ff00ull) << 40)
- | (((u) & 0x00000000000000ffull) << 56));
-}
-#endif
-#ifdef L_ffssi2
-#undef int
-int
-__ffsSI2 (UWtype u)
-{
- UWtype count;
-
- if (u == 0)
- return 0;
-
- count_trailing_zeros (count, u);
- return count + 1;
-}
-#endif
-
-#ifdef L_ffsdi2
-#undef int
-int
-__ffsDI2 (DWtype u)
-{
- const DWunion uu = {.ll = u};
- UWtype word, count, add;
-
- if (uu.s.low != 0)
- word = uu.s.low, add = 0;
- else if (uu.s.high != 0)
- word = uu.s.high, add = W_TYPE_SIZE;
- else
- return 0;
-
- count_trailing_zeros (count, word);
- return count + add + 1;
-}
-#endif
-
-#ifdef L_muldi3
-DWtype
-__muldi3 (DWtype u, DWtype v)
-{
- const DWunion uu = {.ll = u};
- const DWunion vv = {.ll = v};
- DWunion w = {.ll = __umulsidi3 (uu.s.low, vv.s.low)};
-
- w.s.high += ((UWtype) uu.s.low * (UWtype) vv.s.high
- + (UWtype) uu.s.high * (UWtype) vv.s.low);
-
- return w.ll;
-}
-#endif
-
-#if (defined (L_udivdi3) || defined (L_divdi3) || \
- defined (L_umoddi3) || defined (L_moddi3))
-#if defined (sdiv_qrnnd)
-#define L_udiv_w_sdiv
-#endif
-#endif
-
-#ifdef L_udiv_w_sdiv
-#if defined (sdiv_qrnnd)
-#if (defined (L_udivdi3) || defined (L_divdi3) || \
- defined (L_umoddi3) || defined (L_moddi3))
-static inline __attribute__ ((__always_inline__))
-#endif
-UWtype
-__udiv_w_sdiv (UWtype *rp, UWtype a1, UWtype a0, UWtype d)
-{
- UWtype q, r;
- UWtype c0, c1, b1;
-
- if ((Wtype) d >= 0)
- {
- if (a1 < d - a1 - (a0 >> (W_TYPE_SIZE - 1)))
- {
- /* Dividend, divisor, and quotient are nonnegative. */
- sdiv_qrnnd (q, r, a1, a0, d);
- }
- else
- {
- /* Compute c1*2^32 + c0 = a1*2^32 + a0 - 2^31*d. */
- sub_ddmmss (c1, c0, a1, a0, d >> 1, d << (W_TYPE_SIZE - 1));
- /* Divide (c1*2^32 + c0) by d. */
- sdiv_qrnnd (q, r, c1, c0, d);
- /* Add 2^31 to quotient. */
- q += (UWtype) 1 << (W_TYPE_SIZE - 1);
- }
- }
- else
- {
- b1 = d >> 1; /* d/2, between 2^30 and 2^31 - 1 */
- c1 = a1 >> 1; /* A/2 */
- c0 = (a1 << (W_TYPE_SIZE - 1)) + (a0 >> 1);
-
- if (a1 < b1) /* A < 2^32*b1, so A/2 < 2^31*b1 */
- {
- sdiv_qrnnd (q, r, c1, c0, b1); /* (A/2) / (d/2) */
-
- r = 2*r + (a0 & 1); /* Remainder from A/(2*b1) */
- if ((d & 1) != 0)
- {
- if (r >= q)
- r = r - q;
- else if (q - r <= d)
- {
- r = r - q + d;
- q--;
- }
- else
- {
- r = r - q + 2*d;
- q -= 2;
- }
- }
- }
- else if (c1 < b1) /* So 2^31 <= (A/2)/b1 < 2^32 */
- {
- c1 = (b1 - 1) - c1;
- c0 = ~c0; /* logical NOT */
-
- sdiv_qrnnd (q, r, c1, c0, b1); /* (A/2) / (d/2) */
-
- q = ~q; /* (A/2)/b1 */
- r = (b1 - 1) - r;
-
- r = 2*r + (a0 & 1); /* A/(2*b1) */
-
- if ((d & 1) != 0)
- {
- if (r >= q)
- r = r - q;
- else if (q - r <= d)
- {
- r = r - q + d;
- q--;
- }
- else
- {
- r = r - q + 2*d;
- q -= 2;
- }
- }
- }
- else /* Implies c1 = b1 */
- { /* Hence a1 = d - 1 = 2*b1 - 1 */
- if (a0 >= -d)
- {
- q = -1;
- r = a0 + d;
- }
- else
- {
- q = -2;
- r = a0 + 2*d;
- }
- }
- }
-
- *rp = r;
- return q;
-}
-#else
-/* If sdiv_qrnnd doesn't exist, define dummy __udiv_w_sdiv. */
-UWtype
-__udiv_w_sdiv (UWtype *rp __attribute__ ((__unused__)),
- UWtype a1 __attribute__ ((__unused__)),
- UWtype a0 __attribute__ ((__unused__)),
- UWtype d __attribute__ ((__unused__)))
-{
- return 0;
-}
-#endif
-#endif
-
-#if (defined (L_udivdi3) || defined (L_divdi3) || \
- defined (L_umoddi3) || defined (L_moddi3))
-#define L_udivmoddi4
-#endif
-
-#ifdef L_clz
-const UQItype __clz_tab[256] =
-{
- 0,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
- 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
- 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
- 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
- 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8
-};
-#endif
-
-#ifdef L_clzsi2
-#undef int
-int
-__clzSI2 (UWtype x)
-{
- Wtype ret;
-
- count_leading_zeros (ret, x);
-
- return ret;
-}
-#endif
-
-#ifdef L_clzdi2
-#undef int
-int
-__clzDI2 (UDWtype x)
-{
- const DWunion uu = {.ll = x};
- UWtype word;
- Wtype ret, add;
-
- if (uu.s.high)
- word = uu.s.high, add = 0;
- else
- word = uu.s.low, add = W_TYPE_SIZE;
-
- count_leading_zeros (ret, word);
- return ret + add;
-}
-#endif
-
-#ifdef L_ctzsi2
-#undef int
-int
-__ctzSI2 (UWtype x)
-{
- Wtype ret;
-
- count_trailing_zeros (ret, x);
-
- return ret;
-}
-#endif
-
-#ifdef L_ctzdi2
-#undef int
-int
-__ctzDI2 (UDWtype x)
-{
- const DWunion uu = {.ll = x};
- UWtype word;
- Wtype ret, add;
-
- if (uu.s.low)
- word = uu.s.low, add = 0;
- else
- word = uu.s.high, add = W_TYPE_SIZE;
-
- count_trailing_zeros (ret, word);
- return ret + add;
-}
-#endif
-
-#ifdef L_clrsbsi2
-#undef int
-int
-__clrsbSI2 (Wtype x)
-{
- Wtype ret;
-
- if (x < 0)
- x = ~x;
- if (x == 0)
- return W_TYPE_SIZE - 1;
- count_leading_zeros (ret, x);
- return ret - 1;
-}
-#endif
-
-#ifdef L_clrsbdi2
-#undef int
-int
-__clrsbDI2 (DWtype x)
-{
- const DWunion uu = {.ll = x};
- UWtype word;
- Wtype ret, add;
-
- if (uu.s.high == 0)
- word = uu.s.low, add = W_TYPE_SIZE;
- else if (uu.s.high == -1)
- word = ~uu.s.low, add = W_TYPE_SIZE;
- else if (uu.s.high >= 0)
- word = uu.s.high, add = 0;
- else
- word = ~uu.s.high, add = 0;
-
- if (word == 0)
- ret = W_TYPE_SIZE;
- else
- count_leading_zeros (ret, word);
-
- return ret + add - 1;
-}
-#endif
-
-#ifdef L_popcount_tab
-const UQItype __popcount_tab[256] =
-{
- 0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4,1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,
- 1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,
- 1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,
- 2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,
- 1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,
- 2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,
- 2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,
- 3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,4,5,5,6,5,6,6,7,5,6,6,7,6,7,7,8
-};
-#endif
-
-#ifdef L_popcountsi2
-#undef int
-int
-__popcountSI2 (UWtype x)
-{
- int i, ret = 0;
-
- for (i = 0; i < W_TYPE_SIZE; i += 8)
- ret += __popcount_tab[(x >> i) & 0xff];
-
- return ret;
-}
-#endif
-
-#ifdef L_popcountdi2
-#undef int
-int
-__popcountDI2 (UDWtype x)
-{
- int i, ret = 0;
-
- for (i = 0; i < 2*W_TYPE_SIZE; i += 8)
- ret += __popcount_tab[(x >> i) & 0xff];
-
- return ret;
-}
-#endif
-
-#ifdef L_paritysi2
-#undef int
-int
-__paritySI2 (UWtype x)
-{
-#if W_TYPE_SIZE > 64
-# error "fill out the table"
-#endif
-#if W_TYPE_SIZE > 32
- x ^= x >> 32;
-#endif
-#if W_TYPE_SIZE > 16
- x ^= x >> 16;
-#endif
- x ^= x >> 8;
- x ^= x >> 4;
- x &= 0xf;
- return (0x6996 >> x) & 1;
-}
-#endif
-
-#ifdef L_paritydi2
-#undef int
-int
-__parityDI2 (UDWtype x)
-{
- const DWunion uu = {.ll = x};
- UWtype nx = uu.s.low ^ uu.s.high;
-
-#if W_TYPE_SIZE > 64
-# error "fill out the table"
-#endif
-#if W_TYPE_SIZE > 32
- nx ^= nx >> 32;
-#endif
-#if W_TYPE_SIZE > 16
- nx ^= nx >> 16;
-#endif
- nx ^= nx >> 8;
- nx ^= nx >> 4;
- nx &= 0xf;
- return (0x6996 >> nx) & 1;
-}
-#endif
-
-#ifdef L_udivmoddi4
-
-#if (defined (L_udivdi3) || defined (L_divdi3) || \
- defined (L_umoddi3) || defined (L_moddi3))
-static inline __attribute__ ((__always_inline__))
-#endif
-UDWtype
-__udivmoddi4 (UDWtype n, UDWtype d, UDWtype *rp)
-{
- const DWunion nn = {.ll = n};
- const DWunion dd = {.ll = d};
- DWunion rr;
- UWtype d0, d1, n0, n1, n2;
- UWtype q0, q1;
- UWtype b, bm;
-
- d0 = dd.s.low;
- d1 = dd.s.high;
- n0 = nn.s.low;
- n1 = nn.s.high;
-
-#if !UDIV_NEEDS_NORMALIZATION
- if (d1 == 0)
- {
- if (d0 > n1)
- {
- /* 0q = nn / 0D */
-
- udiv_qrnnd (q0, n0, n1, n0, d0);
- q1 = 0;
-
- /* Remainder in n0. */
- }
- else
- {
- /* qq = NN / 0d */
-
- if (d0 == 0)
- d0 = 1 / d0; /* Divide intentionally by zero. */
-
- udiv_qrnnd (q1, n1, 0, n1, d0);
- udiv_qrnnd (q0, n0, n1, n0, d0);
-
- /* Remainder in n0. */
- }
-
- if (rp != 0)
- {
- rr.s.low = n0;
- rr.s.high = 0;
- *rp = rr.ll;
- }
- }
-
-#else /* UDIV_NEEDS_NORMALIZATION */
-
- if (d1 == 0)
- {
- if (d0 > n1)
- {
- /* 0q = nn / 0D */
-
- count_leading_zeros (bm, d0);
-
- if (bm != 0)
- {
- /* Normalize, i.e. make the most significant bit of the
- denominator set. */
-
- d0 = d0 << bm;
- n1 = (n1 << bm) | (n0 >> (W_TYPE_SIZE - bm));
- n0 = n0 << bm;
- }
-
- udiv_qrnnd (q0, n0, n1, n0, d0);
- q1 = 0;
-
- /* Remainder in n0 >> bm. */
- }
- else
- {
- /* qq = NN / 0d */
-
- if (d0 == 0)
- d0 = 1 / d0; /* Divide intentionally by zero. */
-
- count_leading_zeros (bm, d0);
-
- if (bm == 0)
- {
- /* From (n1 >= d0) /\ (the most significant bit of d0 is set),
- conclude (the most significant bit of n1 is set) /\ (the
- leading quotient digit q1 = 1).
-
- This special case is necessary, not an optimization.
- (Shifts counts of W_TYPE_SIZE are undefined.) */
-
- n1 -= d0;
- q1 = 1;
- }
- else
- {
- /* Normalize. */
-
- b = W_TYPE_SIZE - bm;
-
- d0 = d0 << bm;
- n2 = n1 >> b;
- n1 = (n1 << bm) | (n0 >> b);
- n0 = n0 << bm;
-
- udiv_qrnnd (q1, n1, n2, n1, d0);
- }
-
- /* n1 != d0... */
-
- udiv_qrnnd (q0, n0, n1, n0, d0);
-
- /* Remainder in n0 >> bm. */
- }
-
- if (rp != 0)
- {
- rr.s.low = n0 >> bm;
- rr.s.high = 0;
- *rp = rr.ll;
- }
- }
-#endif /* UDIV_NEEDS_NORMALIZATION */
-
- else
- {
- if (d1 > n1)
- {
- /* 00 = nn / DD */
-
- q0 = 0;
- q1 = 0;
-
- /* Remainder in n1n0. */
- if (rp != 0)
- {
- rr.s.low = n0;
- rr.s.high = n1;
- *rp = rr.ll;
- }
- }
- else
- {
- /* 0q = NN / dd */
-
- count_leading_zeros (bm, d1);
- if (bm == 0)
- {
- /* From (n1 >= d1) /\ (the most significant bit of d1 is set),
- conclude (the most significant bit of n1 is set) /\ (the
- quotient digit q0 = 0 or 1).
-
- This special case is necessary, not an optimization. */
-
- /* The condition on the next line takes advantage of that
- n1 >= d1 (true due to program flow). */
- if (n1 > d1 || n0 >= d0)
- {
- q0 = 1;
- sub_ddmmss (n1, n0, n1, n0, d1, d0);
- }
- else
- q0 = 0;
-
- q1 = 0;
-
- if (rp != 0)
- {
- rr.s.low = n0;
- rr.s.high = n1;
- *rp = rr.ll;
- }
- }
- else
- {
- UWtype m1, m0;
- /* Normalize. */
-
- b = W_TYPE_SIZE - bm;
-
- d1 = (d1 << bm) | (d0 >> b);
- d0 = d0 << bm;
- n2 = n1 >> b;
- n1 = (n1 << bm) | (n0 >> b);
- n0 = n0 << bm;
-
- udiv_qrnnd (q0, n1, n2, n1, d1);
- umul_ppmm (m1, m0, q0, d0);
-
- if (m1 > n1 || (m1 == n1 && m0 > n0))
- {
- q0--;
- sub_ddmmss (m1, m0, m1, m0, d1, d0);
- }
-
- q1 = 0;
-
- /* Remainder in (n1n0 - m1m0) >> bm. */
- if (rp != 0)
- {
- sub_ddmmss (n1, n0, n1, n0, m1, m0);
- rr.s.low = (n1 << b) | (n0 >> bm);
- rr.s.high = n1 >> bm;
- *rp = rr.ll;
- }
- }
- }
- }
-
- const DWunion ww = {{.low = q0, .high = q1}};
- return ww.ll;
-}
-#endif
-
-#ifdef L_divdi3
-DWtype
-__divdi3 (DWtype u, DWtype v)
-{
- Wtype c = 0;
- DWunion uu = {.ll = u};
- DWunion vv = {.ll = v};
- DWtype w;
-
- if (uu.s.high < 0)
- c = ~c,
- uu.ll = -uu.ll;
- if (vv.s.high < 0)
- c = ~c,
- vv.ll = -vv.ll;
-
- w = __udivmoddi4 (uu.ll, vv.ll, (UDWtype *) 0);
- if (c)
- w = -w;
-
- return w;
-}
-#endif
-
-#ifdef L_moddi3
-DWtype
-__moddi3 (DWtype u, DWtype v)
-{
- Wtype c = 0;
- DWunion uu = {.ll = u};
- DWunion vv = {.ll = v};
- DWtype w;
-
- if (uu.s.high < 0)
- c = ~c,
- uu.ll = -uu.ll;
- if (vv.s.high < 0)
- vv.ll = -vv.ll;
-
- (void) __udivmoddi4 (uu.ll, vv.ll, (UDWtype*)&w);
- if (c)
- w = -w;
-
- return w;
-}
-#endif
-
-#ifdef L_umoddi3
-UDWtype
-__umoddi3 (UDWtype u, UDWtype v)
-{
- UDWtype w;
-
- (void) __udivmoddi4 (u, v, &w);
-
- return w;
-}
-#endif
-
-#ifdef L_udivdi3
-UDWtype
-__udivdi3 (UDWtype n, UDWtype d)
-{
- return __udivmoddi4 (n, d, (UDWtype *) 0);
-}
-#endif
-
-#ifdef L_cmpdi2
-cmp_return_type
-__cmpdi2 (DWtype a, DWtype b)
-{
- const DWunion au = {.ll = a};
- const DWunion bu = {.ll = b};
-
- if (au.s.high < bu.s.high)
- return 0;
- else if (au.s.high > bu.s.high)
- return 2;
- if ((UWtype) au.s.low < (UWtype) bu.s.low)
- return 0;
- else if ((UWtype) au.s.low > (UWtype) bu.s.low)
- return 2;
- return 1;
-}
-#endif
-
-#ifdef L_ucmpdi2
-cmp_return_type
-__ucmpdi2 (DWtype a, DWtype b)
-{
- const DWunion au = {.ll = a};
- const DWunion bu = {.ll = b};
-
- if ((UWtype) au.s.high < (UWtype) bu.s.high)
- return 0;
- else if ((UWtype) au.s.high > (UWtype) bu.s.high)
- return 2;
- if ((UWtype) au.s.low < (UWtype) bu.s.low)
- return 0;
- else if ((UWtype) au.s.low > (UWtype) bu.s.low)
- return 2;
- return 1;
-}
-#endif
-
-#if defined(L_fixunstfdi) && LIBGCC2_HAS_TF_MODE
-UDWtype
-__fixunstfDI (TFtype a)
-{
- if (a < 0)
- return 0;
-
- /* Compute high word of result, as a flonum. */
- const TFtype b = (a / Wtype_MAXp1_F);
- /* Convert that to fixed (but not to DWtype!),
- and shift it into the high word. */
- UDWtype v = (UWtype) b;
- v <<= W_TYPE_SIZE;
- /* Remove high part from the TFtype, leaving the low part as flonum. */
- a -= (TFtype)v;
- /* Convert that to fixed (but not to DWtype!) and add it in.
- Sometimes A comes out negative. This is significant, since
- A has more bits than a long int does. */
- if (a < 0)
- v -= (UWtype) (- a);
- else
- v += (UWtype) a;
- return v;
-}
-#endif
-
-#if defined(L_fixtfdi) && LIBGCC2_HAS_TF_MODE
-DWtype
-__fixtfdi (TFtype a)
-{
- if (a < 0)
- return - __fixunstfDI (-a);
- return __fixunstfDI (a);
-}
-#endif
-
-#if defined(L_fixunsxfdi) && LIBGCC2_HAS_XF_MODE
-UDWtype
-__fixunsxfDI (XFtype a)
-{
- if (a < 0)
- return 0;
-
- /* Compute high word of result, as a flonum. */
- const XFtype b = (a / Wtype_MAXp1_F);
- /* Convert that to fixed (but not to DWtype!),
- and shift it into the high word. */
- UDWtype v = (UWtype) b;
- v <<= W_TYPE_SIZE;
- /* Remove high part from the XFtype, leaving the low part as flonum. */
- a -= (XFtype)v;
- /* Convert that to fixed (but not to DWtype!) and add it in.
- Sometimes A comes out negative. This is significant, since
- A has more bits than a long int does. */
- if (a < 0)
- v -= (UWtype) (- a);
- else
- v += (UWtype) a;
- return v;
-}
-#endif
-
-#if defined(L_fixxfdi) && LIBGCC2_HAS_XF_MODE
-DWtype
-__fixxfdi (XFtype a)
-{
- if (a < 0)
- return - __fixunsxfDI (-a);
- return __fixunsxfDI (a);
-}
-#endif
-
-#if defined(L_fixunsdfdi) && LIBGCC2_HAS_DF_MODE
-UDWtype
-__fixunsdfDI (DFtype a)
-{
- /* Get high part of result. The division here will just moves the radix
- point and will not cause any rounding. Then the conversion to integral
- type chops result as desired. */
- const UWtype hi = a / Wtype_MAXp1_F;
-
- /* Get low part of result. Convert `hi' to floating type and scale it back,
- then subtract this from the number being converted. This leaves the low
- part. Convert that to integral type. */
- const UWtype lo = a - (DFtype) hi * Wtype_MAXp1_F;
-
- /* Assemble result from the two parts. */
- return ((UDWtype) hi << W_TYPE_SIZE) | lo;
-}
-#endif
-
-#if defined(L_fixdfdi) && LIBGCC2_HAS_DF_MODE
-DWtype
-__fixdfdi (DFtype a)
-{
- if (a < 0)
- return - __fixunsdfDI (-a);
- return __fixunsdfDI (a);
-}
-#endif
-
-#if defined(L_fixunssfdi) && LIBGCC2_HAS_SF_MODE
-UDWtype
-__fixunssfDI (SFtype a)
-{
-#if LIBGCC2_HAS_DF_MODE
- /* Convert the SFtype to a DFtype, because that is surely not going
- to lose any bits. Some day someone else can write a faster version
- that avoids converting to DFtype, and verify it really works right. */
- const DFtype dfa = a;
-
- /* Get high part of result. The division here will just moves the radix
- point and will not cause any rounding. Then the conversion to integral
- type chops result as desired. */
- const UWtype hi = dfa / Wtype_MAXp1_F;
-
- /* Get low part of result. Convert `hi' to floating type and scale it back,
- then subtract this from the number being converted. This leaves the low
- part. Convert that to integral type. */
- const UWtype lo = dfa - (DFtype) hi * Wtype_MAXp1_F;
-
- /* Assemble result from the two parts. */
- return ((UDWtype) hi << W_TYPE_SIZE) | lo;
-#elif FLT_MANT_DIG < W_TYPE_SIZE
- if (a < 1)
- return 0;
- if (a < Wtype_MAXp1_F)
- return (UWtype)a;
- if (a < Wtype_MAXp1_F * Wtype_MAXp1_F)
- {
- /* Since we know that there are fewer significant bits in the SFmode
- quantity than in a word, we know that we can convert out all the
- significant bits in one step, and thus avoid losing bits. */
-
- /* ??? This following loop essentially performs frexpf. If we could
- use the real libm function, or poke at the actual bits of the fp
- format, it would be significantly faster. */
-
- UWtype shift = 0, counter;
- SFtype msb;
-
- a /= Wtype_MAXp1_F;
- for (counter = W_TYPE_SIZE / 2; counter != 0; counter >>= 1)
- {
- SFtype counterf = (UWtype)1 << counter;
- if (a >= counterf)
- {
- shift |= counter;
- a /= counterf;
- }
- }
-
- /* Rescale into the range of one word, extract the bits of that
- one word, and shift the result into position. */
- a *= Wtype_MAXp1_F;
- counter = a;
- return (DWtype)counter << shift;
- }
- return -1;
-#else
-# error
-#endif
-}
-#endif
-
-#if defined(L_fixsfdi) && LIBGCC2_HAS_SF_MODE
-DWtype
-__fixsfdi (SFtype a)
-{
- if (a < 0)
- return - __fixunssfDI (-a);
- return __fixunssfDI (a);
-}
-#endif
-
-#if defined(L_floatdixf) && LIBGCC2_HAS_XF_MODE
-XFtype
-__floatdixf (DWtype u)
-{
-#if W_TYPE_SIZE > XF_SIZE
-# error
-#endif
- XFtype d = (Wtype) (u >> W_TYPE_SIZE);
- d *= Wtype_MAXp1_F;
- d += (UWtype)u;
- return d;
-}
-#endif
-
-#if defined(L_floatundixf) && LIBGCC2_HAS_XF_MODE
-XFtype
-__floatundixf (UDWtype u)
-{
-#if W_TYPE_SIZE > XF_SIZE
-# error
-#endif
- XFtype d = (UWtype) (u >> W_TYPE_SIZE);
- d *= Wtype_MAXp1_F;
- d += (UWtype)u;
- return d;
-}
-#endif
-
-#if defined(L_floatditf) && LIBGCC2_HAS_TF_MODE
-TFtype
-__floatditf (DWtype u)
-{
-#if W_TYPE_SIZE > TF_SIZE
-# error
-#endif
- TFtype d = (Wtype) (u >> W_TYPE_SIZE);
- d *= Wtype_MAXp1_F;
- d += (UWtype)u;
- return d;
-}
-#endif
-
-#if defined(L_floatunditf) && LIBGCC2_HAS_TF_MODE
-TFtype
-__floatunditf (UDWtype u)
-{
-#if W_TYPE_SIZE > TF_SIZE
-# error
-#endif
- TFtype d = (UWtype) (u >> W_TYPE_SIZE);
- d *= Wtype_MAXp1_F;
- d += (UWtype)u;
- return d;
-}
-#endif
-
-#if (defined(L_floatdisf) && LIBGCC2_HAS_SF_MODE) \
- || (defined(L_floatdidf) && LIBGCC2_HAS_DF_MODE)
-#define DI_SIZE (W_TYPE_SIZE * 2)
-#define F_MODE_OK(SIZE) \
- (SIZE < DI_SIZE \
- && SIZE > (DI_SIZE - SIZE + FSSIZE) \
- && !AVOID_FP_TYPE_CONVERSION(SIZE))
-#if defined(L_floatdisf)
-#define FUNC __floatdisf
-#define FSTYPE SFtype
-#define FSSIZE SF_SIZE
-#else
-#define FUNC __floatdidf
-#define FSTYPE DFtype
-#define FSSIZE DF_SIZE
-#endif
-
-FSTYPE
-FUNC (DWtype u)
-{
-#if FSSIZE >= W_TYPE_SIZE
- /* When the word size is small, we never get any rounding error. */
- FSTYPE f = (Wtype) (u >> W_TYPE_SIZE);
- f *= Wtype_MAXp1_F;
- f += (UWtype)u;
- return f;
-#elif (LIBGCC2_HAS_DF_MODE && F_MODE_OK (DF_SIZE)) \
- || (LIBGCC2_HAS_XF_MODE && F_MODE_OK (XF_SIZE)) \
- || (LIBGCC2_HAS_TF_MODE && F_MODE_OK (TF_SIZE))
-
-#if (LIBGCC2_HAS_DF_MODE && F_MODE_OK (DF_SIZE))
-# define FSIZE DF_SIZE
-# define FTYPE DFtype
-#elif (LIBGCC2_HAS_XF_MODE && F_MODE_OK (XF_SIZE))
-# define FSIZE XF_SIZE
-# define FTYPE XFtype
-#elif (LIBGCC2_HAS_TF_MODE && F_MODE_OK (TF_SIZE))
-# define FSIZE TF_SIZE
-# define FTYPE TFtype
-#else
-# error
-#endif
-
-#define REP_BIT ((UDWtype) 1 << (DI_SIZE - FSIZE))
-
- /* Protect against double-rounding error.
- Represent any low-order bits, that might be truncated by a bit that
- won't be lost. The bit can go in anywhere below the rounding position
- of the FSTYPE. A fixed mask and bit position handles all usual
- configurations. */
- if (! (- ((DWtype) 1 << FSIZE) < u
- && u < ((DWtype) 1 << FSIZE)))
- {
- if ((UDWtype) u & (REP_BIT - 1))
- {
- u &= ~ (REP_BIT - 1);
- u |= REP_BIT;
- }
- }
-
- /* Do the calculation in a wider type so that we don't lose any of
- the precision of the high word while multiplying it. */
- FTYPE f = (Wtype) (u >> W_TYPE_SIZE);
- f *= Wtype_MAXp1_F;
- f += (UWtype)u;
- return (FSTYPE) f;
-#else
-#if FSSIZE >= W_TYPE_SIZE - 2
-# error
-#endif
- /* Finally, the word size is larger than the number of bits in the
- required FSTYPE, and we've got no suitable wider type. The only
- way to avoid double rounding is to special case the
- extraction. */
-
- /* If there are no high bits set, fall back to one conversion. */
- if ((Wtype)u == u)
- return (FSTYPE)(Wtype)u;
-
- /* Otherwise, find the power of two. */
- Wtype hi = u >> W_TYPE_SIZE;
- if (hi < 0)
- hi = -hi;
-
- UWtype count, shift;
- count_leading_zeros (count, hi);
-
- /* No leading bits means u == minimum. */
- if (count == 0)
- return -(Wtype_MAXp1_F * (Wtype_MAXp1_F / 2));
-
- shift = 1 + W_TYPE_SIZE - count;
-
- /* Shift down the most significant bits. */
- hi = u >> shift;
-
- /* If we lost any nonzero bits, set the lsb to ensure correct rounding. */
- if ((UWtype)u << (W_TYPE_SIZE - shift))
- hi |= 1;
-
- /* Convert the one word of data, and rescale. */
- FSTYPE f = hi, e;
- if (shift == W_TYPE_SIZE)
- e = Wtype_MAXp1_F;
- /* The following two cases could be merged if we knew that the target
- supported a native unsigned->float conversion. More often, we only
- have a signed conversion, and have to add extra fixup code. */
- else if (shift == W_TYPE_SIZE - 1)
- e = Wtype_MAXp1_F / 2;
- else
- e = (Wtype)1 << shift;
- return f * e;
-#endif
-}
-#endif
-
-#if (defined(L_floatundisf) && LIBGCC2_HAS_SF_MODE) \
- || (defined(L_floatundidf) && LIBGCC2_HAS_DF_MODE)
-#define DI_SIZE (W_TYPE_SIZE * 2)
-#define F_MODE_OK(SIZE) \
- (SIZE < DI_SIZE \
- && SIZE > (DI_SIZE - SIZE + FSSIZE) \
- && !AVOID_FP_TYPE_CONVERSION(SIZE))
-#if defined(L_floatundisf)
-#define FUNC __floatundisf
-#define FSTYPE SFtype
-#define FSSIZE SF_SIZE
-#else
-#define FUNC __floatundidf
-#define FSTYPE DFtype
-#define FSSIZE DF_SIZE
-#endif
-
-FSTYPE
-FUNC (UDWtype u)
-{
-#if FSSIZE >= W_TYPE_SIZE
- /* When the word size is small, we never get any rounding error. */
- FSTYPE f = (UWtype) (u >> W_TYPE_SIZE);
- f *= Wtype_MAXp1_F;
- f += (UWtype)u;
- return f;
-#elif (LIBGCC2_HAS_DF_MODE && F_MODE_OK (DF_SIZE)) \
- || (LIBGCC2_HAS_XF_MODE && F_MODE_OK (XF_SIZE)) \
- || (LIBGCC2_HAS_TF_MODE && F_MODE_OK (TF_SIZE))
-
-#if (LIBGCC2_HAS_DF_MODE && F_MODE_OK (DF_SIZE))
-# define FSIZE DF_SIZE
-# define FTYPE DFtype
-#elif (LIBGCC2_HAS_XF_MODE && F_MODE_OK (XF_SIZE))
-# define FSIZE XF_SIZE
-# define FTYPE XFtype
-#elif (LIBGCC2_HAS_TF_MODE && F_MODE_OK (TF_SIZE))
-# define FSIZE TF_SIZE
-# define FTYPE TFtype
-#else
-# error
-#endif
-
-#define REP_BIT ((UDWtype) 1 << (DI_SIZE - FSIZE))
-
- /* Protect against double-rounding error.
- Represent any low-order bits, that might be truncated by a bit that
- won't be lost. The bit can go in anywhere below the rounding position
- of the FSTYPE. A fixed mask and bit position handles all usual
- configurations. */
- if (u >= ((UDWtype) 1 << FSIZE))
- {
- if ((UDWtype) u & (REP_BIT - 1))
- {
- u &= ~ (REP_BIT - 1);
- u |= REP_BIT;
- }
- }
-
- /* Do the calculation in a wider type so that we don't lose any of
- the precision of the high word while multiplying it. */
- FTYPE f = (UWtype) (u >> W_TYPE_SIZE);
- f *= Wtype_MAXp1_F;
- f += (UWtype)u;
- return (FSTYPE) f;
-#else
-#if FSSIZE == W_TYPE_SIZE - 1
-# error
-#endif
- /* Finally, the word size is larger than the number of bits in the
- required FSTYPE, and we've got no suitable wider type. The only
- way to avoid double rounding is to special case the
- extraction. */
-
- /* If there are no high bits set, fall back to one conversion. */
- if ((UWtype)u == u)
- return (FSTYPE)(UWtype)u;
-
- /* Otherwise, find the power of two. */
- UWtype hi = u >> W_TYPE_SIZE;
-
- UWtype count, shift;
- count_leading_zeros (count, hi);
-
- shift = W_TYPE_SIZE - count;
-
- /* Shift down the most significant bits. */
- hi = u >> shift;
-
- /* If we lost any nonzero bits, set the lsb to ensure correct rounding. */
- if ((UWtype)u << (W_TYPE_SIZE - shift))
- hi |= 1;
-
- /* Convert the one word of data, and rescale. */
- FSTYPE f = hi, e;
- if (shift == W_TYPE_SIZE)
- e = Wtype_MAXp1_F;
- /* The following two cases could be merged if we knew that the target
- supported a native unsigned->float conversion. More often, we only
- have a signed conversion, and have to add extra fixup code. */
- else if (shift == W_TYPE_SIZE - 1)
- e = Wtype_MAXp1_F / 2;
- else
- e = (Wtype)1 << shift;
- return f * e;
-#endif
-}
-#endif
-
-#if defined(L_fixunsxfsi) && LIBGCC2_HAS_XF_MODE
-/* Reenable the normal types, in case limits.h needs them. */
-#undef char
-#undef short
-#undef int
-#undef long
-#undef unsigned
-#undef float
-#undef double
-#undef MIN
-#undef MAX
-#include <limits.h>
-
-UWtype
-__fixunsxfSI (XFtype a)
-{
- if (a >= - (DFtype) Wtype_MIN)
- return (Wtype) (a + Wtype_MIN) - Wtype_MIN;
- return (Wtype) a;
-}
-#endif
-
-#if defined(L_fixunsdfsi) && LIBGCC2_HAS_DF_MODE
-/* Reenable the normal types, in case limits.h needs them. */
-#undef char
-#undef short
-#undef int
-#undef long
-#undef unsigned
-#undef float
-#undef double
-#undef MIN
-#undef MAX
-#include <limits.h>
-
-UWtype
-__fixunsdfSI (DFtype a)
-{
- if (a >= - (DFtype) Wtype_MIN)
- return (Wtype) (a + Wtype_MIN) - Wtype_MIN;
- return (Wtype) a;
-}
-#endif
-
-#if defined(L_fixunssfsi) && LIBGCC2_HAS_SF_MODE
-/* Reenable the normal types, in case limits.h needs them. */
-#undef char
-#undef short
-#undef int
-#undef long
-#undef unsigned
-#undef float
-#undef double
-#undef MIN
-#undef MAX
-#include <limits.h>
-
-UWtype
-__fixunssfSI (SFtype a)
-{
- if (a >= - (SFtype) Wtype_MIN)
- return (Wtype) (a + Wtype_MIN) - Wtype_MIN;
- return (Wtype) a;
-}
-#endif
-
-/* Integer power helper used from __builtin_powi for non-constant
- exponents. */
-
-#if (defined(L_powisf2) && LIBGCC2_HAS_SF_MODE) \
- || (defined(L_powidf2) && LIBGCC2_HAS_DF_MODE) \
- || (defined(L_powixf2) && LIBGCC2_HAS_XF_MODE) \
- || (defined(L_powitf2) && LIBGCC2_HAS_TF_MODE)
-# if defined(L_powisf2)
-# define TYPE SFtype
-# define NAME __powisf2
-# elif defined(L_powidf2)
-# define TYPE DFtype
-# define NAME __powidf2
-# elif defined(L_powixf2)
-# define TYPE XFtype
-# define NAME __powixf2
-# elif defined(L_powitf2)
-# define TYPE TFtype
-# define NAME __powitf2
-# endif
-
-#undef int
-#undef unsigned
-TYPE
-NAME (TYPE x, int m)
-{
- unsigned int n = m < 0 ? -m : m;
- TYPE y = n % 2 ? x : 1;
- while (n >>= 1)
- {
- x = x * x;
- if (n % 2)
- y = y * x;
- }
- return m < 0 ? 1/y : y;
-}
-
-#endif
-
-#if ((defined(L_mulsc3) || defined(L_divsc3)) && LIBGCC2_HAS_SF_MODE) \
- || ((defined(L_muldc3) || defined(L_divdc3)) && LIBGCC2_HAS_DF_MODE) \
- || ((defined(L_mulxc3) || defined(L_divxc3)) && LIBGCC2_HAS_XF_MODE) \
- || ((defined(L_multc3) || defined(L_divtc3)) && LIBGCC2_HAS_TF_MODE)
-
-#undef float
-#undef double
-#undef long
-
-#if defined(L_mulsc3) || defined(L_divsc3)
-# define MTYPE SFtype
-# define CTYPE SCtype
-# define MODE sc
-# define CEXT f
-# define NOTRUNC __FLT_EVAL_METHOD__ == 0
-#elif defined(L_muldc3) || defined(L_divdc3)
-# define MTYPE DFtype
-# define CTYPE DCtype
-# define MODE dc
-# if LIBGCC2_LONG_DOUBLE_TYPE_SIZE == 64
-# define CEXT l
-# define NOTRUNC 1
-# else
-# define CEXT
-# define NOTRUNC __FLT_EVAL_METHOD__ == 0 || __FLT_EVAL_METHOD__ == 1
-# endif
-#elif defined(L_mulxc3) || defined(L_divxc3)
-# define MTYPE XFtype
-# define CTYPE XCtype
-# define MODE xc
-# define CEXT l
-# define NOTRUNC 1
-#elif defined(L_multc3) || defined(L_divtc3)
-# define MTYPE TFtype
-# define CTYPE TCtype
-# define MODE tc
-# if LIBGCC2_LONG_DOUBLE_TYPE_SIZE == 128
-# define CEXT l
-# else
-# define CEXT LIBGCC2_TF_CEXT
-# endif
-# define NOTRUNC 1
-#else
-# error
-#endif
-
-#define CONCAT3(A,B,C) _CONCAT3(A,B,C)
-#define _CONCAT3(A,B,C) A##B##C
-
-#define CONCAT2(A,B) _CONCAT2(A,B)
-#define _CONCAT2(A,B) A##B
-
-/* All of these would be present in a full C99 implementation of <math.h>
- and <complex.h>. Our problem is that only a few systems have such full
- implementations. Further, libgcc_s.so isn't currently linked against
- libm.so, and even for systems that do provide full C99, the extra overhead
- of all programs using libgcc having to link against libm. So avoid it. */
-
-#define isnan(x) __builtin_expect ((x) != (x), 0)
-#define isfinite(x) __builtin_expect (!isnan((x) - (x)), 1)
-#define isinf(x) __builtin_expect (!isnan(x) & !isfinite(x), 0)
-
-#define INFINITY CONCAT2(__builtin_huge_val, CEXT) ()
-#define I 1i
-
-/* Helpers to make the following code slightly less gross. */
-#define COPYSIGN CONCAT2(__builtin_copysign, CEXT)
-#define FABS CONCAT2(__builtin_fabs, CEXT)
-
-/* Verify that MTYPE matches up with CEXT. */
-extern void *compile_type_assert[sizeof(INFINITY) == sizeof(MTYPE) ? 1 : -1];
-
-/* Ensure that we've lost any extra precision. */
-#if NOTRUNC
-# define TRUNC(x)
-#else
-# define TRUNC(x) __asm__ ("" : "=m"(x) : "m"(x))
-#endif
-
-#if defined(L_mulsc3) || defined(L_muldc3) \
- || defined(L_mulxc3) || defined(L_multc3)
-
-CTYPE
-CONCAT3(__mul,MODE,3) (MTYPE a, MTYPE b, MTYPE c, MTYPE d)
-{
- MTYPE ac, bd, ad, bc, x, y;
- CTYPE res;
-
- ac = a * c;
- bd = b * d;
- ad = a * d;
- bc = b * c;
-
- TRUNC (ac);
- TRUNC (bd);
- TRUNC (ad);
- TRUNC (bc);
-
- x = ac - bd;
- y = ad + bc;
-
- if (isnan (x) && isnan (y))
- {
- /* Recover infinities that computed as NaN + iNaN. */
- _Bool recalc = 0;
- if (isinf (a) || isinf (b))
- {
- /* z is infinite. "Box" the infinity and change NaNs in
- the other factor to 0. */
- a = COPYSIGN (isinf (a) ? 1 : 0, a);
- b = COPYSIGN (isinf (b) ? 1 : 0, b);
- if (isnan (c)) c = COPYSIGN (0, c);
- if (isnan (d)) d = COPYSIGN (0, d);
- recalc = 1;
- }
- if (isinf (c) || isinf (d))
- {
- /* w is infinite. "Box" the infinity and change NaNs in
- the other factor to 0. */
- c = COPYSIGN (isinf (c) ? 1 : 0, c);
- d = COPYSIGN (isinf (d) ? 1 : 0, d);
- if (isnan (a)) a = COPYSIGN (0, a);
- if (isnan (b)) b = COPYSIGN (0, b);
- recalc = 1;
- }
- if (!recalc
- && (isinf (ac) || isinf (bd)
- || isinf (ad) || isinf (bc)))
- {
- /* Recover infinities from overflow by changing NaNs to 0. */
- if (isnan (a)) a = COPYSIGN (0, a);
- if (isnan (b)) b = COPYSIGN (0, b);
- if (isnan (c)) c = COPYSIGN (0, c);
- if (isnan (d)) d = COPYSIGN (0, d);
- recalc = 1;
- }
- if (recalc)
- {
- x = INFINITY * (a * c - b * d);
- y = INFINITY * (a * d + b * c);
- }
- }
-
- __real__ res = x;
- __imag__ res = y;
- return res;
-}
-#endif /* complex multiply */
-
-#if defined(L_divsc3) || defined(L_divdc3) \
- || defined(L_divxc3) || defined(L_divtc3)
-
-CTYPE
-CONCAT3(__div,MODE,3) (MTYPE a, MTYPE b, MTYPE c, MTYPE d)
-{
- MTYPE denom, ratio, x, y;
- CTYPE res;
-
- /* ??? We can get better behavior from logarithmic scaling instead of
- the division. But that would mean starting to link libgcc against
- libm. We could implement something akin to ldexp/frexp as gcc builtins
- fairly easily... */
- if (FABS (c) < FABS (d))
- {
- ratio = c / d;
- denom = (c * ratio) + d;
- x = ((a * ratio) + b) / denom;
- y = ((b * ratio) - a) / denom;
- }
- else
- {
- ratio = d / c;
- denom = (d * ratio) + c;
- x = ((b * ratio) + a) / denom;
- y = (b - (a * ratio)) / denom;
- }
-
- /* Recover infinities and zeros that computed as NaN+iNaN; the only cases
- are nonzero/zero, infinite/finite, and finite/infinite. */
- if (isnan (x) && isnan (y))
- {
- if (c == 0.0 && d == 0.0 && (!isnan (a) || !isnan (b)))
- {
- x = COPYSIGN (INFINITY, c) * a;
- y = COPYSIGN (INFINITY, c) * b;
- }
- else if ((isinf (a) || isinf (b)) && isfinite (c) && isfinite (d))
- {
- a = COPYSIGN (isinf (a) ? 1 : 0, a);
- b = COPYSIGN (isinf (b) ? 1 : 0, b);
- x = INFINITY * (a * c + b * d);
- y = INFINITY * (b * c - a * d);
- }
- else if ((isinf (c) || isinf (d)) && isfinite (a) && isfinite (b))
- {
- c = COPYSIGN (isinf (c) ? 1 : 0, c);
- d = COPYSIGN (isinf (d) ? 1 : 0, d);
- x = 0.0 * (a * c + b * d);
- y = 0.0 * (b * c - a * d);
- }
- }
-
- __real__ res = x;
- __imag__ res = y;
- return res;
-}
-#endif /* complex divide */
-
-#endif /* all complex float routines */
-
-/* From here on down, the routines use normal data types. */
-
-#define SItype bogus_type
-#define USItype bogus_type
-#define DItype bogus_type
-#define UDItype bogus_type
-#define SFtype bogus_type
-#define DFtype bogus_type
-#undef Wtype
-#undef UWtype
-#undef HWtype
-#undef UHWtype
-#undef DWtype
-#undef UDWtype
-
-#undef char
-#undef short
-#undef int
-#undef long
-#undef unsigned
-#undef float
-#undef double
-
-#ifdef L__gcc_bcmp
-
-/* Like bcmp except the sign is meaningful.
- Result is negative if S1 is less than S2,
- positive if S1 is greater, 0 if S1 and S2 are equal. */
-
-int
-__gcc_bcmp (const unsigned char *s1, const unsigned char *s2, size_t size)
-{
- while (size > 0)
- {
- const unsigned char c1 = *s1++, c2 = *s2++;
- if (c1 != c2)
- return c1 - c2;
- size--;
- }
- return 0;
-}
-
-#endif
-
-/* __eprintf used to be used by GCC's private version of <assert.h>.
- We no longer provide that header, but this routine remains in libgcc.a
- for binary backward compatibility. Note that it is not included in
- the shared version of libgcc. */
-#ifdef L_eprintf
-#ifndef inhibit_libc
-
-#undef NULL /* Avoid errors if stdio.h and our stddef.h mismatch. */
-#include <stdio.h>
-
-void
-__eprintf (const char *string, const char *expression,
- unsigned int line, const char *filename)
-{
- fprintf (stderr, string, expression, line, filename);
- fflush (stderr);
- abort ();
-}
-
-#endif
-#endif
-
-
-#ifdef L_clear_cache
-/* Clear part of an instruction cache. */
-
-void
-__clear_cache (char *beg __attribute__((__unused__)),
- char *end __attribute__((__unused__)))
-{
-#ifdef CLEAR_INSN_CACHE
- CLEAR_INSN_CACHE (beg, end);
-#endif /* CLEAR_INSN_CACHE */
-}
-
-#endif /* L_clear_cache */
-
-#ifdef L_trampoline
-
-/* Jump to a trampoline, loading the static chain address. */
-
-#if defined(WINNT) && ! defined(__CYGWIN__)
-#include <windows.h>
-int getpagesize (void);
-int mprotect (char *,int, int);
-
-int
-getpagesize (void)
-{
-#ifdef _ALPHA_
- return 8192;
-#else
- return 4096;
-#endif
-}
-
-int
-mprotect (char *addr, int len, int prot)
-{
- DWORD np, op;
-
- if (prot == 7)
- np = 0x40;
- else if (prot == 5)
- np = 0x20;
- else if (prot == 4)
- np = 0x10;
- else if (prot == 3)
- np = 0x04;
- else if (prot == 1)
- np = 0x02;
- else if (prot == 0)
- np = 0x01;
- else
- return -1;
-
- if (VirtualProtect (addr, len, np, &op))
- return 0;
- else
- return -1;
-}
-
-#endif /* WINNT && ! __CYGWIN__ */
-
-#ifdef TRANSFER_FROM_TRAMPOLINE
-TRANSFER_FROM_TRAMPOLINE
-#endif
-#endif /* L_trampoline */
-
-#ifndef __CYGWIN__
-#ifdef L__main
-
-#include "gbl-ctors.h"
-
-/* Some systems use __main in a way incompatible with its use in gcc, in these
- cases use the macros NAME__MAIN to give a quoted symbol and SYMBOL__MAIN to
- give the same symbol without quotes for an alternative entry point. You
- must define both, or neither. */
-#ifndef NAME__MAIN
-#define NAME__MAIN "__main"
-#define SYMBOL__MAIN __main
-#endif
-
-#if defined (INIT_SECTION_ASM_OP) || defined (INIT_ARRAY_SECTION_ASM_OP)
-#undef HAS_INIT_SECTION
-#define HAS_INIT_SECTION
-#endif
-
-#if !defined (HAS_INIT_SECTION) || !defined (OBJECT_FORMAT_ELF)
-
-/* Some ELF crosses use crtstuff.c to provide __CTOR_LIST__, but use this
- code to run constructors. In that case, we need to handle EH here, too. */
-
-#ifdef EH_FRAME_SECTION_NAME
-#include "unwind-dw2-fde.h"
-extern unsigned char __EH_FRAME_BEGIN__[];
-#endif
-
-/* Run all the global destructors on exit from the program. */
-
-void
-__do_global_dtors (void)
-{
-#ifdef DO_GLOBAL_DTORS_BODY
- DO_GLOBAL_DTORS_BODY;
-#else
- static func_ptr *p = __DTOR_LIST__ + 1;
- while (*p)
- {
- p++;
- (*(p-1)) ();
- }
-#endif
-#if defined (EH_FRAME_SECTION_NAME) && !defined (HAS_INIT_SECTION)
- {
- static int completed = 0;
- if (! completed)
- {
- completed = 1;
- __deregister_frame_info (__EH_FRAME_BEGIN__);
- }
- }
-#endif
-}
-#endif
-
-#ifndef HAS_INIT_SECTION
-/* Run all the global constructors on entry to the program. */
-
-void
-__do_global_ctors (void)
-{
-#ifdef EH_FRAME_SECTION_NAME
- {
- static struct object object;
- __register_frame_info (__EH_FRAME_BEGIN__, &object);
- }
-#endif
- DO_GLOBAL_CTORS_BODY;
- atexit (__do_global_dtors);
-}
-#endif /* no HAS_INIT_SECTION */
-
-#if !defined (HAS_INIT_SECTION) || defined (INVOKE__main)
-/* Subroutine called automatically by `main'.
- Compiling a global function named `main'
- produces an automatic call to this function at the beginning.
-
- For many systems, this routine calls __do_global_ctors.
- For systems which support a .init section we use the .init section
- to run __do_global_ctors, so we need not do anything here. */
-
-extern void SYMBOL__MAIN (void);
-void
-SYMBOL__MAIN (void)
-{
- /* Support recursive calls to `main': run initializers just once. */
- static int initialized;
- if (! initialized)
- {
- initialized = 1;
- __do_global_ctors ();
- }
-}
-#endif /* no HAS_INIT_SECTION or INVOKE__main */
-
-#endif /* L__main */
-#endif /* __CYGWIN__ */
-
-#ifdef L_ctors
-
-#include "gbl-ctors.h"
-
-/* Provide default definitions for the lists of constructors and
- destructors, so that we don't get linker errors. These symbols are
- intentionally bss symbols, so that gld and/or collect will provide
- the right values. */
-
-/* We declare the lists here with two elements each,
- so that they are valid empty lists if no other definition is loaded.
-
- If we are using the old "set" extensions to have the gnu linker
- collect ctors and dtors, then we __CTOR_LIST__ and __DTOR_LIST__
- must be in the bss/common section.
-
- Long term no port should use those extensions. But many still do. */
-#if !defined(INIT_SECTION_ASM_OP) && !defined(CTOR_LISTS_DEFINED_EXTERNALLY)
-#if defined (TARGET_ASM_CONSTRUCTOR) || defined (USE_COLLECT2)
-func_ptr __CTOR_LIST__[2] = {0, 0};
-func_ptr __DTOR_LIST__[2] = {0, 0};
-#else
-func_ptr __CTOR_LIST__[2];
-func_ptr __DTOR_LIST__[2];
-#endif
-#endif /* no INIT_SECTION_ASM_OP and not CTOR_LISTS_DEFINED_EXTERNALLY */
-#endif /* L_ctors */
-#endif /* LIBGCC2_UNITS_PER_WORD <= MIN_UNITS_PER_WORD */
diff --git a/gcc/libgcc2.h b/gcc/libgcc2.h
deleted file mode 100644
index 0c7d0e15623..00000000000
--- a/gcc/libgcc2.h
+++ /dev/null
@@ -1,530 +0,0 @@
-/* Header file for libgcc2.c. */
-/* Copyright (C) 2000, 2001, 2004, 2005, 2009, 2010
- 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 GCC_LIBGCC2_H
-#define GCC_LIBGCC2_H
-
-#ifndef HIDE_EXPORTS
-#pragma GCC visibility push(default)
-#endif
-
-extern int __gcc_bcmp (const unsigned char *, const unsigned char *, size_t);
-extern void __clear_cache (char *, char *);
-extern void __eprintf (const char *, const char *, unsigned int, const char *)
- __attribute__ ((__noreturn__));
-
-#ifndef LIBGCC2_LONG_DOUBLE_TYPE_SIZE
-#define LIBGCC2_LONG_DOUBLE_TYPE_SIZE LONG_DOUBLE_TYPE_SIZE
-#endif
-
-#ifndef LIBGCC2_HAS_SF_MODE
-#define LIBGCC2_HAS_SF_MODE (BITS_PER_UNIT == 8)
-#endif
-
-#ifndef LIBGCC2_HAS_DF_MODE
-#define LIBGCC2_HAS_DF_MODE \
- (BITS_PER_UNIT == 8 \
- && (__SIZEOF_DOUBLE__ * __CHAR_BIT__ == 64 \
- || LIBGCC2_LONG_DOUBLE_TYPE_SIZE == 64))
-#endif
-
-#ifndef LIBGCC2_HAS_XF_MODE
-#define LIBGCC2_HAS_XF_MODE \
- (BITS_PER_UNIT == 8 && LIBGCC2_LONG_DOUBLE_TYPE_SIZE == 80)
-#endif
-
-#ifndef LIBGCC2_HAS_TF_MODE
-#define LIBGCC2_HAS_TF_MODE \
- (BITS_PER_UNIT == 8 && LIBGCC2_LONG_DOUBLE_TYPE_SIZE == 128)
-#endif
-
-#ifndef SF_SIZE
-#if LIBGCC2_HAS_SF_MODE
-#define SF_SIZE FLT_MANT_DIG
-#else
-#define SF_SIZE 0
-#endif
-#endif
-
-#ifndef DF_SIZE
-#if LIBGCC2_HAS_DF_MODE
-#if __SIZEOF_DOUBLE__ * __CHAR_BIT__ == 64
-#define DF_SIZE DBL_MANT_DIG
-#elif LIBGCC2_LONG_DOUBLE_TYPE_SIZE == 64
-#define DF_SIZE LDBL_MANT_DIG
-#else
-#define DF_SIZE 0
-#endif
-#else
-#define DF_SIZE 0
-#endif
-#endif
-
-#ifndef XF_SIZE
-#if LIBGCC2_HAS_XF_MODE
-#define XF_SIZE LDBL_MANT_DIG
-#else
-#define XF_SIZE 0
-#endif
-#endif
-
-#ifndef TF_SIZE
-#if LIBGCC2_HAS_TF_MODE
-#define TF_SIZE LDBL_MANT_DIG
-#else
-#define TF_SIZE 0
-#endif
-#endif
-
-/* FIXME: This #ifdef probably should be removed, ie. enable the test
- for mips too. */
-/* Don't use IBM Extended Double TFmode for TI->SF calculations.
- The conversion from long double to float suffers from double
- rounding, because we convert via double. In other cases, going
- through the software fp routines is much slower than the fallback. */
-#ifdef __powerpc__
-#define AVOID_FP_TYPE_CONVERSION(SIZE) (SIZE == 106)
-#elif defined(WIDEST_HARDWARE_FP_SIZE)
-#define AVOID_FP_TYPE_CONVERSION(SIZE) (SIZE > WIDEST_HARDWARE_FP_SIZE)
-#else
-#define AVOID_FP_TYPE_CONVERSION(SIZE) 0
-#endif
-
-/* In the first part of this file, we are interfacing to calls generated
- by the compiler itself. These calls pass values into these routines
- which have very specific modes (rather than very specific types), and
- these compiler-generated calls also expect any return values to have
- very specific modes (rather than very specific types). Thus, we need
- to avoid using regular C language type names in this part of the file
- because the sizes for those types can be configured to be anything.
- Instead we use the following special type names. */
-
-typedef int QItype __attribute__ ((mode (QI)));
-typedef unsigned int UQItype __attribute__ ((mode (QI)));
-typedef int HItype __attribute__ ((mode (HI)));
-typedef unsigned int UHItype __attribute__ ((mode (HI)));
-#if MIN_UNITS_PER_WORD > 1
-/* These typedefs are usually forbidden on dsp's with UNITS_PER_WORD 1. */
-typedef int SItype __attribute__ ((mode (SI)));
-typedef unsigned int USItype __attribute__ ((mode (SI)));
-#if __SIZEOF_LONG_LONG__ > 4
-/* These typedefs are usually forbidden on archs with UNITS_PER_WORD 2. */
-typedef int DItype __attribute__ ((mode (DI)));
-typedef unsigned int UDItype __attribute__ ((mode (DI)));
-#if MIN_UNITS_PER_WORD > 4
-/* These typedefs are usually forbidden on archs with UNITS_PER_WORD 4. */
-typedef int TItype __attribute__ ((mode (TI)));
-typedef unsigned int UTItype __attribute__ ((mode (TI)));
-#endif
-#endif
-#endif
-
-#if LIBGCC2_HAS_SF_MODE
-typedef float SFtype __attribute__ ((mode (SF)));
-typedef _Complex float SCtype __attribute__ ((mode (SC)));
-#endif
-#if LIBGCC2_HAS_DF_MODE
-typedef float DFtype __attribute__ ((mode (DF)));
-typedef _Complex float DCtype __attribute__ ((mode (DC)));
-#endif
-#if LIBGCC2_HAS_XF_MODE
-typedef float XFtype __attribute__ ((mode (XF)));
-typedef _Complex float XCtype __attribute__ ((mode (XC)));
-#endif
-#if LIBGCC2_HAS_TF_MODE
-typedef float TFtype __attribute__ ((mode (TF)));
-typedef _Complex float TCtype __attribute__ ((mode (TC)));
-#endif
-
-typedef int cmp_return_type __attribute__((mode (__libgcc_cmp_return__)));
-typedef int shift_count_type __attribute__((mode (__libgcc_shift_count__)));
-
-/* Make sure that we don't accidentally use any normal C language built-in
- type names in the first part of this file. Instead we want to use *only*
- the type names defined above. The following macro definitions insure
- that if we *do* accidentally use some normal C language built-in type name,
- we will get a syntax error. */
-
-#define char bogus_type
-#define short bogus_type
-#define int bogus_type
-#define long bogus_type
-#define unsigned bogus_type
-#define float bogus_type
-#define double bogus_type
-
-/* Versions prior to 3.4.4 were not taking into account the word size for
- the 5 trapping arithmetic functions absv, addv, subv, mulv and negv. As
- a consequence, the si and di variants were always and the only ones emitted.
- To maintain backward compatibility, COMPAT_SIMODE_TRAPPING_ARITHMETIC is
- defined on platforms where it makes sense to still have the si variants
- emitted. As a bonus, their implementation is now correct. Note that the
- same mechanism should have been implemented for the di variants, but it
- turns out that no platform would define COMPAT_DIMODE_TRAPPING_ARITHMETIC
- if it existed. */
-
-#if LIBGCC2_UNITS_PER_WORD == 8
-#define W_TYPE_SIZE (8 * BITS_PER_UNIT)
-#define Wtype DItype
-#define UWtype UDItype
-#define HWtype DItype
-#define UHWtype UDItype
-#define DWtype TItype
-#define UDWtype UTItype
-#ifdef LIBGCC2_GNU_PREFIX
-#define __NW(a,b) __gnu_ ## a ## di ## b
-#define __NDW(a,b) __gnu_ ## a ## ti ## b
-#else
-#define __NW(a,b) __ ## a ## di ## b
-#define __NDW(a,b) __ ## a ## ti ## b
-#endif
-#define COMPAT_SIMODE_TRAPPING_ARITHMETIC
-#elif LIBGCC2_UNITS_PER_WORD == 4
-#define W_TYPE_SIZE (4 * BITS_PER_UNIT)
-#define Wtype SItype
-#define UWtype USItype
-#define HWtype SItype
-#define UHWtype USItype
-#define DWtype DItype
-#define UDWtype UDItype
-#ifdef LIBGCC2_GNU_PREFIX
-#define __NW(a,b) __gnu_ ## a ## si ## b
-#define __NDW(a,b) __gnu_ ## a ## di ## b
-#else
-#define __NW(a,b) __ ## a ## si ## b
-#define __NDW(a,b) __ ## a ## di ## b
-#endif
-#elif LIBGCC2_UNITS_PER_WORD == 2
-#define W_TYPE_SIZE (2 * BITS_PER_UNIT)
-#define Wtype HItype
-#define UWtype UHItype
-#define HWtype HItype
-#define UHWtype UHItype
-#define DWtype SItype
-#define UDWtype USItype
-#ifdef LIBGCC2_GNU_PREFIX
-#define __NW(a,b) __gnu_ ## a ## hi ## b
-#define __NDW(a,b) __gnu_ ## a ## si ## b
-#else
-#define __NW(a,b) __ ## a ## hi ## b
-#define __NDW(a,b) __ ## a ## si ## b
-#endif
-#else
-#define W_TYPE_SIZE BITS_PER_UNIT
-#define Wtype QItype
-#define UWtype UQItype
-#define HWtype QItype
-#define UHWtype UQItype
-#define DWtype HItype
-#define UDWtype UHItype
-#ifdef LIBGCC2_GNU_PREFIX
-#define __NW(a,b) __gnu_ ## a ## qi ## b
-#define __NDW(a,b) __gnu_ ## a ## hi ## b
-#else
-#define __NW(a,b) __ ## a ## qi ## b
-#define __NDW(a,b) __ ## a ## hi ## b
-#endif
-#endif
-
-#ifdef LIBGCC2_GNU_PREFIX
-#define __N(a) __gnu_ ## a
-#else
-#define __N(a) __ ## a
-#endif
-#define Wtype_MAX ((Wtype)(((UWtype)1 << (W_TYPE_SIZE - 1)) - 1))
-#define Wtype_MIN (- Wtype_MAX - 1)
-
-#if W_TYPE_SIZE == 8
-# define Wtype_MAXp1_F 0x1p8f
-#elif W_TYPE_SIZE == 16
-# define Wtype_MAXp1_F 0x1p16f
-#elif W_TYPE_SIZE == 32
-# define Wtype_MAXp1_F 0x1p32f
-#elif W_TYPE_SIZE == 64
-# define Wtype_MAXp1_F 0x1p64f
-#else
-# error "expand the table"
-#endif
-
-#define __muldi3 __NDW(mul,3)
-#define __divdi3 __NDW(div,3)
-#define __udivdi3 __NDW(udiv,3)
-#define __moddi3 __NDW(mod,3)
-#define __umoddi3 __NDW(umod,3)
-#define __negdi2 __NDW(neg,2)
-#define __lshrdi3 __NDW(lshr,3)
-#define __ashldi3 __NDW(ashl,3)
-#define __ashrdi3 __NDW(ashr,3)
-#define __cmpdi2 __NDW(cmp,2)
-#define __ucmpdi2 __NDW(ucmp,2)
-#define __udivmoddi4 __NDW(udivmod,4)
-#define __fixunstfDI __NDW(fixunstf,)
-#define __fixtfdi __NDW(fixtf,)
-#define __fixunsxfDI __NDW(fixunsxf,)
-#define __fixxfdi __NDW(fixxf,)
-#define __fixunsdfDI __NDW(fixunsdf,)
-#define __fixdfdi __NDW(fixdf,)
-#define __fixunssfDI __NDW(fixunssf,)
-#define __fixsfdi __NDW(fixsf,)
-#define __floatdixf __NDW(float,xf)
-#define __floatditf __NDW(float,tf)
-#define __floatdidf __NDW(float,df)
-#define __floatdisf __NDW(float,sf)
-#define __floatundixf __NDW(floatun,xf)
-#define __floatunditf __NDW(floatun,tf)
-#define __floatundidf __NDW(floatun,df)
-#define __floatundisf __NDW(floatun,sf)
-#define __fixunsxfSI __NW(fixunsxf,)
-#define __fixunstfSI __NW(fixunstf,)
-#define __fixunsdfSI __NW(fixunsdf,)
-#define __fixunssfSI __NW(fixunssf,)
-
-#define __absvSI2 __NW(absv,2)
-#define __addvSI3 __NW(addv,3)
-#define __subvSI3 __NW(subv,3)
-#define __mulvSI3 __NW(mulv,3)
-#define __negvSI2 __NW(negv,2)
-#define __absvDI2 __NDW(absv,2)
-#define __addvDI3 __NDW(addv,3)
-#define __subvDI3 __NDW(subv,3)
-#define __mulvDI3 __NDW(mulv,3)
-#define __negvDI2 __NDW(negv,2)
-
-#define __ffsSI2 __NW(ffs,2)
-#define __clzSI2 __NW(clz,2)
-#define __ctzSI2 __NW(ctz,2)
-#define __clrsbSI2 __NW(clrsb,2)
-#define __popcountSI2 __NW(popcount,2)
-#define __paritySI2 __NW(parity,2)
-#define __ffsDI2 __NDW(ffs,2)
-#define __clzDI2 __NDW(clz,2)
-#define __ctzDI2 __NDW(ctz,2)
-#define __clrsbDI2 __NDW(clrsb,2)
-#define __popcountDI2 __NDW(popcount,2)
-#define __parityDI2 __NDW(parity,2)
-
-#define __clz_tab __N(clz_tab)
-#define __bswapsi2 __N(bswapsi2)
-#define __bswapdi2 __N(bswapdi2)
-#define __udiv_w_sdiv __N(udiv_w_sdiv)
-#define __clear_cache __N(clear_cache)
-#define __enable_execute_stack __N(enable_execute_stack)
-
-#ifndef __powisf2
-#define __powisf2 __N(powisf2)
-#endif
-#ifndef __powidf2
-#define __powidf2 __N(powidf2)
-#endif
-#ifndef __powitf2
-#define __powitf2 __N(powitf2)
-#endif
-#ifndef __powixf2
-#define __powixf2 __N(powixf2)
-#endif
-#ifndef __mulsc3
-#define __mulsc3 __N(mulsc3)
-#endif
-#ifndef __muldc3
-#define __muldc3 __N(muldc3)
-#endif
-#ifndef __mulxc3
-#define __mulxc3 __N(mulxc3)
-#endif
-#ifndef __multc3
-#define __multc3 __N(multc3)
-#endif
-#ifndef __divsc3
-#define __divsc3 __N(divsc3)
-#endif
-#ifndef __divdc3
-#define __divdc3 __N(divdc3)
-#endif
-#ifndef __divxc3
-#define __divxc3 __N(divxc3)
-#endif
-#ifndef __divtc3
-#define __divtc3 __N(divtc3)
-#endif
-
-extern DWtype __muldi3 (DWtype, DWtype);
-extern DWtype __divdi3 (DWtype, DWtype);
-extern UDWtype __udivdi3 (UDWtype, UDWtype);
-extern UDWtype __umoddi3 (UDWtype, UDWtype);
-extern DWtype __moddi3 (DWtype, DWtype);
-
-/* __udivmoddi4 is static inline when building other libgcc2 portions. */
-#if (!defined (L_udivdi3) && !defined (L_divdi3) && \
- !defined (L_umoddi3) && !defined (L_moddi3))
-extern UDWtype __udivmoddi4 (UDWtype, UDWtype, UDWtype *);
-#endif
-
-/* __negdi2 is static inline when building other libgcc2 portions. */
-#if !defined(L_divdi3) && !defined(L_moddi3)
-extern DWtype __negdi2 (DWtype);
-#endif
-
-extern DWtype __lshrdi3 (DWtype, shift_count_type);
-extern DWtype __ashldi3 (DWtype, shift_count_type);
-extern DWtype __ashrdi3 (DWtype, shift_count_type);
-
-/* __udiv_w_sdiv is static inline when building other libgcc2 portions. */
-#if (!defined(L_udivdi3) && !defined(L_divdi3) && \
- !defined(L_umoddi3) && !defined(L_moddi3))
-extern UWtype __udiv_w_sdiv (UWtype *, UWtype, UWtype, UWtype);
-#endif
-
-extern cmp_return_type __cmpdi2 (DWtype, DWtype);
-extern cmp_return_type __ucmpdi2 (DWtype, DWtype);
-
-#if MIN_UNITS_PER_WORD > 1
-extern SItype __bswapsi2 (SItype);
-#endif
-#if __SIZEOF_LONG_LONG__ > 4
-extern DItype __bswapdi2 (DItype);
-#endif
-
-extern Wtype __absvSI2 (Wtype);
-extern Wtype __addvSI3 (Wtype, Wtype);
-extern Wtype __subvSI3 (Wtype, Wtype);
-extern Wtype __mulvSI3 (Wtype, Wtype);
-extern Wtype __negvSI2 (Wtype);
-extern DWtype __absvDI2 (DWtype);
-extern DWtype __addvDI3 (DWtype, DWtype);
-extern DWtype __subvDI3 (DWtype, DWtype);
-extern DWtype __mulvDI3 (DWtype, DWtype);
-extern DWtype __negvDI2 (DWtype);
-
-#ifdef COMPAT_SIMODE_TRAPPING_ARITHMETIC
-#define __absvsi2 __N(absvsi2)
-#define __negvsi2 __N(negvsi2)
-#define __addvsi3 __N(addvsi3)
-#define __subvsi3 __N(subvsi3)
-#define __mulvsi3 __N(mulvsi3)
-
-extern SItype __absvsi2 (SItype);
-extern SItype __addvsi3 (SItype, SItype);
-extern SItype __subvsi3 (SItype, SItype);
-extern SItype __mulvsi3 (SItype, SItype);
-extern SItype __negvsi2 (SItype);
-#endif /* COMPAT_SIMODE_TRAPPING_ARITHMETIC */
-
-#undef int
-#if LIBGCC2_HAS_SF_MODE
-extern DWtype __fixsfdi (SFtype);
-extern SFtype __floatdisf (DWtype);
-extern SFtype __floatundisf (UDWtype);
-extern UWtype __fixunssfSI (SFtype);
-extern UDWtype __fixunssfDI (SFtype);
-extern SFtype __powisf2 (SFtype, int);
-extern SCtype __divsc3 (SFtype, SFtype, SFtype, SFtype);
-extern SCtype __mulsc3 (SFtype, SFtype, SFtype, SFtype);
-#endif
-#if LIBGCC2_HAS_DF_MODE
-extern DWtype __fixdfdi (DFtype);
-extern DFtype __floatdidf (DWtype);
-extern DFtype __floatundidf (UDWtype);
-extern UWtype __fixunsdfSI (DFtype);
-extern UDWtype __fixunsdfDI (DFtype);
-extern DFtype __powidf2 (DFtype, int);
-extern DCtype __divdc3 (DFtype, DFtype, DFtype, DFtype);
-extern DCtype __muldc3 (DFtype, DFtype, DFtype, DFtype);
-#endif
-
-#if LIBGCC2_HAS_XF_MODE
-extern DWtype __fixxfdi (XFtype);
-extern UDWtype __fixunsxfDI (XFtype);
-extern XFtype __floatdixf (DWtype);
-extern XFtype __floatundixf (UDWtype);
-extern UWtype __fixunsxfSI (XFtype);
-extern XFtype __powixf2 (XFtype, int);
-extern XCtype __divxc3 (XFtype, XFtype, XFtype, XFtype);
-extern XCtype __mulxc3 (XFtype, XFtype, XFtype, XFtype);
-#endif
-
-#if LIBGCC2_HAS_TF_MODE
-extern UDWtype __fixunstfDI (TFtype);
-extern DWtype __fixtfdi (TFtype);
-extern TFtype __floatditf (DWtype);
-extern TFtype __floatunditf (UDWtype);
-extern TFtype __powitf2 (TFtype, int);
-extern TCtype __divtc3 (TFtype, TFtype, TFtype, TFtype);
-extern TCtype __multc3 (TFtype, TFtype, TFtype, TFtype);
-#endif
-#define int bogus_type
-
-/* DWstructs are pairs of Wtype values in the order determined by
- __BYTE_ORDER__. */
-
-#if __BYTE_ORDER__ != __ORDER_LITTLE_ENDIAN__
- struct DWstruct {Wtype high, low;};
-#else
- struct DWstruct {Wtype low, high;};
-#endif
-
-/* We need this union to unpack/pack DImode values, since we don't have
- any arithmetic yet. Incoming DImode parameters are stored into the
- `ll' field, and the unpacked result is read from the struct `s'. */
-
-typedef union
-{
- struct DWstruct s;
- DWtype ll;
-} DWunion;
-
-/* Defined for L_popcount_tab. Exported here because some targets may
- want to use it for their own versions of the __popcount builtins. */
-extern const UQItype __popcount_tab[256];
-
-/* Defined for L_clz. Exported here because some targets may want to use
- it for their own versions of the __clz builtins. It contains the bit
- position of the first set bit for the numbers 0 - 255. This avoids the
- need for a separate table for the __ctz builtins. */
-extern const UQItype __clz_tab[256];
-
-#include "longlong.h"
-
-#undef int
-extern int __clzDI2 (UDWtype);
-extern int __clzSI2 (UWtype);
-extern int __ctzSI2 (UWtype);
-extern int __ctzDI2 (UDWtype);
-extern int __clrsbSI2 (Wtype);
-extern int __clrsbDI2 (DWtype);
-extern int __ffsSI2 (UWtype);
-extern int __ffsDI2 (DWtype);
-extern int __popcountSI2 (UWtype);
-extern int __popcountDI2 (UDWtype);
-extern int __paritySI2 (UWtype);
-extern int __parityDI2 (UDWtype);
-#define int bogus_type
-
-extern void __enable_execute_stack (void *);
-
-#ifndef HIDE_EXPORTS
-#pragma GCC visibility pop
-#endif
-
-#endif /* ! GCC_LIBGCC2_H */
diff --git a/gcc/longlong.h b/gcc/longlong.h
deleted file mode 100644
index 30cc2e337f3..00000000000
--- a/gcc/longlong.h
+++ /dev/null
@@ -1,1660 +0,0 @@
-/* longlong.h -- definitions for mixed size 32/64 bit arithmetic.
- Copyright (C) 1991, 1992, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
- 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
- Free Software Foundation, Inc.
-
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- In addition to the permissions in the GNU Lesser General Public
- License, the Free Software Foundation gives you unlimited
- permission to link the compiled version of this file into
- combinations with other programs, and to distribute those
- combinations without any restriction coming from the use of this
- file. (The Lesser General Public License restrictions do apply in
- other respects; for example, they cover modification of the file,
- and distribution when not linked into a combine executable.)
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
- MA 02110-1301, USA. */
-
-/* You have to define the following before including this file:
-
- UWtype -- An unsigned type, default type for operations (typically a "word")
- UHWtype -- An unsigned type, at least half the size of UWtype.
- UDWtype -- An unsigned type, at least twice as large a UWtype
- W_TYPE_SIZE -- size in bits of UWtype
-
- UQItype -- Unsigned 8 bit type.
- SItype, USItype -- Signed and unsigned 32 bit types.
- DItype, UDItype -- Signed and unsigned 64 bit types.
-
- On a 32 bit machine UWtype should typically be USItype;
- on a 64 bit machine, UWtype should typically be UDItype. */
-
-#define __BITS4 (W_TYPE_SIZE / 4)
-#define __ll_B ((UWtype) 1 << (W_TYPE_SIZE / 2))
-#define __ll_lowpart(t) ((UWtype) (t) & (__ll_B - 1))
-#define __ll_highpart(t) ((UWtype) (t) >> (W_TYPE_SIZE / 2))
-
-#ifndef W_TYPE_SIZE
-#define W_TYPE_SIZE 32
-#define UWtype USItype
-#define UHWtype USItype
-#define UDWtype UDItype
-#endif
-
-/* Used in glibc only. */
-#ifndef attribute_hidden
-#define attribute_hidden
-#endif
-
-extern const UQItype __clz_tab[256] attribute_hidden;
-
-/* Define auxiliary asm macros.
-
- 1) umul_ppmm(high_prod, low_prod, multiplier, multiplicand) multiplies two
- UWtype integers MULTIPLIER and MULTIPLICAND, and generates a two UWtype
- word product in HIGH_PROD and LOW_PROD.
-
- 2) __umulsidi3(a,b) multiplies two UWtype integers A and B, and returns a
- UDWtype product. This is just a variant of umul_ppmm.
-
- 3) udiv_qrnnd(quotient, remainder, high_numerator, low_numerator,
- denominator) divides a UDWtype, composed by the UWtype integers
- HIGH_NUMERATOR and LOW_NUMERATOR, by DENOMINATOR and places the quotient
- in QUOTIENT and the remainder in REMAINDER. HIGH_NUMERATOR must be less
- than DENOMINATOR for correct operation. If, in addition, the most
- significant bit of DENOMINATOR must be 1, then the pre-processor symbol
- UDIV_NEEDS_NORMALIZATION is defined to 1.
-
- 4) sdiv_qrnnd(quotient, remainder, high_numerator, low_numerator,
- denominator). Like udiv_qrnnd but the numbers are signed. The quotient
- is rounded towards 0.
-
- 5) count_leading_zeros(count, x) counts the number of zero-bits from the
- msb to the first nonzero bit in the UWtype X. This is the number of
- steps X needs to be shifted left to set the msb. Undefined for X == 0,
- unless the symbol COUNT_LEADING_ZEROS_0 is defined to some value.
-
- 6) count_trailing_zeros(count, x) like count_leading_zeros, but counts
- from the least significant end.
-
- 7) add_ssaaaa(high_sum, low_sum, high_addend_1, low_addend_1,
- high_addend_2, low_addend_2) adds two UWtype integers, composed by
- HIGH_ADDEND_1 and LOW_ADDEND_1, and HIGH_ADDEND_2 and LOW_ADDEND_2
- respectively. The result is placed in HIGH_SUM and LOW_SUM. Overflow
- (i.e. carry out) is not stored anywhere, and is lost.
-
- 8) sub_ddmmss(high_difference, low_difference, high_minuend, low_minuend,
- high_subtrahend, low_subtrahend) subtracts two two-word UWtype integers,
- composed by HIGH_MINUEND_1 and LOW_MINUEND_1, and HIGH_SUBTRAHEND_2 and
- LOW_SUBTRAHEND_2 respectively. The result is placed in HIGH_DIFFERENCE
- and LOW_DIFFERENCE. Overflow (i.e. carry out) is not stored anywhere,
- and is lost.
-
- If any of these macros are left undefined for a particular CPU,
- C macros are used. */
-
-/* The CPUs come in alphabetical order below.
-
- Please add support for more CPUs here, or improve the current support
- for the CPUs below!
- (E.g. WE32100, IBM360.) */
-
-#if defined (__GNUC__) && !defined (NO_ASM)
-
-/* We sometimes need to clobber "cc" with gcc2, but that would not be
- understood by gcc1. Use cpp to avoid major code duplication. */
-#if __GNUC__ < 2
-#define __CLOBBER_CC
-#define __AND_CLOBBER_CC
-#else /* __GNUC__ >= 2 */
-#define __CLOBBER_CC : "cc"
-#define __AND_CLOBBER_CC , "cc"
-#endif /* __GNUC__ < 2 */
-
-#if defined (__alpha) && W_TYPE_SIZE == 64
-#define umul_ppmm(ph, pl, m0, m1) \
- do { \
- UDItype __m0 = (m0), __m1 = (m1); \
- (ph) = __builtin_alpha_umulh (__m0, __m1); \
- (pl) = __m0 * __m1; \
- } while (0)
-#define UMUL_TIME 46
-#ifndef LONGLONG_STANDALONE
-#define udiv_qrnnd(q, r, n1, n0, d) \
- do { UDItype __r; \
- (q) = __udiv_qrnnd (&__r, (n1), (n0), (d)); \
- (r) = __r; \
- } while (0)
-extern UDItype __udiv_qrnnd (UDItype *, UDItype, UDItype, UDItype);
-#define UDIV_TIME 220
-#endif /* LONGLONG_STANDALONE */
-#ifdef __alpha_cix__
-#define count_leading_zeros(COUNT,X) ((COUNT) = __builtin_clzl (X))
-#define count_trailing_zeros(COUNT,X) ((COUNT) = __builtin_ctzl (X))
-#define COUNT_LEADING_ZEROS_0 64
-#else
-#define count_leading_zeros(COUNT,X) \
- do { \
- UDItype __xr = (X), __t, __a; \
- __t = __builtin_alpha_cmpbge (0, __xr); \
- __a = __clz_tab[__t ^ 0xff] - 1; \
- __t = __builtin_alpha_extbl (__xr, __a); \
- (COUNT) = 64 - (__clz_tab[__t] + __a*8); \
- } while (0)
-#define count_trailing_zeros(COUNT,X) \
- do { \
- UDItype __xr = (X), __t, __a; \
- __t = __builtin_alpha_cmpbge (0, __xr); \
- __t = ~__t & -~__t; \
- __a = ((__t & 0xCC) != 0) * 2; \
- __a += ((__t & 0xF0) != 0) * 4; \
- __a += ((__t & 0xAA) != 0); \
- __t = __builtin_alpha_extbl (__xr, __a); \
- __a <<= 3; \
- __t &= -__t; \
- __a += ((__t & 0xCC) != 0) * 2; \
- __a += ((__t & 0xF0) != 0) * 4; \
- __a += ((__t & 0xAA) != 0); \
- (COUNT) = __a; \
- } while (0)
-#endif /* __alpha_cix__ */
-#endif /* __alpha */
-
-#if defined (__arc__) && W_TYPE_SIZE == 32
-#define add_ssaaaa(sh, sl, ah, al, bh, bl) \
- __asm__ ("add.f %1, %4, %5\n\tadc %0, %2, %3" \
- : "=r" ((USItype) (sh)), \
- "=&r" ((USItype) (sl)) \
- : "%r" ((USItype) (ah)), \
- "rIJ" ((USItype) (bh)), \
- "%r" ((USItype) (al)), \
- "rIJ" ((USItype) (bl)))
-#define sub_ddmmss(sh, sl, ah, al, bh, bl) \
- __asm__ ("sub.f %1, %4, %5\n\tsbc %0, %2, %3" \
- : "=r" ((USItype) (sh)), \
- "=&r" ((USItype) (sl)) \
- : "r" ((USItype) (ah)), \
- "rIJ" ((USItype) (bh)), \
- "r" ((USItype) (al)), \
- "rIJ" ((USItype) (bl)))
-/* Call libgcc routine. */
-#define umul_ppmm(w1, w0, u, v) \
-do { \
- DWunion __w; \
- __w.ll = __umulsidi3 (u, v); \
- w1 = __w.s.high; \
- w0 = __w.s.low; \
-} while (0)
-#define __umulsidi3 __umulsidi3
-UDItype __umulsidi3 (USItype, USItype);
-#endif
-
-#if defined (__arm__) && !defined (__thumb__) && W_TYPE_SIZE == 32
-#define add_ssaaaa(sh, sl, ah, al, bh, bl) \
- __asm__ ("adds %1, %4, %5\n\tadc %0, %2, %3" \
- : "=r" ((USItype) (sh)), \
- "=&r" ((USItype) (sl)) \
- : "%r" ((USItype) (ah)), \
- "rI" ((USItype) (bh)), \
- "%r" ((USItype) (al)), \
- "rI" ((USItype) (bl)) __CLOBBER_CC)
-#define sub_ddmmss(sh, sl, ah, al, bh, bl) \
- __asm__ ("subs %1, %4, %5\n\tsbc %0, %2, %3" \
- : "=r" ((USItype) (sh)), \
- "=&r" ((USItype) (sl)) \
- : "r" ((USItype) (ah)), \
- "rI" ((USItype) (bh)), \
- "r" ((USItype) (al)), \
- "rI" ((USItype) (bl)) __CLOBBER_CC)
-#define umul_ppmm(xh, xl, a, b) \
-{register USItype __t0, __t1, __t2; \
- __asm__ ("%@ Inlined umul_ppmm\n" \
- " mov %2, %5, lsr #16\n" \
- " mov %0, %6, lsr #16\n" \
- " bic %3, %5, %2, lsl #16\n" \
- " bic %4, %6, %0, lsl #16\n" \
- " mul %1, %3, %4\n" \
- " mul %4, %2, %4\n" \
- " mul %3, %0, %3\n" \
- " mul %0, %2, %0\n" \
- " adds %3, %4, %3\n" \
- " addcs %0, %0, #65536\n" \
- " adds %1, %1, %3, lsl #16\n" \
- " adc %0, %0, %3, lsr #16" \
- : "=&r" ((USItype) (xh)), \
- "=r" ((USItype) (xl)), \
- "=&r" (__t0), "=&r" (__t1), "=r" (__t2) \
- : "r" ((USItype) (a)), \
- "r" ((USItype) (b)) __CLOBBER_CC );}
-#define UMUL_TIME 20
-#define UDIV_TIME 100
-#endif /* __arm__ */
-
-#if defined(__arm__)
-/* Let gcc decide how best to implement count_leading_zeros. */
-#define count_leading_zeros(COUNT,X) ((COUNT) = __builtin_clz (X))
-#define COUNT_LEADING_ZEROS_0 32
-#endif
-
-#if defined (__AVR__)
-
-#if W_TYPE_SIZE == 16
-#define count_leading_zeros(COUNT,X) ((COUNT) = __builtin_clz (X))
-#define count_trailing_zeros(COUNT,X) ((COUNT) = __builtin_ctz (X))
-#define COUNT_LEADING_ZEROS_0 16
-#endif /* W_TYPE_SIZE == 16 */
-
-#if W_TYPE_SIZE == 32
-#define count_leading_zeros(COUNT,X) ((COUNT) = __builtin_clzl (X))
-#define count_trailing_zeros(COUNT,X) ((COUNT) = __builtin_ctzl (X))
-#define COUNT_LEADING_ZEROS_0 32
-#endif /* W_TYPE_SIZE == 32 */
-
-#if W_TYPE_SIZE == 64
-#define count_leading_zeros(COUNT,X) ((COUNT) = __builtin_clzll (X))
-#define count_trailing_zeros(COUNT,X) ((COUNT) = __builtin_ctzll (X))
-#define COUNT_LEADING_ZEROS_0 64
-#endif /* W_TYPE_SIZE == 64 */
-
-#endif /* defined (__AVR__) */
-
-#if defined (__CRIS__) && __CRIS_arch_version >= 3
-#define count_leading_zeros(COUNT, X) ((COUNT) = __builtin_clz (X))
-#if __CRIS_arch_version >= 8
-#define count_trailing_zeros(COUNT, X) ((COUNT) = __builtin_ctz (X))
-#endif
-#endif /* __CRIS__ */
-
-#if defined (__hppa) && W_TYPE_SIZE == 32
-#define add_ssaaaa(sh, sl, ah, al, bh, bl) \
- __asm__ ("add %4,%5,%1\n\taddc %2,%3,%0" \
- : "=r" ((USItype) (sh)), \
- "=&r" ((USItype) (sl)) \
- : "%rM" ((USItype) (ah)), \
- "rM" ((USItype) (bh)), \
- "%rM" ((USItype) (al)), \
- "rM" ((USItype) (bl)))
-#define sub_ddmmss(sh, sl, ah, al, bh, bl) \
- __asm__ ("sub %4,%5,%1\n\tsubb %2,%3,%0" \
- : "=r" ((USItype) (sh)), \
- "=&r" ((USItype) (sl)) \
- : "rM" ((USItype) (ah)), \
- "rM" ((USItype) (bh)), \
- "rM" ((USItype) (al)), \
- "rM" ((USItype) (bl)))
-#if defined (_PA_RISC1_1)
-#define umul_ppmm(w1, w0, u, v) \
- do { \
- union \
- { \
- UDItype __f; \
- struct {USItype __w1, __w0;} __w1w0; \
- } __t; \
- __asm__ ("xmpyu %1,%2,%0" \
- : "=x" (__t.__f) \
- : "x" ((USItype) (u)), \
- "x" ((USItype) (v))); \
- (w1) = __t.__w1w0.__w1; \
- (w0) = __t.__w1w0.__w0; \
- } while (0)
-#define UMUL_TIME 8
-#else
-#define UMUL_TIME 30
-#endif
-#define UDIV_TIME 40
-#define count_leading_zeros(count, x) \
- do { \
- USItype __tmp; \
- __asm__ ( \
- "ldi 1,%0\n" \
-" extru,= %1,15,16,%%r0 ; Bits 31..16 zero?\n" \
-" extru,tr %1,15,16,%1 ; No. Shift down, skip add.\n"\
-" ldo 16(%0),%0 ; Yes. Perform add.\n" \
-" extru,= %1,23,8,%%r0 ; Bits 15..8 zero?\n" \
-" extru,tr %1,23,8,%1 ; No. Shift down, skip add.\n"\
-" ldo 8(%0),%0 ; Yes. Perform add.\n" \
-" extru,= %1,27,4,%%r0 ; Bits 7..4 zero?\n" \
-" extru,tr %1,27,4,%1 ; No. Shift down, skip add.\n"\
-" ldo 4(%0),%0 ; Yes. Perform add.\n" \
-" extru,= %1,29,2,%%r0 ; Bits 3..2 zero?\n" \
-" extru,tr %1,29,2,%1 ; No. Shift down, skip add.\n"\
-" ldo 2(%0),%0 ; Yes. Perform add.\n" \
-" extru %1,30,1,%1 ; Extract bit 1.\n" \
-" sub %0,%1,%0 ; Subtract it.\n" \
- : "=r" (count), "=r" (__tmp) : "1" (x)); \
- } while (0)
-#endif
-
-#if (defined (__i370__) || defined (__s390__) || defined (__mvs__)) && W_TYPE_SIZE == 32
-#if !defined (__zarch__)
-#define smul_ppmm(xh, xl, m0, m1) \
- do { \
- union {DItype __ll; \
- struct {USItype __h, __l;} __i; \
- } __x; \
- __asm__ ("lr %N0,%1\n\tmr %0,%2" \
- : "=&r" (__x.__ll) \
- : "r" (m0), "r" (m1)); \
- (xh) = __x.__i.__h; (xl) = __x.__i.__l; \
- } while (0)
-#define sdiv_qrnnd(q, r, n1, n0, d) \
- do { \
- union {DItype __ll; \
- struct {USItype __h, __l;} __i; \
- } __x; \
- __x.__i.__h = n1; __x.__i.__l = n0; \
- __asm__ ("dr %0,%2" \
- : "=r" (__x.__ll) \
- : "0" (__x.__ll), "r" (d)); \
- (q) = __x.__i.__l; (r) = __x.__i.__h; \
- } while (0)
-#else
-#define smul_ppmm(xh, xl, m0, m1) \
- do { \
- register SItype __r0 __asm__ ("0"); \
- register SItype __r1 __asm__ ("1") = (m0); \
- \
- __asm__ ("mr\t%%r0,%3" \
- : "=r" (__r0), "=r" (__r1) \
- : "r" (__r1), "r" (m1)); \
- (xh) = __r0; (xl) = __r1; \
- } while (0)
-
-#define sdiv_qrnnd(q, r, n1, n0, d) \
- do { \
- register SItype __r0 __asm__ ("0") = (n1); \
- register SItype __r1 __asm__ ("1") = (n0); \
- \
- __asm__ ("dr\t%%r0,%4" \
- : "=r" (__r0), "=r" (__r1) \
- : "r" (__r0), "r" (__r1), "r" (d)); \
- (q) = __r1; (r) = __r0; \
- } while (0)
-#endif /* __zarch__ */
-#endif
-
-#if (defined (__i386__) || defined (__i486__)) && W_TYPE_SIZE == 32
-#define add_ssaaaa(sh, sl, ah, al, bh, bl) \
- __asm__ ("add{l} {%5,%1|%1,%5}\n\tadc{l} {%3,%0|%0,%3}" \
- : "=r" ((USItype) (sh)), \
- "=&r" ((USItype) (sl)) \
- : "%0" ((USItype) (ah)), \
- "g" ((USItype) (bh)), \
- "%1" ((USItype) (al)), \
- "g" ((USItype) (bl)))
-#define sub_ddmmss(sh, sl, ah, al, bh, bl) \
- __asm__ ("sub{l} {%5,%1|%1,%5}\n\tsbb{l} {%3,%0|%0,%3}" \
- : "=r" ((USItype) (sh)), \
- "=&r" ((USItype) (sl)) \
- : "0" ((USItype) (ah)), \
- "g" ((USItype) (bh)), \
- "1" ((USItype) (al)), \
- "g" ((USItype) (bl)))
-#define umul_ppmm(w1, w0, u, v) \
- __asm__ ("mul{l} %3" \
- : "=a" ((USItype) (w0)), \
- "=d" ((USItype) (w1)) \
- : "%0" ((USItype) (u)), \
- "rm" ((USItype) (v)))
-#define udiv_qrnnd(q, r, n1, n0, dv) \
- __asm__ ("div{l} %4" \
- : "=a" ((USItype) (q)), \
- "=d" ((USItype) (r)) \
- : "0" ((USItype) (n0)), \
- "1" ((USItype) (n1)), \
- "rm" ((USItype) (dv)))
-#define count_leading_zeros(count, x) ((count) = __builtin_clz (x))
-#define count_trailing_zeros(count, x) ((count) = __builtin_ctz (x))
-#define UMUL_TIME 40
-#define UDIV_TIME 40
-#endif /* 80x86 */
-
-#if (defined (__x86_64__) || defined (__i386__)) && W_TYPE_SIZE == 64
-#define add_ssaaaa(sh, sl, ah, al, bh, bl) \
- __asm__ ("add{q} {%5,%1|%1,%5}\n\tadc{q} {%3,%0|%0,%3}" \
- : "=r" ((UDItype) (sh)), \
- "=&r" ((UDItype) (sl)) \
- : "%0" ((UDItype) (ah)), \
- "rme" ((UDItype) (bh)), \
- "%1" ((UDItype) (al)), \
- "rme" ((UDItype) (bl)))
-#define sub_ddmmss(sh, sl, ah, al, bh, bl) \
- __asm__ ("sub{q} {%5,%1|%1,%5}\n\tsbb{q} {%3,%0|%0,%3}" \
- : "=r" ((UDItype) (sh)), \
- "=&r" ((UDItype) (sl)) \
- : "0" ((UDItype) (ah)), \
- "rme" ((UDItype) (bh)), \
- "1" ((UDItype) (al)), \
- "rme" ((UDItype) (bl)))
-#define umul_ppmm(w1, w0, u, v) \
- __asm__ ("mul{q} %3" \
- : "=a" ((UDItype) (w0)), \
- "=d" ((UDItype) (w1)) \
- : "%0" ((UDItype) (u)), \
- "rm" ((UDItype) (v)))
-#define udiv_qrnnd(q, r, n1, n0, dv) \
- __asm__ ("div{q} %4" \
- : "=a" ((UDItype) (q)), \
- "=d" ((UDItype) (r)) \
- : "0" ((UDItype) (n0)), \
- "1" ((UDItype) (n1)), \
- "rm" ((UDItype) (dv)))
-#define count_leading_zeros(count, x) ((count) = __builtin_clzll (x))
-#define count_trailing_zeros(count, x) ((count) = __builtin_ctzll (x))
-#define UMUL_TIME 40
-#define UDIV_TIME 40
-#endif /* x86_64 */
-
-#if defined (__i960__) && W_TYPE_SIZE == 32
-#define umul_ppmm(w1, w0, u, v) \
- ({union {UDItype __ll; \
- struct {USItype __l, __h;} __i; \
- } __xx; \
- __asm__ ("emul %2,%1,%0" \
- : "=d" (__xx.__ll) \
- : "%dI" ((USItype) (u)), \
- "dI" ((USItype) (v))); \
- (w1) = __xx.__i.__h; (w0) = __xx.__i.__l;})
-#define __umulsidi3(u, v) \
- ({UDItype __w; \
- __asm__ ("emul %2,%1,%0" \
- : "=d" (__w) \
- : "%dI" ((USItype) (u)), \
- "dI" ((USItype) (v))); \
- __w; })
-#endif /* __i960__ */
-
-#if defined (__ia64) && W_TYPE_SIZE == 64
-/* This form encourages gcc (pre-release 3.4 at least) to emit predicated
- "sub r=r,r" and "sub r=r,r,1", giving a 2 cycle latency. The generic
- code using "al<bl" arithmetically comes out making an actual 0 or 1 in a
- register, which takes an extra cycle. */
-#define sub_ddmmss(sh, sl, ah, al, bh, bl) \
- do { \
- UWtype __x; \
- __x = (al) - (bl); \
- if ((al) < (bl)) \
- (sh) = (ah) - (bh) - 1; \
- else \
- (sh) = (ah) - (bh); \
- (sl) = __x; \
- } while (0)
-
-/* Do both product parts in assembly, since that gives better code with
- all gcc versions. Some callers will just use the upper part, and in
- that situation we waste an instruction, but not any cycles. */
-#define umul_ppmm(ph, pl, m0, m1) \
- __asm__ ("xma.hu %0 = %2, %3, f0\n\txma.l %1 = %2, %3, f0" \
- : "=&f" (ph), "=f" (pl) \
- : "f" (m0), "f" (m1))
-#define count_leading_zeros(count, x) \
- do { \
- UWtype _x = (x), _y, _a, _c; \
- __asm__ ("mux1 %0 = %1, @rev" : "=r" (_y) : "r" (_x)); \
- __asm__ ("czx1.l %0 = %1" : "=r" (_a) : "r" (-_y | _y)); \
- _c = (_a - 1) << 3; \
- _x >>= _c; \
- if (_x >= 1 << 4) \
- _x >>= 4, _c += 4; \
- if (_x >= 1 << 2) \
- _x >>= 2, _c += 2; \
- _c += _x >> 1; \
- (count) = W_TYPE_SIZE - 1 - _c; \
- } while (0)
-/* similar to what gcc does for __builtin_ffs, but 0 based rather than 1
- based, and we don't need a special case for x==0 here */
-#define count_trailing_zeros(count, x) \
- do { \
- UWtype __ctz_x = (x); \
- __asm__ ("popcnt %0 = %1" \
- : "=r" (count) \
- : "r" ((__ctz_x-1) & ~__ctz_x)); \
- } while (0)
-#define UMUL_TIME 14
-#endif
-
-#if defined (__M32R__) && W_TYPE_SIZE == 32
-#define add_ssaaaa(sh, sl, ah, al, bh, bl) \
- /* The cmp clears the condition bit. */ \
- __asm__ ("cmp %0,%0\n\taddx %1,%5\n\taddx %0,%3" \
- : "=r" ((USItype) (sh)), \
- "=&r" ((USItype) (sl)) \
- : "0" ((USItype) (ah)), \
- "r" ((USItype) (bh)), \
- "1" ((USItype) (al)), \
- "r" ((USItype) (bl)) \
- : "cbit")
-#define sub_ddmmss(sh, sl, ah, al, bh, bl) \
- /* The cmp clears the condition bit. */ \
- __asm__ ("cmp %0,%0\n\tsubx %1,%5\n\tsubx %0,%3" \
- : "=r" ((USItype) (sh)), \
- "=&r" ((USItype) (sl)) \
- : "0" ((USItype) (ah)), \
- "r" ((USItype) (bh)), \
- "1" ((USItype) (al)), \
- "r" ((USItype) (bl)) \
- : "cbit")
-#endif /* __M32R__ */
-
-#if defined (__mc68000__) && W_TYPE_SIZE == 32
-#define add_ssaaaa(sh, sl, ah, al, bh, bl) \
- __asm__ ("add%.l %5,%1\n\taddx%.l %3,%0" \
- : "=d" ((USItype) (sh)), \
- "=&d" ((USItype) (sl)) \
- : "%0" ((USItype) (ah)), \
- "d" ((USItype) (bh)), \
- "%1" ((USItype) (al)), \
- "g" ((USItype) (bl)))
-#define sub_ddmmss(sh, sl, ah, al, bh, bl) \
- __asm__ ("sub%.l %5,%1\n\tsubx%.l %3,%0" \
- : "=d" ((USItype) (sh)), \
- "=&d" ((USItype) (sl)) \
- : "0" ((USItype) (ah)), \
- "d" ((USItype) (bh)), \
- "1" ((USItype) (al)), \
- "g" ((USItype) (bl)))
-
-/* The '020, '030, '040, '060 and CPU32 have 32x32->64 and 64/32->32q-32r. */
-#if (defined (__mc68020__) && !defined (__mc68060__))
-#define umul_ppmm(w1, w0, u, v) \
- __asm__ ("mulu%.l %3,%1:%0" \
- : "=d" ((USItype) (w0)), \
- "=d" ((USItype) (w1)) \
- : "%0" ((USItype) (u)), \
- "dmi" ((USItype) (v)))
-#define UMUL_TIME 45
-#define udiv_qrnnd(q, r, n1, n0, d) \
- __asm__ ("divu%.l %4,%1:%0" \
- : "=d" ((USItype) (q)), \
- "=d" ((USItype) (r)) \
- : "0" ((USItype) (n0)), \
- "1" ((USItype) (n1)), \
- "dmi" ((USItype) (d)))
-#define UDIV_TIME 90
-#define sdiv_qrnnd(q, r, n1, n0, d) \
- __asm__ ("divs%.l %4,%1:%0" \
- : "=d" ((USItype) (q)), \
- "=d" ((USItype) (r)) \
- : "0" ((USItype) (n0)), \
- "1" ((USItype) (n1)), \
- "dmi" ((USItype) (d)))
-
-#elif defined (__mcoldfire__) /* not mc68020 */
-
-#define umul_ppmm(xh, xl, a, b) \
- __asm__ ("| Inlined umul_ppmm\n" \
- " move%.l %2,%/d0\n" \
- " move%.l %3,%/d1\n" \
- " move%.l %/d0,%/d2\n" \
- " swap %/d0\n" \
- " move%.l %/d1,%/d3\n" \
- " swap %/d1\n" \
- " move%.w %/d2,%/d4\n" \
- " mulu %/d3,%/d4\n" \
- " mulu %/d1,%/d2\n" \
- " mulu %/d0,%/d3\n" \
- " mulu %/d0,%/d1\n" \
- " move%.l %/d4,%/d0\n" \
- " clr%.w %/d0\n" \
- " swap %/d0\n" \
- " add%.l %/d0,%/d2\n" \
- " add%.l %/d3,%/d2\n" \
- " jcc 1f\n" \
- " add%.l %#65536,%/d1\n" \
- "1: swap %/d2\n" \
- " moveq %#0,%/d0\n" \
- " move%.w %/d2,%/d0\n" \
- " move%.w %/d4,%/d2\n" \
- " move%.l %/d2,%1\n" \
- " add%.l %/d1,%/d0\n" \
- " move%.l %/d0,%0" \
- : "=g" ((USItype) (xh)), \
- "=g" ((USItype) (xl)) \
- : "g" ((USItype) (a)), \
- "g" ((USItype) (b)) \
- : "d0", "d1", "d2", "d3", "d4")
-#define UMUL_TIME 100
-#define UDIV_TIME 400
-#else /* not ColdFire */
-/* %/ inserts REGISTER_PREFIX, %# inserts IMMEDIATE_PREFIX. */
-#define umul_ppmm(xh, xl, a, b) \
- __asm__ ("| Inlined umul_ppmm\n" \
- " move%.l %2,%/d0\n" \
- " move%.l %3,%/d1\n" \
- " move%.l %/d0,%/d2\n" \
- " swap %/d0\n" \
- " move%.l %/d1,%/d3\n" \
- " swap %/d1\n" \
- " move%.w %/d2,%/d4\n" \
- " mulu %/d3,%/d4\n" \
- " mulu %/d1,%/d2\n" \
- " mulu %/d0,%/d3\n" \
- " mulu %/d0,%/d1\n" \
- " move%.l %/d4,%/d0\n" \
- " eor%.w %/d0,%/d0\n" \
- " swap %/d0\n" \
- " add%.l %/d0,%/d2\n" \
- " add%.l %/d3,%/d2\n" \
- " jcc 1f\n" \
- " add%.l %#65536,%/d1\n" \
- "1: swap %/d2\n" \
- " moveq %#0,%/d0\n" \
- " move%.w %/d2,%/d0\n" \
- " move%.w %/d4,%/d2\n" \
- " move%.l %/d2,%1\n" \
- " add%.l %/d1,%/d0\n" \
- " move%.l %/d0,%0" \
- : "=g" ((USItype) (xh)), \
- "=g" ((USItype) (xl)) \
- : "g" ((USItype) (a)), \
- "g" ((USItype) (b)) \
- : "d0", "d1", "d2", "d3", "d4")
-#define UMUL_TIME 100
-#define UDIV_TIME 400
-
-#endif /* not mc68020 */
-
-/* The '020, '030, '040 and '060 have bitfield insns.
- cpu32 disguises as a 68020, but lacks them. */
-#if defined (__mc68020__) && !defined (__mcpu32__)
-#define count_leading_zeros(count, x) \
- __asm__ ("bfffo %1{%b2:%b2},%0" \
- : "=d" ((USItype) (count)) \
- : "od" ((USItype) (x)), "n" (0))
-/* Some ColdFire architectures have a ff1 instruction supported via
- __builtin_clz. */
-#elif defined (__mcfisaaplus__) || defined (__mcfisac__)
-#define count_leading_zeros(count,x) ((count) = __builtin_clz (x))
-#define COUNT_LEADING_ZEROS_0 32
-#endif
-#endif /* mc68000 */
-
-#if defined (__m88000__) && W_TYPE_SIZE == 32
-#define add_ssaaaa(sh, sl, ah, al, bh, bl) \
- __asm__ ("addu.co %1,%r4,%r5\n\taddu.ci %0,%r2,%r3" \
- : "=r" ((USItype) (sh)), \
- "=&r" ((USItype) (sl)) \
- : "%rJ" ((USItype) (ah)), \
- "rJ" ((USItype) (bh)), \
- "%rJ" ((USItype) (al)), \
- "rJ" ((USItype) (bl)))
-#define sub_ddmmss(sh, sl, ah, al, bh, bl) \
- __asm__ ("subu.co %1,%r4,%r5\n\tsubu.ci %0,%r2,%r3" \
- : "=r" ((USItype) (sh)), \
- "=&r" ((USItype) (sl)) \
- : "rJ" ((USItype) (ah)), \
- "rJ" ((USItype) (bh)), \
- "rJ" ((USItype) (al)), \
- "rJ" ((USItype) (bl)))
-#define count_leading_zeros(count, x) \
- do { \
- USItype __cbtmp; \
- __asm__ ("ff1 %0,%1" \
- : "=r" (__cbtmp) \
- : "r" ((USItype) (x))); \
- (count) = __cbtmp ^ 31; \
- } while (0)
-#define COUNT_LEADING_ZEROS_0 63 /* sic */
-#if defined (__mc88110__)
-#define umul_ppmm(wh, wl, u, v) \
- do { \
- union {UDItype __ll; \
- struct {USItype __h, __l;} __i; \
- } __xx; \
- __asm__ ("mulu.d %0,%1,%2" \
- : "=r" (__xx.__ll) \
- : "r" ((USItype) (u)), \
- "r" ((USItype) (v))); \
- (wh) = __xx.__i.__h; \
- (wl) = __xx.__i.__l; \
- } while (0)
-#define udiv_qrnnd(q, r, n1, n0, d) \
- ({union {UDItype __ll; \
- struct {USItype __h, __l;} __i; \
- } __xx; \
- USItype __q; \
- __xx.__i.__h = (n1); __xx.__i.__l = (n0); \
- __asm__ ("divu.d %0,%1,%2" \
- : "=r" (__q) \
- : "r" (__xx.__ll), \
- "r" ((USItype) (d))); \
- (r) = (n0) - __q * (d); (q) = __q; })
-#define UMUL_TIME 5
-#define UDIV_TIME 25
-#else
-#define UMUL_TIME 17
-#define UDIV_TIME 150
-#endif /* __mc88110__ */
-#endif /* __m88000__ */
-
-#if defined (__mn10300__)
-# if defined (__AM33__)
-# define count_leading_zeros(COUNT,X) ((COUNT) = __builtin_clz (X))
-# define umul_ppmm(w1, w0, u, v) \
- asm("mulu %3,%2,%1,%0" : "=r"(w0), "=r"(w1) : "r"(u), "r"(v))
-# define smul_ppmm(w1, w0, u, v) \
- asm("mul %3,%2,%1,%0" : "=r"(w0), "=r"(w1) : "r"(u), "r"(v))
-# else
-# define umul_ppmm(w1, w0, u, v) \
- asm("nop; nop; mulu %3,%0" : "=d"(w0), "=z"(w1) : "%0"(u), "d"(v))
-# define smul_ppmm(w1, w0, u, v) \
- asm("nop; nop; mul %3,%0" : "=d"(w0), "=z"(w1) : "%0"(u), "d"(v))
-# endif
-# define add_ssaaaa(sh, sl, ah, al, bh, bl) \
- do { \
- DWunion __s, __a, __b; \
- __a.s.low = (al); __a.s.high = (ah); \
- __b.s.low = (bl); __b.s.high = (bh); \
- __s.ll = __a.ll + __b.ll; \
- (sl) = __s.s.low; (sh) = __s.s.high; \
- } while (0)
-# define sub_ddmmss(sh, sl, ah, al, bh, bl) \
- do { \
- DWunion __s, __a, __b; \
- __a.s.low = (al); __a.s.high = (ah); \
- __b.s.low = (bl); __b.s.high = (bh); \
- __s.ll = __a.ll - __b.ll; \
- (sl) = __s.s.low; (sh) = __s.s.high; \
- } while (0)
-# define udiv_qrnnd(q, r, nh, nl, d) \
- asm("divu %2,%0" : "=D"(q), "=z"(r) : "D"(d), "0"(nl), "1"(nh))
-# define sdiv_qrnnd(q, r, nh, nl, d) \
- asm("div %2,%0" : "=D"(q), "=z"(r) : "D"(d), "0"(nl), "1"(nh))
-# define UMUL_TIME 3
-# define UDIV_TIME 38
-#endif
-
-#if defined (__mips__) && W_TYPE_SIZE == 32
-#define umul_ppmm(w1, w0, u, v) \
- do { \
- UDItype __x = (UDItype) (USItype) (u) * (USItype) (v); \
- (w1) = (USItype) (__x >> 32); \
- (w0) = (USItype) (__x); \
- } while (0)
-#define UMUL_TIME 10
-#define UDIV_TIME 100
-
-#if (__mips == 32 || __mips == 64) && ! __mips16
-#define count_leading_zeros(COUNT,X) ((COUNT) = __builtin_clz (X))
-#define COUNT_LEADING_ZEROS_0 32
-#endif
-#endif /* __mips__ */
-
-#if defined (__ns32000__) && W_TYPE_SIZE == 32
-#define umul_ppmm(w1, w0, u, v) \
- ({union {UDItype __ll; \
- struct {USItype __l, __h;} __i; \
- } __xx; \
- __asm__ ("meid %2,%0" \
- : "=g" (__xx.__ll) \
- : "%0" ((USItype) (u)), \
- "g" ((USItype) (v))); \
- (w1) = __xx.__i.__h; (w0) = __xx.__i.__l;})
-#define __umulsidi3(u, v) \
- ({UDItype __w; \
- __asm__ ("meid %2,%0" \
- : "=g" (__w) \
- : "%0" ((USItype) (u)), \
- "g" ((USItype) (v))); \
- __w; })
-#define udiv_qrnnd(q, r, n1, n0, d) \
- ({union {UDItype __ll; \
- struct {USItype __l, __h;} __i; \
- } __xx; \
- __xx.__i.__h = (n1); __xx.__i.__l = (n0); \
- __asm__ ("deid %2,%0" \
- : "=g" (__xx.__ll) \
- : "0" (__xx.__ll), \
- "g" ((USItype) (d))); \
- (r) = __xx.__i.__l; (q) = __xx.__i.__h; })
-#define count_trailing_zeros(count,x) \
- do { \
- __asm__ ("ffsd %2,%0" \
- : "=r" ((USItype) (count)) \
- : "0" ((USItype) 0), \
- "r" ((USItype) (x))); \
- } while (0)
-#endif /* __ns32000__ */
-
-/* FIXME: We should test _IBMR2 here when we add assembly support for the
- system vendor compilers.
- FIXME: What's needed for gcc PowerPC VxWorks? __vxworks__ is not good
- enough, since that hits ARM and m68k too. */
-#if (defined (_ARCH_PPC) /* AIX */ \
- || defined (_ARCH_PWR) /* AIX */ \
- || defined (_ARCH_COM) /* AIX */ \
- || defined (__powerpc__) /* gcc */ \
- || defined (__POWERPC__) /* BEOS */ \
- || defined (__ppc__) /* Darwin */ \
- || (defined (PPC) && ! defined (CPU_FAMILY)) /* gcc 2.7.x GNU&SysV */ \
- || (defined (PPC) && defined (CPU_FAMILY) /* VxWorks */ \
- && CPU_FAMILY == PPC) \
- ) && W_TYPE_SIZE == 32
-#define add_ssaaaa(sh, sl, ah, al, bh, bl) \
- do { \
- if (__builtin_constant_p (bh) && (bh) == 0) \
- __asm__ ("{a%I4|add%I4c} %1,%3,%4\n\t{aze|addze} %0,%2" \
- : "=r" (sh), "=&r" (sl) : "r" (ah), "%r" (al), "rI" (bl));\
- else if (__builtin_constant_p (bh) && (bh) == ~(USItype) 0) \
- __asm__ ("{a%I4|add%I4c} %1,%3,%4\n\t{ame|addme} %0,%2" \
- : "=r" (sh), "=&r" (sl) : "r" (ah), "%r" (al), "rI" (bl));\
- else \
- __asm__ ("{a%I5|add%I5c} %1,%4,%5\n\t{ae|adde} %0,%2,%3" \
- : "=r" (sh), "=&r" (sl) \
- : "%r" (ah), "r" (bh), "%r" (al), "rI" (bl)); \
- } while (0)
-#define sub_ddmmss(sh, sl, ah, al, bh, bl) \
- do { \
- if (__builtin_constant_p (ah) && (ah) == 0) \
- __asm__ ("{sf%I3|subf%I3c} %1,%4,%3\n\t{sfze|subfze} %0,%2" \
- : "=r" (sh), "=&r" (sl) : "r" (bh), "rI" (al), "r" (bl));\
- else if (__builtin_constant_p (ah) && (ah) == ~(USItype) 0) \
- __asm__ ("{sf%I3|subf%I3c} %1,%4,%3\n\t{sfme|subfme} %0,%2" \
- : "=r" (sh), "=&r" (sl) : "r" (bh), "rI" (al), "r" (bl));\
- else if (__builtin_constant_p (bh) && (bh) == 0) \
- __asm__ ("{sf%I3|subf%I3c} %1,%4,%3\n\t{ame|addme} %0,%2" \
- : "=r" (sh), "=&r" (sl) : "r" (ah), "rI" (al), "r" (bl));\
- else if (__builtin_constant_p (bh) && (bh) == ~(USItype) 0) \
- __asm__ ("{sf%I3|subf%I3c} %1,%4,%3\n\t{aze|addze} %0,%2" \
- : "=r" (sh), "=&r" (sl) : "r" (ah), "rI" (al), "r" (bl));\
- else \
- __asm__ ("{sf%I4|subf%I4c} %1,%5,%4\n\t{sfe|subfe} %0,%3,%2" \
- : "=r" (sh), "=&r" (sl) \
- : "r" (ah), "r" (bh), "rI" (al), "r" (bl)); \
- } while (0)
-#define count_leading_zeros(count, x) \
- __asm__ ("{cntlz|cntlzw} %0,%1" : "=r" (count) : "r" (x))
-#define COUNT_LEADING_ZEROS_0 32
-#if defined (_ARCH_PPC) || defined (__powerpc__) || defined (__POWERPC__) \
- || defined (__ppc__) \
- || (defined (PPC) && ! defined (CPU_FAMILY)) /* gcc 2.7.x GNU&SysV */ \
- || (defined (PPC) && defined (CPU_FAMILY) /* VxWorks */ \
- && CPU_FAMILY == PPC)
-#define umul_ppmm(ph, pl, m0, m1) \
- do { \
- USItype __m0 = (m0), __m1 = (m1); \
- __asm__ ("mulhwu %0,%1,%2" : "=r" (ph) : "%r" (m0), "r" (m1)); \
- (pl) = __m0 * __m1; \
- } while (0)
-#define UMUL_TIME 15
-#define smul_ppmm(ph, pl, m0, m1) \
- do { \
- SItype __m0 = (m0), __m1 = (m1); \
- __asm__ ("mulhw %0,%1,%2" : "=r" (ph) : "%r" (m0), "r" (m1)); \
- (pl) = __m0 * __m1; \
- } while (0)
-#define SMUL_TIME 14
-#define UDIV_TIME 120
-#elif defined (_ARCH_PWR)
-#define UMUL_TIME 8
-#define smul_ppmm(xh, xl, m0, m1) \
- __asm__ ("mul %0,%2,%3" : "=r" (xh), "=q" (xl) : "r" (m0), "r" (m1))
-#define SMUL_TIME 4
-#define sdiv_qrnnd(q, r, nh, nl, d) \
- __asm__ ("div %0,%2,%4" : "=r" (q), "=q" (r) : "r" (nh), "1" (nl), "r" (d))
-#define UDIV_TIME 100
-#endif
-#endif /* 32-bit POWER architecture variants. */
-
-/* We should test _IBMR2 here when we add assembly support for the system
- vendor compilers. */
-#if (defined (_ARCH_PPC64) || defined (__powerpc64__)) && W_TYPE_SIZE == 64
-#define add_ssaaaa(sh, sl, ah, al, bh, bl) \
- do { \
- if (__builtin_constant_p (bh) && (bh) == 0) \
- __asm__ ("{a%I4|add%I4c} %1,%3,%4\n\t{aze|addze} %0,%2" \
- : "=r" (sh), "=&r" (sl) : "r" (ah), "%r" (al), "rI" (bl));\
- else if (__builtin_constant_p (bh) && (bh) == ~(UDItype) 0) \
- __asm__ ("{a%I4|add%I4c} %1,%3,%4\n\t{ame|addme} %0,%2" \
- : "=r" (sh), "=&r" (sl) : "r" (ah), "%r" (al), "rI" (bl));\
- else \
- __asm__ ("{a%I5|add%I5c} %1,%4,%5\n\t{ae|adde} %0,%2,%3" \
- : "=r" (sh), "=&r" (sl) \
- : "%r" (ah), "r" (bh), "%r" (al), "rI" (bl)); \
- } while (0)
-#define sub_ddmmss(sh, sl, ah, al, bh, bl) \
- do { \
- if (__builtin_constant_p (ah) && (ah) == 0) \
- __asm__ ("{sf%I3|subf%I3c} %1,%4,%3\n\t{sfze|subfze} %0,%2" \
- : "=r" (sh), "=&r" (sl) : "r" (bh), "rI" (al), "r" (bl));\
- else if (__builtin_constant_p (ah) && (ah) == ~(UDItype) 0) \
- __asm__ ("{sf%I3|subf%I3c} %1,%4,%3\n\t{sfme|subfme} %0,%2" \
- : "=r" (sh), "=&r" (sl) : "r" (bh), "rI" (al), "r" (bl));\
- else if (__builtin_constant_p (bh) && (bh) == 0) \
- __asm__ ("{sf%I3|subf%I3c} %1,%4,%3\n\t{ame|addme} %0,%2" \
- : "=r" (sh), "=&r" (sl) : "r" (ah), "rI" (al), "r" (bl));\
- else if (__builtin_constant_p (bh) && (bh) == ~(UDItype) 0) \
- __asm__ ("{sf%I3|subf%I3c} %1,%4,%3\n\t{aze|addze} %0,%2" \
- : "=r" (sh), "=&r" (sl) : "r" (ah), "rI" (al), "r" (bl));\
- else \
- __asm__ ("{sf%I4|subf%I4c} %1,%5,%4\n\t{sfe|subfe} %0,%3,%2" \
- : "=r" (sh), "=&r" (sl) \
- : "r" (ah), "r" (bh), "rI" (al), "r" (bl)); \
- } while (0)
-#define count_leading_zeros(count, x) \
- __asm__ ("cntlzd %0,%1" : "=r" (count) : "r" (x))
-#define COUNT_LEADING_ZEROS_0 64
-#define umul_ppmm(ph, pl, m0, m1) \
- do { \
- UDItype __m0 = (m0), __m1 = (m1); \
- __asm__ ("mulhdu %0,%1,%2" : "=r" (ph) : "%r" (m0), "r" (m1)); \
- (pl) = __m0 * __m1; \
- } while (0)
-#define UMUL_TIME 15
-#define smul_ppmm(ph, pl, m0, m1) \
- do { \
- DItype __m0 = (m0), __m1 = (m1); \
- __asm__ ("mulhd %0,%1,%2" : "=r" (ph) : "%r" (m0), "r" (m1)); \
- (pl) = __m0 * __m1; \
- } while (0)
-#define SMUL_TIME 14 /* ??? */
-#define UDIV_TIME 120 /* ??? */
-#endif /* 64-bit PowerPC. */
-
-#if defined (__ibm032__) /* RT/ROMP */ && W_TYPE_SIZE == 32
-#define add_ssaaaa(sh, sl, ah, al, bh, bl) \
- __asm__ ("a %1,%5\n\tae %0,%3" \
- : "=r" ((USItype) (sh)), \
- "=&r" ((USItype) (sl)) \
- : "%0" ((USItype) (ah)), \
- "r" ((USItype) (bh)), \
- "%1" ((USItype) (al)), \
- "r" ((USItype) (bl)))
-#define sub_ddmmss(sh, sl, ah, al, bh, bl) \
- __asm__ ("s %1,%5\n\tse %0,%3" \
- : "=r" ((USItype) (sh)), \
- "=&r" ((USItype) (sl)) \
- : "0" ((USItype) (ah)), \
- "r" ((USItype) (bh)), \
- "1" ((USItype) (al)), \
- "r" ((USItype) (bl)))
-#define umul_ppmm(ph, pl, m0, m1) \
- do { \
- USItype __m0 = (m0), __m1 = (m1); \
- __asm__ ( \
- "s r2,r2\n" \
-" mts r10,%2\n" \
-" m r2,%3\n" \
-" m r2,%3\n" \
-" m r2,%3\n" \
-" m r2,%3\n" \
-" m r2,%3\n" \
-" m r2,%3\n" \
-" m r2,%3\n" \
-" m r2,%3\n" \
-" m r2,%3\n" \
-" m r2,%3\n" \
-" m r2,%3\n" \
-" m r2,%3\n" \
-" m r2,%3\n" \
-" m r2,%3\n" \
-" m r2,%3\n" \
-" m r2,%3\n" \
-" cas %0,r2,r0\n" \
-" mfs r10,%1" \
- : "=r" ((USItype) (ph)), \
- "=r" ((USItype) (pl)) \
- : "%r" (__m0), \
- "r" (__m1) \
- : "r2"); \
- (ph) += ((((SItype) __m0 >> 31) & __m1) \
- + (((SItype) __m1 >> 31) & __m0)); \
- } while (0)
-#define UMUL_TIME 20
-#define UDIV_TIME 200
-#define count_leading_zeros(count, x) \
- do { \
- if ((x) >= 0x10000) \
- __asm__ ("clz %0,%1" \
- : "=r" ((USItype) (count)) \
- : "r" ((USItype) (x) >> 16)); \
- else \
- { \
- __asm__ ("clz %0,%1" \
- : "=r" ((USItype) (count)) \
- : "r" ((USItype) (x))); \
- (count) += 16; \
- } \
- } while (0)
-#endif
-
-#if defined(__sh__) && !__SHMEDIA__ && W_TYPE_SIZE == 32
-#ifndef __sh1__
-#define umul_ppmm(w1, w0, u, v) \
- __asm__ ( \
- "dmulu.l %2,%3\n\tsts%M1 macl,%1\n\tsts%M0 mach,%0" \
- : "=r<" ((USItype)(w1)), \
- "=r<" ((USItype)(w0)) \
- : "r" ((USItype)(u)), \
- "r" ((USItype)(v)) \
- : "macl", "mach")
-#define UMUL_TIME 5
-#endif
-
-/* This is the same algorithm as __udiv_qrnnd_c. */
-#define UDIV_NEEDS_NORMALIZATION 1
-
-#define udiv_qrnnd(q, r, n1, n0, d) \
- do { \
- extern UWtype __udiv_qrnnd_16 (UWtype, UWtype) \
- __attribute__ ((visibility ("hidden"))); \
- /* r0: rn r1: qn */ /* r0: n1 r4: n0 r5: d r6: d1 */ /* r2: __m */ \
- __asm__ ( \
- "mov%M4 %4,r5\n" \
-" swap.w %3,r4\n" \
-" swap.w r5,r6\n" \
-" jsr @%5\n" \
-" shll16 r6\n" \
-" swap.w r4,r4\n" \
-" jsr @%5\n" \
-" swap.w r1,%0\n" \
-" or r1,%0" \
- : "=r" (q), "=&z" (r) \
- : "1" (n1), "r" (n0), "rm" (d), "r" (&__udiv_qrnnd_16) \
- : "r1", "r2", "r4", "r5", "r6", "pr", "t"); \
- } while (0)
-
-#define UDIV_TIME 80
-
-#define sub_ddmmss(sh, sl, ah, al, bh, bl) \
- __asm__ ("clrt;subc %5,%1; subc %4,%0" \
- : "=r" (sh), "=r" (sl) \
- : "0" (ah), "1" (al), "r" (bh), "r" (bl) : "t")
-
-#endif /* __sh__ */
-
-#if defined (__SH5__) && __SHMEDIA__ && W_TYPE_SIZE == 32
-#define __umulsidi3(u,v) ((UDItype)(USItype)u*(USItype)v)
-#define count_leading_zeros(count, x) \
- do \
- { \
- UDItype x_ = (USItype)(x); \
- SItype c_; \
- \
- __asm__ ("nsb %1, %0" : "=r" (c_) : "r" (x_)); \
- (count) = c_ - 31; \
- } \
- while (0)
-#define COUNT_LEADING_ZEROS_0 32
-#endif
-
-#if defined (__sparc__) && !defined (__arch64__) && !defined (__sparcv9) \
- && W_TYPE_SIZE == 32
-#define add_ssaaaa(sh, sl, ah, al, bh, bl) \
- __asm__ ("addcc %r4,%5,%1\n\taddx %r2,%3,%0" \
- : "=r" ((USItype) (sh)), \
- "=&r" ((USItype) (sl)) \
- : "%rJ" ((USItype) (ah)), \
- "rI" ((USItype) (bh)), \
- "%rJ" ((USItype) (al)), \
- "rI" ((USItype) (bl)) \
- __CLOBBER_CC)
-#define sub_ddmmss(sh, sl, ah, al, bh, bl) \
- __asm__ ("subcc %r4,%5,%1\n\tsubx %r2,%3,%0" \
- : "=r" ((USItype) (sh)), \
- "=&r" ((USItype) (sl)) \
- : "rJ" ((USItype) (ah)), \
- "rI" ((USItype) (bh)), \
- "rJ" ((USItype) (al)), \
- "rI" ((USItype) (bl)) \
- __CLOBBER_CC)
-#if defined (__sparc_v8__)
-#define umul_ppmm(w1, w0, u, v) \
- __asm__ ("umul %2,%3,%1;rd %%y,%0" \
- : "=r" ((USItype) (w1)), \
- "=r" ((USItype) (w0)) \
- : "r" ((USItype) (u)), \
- "r" ((USItype) (v)))
-#define udiv_qrnnd(__q, __r, __n1, __n0, __d) \
- __asm__ ("mov %2,%%y;nop;nop;nop;udiv %3,%4,%0;umul %0,%4,%1;sub %3,%1,%1"\
- : "=&r" ((USItype) (__q)), \
- "=&r" ((USItype) (__r)) \
- : "r" ((USItype) (__n1)), \
- "r" ((USItype) (__n0)), \
- "r" ((USItype) (__d)))
-#else
-#if defined (__sparclite__)
-/* This has hardware multiply but not divide. It also has two additional
- instructions scan (ffs from high bit) and divscc. */
-#define umul_ppmm(w1, w0, u, v) \
- __asm__ ("umul %2,%3,%1;rd %%y,%0" \
- : "=r" ((USItype) (w1)), \
- "=r" ((USItype) (w0)) \
- : "r" ((USItype) (u)), \
- "r" ((USItype) (v)))
-#define udiv_qrnnd(q, r, n1, n0, d) \
- __asm__ ("! Inlined udiv_qrnnd\n" \
-" wr %%g0,%2,%%y ! Not a delayed write for sparclite\n" \
-" tst %%g0\n" \
-" divscc %3,%4,%%g1\n" \
-" divscc %%g1,%4,%%g1\n" \
-" divscc %%g1,%4,%%g1\n" \
-" divscc %%g1,%4,%%g1\n" \
-" divscc %%g1,%4,%%g1\n" \
-" divscc %%g1,%4,%%g1\n" \
-" divscc %%g1,%4,%%g1\n" \
-" divscc %%g1,%4,%%g1\n" \
-" divscc %%g1,%4,%%g1\n" \
-" divscc %%g1,%4,%%g1\n" \
-" divscc %%g1,%4,%%g1\n" \
-" divscc %%g1,%4,%%g1\n" \
-" divscc %%g1,%4,%%g1\n" \
-" divscc %%g1,%4,%%g1\n" \
-" divscc %%g1,%4,%%g1\n" \
-" divscc %%g1,%4,%%g1\n" \
-" divscc %%g1,%4,%%g1\n" \
-" divscc %%g1,%4,%%g1\n" \
-" divscc %%g1,%4,%%g1\n" \
-" divscc %%g1,%4,%%g1\n" \
-" divscc %%g1,%4,%%g1\n" \
-" divscc %%g1,%4,%%g1\n" \
-" divscc %%g1,%4,%%g1\n" \
-" divscc %%g1,%4,%%g1\n" \
-" divscc %%g1,%4,%%g1\n" \
-" divscc %%g1,%4,%%g1\n" \
-" divscc %%g1,%4,%%g1\n" \
-" divscc %%g1,%4,%%g1\n" \
-" divscc %%g1,%4,%%g1\n" \
-" divscc %%g1,%4,%%g1\n" \
-" divscc %%g1,%4,%%g1\n" \
-" divscc %%g1,%4,%0\n" \
-" rd %%y,%1\n" \
-" bl,a 1f\n" \
-" add %1,%4,%1\n" \
-"1: ! End of inline udiv_qrnnd" \
- : "=r" ((USItype) (q)), \
- "=r" ((USItype) (r)) \
- : "r" ((USItype) (n1)), \
- "r" ((USItype) (n0)), \
- "rI" ((USItype) (d)) \
- : "g1" __AND_CLOBBER_CC)
-#define UDIV_TIME 37
-#define count_leading_zeros(count, x) \
- do { \
- __asm__ ("scan %1,1,%0" \
- : "=r" ((USItype) (count)) \
- : "r" ((USItype) (x))); \
- } while (0)
-/* Early sparclites return 63 for an argument of 0, but they warn that future
- implementations might change this. Therefore, leave COUNT_LEADING_ZEROS_0
- undefined. */
-#else
-/* SPARC without integer multiplication and divide instructions.
- (i.e. at least Sun4/20,40,60,65,75,110,260,280,330,360,380,470,490) */
-#define umul_ppmm(w1, w0, u, v) \
- __asm__ ("! Inlined umul_ppmm\n" \
-" wr %%g0,%2,%%y ! SPARC has 0-3 delay insn after a wr\n"\
-" sra %3,31,%%o5 ! Don't move this insn\n" \
-" and %2,%%o5,%%o5 ! Don't move this insn\n" \
-" andcc %%g0,0,%%g1 ! Don't move this insn\n" \
-" mulscc %%g1,%3,%%g1\n" \
-" mulscc %%g1,%3,%%g1\n" \
-" mulscc %%g1,%3,%%g1\n" \
-" mulscc %%g1,%3,%%g1\n" \
-" mulscc %%g1,%3,%%g1\n" \
-" mulscc %%g1,%3,%%g1\n" \
-" mulscc %%g1,%3,%%g1\n" \
-" mulscc %%g1,%3,%%g1\n" \
-" mulscc %%g1,%3,%%g1\n" \
-" mulscc %%g1,%3,%%g1\n" \
-" mulscc %%g1,%3,%%g1\n" \
-" mulscc %%g1,%3,%%g1\n" \
-" mulscc %%g1,%3,%%g1\n" \
-" mulscc %%g1,%3,%%g1\n" \
-" mulscc %%g1,%3,%%g1\n" \
-" mulscc %%g1,%3,%%g1\n" \
-" mulscc %%g1,%3,%%g1\n" \
-" mulscc %%g1,%3,%%g1\n" \
-" mulscc %%g1,%3,%%g1\n" \
-" mulscc %%g1,%3,%%g1\n" \
-" mulscc %%g1,%3,%%g1\n" \
-" mulscc %%g1,%3,%%g1\n" \
-" mulscc %%g1,%3,%%g1\n" \
-" mulscc %%g1,%3,%%g1\n" \
-" mulscc %%g1,%3,%%g1\n" \
-" mulscc %%g1,%3,%%g1\n" \
-" mulscc %%g1,%3,%%g1\n" \
-" mulscc %%g1,%3,%%g1\n" \
-" mulscc %%g1,%3,%%g1\n" \
-" mulscc %%g1,%3,%%g1\n" \
-" mulscc %%g1,%3,%%g1\n" \
-" mulscc %%g1,%3,%%g1\n" \
-" mulscc %%g1,0,%%g1\n" \
-" add %%g1,%%o5,%0\n" \
-" rd %%y,%1" \
- : "=r" ((USItype) (w1)), \
- "=r" ((USItype) (w0)) \
- : "%rI" ((USItype) (u)), \
- "r" ((USItype) (v)) \
- : "g1", "o5" __AND_CLOBBER_CC)
-#define UMUL_TIME 39 /* 39 instructions */
-/* It's quite necessary to add this much assembler for the sparc.
- The default udiv_qrnnd (in C) is more than 10 times slower! */
-#define udiv_qrnnd(__q, __r, __n1, __n0, __d) \
- __asm__ ("! Inlined udiv_qrnnd\n" \
-" mov 32,%%g1\n" \
-" subcc %1,%2,%%g0\n" \
-"1: bcs 5f\n" \
-" addxcc %0,%0,%0 ! shift n1n0 and a q-bit in lsb\n" \
-" sub %1,%2,%1 ! this kills msb of n\n" \
-" addx %1,%1,%1 ! so this can't give carry\n" \
-" subcc %%g1,1,%%g1\n" \
-"2: bne 1b\n" \
-" subcc %1,%2,%%g0\n" \
-" bcs 3f\n" \
-" addxcc %0,%0,%0 ! shift n1n0 and a q-bit in lsb\n" \
-" b 3f\n" \
-" sub %1,%2,%1 ! this kills msb of n\n" \
-"4: sub %1,%2,%1\n" \
-"5: addxcc %1,%1,%1\n" \
-" bcc 2b\n" \
-" subcc %%g1,1,%%g1\n" \
-"! Got carry from n. Subtract next step to cancel this carry.\n" \
-" bne 4b\n" \
-" addcc %0,%0,%0 ! shift n1n0 and a 0-bit in lsb\n" \
-" sub %1,%2,%1\n" \
-"3: xnor %0,0,%0\n" \
-" ! End of inline udiv_qrnnd" \
- : "=&r" ((USItype) (__q)), \
- "=&r" ((USItype) (__r)) \
- : "r" ((USItype) (__d)), \
- "1" ((USItype) (__n1)), \
- "0" ((USItype) (__n0)) : "g1" __AND_CLOBBER_CC)
-#define UDIV_TIME (3+7*32) /* 7 instructions/iteration. 32 iterations. */
-#endif /* __sparclite__ */
-#endif /* __sparc_v8__ */
-#endif /* sparc32 */
-
-#if ((defined (__sparc__) && defined (__arch64__)) || defined (__sparcv9)) \
- && W_TYPE_SIZE == 64
-#define add_ssaaaa(sh, sl, ah, al, bh, bl) \
- __asm__ ("addcc %r4,%5,%1\n\t" \
- "add %r2,%3,%0\n\t" \
- "bcs,a,pn %%xcc, 1f\n\t" \
- "add %0, 1, %0\n" \
- "1:" \
- : "=r" ((UDItype)(sh)), \
- "=&r" ((UDItype)(sl)) \
- : "%rJ" ((UDItype)(ah)), \
- "rI" ((UDItype)(bh)), \
- "%rJ" ((UDItype)(al)), \
- "rI" ((UDItype)(bl)) \
- __CLOBBER_CC)
-
-#define sub_ddmmss(sh, sl, ah, al, bh, bl) \
- __asm__ ("subcc %r4,%5,%1\n\t" \
- "sub %r2,%3,%0\n\t" \
- "bcs,a,pn %%xcc, 1f\n\t" \
- "sub %0, 1, %0\n\t" \
- "1:" \
- : "=r" ((UDItype)(sh)), \
- "=&r" ((UDItype)(sl)) \
- : "rJ" ((UDItype)(ah)), \
- "rI" ((UDItype)(bh)), \
- "rJ" ((UDItype)(al)), \
- "rI" ((UDItype)(bl)) \
- __CLOBBER_CC)
-
-#define umul_ppmm(wh, wl, u, v) \
- do { \
- UDItype tmp1, tmp2, tmp3, tmp4; \
- __asm__ __volatile__ ( \
- "srl %7,0,%3\n\t" \
- "mulx %3,%6,%1\n\t" \
- "srlx %6,32,%2\n\t" \
- "mulx %2,%3,%4\n\t" \
- "sllx %4,32,%5\n\t" \
- "srl %6,0,%3\n\t" \
- "sub %1,%5,%5\n\t" \
- "srlx %5,32,%5\n\t" \
- "addcc %4,%5,%4\n\t" \
- "srlx %7,32,%5\n\t" \
- "mulx %3,%5,%3\n\t" \
- "mulx %2,%5,%5\n\t" \
- "sethi %%hi(0x80000000),%2\n\t" \
- "addcc %4,%3,%4\n\t" \
- "srlx %4,32,%4\n\t" \
- "add %2,%2,%2\n\t" \
- "movcc %%xcc,%%g0,%2\n\t" \
- "addcc %5,%4,%5\n\t" \
- "sllx %3,32,%3\n\t" \
- "add %1,%3,%1\n\t" \
- "add %5,%2,%0" \
- : "=r" ((UDItype)(wh)), \
- "=&r" ((UDItype)(wl)), \
- "=&r" (tmp1), "=&r" (tmp2), "=&r" (tmp3), "=&r" (tmp4) \
- : "r" ((UDItype)(u)), \
- "r" ((UDItype)(v)) \
- __CLOBBER_CC); \
- } while (0)
-#define UMUL_TIME 96
-#define UDIV_TIME 230
-#endif /* sparc64 */
-
-#if defined (__vax__) && W_TYPE_SIZE == 32
-#define add_ssaaaa(sh, sl, ah, al, bh, bl) \
- __asm__ ("addl2 %5,%1\n\tadwc %3,%0" \
- : "=g" ((USItype) (sh)), \
- "=&g" ((USItype) (sl)) \
- : "%0" ((USItype) (ah)), \
- "g" ((USItype) (bh)), \
- "%1" ((USItype) (al)), \
- "g" ((USItype) (bl)))
-#define sub_ddmmss(sh, sl, ah, al, bh, bl) \
- __asm__ ("subl2 %5,%1\n\tsbwc %3,%0" \
- : "=g" ((USItype) (sh)), \
- "=&g" ((USItype) (sl)) \
- : "0" ((USItype) (ah)), \
- "g" ((USItype) (bh)), \
- "1" ((USItype) (al)), \
- "g" ((USItype) (bl)))
-#define umul_ppmm(xh, xl, m0, m1) \
- do { \
- union { \
- UDItype __ll; \
- struct {USItype __l, __h;} __i; \
- } __xx; \
- USItype __m0 = (m0), __m1 = (m1); \
- __asm__ ("emul %1,%2,$0,%0" \
- : "=r" (__xx.__ll) \
- : "g" (__m0), \
- "g" (__m1)); \
- (xh) = __xx.__i.__h; \
- (xl) = __xx.__i.__l; \
- (xh) += ((((SItype) __m0 >> 31) & __m1) \
- + (((SItype) __m1 >> 31) & __m0)); \
- } while (0)
-#define sdiv_qrnnd(q, r, n1, n0, d) \
- do { \
- union {DItype __ll; \
- struct {SItype __l, __h;} __i; \
- } __xx; \
- __xx.__i.__h = n1; __xx.__i.__l = n0; \
- __asm__ ("ediv %3,%2,%0,%1" \
- : "=g" (q), "=g" (r) \
- : "g" (__xx.__ll), "g" (d)); \
- } while (0)
-#endif /* __vax__ */
-
-#ifdef _TMS320C6X
-#define add_ssaaaa(sh, sl, ah, al, bh, bl) \
- do \
- { \
- UDItype __ll; \
- __asm__ ("addu .l1 %1, %2, %0" \
- : "=a" (__ll) : "a" (al), "a" (bl)); \
- (sl) = (USItype)__ll; \
- (sh) = ((USItype)(__ll >> 32)) + (ah) + (bh); \
- } \
- while (0)
-
-#ifdef _TMS320C6400_PLUS
-#define __umulsidi3(u,v) ((UDItype)(USItype)u*(USItype)v)
-#define umul_ppmm(w1, w0, u, v) \
- do { \
- UDItype __x = (UDItype) (USItype) (u) * (USItype) (v); \
- (w1) = (USItype) (__x >> 32); \
- (w0) = (USItype) (__x); \
- } while (0)
-#endif /* _TMS320C6400_PLUS */
-
-#define count_leading_zeros(count, x) ((count) = __builtin_clz (x))
-#ifdef _TMS320C6400
-#define count_trailing_zeros(count, x) ((count) = __builtin_ctz (x))
-#endif
-#define UMUL_TIME 4
-#define UDIV_TIME 40
-#endif /* _TMS320C6X */
-
-#if defined (__xtensa__) && W_TYPE_SIZE == 32
-/* This code is not Xtensa-configuration-specific, so rely on the compiler
- to expand builtin functions depending on what configuration features
- are available. This avoids library calls when the operation can be
- performed in-line. */
-#define umul_ppmm(w1, w0, u, v) \
- do { \
- DWunion __w; \
- __w.ll = __builtin_umulsidi3 (u, v); \
- w1 = __w.s.high; \
- w0 = __w.s.low; \
- } while (0)
-#define __umulsidi3(u, v) __builtin_umulsidi3 (u, v)
-#define count_leading_zeros(COUNT, X) ((COUNT) = __builtin_clz (X))
-#define count_trailing_zeros(COUNT, X) ((COUNT) = __builtin_ctz (X))
-#endif /* __xtensa__ */
-
-#if defined xstormy16
-extern UHItype __stormy16_count_leading_zeros (UHItype);
-#define count_leading_zeros(count, x) \
- do \
- { \
- UHItype size; \
- \
- /* We assume that W_TYPE_SIZE is a multiple of 16... */ \
- for ((count) = 0, size = W_TYPE_SIZE; size; size -= 16) \
- { \
- UHItype c; \
- \
- c = __clzhi2 ((x) >> (size - 16)); \
- (count) += c; \
- if (c != 16) \
- break; \
- } \
- } \
- while (0)
-#define COUNT_LEADING_ZEROS_0 W_TYPE_SIZE
-#endif
-
-#if defined (__z8000__) && W_TYPE_SIZE == 16
-#define add_ssaaaa(sh, sl, ah, al, bh, bl) \
- __asm__ ("add %H1,%H5\n\tadc %H0,%H3" \
- : "=r" ((unsigned int)(sh)), \
- "=&r" ((unsigned int)(sl)) \
- : "%0" ((unsigned int)(ah)), \
- "r" ((unsigned int)(bh)), \
- "%1" ((unsigned int)(al)), \
- "rQR" ((unsigned int)(bl)))
-#define sub_ddmmss(sh, sl, ah, al, bh, bl) \
- __asm__ ("sub %H1,%H5\n\tsbc %H0,%H3" \
- : "=r" ((unsigned int)(sh)), \
- "=&r" ((unsigned int)(sl)) \
- : "0" ((unsigned int)(ah)), \
- "r" ((unsigned int)(bh)), \
- "1" ((unsigned int)(al)), \
- "rQR" ((unsigned int)(bl)))
-#define umul_ppmm(xh, xl, m0, m1) \
- do { \
- union {long int __ll; \
- struct {unsigned int __h, __l;} __i; \
- } __xx; \
- unsigned int __m0 = (m0), __m1 = (m1); \
- __asm__ ("mult %S0,%H3" \
- : "=r" (__xx.__i.__h), \
- "=r" (__xx.__i.__l) \
- : "%1" (__m0), \
- "rQR" (__m1)); \
- (xh) = __xx.__i.__h; (xl) = __xx.__i.__l; \
- (xh) += ((((signed int) __m0 >> 15) & __m1) \
- + (((signed int) __m1 >> 15) & __m0)); \
- } while (0)
-#endif /* __z8000__ */
-
-#endif /* __GNUC__ */
-
-/* If this machine has no inline assembler, use C macros. */
-
-#if !defined (add_ssaaaa)
-#define add_ssaaaa(sh, sl, ah, al, bh, bl) \
- do { \
- UWtype __x; \
- __x = (al) + (bl); \
- (sh) = (ah) + (bh) + (__x < (al)); \
- (sl) = __x; \
- } while (0)
-#endif
-
-#if !defined (sub_ddmmss)
-#define sub_ddmmss(sh, sl, ah, al, bh, bl) \
- do { \
- UWtype __x; \
- __x = (al) - (bl); \
- (sh) = (ah) - (bh) - (__x > (al)); \
- (sl) = __x; \
- } while (0)
-#endif
-
-/* If we lack umul_ppmm but have smul_ppmm, define umul_ppmm in terms of
- smul_ppmm. */
-#if !defined (umul_ppmm) && defined (smul_ppmm)
-#define umul_ppmm(w1, w0, u, v) \
- do { \
- UWtype __w1; \
- UWtype __xm0 = (u), __xm1 = (v); \
- smul_ppmm (__w1, w0, __xm0, __xm1); \
- (w1) = __w1 + (-(__xm0 >> (W_TYPE_SIZE - 1)) & __xm1) \
- + (-(__xm1 >> (W_TYPE_SIZE - 1)) & __xm0); \
- } while (0)
-#endif
-
-/* If we still don't have umul_ppmm, define it using plain C. */
-#if !defined (umul_ppmm)
-#define umul_ppmm(w1, w0, u, v) \
- do { \
- UWtype __x0, __x1, __x2, __x3; \
- UHWtype __ul, __vl, __uh, __vh; \
- \
- __ul = __ll_lowpart (u); \
- __uh = __ll_highpart (u); \
- __vl = __ll_lowpart (v); \
- __vh = __ll_highpart (v); \
- \
- __x0 = (UWtype) __ul * __vl; \
- __x1 = (UWtype) __ul * __vh; \
- __x2 = (UWtype) __uh * __vl; \
- __x3 = (UWtype) __uh * __vh; \
- \
- __x1 += __ll_highpart (__x0);/* this can't give carry */ \
- __x1 += __x2; /* but this indeed can */ \
- if (__x1 < __x2) /* did we get it? */ \
- __x3 += __ll_B; /* yes, add it in the proper pos. */ \
- \
- (w1) = __x3 + __ll_highpart (__x1); \
- (w0) = __ll_lowpart (__x1) * __ll_B + __ll_lowpart (__x0); \
- } while (0)
-#endif
-
-#if !defined (__umulsidi3)
-#define __umulsidi3(u, v) \
- ({DWunion __w; \
- umul_ppmm (__w.s.high, __w.s.low, u, v); \
- __w.ll; })
-#endif
-
-/* Define this unconditionally, so it can be used for debugging. */
-#define __udiv_qrnnd_c(q, r, n1, n0, d) \
- do { \
- UWtype __d1, __d0, __q1, __q0; \
- UWtype __r1, __r0, __m; \
- __d1 = __ll_highpart (d); \
- __d0 = __ll_lowpart (d); \
- \
- __r1 = (n1) % __d1; \
- __q1 = (n1) / __d1; \
- __m = (UWtype) __q1 * __d0; \
- __r1 = __r1 * __ll_B | __ll_highpart (n0); \
- if (__r1 < __m) \
- { \
- __q1--, __r1 += (d); \
- if (__r1 >= (d)) /* i.e. we didn't get carry when adding to __r1 */\
- if (__r1 < __m) \
- __q1--, __r1 += (d); \
- } \
- __r1 -= __m; \
- \
- __r0 = __r1 % __d1; \
- __q0 = __r1 / __d1; \
- __m = (UWtype) __q0 * __d0; \
- __r0 = __r0 * __ll_B | __ll_lowpart (n0); \
- if (__r0 < __m) \
- { \
- __q0--, __r0 += (d); \
- if (__r0 >= (d)) \
- if (__r0 < __m) \
- __q0--, __r0 += (d); \
- } \
- __r0 -= __m; \
- \
- (q) = (UWtype) __q1 * __ll_B | __q0; \
- (r) = __r0; \
- } while (0)
-
-/* If the processor has no udiv_qrnnd but sdiv_qrnnd, go through
- __udiv_w_sdiv (defined in libgcc or elsewhere). */
-#if !defined (udiv_qrnnd) && defined (sdiv_qrnnd)
-#define udiv_qrnnd(q, r, nh, nl, d) \
- do { \
- USItype __r; \
- (q) = __udiv_w_sdiv (&__r, nh, nl, d); \
- (r) = __r; \
- } while (0)
-#endif
-
-/* If udiv_qrnnd was not defined for this processor, use __udiv_qrnnd_c. */
-#if !defined (udiv_qrnnd)
-#define UDIV_NEEDS_NORMALIZATION 1
-#define udiv_qrnnd __udiv_qrnnd_c
-#endif
-
-#if !defined (count_leading_zeros)
-#define count_leading_zeros(count, x) \
- do { \
- UWtype __xr = (x); \
- UWtype __a; \
- \
- if (W_TYPE_SIZE <= 32) \
- { \
- __a = __xr < ((UWtype)1<<2*__BITS4) \
- ? (__xr < ((UWtype)1<<__BITS4) ? 0 : __BITS4) \
- : (__xr < ((UWtype)1<<3*__BITS4) ? 2*__BITS4 : 3*__BITS4); \
- } \
- else \
- { \
- for (__a = W_TYPE_SIZE - 8; __a > 0; __a -= 8) \
- if (((__xr >> __a) & 0xff) != 0) \
- break; \
- } \
- \
- (count) = W_TYPE_SIZE - (__clz_tab[__xr >> __a] + __a); \
- } while (0)
-#define COUNT_LEADING_ZEROS_0 W_TYPE_SIZE
-#endif
-
-#if !defined (count_trailing_zeros)
-/* Define count_trailing_zeros using count_leading_zeros. The latter might be
- defined in asm, but if it is not, the C version above is good enough. */
-#define count_trailing_zeros(count, x) \
- do { \
- UWtype __ctz_x = (x); \
- UWtype __ctz_c; \
- count_leading_zeros (__ctz_c, __ctz_x & -__ctz_x); \
- (count) = W_TYPE_SIZE - 1 - __ctz_c; \
- } while (0)
-#endif
-
-#ifndef UDIV_NEEDS_NORMALIZATION
-#define UDIV_NEEDS_NORMALIZATION 0
-#endif
diff --git a/gcc/lto-opts.c b/gcc/lto-opts.c
index 296739ed738..47f73aa01c6 100644
--- a/gcc/lto-opts.c
+++ b/gcc/lto-opts.c
@@ -1,6 +1,6 @@
/* LTO IL options.
- Copyright 2009, 2010, 2011 Free Software Foundation, Inc.
+ Copyright 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
Contributed by Simon Baldwin <simonb@google.com>
This file is part of GCC.
@@ -33,390 +33,89 @@ along with GCC; see the file COPYING3. If not see
#include "common/common-target.h"
#include "diagnostic.h"
#include "lto-streamer.h"
-
-/* When a file is initially compiled, the options used when generating
- the IL are not necessarily the same as those used when linking the
- objects into the final executable. In general, most build systems
- will proceed with something along the lines of:
-
- $ gcc <cc-flags> -flto -c f1.c -o f1.o
- $ gcc <cc-flags> -flto -c f2.c -o f2.o
- ...
- $ gcc <cc-flags> -flto -c fN.c -o fN.o
-
- And the final link may or may not include the same <cc-flags> used
- to generate the initial object files:
-
- $ gcc <ld-flags> -flto -o prog f1.o ... fN.o
-
- Since we will be generating final code during the link step, some
- of the flags used during the compile step need to be re-applied
- during the link step. For instance, flags in the -m family.
-
- The idea is to save a selected set of <cc-flags> in a special
- section of the initial object files. This section is then read
- during linking and the options re-applied.
-
- FIXME lto. Currently the scheme is limited in that only the
- options saved on the first object file (f1.o) are read back during
- the link step. This means that the options used to compile f1.o
- will be applied to ALL the object files in the final link step.
- More work needs to be done to implement a merging and validation
- mechanism, as this will not be enough for all cases. */
-
-/* Saved options hold the type of the option (currently CL_TARGET or
- CL_COMMON), and the code, argument, and value. */
-
-typedef struct GTY(()) opt_d
-{
- unsigned int type;
- size_t code;
- char *arg;
- int value;
-} opt_t;
-
-DEF_VEC_O (opt_t);
-DEF_VEC_ALLOC_O (opt_t, heap);
-
-
-/* Options are held in two vectors, one for those registered by
- command line handling code, and the other for those read in from
- any LTO IL input. */
-static VEC(opt_t, heap) *user_options = NULL;
-static VEC(opt_t, heap) *file_options = NULL;
-
-/* Iterate FROM in reverse, writing option codes not yet in CODES into *TO.
- Mark each new option code encountered in CODES. */
-
-static void
-reverse_iterate_options (VEC(opt_t, heap) *from, VEC(opt_t, heap) **to,
- bitmap codes)
-{
- int i;
-
- for (i = VEC_length (opt_t, from); i > 0; i--)
- {
- const opt_t *const o = VEC_index (opt_t, from, i - 1);
-
- if (bitmap_set_bit (codes, o->code))
- VEC_safe_push (opt_t, heap, *to, o);
- }
-}
-
-/* Concatenate options vectors FIRST and SECOND, rationalize so that only the
- final of any given option remains, and return the result. */
-
-static VEC(opt_t, heap) *
-concatenate_options (VEC(opt_t, heap) *first, VEC(opt_t, heap) *second)
-{
- VEC(opt_t, heap) *results = NULL;
- bitmap codes = lto_bitmap_alloc ();
-
- reverse_iterate_options (second, &results, codes);
- reverse_iterate_options (first, &results, codes);
-
- lto_bitmap_free (codes);
- return results;
-}
-
-/* Clear the options vector in *OPTS_P and set it to NULL. */
-
-static void
-clear_options (VEC(opt_t, heap) **opts_p)
-{
- int i;
- opt_t *o;
-
- FOR_EACH_VEC_ELT (opt_t, *opts_p, i, o)
- free (o->arg);
-
- VEC_free (opt_t, heap, *opts_p);
-}
-
-/* Write LENGTH bytes from ADDR to STREAM. */
-
-static void
-output_data_stream (struct lto_output_stream *stream,
- const void *addr, size_t length)
-{
- lto_output_data_stream (stream, addr, length);
-}
-
-/* Write string STRING to STREAM. */
-
-static void
-output_string_stream (struct lto_output_stream *stream, const char *string)
-{
- bool flag = false;
-
- if (string != NULL)
- {
- const size_t length = strlen (string);
-
- flag = true;
- output_data_stream (stream, &flag, sizeof (flag));
- output_data_stream (stream, &length, sizeof (length));
- output_data_stream (stream, string, length);
- }
- else
- output_data_stream (stream, &flag, sizeof (flag));
-}
-
-/* Return a string from IB. The string is allocated, and the caller is
- responsible for freeing it. */
-
-static char *
-input_string_block (struct lto_input_block *ib)
-{
- bool flag;
-
- lto_input_data_block (ib, &flag, sizeof (flag));
- if (flag)
- {
- size_t length;
- char *string;
-
- lto_input_data_block (ib, &length, sizeof (length));
- string = (char *) xcalloc (1, length + 1);
- lto_input_data_block (ib, string, length);
-
- return string;
- }
- else
- return NULL;
-}
-
-/* Return true if this option is one we need to save in LTO output files.
- At present, we pass along all target options, and common options that
- involve position independent code.
-
- TODO This list of options requires expansion and rationalization.
- Among others, optimization options may well be appropriate here. */
-
-static bool
-register_user_option_p (size_t code, unsigned int type)
-{
- if (type == CL_TARGET)
- return true;
- else if (type == CL_COMMON)
- {
- return (code == OPT_fPIC
- || code == OPT_fpic
- || code == OPT_fPIE
- || code == OPT_fpie
- || code == OPT_fcommon
- || code == OPT_fexceptions);
- }
-
- return false;
-}
-
-/* Note command line option with the given TYPE and CODE, ARG, and VALUE.
- If relevant to LTO, save it in the user options vector. */
-
-void
-lto_register_user_option (size_t code, const char *arg, int value,
- unsigned int type)
-{
- if (register_user_option_p (code, type))
- {
- opt_t o;
-
- o.type = type;
- o.code = code;
- if (arg != NULL)
- {
- o.arg = (char *) xmalloc (strlen (arg) + 1);
- strcpy (o.arg, arg);
- }
- else
- o.arg = NULL;
- o.value = value;
- VEC_safe_push (opt_t, heap, user_options, &o);
- }
-}
-
-/* Empty the saved user options vector. */
-
-void
-lto_clear_user_options (void)
-{
- clear_options (&user_options);
-}
-
-/* Empty the saved file options vector. */
-
-void
-lto_clear_file_options (void)
-{
- clear_options (&file_options);
-}
-
-/* Concatenate the user options and any file options read from an LTO IL
- file, and serialize them to STREAM. File options precede user options
- so that the latter override the former when reissued. */
-
-static void
-output_options (struct lto_output_stream *stream)
-{
- VEC(opt_t, heap) *opts = concatenate_options (file_options, user_options);
- const size_t length = VEC_length (opt_t, opts);
- int i;
- opt_t *o;
-
- output_data_stream (stream, &length, sizeof (length));
-
- FOR_EACH_VEC_ELT (opt_t, opts, i, o)
- {
- output_data_stream (stream, &o->type, sizeof (o->type));
- output_data_stream (stream, &o->code, sizeof (o->code));
- output_string_stream (stream, o->arg);
- output_data_stream (stream, &o->value, sizeof (o->value));
- }
-
- VEC_free (opt_t, heap, opts);
-}
+#include "toplev.h"
/* Write currently held options to an LTO IL section. */
void
lto_write_options (void)
{
- char *const section_name = lto_get_section_name (LTO_section_opts, NULL, NULL);
struct lto_output_stream stream;
- struct lto_simple_header header;
- struct lto_output_stream *header_stream;
-
- /* Targets and languages can provide defaults for -fexceptions but
- we only process user options from the command-line. Until we
- serialize out a white list of options from the new global state
- explicitly append important options as user options here. */
- if (flag_exceptions)
- lto_register_user_option (OPT_fexceptions, NULL, 1, CL_COMMON);
-
- lto_begin_section (section_name, !flag_wpa);
- free (section_name);
+ char *section_name;
+ struct obstack temporary_obstack;
+ unsigned int i, j;
+ char *args;
+ section_name = lto_get_section_name (LTO_section_opts, NULL, NULL);
+ lto_begin_section (section_name, false);
memset (&stream, 0, sizeof (stream));
- output_options (&stream);
- memset (&header, 0, sizeof (header));
- header.lto_header.major_version = LTO_major_version;
- header.lto_header.minor_version = LTO_minor_version;
- header.lto_header.section_type = LTO_section_opts;
-
- header.compressed_size = 0;
- header.main_size = stream.total_size;
-
- header_stream = ((struct lto_output_stream *)
- xcalloc (1, sizeof (*header_stream)));
- lto_output_data_stream (header_stream, &header, sizeof (header));
- lto_write_stream (header_stream);
- free (header_stream);
-
- lto_write_stream (&stream);
- lto_end_section ();
-}
-
-/* Unserialize an options vector from IB, and append to file_options. */
-
-static void
-input_options (struct lto_input_block *ib)
-{
- size_t length, i;
-
- lto_input_data_block (ib, &length, sizeof (length));
-
- for (i = 0; i < length; i++)
+ obstack_init (&temporary_obstack);
+ for (i = 1; i < save_decoded_options_count; ++i)
{
- opt_t o;
-
- lto_input_data_block (ib, &o.type, sizeof (o.type));
- lto_input_data_block (ib, &o.code, sizeof (o.code));
- o.arg = input_string_block (ib);
- lto_input_data_block (ib, &o.value, sizeof (o.value));
- VEC_safe_push (opt_t, heap, file_options, &o);
- }
-}
-
-/* Read options from an LTO IL section. */
-
-void
-lto_read_file_options (struct lto_file_decl_data *file_data)
-{
- size_t len, l, skip;
- const char *data, *p;
- const struct lto_simple_header *header;
- int32_t opts_offset;
- struct lto_input_block ib;
-
- data = lto_get_section_data (file_data, LTO_section_opts, NULL, &len);
- if (!data)
- return;
-
- /* Option could be multiple sections merged (through ld -r)
- Keep reading all options. This is ok right now because
- the options just get mashed together anyways.
- This will have to be done differently once lto-opts knows
- how to associate options with different files. */
- l = len;
- p = data;
- do
- {
- header = (const struct lto_simple_header *) p;
- opts_offset = sizeof (*header);
-
- lto_check_version (header->lto_header.major_version,
- header->lto_header.minor_version);
-
- LTO_INIT_INPUT_BLOCK (ib, p + opts_offset, 0, header->main_size);
- input_options (&ib);
-
- skip = header->main_size + opts_offset;
- l -= skip;
- p += skip;
- }
- while (l > 0);
-
- lto_free_section_data (file_data, LTO_section_opts, 0, data, len);
-}
-
-/* Concatenate the user options and any file options read from an LTO IL
- file, and reissue them as if all had just been read in from the command
- line. As with serialization, file options precede user options. */
-
-void
-lto_reissue_options (void)
-{
- VEC(opt_t, heap) *opts = concatenate_options (file_options, user_options);
- int i;
- opt_t *o;
+ struct cl_decoded_option *option = &save_decoded_options[i];
+ const char *q, *p;
+
+ /* Skip frontend and driver specific options here. */
+ if (!(cl_options[option->opt_index].flags & (CL_COMMON|CL_TARGET|CL_LTO)))
+ continue;
+
+ /* Drop options created from the gcc driver that will be rejected
+ when passed on to the driver again. */
+ if (cl_options[option->opt_index].cl_reject_driver)
+ continue;
+
+ /* Also drop all options that are handled by the driver as well,
+ which includes things like -o and -v or -fhelp for example.
+ We do not need those. Also drop all diagnostic options. */
+ if (cl_options[option->opt_index].flags & (CL_DRIVER|CL_WARNING))
+ continue;
+
+ /* Skip explicitly some common options that we do not need. */
+ switch (option->opt_index)
+ {
+ case OPT_dumpbase:
+ case OPT_SPECIAL_input_file:
+ continue;
- FOR_EACH_VEC_ELT (opt_t, opts, i, o)
- {
- void *flag_var = option_flag_var (o->code, &global_options);
+ default:
+ break;
+ }
- if (flag_var)
- set_option (&global_options, &global_options_set,
- o->code, o->value, o->arg,
- DK_UNSPECIFIED, UNKNOWN_LOCATION, global_dc);
+ if (i != 1)
+ obstack_grow (&temporary_obstack, " ", 1);
+ obstack_grow (&temporary_obstack, "'", 1);
+ q = option->canonical_option[0];
+ while ((p = strchr (q, '\'')))
+ {
+ obstack_grow (&temporary_obstack, q, p - q);
+ obstack_grow (&temporary_obstack, "'\\''", 4);
+ q = ++p;
+ }
+ obstack_grow (&temporary_obstack, q, strlen (q));
+ obstack_grow (&temporary_obstack, "'", 1);
- if (o->type == CL_TARGET)
+ for (j = 1; j < option->canonical_option_num_elements; ++j)
{
- struct cl_decoded_option decoded;
- generate_option (o->code, o->arg, o->value, CL_TARGET, &decoded);
- targetm_common.handle_option (&global_options, &global_options_set,
- &decoded, UNKNOWN_LOCATION);
+ obstack_grow (&temporary_obstack, " '", 2);
+ q = option->canonical_option[j];
+ while ((p = strchr (q, '\'')))
+ {
+ obstack_grow (&temporary_obstack, q, p - q);
+ obstack_grow (&temporary_obstack, "'\\''", 4);
+ q = ++p;
+ }
+ obstack_grow (&temporary_obstack, q, strlen (q));
+ obstack_grow (&temporary_obstack, "'", 1);
}
- else if (o->type == CL_COMMON)
- gcc_assert (flag_var);
- else
- gcc_unreachable ();
}
+ obstack_grow (&temporary_obstack, "\0", 1);
+ args = XOBFINISH (&temporary_obstack, char *);
+ lto_output_data_stream (&stream, args, strlen (args) + 1);
- /* Flag_shlib is usually set by finish_options, but we are issuing flag_pic
- too late. */
- if (flag_pic && !flag_pie)
- flag_shlib = 1;
- VEC_free (opt_t, heap, opts);
+ lto_write_stream (&stream);
+ lto_end_section ();
+
+ obstack_free (&temporary_obstack, NULL);
+ free (section_name);
}
diff --git a/gcc/lto-streamer.h b/gcc/lto-streamer.h
index f3c93682633..58d487485ec 100644
--- a/gcc/lto-streamer.h
+++ b/gcc/lto-streamer.h
@@ -882,12 +882,7 @@ extern GTY(()) VEC(tree,gc) *lto_global_var_decls;
/* In lto-opts.c. */
-extern void lto_register_user_option (size_t, const char *, int, unsigned int);
-extern void lto_read_file_options (struct lto_file_decl_data *);
extern void lto_write_options (void);
-extern void lto_reissue_options (void);
-void lto_clear_user_options (void);
-void lto_clear_file_options (void);
/* In lto-wpa-fixup.c */
diff --git a/gcc/lto-wrapper.c b/gcc/lto-wrapper.c
index 1bf7ded2524..5fb37624810 100644
--- a/gcc/lto-wrapper.c
+++ b/gcc/lto-wrapper.c
@@ -45,6 +45,14 @@ along with GCC; see the file COPYING3. If not see
#include "obstack.h"
#include "opts.h"
#include "options.h"
+#include "simple-object.h"
+
+/* From lto-streamer.h which we cannot include with -fkeep-inline-functions.
+ ??? Split out a lto-streamer-core.h. */
+
+#define LTO_SECTION_NAME_PREFIX ".gnu.lto_"
+
+/* End of lto-streamer.h copy. */
int debug; /* true if -save-temps. */
int verbose; /* true if -v. */
@@ -292,41 +300,122 @@ get_options_from_collect_gcc_options (const char *collect_gcc,
struct cl_decoded_option **decoded_options,
unsigned int *decoded_options_count)
{
+ struct obstack argv_obstack;
char *argv_storage;
const char **argv;
- int i, j, argc;
-
- /* Count arguments, account for the program name. */
- argc = 2;
- for (j = 0; collect_gcc_options[j] != '\0'; ++j)
- if (collect_gcc_options[j] == '\'')
- ++argc;
- if (argc % 2 != 0)
- fatal ("malformed COLLECT_GCC_OPTIONS");
-
- /* Copy the options to a argv-like array. */
- argc /= 2;
- argv = (const char **) xmalloc ((argc + 2) * sizeof (char *));
- argv[0] = collect_gcc;
+ int j, k, argc;
+
argv_storage = xstrdup (collect_gcc_options);
- for (i = 1, j = 0; argv_storage[j] != '\0'; ++j)
+ obstack_init (&argv_obstack);
+ obstack_ptr_grow (&argv_obstack, collect_gcc);
+
+ for (j = 0, k = 0; argv_storage[j] != '\0'; ++j)
{
if (argv_storage[j] == '\'')
{
- argv[i++] = &argv_storage[++j];
- while (argv_storage[j] != '\'')
- ++j;
- argv_storage[j] = '\0';
+ obstack_ptr_grow (&argv_obstack, &argv_storage[k]);
+ ++j;
+ do
+ {
+ if (argv_storage[j] == '\0')
+ fatal ("malformed COLLECT_GCC_OPTIONS");
+ else if (strncmp (&argv_storage[j], "'\\''", 4) == 0)
+ {
+ argv_storage[k++] = '\'';
+ j += 4;
+ }
+ else if (argv_storage[j] == '\'')
+ break;
+ else
+ argv_storage[k++] = argv_storage[j++];
+ }
+ while (1);
+ argv_storage[k++] = '\0';
}
}
- argv[i] = NULL;
+
+ obstack_ptr_grow (&argv_obstack, NULL);
+ argc = obstack_object_size (&argv_obstack) / sizeof (void *) - 1;
+ argv = XOBFINISH (&argv_obstack, const char **);
decode_cmdline_options_to_array (argc, (const char **)argv,
lang_mask,
decoded_options, decoded_options_count);
- free (argv);
+ obstack_free (&argv_obstack, NULL);
+}
+
+/* Append OPTION to the options array DECODED_OPTIONS with size
+ DECODED_OPTIONS_COUNT. */
+
+static void
+append_option (struct cl_decoded_option **decoded_options,
+ unsigned int *decoded_options_count,
+ struct cl_decoded_option *option)
+{
+ ++*decoded_options_count;
+ *decoded_options
+ = (struct cl_decoded_option *)
+ xrealloc (*decoded_options,
+ (*decoded_options_count
+ * sizeof (struct cl_decoded_option)));
+ memcpy (&(*decoded_options)[*decoded_options_count - 1], option,
+ sizeof (struct cl_decoded_option));
}
+/* Try to merge and complain about options FDECODED_OPTIONS when applied
+ ontop of DECODED_OPTIONS. */
+
+static void
+merge_and_complain (struct cl_decoded_option **decoded_options,
+ unsigned int *decoded_options_count,
+ struct cl_decoded_option *fdecoded_options,
+ unsigned int fdecoded_options_count)
+{
+ unsigned int i, j;
+
+ /* ??? Merge options from files. Most cases can be
+ handled by either unioning or intersecting
+ (for example -fwrapv is a case for unioning,
+ -ffast-math is for intersection). Most complaints
+ about real conflicts between different options can
+ be deferred to the compiler proper. Options that
+ we can neither safely handle by intersection nor
+ unioning would need to be complained about here.
+ Ideally we'd have a flag in the opt files that
+ tells whether to union or intersect or reject.
+ In absence of that it's unclear what a good default is.
+ It's also difficult to get positional handling correct. */
+
+ /* The following does what the old LTO option code did,
+ union all target and a selected set of common options. */
+ for (i = 0; i < fdecoded_options_count; ++i)
+ {
+ struct cl_decoded_option *foption = &fdecoded_options[i];
+ switch (foption->opt_index)
+ {
+ default:
+ if (!(cl_options[foption->opt_index].flags & CL_TARGET))
+ break;
+
+ /* Fallthru. */
+ case OPT_fPIC:
+ case OPT_fpic:
+ case OPT_fpie:
+ case OPT_fcommon:
+ case OPT_fexceptions:
+ /* Do what the old LTO code did - collect exactly one option
+ setting per OPT code, we pick the first we encounter.
+ ??? This doesn't make too much sense, but when it doesn't
+ then we should complain. */
+ for (j = 0; j < *decoded_options_count; ++j)
+ if ((*decoded_options)[j].opt_index == foption->opt_index)
+ break;
+ if (j == *decoded_options_count)
+ append_option (decoded_options, decoded_options_count, foption);
+ break;
+ }
+ }
+}
/* Execute gcc. ARGC is the number of arguments. ARGV contains the arguments. */
@@ -342,6 +431,8 @@ run_gcc (unsigned argc, char *argv[])
int parallel = 0;
int jobserver = 0;
bool no_partition = false;
+ struct cl_decoded_option *fdecoded_options = NULL;
+ unsigned int fdecoded_options_count = 0;
struct cl_decoded_option *decoded_options;
unsigned int decoded_options_count;
struct obstack argv_obstack;
@@ -359,11 +450,125 @@ run_gcc (unsigned argc, char *argv[])
&decoded_options,
&decoded_options_count);
+ /* Look at saved options in the IL files. */
+ for (i = 1; i < argc; ++i)
+ {
+ char *data, *p;
+ char *fopts;
+ int fd;
+ const char *errmsg;
+ int err;
+ off_t file_offset = 0, offset, length;
+ long loffset;
+ simple_object_read *sobj;
+ int consumed;
+ struct cl_decoded_option *f2decoded_options;
+ unsigned int f2decoded_options_count;
+ char *filename = argv[i];
+ if ((p = strrchr (argv[i], '@'))
+ && p != argv[i]
+ && sscanf (p, "@%li%n", &loffset, &consumed) >= 1
+ && strlen (p) == (unsigned int) consumed)
+ {
+ filename = XNEWVEC (char, p - argv[i] + 1);
+ memcpy (filename, argv[i], p - argv[i]);
+ filename[p - argv[i]] = '\0';
+ file_offset = (off_t) loffset;
+ }
+ fd = open (argv[i], O_RDONLY);
+ if (fd == -1)
+ continue;
+ sobj = simple_object_start_read (fd, file_offset, NULL, &errmsg, &err);
+ if (!sobj)
+ {
+ close (fd);
+ continue;
+ }
+ if (!simple_object_find_section (sobj, LTO_SECTION_NAME_PREFIX "." "opts",
+ &offset, &length, &errmsg, &err))
+ {
+ simple_object_release_read (sobj);
+ close (fd);
+ continue;
+ }
+ lseek (fd, file_offset + offset, SEEK_SET);
+ data = (char *)xmalloc (length);
+ read (fd, data, length);
+ fopts = data;
+ do
+ {
+ get_options_from_collect_gcc_options (collect_gcc,
+ fopts, CL_LANG_ALL,
+ &f2decoded_options,
+ &f2decoded_options_count);
+ if (!fdecoded_options)
+ {
+ fdecoded_options = f2decoded_options;
+ fdecoded_options_count = f2decoded_options_count;
+ }
+ else
+ merge_and_complain (&fdecoded_options,
+ &fdecoded_options_count,
+ f2decoded_options, f2decoded_options_count);
+
+ fopts += strlen (fopts) + 1;
+ }
+ while (fopts - data < length);
+
+ free (data);
+ simple_object_release_read (sobj);
+ close (fd);
+ }
+
/* Initalize the common arguments for the driver. */
obstack_init (&argv_obstack);
obstack_ptr_grow (&argv_obstack, collect_gcc);
obstack_ptr_grow (&argv_obstack, "-xlto");
obstack_ptr_grow (&argv_obstack, "-c");
+
+ /* Append compiler driver arguments as far as they were merged. */
+ for (j = 1; j < fdecoded_options_count; ++j)
+ {
+ struct cl_decoded_option *option = &fdecoded_options[j];
+
+ /* File options have been properly filtered by lto-opts.c. */
+ switch (option->opt_index)
+ {
+ /* Drop arguments that we want to take from the link line. */
+ case OPT_flto_:
+ case OPT_flto:
+ case OPT_flto_partition_none:
+ case OPT_flto_partition_1to1:
+ case OPT_flto_partition_balanced:
+ continue;
+
+ default:
+ break;
+ }
+
+ /* For now do what the original LTO option code was doing - pass
+ on any CL_TARGET flag and a few selected others. */
+ switch (option->opt_index)
+ {
+ case OPT_fPIC:
+ case OPT_fpic:
+ case OPT_fpie:
+ case OPT_fcommon:
+ case OPT_fexceptions:
+ break;
+
+ default:
+ if (!(cl_options[option->opt_index].flags & CL_TARGET))
+ continue;
+ }
+
+ /* Pass the option on. */
+ for (i = 0; i < option->canonical_option_num_elements; ++i)
+ obstack_ptr_grow (&argv_obstack, option->canonical_option[i]);
+ }
+
+ /* Append linker driver arguments. Compiler options from the linker
+ driver arguments will override / merge with those from the compiler. */
for (j = 1; j < decoded_options_count; ++j)
{
struct cl_decoded_option *option = &decoded_options[j];
diff --git a/gcc/lto/ChangeLog b/gcc/lto/ChangeLog
index 5de85dd4f33..d8bbd9ca8dd 100644
--- a/gcc/lto/ChangeLog
+++ b/gcc/lto/ChangeLog
@@ -1,3 +1,10 @@
+2011-11-03 Richard Guenther <rguenther@suse.de>
+
+ PR lto/44965
+ * lto-lang.c (lto_post_options): Do not read file options.
+ * lto.c (lto_read_all_file_options): Remove.
+ (lto_init): Call lto_set_in_hooks here.
+
2011-10-09 Jan Hubicka <jh@suse.cz>
* lto.c (node_cmp, varpool_node_cmp): New functions.
diff --git a/gcc/lto/lto-lang.c b/gcc/lto/lto-lang.c
index 4a5f6fe8ab5..c702b9a2d24 100644
--- a/gcc/lto/lto-lang.c
+++ b/gcc/lto/lto-lang.c
@@ -692,8 +692,6 @@ lto_post_options (const char **pfilename ATTRIBUTE_UNUSED)
support. */
flag_excess_precision_cmdline = EXCESS_PRECISION_FAST;
- lto_read_all_file_options ();
-
/* Initialize the compiler back end. */
return false;
}
diff --git a/gcc/lto/lto.c b/gcc/lto/lto.c
index c50a97ec205..3b35604af8d 100644
--- a/gcc/lto/lto.c
+++ b/gcc/lto/lto.c
@@ -2494,60 +2494,6 @@ lto_fixup_decls (struct lto_file_decl_data **files)
}
}
-/* Read the options saved from each file in the command line. Called
- from lang_hooks.post_options which is called by process_options
- right before all the options are used to initialize the compiler.
- This assumes that decode_options has already run, so the
- num_in_fnames and in_fnames are properly set.
-
- Note that this assumes that all the files had been compiled with
- the same options, which is not a good assumption. In general,
- options ought to be read from all the files in the set and merged.
- However, it is still unclear what the merge rules should be. */
-
-void
-lto_read_all_file_options (void)
-{
- size_t i;
-
- /* Clear any file options currently saved. */
- lto_clear_file_options ();
-
- /* Set the hooks to read ELF sections. */
- lto_set_in_hooks (NULL, get_section_data, free_section_data);
- if (!quiet_flag)
- fprintf (stderr, "Reading command line options:");
-
- for (i = 0; i < num_in_fnames; i++)
- {
- struct lto_file_decl_data *file_data;
- lto_file *file = lto_obj_file_open (in_fnames[i], false);
- if (!file)
- break;
- if (!quiet_flag)
- {
- fprintf (stderr, " %s", in_fnames[i]);
- fflush (stderr);
- }
-
- file_data = XCNEW (struct lto_file_decl_data);
- file_data->file_name = file->filename;
- file_data->section_hash_table = lto_obj_build_section_table (file, NULL);
-
- lto_read_file_options (file_data);
-
- lto_obj_file_close (file);
- htab_delete (file_data->section_hash_table);
- free (file_data);
- }
-
- if (!quiet_flag)
- fprintf (stderr, "\n");
-
- /* Apply globally the options read from all the files. */
- lto_reissue_options ();
-}
-
static GTY((length ("lto_stats.num_input_files + 1"))) struct lto_file_decl_data **all_file_decl_data;
/* Turn file datas for sub files into a single array, so that they look
@@ -2921,6 +2867,7 @@ lto_init (void)
lto_process_name ();
lto_streamer_hooks_init ();
lto_reader_init ();
+ lto_set_in_hooks (NULL, get_section_data, free_section_data);
memset (&lto_stats, 0, sizeof (lto_stats));
bitmap_obstack_initialize (NULL);
gimple_register_cfg_hooks ();
diff --git a/gcc/mkconfig.sh b/gcc/mkconfig.sh
index d96af1d2f2b..e93d45fabb3 100644
--- a/gcc/mkconfig.sh
+++ b/gcc/mkconfig.sh
@@ -89,9 +89,8 @@ if [ -n "$HEADERS" ]; then
fi
# If this is tm.h, now include insn-flags.h only if IN_GCC is defined
-# but neither GENERATOR_FILE nor USED_FOR_TARGET is defined. Also
-# include libgcc_tm.h if USED_FOR_TARGET is defined. (Much of this is
-# temporary.)
+# but neither GENERATOR_FILE nor USED_FOR_TARGET is defined. (Much of this
+# is temporary.)
case $output in
tm.h )
@@ -99,9 +98,6 @@ case $output in
#if defined IN_GCC && !defined GENERATOR_FILE && !defined USED_FOR_TARGET
# include "insn-flags.h"
#endif
-#ifdef USED_FOR_TARGET
-# include "libgcc_tm.h"
-#endif
EOF
;;
esac
diff --git a/gcc/mkmap-flat.awk b/gcc/mkmap-flat.awk
deleted file mode 100644
index ec5e1fdf513..00000000000
--- a/gcc/mkmap-flat.awk
+++ /dev/null
@@ -1,109 +0,0 @@
-# Generate a flat list of symbols to export.
-# Copyright (C) 2007, 2008, 2009, 2011 Free Software Foundation, Inc.
-# Contributed by Richard Henderson <rth@cygnus.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/>.
-
-# Options:
-# "-v leading_underscore=1" : Symbols in map need leading underscore.
-# "-v osf_export=1" : Create -input file for Tru64 UNIX linker
-# instead of map file.
-# "-v pe_dll=1" : Create .DEF file for Windows PECOFF
-# DLL link instead of map file.
-
-BEGIN {
- state = "nm";
- excluding = 0;
- if (leading_underscore)
- prefix = "_";
- else
- prefix = "";
-}
-
-# Remove comment and blank lines.
-/^ *#/ || /^ *$/ {
- next;
-}
-
-# We begin with nm input. Collect the set of symbols that are present
-# so that we can elide undefined symbols.
-
-state == "nm" && /^%%/ {
- state = "ver";
- next;
-}
-
-state == "nm" && ($1 == "U" || $2 == "U") {
- next;
-}
-
-state == "nm" && NF == 3 {
- def[$3] = 1;
- next;
-}
-
-state == "nm" {
- next;
-}
-
-# Now we process a simplified variant of the Solaris symbol version
-# script. We have one symbol per line, no semicolons, simple markers
-# for beginning and ending each section, and %inherit markers for
-# describing version inheritance. A symbol may appear in more than
-# one symbol version, and the last seen takes effect.
-# The magic version name '%exclude' causes all the symbols given that
-# version to be dropped from the output (unless a later version overrides).
-
-NF == 3 && $1 == "%inherit" {
- next;
-}
-
-NF == 2 && $2 == "{" {
- if ($1 == "%exclude")
- excluding = 1;
- next;
-}
-
-$1 == "}" {
- excluding = 0;
- next;
-}
-
-{
- sym = prefix $1;
- if (excluding)
- delete export[sym];
- else
- export[sym] = 1;
- next;
-}
-
-END {
-
- if (pe_dll) {
- print "LIBRARY " pe_dll;
- print "EXPORTS";
- }
-
- for (sym in export)
- if (def[sym] || (pe_dll && def["_" sym])) {
- if (!osf_export)
- print sym;
- else
- print "-exported_symbol " sym;
- }
-}
diff --git a/gcc/mkmap-symver.awk b/gcc/mkmap-symver.awk
deleted file mode 100644
index 4877e905147..00000000000
--- a/gcc/mkmap-symver.awk
+++ /dev/null
@@ -1,136 +0,0 @@
-# Generate an ELF symbol version map a-la Solaris and GNU ld.
-# Copyright (C) 2007, 2008 Free Software Foundation, Inc.
-# Contributed by Richard Henderson <rth@cygnus.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/>.
-
-BEGIN {
- state = "nm";
- sawsymbol = 0;
- if (leading_underscore)
- prefix = "_";
- else
- prefix = "";
-}
-
-# Remove comment and blank lines.
-/^ *#/ || /^ *$/ {
- next;
-}
-
-# We begin with nm input. Collect the set of symbols that are present
-# so that we can not emit them into the final version script -- Solaris
-# complains at us if we do.
-
-state == "nm" && /^%%/ {
- state = "ver";
- next;
-}
-
-state == "nm" && ($1 == "U" || $2 == "U") {
- next;
-}
-
-state == "nm" && NF == 3 {
- split ($3, s, "@")
- def[s[1]] = 1;
- sawsymbol = 1;
- next;
-}
-
-state == "nm" {
- next;
-}
-
-# Now we process a simplified variant of the Solaris symbol version
-# script. We have one symbol per line, no semicolons, simple markers
-# for beginning and ending each section, and %inherit markers for
-# describing version inheritance. A symbol may appear in more than
-# one symbol version, and the last seen takes effect.
-# The magic version name '%exclude' causes all the symbols given that
-# version to be dropped from the output (unless a later version overrides).
-
-NF == 3 && $1 == "%inherit" {
- inherit[$2] = $3;
- next;
-}
-
-NF == 2 && $2 == "{" {
- if ($1 != "%exclude")
- libs[$1] = 1;
- thislib = $1;
- next;
-}
-
-$1 == "}" {
- thislib = "";
- next;
-}
-
-{
- sym = prefix $1;
- symbols[sym] = 1
- if (thislib != "%exclude")
- ver[sym, thislib] = 1;
- else {
- for (l in libs)
- ver[sym, l] = 0;
- }
- next;
-}
-
-END {
- if (!sawsymbol)
- {
- print "No symbols seen -- broken or mis-installed nm?" | "cat 1>&2";
- exit 1;
- }
- for (l in libs)
- output(l);
-}
-
-function output(lib) {
- if (done[lib])
- return;
- done[lib] = 1;
- if (inherit[lib])
- output(inherit[lib]);
-
- empty=1
- for (sym in symbols)
- if ((ver[sym, lib] != 0) && (sym in def))
- {
- if (empty)
- {
- printf("%s {\n", lib);
- printf(" global:\n");
- empty = 0;
- }
- printf("\t%s;\n", sym);
- }
-
- if (empty)
- {
- for (l in libs)
- if (inherit[l] == lib)
- inherit[l] = inherit[lib];
- }
- else if (inherit[lib])
- printf("} %s;\n", inherit[lib]);
- else
- printf ("\n local:\n\t*;\n};\n");
-}
diff --git a/gcc/omp-low.c b/gcc/omp-low.c
index ff36803c4e2..424c1f45b54 100644
--- a/gcc/omp-low.c
+++ b/gcc/omp-low.c
@@ -4999,7 +4999,7 @@ expand_omp_atomic_store (basic_block load_bb, tree addr)
}
/* A subroutine of expand_omp_atomic. Attempt to implement the atomic
- operation as a __sync_fetch_and_op builtin. INDEX is log2 of the
+ operation as a __atomic_fetch_op builtin. INDEX is log2 of the
size of the data type, and thus usable to find the index of the builtin
decl. Returns false if the expression is not of the proper form. */
@@ -5010,13 +5010,14 @@ expand_omp_atomic_fetch_op (basic_block load_bb,
{
enum built_in_function oldbase, newbase, tmpbase;
tree decl, itype, call;
- direct_optab optab, oldoptab, newoptab;
tree lhs, rhs;
basic_block store_bb = single_succ (load_bb);
gimple_stmt_iterator gsi;
gimple stmt;
location_t loc;
+ enum tree_code code;
bool need_old, need_new;
+ enum machine_mode imode;
/* We expect to find the following sequences:
@@ -5048,47 +5049,34 @@ expand_omp_atomic_fetch_op (basic_block load_bb,
return false;
/* Check for one of the supported fetch-op operations. */
- switch (gimple_assign_rhs_code (stmt))
+ code = gimple_assign_rhs_code (stmt);
+ switch (code)
{
case PLUS_EXPR:
case POINTER_PLUS_EXPR:
- oldbase = BUILT_IN_SYNC_FETCH_AND_ADD_N;
- newbase = BUILT_IN_SYNC_ADD_AND_FETCH_N;
- optab = sync_add_optab;
- oldoptab = sync_old_add_optab;
- newoptab = sync_new_add_optab;
+ oldbase = BUILT_IN_ATOMIC_FETCH_ADD_N;
+ newbase = BUILT_IN_ATOMIC_ADD_FETCH_N;
break;
case MINUS_EXPR:
- oldbase = BUILT_IN_SYNC_FETCH_AND_SUB_N;
- newbase = BUILT_IN_SYNC_SUB_AND_FETCH_N;
- optab = sync_add_optab;
- oldoptab = sync_old_add_optab;
- newoptab = sync_new_add_optab;
+ oldbase = BUILT_IN_ATOMIC_FETCH_SUB_N;
+ newbase = BUILT_IN_ATOMIC_SUB_FETCH_N;
break;
case BIT_AND_EXPR:
- oldbase = BUILT_IN_SYNC_FETCH_AND_AND_N;
- newbase = BUILT_IN_SYNC_AND_AND_FETCH_N;
- optab = sync_and_optab;
- oldoptab = sync_old_and_optab;
- newoptab = sync_new_and_optab;
+ oldbase = BUILT_IN_ATOMIC_FETCH_AND_N;
+ newbase = BUILT_IN_ATOMIC_AND_FETCH_N;
break;
case BIT_IOR_EXPR:
- oldbase = BUILT_IN_SYNC_FETCH_AND_OR_N;
- newbase = BUILT_IN_SYNC_OR_AND_FETCH_N;
- optab = sync_ior_optab;
- oldoptab = sync_old_ior_optab;
- newoptab = sync_new_ior_optab;
+ oldbase = BUILT_IN_ATOMIC_FETCH_OR_N;
+ newbase = BUILT_IN_ATOMIC_OR_FETCH_N;
break;
case BIT_XOR_EXPR:
- oldbase = BUILT_IN_SYNC_FETCH_AND_XOR_N;
- newbase = BUILT_IN_SYNC_XOR_AND_FETCH_N;
- optab = sync_xor_optab;
- oldoptab = sync_old_xor_optab;
- newoptab = sync_new_xor_optab;
+ oldbase = BUILT_IN_ATOMIC_FETCH_XOR_N;
+ newbase = BUILT_IN_ATOMIC_XOR_FETCH_N;
break;
default:
return false;
}
+
/* Make sure the expression is of the proper form. */
if (operand_equal_p (gimple_assign_rhs1 (stmt), loaded_val, 0))
rhs = gimple_assign_rhs2 (stmt);
@@ -5104,37 +5092,25 @@ expand_omp_atomic_fetch_op (basic_block load_bb,
if (decl == NULL_TREE)
return false;
itype = TREE_TYPE (TREE_TYPE (decl));
+ imode = TYPE_MODE (itype);
- if (need_new)
- {
- /* expand_sync_fetch_operation can always compensate when interested
- in the new value. */
- if (direct_optab_handler (newoptab, TYPE_MODE (itype))
- == CODE_FOR_nothing
- && direct_optab_handler (oldoptab, TYPE_MODE (itype))
- == CODE_FOR_nothing)
- return false;
- }
- else if (need_old)
- {
- /* When interested in the old value, expand_sync_fetch_operation
- can compensate only if the operation is reversible. AND and OR
- are not reversible. */
- if (direct_optab_handler (oldoptab, TYPE_MODE (itype))
- == CODE_FOR_nothing
- && (oldbase == BUILT_IN_SYNC_FETCH_AND_AND_N
- || oldbase == BUILT_IN_SYNC_FETCH_AND_OR_N
- || direct_optab_handler (newoptab, TYPE_MODE (itype))
- == CODE_FOR_nothing))
- return false;
- }
- else if (direct_optab_handler (optab, TYPE_MODE (itype)) == CODE_FOR_nothing)
+ /* We could test all of the various optabs involved, but the fact of the
+ matter is that (with the exception of i486 vs i586 and xadd) all targets
+ that support any atomic operaton optab also implements compare-and-swap.
+ Let optabs.c take care of expanding any compare-and-swap loop. */
+ if (!can_compare_and_swap_p (imode))
return false;
gsi = gsi_last_bb (load_bb);
gcc_assert (gimple_code (gsi_stmt (gsi)) == GIMPLE_OMP_ATOMIC_LOAD);
- call = build_call_expr_loc (loc, decl, 2, addr,
- fold_convert_loc (loc, itype, rhs));
+
+ /* OpenMP does not imply any barrier-like semantics on its atomic ops.
+ It only requires that the operation happen atomically. Thus we can
+ use the RELAXED memory model. */
+ call = build_call_expr_loc (loc, decl, 3, addr,
+ fold_convert_loc (loc, itype, rhs),
+ build_int_cst (NULL, MEMMODEL_RELAXED));
+
if (need_old || need_new)
{
lhs = need_old ? loaded_val : stored_val;
@@ -5183,6 +5159,8 @@ expand_omp_atomic_pipeline (basic_block load_bb, basic_block store_bb,
edge e;
enum built_in_function fncode;
+ /* ??? We need a non-pointer interface to __atomic_compare_exchange in
+ order to use the RELAXED memory model effectively. */
fncode = (enum built_in_function)((int)BUILT_IN_SYNC_VAL_COMPARE_AND_SWAP_N
+ index + 1);
cmpxchg = builtin_decl_explicit (fncode);
@@ -5191,8 +5169,7 @@ expand_omp_atomic_pipeline (basic_block load_bb, basic_block store_bb,
type = TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (addr)));
itype = TREE_TYPE (TREE_TYPE (cmpxchg));
- if (direct_optab_handler (sync_compare_and_swap_optab, TYPE_MODE (itype))
- == CODE_FOR_nothing)
+ if (!can_compare_and_swap_p (TYPE_MODE (itype)))
return false;
/* Load the initial value, replacing the GIMPLE_OMP_ATOMIC_LOAD. */
diff --git a/gcc/optabs.c b/gcc/optabs.c
index f07381cf836..a466e56fc68 100644
--- a/gcc/optabs.c
+++ b/gcc/optabs.c
@@ -7162,43 +7162,25 @@ expand_vec_cond_expr (tree vec_cond_type, tree op0, tree op1, tree op2,
}
-/* This is an internal subroutine of the other compare_and_swap expanders.
- MEM, OLD_VAL and NEW_VAL are as you'd expect for a compare-and-swap
- operation. TARGET is an optional place to store the value result of
- the operation. ICODE is the particular instruction to expand. Return
- the result of the operation. */
+/* Return true if there is a compare_and_swap pattern. */
-static rtx
-expand_val_compare_and_swap_1 (rtx mem, rtx old_val, rtx new_val,
- rtx target, enum insn_code icode)
+bool
+can_compare_and_swap_p (enum machine_mode mode)
{
- struct expand_operand ops[4];
- enum machine_mode mode = GET_MODE (mem);
-
- create_output_operand (&ops[0], target, mode);
- create_fixed_operand (&ops[1], mem);
- /* OLD_VAL and NEW_VAL may have been promoted to a wider mode.
- Shrink them if so. */
- create_convert_operand_to (&ops[2], old_val, mode, true);
- create_convert_operand_to (&ops[3], new_val, mode, true);
- if (maybe_expand_insn (icode, 4, ops))
- return ops[0].value;
- return NULL_RTX;
-}
-
-/* Expand a compare-and-swap operation and return its value. */
+ enum insn_code icode;
-rtx
-expand_val_compare_and_swap (rtx mem, rtx old_val, rtx new_val, rtx target)
-{
- enum machine_mode mode = GET_MODE (mem);
- enum insn_code icode
- = direct_optab_handler (sync_compare_and_swap_optab, mode);
+ /* Check for __sync_compare_and_swap. */
+ icode = direct_optab_handler (sync_compare_and_swap_optab, mode);
+ if (icode != CODE_FOR_nothing)
+ return true;
- if (icode == CODE_FOR_nothing)
- return NULL_RTX;
+ /* Check for __atomic_compare_and_swap. */
+ icode = direct_optab_handler (atomic_compare_and_swap_optab, mode);
+ if (icode != CODE_FOR_nothing)
+ return true;
- return expand_val_compare_and_swap_1 (mem, old_val, new_val, target, icode);
+ /* No inline compare and swap. */
+ return false;
}
/* Helper function to find the MODE_CC set in a sync_compare_and_swap
@@ -7216,58 +7198,6 @@ find_cc_set (rtx x, const_rtx pat, void *data)
}
}
-/* Expand a compare-and-swap operation and store true into the result if
- the operation was successful and false otherwise. Return the result.
- Unlike other routines, TARGET is not optional. */
-
-rtx
-expand_bool_compare_and_swap (rtx mem, rtx old_val, rtx new_val, rtx target)
-{
- enum machine_mode mode = GET_MODE (mem);
- enum insn_code icode;
- rtx subtarget, seq, cc_reg;
-
- /* If the target supports a compare-and-swap pattern that simultaneously
- sets some flag for success, then use it. Otherwise use the regular
- compare-and-swap and follow that immediately with a compare insn. */
- icode = direct_optab_handler (sync_compare_and_swap_optab, mode);
- if (icode == CODE_FOR_nothing)
- return NULL_RTX;
-
- do_pending_stack_adjust ();
- do
- {
- start_sequence ();
- subtarget = expand_val_compare_and_swap_1 (mem, old_val, new_val,
- NULL_RTX, icode);
- cc_reg = NULL_RTX;
- if (subtarget == NULL_RTX)
- {
- end_sequence ();
- return NULL_RTX;
- }
-
- if (have_insn_for (COMPARE, CCmode))
- note_stores (PATTERN (get_last_insn ()), find_cc_set, &cc_reg);
- seq = get_insns ();
- end_sequence ();
-
- /* We might be comparing against an old value. Try again. :-( */
- if (!cc_reg && MEM_P (old_val))
- {
- seq = NULL_RTX;
- old_val = force_reg (mode, old_val);
- }
- }
- while (!seq);
-
- emit_insn (seq);
- if (cc_reg)
- return emit_store_flag_force (target, EQ, cc_reg, const0_rtx, VOIDmode, 0, 1);
- else
- return emit_store_flag_force (target, EQ, subtarget, old_val, VOIDmode, 1, 1);
-}
-
/* This is a helper function for the other atomic operations. This function
emits a loop that contains SEQ that iterates until a compare-and-swap
operation at the end succeeds. MEM is the memory to be modified. SEQ is
@@ -7281,8 +7211,7 @@ static bool
expand_compare_and_swap_loop (rtx mem, rtx old_reg, rtx new_reg, rtx seq)
{
enum machine_mode mode = GET_MODE (mem);
- enum insn_code icode;
- rtx label, cmp_reg, subtarget, cc_reg;
+ rtx label, cmp_reg, success, oldval;
/* The loop we want to generate looks like
@@ -7290,8 +7219,8 @@ expand_compare_and_swap_loop (rtx mem, rtx old_reg, rtx new_reg, rtx seq)
label:
old_reg = cmp_reg;
seq;
- cmp_reg = compare-and-swap(mem, old_reg, new_reg)
- if (cmp_reg != old_reg)
+ (success, cmp_reg) = compare-and-swap(mem, old_reg, new_reg)
+ if (success)
goto label;
Note that we only do the plain load from memory once. Subsequent
@@ -7306,331 +7235,600 @@ expand_compare_and_swap_loop (rtx mem, rtx old_reg, rtx new_reg, rtx seq)
if (seq)
emit_insn (seq);
- /* If the target supports a compare-and-swap pattern that simultaneously
- sets some flag for success, then use it. Otherwise use the regular
- compare-and-swap and follow that immediately with a compare insn. */
- icode = direct_optab_handler (sync_compare_and_swap_optab, mode);
- if (icode == CODE_FOR_nothing)
+ success = NULL_RTX;
+ oldval = cmp_reg;
+ if (!expand_atomic_compare_and_swap (&success, &oldval, mem, old_reg,
+ new_reg, false, MEMMODEL_SEQ_CST,
+ MEMMODEL_RELAXED))
return false;
- subtarget = expand_val_compare_and_swap_1 (mem, old_reg, new_reg,
- cmp_reg, icode);
- if (subtarget == NULL_RTX)
- return false;
+ if (oldval != cmp_reg)
+ emit_move_insn (cmp_reg, oldval);
- cc_reg = NULL_RTX;
- if (have_insn_for (COMPARE, CCmode))
- note_stores (PATTERN (get_last_insn ()), find_cc_set, &cc_reg);
- if (cc_reg)
+ /* ??? Mark this jump predicted not taken? */
+ emit_cmp_and_jump_insns (success, const0_rtx, EQ, const0_rtx,
+ GET_MODE (success), 1, label);
+ return true;
+}
+
+
+/* This function expands the atomic exchange operation:
+ atomically store VAL in MEM and return the previous value in MEM.
+
+ MEMMODEL is the memory model variant to use.
+ TARGET is an optional place to stick the return value.
+ USE_TEST_AND_SET indicates whether __sync_lock_test_and_set should be used
+ as a fall back if the atomic_exchange pattern does not exist. */
+
+rtx
+expand_atomic_exchange (rtx target, rtx mem, rtx val, enum memmodel model,
+ bool use_test_and_set)
+{
+ enum machine_mode mode = GET_MODE (mem);
+ enum insn_code icode;
+ rtx last_insn;
+
+ /* If the target supports the exchange directly, great. */
+ icode = direct_optab_handler (atomic_exchange_optab, mode);
+ if (icode != CODE_FOR_nothing)
{
- cmp_reg = cc_reg;
- old_reg = const0_rtx;
+ struct expand_operand ops[4];
+
+ create_output_operand (&ops[0], target, mode);
+ create_fixed_operand (&ops[1], mem);
+ /* VAL may have been promoted to a wider mode. Shrink it if so. */
+ create_convert_operand_to (&ops[2], val, mode, true);
+ create_integer_operand (&ops[3], model);
+ if (maybe_expand_insn (icode, 4, ops))
+ return ops[0].value;
}
- else
+
+ /* Legacy sync_lock_test_and_set works the same, but is only defined as an
+ acquire barrier. If the pattern exists, and the memory model is stronger
+ than acquire, add a release barrier before the instruction.
+ The barrier is not needed if sync_lock_test_and_set doesn't exist since
+ it will expand into a compare-and-swap loop.
+
+ Some targets have non-compliant test_and_sets, so it would be incorrect
+ to emit a test_and_set in place of an __atomic_exchange. The test_and_set
+ builtin shares this expander since exchange can always replace the
+ test_and_set. */
+
+ if (use_test_and_set)
{
- if (subtarget != cmp_reg)
- emit_move_insn (cmp_reg, subtarget);
+ icode = direct_optab_handler (sync_lock_test_and_set_optab, mode);
+ last_insn = get_last_insn ();
+ if ((icode != CODE_FOR_nothing) && (model == MEMMODEL_SEQ_CST ||
+ model == MEMMODEL_RELEASE ||
+ model == MEMMODEL_ACQ_REL))
+ expand_builtin_mem_thread_fence (model);
+
+ if (icode != CODE_FOR_nothing)
+ {
+ struct expand_operand ops[3];
+
+ create_output_operand (&ops[0], target, mode);
+ create_fixed_operand (&ops[1], mem);
+ /* VAL may have been promoted to a wider mode. Shrink it if so. */
+ create_convert_operand_to (&ops[2], val, mode, true);
+ if (maybe_expand_insn (icode, 3, ops))
+ return ops[0].value;
+ }
+
+ /* Remove any fence that was inserted since a compare and swap loop is
+ already a full memory barrier. */
+ if (last_insn != get_last_insn ())
+ delete_insns_since (last_insn);
}
- /* ??? Mark this jump predicted not taken? */
- emit_cmp_and_jump_insns (cmp_reg, old_reg, NE, const0_rtx, GET_MODE (cmp_reg), 1,
- label);
+ /* Otherwise, use a compare-and-swap loop for the exchange. */
+ if (can_compare_and_swap_p (mode))
+ {
+ if (!target || !register_operand (target, mode))
+ target = gen_reg_rtx (mode);
+ if (GET_MODE (val) != VOIDmode && GET_MODE (val) != mode)
+ val = convert_modes (mode, GET_MODE (val), val, 1);
+ if (expand_compare_and_swap_loop (mem, target, val, NULL_RTX))
+ return target;
+ }
+
+ return NULL_RTX;
+}
+
+/* This function expands the atomic compare exchange operation:
+
+ *PTARGET_BOOL is an optional place to store the boolean success/failure.
+ *PTARGET_OVAL is an optional place to store the old value from memory.
+ Both target parameters may be NULL to indicate that we do not care about
+ that return value. Both target parameters are updated on success to
+ the actual location of the corresponding result.
+
+ MEMMODEL is the memory model variant to use.
+
+ The return value of the function is true for success. */
+
+bool
+expand_atomic_compare_and_swap (rtx *ptarget_bool, rtx *ptarget_oval,
+ rtx mem, rtx expected, rtx desired,
+ bool is_weak, enum memmodel succ_model,
+ enum memmodel fail_model)
+{
+ enum machine_mode mode = GET_MODE (mem);
+ struct expand_operand ops[8];
+ enum insn_code icode;
+ rtx target_bool, target_oval;
+
+ /* Load expected into a register for the compare and swap. */
+ if (MEM_P (expected))
+ expected = copy_to_reg (expected);
+
+ /* Make sure we always have some place to put the return oldval.
+ Further, make sure that place is distinct from the input expected,
+ just in case we need that path down below. */
+ if (ptarget_oval == NULL
+ || (target_oval = *ptarget_oval) == NULL
+ || reg_overlap_mentioned_p (expected, target_oval))
+ target_oval = gen_reg_rtx (mode);
+
+ icode = direct_optab_handler (atomic_compare_and_swap_optab, mode);
+ if (icode != CODE_FOR_nothing)
+ {
+ enum machine_mode bool_mode = insn_data[icode].operand[0].mode;
+
+ /* Make sure we always have a place for the bool operand. */
+ if (ptarget_bool == NULL
+ || (target_bool = *ptarget_bool) == NULL
+ || GET_MODE (target_bool) != bool_mode)
+ target_bool = gen_reg_rtx (bool_mode);
+
+ /* Emit the compare_and_swap. */
+ create_output_operand (&ops[0], target_bool, bool_mode);
+ create_output_operand (&ops[1], target_oval, mode);
+ create_fixed_operand (&ops[2], mem);
+ create_convert_operand_to (&ops[3], expected, mode, true);
+ create_convert_operand_to (&ops[4], desired, mode, true);
+ create_integer_operand (&ops[5], is_weak);
+ create_integer_operand (&ops[6], succ_model);
+ create_integer_operand (&ops[7], fail_model);
+ expand_insn (icode, 8, ops);
+
+ /* Return success/failure. */
+ target_bool = ops[0].value;
+ target_oval = ops[1].value;
+ goto success;
+ }
+
+ /* Otherwise fall back to the original __sync_val_compare_and_swap
+ which is always seq-cst. */
+ icode = direct_optab_handler (sync_compare_and_swap_optab, mode);
+ if (icode != CODE_FOR_nothing)
+ {
+ rtx cc_reg;
+
+ create_output_operand (&ops[0], target_oval, mode);
+ create_fixed_operand (&ops[1], mem);
+ create_convert_operand_to (&ops[2], expected, mode, true);
+ create_convert_operand_to (&ops[3], desired, mode, true);
+ if (!maybe_expand_insn (icode, 4, ops))
+ return false;
+
+ target_oval = ops[0].value;
+ target_bool = NULL_RTX;
+
+ /* If the caller isn't interested in the boolean return value,
+ skip the computation of it. */
+ if (ptarget_bool == NULL)
+ goto success;
+
+ /* Otherwise, work out if the compare-and-swap succeeded. */
+ cc_reg = NULL_RTX;
+ if (have_insn_for (COMPARE, CCmode))
+ note_stores (PATTERN (get_last_insn ()), find_cc_set, &cc_reg);
+
+ target_bool
+ = (cc_reg
+ ? emit_store_flag_force (target_bool, EQ, cc_reg,
+ const0_rtx, VOIDmode, 0, 1)
+ : emit_store_flag_force (target_bool, EQ, target_oval,
+ expected, VOIDmode, 1, 1));
+ goto success;
+ }
+ return false;
+
+ success:
+ /* Make sure that the oval output winds up where the caller asked. */
+ if (ptarget_oval)
+ *ptarget_oval = target_oval;
+ if (ptarget_bool)
+ *ptarget_bool = target_bool;
return true;
}
-/* This function generates the atomic operation MEM CODE= VAL. In this
- case, we do not care about any resulting value. Returns NULL if we
- cannot generate the operation. */
+/* This function expands the atomic load operation:
+ return the atomically loaded value in MEM.
+
+ MEMMODEL is the memory model variant to use.
+ TARGET is an option place to stick the return value. */
rtx
-expand_sync_operation (rtx mem, rtx val, enum rtx_code code)
+expand_atomic_load (rtx target, rtx mem, enum memmodel model)
{
enum machine_mode mode = GET_MODE (mem);
enum insn_code icode;
- rtx insn;
- /* Look to see if the target supports the operation directly. */
- switch (code)
+ /* If the target supports the load directly, great. */
+ icode = direct_optab_handler (atomic_load_optab, mode);
+ if (icode != CODE_FOR_nothing)
{
- case PLUS:
- icode = direct_optab_handler (sync_add_optab, mode);
- break;
- case IOR:
- icode = direct_optab_handler (sync_ior_optab, mode);
- break;
- case XOR:
- icode = direct_optab_handler (sync_xor_optab, mode);
- break;
- case AND:
- icode = direct_optab_handler (sync_and_optab, mode);
- break;
- case NOT:
- icode = direct_optab_handler (sync_nand_optab, mode);
- break;
+ struct expand_operand ops[3];
- case MINUS:
- icode = direct_optab_handler (sync_sub_optab, mode);
- if (icode == CODE_FOR_nothing || CONST_INT_P (val))
- {
- icode = direct_optab_handler (sync_add_optab, mode);
- if (icode != CODE_FOR_nothing)
- {
- val = expand_simple_unop (mode, NEG, val, NULL_RTX, 1);
- code = PLUS;
- }
- }
- break;
+ create_output_operand (&ops[0], target, mode);
+ create_fixed_operand (&ops[1], mem);
+ create_integer_operand (&ops[2], model);
+ if (maybe_expand_insn (icode, 3, ops))
+ return ops[0].value;
+ }
- default:
- gcc_unreachable ();
+ /* If the size of the object is greater than word size on this target,
+ then we assume that a load will not be atomic. */
+ if (GET_MODE_PRECISION (mode) > BITS_PER_WORD)
+ {
+ /* Issue val = compare_and_swap (mem, 0, 0).
+ This may cause the occasional harmless store of 0 when the value is
+ already 0, but it seems to be OK according to the standards guys. */
+ expand_atomic_compare_and_swap (NULL, &target, mem, const0_rtx,
+ const0_rtx, false, model, model);
+ return target;
}
- /* Generate the direct operation, if present. */
+ /* Otherwise assume loads are atomic, and emit the proper barriers. */
+ if (!target || target == const0_rtx)
+ target = gen_reg_rtx (mode);
+
+ /* Emit the appropriate barrier before the load. */
+ expand_builtin_mem_thread_fence (model);
+
+ emit_move_insn (target, mem);
+
+ /* For SEQ_CST, also emit a barrier after the load. */
+ if (model == MEMMODEL_SEQ_CST)
+ expand_builtin_mem_thread_fence (model);
+
+ return target;
+}
+
+/* This function expands the atomic store operation:
+ Atomically store VAL in MEM.
+ MEMMODEL is the memory model variant to use.
+ USE_RELEASE is true if __sync_lock_release can be used as a fall back.
+ function returns const0_rtx if a pattern was emitted. */
+
+rtx
+expand_atomic_store (rtx mem, rtx val, enum memmodel model, bool use_release)
+{
+ enum machine_mode mode = GET_MODE (mem);
+ enum insn_code icode;
+ struct expand_operand ops[3];
+
+ /* If the target supports the store directly, great. */
+ icode = direct_optab_handler (atomic_store_optab, mode);
if (icode != CODE_FOR_nothing)
{
- struct expand_operand ops[2];
-
create_fixed_operand (&ops[0], mem);
- /* VAL may have been promoted to a wider mode. Shrink it if so. */
- create_convert_operand_to (&ops[1], val, mode, true);
- if (maybe_expand_insn (icode, 2, ops))
+ create_input_operand (&ops[1], val, mode);
+ create_integer_operand (&ops[2], model);
+ if (maybe_expand_insn (icode, 3, ops))
return const0_rtx;
}
- /* Failing that, generate a compare-and-swap loop in which we perform the
- operation with normal arithmetic instructions. */
- if (direct_optab_handler (sync_compare_and_swap_optab, mode)
- != CODE_FOR_nothing)
+ /* If using __sync_lock_release is a viable alternative, try it. */
+ if (use_release)
{
- rtx t0 = gen_reg_rtx (mode), t1;
-
- start_sequence ();
-
- t1 = t0;
- if (code == NOT)
+ icode = direct_optab_handler (sync_lock_release_optab, mode);
+ if (icode != CODE_FOR_nothing)
{
- t1 = expand_simple_binop (mode, AND, t1, val, NULL_RTX,
- true, OPTAB_LIB_WIDEN);
- t1 = expand_simple_unop (mode, code, t1, NULL_RTX, true);
+ create_fixed_operand (&ops[0], mem);
+ create_input_operand (&ops[1], const0_rtx, mode);
+ if (maybe_expand_insn (icode, 2, ops))
+ {
+ /* lock_release is only a release barrier. */
+ if (model == MEMMODEL_SEQ_CST)
+ expand_builtin_mem_thread_fence (model);
+ return const0_rtx;
+ }
}
- else
- t1 = expand_simple_binop (mode, code, t1, val, NULL_RTX,
- true, OPTAB_LIB_WIDEN);
- insn = get_insns ();
- end_sequence ();
+ }
- if (t1 != NULL && expand_compare_and_swap_loop (mem, t0, t1, insn))
- return const0_rtx;
+ /* If the size of the object is greater than word size on this target,
+ a default store will not be atomic, Try a mem_exchange and throw away
+ the result. If that doesn't work, don't do anything. */
+ if (GET_MODE_PRECISION(mode) > BITS_PER_WORD)
+ {
+ rtx target = expand_atomic_exchange (NULL_RTX, mem, val, model, false);
+ if (target)
+ return const0_rtx;
+ else
+ return NULL_RTX;
}
- return NULL_RTX;
+ /* If there is no mem_store, default to a move with barriers */
+ if (model == MEMMODEL_SEQ_CST || model == MEMMODEL_RELEASE)
+ expand_builtin_mem_thread_fence (model);
+
+ emit_move_insn (mem, val);
+
+ /* For SEQ_CST, also emit a barrier after the load. */
+ if (model == MEMMODEL_SEQ_CST)
+ expand_builtin_mem_thread_fence (model);
+
+ return const0_rtx;
}
-/* This function generates the atomic operation MEM CODE= VAL. In this
- case, we do care about the resulting value: if AFTER is true then
- return the value MEM holds after the operation, if AFTER is false
- then return the value MEM holds before the operation. TARGET is an
- optional place for the result value to be stored. */
-rtx
-expand_sync_fetch_operation (rtx mem, rtx val, enum rtx_code code,
- bool after, rtx target)
+/* Structure containing the pointers and values required to process the
+ various forms of the atomic_fetch_op and atomic_op_fetch builtins. */
+
+struct atomic_op_functions
{
- enum machine_mode mode = GET_MODE (mem);
- enum insn_code old_code, new_code, icode;
- bool compensate;
- rtx insn;
+ struct direct_optab_d *mem_fetch_before;
+ struct direct_optab_d *mem_fetch_after;
+ struct direct_optab_d *mem_no_result;
+ struct direct_optab_d *fetch_before;
+ struct direct_optab_d *fetch_after;
+ struct direct_optab_d *no_result;
+ enum rtx_code reverse_code;
+};
+
+
+/* Fill in structure pointed to by OP with the various optab entries for an
+ operation of type CODE. */
+
+static void
+get_atomic_op_for_code (struct atomic_op_functions *op, enum rtx_code code)
+{
+ gcc_assert (op!= NULL);
- /* Look to see if the target supports the operation directly. */
+ /* If SWITCHABLE_TARGET is defined, then subtargets can be switched
+ in the source code during compilation, and the optab entries are not
+ computable until runtime. Fill in the values at runtime. */
switch (code)
{
case PLUS:
- old_code = direct_optab_handler (sync_old_add_optab, mode);
- new_code = direct_optab_handler (sync_new_add_optab, mode);
+ op->mem_fetch_before = atomic_fetch_add_optab;
+ op->mem_fetch_after = atomic_add_fetch_optab;
+ op->mem_no_result = atomic_add_optab;
+ op->fetch_before = sync_old_add_optab;
+ op->fetch_after = sync_new_add_optab;
+ op->no_result = sync_add_optab;
+ op->reverse_code = MINUS;
break;
- case IOR:
- old_code = direct_optab_handler (sync_old_ior_optab, mode);
- new_code = direct_optab_handler (sync_new_ior_optab, mode);
+ case MINUS:
+ op->mem_fetch_before = atomic_fetch_sub_optab;
+ op->mem_fetch_after = atomic_sub_fetch_optab;
+ op->mem_no_result = atomic_sub_optab;
+ op->fetch_before = sync_old_sub_optab;
+ op->fetch_after = sync_new_sub_optab;
+ op->no_result = sync_sub_optab;
+ op->reverse_code = PLUS;
break;
case XOR:
- old_code = direct_optab_handler (sync_old_xor_optab, mode);
- new_code = direct_optab_handler (sync_new_xor_optab, mode);
+ op->mem_fetch_before = atomic_fetch_xor_optab;
+ op->mem_fetch_after = atomic_xor_fetch_optab;
+ op->mem_no_result = atomic_xor_optab;
+ op->fetch_before = sync_old_xor_optab;
+ op->fetch_after = sync_new_xor_optab;
+ op->no_result = sync_xor_optab;
+ op->reverse_code = XOR;
break;
case AND:
- old_code = direct_optab_handler (sync_old_and_optab, mode);
- new_code = direct_optab_handler (sync_new_and_optab, mode);
+ op->mem_fetch_before = atomic_fetch_and_optab;
+ op->mem_fetch_after = atomic_and_fetch_optab;
+ op->mem_no_result = atomic_and_optab;
+ op->fetch_before = sync_old_and_optab;
+ op->fetch_after = sync_new_and_optab;
+ op->no_result = sync_and_optab;
+ op->reverse_code = UNKNOWN;
break;
- case NOT:
- old_code = direct_optab_handler (sync_old_nand_optab, mode);
- new_code = direct_optab_handler (sync_new_nand_optab, mode);
+ case IOR:
+ op->mem_fetch_before = atomic_fetch_or_optab;
+ op->mem_fetch_after = atomic_or_fetch_optab;
+ op->mem_no_result = atomic_or_optab;
+ op->fetch_before = sync_old_ior_optab;
+ op->fetch_after = sync_new_ior_optab;
+ op->no_result = sync_ior_optab;
+ op->reverse_code = UNKNOWN;
break;
-
- case MINUS:
- old_code = direct_optab_handler (sync_old_sub_optab, mode);
- new_code = direct_optab_handler (sync_new_sub_optab, mode);
- if ((old_code == CODE_FOR_nothing && new_code == CODE_FOR_nothing)
- || CONST_INT_P (val))
- {
- old_code = direct_optab_handler (sync_old_add_optab, mode);
- new_code = direct_optab_handler (sync_new_add_optab, mode);
- if (old_code != CODE_FOR_nothing || new_code != CODE_FOR_nothing)
- {
- val = expand_simple_unop (mode, NEG, val, NULL_RTX, 1);
- code = PLUS;
- }
- }
+ case NOT:
+ op->mem_fetch_before = atomic_fetch_nand_optab;
+ op->mem_fetch_after = atomic_nand_fetch_optab;
+ op->mem_no_result = atomic_nand_optab;
+ op->fetch_before = sync_old_nand_optab;
+ op->fetch_after = sync_new_nand_optab;
+ op->no_result = sync_nand_optab;
+ op->reverse_code = UNKNOWN;
break;
-
default:
gcc_unreachable ();
}
+}
+
+/* Try to emit an instruction for a specific operation varaition.
+ OPTAB contains the OP functions.
+ TARGET is an optional place to return the result. const0_rtx means unused.
+ MEM is the memory location to operate on.
+ VAL is the value to use in the operation.
+ USE_MEMMODEL is TRUE if the variation with a memory model should be tried.
+ MODEL is the memory model, if used.
+ AFTER is true if the returned result is the value after the operation. */
+
+static rtx
+maybe_emit_op (const struct atomic_op_functions *optab, rtx target, rtx mem,
+ rtx val, bool use_memmodel, enum memmodel model, bool after)
+{
+ enum machine_mode mode = GET_MODE (mem);
+ struct direct_optab_d *this_optab;
+ struct expand_operand ops[4];
+ enum insn_code icode;
+ int op_counter = 0;
+ int num_ops;
- /* If the target does supports the proper new/old operation, great. But
- if we only support the opposite old/new operation, check to see if we
- can compensate. In the case in which the old value is supported, then
- we can always perform the operation again with normal arithmetic. In
- the case in which the new value is supported, then we can only handle
- this in the case the operation is reversible. */
- compensate = false;
- if (after)
+ /* Check to see if there is a result returned. */
+ if (target == const0_rtx)
{
- icode = new_code;
- if (icode == CODE_FOR_nothing)
- {
- icode = old_code;
- if (icode != CODE_FOR_nothing)
- compensate = true;
+ if (use_memmodel)
+ {
+ this_optab = optab->mem_no_result;
+ create_integer_operand (&ops[2], model);
+ num_ops = 3;
+ }
+ else
+ {
+ this_optab = optab->no_result;
+ num_ops = 2;
}
}
+ /* Otherwise, we need to generate a result. */
else
{
- icode = old_code;
- if (icode == CODE_FOR_nothing
- && (code == PLUS || code == MINUS || code == XOR))
+ if (use_memmodel)
+ {
+ this_optab = after ? optab->mem_fetch_after : optab->mem_fetch_before;
+ create_integer_operand (&ops[3], model);
+ num_ops= 4;
+ }
+ else
{
- icode = new_code;
- if (icode != CODE_FOR_nothing)
- compensate = true;
+ this_optab = after ? optab->fetch_after : optab->fetch_before;
+ num_ops = 3;
}
+ create_output_operand (&ops[op_counter++], target, mode);
}
- /* If we found something supported, great. */
- if (icode != CODE_FOR_nothing)
+ icode = direct_optab_handler (this_optab, mode);
+ if (icode == CODE_FOR_nothing)
+ return NULL_RTX;
+
+ create_fixed_operand (&ops[op_counter++], mem);
+ /* VAL may have been promoted to a wider mode. Shrink it if so. */
+ create_convert_operand_to (&ops[op_counter++], val, mode, true);
+
+ if (maybe_expand_insn (icode, num_ops, ops))
+ return ((target == const0_rtx) ? const0_rtx : ops[0].value);
+
+ return NULL_RTX;
+}
+
+
+/* This function expands an atomic fetch_OP or OP_fetch operation:
+ TARGET is an option place to stick the return value. const0_rtx indicates
+ the result is unused.
+ atomically fetch MEM, perform the operation with VAL and return it to MEM.
+ CODE is the operation being performed (OP)
+ MEMMODEL is the memory model variant to use.
+ AFTER is true to return the result of the operation (OP_fetch).
+ AFTER is false to return the value before the operation (fetch_OP). */
+rtx
+expand_atomic_fetch_op (rtx target, rtx mem, rtx val, enum rtx_code code,
+ enum memmodel model, bool after)
+{
+ enum machine_mode mode = GET_MODE (mem);
+ struct atomic_op_functions optab;
+ rtx result;
+ bool unused_result = (target == const0_rtx);
+
+ get_atomic_op_for_code (&optab, code);
+
+ /* Check for the case where the result isn't used and try those patterns. */
+ if (unused_result)
{
- struct expand_operand ops[3];
+ /* Try the memory model variant first. */
+ result = maybe_emit_op (&optab, target, mem, val, true, model, true);
+ if (result)
+ return result;
- create_output_operand (&ops[0], target, mode);
- create_fixed_operand (&ops[1], mem);
- /* VAL may have been promoted to a wider mode. Shrink it if so. */
- create_convert_operand_to (&ops[2], val, mode, true);
- if (maybe_expand_insn (icode, 3, ops))
- {
- target = ops[0].value;
- val = ops[2].value;
- /* If we need to compensate for using an operation with the
- wrong return value, do so now. */
- if (compensate)
- {
- if (!after)
- {
- if (code == PLUS)
- code = MINUS;
- else if (code == MINUS)
- code = PLUS;
- }
+ /* Next try the old style withuot a memory model. */
+ result = maybe_emit_op (&optab, target, mem, val, false, model, true);
+ if (result)
+ return result;
- if (code == NOT)
- {
- target = expand_simple_binop (mode, AND, target, val,
- NULL_RTX, true,
- OPTAB_LIB_WIDEN);
- target = expand_simple_unop (mode, code, target,
- NULL_RTX, true);
- }
- else
- target = expand_simple_binop (mode, code, target, val,
- NULL_RTX, true,
- OPTAB_LIB_WIDEN);
- }
+ /* There is no no-result pattern, so try patterns with a result. */
+ target = NULL_RTX;
+ }
- return target;
+ /* Try the __atomic version. */
+ result = maybe_emit_op (&optab, target, mem, val, true, model, after);
+ if (result)
+ return result;
+
+ /* Try the older __sync version. */
+ result = maybe_emit_op (&optab, target, mem, val, false, model, after);
+ if (result)
+ return result;
+
+ /* If the fetch value can be calculated from the other variation of fetch,
+ try that operation. */
+ if (after || optab.reverse_code != UNKNOWN || target == const0_rtx)
+ {
+ /* Try the __atomic version, then the older __sync version. */
+ result = maybe_emit_op (&optab, target, mem, val, true, model, !after);
+ if (!result)
+ result = maybe_emit_op (&optab, target, mem, val, false, model, !after);
+
+ if (result)
+ {
+ /* If the result isn't used, no need to do compensation code. */
+ if (unused_result)
+ return target;
+
+ /* Issue compensation code. Fetch_after == fetch_before OP val.
+ Fetch_before == after REVERSE_OP val. */
+ if (!after)
+ code = optab.reverse_code;
+ result = expand_simple_binop (mode, code, result, val, NULL_RTX, true,
+ OPTAB_LIB_WIDEN);
+ return result;
}
}
- /* Failing that, generate a compare-and-swap loop in which we perform the
- operation with normal arithmetic instructions. */
- if (direct_optab_handler (sync_compare_and_swap_optab, mode)
- != CODE_FOR_nothing)
+ /* If nothing else has succeeded, default to a compare and swap loop. */
+ if (can_compare_and_swap_p (mode))
{
+ rtx insn;
rtx t0 = gen_reg_rtx (mode), t1;
- if (!target || !register_operand (target, mode))
- target = gen_reg_rtx (mode);
-
start_sequence ();
- if (!after)
- emit_move_insn (target, t0);
+ /* If the result is used, get a register for it. */
+ if (!unused_result)
+ {
+ if (!target || !register_operand (target, mode))
+ target = gen_reg_rtx (mode);
+ /* If fetch_before, copy the value now. */
+ if (!after)
+ emit_move_insn (target, t0);
+ }
+ else
+ target = const0_rtx;
+
t1 = t0;
if (code == NOT)
- {
+ {
t1 = expand_simple_binop (mode, AND, t1, val, NULL_RTX,
true, OPTAB_LIB_WIDEN);
t1 = expand_simple_unop (mode, code, t1, NULL_RTX, true);
}
else
- t1 = expand_simple_binop (mode, code, t1, val, NULL_RTX,
- true, OPTAB_LIB_WIDEN);
- if (after)
- emit_move_insn (target, t1);
+ t1 = expand_simple_binop (mode, code, t1, val, NULL_RTX, true,
+ OPTAB_LIB_WIDEN);
+ /* For after, copy the value now. */
+ if (!unused_result && after)
+ emit_move_insn (target, t1);
insn = get_insns ();
end_sequence ();
if (t1 != NULL && expand_compare_and_swap_loop (mem, t0, t1, insn))
- return target;
- }
-
- return NULL_RTX;
-}
-
-/* This function expands a test-and-set operation. Ideally we atomically
- store VAL in MEM and return the previous value in MEM. Some targets
- may not support this operation and only support VAL with the constant 1;
- in this case while the return value will be 0/1, but the exact value
- stored in MEM is target defined. TARGET is an option place to stick
- the return value. */
-
-rtx
-expand_sync_lock_test_and_set (rtx mem, rtx val, rtx target)
-{
- enum machine_mode mode = GET_MODE (mem);
- enum insn_code icode;
-
- /* If the target supports the test-and-set directly, great. */
- icode = direct_optab_handler (sync_lock_test_and_set_optab, mode);
- if (icode != CODE_FOR_nothing)
- {
- struct expand_operand ops[3];
-
- create_output_operand (&ops[0], target, mode);
- create_fixed_operand (&ops[1], mem);
- /* VAL may have been promoted to a wider mode. Shrink it if so. */
- create_convert_operand_to (&ops[2], val, mode, true);
- if (maybe_expand_insn (icode, 3, ops))
- return ops[0].value;
- }
-
- /* Otherwise, use a compare-and-swap loop for the exchange. */
- if (direct_optab_handler (sync_compare_and_swap_optab, mode)
- != CODE_FOR_nothing)
- {
- if (!target || !register_operand (target, mode))
- target = gen_reg_rtx (mode);
- if (GET_MODE (val) != VOIDmode && GET_MODE (val) != mode)
- val = convert_modes (mode, GET_MODE (val), val, 1);
- if (expand_compare_and_swap_loop (mem, target, val, NULL_RTX))
- return target;
+ return target;
}
return NULL_RTX;
@@ -7838,6 +8036,14 @@ maybe_gen_insn (enum insn_code icode, unsigned int nops,
case 6:
return GEN_FCN (icode) (ops[0].value, ops[1].value, ops[2].value,
ops[3].value, ops[4].value, ops[5].value);
+ case 7:
+ return GEN_FCN (icode) (ops[0].value, ops[1].value, ops[2].value,
+ ops[3].value, ops[4].value, ops[5].value,
+ ops[6].value);
+ case 8:
+ return GEN_FCN (icode) (ops[0].value, ops[1].value, ops[2].value,
+ ops[3].value, ops[4].value, ops[5].value,
+ ops[6].value, ops[7].value);
}
gcc_unreachable ();
}
diff --git a/gcc/optabs.h b/gcc/optabs.h
index 8357a298618..d70b3fa0f91 100644
--- a/gcc/optabs.h
+++ b/gcc/optabs.h
@@ -695,6 +695,34 @@ enum direct_optab_index
/* Atomic clear with release semantics. */
DOI_sync_lock_release,
+ /* Atomic operations with memory model parameters. */
+ DOI_atomic_exchange,
+ DOI_atomic_compare_and_swap,
+ DOI_atomic_load,
+ DOI_atomic_store,
+ DOI_atomic_add_fetch,
+ DOI_atomic_sub_fetch,
+ DOI_atomic_and_fetch,
+ DOI_atomic_nand_fetch,
+ DOI_atomic_xor_fetch,
+ DOI_atomic_or_fetch,
+ DOI_atomic_fetch_add,
+ DOI_atomic_fetch_sub,
+ DOI_atomic_fetch_and,
+ DOI_atomic_fetch_nand,
+ DOI_atomic_fetch_xor,
+ DOI_atomic_fetch_or,
+ DOI_atomic_add,
+ DOI_atomic_sub,
+ DOI_atomic_and,
+ DOI_atomic_nand,
+ DOI_atomic_xor,
+ DOI_atomic_or,
+ DOI_atomic_always_lock_free,
+ DOI_atomic_is_lock_free,
+ DOI_atomic_thread_fence,
+ DOI_atomic_signal_fence,
+
/* Vector permutation. */
DOI_vec_perm,
DOI_vec_perm_const,
@@ -744,6 +772,60 @@ typedef struct direct_optab_d *direct_optab;
(&direct_optab_table[(int) DOI_sync_lock_test_and_set])
#define sync_lock_release_optab \
(&direct_optab_table[(int) DOI_sync_lock_release])
+
+#define atomic_exchange_optab \
+ (&direct_optab_table[(int) DOI_atomic_exchange])
+#define atomic_compare_and_swap_optab \
+ (&direct_optab_table[(int) DOI_atomic_compare_and_swap])
+#define atomic_load_optab \
+ (&direct_optab_table[(int) DOI_atomic_load])
+#define atomic_store_optab \
+ (&direct_optab_table[(int) DOI_atomic_store])
+#define atomic_add_fetch_optab \
+ (&direct_optab_table[(int) DOI_atomic_add_fetch])
+#define atomic_sub_fetch_optab \
+ (&direct_optab_table[(int) DOI_atomic_sub_fetch])
+#define atomic_and_fetch_optab \
+ (&direct_optab_table[(int) DOI_atomic_and_fetch])
+#define atomic_nand_fetch_optab \
+ (&direct_optab_table[(int) DOI_atomic_nand_fetch])
+#define atomic_xor_fetch_optab \
+ (&direct_optab_table[(int) DOI_atomic_xor_fetch])
+#define atomic_or_fetch_optab \
+ (&direct_optab_table[(int) DOI_atomic_or_fetch])
+#define atomic_fetch_add_optab \
+ (&direct_optab_table[(int) DOI_atomic_fetch_add])
+#define atomic_fetch_sub_optab \
+ (&direct_optab_table[(int) DOI_atomic_fetch_sub])
+#define atomic_fetch_and_optab \
+ (&direct_optab_table[(int) DOI_atomic_fetch_and])
+#define atomic_fetch_nand_optab \
+ (&direct_optab_table[(int) DOI_atomic_fetch_nand])
+#define atomic_fetch_xor_optab \
+ (&direct_optab_table[(int) DOI_atomic_fetch_xor])
+#define atomic_fetch_or_optab \
+ (&direct_optab_table[(int) DOI_atomic_fetch_or])
+#define atomic_add_optab \
+ (&direct_optab_table[(int) DOI_atomic_add])
+#define atomic_sub_optab \
+ (&direct_optab_table[(int) DOI_atomic_sub])
+#define atomic_and_optab \
+ (&direct_optab_table[(int) DOI_atomic_and])
+#define atomic_nand_optab \
+ (&direct_optab_table[(int) DOI_atomic_nand])
+#define atomic_xor_optab \
+ (&direct_optab_table[(int) DOI_atomic_xor])
+#define atomic_or_optab \
+ (&direct_optab_table[(int) DOI_atomic_or])
+#define atomic_always_lock_free_optab \
+ (&direct_optab_table[(int) DOI_atomic_always_lock_free])
+#define atomic_is_lock_free_optab \
+ (&direct_optab_table[(int) DOI_atomic_is_lock_free])
+#define atomic_thread_fence_optab \
+ (&direct_optab_table[(int) DOI_atomic_thread_fence])
+#define atomic_signal_fence_optab \
+ (&direct_optab_table[(int) DOI_atomic_signal_fence])
+
#define vec_perm_optab (&direct_optab_table[DOI_vec_perm])
#define vec_perm_const_optab (&direct_optab_table[(int) DOI_vec_perm_const])
@@ -883,6 +965,13 @@ extern void expand_float (rtx, rtx, int);
/* Return the insn_code for a FLOAT_EXPR. */
enum insn_code can_float_p (enum machine_mode, enum machine_mode, int);
+/* Return true if there is an inline compare and swap pattern. */
+extern bool can_compare_and_swap_p (enum machine_mode);
+
+/* Generate code for a compare and swap. */
+extern bool expand_atomic_compare_and_swap (rtx *, rtx *, rtx, rtx, rtx, bool,
+ enum memmodel, enum memmodel);
+
/* Check whether an operation represented by the code CODE is a
convert operation that is supported by the target platform in
vector form */
diff --git a/gcc/opts-common.c b/gcc/opts-common.c
index 0b86764cd79..00edbe6601c 100644
--- a/gcc/opts-common.c
+++ b/gcc/opts-common.c
@@ -878,9 +878,6 @@ handle_option (struct gcc_options *opts,
lang_mask, kind, loc,
handlers, dc))
return false;
- else
- handlers->post_handling_callback (decoded,
- handlers->handlers[i].mask);
}
return true;
diff --git a/gcc/opts-global.c b/gcc/opts-global.c
index 6fdc9519ca9..b93d56fcd8d 100644
--- a/gcc/opts-global.c
+++ b/gcc/opts-global.c
@@ -160,19 +160,6 @@ unknown_option_callback (const struct cl_decoded_option *decoded)
return true;
}
-/* Note that an option DECODED has been successfully handled with a
- handler for mask MASK. */
-
-static void
-post_handling_callback (const struct cl_decoded_option *decoded ATTRIBUTE_UNUSED,
- unsigned int mask ATTRIBUTE_UNUSED)
-{
-#ifdef ENABLE_LTO
- lto_register_user_option (decoded->opt_index, decoded->arg,
- decoded->value, mask);
-#endif
-}
-
/* Handle a front-end option; arguments and return value as for
handle_option. */
@@ -282,7 +269,6 @@ set_default_handlers (struct cl_option_handlers *handlers)
{
handlers->unknown_option_callback = unknown_option_callback;
handlers->wrong_lang_callback = complain_wrong_lang;
- handlers->post_handling_callback = post_handling_callback;
handlers->num_handlers = 3;
handlers->handlers[0].handler = lang_handle_option;
handlers->handlers[0].mask = initial_lang_mask;
@@ -314,11 +300,6 @@ decode_options (struct gcc_options *opts, struct gcc_options *opts_set,
decoded_options, decoded_options_count,
loc, lang_mask, &handlers, dc);
-#ifdef ENABLE_LTO
- /* Clear any options currently held for LTO. */
- lto_clear_user_options ();
-#endif
-
read_cmdline_options (opts, opts_set,
decoded_options, decoded_options_count,
loc, lang_mask,
diff --git a/gcc/opts.h b/gcc/opts.h
index 621cdea4934..dbefc6401d9 100644
--- a/gcc/opts.h
+++ b/gcc/opts.h
@@ -291,10 +291,6 @@ struct cl_option_handlers
void (*wrong_lang_callback) (const struct cl_decoded_option *decoded,
unsigned int lang_mask);
- /* Callback to call after the successful handling of any option. */
- void (*post_handling_callback) (const struct cl_decoded_option *decoded,
- unsigned int mask);
-
/* The number of individual handlers. */
size_t num_handlers;
diff --git a/gcc/params.def b/gcc/params.def
index b55449b1d2c..239b684b5fc 100644
--- a/gcc/params.def
+++ b/gcc/params.def
@@ -928,11 +928,26 @@ DEFPARAM (PARAM_CASE_VALUES_THRESHOLD,
0, 0, 0)
/* Data race flags for C++0x memory model compliance. */
+DEFPARAM (PARAM_ALLOW_LOAD_DATA_RACES,
+ "allow-load-data-races",
+ "Allow new data races on loads to be introduced",
+ 1, 0, 1)
+
DEFPARAM (PARAM_ALLOW_STORE_DATA_RACES,
"allow-store-data-races",
"Allow new data races on stores to be introduced",
1, 0, 1)
+DEFPARAM (PARAM_ALLOW_PACKED_LOAD_DATA_RACES,
+ "allow-packed-load-data-races",
+ "Allow new data races on packed data loads to be introduced",
+ 1, 0, 1)
+
+DEFPARAM (PARAM_ALLOW_PACKED_STORE_DATA_RACES,
+ "allow-packed-store-data-races",
+ "Allow new data races on packed data stores to be introduced",
+ 1, 0, 1)
+
/* Reassociation width to be used by tree reassoc optimization. */
DEFPARAM (PARAM_TREE_REASSOC_WIDTH,
"tree-reassoc-width",
diff --git a/gcc/params.h b/gcc/params.h
index 783f3b3d51d..0bf8961fd0e 100644
--- a/gcc/params.h
+++ b/gcc/params.h
@@ -211,6 +211,13 @@ extern void init_param_values (int *params);
PARAM_VALUE (PARAM_MIN_NONDEBUG_INSN_UID)
#define MAX_STORES_TO_SINK \
PARAM_VALUE (PARAM_MAX_STORES_TO_SINK)
+#define ALLOW_LOAD_DATA_RACES \
+ PARAM_VALUE (PARAM_ALLOW_LOAD_DATA_RACES)
#define ALLOW_STORE_DATA_RACES \
PARAM_VALUE (PARAM_ALLOW_STORE_DATA_RACES)
+#define ALLOW_PACKED_LOAD_DATA_RACES \
+ PARAM_VALUE (PARAM_ALLOW_PACKED_LOAD_DATA_RACES)
+#define ALLOW_PACKED_STORE_DATA_RACES \
+ PARAM_VALUE (PARAM_ALLOW_PACKED_STORE_DATA_RACES)
+
#endif /* ! GCC_PARAMS_H */
diff --git a/gcc/po/ChangeLog b/gcc/po/ChangeLog
index 70827cb6e6d..c7164125d0c 100644
--- a/gcc/po/ChangeLog
+++ b/gcc/po/ChangeLog
@@ -1,3 +1,18 @@
+2011-11-02 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
+
+ * EXCLUDES (gthr-aix.h, gthr-dce.h, gthr-posix.c, gthr-posix.h)
+ (gthr-rtems.h, gthr-single.h, gthr-solaris.h, gthr-vxworks.h)
+ (gthr-win32.h, gthr.h): Remove.
+
+2011-11-02 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
+
+ * EXCLUDES (config/vxlib.c, gbl-ctors.h, libgcc2.c, libgcc2.h)
+ (longlong.h): Remove.
+
+2011-11-02 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
+
+ * EXCLUDES (crtstuff.c): Remove.
+
2011-10-30 Joseph Myers <joseph@codesourcery.com>
* ja.po: Update.
diff --git a/gcc/po/EXCLUDES b/gcc/po/EXCLUDES
index 5a4ad770973..e04b9239363 100644
--- a/gcc/po/EXCLUDES
+++ b/gcc/po/EXCLUDES
@@ -22,26 +22,10 @@
# .def are examined to begin with.
# These files are part of libgcc, or target headers provided by gcc.
-config/vxlib.c
-crtstuff.c
-gbl-ctors.h
gcov-io.h
gcov-iov.c
-gthr-aix.h
-gthr-dce.h
-gthr-posix.c
-gthr-posix.h
-gthr-rtems.h
-gthr-single.h
-gthr-solaris.h
-gthr-vxworks.h
-gthr-win32.h
-gthr.h
-libgcc2.c
-libgcc2.h
limitx.h
limity.h
-longlong.h
# These programs are meant to be executed only by GCC maintainers or
# installers. Such files do not need to be translated, as these
diff --git a/gcc/postreload.c b/gcc/postreload.c
index 8994366d922..886d024926c 100644
--- a/gcc/postreload.c
+++ b/gcc/postreload.c
@@ -112,8 +112,8 @@ reload_cse_simplify (rtx insn, rtx testreg)
if (REG_P (value)
&& ! REG_FUNCTION_VALUE_P (value))
value = 0;
- check_for_inc_dec (insn);
- delete_insn_and_edges (insn);
+ if (check_for_inc_dec (insn))
+ delete_insn_and_edges (insn);
return;
}
@@ -164,8 +164,8 @@ reload_cse_simplify (rtx insn, rtx testreg)
if (i < 0)
{
- check_for_inc_dec (insn);
- delete_insn_and_edges (insn);
+ if (check_for_inc_dec (insn))
+ delete_insn_and_edges (insn);
/* We're done with this insn. */
return;
}
diff --git a/gcc/print-rtl.c b/gcc/print-rtl.c
index db9c0fbbdd0..9bd8621c4ed 100644
--- a/gcc/print-rtl.c
+++ b/gcc/print-rtl.c
@@ -283,6 +283,7 @@ print_rtx (const_rtx in_rtx)
}
case NOTE_INSN_DELETED_LABEL:
+ case NOTE_INSN_DELETED_DEBUG_LABEL:
{
const char *label = NOTE_DELETED_LABEL_NAME (in_rtx);
if (label)
@@ -442,7 +443,8 @@ print_rtx (const_rtx in_rtx)
{
/* This field is only used for NOTE_INSN_DELETED_LABEL, and
other times often contains garbage from INSN->NOTE death. */
- if (NOTE_KIND (in_rtx) == NOTE_INSN_DELETED_LABEL)
+ if (NOTE_KIND (in_rtx) == NOTE_INSN_DELETED_LABEL
+ || NOTE_KIND (in_rtx) == NOTE_INSN_DELETED_DEBUG_LABEL)
fprintf (outfile, " %d", XINT (in_rtx, i));
}
#if !defined(GENERATOR_FILE) && NUM_UNSPECV_VALUES > 0
@@ -466,11 +468,10 @@ print_rtx (const_rtx in_rtx)
const char *name;
#ifndef GENERATOR_FILE
- if (REG_P (in_rtx) && value < FIRST_PSEUDO_REGISTER)
- fprintf (outfile, " %d %s", REGNO (in_rtx),
- reg_names[REGNO (in_rtx)]);
+ if (REG_P (in_rtx) && (unsigned) value < FIRST_PSEUDO_REGISTER)
+ fprintf (outfile, " %d %s", value, reg_names[value]);
else if (REG_P (in_rtx)
- && value <= LAST_VIRTUAL_REGISTER)
+ && (unsigned) value <= LAST_VIRTUAL_REGISTER)
{
if (value == VIRTUAL_INCOMING_ARGS_REGNUM)
fprintf (outfile, " %d virtual-incoming-args", value);
diff --git a/gcc/reginfo.c b/gcc/reginfo.c
index 537364192da..e9bf65f3003 100644
--- a/gcc/reginfo.c
+++ b/gcc/reginfo.c
@@ -1,7 +1,7 @@
/* Compute different info about registers.
Copyright (C) 1987, 1988, 1991, 1992, 1993, 1994, 1995, 1996
1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
- 2009, 2010 Free Software Foundation, Inc.
+ 2009, 2010, 2011 Free Software Foundation, Inc.
This file is part of GCC.
@@ -94,6 +94,9 @@ static tree GTY(()) global_regs_decl[FIRST_PSEUDO_REGISTER];
in dataflow more conveniently. */
regset regs_invalidated_by_call_regset;
+/* Same information as FIXED_REG_SET but in regset form. */
+regset fixed_reg_set_regset;
+
/* The bitmap_obstack is used to hold some static variables that
should not be reset after each function is compiled. */
static bitmap_obstack persistent_obstack;
@@ -451,6 +454,10 @@ init_reg_sets_1 (void)
}
else
CLEAR_REG_SET (regs_invalidated_by_call_regset);
+ if (!fixed_reg_set_regset)
+ fixed_reg_set_regset = ALLOC_REG_SET (&persistent_obstack);
+ else
+ CLEAR_REG_SET (fixed_reg_set_regset);
for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
{
@@ -462,7 +469,10 @@ init_reg_sets_1 (void)
#endif
if (fixed_regs[i])
- SET_HARD_REG_BIT (fixed_reg_set, i);
+ {
+ SET_HARD_REG_BIT (fixed_reg_set, i);
+ SET_REGNO_REG_SET (fixed_reg_set_regset, i);
+ }
if (call_used_regs[i])
SET_HARD_REG_BIT (call_used_reg_set, i);
diff --git a/gcc/regset.h b/gcc/regset.h
index 75082a06322..af807b03597 100644
--- a/gcc/regset.h
+++ b/gcc/regset.h
@@ -1,6 +1,6 @@
/* Define regsets.
Copyright (C) 1987, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
- 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+ 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
This file is part of GCC.
@@ -115,6 +115,9 @@ typedef bitmap_iterator reg_set_iterator;
extern regset regs_invalidated_by_call_regset;
+/* Same information as FIXED_REG_SET but in regset form. */
+extern regset fixed_reg_set_regset;
+
/* An obstack for regsets. */
extern bitmap_obstack reg_obstack;
diff --git a/gcc/reload1.c b/gcc/reload1.c
index 04a839ede7b..c9fb57baa4c 100644
--- a/gcc/reload1.c
+++ b/gcc/reload1.c
@@ -8601,10 +8601,10 @@ gen_reload (rtx out, rtx in, int opnum, enum reload_type type)
rtx loc = get_secondary_mem (in, GET_MODE (out), opnum, type);
if (GET_MODE (loc) != GET_MODE (out))
- out = gen_rtx_REG (GET_MODE (loc), REGNO (out));
+ out = gen_rtx_REG (GET_MODE (loc), reg_or_subregno (out));
if (GET_MODE (loc) != GET_MODE (in))
- in = gen_rtx_REG (GET_MODE (loc), REGNO (in));
+ in = gen_rtx_REG (GET_MODE (loc), reg_or_subregno (in));
gen_reload (loc, in, opnum, type);
gen_reload (out, loc, opnum, type);
diff --git a/gcc/rtl.h b/gcc/rtl.h
index 41536bea02c..fd3e3ef641e 100644
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -2396,7 +2396,7 @@ extern int exp_equiv_p (const_rtx, const_rtx, int, bool);
extern unsigned hash_rtx (const_rtx x, enum machine_mode, int *, int *, bool);
/* In dse.c */
-extern void check_for_inc_dec (rtx insn);
+extern bool check_for_inc_dec (rtx insn);
/* In jump.c */
extern int comparison_dominates_p (enum rtx_code, enum rtx_code);
diff --git a/gcc/sched-vis.c b/gcc/sched-vis.c
index 8c15788eecd..5b6ea9ed88a 100644
--- a/gcc/sched-vis.c
+++ b/gcc/sched-vis.c
@@ -511,6 +511,12 @@ print_value (char *buf, const_rtx x, int verbose)
sprintf (t, "#%d", SUBREG_BYTE (x));
cur = safe_concat (buf, cur, t);
break;
+ case STRICT_LOW_PART:
+ print_value (t, XEXP (x, 0), verbose);
+ cur = safe_concat (buf, cur, "strict_low_part(");
+ cur = safe_concat (buf, cur, t);
+ cur = safe_concat (buf, cur, ")");
+ break;
case SCRATCH:
cur = safe_concat (buf, cur, "scratch");
break;
diff --git a/gcc/sync-builtins.def b/gcc/sync-builtins.def
index 731d4a237c2..1a2df9ac018 100644
--- a/gcc/sync-builtins.def
+++ b/gcc/sync-builtins.def
@@ -256,3 +256,341 @@ DEF_SYNC_BUILTIN (BUILT_IN_SYNC_LOCK_RELEASE_16, "__sync_lock_release_16",
DEF_SYNC_BUILTIN (BUILT_IN_SYNC_SYNCHRONIZE, "__sync_synchronize",
BT_FN_VOID, ATTR_NOTHROW_LEAF_LIST)
+
+/* __sync* builtins for the C++ memory model. */
+
+DEF_SYNC_BUILTIN (BUILT_IN_ATOMIC_EXCHANGE,
+ "__atomic_exchange",
+ BT_FN_VOID_SIZE_VPTR_PTR_PTR_INT, ATTR_NOTHROW_LEAF_LIST)
+DEF_SYNC_BUILTIN (BUILT_IN_ATOMIC_EXCHANGE_N,
+ "__atomic_exchange_n",
+ BT_FN_VOID_VAR, ATTR_NOTHROW_LEAF_LIST)
+DEF_SYNC_BUILTIN (BUILT_IN_ATOMIC_EXCHANGE_1,
+ "__atomic_exchange_1",
+ BT_FN_I1_VPTR_I1_INT, ATTR_NOTHROW_LEAF_LIST)
+DEF_SYNC_BUILTIN (BUILT_IN_ATOMIC_EXCHANGE_2,
+ "__atomic_exchange_2",
+ BT_FN_I2_VPTR_I2_INT, ATTR_NOTHROW_LEAF_LIST)
+DEF_SYNC_BUILTIN (BUILT_IN_ATOMIC_EXCHANGE_4,
+ "__atomic_exchange_4",
+ BT_FN_I4_VPTR_I4_INT, ATTR_NOTHROW_LEAF_LIST)
+DEF_SYNC_BUILTIN (BUILT_IN_ATOMIC_EXCHANGE_8,
+ "__atomic_exchange_8",
+ BT_FN_I8_VPTR_I8_INT, ATTR_NOTHROW_LEAF_LIST)
+DEF_SYNC_BUILTIN (BUILT_IN_ATOMIC_EXCHANGE_16,
+ "__atomic_exchange_16",
+ BT_FN_I16_VPTR_I16_INT, ATTR_NOTHROW_LEAF_LIST)
+
+DEF_SYNC_BUILTIN (BUILT_IN_ATOMIC_LOAD,
+ "__atomic_load",
+ BT_FN_VOID_SIZE_CONST_VPTR_PTR_INT, ATTR_NOTHROW_LEAF_LIST)
+DEF_SYNC_BUILTIN (BUILT_IN_ATOMIC_LOAD_N,
+ "__atomic_load_n",
+ BT_FN_VOID_VAR, ATTR_NOTHROW_LEAF_LIST)
+DEF_SYNC_BUILTIN (BUILT_IN_ATOMIC_LOAD_1,
+ "__atomic_load_1",
+ BT_FN_I1_CONST_VPTR_INT, ATTR_NOTHROW_LEAF_LIST)
+DEF_SYNC_BUILTIN (BUILT_IN_ATOMIC_LOAD_2,
+ "__atomic_load_2",
+ BT_FN_I2_CONST_VPTR_INT, ATTR_NOTHROW_LEAF_LIST)
+DEF_SYNC_BUILTIN (BUILT_IN_ATOMIC_LOAD_4,
+ "__atomic_load_4",
+ BT_FN_I4_CONST_VPTR_INT, ATTR_NOTHROW_LEAF_LIST)
+DEF_SYNC_BUILTIN (BUILT_IN_ATOMIC_LOAD_8,
+ "__atomic_load_8",
+ BT_FN_I8_CONST_VPTR_INT, ATTR_NOTHROW_LEAF_LIST)
+DEF_SYNC_BUILTIN (BUILT_IN_ATOMIC_LOAD_16,
+ "__atomic_load_16",
+ BT_FN_I16_CONST_VPTR_INT, ATTR_NOTHROW_LEAF_LIST)
+
+DEF_SYNC_BUILTIN (BUILT_IN_ATOMIC_COMPARE_EXCHANGE,
+ "__atomic_compare_exchange",
+ BT_FN_BOOL_SIZE_VPTR_PTR_PTR_INT_INT,
+ ATTR_NOTHROW_LEAF_LIST)
+DEF_SYNC_BUILTIN (BUILT_IN_ATOMIC_COMPARE_EXCHANGE_N,
+ "__atomic_compare_exchange_n",
+ BT_FN_VOID_VAR, ATTR_NOTHROW_LEAF_LIST)
+DEF_SYNC_BUILTIN (BUILT_IN_ATOMIC_COMPARE_EXCHANGE_1,
+ "__atomic_compare_exchange_1",
+ BT_FN_BOOL_VPTR_PTR_I1_BOOL_INT_INT, ATTR_NOTHROW_LEAF_LIST)
+DEF_SYNC_BUILTIN (BUILT_IN_ATOMIC_COMPARE_EXCHANGE_2,
+ "__atomic_compare_exchange_2",
+ BT_FN_BOOL_VPTR_PTR_I2_BOOL_INT_INT, ATTR_NOTHROW_LEAF_LIST)
+DEF_SYNC_BUILTIN (BUILT_IN_ATOMIC_COMPARE_EXCHANGE_4,
+ "__atomic_compare_exchange_4",
+ BT_FN_BOOL_VPTR_PTR_I4_BOOL_INT_INT, ATTR_NOTHROW_LEAF_LIST)
+DEF_SYNC_BUILTIN (BUILT_IN_ATOMIC_COMPARE_EXCHANGE_8,
+ "__atomic_compare_exchange_8",
+ BT_FN_BOOL_VPTR_PTR_I8_BOOL_INT_INT, ATTR_NOTHROW_LEAF_LIST)
+DEF_SYNC_BUILTIN (BUILT_IN_ATOMIC_COMPARE_EXCHANGE_16,
+ "__atomic_compare_exchange_16",
+ BT_FN_BOOL_VPTR_PTR_I16_BOOL_INT_INT, ATTR_NOTHROW_LEAF_LIST)
+
+DEF_SYNC_BUILTIN (BUILT_IN_ATOMIC_STORE,
+ "__atomic_store",
+ BT_FN_VOID_SIZE_VPTR_PTR_INT, ATTR_NOTHROW_LEAF_LIST)
+DEF_SYNC_BUILTIN (BUILT_IN_ATOMIC_STORE_N,
+ "__atomic_store_n",
+ BT_FN_VOID_VAR, ATTR_NOTHROW_LEAF_LIST)
+DEF_SYNC_BUILTIN (BUILT_IN_ATOMIC_STORE_1,
+ "__atomic_store_1",
+ BT_FN_VOID_VPTR_I1_INT, ATTR_NOTHROW_LEAF_LIST)
+DEF_SYNC_BUILTIN (BUILT_IN_ATOMIC_STORE_2,
+ "__atomic_store_2",
+ BT_FN_VOID_VPTR_I2_INT, ATTR_NOTHROW_LEAF_LIST)
+DEF_SYNC_BUILTIN (BUILT_IN_ATOMIC_STORE_4,
+ "__atomic_store_4",
+ BT_FN_VOID_VPTR_I4_INT, ATTR_NOTHROW_LEAF_LIST)
+DEF_SYNC_BUILTIN (BUILT_IN_ATOMIC_STORE_8,
+ "__atomic_store_8",
+ BT_FN_VOID_VPTR_I8_INT, ATTR_NOTHROW_LEAF_LIST)
+DEF_SYNC_BUILTIN (BUILT_IN_ATOMIC_STORE_16,
+ "__atomic_store_16",
+ BT_FN_VOID_VPTR_I16_INT, ATTR_NOTHROW_LEAF_LIST)
+
+DEF_SYNC_BUILTIN (BUILT_IN_ATOMIC_ADD_FETCH_N,
+ "__atomic_add_fetch",
+ BT_FN_VOID_VAR, ATTR_NOTHROW_LEAF_LIST)
+DEF_SYNC_BUILTIN (BUILT_IN_ATOMIC_ADD_FETCH_1,
+ "__atomic_add_fetch_1",
+ BT_FN_I1_VPTR_I1_INT, ATTR_NOTHROW_LEAF_LIST)
+DEF_SYNC_BUILTIN (BUILT_IN_ATOMIC_ADD_FETCH_2,
+ "__atomic_add_fetch_2",
+ BT_FN_I2_VPTR_I2_INT, ATTR_NOTHROW_LEAF_LIST)
+DEF_SYNC_BUILTIN (BUILT_IN_ATOMIC_ADD_FETCH_4,
+ "__atomic_add_fetch_4",
+ BT_FN_I4_VPTR_I4_INT, ATTR_NOTHROW_LEAF_LIST)
+DEF_SYNC_BUILTIN (BUILT_IN_ATOMIC_ADD_FETCH_8,
+ "__atomic_add_fetch_8",
+ BT_FN_I8_VPTR_I8_INT, ATTR_NOTHROW_LEAF_LIST)
+DEF_SYNC_BUILTIN (BUILT_IN_ATOMIC_ADD_FETCH_16,
+ "__atomic_add_fetch_16",
+ BT_FN_I16_VPTR_I16_INT, ATTR_NOTHROW_LEAF_LIST)
+
+DEF_SYNC_BUILTIN (BUILT_IN_ATOMIC_SUB_FETCH_N,
+ "__atomic_sub_fetch",
+ BT_FN_VOID_VAR, ATTR_NOTHROW_LEAF_LIST)
+DEF_SYNC_BUILTIN (BUILT_IN_ATOMIC_SUB_FETCH_1,
+ "__atomic_sub_fetch_1",
+ BT_FN_I1_VPTR_I1_INT, ATTR_NOTHROW_LEAF_LIST)
+DEF_SYNC_BUILTIN (BUILT_IN_ATOMIC_SUB_FETCH_2,
+ "__atomic_sub_fetch_2",
+ BT_FN_I2_VPTR_I2_INT, ATTR_NOTHROW_LEAF_LIST)
+DEF_SYNC_BUILTIN (BUILT_IN_ATOMIC_SUB_FETCH_4,
+ "__atomic_sub_fetch_4",
+ BT_FN_I4_VPTR_I4_INT, ATTR_NOTHROW_LEAF_LIST)
+DEF_SYNC_BUILTIN (BUILT_IN_ATOMIC_SUB_FETCH_8,
+ "__atomic_sub_fetch_8",
+ BT_FN_I8_VPTR_I8_INT, ATTR_NOTHROW_LEAF_LIST)
+DEF_SYNC_BUILTIN (BUILT_IN_ATOMIC_SUB_FETCH_16,
+ "__atomic_sub_fetch_16",
+ BT_FN_I16_VPTR_I16_INT, ATTR_NOTHROW_LEAF_LIST)
+
+DEF_SYNC_BUILTIN (BUILT_IN_ATOMIC_AND_FETCH_N,
+ "__atomic_and_fetch",
+ BT_FN_VOID_VAR, ATTR_NOTHROW_LEAF_LIST)
+DEF_SYNC_BUILTIN (BUILT_IN_ATOMIC_AND_FETCH_1,
+ "__atomic_and_fetch_1",
+ BT_FN_I1_VPTR_I1_INT, ATTR_NOTHROW_LEAF_LIST)
+DEF_SYNC_BUILTIN (BUILT_IN_ATOMIC_AND_FETCH_2,
+ "__atomic_and_fetch_2",
+ BT_FN_I2_VPTR_I2_INT, ATTR_NOTHROW_LEAF_LIST)
+DEF_SYNC_BUILTIN (BUILT_IN_ATOMIC_AND_FETCH_4,
+ "__atomic_and_fetch_4",
+ BT_FN_I4_VPTR_I4_INT, ATTR_NOTHROW_LEAF_LIST)
+DEF_SYNC_BUILTIN (BUILT_IN_ATOMIC_AND_FETCH_8,
+ "__atomic_and_fetch_8",
+ BT_FN_I8_VPTR_I8_INT, ATTR_NOTHROW_LEAF_LIST)
+DEF_SYNC_BUILTIN (BUILT_IN_ATOMIC_AND_FETCH_16,
+ "__atomic_and_fetch_16",
+ BT_FN_I16_VPTR_I16_INT, ATTR_NOTHROW_LEAF_LIST)
+
+DEF_SYNC_BUILTIN (BUILT_IN_ATOMIC_NAND_FETCH_N,
+ "__atomic_nand_fetch",
+ BT_FN_VOID_VAR, ATTR_NOTHROW_LEAF_LIST)
+DEF_SYNC_BUILTIN (BUILT_IN_ATOMIC_NAND_FETCH_1,
+ "__atomic_nand_fetch_1",
+ BT_FN_I1_VPTR_I1_INT, ATTR_NOTHROW_LEAF_LIST)
+DEF_SYNC_BUILTIN (BUILT_IN_ATOMIC_NAND_FETCH_2,
+ "__atomic_nand_fetch_2",
+ BT_FN_I2_VPTR_I2_INT, ATTR_NOTHROW_LEAF_LIST)
+DEF_SYNC_BUILTIN (BUILT_IN_ATOMIC_NAND_FETCH_4,
+ "__atomic_nand_fetch_4",
+ BT_FN_I4_VPTR_I4_INT, ATTR_NOTHROW_LEAF_LIST)
+DEF_SYNC_BUILTIN (BUILT_IN_ATOMIC_NAND_FETCH_8,
+ "__atomic_nand_fetch_8",
+ BT_FN_I8_VPTR_I8_INT, ATTR_NOTHROW_LEAF_LIST)
+DEF_SYNC_BUILTIN (BUILT_IN_ATOMIC_NAND_FETCH_16,
+ "__atomic_nand_fetch_16",
+ BT_FN_I16_VPTR_I16_INT, ATTR_NOTHROW_LEAF_LIST)
+
+DEF_SYNC_BUILTIN (BUILT_IN_ATOMIC_XOR_FETCH_N,
+ "__atomic_xor_fetch",
+ BT_FN_VOID_VAR, ATTR_NOTHROW_LEAF_LIST)
+DEF_SYNC_BUILTIN (BUILT_IN_ATOMIC_XOR_FETCH_1,
+ "__atomic_xor_fetch_1",
+ BT_FN_I1_VPTR_I1_INT, ATTR_NOTHROW_LEAF_LIST)
+DEF_SYNC_BUILTIN (BUILT_IN_ATOMIC_XOR_FETCH_2,
+ "__atomic_xor_fetch_2",
+ BT_FN_I2_VPTR_I2_INT, ATTR_NOTHROW_LEAF_LIST)
+DEF_SYNC_BUILTIN (BUILT_IN_ATOMIC_XOR_FETCH_4,
+ "__atomic_xor_fetch_4",
+ BT_FN_I4_VPTR_I4_INT, ATTR_NOTHROW_LEAF_LIST)
+DEF_SYNC_BUILTIN (BUILT_IN_ATOMIC_XOR_FETCH_8,
+ "__atomic_xor_fetch_8",
+ BT_FN_I8_VPTR_I8_INT, ATTR_NOTHROW_LEAF_LIST)
+DEF_SYNC_BUILTIN (BUILT_IN_ATOMIC_XOR_FETCH_16,
+ "__atomic_xor_fetch_16",
+ BT_FN_I16_VPTR_I16_INT, ATTR_NOTHROW_LEAF_LIST)
+
+DEF_SYNC_BUILTIN (BUILT_IN_ATOMIC_OR_FETCH_N,
+ "__atomic_or_fetch",
+ BT_FN_VOID_VAR, ATTR_NOTHROW_LEAF_LIST)
+DEF_SYNC_BUILTIN (BUILT_IN_ATOMIC_OR_FETCH_1,
+ "__atomic_or_fetch_1",
+ BT_FN_I1_VPTR_I1_INT, ATTR_NOTHROW_LEAF_LIST)
+DEF_SYNC_BUILTIN (BUILT_IN_ATOMIC_OR_FETCH_2,
+ "__atomic_or_fetch_2",
+ BT_FN_I2_VPTR_I2_INT, ATTR_NOTHROW_LEAF_LIST)
+DEF_SYNC_BUILTIN (BUILT_IN_ATOMIC_OR_FETCH_4,
+ "__atomic_or_fetch_4",
+ BT_FN_I4_VPTR_I4_INT, ATTR_NOTHROW_LEAF_LIST)
+DEF_SYNC_BUILTIN (BUILT_IN_ATOMIC_OR_FETCH_8,
+ "__atomic_or_fetch_8",
+ BT_FN_I8_VPTR_I8_INT, ATTR_NOTHROW_LEAF_LIST)
+DEF_SYNC_BUILTIN (BUILT_IN_ATOMIC_OR_FETCH_16,
+ "__atomic_or_fetch_16",
+ BT_FN_I16_VPTR_I16_INT, ATTR_NOTHROW_LEAF_LIST)
+
+DEF_SYNC_BUILTIN (BUILT_IN_ATOMIC_FETCH_ADD_N,
+ "__atomic_fetch_add",
+ BT_FN_VOID_VAR, ATTR_NOTHROW_LEAF_LIST)
+DEF_SYNC_BUILTIN (BUILT_IN_ATOMIC_FETCH_ADD_1,
+ "__atomic_fetch_add_1",
+ BT_FN_I1_VPTR_I1_INT, ATTR_NOTHROW_LEAF_LIST)
+DEF_SYNC_BUILTIN (BUILT_IN_ATOMIC_FETCH_ADD_2,
+ "__atomic_fetch_add_2",
+ BT_FN_I2_VPTR_I2_INT, ATTR_NOTHROW_LEAF_LIST)
+DEF_SYNC_BUILTIN (BUILT_IN_ATOMIC_FETCH_ADD_4,
+ "__atomic_fetch_add_4",
+ BT_FN_I4_VPTR_I4_INT, ATTR_NOTHROW_LEAF_LIST)
+DEF_SYNC_BUILTIN (BUILT_IN_ATOMIC_FETCH_ADD_8,
+ "__atomic_fetch_add_8",
+ BT_FN_I8_VPTR_I8_INT, ATTR_NOTHROW_LEAF_LIST)
+DEF_SYNC_BUILTIN (BUILT_IN_ATOMIC_FETCH_ADD_16,
+ "__atomic_fetch_add_16",
+ BT_FN_I16_VPTR_I16_INT, ATTR_NOTHROW_LEAF_LIST)
+
+DEF_SYNC_BUILTIN (BUILT_IN_ATOMIC_FETCH_SUB_N,
+ "__atomic_fetch_sub",
+ BT_FN_VOID_VAR, ATTR_NOTHROW_LEAF_LIST)
+DEF_SYNC_BUILTIN (BUILT_IN_ATOMIC_FETCH_SUB_1,
+ "__atomic_fetch_sub_1",
+ BT_FN_I1_VPTR_I1_INT, ATTR_NOTHROW_LEAF_LIST)
+DEF_SYNC_BUILTIN (BUILT_IN_ATOMIC_FETCH_SUB_2,
+ "__atomic_fetch_sub_2",
+ BT_FN_I2_VPTR_I2_INT, ATTR_NOTHROW_LEAF_LIST)
+DEF_SYNC_BUILTIN (BUILT_IN_ATOMIC_FETCH_SUB_4,
+ "__atomic_fetch_sub_4",
+ BT_FN_I4_VPTR_I4_INT, ATTR_NOTHROW_LEAF_LIST)
+DEF_SYNC_BUILTIN (BUILT_IN_ATOMIC_FETCH_SUB_8,
+ "__atomic_fetch_sub_8",
+ BT_FN_I8_VPTR_I8_INT, ATTR_NOTHROW_LEAF_LIST)
+DEF_SYNC_BUILTIN (BUILT_IN_ATOMIC_FETCH_SUB_16,
+ "__atomic_fetch_sub_16",
+ BT_FN_I16_VPTR_I16_INT, ATTR_NOTHROW_LEAF_LIST)
+
+DEF_SYNC_BUILTIN (BUILT_IN_ATOMIC_FETCH_AND_N,
+ "__atomic_fetch_and",
+ BT_FN_VOID_VAR, ATTR_NOTHROW_LEAF_LIST)
+DEF_SYNC_BUILTIN (BUILT_IN_ATOMIC_FETCH_AND_1,
+ "__atomic_fetch_and_1",
+ BT_FN_I1_VPTR_I1_INT, ATTR_NOTHROW_LEAF_LIST)
+DEF_SYNC_BUILTIN (BUILT_IN_ATOMIC_FETCH_AND_2,
+ "__atomic_fetch_and_2",
+ BT_FN_I2_VPTR_I2_INT, ATTR_NOTHROW_LEAF_LIST)
+DEF_SYNC_BUILTIN (BUILT_IN_ATOMIC_FETCH_AND_4,
+ "__atomic_fetch_and_4",
+ BT_FN_I4_VPTR_I4_INT, ATTR_NOTHROW_LEAF_LIST)
+DEF_SYNC_BUILTIN (BUILT_IN_ATOMIC_FETCH_AND_8,
+ "__atomic_fetch_and_8",
+ BT_FN_I8_VPTR_I8_INT, ATTR_NOTHROW_LEAF_LIST)
+DEF_SYNC_BUILTIN (BUILT_IN_ATOMIC_FETCH_AND_16,
+ "__atomic_fetch_and_16",
+ BT_FN_I16_VPTR_I16_INT, ATTR_NOTHROW_LEAF_LIST)
+
+DEF_SYNC_BUILTIN (BUILT_IN_ATOMIC_FETCH_NAND_N,
+ "__atomic_fetch_nand",
+ BT_FN_VOID_VAR, ATTR_NOTHROW_LEAF_LIST)
+DEF_SYNC_BUILTIN (BUILT_IN_ATOMIC_FETCH_NAND_1,
+ "__atomic_fetch_nand_1",
+ BT_FN_I1_VPTR_I1_INT, ATTR_NOTHROW_LEAF_LIST)
+DEF_SYNC_BUILTIN (BUILT_IN_ATOMIC_FETCH_NAND_2,
+ "__atomic_fetch_nand_2",
+ BT_FN_I2_VPTR_I2_INT, ATTR_NOTHROW_LEAF_LIST)
+DEF_SYNC_BUILTIN (BUILT_IN_ATOMIC_FETCH_NAND_4,
+ "__atomic_fetch_nand_4",
+ BT_FN_I4_VPTR_I4_INT, ATTR_NOTHROW_LEAF_LIST)
+DEF_SYNC_BUILTIN (BUILT_IN_ATOMIC_FETCH_NAND_8,
+ "__atomic_fetch_nand_8",
+ BT_FN_I8_VPTR_I8_INT, ATTR_NOTHROW_LEAF_LIST)
+DEF_SYNC_BUILTIN (BUILT_IN_ATOMIC_FETCH_NAND_16,
+ "__atomic_fetch_nand_16",
+ BT_FN_I16_VPTR_I16_INT, ATTR_NOTHROW_LEAF_LIST)
+
+DEF_SYNC_BUILTIN (BUILT_IN_ATOMIC_FETCH_XOR_N,
+ "__atomic_fetch_xor",
+ BT_FN_VOID_VAR, ATTR_NOTHROW_LEAF_LIST)
+DEF_SYNC_BUILTIN (BUILT_IN_ATOMIC_FETCH_XOR_1,
+ "__atomic_fetch_xor_1",
+ BT_FN_I1_VPTR_I1_INT, ATTR_NOTHROW_LEAF_LIST)
+DEF_SYNC_BUILTIN (BUILT_IN_ATOMIC_FETCH_XOR_2,
+ "__atomic_fetch_xor_2",
+ BT_FN_I2_VPTR_I2_INT, ATTR_NOTHROW_LEAF_LIST)
+DEF_SYNC_BUILTIN (BUILT_IN_ATOMIC_FETCH_XOR_4,
+ "__atomic_fetch_xor_4",
+ BT_FN_I4_VPTR_I4_INT, ATTR_NOTHROW_LEAF_LIST)
+DEF_SYNC_BUILTIN (BUILT_IN_ATOMIC_FETCH_XOR_8,
+ "__atomic_fetch_xor_8",
+ BT_FN_I8_VPTR_I8_INT, ATTR_NOTHROW_LEAF_LIST)
+DEF_SYNC_BUILTIN (BUILT_IN_ATOMIC_FETCH_XOR_16,
+ "__atomic_fetch_xor_16",
+ BT_FN_I16_VPTR_I16_INT, ATTR_NOTHROW_LEAF_LIST)
+
+
+DEF_SYNC_BUILTIN (BUILT_IN_ATOMIC_FETCH_OR_N,
+ "__atomic_fetch_or",
+ BT_FN_VOID_VAR, ATTR_NOTHROW_LEAF_LIST)
+DEF_SYNC_BUILTIN (BUILT_IN_ATOMIC_FETCH_OR_1,
+ "__atomic_fetch_or_1",
+ BT_FN_I1_VPTR_I1_INT, ATTR_NOTHROW_LEAF_LIST)
+DEF_SYNC_BUILTIN (BUILT_IN_ATOMIC_FETCH_OR_2,
+ "__atomic_fetch_or_2",
+ BT_FN_I2_VPTR_I2_INT, ATTR_NOTHROW_LEAF_LIST)
+DEF_SYNC_BUILTIN (BUILT_IN_ATOMIC_FETCH_OR_4,
+ "__atomic_fetch_or_4",
+ BT_FN_I4_VPTR_I4_INT, ATTR_NOTHROW_LEAF_LIST)
+DEF_SYNC_BUILTIN (BUILT_IN_ATOMIC_FETCH_OR_8,
+ "__atomic_fetch_or_8",
+ BT_FN_I8_VPTR_I8_INT, ATTR_NOTHROW_LEAF_LIST)
+DEF_SYNC_BUILTIN (BUILT_IN_ATOMIC_FETCH_OR_16,
+ "__atomic_fetch_or_16",
+ BT_FN_I16_VPTR_I16_INT, ATTR_NOTHROW_LEAF_LIST)
+
+DEF_SYNC_BUILTIN (BUILT_IN_ATOMIC_ALWAYS_LOCK_FREE,
+ "__atomic_always_lock_free",
+ BT_FN_BOOL_SIZE_CONST_VPTR, ATTR_CONST_NOTHROW_LEAF_LIST)
+
+DEF_SYNC_BUILTIN (BUILT_IN_ATOMIC_IS_LOCK_FREE,
+ "__atomic_is_lock_free",
+ BT_FN_BOOL_SIZE_CONST_VPTR, ATTR_CONST_NOTHROW_LEAF_LIST)
+
+
+DEF_SYNC_BUILTIN (BUILT_IN_ATOMIC_THREAD_FENCE,
+ "__atomic_thread_fence",
+ BT_FN_VOID_INT, ATTR_NOTHROW_LEAF_LIST)
+
+DEF_SYNC_BUILTIN (BUILT_IN_ATOMIC_SIGNAL_FENCE,
+ "__atomic_signal_fence",
+ BT_FN_VOID_INT, ATTR_NOTHROW_LEAF_LIST)
+
diff --git a/gcc/target.def b/gcc/target.def
index d6d6cc39ca1..62bd06e976f 100644
--- a/gcc/target.def
+++ b/gcc/target.def
@@ -1039,6 +1039,14 @@ DEFHOOK
(void),
default_autovectorize_vector_sizes)
+/* Target builtin that implements vector gather operation. */
+DEFHOOK
+(builtin_gather,
+ "",
+ tree,
+ (const_tree mem_vectype, const_tree index_type, int scale),
+ NULL)
+
HOOK_VECTOR_END (vectorize)
#undef HOOK_PREFIX
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 28f918a4324..1560c27c25d 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,392 @@
+2011-11-07 Dodji Seketeli <dodji@redhat.com>
+
+ Support C++11 alias-declaration
+ PR c++/45114
+ * g++.dg/cpp0x/alias-decl-0.C: New test case.
+ * g++.dg/cpp0x/alias-decl-1.C: Likewise.
+ * g++.dg/cpp0x/alias-decl-3.C: Likewise.
+ * g++.dg/cpp0x/alias-decl-4.C: Likewise.
+ * g++.dg/cpp0x/alias-decl-6.C: Likewise.
+ * g++.dg/cpp0x/alias-decl-7.C: Likewise.
+ * g++.dg/cpp0x/alias-decl-8.C: Likewise.
+ * g++.dg/cpp0x/alias-decl-9.C: Likewise.
+ * g++.dg/cpp0x/alias-decl-10.C: Likewise.
+ * g++.dg/ext/alias-decl-attr1.C: Likewise.
+ * g++.dg/ext/alias-decl-attr2.C: Likewise.
+ * g++.dg/ext/alias-decl-attr3.C: Likewise.
+ * g++.dg/ext/alias-decl-attr4.C: Likewise.
+
+2011-11-07 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gcc.dg/pragma-align-2.c: Compile with -std=gnu99.
+
+2011-11-07 Janus Weil <janus@gcc.gnu.org>
+
+ PR fortran/50919
+ * gfortran.dg/typebound_call_21.f03: New.
+
+2011-11-07 Nathan Sidwell <nathan@acm.org>
+
+ * gcc.dg/profile-dir-1.c: Adjust final scan.
+ * gcc.dg/profile-dir-2.c: Adjust final scan.
+ * gcc.dg/profile-dir-3.c: Adjust final scan.
+ * gcc.misc-tests/gcov.exp: Adjust regexp.
+ * gcc.misc-tests/gcov-12.c: New.
+ * gcc.misc-tests/gcov-13.c: New.
+ * gcc.misc-tests/gcovpart-13b.c: New.
+ * gcc.misc-tests/gcov-14.c: New.
+
+2011-11-07 Jason Merrill <jason@redhat.com>
+
+ PR c++/35688
+ * g++.dg/ext/visibility/template8.C: New.
+
+2011-11-07 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/50789
+ * gcc.target/i386/avx2-gather-1.c: New test.
+ * gcc.target/i386/avx2-gather-2.c: New test.
+ * gcc.target/i386/avx2-gather-3.c: New test.
+ * gcc.target/i386/avx2-gather-4.c: New test.
+
+2011-11-07 Uros Bizjak <ubizjak@gmail.com>
+
+ * gcc.target/i386/pr49781-1.c (dg-options): Add -mtune=generic.
+
+2011-11-07 Janne Blomqvist <jb@gcc.gnu.org>
+
+ PR libfortran/45723
+ * gfortran.dg/open_dev_null.f90: Remove testcase.
+
+2011-11-07 Uros Bizjak <ubizjak@gmail.com>
+
+ * lib/target-supports.exp (check_effective_target_sync_int_128):
+ Don't cache the result.
+ (check_effective_target_sync_long_long): Ditto.
+
+2011-11-07 Sergey Ostanevich <sergos.gnu@gmail.com>
+
+ PR rtl-optimization/47698
+ * gcc.target/i386/47698.c: New test.
+
+2011-11-06 Jason Merrill <jason@redhat.com>
+
+ PR c++/35688
+ * g++.dg/ext/visibility/template7.C: New.
+
+2011-11-07 Terry Guo <terry.guo@arm.com>
+
+ * gcc.target/arm/wmul-1.c: Adjust optimization level.
+ * gcc.target/arm/wmul-2.c: Ditto.
+ * gcc.target/arm/wmul-3.c: Ditto.
+ * gcc.target/arm/wmul-4.c: Ditto.
+
+2011-11-06 Joseph Myers <joseph@codesourcery.com>
+
+ * g++.dg/cpp0x/alignof3.C, gcc.dg/c1x-align-1.c,
+ gcc.dg/c1x-align-2.c, gcc.dg/c1x-align-3.c, gcc.dg/c1x-align-4.c,
+ gcc.dg/c90-align-1.c, gcc.dg/c99-align-1.c: New tests.
+ * gcc.dg/gnu89-const-expr-1.c, gcc.dg/gnu90-const-expr-1.c,
+ gcc.dg/gnu99-const-expr-1.c, gcc.dg/gnu99-static-1.c: Update
+ expected diagnostics.
+
+2011-11-06 Andrew MacLeod <amacleod@redhat.com>
+ Richard Henderson <rth@redhat.com>
+ Aldy Hernandez <aldyh@redhat.com>
+
+ Merged from cxx-mem-model.
+
+ * lib/target-supports.exp (check_effective_target_sync_int_128,
+ check_effective_target_sync_long_long): Check whether the target
+ supports 64 and 128 bit __sync builtins.
+ (check_effective_target_cas_char): New.
+ (check_effective_target_cas_int): New.
+ * gcc.dg/dg.exp: Exclude simulate-thread tests.
+ * gcc.dg/atomic-noinline[-aux].c: New. Make a variety of atomics calls.
+ * gcc.dg/atomic-generic[-aux].c: New. Test that generic functions
+ produce the expected library calls.
+ * gcc.dg/atomic-fence.c: New functional tests.
+ * gcc.dg/atomic-param.c: New. Checl for illegal number of parameters.
+ * gcc.dg/atomic-invalid.c: New. Test invalid parameters.
+ * gcc.dg/atomic-lockfree[-aux].c: New tests.
+ * gcc.dg/atomic-compare-exchange-{1-5}.c: New functional tests.
+ * gcc.dg/atomic-op-[1-5].c: New. Test atomic fetch functionality.
+ * gcc.dg/atomic-exchange-{1-5}.c: New functional tests.
+ * gcc.dg/atomic-load-{1-5}.c: New functional tests.
+ * gcc.dg/atomic-store-{1-5}.c: New functional tests.
+ * gcc.dg/simulate-thread/atomic-load-int128.c: New. Verify int128 loads
+ are atomic.
+ * gcc.dg/simulate-thread/atomic-load-longlong.c: New. Verify 8 byte
+ loads are atomic.
+ * gcc.dg/simulate-thread/atomic-load-int.c: New. Verify 4 byte loads
+ are atomic.
+ * gcc.dg/simulate-thread/atomic-load-short.c: New. Verify 2 byte loads
+ are atomic.
+ * gcc.dg/simulate-thread/atomic-other-int128.c: New. Verify other
+ int128 operations are atomic.
+ * gcc.dg/simulate-thread/atomic-other-int.c: New. Verify other 4 byte
+ operations are atomic.
+ * gcc.dg/simulate-thread/atomic-other-longlong.c: New. Verify 8 byte
+ operations are atomic.
+ * gcc.dg/simulate-thread/atomic-other-short.c: New. Verify other 2 byte
+ operations are atomic.
+ * gcc.dg/simulate-thread/speculative-store.c: New. Verify speculative
+ stores aren't moved out of a loop.
+ * gcc.dg/simulate-thread/strict-align-global.c: New. Verify small
+ globals don't overwrite neighbouring globals.
+ * gcc.dg/simulate-thread/subfields.c: New. Verify struct component
+ writes dont overwrite neighbouring components.
+ * c-c++-common/gomp/atomic-10.c: Use cas_int; match __atomic builtin.
+ * c-c++-common/gomp/atomic-3.c: Likewise.
+ * c-c++-common/gomp/atomic-9.c: Likewise.
+ * gcc.dg/gomp/atomic-1.c, gcc.dg/gomp/atomic-2.c,
+ gcc.dg/gomp/atomic-3.c, gcc.dg/gomp/atomic-4.c, gcc.dg/gomp/atomic-7.c,
+ gcc.dg/gomp/atomic-8.c, gcc.dg/gomp/atomic-9.c,
+ gcc.dg/gomp/atomic-10.c, gcc.dg/gomp/atomic-12.c,
+ gcc.dg/gomp/atomic-13.c, gcc.dg/gomp/atomic-14.c,
+ gcc.dg/gomp/atomic-15.c: Move to c-c++-common/gomp/.
+ * g++.dg/gomp/atomic-1.C, g++.dg/gomp/atomic-2.C,
+ g++.dg/gomp/atomic-3.C, g++.dg/gomp/atomic-4.C, g++.dg/gomp/atomic-7.C,
+ g++.dg/gomp/atomic-8.C, g++.dg/gomp/atomic-9.C,
+ g++.dg/gomp/atomic-10.C, g++.dg/gomp/atomic-11.C,
+ g++.dg/gomp/atomic-12.C, g++.dg/gomp/atomic-13.C,
+ g++.dg/gomp/atomic-15.C: Remove.
+ * gcc.dg/gomp/gomp.exp, g++.dg/gomp/gomp.exp: Run c-c++-common tests.
+ * gcc.dg/gomp/atomic-11.c: Remove test.
+
+2011-11-06 Ira Rosen <ira.rosen@linaro.org>
+
+ * gcc.dg/vect/bb-slp-cond-1.c: New test.
+ * gcc.dg/vect/slp-cond-1.c: New test.
+ * gcc.dg/vect/slp-cond-2.c: New test.
+
+2011-11-05 David S. Miller <davem@davemloft.net>
+
+ * lib/test-supports.exp
+ (check_effective_target_ultrasparc_vis2_hw): New proc.
+ (check_effective_target_ultrasparc_vis3_hw): New proc.
+ * gcc.target/sparc/vec-init-1.inc: New vector init common code.
+ * gcc.target/sparc/vec-init-2.inc: Likewise.
+ * gcc.target/sparc/vec-init-3.inc: Likewise.
+ * gcc.target/sparc/vec-init-1-vis1.c: New test.
+ * gcc.target/sparc/vec-init-1-vis2.c: New test.
+ * gcc.target/sparc/vec-init-1-vis3.c: New test.
+ * gcc.target/sparc/vec-init-2-vis1.c: New test.
+ * gcc.target/sparc/vec-init-2-vis2.c: New test.
+ * gcc.target/sparc/vec-init-2-vis3.c: New test.
+ * gcc.target/sparc/vec-init-3-vis1.c: New test.
+ * gcc.target/sparc/vec-init-3-vis2.c: New test.
+ * gcc.target/sparc/vec-init-3-vis3.c: New test.
+
+2011-11-05 Joern Rennecke <joern.rennecke@embecosm.com>
+
+ * gcc.c-torture/execute/ieee/mul-subnormal-single-1.x:
+ Disable test on Epiphany.
+ * gcc.c-torture/execute/20101011-1.c: Disable test on Epiphany.
+ * gcc.dg/stack-usage-1.c [__epiphany__] (SIZE): Define.
+ * gcc.dg/pragma-pack-3.c: Disable test on Epiphany.
+ * g++.dg/parse/pragma3.C: Likewise.
+ * stackalign/builtin-apply-2.c (STACK_ARGUMENTS_SIZE): Define.
+ (bar): Use it.
+ * gcc.dg/weak/typeof-2.c [epiphany-*-*]: Add option -mshort-calls.
+ * gcc.dg/tls/thr-cse-1.c: Likewise.
+ * g++.dg/opt/devirt2.C: Likewise.
+ * gcc.dg/20020312-2.c [epiphany-*-*] (PIC_REG): Define.
+ * gcc.dg/builtin-apply2.c [__epiphany__]: (STACK_ARGUMENTS_SIZE): 20.
+ * gcc.target/epiphany: New directory.
+
+2011-11-05 Tobias Burnus <burnus@net-b.de>
+
+ * gfortran.dg/quad_2.f90: New.
+
+2011-11-05 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gcc.dg/strlenopt-22g.c: New wrapper around...
+ * gcc.dg/strlenopt-22.c: ...this. Do not define USE_GNU and adjust.
+
+2011-11-04 Jason Merrill <jason@redhat.com>
+
+ PR c++/26714
+ * g++.dg/init/lifetime2.C: New.
+ * g++.dg/cpp0x/initlist-lifetime2.C: New.
+
+ PR c++/48370
+ * g++.dg/init/lifetime1.C: Test cleanup order.
+
+2011-11-04 Eric Botcazou <ebotcazou@adacore.com>
+
+ * g++.dg/other/offsetof7.C: New test.
+
+2011-11-04 Hans-Peter Nilsson <hp@axis.com>
+
+ * lib/gcc-dg.exp (gcc_force_conventional_output): New global
+ variable, default empty, -ffat-lto-objects for effective_target_lto.
+ (gcc-dg-test-1): Add options from dg-final methods.
+ * lib/scanasm.exp (scan-assembler_required_options)
+ (scan-assembler-not_required_options): New procs.
+
+2011-10-09 Magnus Fromreide <magfr@lysator.liu.se>
+
+ * g++.dg/cpp0x/enum21a.C: Test that enum x { y, } does
+ generate a pedwarn in c++98-mode.
+ * g++.dg/cpp0x/enum21b.C: Test that enum x { y, }
+ don't generate a pedwarn in c++0x-mode.
+
+2011-11-04 Olivier Goffart <olivier@woboq.com>
+
+ PR c++/50965
+ * g++.dg/cpp0x/nsdmi1.C: Add more cases.
+
+2011-11-04 Jiangning Liu <jiangning.liu@arm.com>
+
+ PR rtl-optimization/38644
+ * gcc.target/arm/stack-red-zone.c: New.
+
+2011-11-04 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/48420
+ * g++.dg/warn/Wconversion-null-3.C: New.
+
+2011-11-04 Ed Smith-Rowland <3dw4rd@verizon.net>
+
+ PR c++/50941
+ * g++.dg/cpp0x/udlit-strint-length.C: New.
+
+2011-11-04 Jason Merrill <jason@redhat.com>
+
+ PR c++/48370
+ * g++.dg/cpp0x/initlist-lifetime1.C: New.
+ * g++.dg/init/lifetime1.C: New.
+ * g++.dg/init/ref21.C: New.
+ * g++.dg/eh/array1.C: New.
+
+2011-11-04 Tom de Vries <tom@codesourcery.com>
+
+ PR tree-optimization/50763
+ * gcc.dg/pr50763-5.c: New test.
+
+2011-11-04 Tom de Vries <tom@codesourcery.com>
+
+ PR tree-optimization/50763
+ * g++.dg/pr50763-4.C: New test.
+
+2011-11-04 Jakub Jelinek <jakub@redhat.com>
+
+ * gcc.dg/torture/vec-cvt-1.c: Enable commented out inttoflttestui
+ test.
+
+ * gcc.dg/torture/vec-cvt-1.c: Enable flttointtestui test.
+
+ * gcc.dg/torture/vec-cvt-1.c: New test.
+
+2011-11-04 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gnat.dg/specs/private1[-sub].ads: New test.
+
+2011-11-04 Mikael Morin <mikael@gcc.gnu.org>
+
+ PR fortran/43829
+ * gfortran.dg/function_optimize_7.f90: Disable sum inlining.
+ * gfortran.dg/inline_sum_1.f90: New.
+ * gfortran.dg/inline_sum_2.f90: New.
+ * gfortran.dg/inline_sum_bounds_check_1.f90: New.
+ * gfortran.dg/inline_sum_bounds_check_2.f90: New.
+ * gfortran.dg/inline_product_1.f90: New.
+
+2011-11-03 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/50933
+ * gfortran.dg/bind_c_dts_5.f90: New.
+
+2011-11-03 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/50960
+ * gfortran.dg/module_parameter_array_refs_2.f90: New.
+
+2011-11-03 Richard Guenther <rguenther@suse.de>
+
+ PR middle-end/50079
+ * g++.dg/init/copy7.C: Remove testcase.
+
+2011-11-03 Martin Jambor <mjambor@suse.cz>
+
+ * g++.dg/ipa/devirt-c-1.C: Add dump scans.
+ * g++.dg/ipa/devirt-c-2.C: Likewise.
+ * g++.dg/ipa/devirt-c-7.C: New test.
+ * g++.dg/ipa/devirt-c-8.C: Likewise.
+
+2011-11-03 Ira Rosen <ira.rosen@linaro.org>
+
+ PR tree-optimization/50912
+ * gnat.dg/loop_optimization10.ad[sb]: New test.
+ * gnat.dg/loop_optimization10_pkg.ads: New helper.
+
+2011-11-02 Jason Merrill <jason@redhat.com>
+
+ PR c++/50930
+ * g++.dg/cpp0x/nsdmi-list2.C: New.
+
+2011-11-02 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/50810
+ * g++.dg/cpp0x/warn_cxx0x2.C: New.
+ * g++.dg/cpp0x/warn_cxx0x3.C: Likewise.
+
+2011-11-02 Tom de Vries <tom@codesourcery.com>
+
+ PR tree-optimization/50769
+ * gfortran.dg/pr50769.f90: New test.
+
+2011-11-02 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gcc.target/sparc/20111102-1.c: New test.
+
+2011-11-02 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/50956
+ * g++.dg/warn/Wcast-qual2.C: New.
+
+2011-11-02 Tom de Vries <tom@codesourcery.com>
+
+ PR tree-optimization/50763
+ * g++.dg/pr50763-3.C: New test.
+
+2011-11-02 Tom de Vries <tom@codesourcery.com>
+
+ PR tree-optimization/50672
+ * g++.dg/pr50672.C: New test.
+
+2011-11-02 Uros Bizjak <ubizjak@gmail.com>
+
+ * gcc.target/i386/avx-cvt-2.c (dg-options): Add -mtune=generic.
+ * gcc.target/i386/avx2-cvt-2.c (dg-options): Ditto.
+ * gcc.target/i386/sse2-cvt-2.c (dg-options): Ditto.
+
+ * gcc.target/i386/vectorize4-avx.c (scan-assembler): Remove xfail.
+
+2011-11-02 Richard Guenther <rguenther@suse.de>
+
+ PR tree-optimization/50902
+ * gcc.dg/torture/pr50902.c: New testcase.
+
+2010-11-02 Richard Guenther <rguenther@suse.de>
+
+ PR tree-optimization/50890
+ * gcc.dg/torture/pr50890.c: New testcase.
+
+2011-11-01 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/44277
+ * g++.dg/warn/Wzero-as-null-pointer-constant-1.C: New.
+ * g++.dg/cpp0x/Wzero-as-null-pointer-constant-1.C: Likewise.
+
+2011-11-01 Tom de Vries <tom@codesourcery.com>
+
+ PR tree-optimization/50908
+ * gcc.dg/pr50908.c: New test.
+ * gcc.dg/pr50908-2.c: Same.
+ * gcc.dg/pr50908-3.c: Same.
+
2011-11-01 Ira Rosen <ira.rosen@linaro.org>
* gcc.dg/vect/no-scevccp-outer-6-global.c: Expect to vectorize
@@ -62,7 +451,7 @@
2011-10-28 Paolo Carlini <paolo.carlini@oracle.com>
Revert:
- 2011-10-28 Paolo Carlini <paolo.carlini@oracle.com>
+ 2011-10-28 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/50864
* g++.dg/template/crash109.C: New.
diff --git a/gcc/testsuite/gcc.dg/gomp/atomic-1.c b/gcc/testsuite/c-c++-common/gomp/atomic-1.c
index 3e4bc569ba7..3e4bc569ba7 100644
--- a/gcc/testsuite/gcc.dg/gomp/atomic-1.c
+++ b/gcc/testsuite/c-c++-common/gomp/atomic-1.c
diff --git a/gcc/testsuite/gcc.dg/gomp/atomic-10.c b/gcc/testsuite/c-c++-common/gomp/atomic-10.c
index 936d0c1f223..21d035e15c9 100644
--- a/gcc/testsuite/gcc.dg/gomp/atomic-10.c
+++ b/gcc/testsuite/c-c++-common/gomp/atomic-10.c
@@ -1,6 +1,7 @@
/* PR middle-end/28046 */
/* { dg-do compile } */
/* { dg-options "-fopenmp -fdump-tree-ompexp" } */
+/* { dg-require-effective-target cas_int } */
int a[3], b;
struct C { int x; int y; } c;
@@ -20,5 +21,5 @@ foo (void)
*baz () += bar ();
}
-/* { dg-final { scan-tree-dump-times "__sync_fetch_and_add" 4 "ompexp" { target i?86-*-* x86_64-*-* ia64-*-* powerpc*-*-* alpha*-*-* } } } */
+/* { dg-final { scan-tree-dump-times "__atomic_fetch_add" 4 "ompexp" } } */
/* { dg-final { cleanup-tree-dump "ompexp" } } */
diff --git a/gcc/testsuite/gcc.dg/gomp/atomic-12.c b/gcc/testsuite/c-c++-common/gomp/atomic-12.c
index 618c4c8e648..618c4c8e648 100644
--- a/gcc/testsuite/gcc.dg/gomp/atomic-12.c
+++ b/gcc/testsuite/c-c++-common/gomp/atomic-12.c
diff --git a/gcc/testsuite/gcc.dg/gomp/atomic-13.c b/gcc/testsuite/c-c++-common/gomp/atomic-13.c
index 0146825f2bb..0146825f2bb 100644
--- a/gcc/testsuite/gcc.dg/gomp/atomic-13.c
+++ b/gcc/testsuite/c-c++-common/gomp/atomic-13.c
diff --git a/gcc/testsuite/gcc.dg/gomp/atomic-14.c b/gcc/testsuite/c-c++-common/gomp/atomic-14.c
index f8fc9d87257..f8fc9d87257 100644
--- a/gcc/testsuite/gcc.dg/gomp/atomic-14.c
+++ b/gcc/testsuite/c-c++-common/gomp/atomic-14.c
diff --git a/gcc/testsuite/gcc.dg/gomp/atomic-15.c b/gcc/testsuite/c-c++-common/gomp/atomic-15.c
index 13a9e0ce48a..13a9e0ce48a 100644
--- a/gcc/testsuite/gcc.dg/gomp/atomic-15.c
+++ b/gcc/testsuite/c-c++-common/gomp/atomic-15.c
diff --git a/gcc/testsuite/gcc.dg/gomp/atomic-2.c b/gcc/testsuite/c-c++-common/gomp/atomic-2.c
index 720ec9e8ba0..720ec9e8ba0 100644
--- a/gcc/testsuite/gcc.dg/gomp/atomic-2.c
+++ b/gcc/testsuite/c-c++-common/gomp/atomic-2.c
diff --git a/gcc/testsuite/gcc.dg/gomp/atomic-3.c b/gcc/testsuite/c-c++-common/gomp/atomic-3.c
index 7ea792d3457..5b9e60cde8b 100644
--- a/gcc/testsuite/gcc.dg/gomp/atomic-3.c
+++ b/gcc/testsuite/c-c++-common/gomp/atomic-3.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-fopenmp -fdump-tree-ompexp" } */
+/* { dg-require-effective-target cas_int } */
int *xyzzy;
@@ -9,5 +10,5 @@ void f1(void)
xyzzy++;
}
-/* { dg-final { scan-tree-dump-times "xyzzy, 4" 1 "ompexp" { target i?86-*-* x86_64-*-* ia64-*-* powerpc*-*-* alpha*-*-* } } } */
+/* { dg-final { scan-tree-dump-times "xyzzy, 4" 1 "ompexp" } } */
/* { dg-final { cleanup-tree-dump "ompexp" } } */
diff --git a/gcc/testsuite/gcc.dg/gomp/atomic-4.c b/gcc/testsuite/c-c++-common/gomp/atomic-4.c
index 7f27370d535..7f27370d535 100644
--- a/gcc/testsuite/gcc.dg/gomp/atomic-4.c
+++ b/gcc/testsuite/c-c++-common/gomp/atomic-4.c
diff --git a/gcc/testsuite/gcc.dg/gomp/atomic-7.c b/gcc/testsuite/c-c++-common/gomp/atomic-7.c
index 612e97f4530..612e97f4530 100644
--- a/gcc/testsuite/gcc.dg/gomp/atomic-7.c
+++ b/gcc/testsuite/c-c++-common/gomp/atomic-7.c
diff --git a/gcc/testsuite/gcc.dg/gomp/atomic-8.c b/gcc/testsuite/c-c++-common/gomp/atomic-8.c
index 2f04151f0ed..2f04151f0ed 100644
--- a/gcc/testsuite/gcc.dg/gomp/atomic-8.c
+++ b/gcc/testsuite/c-c++-common/gomp/atomic-8.c
diff --git a/gcc/testsuite/gcc.dg/gomp/atomic-9.c b/gcc/testsuite/c-c++-common/gomp/atomic-9.c
index 2fafbd4097a..ff5cb4091f9 100644
--- a/gcc/testsuite/gcc.dg/gomp/atomic-9.c
+++ b/gcc/testsuite/c-c++-common/gomp/atomic-9.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-fopenmp -fdump-tree-ompexp" } */
+/* { dg-require-effective-target cas_int } */
volatile int *bar(void);
@@ -9,5 +10,5 @@ void f1(void)
*bar() += 1;
}
-/* { dg-final { scan-tree-dump-times "__sync_fetch_and_add" 1 "ompexp" { target i?86-*-* x86_64-*-* ia64-*-* powerpc*-*-* alpha*-*-* } } } */
+/* { dg-final { scan-tree-dump-times "__atomic_fetch_add" 1 "ompexp" } } */
/* { dg-final { cleanup-tree-dump "ompexp" } } */
diff --git a/gcc/testsuite/g++.dg/cpp0x/Wzero-as-null-pointer-constant-1.C b/gcc/testsuite/g++.dg/cpp0x/Wzero-as-null-pointer-constant-1.C
new file mode 100644
index 00000000000..aad273792ac
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/Wzero-as-null-pointer-constant-1.C
@@ -0,0 +1,161 @@
+// { dg-options "-std=c++0x -Wzero-as-null-pointer-constant" }
+
+struct A;
+
+typedef int (A::*pointmemfun) (int);
+typedef int (A::*pointdmem);
+typedef int (*pointfun) (int);
+
+pointmemfun pmfs;
+pointdmem pdms;
+pointfun pfs;
+int* ps;
+
+void f()
+{
+ pointmemfun pmf(0); // { dg-warning "zero as null pointer" }
+ pointdmem pdm(0); // { dg-warning "zero as null pointer" }
+ pointfun pf(0); // { dg-warning "zero as null pointer" }
+ int* p(0); // { dg-warning "zero as null pointer" }
+
+ pointmemfun pmfn(nullptr);
+ pointdmem pdmn(nullptr);
+ pointfun pfn(nullptr);
+ int* pn(nullptr);
+
+ pmf = 0; // { dg-warning "zero as null pointer" }
+
+ pdm = 0; // { dg-warning "zero as null pointer" }
+
+ pf = 0; // { dg-warning "zero as null pointer" }
+
+ p = 0; // { dg-warning "zero as null pointer" }
+
+ pmf = nullptr;
+
+ pdm = nullptr;
+
+ pf = nullptr;
+
+ p = nullptr;
+
+ if (pmf)
+ ;
+
+ if (pdm)
+ ;
+
+ if (pf)
+ ;
+
+ if (p)
+ ;
+
+ if (!pmf)
+ ;
+
+ if (!pdm)
+ ;
+
+ if (!pf)
+ ;
+
+ if (!p)
+ ;
+
+ if (pmf == 0) // { dg-warning "zero as null pointer" }
+ ;
+
+ if (pdm == 0) // { dg-warning "zero as null pointer" }
+ ;
+
+ if (pf == 0) // { dg-warning "zero as null pointer" }
+ ;
+
+ if (p == 0) // { dg-warning "zero as null pointer" }
+ ;
+
+ if (0 == pmf) // { dg-warning "zero as null pointer" }
+ ;
+
+ if (0 == pdm) // { dg-warning "zero as null pointer" }
+ ;
+
+ if (0 == pf) // { dg-warning "zero as null pointer" }
+ ;
+
+ if (0 == p) // { dg-warning "zero as null pointer" }
+ ;
+
+ if (pmf != 0) // { dg-warning "zero as null pointer" }
+ ;
+
+ if (pdm != 0) // { dg-warning "zero as null pointer" }
+ ;
+
+ if (pf != 0) // { dg-warning "zero as null pointer" }
+ ;
+
+ if (p != 0) // { dg-warning "zero as null pointer" }
+ ;
+
+ if (0 != pmf) // { dg-warning "zero as null pointer" }
+ ;
+
+ if (0 != pdm) // { dg-warning "zero as null pointer" }
+ ;
+
+ if (0 != pf) // { dg-warning "zero as null pointer" }
+ ;
+
+ if (0 != p) // { dg-warning "zero as null pointer" }
+ ;
+
+ if (pmf == nullptr)
+ ;
+
+ if (pdm == nullptr)
+ ;
+
+ if (pf == nullptr)
+ ;
+
+ if (p == nullptr)
+ ;
+
+ if (nullptr == pmf)
+ ;
+
+ if (nullptr == pdm)
+ ;
+
+ if (nullptr == pf)
+ ;
+
+ if (nullptr == p)
+ ;
+
+ if (pmf != nullptr)
+ ;
+
+ if (pdm != nullptr)
+ ;
+
+ if (pf != nullptr)
+ ;
+
+ if (p != nullptr)
+ ;
+
+ if (nullptr != pmf)
+ ;
+
+ if (nullptr != pdm)
+ ;
+
+ if (nullptr != pf)
+ ;
+
+ if (nullptr != p)
+ ;
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/alias-decl-0.C b/gcc/testsuite/g++.dg/cpp0x/alias-decl-0.C
new file mode 100644
index 00000000000..c5760cfe537
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/alias-decl-0.C
@@ -0,0 +1,37 @@
+// { dg-options "-std=c++0x" }
+
+template<template<class> class TT> struct X { };
+template<class> struct Y { };
+template<class T> using Z = Y<T>;
+
+void f(X<Y>);
+void g(X<Z>);
+
+void
+foo()
+{
+ // Below x and y don't have the same type, because Y and Z don't
+ // designate the same template ...
+ X<Y> y;
+ X<Z> z;
+
+ // ... So these must fail to compile.
+ f(z); // { dg-error "" }
+ g(y); // { dg-error "" }
+}
+
+template<class> struct A0 {};
+template<class T> using AA0 = A0<T>;
+template<class T> using AAA0 = AA0<T>;
+
+void f0(A0<int>);
+void
+g0()
+{
+ AA0<int> a;
+ AAA0<int> b;
+ f0(a);
+ f0(b);
+}
+
+
diff --git a/gcc/testsuite/g++.dg/cpp0x/alias-decl-1.C b/gcc/testsuite/g++.dg/cpp0x/alias-decl-1.C
new file mode 100644
index 00000000000..d0eda5ff1b9
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/alias-decl-1.C
@@ -0,0 +1,15 @@
+// { dg-options "-std=c++0x" }
+
+// These also represent tests for printing alias declarations and
+// their instantiations.
+
+template<class T, class U> struct A0 {};
+template<class T, class U> using AA0 = A0<T, U>;
+template<class T> struct AA0<int, T> {}; // { dg-error "partial specialization" }
+
+template <class U> using Ptr = U*;
+template<class U> struct Ptr<U*> {}; // { dg-error "partial specialization" }
+
+struct A {
+ using A = int;//{ dg-error "nested|has|same name as|class|in which|declared" }
+};
diff --git a/gcc/testsuite/g++.dg/cpp0x/alias-decl-10.C b/gcc/testsuite/g++.dg/cpp0x/alias-decl-10.C
new file mode 100644
index 00000000000..856e4297af5
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/alias-decl-10.C
@@ -0,0 +1,18 @@
+// { dg-options "-std=c++0x" }
+
+template <class T> using Ptr = T*;
+Ptr<unsigned>; // { dg-error "does not declare anything" }
+Ptr<char><int>; // { dg-error "not a template|does not declare anything" }
+template class Ptr<int>;//{ dg-error "explicit instantiation|non-class templ|does not decl|anything" }
+
+template <class T> using Arg = T;
+struct A {};
+template class Arg<A>;// { dg-error "explicit instantiation|non-class templ" }
+
+template <template <class> class TT, class T> using Instantiate = TT<T>;
+template <class> struct Vector {};
+template class Instantiate<Vector, int>; // OK Vector<int> can be explicitely instantiated
+
+template <class T> struct S {};
+template<class T> using SFor = S<T>;
+template class SFor<int>; // OK, S<int> can be explicitely instantiated
diff --git a/gcc/testsuite/g++.dg/cpp0x/alias-decl-2.C b/gcc/testsuite/g++.dg/cpp0x/alias-decl-2.C
new file mode 100644
index 00000000000..2e03dd897b5
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/alias-decl-2.C
@@ -0,0 +1,33 @@
+// { dg-options "-std=c++0x" }
+
+template<class T> struct S0 {};
+template<class T> using AS0 = S0<T>;
+
+template<template<class> class TT>
+void f(TT<int>);
+
+template class AS0<char>;
+
+void
+foo()
+{
+ AS0<int> a;
+ f(a);
+}
+
+template<class T, class U> struct Vector{};
+template<class T> struct Alloc {};
+
+template<class T> using Vec = Vector<T, Alloc<T> >;
+
+template<class T> void g(Vector<T, Alloc<T> >);
+
+template<template<class T> class TT> void h(TT<int>); // { dg-error "provided for" }
+
+void
+bar()
+{
+ Vec<int> a;
+ g(a);
+ h(a); // { dg-error "no matching function|wrong number of template arguments" }
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/alias-decl-3.C b/gcc/testsuite/g++.dg/cpp0x/alias-decl-3.C
new file mode 100644
index 00000000000..5484efce19e
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/alias-decl-3.C
@@ -0,0 +1,42 @@
+// { dg-options "-std=c++0x" }
+
+// Exercise some member alias templates ...
+
+template<class T, class U> class A0 {};
+
+template<class T>
+struct A1 {
+ template<class U> struct S {};
+ template<class U> using AA0 = A0<T, U>;
+
+ void f(A0<T, int>);
+
+ void
+ foo()
+ {
+ AA0<int> a;
+ const AA0<int> b;
+ f(a);
+ f(b);
+ }
+};
+
+void
+bar()
+{
+ A1<int> a1;
+ a1.foo();
+ A1<int>::AA0<int> a1aa0;
+ a1.f(a1aa0);
+}
+
+// ... some simple member alias ...
+struct B {
+ using A = int;
+};
+
+B::A a;
+
+// ... and some simple alias
+
+using Int = int;
diff --git a/gcc/testsuite/g++.dg/cpp0x/alias-decl-4.C b/gcc/testsuite/g++.dg/cpp0x/alias-decl-4.C
new file mode 100644
index 00000000000..876944e23c3
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/alias-decl-4.C
@@ -0,0 +1,14 @@
+// { dg-options "-std=c++0x" }
+
+// [temp.alias]/3:
+// The type-id in an alias template declaration shall not refer
+// to the alias template being declared. The type produced by an
+// alias template specialization shall not directly or indirectly
+// make use of that specialization.
+
+template <class T> struct A;
+template <class T> using B = typename A<T>::U; // { dg-error "type" }
+template <class T> struct A {
+ typedef B<T> U;
+};
+B<short> b; // { dg-error "invalid type" }
diff --git a/gcc/testsuite/g++.dg/cpp0x/alias-decl-5.C b/gcc/testsuite/g++.dg/cpp0x/alias-decl-5.C
new file mode 100644
index 00000000000..1a4cbd5e5bc
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/alias-decl-5.C
@@ -0,0 +1,34 @@
+// { dg-options "-std=c++0x" }
+
+// alias template of a partial specialization
+
+template<class T, class U, class W> struct S0 {};
+template<class T, class U> struct S0<T, U, char> {};
+template<class T> using AS0 = S0<T, int, char>;
+void foo(S0<bool, int, char>);
+
+AS0<bool> a; // OK
+
+void
+f()
+{
+ foo(a); //OK
+}
+
+// alias template of an explicit specialization of a member template
+
+template<class T>
+struct S1 {
+ template<class U>
+ struct M {};
+};
+template<class T> using AM = S1<int>::M<T>;
+void bar(S1<int>::M<bool>);
+
+AM<bool> b; //OK.
+
+void
+g()
+{
+ bar(b); //OK
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/alias-decl-6.C b/gcc/testsuite/g++.dg/cpp0x/alias-decl-6.C
new file mode 100644
index 00000000000..f60b2ea7fc0
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/alias-decl-6.C
@@ -0,0 +1,12 @@
+// { dg-options "-std=c++0x" }
+
+// Alias template of non-class types.
+
+template <class T, class U> struct same;
+template <class T> struct same<T,T> {};
+
+template <class T> using Ptr = T*;
+template <template <class> class T> struct A {
+ template <class U> using X = T<U>;
+};
+same<A<Ptr>::X<int>,int*> s;
diff --git a/gcc/testsuite/g++.dg/cpp0x/alias-decl-7.C b/gcc/testsuite/g++.dg/cpp0x/alias-decl-7.C
new file mode 100644
index 00000000000..96c349a0da6
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/alias-decl-7.C
@@ -0,0 +1,23 @@
+// { dg-options "-std=c++0x" }
+
+// Add arguments to unbound template template parameter.
+
+template <template <class> class Template>
+struct Internal {
+ template <class Arg> using Bind = Template<Arg>;
+};
+
+template <template <class> class Template, class Arg>
+using Instantiate = Template<Arg>; // After parsing #1, the
+ // BOUND_TEMPLATE_TEMPLATE_PARM
+ // parameter Template gets
+ // the UNBOUND_CLASS_TEMPLATE
+ // Internal<Template>::template Bind
+ // as an argument, and the
+ // parameter Arg gets Argument as
+ // an argument. And we build
+ // 'Bind<Argument>'.
+
+template <template <class> class Template, class Argument>
+using Bind = Instantiate<Internal<Template>::template Bind, Argument>; //#1
+
diff --git a/gcc/testsuite/g++.dg/cpp0x/alias-decl-8.C b/gcc/testsuite/g++.dg/cpp0x/alias-decl-8.C
new file mode 100644
index 00000000000..c926df7539b
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/alias-decl-8.C
@@ -0,0 +1,32 @@
+// { dg-options "-std=c++0x" }
+
+struct A {
+ template <class U> using C = U;
+};
+
+// The particularity of the below struct is to have more than 7
+// fields. In this case, looking up a member here should exercise
+// cp/search.c:lookup_field_1 in such a way that it finds it in the
+// CLASSTYPE_SORTED_FIELDS of struct A7.
+struct A7 {
+ int f0;
+ int f1;
+ int f2;
+ int f3;
+ int f4;
+ int f5;
+ int f6;
+ int f7;
+ template <class U> using C = U;
+};
+
+template <class T>
+struct B {
+ typename T::template C<int> n; //#0
+};
+
+// These should trigger the lookup
+// of template C inside class A or
+// A7, via #0.
+B<A> b;
+B<A7> c;
diff --git a/gcc/testsuite/g++.dg/cpp0x/alias-decl-9.C b/gcc/testsuite/g++.dg/cpp0x/alias-decl-9.C
new file mode 100644
index 00000000000..dcf642d7683
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/alias-decl-9.C
@@ -0,0 +1,9 @@
+// { dg-options "-std=c++0x" }
+
+template <class T>
+struct A {
+ using Result = T;
+};
+template <class A> using Arg = typename A::Result;
+Arg<A<int>> b;
+
diff --git a/gcc/testsuite/g++.dg/cpp0x/alignof3.C b/gcc/testsuite/g++.dg/cpp0x/alignof3.C
new file mode 100644
index 00000000000..50c6ac915e1
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/alignof3.C
@@ -0,0 +1,6 @@
+// { dg-do compile }
+// { dg-options "-std=c++0x -pedantic" }
+int main(void)
+{
+ alignof(void (void)); // { dg-warning "function type" }
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/auto1.C b/gcc/testsuite/g++.dg/cpp0x/auto1.C
index 9e274b62239..f5c0ea6e4d3 100644
--- a/gcc/testsuite/g++.dg/cpp0x/auto1.C
+++ b/gcc/testsuite/g++.dg/cpp0x/auto1.C
@@ -1,8 +1,8 @@
-// { dg-options "-std=c++98 -Wc++0x-compat" }
+// { dg-options "-std=c++98 -Wc++11-compat" }
-// Test warning for use of auto in C++98 mode with C++0x
+// Test warning for use of auto in C++98 mode with C++11
// compatibility warnings
void f()
{
- auto int x = 5; // { dg-warning "will change meaning" }
+ auto int x = 5; // { dg-warning "changes meaning" }
}
diff --git a/gcc/testsuite/g++.dg/cpp0x/bracket3.C b/gcc/testsuite/g++.dg/cpp0x/bracket3.C
index 4ef7a0e9d30..f86aa041a24 100644
--- a/gcc/testsuite/g++.dg/cpp0x/bracket3.C
+++ b/gcc/testsuite/g++.dg/cpp0x/bracket3.C
@@ -1,10 +1,10 @@
-// { dg-options "-std=c++98 -Wc++0x-compat" }
+// { dg-options "-std=c++98 -Wc++11-compat" }
template<int N> struct X {};
-X<1 >> 2> x; // { dg-warning "will be treated as|suggest parentheses" }
+X<1 >> 2> x; // { dg-warning "is treated as|suggest parentheses" }
// From cp/parser.c
typedef int Y;
template <int V> struct Foo {};
-Foo<Y () >> 5> r; // { dg-warning "will be treated as|suggest parentheses" }
+Foo<Y () >> 5> r; // { dg-warning "is treated as|suggest parentheses" }
diff --git a/gcc/testsuite/g++.dg/cpp0x/enum21a.C b/gcc/testsuite/g++.dg/cpp0x/enum21a.C
new file mode 100644
index 00000000000..5526811a635
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/enum21a.C
@@ -0,0 +1,4 @@
+// { dg-do compile }
+// { dg-options "-pedantic -std=c++98" }
+
+enum x { y, }; // { dg-warning "comma at end of enumerator list" }
diff --git a/gcc/testsuite/g++.dg/cpp0x/enum21b.C b/gcc/testsuite/g++.dg/cpp0x/enum21b.C
new file mode 100644
index 00000000000..48989128d89
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/enum21b.C
@@ -0,0 +1,4 @@
+// { dg-do compile }
+// { dg-options "-pedantic -std=c++0x" }
+
+enum x { y, };
diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist-lifetime1.C b/gcc/testsuite/g++.dg/cpp0x/initlist-lifetime1.C
new file mode 100644
index 00000000000..e43ce5d62cd
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/initlist-lifetime1.C
@@ -0,0 +1,34 @@
+// Test that we properly extend the lifetime of the initializer_list
+// array even if the initializer_list is a subobject.
+// { dg-options -std=c++0x }
+// { dg-do run }
+
+#include <initializer_list>
+
+extern "C" void abort();
+bool ok;
+
+bool do_throw;
+
+struct A {
+ A(int) { if (do_throw) throw 42; }
+ ~A() { if (!ok) abort(); }
+};
+
+typedef std::initializer_list<A> AL;
+typedef std::initializer_list<AL> AL2;
+typedef std::initializer_list<AL2> AL3;
+
+struct B {
+ AL al;
+ const AL& alr;
+};
+
+int main(int argc, const char** argv)
+{
+ do_throw = (argc > 1); // always false, but optimizer can't tell
+ AL ar[] = {{1,2},{3,4}};
+ B b = {{5,6},{7,8}};
+ AL3 al3 = {{{1},{2},{3}}};
+ ok = true;
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist-lifetime2.C b/gcc/testsuite/g++.dg/cpp0x/initlist-lifetime2.C
new file mode 100644
index 00000000000..16ae1ac6e07
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/initlist-lifetime2.C
@@ -0,0 +1,64 @@
+// Test that we properly extend the lifetime of the initializer_list
+// array even if the initializer_list is a subobject.
+// { dg-options -std=c++0x }
+// { dg-do run }
+
+#include <initializer_list>
+
+extern "C" void abort();
+bool ok;
+
+bool do_throw;
+
+struct A {
+ A(int) { if (do_throw) throw 42; }
+ ~A() { if (!ok) abort(); }
+};
+
+typedef std::initializer_list<A> AL;
+typedef std::initializer_list<AL> AL2;
+typedef std::initializer_list<AL2> AL3;
+
+struct B {
+ AL al;
+ const AL& alr;
+};
+
+struct A2
+{
+ const A& a1;
+ const A& a2;
+};
+
+struct C {
+ AL ar[2];
+ B b;
+ AL3 al3;
+ A2 a2;
+ A2 a2r[2];
+ C():
+ ar{{1,2},{3,4}},
+ b{{5,6},{7,8}},
+ al3{{{1},{2},{3}}},
+ a2{1,2},
+ a2r{{1,2},{3,4}}
+ { ok = true; }
+};
+
+struct D {
+ AL ar[2] = {{1,2},{3,4}};
+ B b = {{5,6},{7,8}};
+ AL3 al3 = {{{1},{2},{3}}};
+ A2 a2 = {1,2};
+ A2 a2r[2] = {{1,2},{3,4}};
+ D() { ok = true; }
+};
+
+int main(int argc, const char** argv)
+{
+ do_throw = (argc > 1); // always false, but optimizer can't tell
+ ok = false;
+ C c;
+ ok = false;
+ D d;
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/nsdmi-list2.C b/gcc/testsuite/g++.dg/cpp0x/nsdmi-list2.C
new file mode 100644
index 00000000000..a6321ffb605
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/nsdmi-list2.C
@@ -0,0 +1,32 @@
+// PR c++/50930
+// { dg-options -std=c++0x }
+
+struct nmc {
+ nmc() = default;
+ nmc(nmc&&) = delete; // line 3
+};
+
+struct A { // line 6
+ nmc n{};
+ nmc n2 = {};
+} a; // line 8
+
+// ------
+
+struct lock_t {
+ int lock[4];
+};
+
+struct pthread_mutex_t {
+ volatile lock_t __spinlock;
+};
+
+struct mutex {
+ pthread_mutex_t m = { };
+ mutex() = default;
+};
+
+int main()
+{
+ mutex mx;
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/nsdmi1.C b/gcc/testsuite/g++.dg/cpp0x/nsdmi1.C
index f6381d0fdb4..159c16de851 100644
--- a/gcc/testsuite/g++.dg/cpp0x/nsdmi1.C
+++ b/gcc/testsuite/g++.dg/cpp0x/nsdmi1.C
@@ -31,8 +31,8 @@ int main()
{
A a1;
if (a1.i != 42) return 1;
- A a2 = { 24 };
- if (a2.i != 24) return 2;
+ A a2{};
+ if (a2.i != 42) return 2;
A a3[1];
if (a3[0].i != 42) return 3;
@@ -43,7 +43,7 @@ int main()
C<int,3> c1;
if (c1.m != 3) return 5;
- C<int,3> c2 { 5 };
+ C<int,5> c2 {};
if (c2.m != 5) return 6;
D<int,3> d1;
diff --git a/gcc/testsuite/g++.dg/cpp0x/udlit-string-length.C b/gcc/testsuite/g++.dg/cpp0x/udlit-string-length.C
new file mode 100644
index 00000000000..86903e8355a
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/udlit-string-length.C
@@ -0,0 +1,46 @@
+// { dg-options "-std=c++0x" }
+// PR c++/50941
+
+typedef decltype(sizeof(0)) size_type;
+
+constexpr size_type
+operator"" _len(const char*, size_type len)
+{
+ return len;
+}
+
+constexpr size_type
+operator"" _len(const wchar_t*, size_type len)
+{
+ return len;
+}
+
+constexpr size_type
+operator"" _len(const char16_t*, size_type len)
+{
+ return len;
+}
+
+constexpr size_type
+operator"" _len(const char32_t*, size_type len)
+{
+ return len;
+}
+
+static_assert( ""_len == 0, "Ouch");
+static_assert(u8""_len == 0, "Ouch");
+static_assert( L""_len == 0, "Ouch");
+static_assert( u""_len == 0, "Ouch");
+static_assert( U""_len == 0, "Ouch");
+
+static_assert( "1"_len == 1, "Ouch");
+static_assert(u8"1"_len == 1, "Ouch");
+static_assert( L"1"_len == 1, "Ouch");
+static_assert( u"1"_len == 1, "Ouch");
+static_assert( U"1"_len == 1, "Ouch");
+
+static_assert( "123"_len == 3, "Ouch");
+static_assert(u8"123"_len == 3, "Ouch");
+static_assert( L"123"_len == 3, "Ouch");
+static_assert( u"123"_len == 3, "Ouch");
+static_assert( U"123"_len == 3, "Ouch");
diff --git a/gcc/testsuite/g++.dg/cpp0x/warn_cxx0x.C b/gcc/testsuite/g++.dg/cpp0x/warn_cxx0x.C
index 5ad9b61b83a..5c5eeffb350 100644
--- a/gcc/testsuite/g++.dg/cpp0x/warn_cxx0x.C
+++ b/gcc/testsuite/g++.dg/cpp0x/warn_cxx0x.C
@@ -1,6 +1,6 @@
-// { dg-options "-std=gnu++98 -Wc++0x-compat" }
-int static_assert; // { dg-warning "will become a keyword" }
-int nullptr; // { dg-warning "will become a keyword" }
+// { dg-options "-std=gnu++98 -Wc++11-compat" }
+int static_assert; // { dg-warning "is a keyword" }
+int nullptr; // { dg-warning "is a keyword" }
void foo()
{
diff --git a/gcc/testsuite/g++.dg/cpp0x/warn_cxx0x2.C b/gcc/testsuite/g++.dg/cpp0x/warn_cxx0x2.C
new file mode 100644
index 00000000000..116b2331762
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/warn_cxx0x2.C
@@ -0,0 +1,4 @@
+// PR c++/50810
+// { dg-options "-std=gnu++98 -Wc++11-compat" }
+
+signed char data[] = { 0xff }; // { dg-warning "narrowing" }
diff --git a/gcc/testsuite/g++.dg/cpp0x/warn_cxx0x3.C b/gcc/testsuite/g++.dg/cpp0x/warn_cxx0x3.C
new file mode 100644
index 00000000000..c3df9d99ed3
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/warn_cxx0x3.C
@@ -0,0 +1,4 @@
+// PR c++/50810
+// { dg-options "-std=gnu++98 -Wc++11-compat -Wno-narrowing" }
+
+signed char data[] = { 0xff };
diff --git a/gcc/testsuite/g++.dg/dg.exp b/gcc/testsuite/g++.dg/dg.exp
index 0144eef2a4f..ad1f7e23700 100644
--- a/gcc/testsuite/g++.dg/dg.exp
+++ b/gcc/testsuite/g++.dg/dg.exp
@@ -49,6 +49,7 @@ set tests [prune $tests $srcdir/$subdir/torture/*]
set tests [prune $tests $srcdir/$subdir/graphite/*]
set tests [prune $tests $srcdir/$subdir/tm/*]
set tests [prune $tests $srcdir/$subdir/guality/*]
+set tests [prune $tests $srcdir/$subdir/simulate-thread/*]
# Main loop.
dg-runtest $tests "" $DEFAULT_CXXFLAGS
diff --git a/gcc/testsuite/g++.dg/eh/array1.C b/gcc/testsuite/g++.dg/eh/array1.C
new file mode 100644
index 00000000000..157450a9592
--- /dev/null
+++ b/gcc/testsuite/g++.dg/eh/array1.C
@@ -0,0 +1,15 @@
+// Test that we have one EH cleanup region for the whole array
+// rather than one for each element.
+// { dg-options -fdump-tree-gimple }
+// { dg-final { scan-tree-dump-times "catch" 1 "gimple" } }
+
+struct A
+{
+ A();
+ ~A();
+};
+
+void f()
+{
+ A a[10] = { };
+}
diff --git a/gcc/testsuite/g++.dg/ext/alias-decl-attr1.C b/gcc/testsuite/g++.dg/ext/alias-decl-attr1.C
new file mode 100644
index 00000000000..e83fe441275
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/alias-decl-attr1.C
@@ -0,0 +1,19 @@
+// { dg-options "-std=c++0x" }
+
+template <unsigned Len, unsigned Align>
+struct aligned_storage
+{
+ using type __attribute__((aligned((Align)))) =
+ char[Len];
+};
+
+template<typename T>
+struct X
+{
+ typename aligned_storage<sizeof(T),__alignof(T)>::type data;
+};
+
+template<bool> struct StaticAssert;
+template<> struct StaticAssert<true> {};
+
+StaticAssert<__alignof (X<double>) == __alignof (double)> dummy;
diff --git a/gcc/testsuite/g++.dg/ext/alias-decl-attr2.C b/gcc/testsuite/g++.dg/ext/alias-decl-attr2.C
new file mode 100644
index 00000000000..83e557c43fb
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/alias-decl-attr2.C
@@ -0,0 +1,42 @@
+// { dg-options "-std=c++0x" }
+
+template<typename T>
+struct X {
+ using layout_type __attribute ((aligned(__alignof(double)))) =
+ char[sizeof(T)];
+ layout_type data;
+};
+
+template<typename T>
+struct Y {
+ using layout_type __attribute ((aligned(__alignof(T)))) =
+ char[sizeof(T)];
+ layout_type data;
+};
+
+template<typename T>
+struct Z {
+ using layout_type __attribute ((aligned(__alignof(T)))) =
+ char[sizeof(T)];
+ struct Z2 {
+ layout_type data;
+ } in;
+};
+
+template<typename T>
+struct A;
+
+template <typename T>
+struct A<T*> {
+ using layout_type __attribute ((aligned(__alignof(T)))) =
+ char[sizeof(T)];
+ layout_type data;
+};
+
+template<bool> struct StaticAssert;
+template<> struct StaticAssert<true> {};
+
+StaticAssert<__alignof(X<double>) == __alignof(double)> d1;
+StaticAssert<__alignof(Y<double>) == __alignof(double)> d2;
+StaticAssert<__alignof(Z<double>) == __alignof(double)> d3;
+StaticAssert<__alignof(A<double*>) == __alignof(double)> d4;
diff --git a/gcc/testsuite/g++.dg/ext/alias-decl-attr3.C b/gcc/testsuite/g++.dg/ext/alias-decl-attr3.C
new file mode 100644
index 00000000000..369aa10e65e
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/alias-decl-attr3.C
@@ -0,0 +1,21 @@
+// { dg-options "-std=c++0x" }
+// { dg-do run }
+
+template <class T>
+int
+align_of_type_wide_array()
+{
+ using type_wide_array __attribute((aligned(__alignof(T))))
+ = unsigned char[sizeof (T)];
+
+ return __alignof(type_wide_array);
+}
+
+int
+main ()
+{
+ if (align_of_type_wide_array<int>() == __alignof(int))
+ return 0;
+ else
+ return 1;
+}
diff --git a/gcc/testsuite/g++.dg/ext/alias-decl-attr4.C b/gcc/testsuite/g++.dg/ext/alias-decl-attr4.C
new file mode 100644
index 00000000000..c4dd0487789
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/alias-decl-attr4.C
@@ -0,0 +1,34 @@
+// { dg-options "-std=c++0x" }
+// { dg-do run }
+
+using global_vector_type __attribute__((vector_size(16))) = float;
+
+template <class T> struct A
+{
+ using type = T;
+};
+
+template < typename Val > struct S
+{
+ using vector_type __attribute__((vector_size(16))) =
+ typename A<Val>::type
+ typedef Val vector_type2 __attribute__((vector_size(16)));
+ int pr_size() { return sizeof(vector_type); }
+ int pr_size2() { return sizeof(vector_type2); }
+};
+
+int main()
+{
+ if (sizeof (S<float>::vector_type) != sizeof (global_vector_type))
+ return 1;
+ if (sizeof (S<float>::vector_type2) != sizeof (global_vector_type))
+ return 2;
+
+ S<float> x;
+ if (x.pr_size() != sizeof (global_vector_type))
+ return 3;
+ if (x.pr_size2() != sizeof (global_vector_type))
+ return 4;
+
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/ext/visibility/template7.C b/gcc/testsuite/g++.dg/ext/visibility/template7.C
new file mode 100644
index 00000000000..5197fb1c960
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/visibility/template7.C
@@ -0,0 +1,29 @@
+// PR c++/35688
+// { dg-require-visibility "" }
+// { dg-options "-fvisibility=hidden" }
+
+// { dg-final { scan-hidden "_ZN1s6vectorI1AEC1Ev" } }
+// { dg-final { scan-hidden "_ZN1s3fooI1AEEvT_" } }
+
+namespace s __attribute__((visibility("default"))) {
+ template <class T>
+ class vector {
+ public:
+ vector() { }
+ };
+ template <class T>
+ void foo(T t) {
+ }
+}
+
+class A {
+public:
+ A() { }
+};
+
+s::vector<A> v;
+
+int main() {
+ A a;
+ s::foo(a);
+}
diff --git a/gcc/testsuite/g++.dg/ext/visibility/template8.C b/gcc/testsuite/g++.dg/ext/visibility/template8.C
new file mode 100644
index 00000000000..e491882e057
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/visibility/template8.C
@@ -0,0 +1,26 @@
+// PR c++/35688
+// { dg-require-visibility "" }
+// { dg-options "-fvisibility=hidden" }
+
+// { dg-final { scan-hidden "_Z1gI1BEvT_" } }
+// { dg-final { scan-hidden "_Z1gI1AI1BEEvT_" } }
+
+// Test that template argument visibility takes priority even over an
+// explicit visibility attribute on a template.
+
+template <class T>
+struct __attribute ((visibility ("default"))) A { };
+template <class T>
+void g(T) __attribute ((visibility ("default")));
+
+struct B { };
+
+template <class T>
+void g(T)
+{ }
+
+int main()
+{
+ g(B());
+ g(A<B>());
+}
diff --git a/gcc/testsuite/g++.dg/gomp/atomic-1.C b/gcc/testsuite/g++.dg/gomp/atomic-1.C
deleted file mode 100644
index 3e4bc569ba7..00000000000
--- a/gcc/testsuite/g++.dg/gomp/atomic-1.C
+++ /dev/null
@@ -1,99 +0,0 @@
-/* { dg-do compile } */
-
-int x;
-volatile int y;
-volatile unsigned char z;
-
-void f1(void)
-{
- #pragma omp atomic
- x++;
- #pragma omp atomic
- x--;
- #pragma omp atomic
- ++x;
- #pragma omp atomic
- --x;
- #pragma omp atomic
- x += 1;
- #pragma omp atomic
- x -= y;
- #pragma omp atomic
- x |= 1;
- #pragma omp atomic
- x &= 1;
- #pragma omp atomic
- x ^= 1;
- #pragma omp atomic
- x *= 3;
- #pragma omp atomic
- x /= 3;
- #pragma omp atomic
- x /= 3;
- #pragma omp atomic
- x <<= 3;
- #pragma omp atomic
- x >>= 3;
-}
-
-void f2(void)
-{
- #pragma omp atomic
- y++;
- #pragma omp atomic
- y--;
- #pragma omp atomic
- ++y;
- #pragma omp atomic
- --y;
- #pragma omp atomic
- y += 1;
- #pragma omp atomic
- y -= x;
- #pragma omp atomic
- y |= 1;
- #pragma omp atomic
- y &= 1;
- #pragma omp atomic
- y ^= 1;
- #pragma omp atomic
- y *= 3;
- #pragma omp atomic
- y /= 3;
- #pragma omp atomic
- y /= 3;
- #pragma omp atomic
- y <<= 3;
- #pragma omp atomic
- y >>= 3;
-}
-
-void f3(void)
-{
- #pragma omp atomic
- z++;
- #pragma omp atomic
- z--;
- #pragma omp atomic
- ++z;
- #pragma omp atomic
- --z;
- #pragma omp atomic
- z += 1;
- #pragma omp atomic
- z |= 1;
- #pragma omp atomic
- z &= 1;
- #pragma omp atomic
- z ^= 1;
- #pragma omp atomic
- z *= 3;
- #pragma omp atomic
- z /= 3;
- #pragma omp atomic
- z /= 3;
- #pragma omp atomic
- z <<= 3;
- #pragma omp atomic
- z >>= 3;
-}
diff --git a/gcc/testsuite/g++.dg/gomp/atomic-10.C b/gcc/testsuite/g++.dg/gomp/atomic-10.C
deleted file mode 100644
index fe64f0f0631..00000000000
--- a/gcc/testsuite/g++.dg/gomp/atomic-10.C
+++ /dev/null
@@ -1,24 +0,0 @@
-// PR middle-end/28046
-// { dg-do compile }
-// { dg-options "-fopenmp -fdump-tree-ompexp" }
-
-int a[3], b;
-struct C { int x; int y; } c;
-
-int bar (void), *baz (void);
-
-void
-foo (void)
-{
-#pragma omp atomic
- a[2] += bar ();
-#pragma omp atomic
- b += bar ();
-#pragma omp atomic
- c.y += bar ();
-#pragma omp atomic
- *baz () += bar ();
-}
-
-// { dg-final { scan-tree-dump-times "__sync_fetch_and_add" 4 "ompexp" { target i?86-*-* x86_64-*-* ia64-*-* powerpc*-*-* alpha*-*-* } } }
-// { dg-final { cleanup-tree-dump "ompexp" } }
diff --git a/gcc/testsuite/g++.dg/gomp/atomic-11.C b/gcc/testsuite/g++.dg/gomp/atomic-11.C
deleted file mode 100644
index 618c4c8e648..00000000000
--- a/gcc/testsuite/g++.dg/gomp/atomic-11.C
+++ /dev/null
@@ -1,306 +0,0 @@
-/* PR middle-end/45423 */
-/* { dg-do compile } */
-/* { dg-options "-fopenmp -fdump-tree-gimple -g0" } */
-/* atomicvar should never be referenced in between the barrier and
- following #pragma omp atomic_load. */
-/* { dg-final { scan-tree-dump-not "barrier\[^#\]*atomicvar" "gimple" } } */
-/* { dg-final { cleanup-tree-dump "gimple" } } */
-
-#ifdef __cplusplus
-bool atomicvar, c;
-#else
-_Bool atomicvar, c;
-#endif
-int i, atomicvar2, c2;
-
-int
-foo (void)
-{
- #pragma omp barrier
- #pragma omp atomic
- atomicvar |= -1;
- #pragma omp barrier
- #pragma omp atomic
- atomicvar |= 0;
- #pragma omp barrier
- #pragma omp atomic
- atomicvar |= 1;
- #pragma omp barrier
- #pragma omp atomic
- atomicvar |= 2;
- #pragma omp barrier
- #pragma omp atomic
- atomicvar |= c;
- #pragma omp barrier
- #pragma omp atomic
- atomicvar ^= -1;
- #pragma omp barrier
- #pragma omp atomic
- atomicvar ^= 0;
- #pragma omp barrier
- #pragma omp atomic
- atomicvar ^= 1;
- #pragma omp barrier
- #pragma omp atomic
- atomicvar ^= 2;
- #pragma omp barrier
- #pragma omp atomic
- atomicvar ^= c;
- #pragma omp barrier
- #pragma omp atomic
- atomicvar &= -1;
- #pragma omp barrier
- #pragma omp atomic
- atomicvar &= 0;
- #pragma omp barrier
- #pragma omp atomic
- atomicvar &= 1;
- #pragma omp barrier
- #pragma omp atomic
- atomicvar &= 2;
- #pragma omp barrier
- #pragma omp atomic
- atomicvar &= c;
- #pragma omp barrier
- #pragma omp atomic
- atomicvar += -1;
- #pragma omp barrier
- #pragma omp atomic
- atomicvar += 0;
- #pragma omp barrier
- #pragma omp atomic
- atomicvar += 1;
- #pragma omp barrier
- #pragma omp atomic
- atomicvar += 2;
- #pragma omp barrier
- #pragma omp atomic
- atomicvar += c;
- #pragma omp barrier
- #pragma omp atomic
- atomicvar -= -1;
- #pragma omp barrier
- #pragma omp atomic
- atomicvar -= 0;
- #pragma omp barrier
- #pragma omp atomic
- atomicvar -= 1;
- #pragma omp barrier
- #pragma omp atomic
- atomicvar -= 2;
- #pragma omp barrier
- #pragma omp atomic
- atomicvar -= c;
- #pragma omp barrier
- #pragma omp atomic
- atomicvar *= -1;
- #pragma omp barrier
- #pragma omp atomic
- atomicvar *= 0;
- #pragma omp barrier
- #pragma omp atomic
- atomicvar *= 1;
- #pragma omp barrier
- #pragma omp atomic
- atomicvar *= 2;
- #pragma omp barrier
- #pragma omp atomic
- atomicvar *= c;
- #pragma omp barrier
- #pragma omp atomic
- atomicvar /= -1;
- #pragma omp barrier
- #pragma omp atomic
- atomicvar /= 1;
- #pragma omp barrier
- #pragma omp atomic
- atomicvar /= 2;
- #pragma omp barrier
- #pragma omp atomic
- atomicvar /= c;
- #pragma omp barrier
- #pragma omp atomic
- atomicvar <<= 0;
- #pragma omp barrier
- #pragma omp atomic
- atomicvar <<= 1;
- #pragma omp barrier
- #pragma omp atomic
- atomicvar <<= 2;
- #pragma omp barrier
- #pragma omp atomic
- atomicvar <<= i;
- #pragma omp barrier
- #pragma omp atomic
- atomicvar >>= 0;
- #pragma omp barrier
- #pragma omp atomic
- atomicvar >>= 1;
- #pragma omp barrier
- #pragma omp atomic
- atomicvar >>= 2;
- #pragma omp barrier
- #pragma omp atomic
- atomicvar >>= i;
- #pragma omp barrier
- #pragma omp atomic
- atomicvar++;
- #pragma omp barrier
- #pragma omp atomic
- ++atomicvar;
- #pragma omp barrier
-#ifndef __cplusplus
- #pragma omp atomic
- atomicvar--;
- #pragma omp barrier
- #pragma omp atomic
- --atomicvar;
- #pragma omp barrier
-#endif
- return 0;
-}
-
-int
-bar (void)
-{
- #pragma omp barrier
- #pragma omp atomic
- atomicvar2 |= -1;
- #pragma omp barrier
- #pragma omp atomic
- atomicvar2 |= 0;
- #pragma omp barrier
- #pragma omp atomic
- atomicvar2 |= 1;
- #pragma omp barrier
- #pragma omp atomic
- atomicvar2 |= 2;
- #pragma omp barrier
- #pragma omp atomic
- atomicvar2 |= c2;
- #pragma omp barrier
- #pragma omp atomic
- atomicvar2 ^= -1;
- #pragma omp barrier
- #pragma omp atomic
- atomicvar2 ^= 0;
- #pragma omp barrier
- #pragma omp atomic
- atomicvar2 ^= 1;
- #pragma omp barrier
- #pragma omp atomic
- atomicvar2 ^= 2;
- #pragma omp barrier
- #pragma omp atomic
- atomicvar2 ^= c2;
- #pragma omp barrier
- #pragma omp atomic
- atomicvar2 &= -1;
- #pragma omp barrier
- #pragma omp atomic
- atomicvar2 &= 0;
- #pragma omp barrier
- #pragma omp atomic
- atomicvar2 &= 1;
- #pragma omp barrier
- #pragma omp atomic
- atomicvar2 &= 2;
- #pragma omp barrier
- #pragma omp atomic
- atomicvar2 &= c2;
- #pragma omp barrier
- #pragma omp atomic
- atomicvar2 += -1;
- #pragma omp barrier
- #pragma omp atomic
- atomicvar2 += 0;
- #pragma omp barrier
- #pragma omp atomic
- atomicvar2 += 1;
- #pragma omp barrier
- #pragma omp atomic
- atomicvar2 += 2;
- #pragma omp barrier
- #pragma omp atomic
- atomicvar2 += c2;
- #pragma omp barrier
- #pragma omp atomic
- atomicvar2 -= -1;
- #pragma omp barrier
- #pragma omp atomic
- atomicvar2 -= 0;
- #pragma omp barrier
- #pragma omp atomic
- atomicvar2 -= 1;
- #pragma omp barrier
- #pragma omp atomic
- atomicvar2 -= 2;
- #pragma omp barrier
- #pragma omp atomic
- atomicvar2 -= c2;
- #pragma omp barrier
- #pragma omp atomic
- atomicvar2 *= -1;
- #pragma omp barrier
- #pragma omp atomic
- atomicvar2 *= 0;
- #pragma omp barrier
- #pragma omp atomic
- atomicvar2 *= 1;
- #pragma omp barrier
- #pragma omp atomic
- atomicvar2 *= 2;
- #pragma omp barrier
- #pragma omp atomic
- atomicvar2 *= c2;
- #pragma omp barrier
- #pragma omp atomic
- atomicvar2 /= -1;
- #pragma omp barrier
- #pragma omp atomic
- atomicvar2 /= 1;
- #pragma omp barrier
- #pragma omp atomic
- atomicvar2 /= 2;
- #pragma omp barrier
- #pragma omp atomic
- atomicvar2 /= c2;
- #pragma omp barrier
- #pragma omp atomic
- atomicvar2 <<= 0;
- #pragma omp barrier
- #pragma omp atomic
- atomicvar2 <<= 1;
- #pragma omp barrier
- #pragma omp atomic
- atomicvar2 <<= 2;
- #pragma omp barrier
- #pragma omp atomic
- atomicvar2 <<= i;
- #pragma omp barrier
- #pragma omp atomic
- atomicvar2 >>= 0;
- #pragma omp barrier
- #pragma omp atomic
- atomicvar2 >>= 1;
- #pragma omp barrier
- #pragma omp atomic
- atomicvar2 >>= 2;
- #pragma omp barrier
- #pragma omp atomic
- atomicvar2 >>= i;
- #pragma omp barrier
- #pragma omp atomic
- atomicvar2++;
- #pragma omp barrier
- #pragma omp atomic
- ++atomicvar2;
- #pragma omp barrier
- #pragma omp atomic
- atomicvar2--;
- #pragma omp barrier
- #pragma omp atomic
- --atomicvar2;
- #pragma omp barrier
- return 0;
-}
diff --git a/gcc/testsuite/g++.dg/gomp/atomic-12.C b/gcc/testsuite/g++.dg/gomp/atomic-12.C
deleted file mode 100644
index 6c1f965021d..00000000000
--- a/gcc/testsuite/g++.dg/gomp/atomic-12.C
+++ /dev/null
@@ -1,9 +0,0 @@
-/* PR middle-end/45423 */
-/* { dg-do compile } */
-/* { dg-options "-fopenmp -fdump-tree-gimple -g0 -O2" } */
-/* atomicvar should never be referenced in between the barrier and
- following #pragma omp atomic_load. */
-/* { dg-final { scan-tree-dump-not "barrier\[^#\]*atomicvar" "gimple" } } */
-/* { dg-final { cleanup-tree-dump "gimple" } } */
-
-#include "atomic-11.C"
diff --git a/gcc/testsuite/g++.dg/gomp/atomic-13.C b/gcc/testsuite/g++.dg/gomp/atomic-13.C
deleted file mode 100644
index f8fc9d87257..00000000000
--- a/gcc/testsuite/g++.dg/gomp/atomic-13.C
+++ /dev/null
@@ -1,43 +0,0 @@
-/* PR middle-end/45423 */
-/* { dg-do compile } */
-/* { dg-options "-fopenmp" } */
-
-#ifdef __cplusplus
-bool *baz ();
-#else
-_Bool *baz ();
-#endif
-int *bar ();
-
-int
-foo (void)
-{
- #pragma omp barrier
- #pragma omp atomic
- (*bar ())++;
- #pragma omp barrier
- #pragma omp atomic
- ++(*bar ());
- #pragma omp barrier
- #pragma omp atomic
- (*bar ())--;
- #pragma omp barrier
- #pragma omp atomic
- --(*bar ());
- #pragma omp barrier
- #pragma omp atomic
- (*baz ())++;
- #pragma omp barrier
- #pragma omp atomic
- ++(*baz ());
-#ifndef __cplusplus
- #pragma omp barrier
- #pragma omp atomic
- (*baz ())--;
- #pragma omp barrier
- #pragma omp atomic
- --(*baz ());
- #pragma omp barrier
-#endif
- return 0;
-}
diff --git a/gcc/testsuite/g++.dg/gomp/atomic-15.C b/gcc/testsuite/g++.dg/gomp/atomic-15.C
deleted file mode 100644
index 95eb8b4534d..00000000000
--- a/gcc/testsuite/g++.dg/gomp/atomic-15.C
+++ /dev/null
@@ -1,46 +0,0 @@
-// { dg-do compile }
-// { dg-options "-fopenmp" }
-
-int x = 6;
-
-int
-main ()
-{
- int v;
- #pragma omp atomic
- x = x * 7 + 6; // { dg-error "expected" }
- #pragma omp atomic
- x = x * 7 ^ 6; // { dg-error "expected" }
- #pragma omp atomic update
- x = x - 8 + 6; // { dg-error "expected" }
- #pragma omp atomic
- x = x ^ 7 | 2; // { dg-error "expected" }
- #pragma omp atomic
- x = x / 7 * 2; // { dg-error "expected" }
- #pragma omp atomic
- x = x / 7 / 2; // { dg-error "expected" }
- #pragma omp atomic capture
- v = x = x | 6; // { dg-error "invalid operator" }
- #pragma omp atomic capture
- { v = x; x = x * 7 + 6; } // { dg-error "expected" }
- #pragma omp atomic capture
- { v = x; x = x * 7 ^ 6; } // { dg-error "expected" }
- #pragma omp atomic capture
- { v = x; x = x - 8 + 6; } // { dg-error "expected" }
- #pragma omp atomic capture
- { v = x; x = x ^ 7 | 2; } // { dg-error "expected" }
- #pragma omp atomic capture
- { v = x; x = x / 7 * 2; } // { dg-error "expected" }
- #pragma omp atomic capture
- { v = x; x = x / 7 / 2; } // { dg-error "expected" }
- #pragma omp atomic capture
- { x = x * 7 + 6; v = x; } // { dg-error "expected" }
- #pragma omp atomic capture
- { x = x * 7 ^ 6; v = x; } // { dg-error "expected" }
- #pragma omp atomic capture
- { x = x - 8 + 6; v = x; } // { dg-error "expected" }
- #pragma omp atomic capture
- { x = x ^ 7 | 2; v = x; } // { dg-error "expected" }
- (void) v;
- return 0;
-}
diff --git a/gcc/testsuite/g++.dg/gomp/atomic-2.C b/gcc/testsuite/g++.dg/gomp/atomic-2.C
deleted file mode 100644
index 720ec9e8ba0..00000000000
--- a/gcc/testsuite/g++.dg/gomp/atomic-2.C
+++ /dev/null
@@ -1,23 +0,0 @@
-/* { dg-do compile } */
-
-float x, y;
-
-void f1(void)
-{
- #pragma omp atomic
- x++;
- #pragma omp atomic
- x--;
- #pragma omp atomic
- ++x;
- #pragma omp atomic
- --x;
- #pragma omp atomic
- x += 1;
- #pragma omp atomic
- x -= y;
- #pragma omp atomic
- x *= 3;
- #pragma omp atomic
- x /= 3;
-}
diff --git a/gcc/testsuite/g++.dg/gomp/atomic-3.C b/gcc/testsuite/g++.dg/gomp/atomic-3.C
deleted file mode 100644
index 7ea792d3457..00000000000
--- a/gcc/testsuite/g++.dg/gomp/atomic-3.C
+++ /dev/null
@@ -1,13 +0,0 @@
-/* { dg-do compile } */
-/* { dg-options "-fopenmp -fdump-tree-ompexp" } */
-
-int *xyzzy;
-
-void f1(void)
-{
- #pragma omp atomic
- xyzzy++;
-}
-
-/* { dg-final { scan-tree-dump-times "xyzzy, 4" 1 "ompexp" { target i?86-*-* x86_64-*-* ia64-*-* powerpc*-*-* alpha*-*-* } } } */
-/* { dg-final { cleanup-tree-dump "ompexp" } } */
diff --git a/gcc/testsuite/g++.dg/gomp/atomic-4.C b/gcc/testsuite/g++.dg/gomp/atomic-4.C
deleted file mode 100644
index 7f27370d535..00000000000
--- a/gcc/testsuite/g++.dg/gomp/atomic-4.C
+++ /dev/null
@@ -1,24 +0,0 @@
-/* { dg-do compile } */
-
-int a[4];
-int *p;
-struct S { int x; int y[4]; } s;
-int *bar(void);
-
-void f1(void)
-{
- #pragma omp atomic
- a[4] += 1;
- #pragma omp atomic
- *p += 1;
- #pragma omp atomic
- s.x += 1;
- #pragma omp atomic
- s.y[*p] += 1;
- #pragma omp atomic
- s.y[*p] *= 42;
- #pragma omp atomic
- *bar() += 1;
- #pragma omp atomic
- *bar() *= 42;
-}
diff --git a/gcc/testsuite/g++.dg/gomp/atomic-7.C b/gcc/testsuite/g++.dg/gomp/atomic-7.C
deleted file mode 100644
index 612e97f4530..00000000000
--- a/gcc/testsuite/g++.dg/gomp/atomic-7.C
+++ /dev/null
@@ -1,23 +0,0 @@
-/* { dg-do compile } */
-
-double x, y;
-
-void f2(void)
-{
- #pragma omp atomic
- y++;
- #pragma omp atomic
- y--;
- #pragma omp atomic
- ++y;
- #pragma omp atomic
- --y;
- #pragma omp atomic
- y += 1;
- #pragma omp atomic
- y -= x;
- #pragma omp atomic
- y *= 3;
- #pragma omp atomic
- y /= 3;
-}
diff --git a/gcc/testsuite/g++.dg/gomp/atomic-8.C b/gcc/testsuite/g++.dg/gomp/atomic-8.C
deleted file mode 100644
index 2f04151f0ed..00000000000
--- a/gcc/testsuite/g++.dg/gomp/atomic-8.C
+++ /dev/null
@@ -1,21 +0,0 @@
-/* { dg-do compile } */
-
-long double z;
-
-void f3(void)
-{
- #pragma omp atomic
- z++;
- #pragma omp atomic
- z--;
- #pragma omp atomic
- ++z;
- #pragma omp atomic
- --z;
- #pragma omp atomic
- z += 1;
- #pragma omp atomic
- z *= 3;
- #pragma omp atomic
- z /= 3;
-}
diff --git a/gcc/testsuite/g++.dg/gomp/atomic-9.C b/gcc/testsuite/g++.dg/gomp/atomic-9.C
deleted file mode 100644
index 2fafbd4097a..00000000000
--- a/gcc/testsuite/g++.dg/gomp/atomic-9.C
+++ /dev/null
@@ -1,13 +0,0 @@
-/* { dg-do compile } */
-/* { dg-options "-fopenmp -fdump-tree-ompexp" } */
-
-volatile int *bar(void);
-
-void f1(void)
-{
- #pragma omp atomic
- *bar() += 1;
-}
-
-/* { dg-final { scan-tree-dump-times "__sync_fetch_and_add" 1 "ompexp" { target i?86-*-* x86_64-*-* ia64-*-* powerpc*-*-* alpha*-*-* } } } */
-/* { dg-final { cleanup-tree-dump "ompexp" } } */
diff --git a/gcc/testsuite/g++.dg/gomp/gomp.exp b/gcc/testsuite/g++.dg/gomp/gomp.exp
index 9f60bc1c5f3..b99d302ddf5 100644
--- a/gcc/testsuite/g++.dg/gomp/gomp.exp
+++ b/gcc/testsuite/g++.dg/gomp/gomp.exp
@@ -27,7 +27,7 @@ if ![check_effective_target_fopenmp] {
dg-init
# Main loop.
-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.C]] "" "-fopenmp"
+dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.C $srcdir/c-c++-common/gomp/*.c]] "" "-fopenmp"
# All done.
dg-finish
diff --git a/gcc/testsuite/g++.dg/init/copy7.C b/gcc/testsuite/g++.dg/init/copy7.C
deleted file mode 100644
index 20e1e47dbb9..00000000000
--- a/gcc/testsuite/g++.dg/init/copy7.C
+++ /dev/null
@@ -1,39 +0,0 @@
-// PR c++/39480
-// It isn't always safe to call memcpy with identical arguments.
-// { dg-do run }
-
-extern "C" void abort();
-extern "C" void *
-memcpy(void *dest, void *src, __SIZE_TYPE__ n)
-{
- if (dest == src)
- abort();
- else
- {
- __SIZE_TYPE__ i;
- for (i = 0; i < n; i++)
- ((char *)dest)[i] = ((const char*)src)[i];
- }
-}
-
-struct A
-{
- double d[10];
-};
-
-struct B: public A
-{
- char bc;
-};
-
-B b;
-
-void f(B *a1, B* a2)
-{
- *a1 = *a2;
-}
-
-int main()
-{
- f(&b,&b);
-}
diff --git a/gcc/testsuite/g++.dg/init/lifetime1.C b/gcc/testsuite/g++.dg/init/lifetime1.C
new file mode 100644
index 00000000000..57f8c62179a
--- /dev/null
+++ b/gcc/testsuite/g++.dg/init/lifetime1.C
@@ -0,0 +1,29 @@
+// PR c++/48370
+// { dg-do run }
+
+extern "C" void abort();
+
+int last = 4;
+
+struct A {
+ int i;
+ A(int i): i(i) { }
+ ~A() { if (i > last) abort(); last = i; }
+};
+
+struct D { int i; };
+
+struct B: D, A { B(int i): A(i) { } };
+struct E: D, virtual A { E(int i): A(i) { } };
+
+struct C
+{
+ const A& ar1;
+ const A& ar2;
+ const A& ar3;
+};
+
+int main()
+{
+ C c = { 1, B(2), E(3) };
+}
diff --git a/gcc/testsuite/g++.dg/init/lifetime2.C b/gcc/testsuite/g++.dg/init/lifetime2.C
new file mode 100644
index 00000000000..293bd692e9c
--- /dev/null
+++ b/gcc/testsuite/g++.dg/init/lifetime2.C
@@ -0,0 +1,23 @@
+// PR c++/26714
+// { dg-do run }
+
+extern "C" void abort();
+
+bool ok = false;
+struct A
+{
+ A() { }
+ ~A() { if (!ok) abort(); }
+};
+
+struct B
+{
+ const A &a1;
+ const A &a2;
+ B() : a1(A()),a2(A()) { ok = true; }
+};
+
+int main()
+{
+ B b;
+}
diff --git a/gcc/testsuite/g++.dg/init/ref21.C b/gcc/testsuite/g++.dg/init/ref21.C
new file mode 100644
index 00000000000..db4ac4a300f
--- /dev/null
+++ b/gcc/testsuite/g++.dg/init/ref21.C
@@ -0,0 +1,7 @@
+struct A
+{
+ const int &i1;
+ const int &i2;
+};
+
+A a = { 1, 2 };
diff --git a/gcc/testsuite/g++.dg/ipa/devirt-c-1.C b/gcc/testsuite/g++.dg/ipa/devirt-c-1.C
index df2230d4c66..dcd8046597c 100644
--- a/gcc/testsuite/g++.dg/ipa/devirt-c-1.C
+++ b/gcc/testsuite/g++.dg/ipa/devirt-c-1.C
@@ -1,7 +1,7 @@
/* Verify that ipa-cp correctly detects the dynamic type of an object
under construction when doing devirtualization. */
/* { dg-do run } */
-/* { dg-options "-O3 -fno-early-inlining -fno-inline" } */
+/* { dg-options "-O3 -fno-early-inlining -fno-inline -fdump-ipa-cp -fdump-tree-optimized" } */
extern "C" void abort (void);
@@ -69,3 +69,8 @@ int main (int argc, char *argv[])
bah ();
return 0;
}
+
+/* { dg-final { scan-ipa-dump "Discovered a virtual call to a known target.*A::foo" "cp" } } */
+/* { dg-final { scan-tree-dump-times "OBJ_TYPE_REF" 0 "optimized"} } */
+/* { dg-final { cleanup-ipa-dump "cp" } } */
+/* { dg-final { cleanup-tree-dump "optimized" } } */
diff --git a/gcc/testsuite/g++.dg/ipa/devirt-c-2.C b/gcc/testsuite/g++.dg/ipa/devirt-c-2.C
index d37fe50cda2..b9a36e29f87 100644
--- a/gcc/testsuite/g++.dg/ipa/devirt-c-2.C
+++ b/gcc/testsuite/g++.dg/ipa/devirt-c-2.C
@@ -1,7 +1,7 @@
/* Verify that ipa-cp correctly detects the dynamic type of an object
under construction when doing devirtualization. */
/* { dg-do run } */
-/* { dg-options "-O3 -fno-early-inlining -fno-inline" } */
+/* { dg-options "-O3 -fno-early-inlining -fno-inline -fdump-ipa-cp -fdump-tree-optimized" } */
extern "C" void abort (void);
@@ -77,3 +77,8 @@ int main (int argc, char *argv[])
bah ();
return 0;
}
+
+/* { dg-final { scan-ipa-dump "Discovered a virtual call to a known target.*A::foo" "cp" } } */
+/* { dg-final { scan-tree-dump-times "OBJ_TYPE_REF" 0 "optimized"} } */
+/* { dg-final { cleanup-ipa-dump "cp" } } */
+/* { dg-final { cleanup-tree-dump "optimized" } } */
diff --git a/gcc/testsuite/g++.dg/ipa/devirt-c-7.C b/gcc/testsuite/g++.dg/ipa/devirt-c-7.C
new file mode 100644
index 00000000000..89d04328c18
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ipa/devirt-c-7.C
@@ -0,0 +1,87 @@
+/* Verify that ipa-cp will not get confused by placement new constructing an
+ object within another one when looking for dynamic type change . */
+/* { dg-do run } */
+/* { dg-options "-O3 -Wno-attributes" } */
+
+extern "C" void abort (void);
+namespace std {
+ typedef __SIZE_TYPE__ size_t;
+}
+inline void* __attribute__ ((always_inline))
+operator new(std::size_t, void* __p) throw()
+{
+ return __p;
+}
+
+class A
+{
+public:
+ char data[256];
+ A();
+ virtual int foo (int i);
+};
+
+class B : public A
+{
+public:
+ virtual int foo (int i);
+};
+
+class C
+{
+public:
+ C();
+ virtual double foo (double i);
+};
+
+int A::foo (int i)
+{
+ return i + 1;
+}
+
+int B::foo (int i)
+{
+ return i + 2;
+}
+
+double C::foo (double i)
+{
+ return i + 3.5;
+}
+
+static int __attribute__ ((noinline)) middleman (class A *obj, int i)
+{
+ return obj->foo (i);
+}
+
+int __attribute__ ((noinline,noclone)) get_input(void)
+{
+ return 1;
+}
+
+__attribute__ ((always_inline)) C::C ()
+{
+}
+
+A::A ()
+{
+}
+
+static __attribute__ ((noinline)) void bah ()
+{
+ class B b;
+
+ C *c = new ((void *) &b.data) C;
+
+ if (middleman (&b, get_input ()) != 3)
+ abort ();
+}
+
+int main (int argc, char *argv[])
+{
+ int i;
+
+ for (i = 0; i < 10; i++)
+ bah ();
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/ipa/devirt-c-8.C b/gcc/testsuite/g++.dg/ipa/devirt-c-8.C
new file mode 100644
index 00000000000..309644d92ac
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ipa/devirt-c-8.C
@@ -0,0 +1,82 @@
+/* Verify that ipa-cp correctly detects the dynamic type of an object
+ under construction when doing devirtualization. */
+/* { dg-do run } */
+/* { dg-options "-O3 -fno-early-inlining -fno-inline -fdump-ipa-cp -fdump-tree-optimized" } */
+
+extern "C" void abort (void);
+
+class A
+{
+public:
+ int data;
+ A();
+ virtual int foo (int i);
+};
+
+class B : public A
+{
+public:
+ B();
+ virtual int foo (int i);
+};
+
+class C : public A
+{
+public:
+ virtual int foo (int i);
+};
+
+int A::foo (int i)
+{
+ return i + 1;
+}
+
+int B::foo (int i)
+{
+ return i + 2;
+}
+
+int C::foo (int i)
+{
+ return i + 3;
+}
+
+static int __attribute__ ((noinline))
+middleman (class A *obj, int i)
+{
+ return obj->foo (i);
+}
+
+int __attribute__ ((noinline,noclone)) get_input(void)
+{
+ return 1;
+}
+
+inline __attribute__ ((always_inline)) A::A ()
+{
+ if (middleman (this, get_input ()) != 2)
+ abort ();
+}
+
+inline __attribute__ ((always_inline)) B::B ()
+{
+}
+
+static void bah ()
+{
+ class B b;
+}
+
+int main (int argc, char *argv[])
+{
+ int i;
+
+ for (i = 0; i < 10; i++)
+ bah ();
+ return 0;
+}
+
+/* { dg-final { scan-ipa-dump "Discovered a virtual call to a known target.*A::foo" "cp" } } */
+/* { dg-final { scan-tree-dump-times "OBJ_TYPE_REF" 0 "optimized"} } */
+/* { dg-final { cleanup-ipa-dump "cp" } } */
+/* { dg-final { cleanup-tree-dump "optimized" } } */
diff --git a/gcc/testsuite/g++.dg/opt/devirt2.C b/gcc/testsuite/g++.dg/opt/devirt2.C
index b068f4dedd7..1198abdd776 100644
--- a/gcc/testsuite/g++.dg/opt/devirt2.C
+++ b/gcc/testsuite/g++.dg/opt/devirt2.C
@@ -1,5 +1,8 @@
// { dg-do compile }
// { dg-options "-O2" }
+/* Using -mshort-calls avoids loading the function addresses in
+ registers and thus getting the counts wrong. */
+// { dg-additional-options "-mshort-calls" {target epiphany-*-*} }
// { dg-final { scan-assembler-times "xyzzy" 2 { target { ! { alpha*-*-* hppa*-*-* ia64*-*-hpux* sparc*-*-* } } } } }
// The IA64 and HPPA compilers generate external declarations in addition
// to the call so those scans need to be more specific.
diff --git a/gcc/testsuite/g++.dg/other/offsetof7.C b/gcc/testsuite/g++.dg/other/offsetof7.C
new file mode 100644
index 00000000000..0ce2ee02aa8
--- /dev/null
+++ b/gcc/testsuite/g++.dg/other/offsetof7.C
@@ -0,0 +1,17 @@
+// PR c++/50608
+// Testcase by <dberger@oubliette.org>
+// { dg-do compile }
+
+struct A {
+ int offset;
+};
+
+struct B: public A {
+};
+
+struct C {
+ A a;
+ B b;
+};
+
+int fails = __builtin_offsetof (C, b.offset);
diff --git a/gcc/testsuite/g++.dg/parse/pragma3.C b/gcc/testsuite/g++.dg/parse/pragma3.C
index 36d7a8c6284..57793b385d0 100644
--- a/gcc/testsuite/g++.dg/parse/pragma3.C
+++ b/gcc/testsuite/g++.dg/parse/pragma3.C
@@ -1,5 +1,6 @@
// PR c++/25294
-// { dg-do run }
+// Epiphany makes struct S 8-byte aligned.
+// { dg-do run { target { ! epiphany-*-* } } }
extern "C" void abort (void);
diff --git a/gcc/testsuite/g++.dg/pr50672.C b/gcc/testsuite/g++.dg/pr50672.C
new file mode 100644
index 00000000000..fb310082edc
--- /dev/null
+++ b/gcc/testsuite/g++.dg/pr50672.C
@@ -0,0 +1,101 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -ftree-tail-merge" } */
+typedef int BoxCoordinate;
+typedef int BoxDimension;
+const BoxDimension X = 0;
+const BoxDimension Y = 1;
+const BoxDimension NDimensions = 2;
+class BoxPoint {
+ BoxCoordinate point[NDimensions];
+public:
+ bool isValid() const;
+ void operator += (const BoxPoint& p) {
+ if (isValid() && p.isValid()) {
+ point[X] += p.point[X];
+ }
+ }
+ const BoxCoordinate& operator [] (const BoxDimension& dimension) const {
+ return point[dimension];
+ }
+};
+class BoxRegion {
+public:
+ BoxCoordinate& origin(BoxDimension d) const;
+ BoxCoordinate& space(BoxDimension d) const;
+};
+inline bool operator <= (const BoxPoint& p, const BoxRegion& r) {
+ for (BoxDimension d = X;
+ d <= Y;
+ d++) if (p[d] < r.origin(d) || p[d] >= r.origin(d) + r.space(d))
+return false;
+ return true;
+}
+typedef struct _WidgetRec *Widget;
+struct GraphGC {
+ BoxPoint offsetIfSelected;
+};
+class GraphNode;
+class GraphEdge {
+public:
+ GraphNode *from() const;
+ GraphNode *to() const;
+};
+class LineGraphEdge: public GraphEdge {
+protected:
+ virtual void drawLine(Widget w, const GraphGC& gc) const;
+ void _print(const GraphGC &gc) const;
+};
+class ArcGraphEdge: public LineGraphEdge {
+ static bool center(const BoxPoint& p1, const BoxPoint& p2,
+ const BoxPoint& p3, double& x, double& y);
+ void makeLine(Widget w, const GraphGC& gc) const;
+};
+class GraphNode {
+public:
+ bool& selected();
+ GraphEdge *firstTo() const;
+ GraphEdge *nextTo(GraphEdge *ref) const;
+ virtual const BoxPoint& pos() const = 0;
+ virtual const BoxRegion& region(const GraphGC& gc) const = 0;
+ virtual bool isHint() const;
+};
+class PosGraphNode: public GraphNode { };
+class RegionGraphNode: public PosGraphNode { };
+class HintGraphNode: public RegionGraphNode { };
+void ArcGraphEdge::makeLine(Widget w, const GraphGC& gc) const {
+ HintGraphNode *arc_hint = 0;
+ RegionGraphNode *arc_from = 0;
+ RegionGraphNode *arc_to = 0;
+ bool make_arc = true;
+ if (from()->isHint() && to()->isHint()) {
+ make_arc = false;
+ }
+ else if (from()->isHint() && from()->firstTo() != 0) {
+ if (arc_hint == 0 || arc_from == 0 || arc_to == 0
+ || arc_hint->nextTo(arc_hint->firstTo()) != 0) {
+ make_arc = false;
+ }
+ }
+ if (!make_arc) {
+ if (w != 0) LineGraphEdge::drawLine(w, gc);
+ else LineGraphEdge::_print(gc);
+ return;
+ }
+ BoxPoint pos_from = arc_from->pos();
+ BoxRegion region_from = arc_from->region(gc);
+ BoxPoint pos_to = arc_to->pos();
+ BoxRegion region_to = arc_to->region(gc);
+ BoxPoint pos_hint = arc_hint->pos();
+ if (arc_hint->selected()) {
+ pos_hint += gc.offsetIfSelected;
+ }
+ if (pos_hint <= region_from || pos_hint <= region_to) {
+ return;
+ }
+ double cx, cy;
+ bool ok = center(pos_from, pos_hint, pos_to, cx, cy);
+ if (!ok) {
+ if (w != 0) LineGraphEdge::drawLine(w, gc);
+ else LineGraphEdge::_print(gc);
+ }
+}
diff --git a/gcc/testsuite/g++.dg/pr50763-3.C b/gcc/testsuite/g++.dg/pr50763-3.C
new file mode 100644
index 00000000000..b66be87b1b8
--- /dev/null
+++ b/gcc/testsuite/g++.dg/pr50763-3.C
@@ -0,0 +1,57 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target ilp32 } */
+/* { dg-options "-O2 -ftree-tail-merge" } */
+
+class v2d {
+public:
+ double x;
+ double y;
+};
+
+class v3d {
+public:
+ double x;
+ v3d() {}
+ v3d(const v2d & cr2Dv) {}
+};
+
+class e2d {
+protected:
+ v2d _Min;
+ v2d _Max;
+public:
+ int cop2d(const v2d & rPnt) const;
+ v2d clp2d(const v2d & rPnt) const;
+};
+
+inline int e2d::cop2d(const v2d & rPnt) const {
+ int bRet = 1;
+ if (rPnt.x < _Min.x) bRet = 0;
+ else if (rPnt.x > _Max.x) bRet = 0;
+ else if (rPnt.y > _Max.y) bRet = 0;
+ return bRet;
+}
+
+inline v2d e2d::clp2d(const v2d & rPnt) const {
+ v2d sRet = rPnt;
+ if (rPnt.x < _Min.x) sRet.x = _Min.x;
+ if (rPnt.y < _Min.y) sRet.y = _Min.y;
+ if (rPnt.x > _Max.x) sRet.x = _Max.x;
+ if (rPnt.y > _Max.y) sRet.y = _Max.y;
+ return sRet;
+}
+
+class sExt {
+protected:
+ e2d _Dom;
+ long eval() const;
+ long evalPoint(const v2d & crUV, v3d & rPnt) const;
+};
+
+long sExt::evalPoint(const v2d & crUV, v3d & rPnt) const {
+ v3d sUV = crUV;
+ if (!_Dom.cop2d(crUV)) {
+ sUV = _Dom.clp2d(crUV);
+ }
+ eval();
+}
diff --git a/gcc/testsuite/g++.dg/pr50763-4.C b/gcc/testsuite/g++.dg/pr50763-4.C
new file mode 100644
index 00000000000..2605d81925b
--- /dev/null
+++ b/gcc/testsuite/g++.dg/pr50763-4.C
@@ -0,0 +1,34 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -ftree-tail-merge" } */
+
+float
+clamp (const float x)
+{
+ return x <= 1 ? 1 : x;
+}
+
+template < class T > struct VECTOR
+{
+ float x;
+};
+template < class TV > class JOINT
+{
+ virtual void Constrain_Angles (VECTOR < float >&angles) const;
+};
+
+template < class TV > class ANGLE_JOINT:public JOINT < TV >
+{
+ virtual ~ ANGLE_JOINT ()
+ {
+ }
+ void Constrain_Angles (VECTOR < float >&angles) const
+ {
+ VECTOR < float >v;
+ if (v.x)
+ v.x = clamp (angles.x);
+ else
+ v.x = angles.x;
+ angles.x = v.x;
+ }
+};
+template ANGLE_JOINT < int >::~ANGLE_JOINT ();
diff --git a/gcc/testsuite/g++.dg/simulate-thread/atomics-1.C b/gcc/testsuite/g++.dg/simulate-thread/atomics-1.C
new file mode 100644
index 00000000000..7e0041ee382
--- /dev/null
+++ b/gcc/testsuite/g++.dg/simulate-thread/atomics-1.C
@@ -0,0 +1,73 @@
+/* { dg-do link } */
+/* { dg-options "-std=c++0x" } */
+/* { dg-final { simulate-thread } } */
+
+/* Test that atomic int and atomic char work properly. */
+
+using namespace std;
+
+#include <atomic>
+#include <limits.h>
+#include <stdio.h>
+#include "simulate-thread.h"
+
+atomic<int> atomi;
+atomic<char> atomc;
+
+/* No need for parallel threads to do anything */
+void simulate_thread_other_threads()
+{
+}
+
+/* Verify after every instruction is executed, that the atmoic int and
+ char have one of the 2 legitimate values. */
+int simulate_thread_step_verify()
+{
+ if (atomi != 0 && atomi != INT_MAX)
+ {
+ printf ("FAIL: invalid intermediate result for atomi (%d).\n",
+ (int)atomi);
+ return 1;
+ }
+ if (atomc != 0 && atomc != CHAR_MAX)
+ {
+ printf ("FAIL: invalid intermediate result for atomc (%d).\n",
+ (int)atomc);
+ return 1;
+ }
+ return 0;
+}
+
+
+/* Verify that both atmoics have the corerct value. */
+int simulate_thread_final_verify()
+{
+ if (atomi != INT_MAX)
+ {
+ printf ("FAIL: invalid final result for atomi (%d).\n",
+ (int)atomi);
+ return 1;
+ }
+ if (atomc != CHAR_MAX)
+ {
+ printf ("FAIL: invalid final result for atomc (%d).\n",
+ (int)atomc);
+ return 1;
+ }
+ return 0;
+}
+
+/* Test a store to an atomic int and an atomic char. */
+__attribute__((noinline))
+void simulate_thread_main()
+{
+ atomi = INT_MAX;
+ atomc = CHAR_MAX;
+}
+
+int main ()
+{
+ simulate_thread_main();
+ simulate_thread_done();
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/simulate-thread/atomics-2.C b/gcc/testsuite/g++.dg/simulate-thread/atomics-2.C
new file mode 100644
index 00000000000..be3232d7087
--- /dev/null
+++ b/gcc/testsuite/g++.dg/simulate-thread/atomics-2.C
@@ -0,0 +1,58 @@
+/* { dg-do link } */
+/* { dg-options "-std=c++0x" } */
+/* { dg-final { simulate-thread } } */
+
+using namespace std;
+
+#include <atomic>
+#include <limits.h>
+#include <stdio.h>
+#include "simulate-thread.h"
+
+atomic_int atomi;
+
+/* Non-atomic. Use a type wide enough to possibly coerce GCC into
+ moving things around. */
+long double j;
+
+
+/* Test that an atomic store synchronizes with an atomic load.
+
+ In this case, test that the store to <j> happens-before the atomic
+ store to <atomi>. Make sure the compiler does not reorder the
+ stores. */
+__attribute__((noinline))
+void simulate_thread_main()
+{
+ j = 13.0;
+ atomi.store(1);
+}
+
+int main ()
+{
+ simulate_thread_main();
+ simulate_thread_done();
+ return 0;
+}
+
+void simulate_thread_other_threads()
+{
+}
+
+/* Verify that side-effects before an atomic store are correctly
+ synchronized with the an atomic load to the same location. */
+int simulate_thread_step_verify()
+{
+ if (atomi.load() == 1 && j != 13.0)
+ {
+ printf ("FAIL: invalid synchronization for atomic load/store.\n");
+ return 1;
+ }
+ return 0;
+}
+
+
+int simulate_thread_final_verify()
+{
+ return simulate_thread_step_verify();
+}
diff --git a/gcc/testsuite/g++.dg/simulate-thread/bitfields-2.C b/gcc/testsuite/g++.dg/simulate-thread/bitfields-2.C
new file mode 100644
index 00000000000..077514a3ff5
--- /dev/null
+++ b/gcc/testsuite/g++.dg/simulate-thread/bitfields-2.C
@@ -0,0 +1,77 @@
+/* { dg-do link } */
+/* { dg-options "--param allow-load-data-races=0 --param allow-store-data-races=0" } */
+/* { dg-final { simulate-thread } } */
+
+/* Test that setting <var.a> does not touch either <var.b> or <var.c>.
+ In the C++ memory model, non contiguous bitfields ("a" and "c"
+ here) should be considered as distinct memory locations, so we
+ can't use bit twiddling to set either one. */
+
+#include <stdio.h>
+#include "simulate-thread.h"
+
+#define CONSTA 12
+
+static int global;
+struct S
+{
+ unsigned int a : 4;
+ unsigned char b;
+ unsigned int c : 6;
+} var;
+
+__attribute__((noinline))
+void set_a()
+{
+ var.a = CONSTA;
+}
+
+void simulate_thread_other_threads()
+{
+ ++global;
+ var.b = global;
+ var.c = global;
+}
+
+int simulate_thread_step_verify()
+{
+ int ret = 0;
+ if (var.b != global)
+ {
+ printf ("FAIL: Unexpected value: var.b is %d, should be %d\n",
+ var.b, global);
+ ret = 1;
+ }
+ if (var.c != global)
+ {
+ printf ("FAIL: Unexpected value: var.c is %d, should be %d\n",
+ var.c, global);
+ ret = 1;
+ }
+ return ret;
+}
+
+int simulate_thread_final_verify()
+{
+ int ret = simulate_thread_step_verify();
+ if (var.a != CONSTA)
+ {
+ printf ("FAIL: Unexpected value: var.a is %d, should be %d\n",
+ var.a, CONSTA);
+ ret = 1;
+ }
+ return ret;
+}
+
+__attribute__((noinline))
+void simulate_thread_main()
+{
+ set_a();
+}
+
+int main()
+{
+ simulate_thread_main();
+ simulate_thread_done();
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/simulate-thread/bitfields.C b/gcc/testsuite/g++.dg/simulate-thread/bitfields.C
new file mode 100644
index 00000000000..3acf21f876f
--- /dev/null
+++ b/gcc/testsuite/g++.dg/simulate-thread/bitfields.C
@@ -0,0 +1,80 @@
+/* { dg-do link } */
+/* { dg-options "--param allow-load-data-races=0 --param allow-store-data-races=0" } */
+/* { dg-final { simulate-thread } } */
+
+/* Test that setting <var.a> does not touch either <var.b> or <var.c>.
+ In the C++ memory model, non contiguous bitfields ("a" and "c"
+ here) should be considered as distinct memory locations, so we
+ can't use bit twiddling to set either one. */
+
+#include <stdio.h>
+#include "simulate-thread.h"
+
+#define CONSTA 12
+
+static int global;
+struct S
+{
+ /* On x86-64, the volatile causes us to access <a> with a 32-bit
+ access, and thus trigger this test. */
+ volatile unsigned int a : 4;
+
+ unsigned char b;
+ unsigned int c : 6;
+} var;
+
+__attribute__((noinline))
+void set_a()
+{
+ var.a = CONSTA;
+}
+
+void simulate_thread_other_threads()
+{
+ ++global;
+ var.b = global;
+ var.c = global;
+}
+
+int simulate_thread_step_verify()
+{
+ int ret = 0;
+ if (var.b != global)
+ {
+ printf ("FAIL: Unexpected value: var.b is %d, should be %d\n",
+ var.b, global);
+ ret = 1;
+ }
+ if (var.c != global)
+ {
+ printf ("FAIL: Unexpected value: var.c is %d, should be %d\n",
+ var.c, global);
+ ret = 1;
+ }
+ return ret;
+}
+
+int simulate_thread_final_verify()
+{
+ int ret = simulate_thread_step_verify();
+ if (var.a != CONSTA)
+ {
+ printf ("FAIL: Unexpected value: var.a is %d, should be %d\n",
+ var.a, CONSTA);
+ ret = 1;
+ }
+ return ret;
+}
+
+__attribute__((noinline))
+void simulate_thread_main()
+{
+ set_a();
+}
+
+int main ()
+{
+ simulate_thread_main();
+ simulate_thread_done();
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/warn/Wcast-qual2.C b/gcc/testsuite/g++.dg/warn/Wcast-qual2.C
new file mode 100644
index 00000000000..23dbb4d39b0
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Wcast-qual2.C
@@ -0,0 +1,4 @@
+// PR c++/50956
+// { dg-options "-Wcast-qual" }
+
+void* p = (void*)"txt"; // { dg-warning "cast" }
diff --git a/gcc/testsuite/g++.dg/warn/Wconversion-null-3.C b/gcc/testsuite/g++.dg/warn/Wconversion-null-3.C
new file mode 100644
index 00000000000..1942ee270bf
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Wconversion-null-3.C
@@ -0,0 +1,8 @@
+// PR c++/48420
+
+void foo(int* p);
+
+void bar() {
+ const bool kDebugMode = false;
+ foo(kDebugMode); // { dg-warning "converting 'false'" }
+}
diff --git a/gcc/testsuite/g++.dg/warn/Wzero-as-null-pointer-constant-1.C b/gcc/testsuite/g++.dg/warn/Wzero-as-null-pointer-constant-1.C
new file mode 100644
index 00000000000..d0f62b212ec
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Wzero-as-null-pointer-constant-1.C
@@ -0,0 +1,100 @@
+// { dg-options "-Wzero-as-null-pointer-constant" }
+
+struct A;
+
+typedef int (A::*pointmemfun) (int);
+typedef int (A::*pointdmem);
+typedef int (*pointfun) (int);
+
+pointmemfun pmfs;
+pointdmem pdms;
+pointfun pfs;
+int* ps;
+
+void f()
+{
+ pointmemfun pmf(0); // { dg-warning "zero as null pointer" }
+ pointdmem pdm(0); // { dg-warning "zero as null pointer" }
+ pointfun pf(0); // { dg-warning "zero as null pointer" }
+ int* p(0); // { dg-warning "zero as null pointer" }
+
+ pmf = 0; // { dg-warning "zero as null pointer" }
+
+ pdm = 0; // { dg-warning "zero as null pointer" }
+
+ pf = 0; // { dg-warning "zero as null pointer" }
+
+ p = 0; // { dg-warning "zero as null pointer" }
+
+ if (pmf)
+ ;
+
+ if (pdm)
+ ;
+
+ if (pf)
+ ;
+
+ if (p)
+ ;
+
+ if (!pmf)
+ ;
+
+ if (!pdm)
+ ;
+
+ if (!pf)
+ ;
+
+ if (!p)
+ ;
+
+ if (pmf == 0) // { dg-warning "zero as null pointer" }
+ ;
+
+ if (pdm == 0) // { dg-warning "zero as null pointer" }
+ ;
+
+ if (pf == 0) // { dg-warning "zero as null pointer" }
+ ;
+
+ if (p == 0) // { dg-warning "zero as null pointer" }
+ ;
+
+ if (0 == pmf) // { dg-warning "zero as null pointer" }
+ ;
+
+ if (0 == pdm) // { dg-warning "zero as null pointer" }
+ ;
+
+ if (0 == pf) // { dg-warning "zero as null pointer" }
+ ;
+
+ if (0 == p) // { dg-warning "zero as null pointer" }
+ ;
+
+ if (pmf != 0) // { dg-warning "zero as null pointer" }
+ ;
+
+ if (pdm != 0) // { dg-warning "zero as null pointer" }
+ ;
+
+ if (pf != 0) // { dg-warning "zero as null pointer" }
+ ;
+
+ if (p != 0) // { dg-warning "zero as null pointer" }
+ ;
+
+ if (0 != pmf) // { dg-warning "zero as null pointer" }
+ ;
+
+ if (0 != pdm) // { dg-warning "zero as null pointer" }
+ ;
+
+ if (0 != pf) // { dg-warning "zero as null pointer" }
+ ;
+
+ if (0 != p) // { dg-warning "zero as null pointer" }
+ ;
+}
diff --git a/gcc/testsuite/gcc.c-torture/execute/20101011-1.c b/gcc/testsuite/gcc.c-torture/execute/20101011-1.c
index 156fd7b0c61..fcf8c071246 100644
--- a/gcc/testsuite/gcc.c-torture/execute/20101011-1.c
+++ b/gcc/testsuite/gcc.c-torture/execute/20101011-1.c
@@ -28,6 +28,10 @@
/* Not all Linux kernels deal correctly the breakpoints generated by
MIPS16 divisions by zero. They show up as a SIGTRAP instead. */
# define DO_TEST 0
+#elif defined (__epiphany__)
+ /* Epiphany does not have hardware division, and the software implementation
+ has truly undefined behaviour for division by 0. */
+# define DO_TEST 0
#else
# define DO_TEST 1
#endif
diff --git a/gcc/testsuite/gcc.c-torture/execute/ieee/mul-subnormal-single-1.x b/gcc/testsuite/gcc.c-torture/execute/ieee/mul-subnormal-single-1.x
index 418526599d5..d090cbf610e 100644
--- a/gcc/testsuite/gcc.c-torture/execute/ieee/mul-subnormal-single-1.x
+++ b/gcc/testsuite/gcc.c-torture/execute/ieee/mul-subnormal-single-1.x
@@ -1,3 +1,8 @@
+if [istarget "epiphany-*-*"] {
+ # The Epiphany single-precision floating point format does not
+ # support subnormals.
+ return 1
+}
if [istarget "mips-sgi-irix6*"] {
# IRIX 6 sets the MIPS IV flush to zero bit by default, so this test
# isn't expected to work for n32 and n64 on MIPS IV targets.
diff --git a/gcc/testsuite/gcc.dg/20020312-2.c b/gcc/testsuite/gcc.dg/20020312-2.c
index 0b3178f28d7..6e568eddb90 100644
--- a/gcc/testsuite/gcc.dg/20020312-2.c
+++ b/gcc/testsuite/gcc.dg/20020312-2.c
@@ -20,6 +20,8 @@ extern void abort (void);
/* No pic register. */
#elif defined(__cris__)
# define PIC_REG "0"
+#elif defined(__epiphany__)
+#define PIC_REG "r28"
#elif defined(__fr30__)
/* No pic register. */
#elif defined(__H8300__) || defined(__H8300H__) || defined(__H8300S__)
diff --git a/gcc/testsuite/gcc.dg/atomic-compare-exchange-1.c b/gcc/testsuite/gcc.dg/atomic-compare-exchange-1.c
new file mode 100644
index 00000000000..2ac54e80887
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/atomic-compare-exchange-1.c
@@ -0,0 +1,85 @@
+/* Test __atomic routines for existence and proper execution on 1 byte
+ values with each valid memory model. */
+/* { dg-do run } */
+/* { dg-require-effective-target sync_char_short } */
+
+/* Test the execution of the __atomic_compare_exchange_n builtin for a char. */
+
+extern void abort(void);
+
+char v = 0;
+char expected = 0;
+char max = ~0;
+char desired = ~0;
+char zero = 0;
+
+#define STRONG 0
+#define WEAK 1
+
+main ()
+{
+
+ if (!__atomic_compare_exchange_n (&v, &expected, max, STRONG , __ATOMIC_RELAXED, __ATOMIC_RELAXED))
+ abort ();
+ if (expected != 0)
+ abort ();
+
+ if (__atomic_compare_exchange_n (&v, &expected, 0, STRONG , __ATOMIC_ACQUIRE, __ATOMIC_RELAXED))
+ abort ();
+ if (expected != max)
+ abort ();
+
+ if (!__atomic_compare_exchange_n (&v, &expected, 0, STRONG , __ATOMIC_RELEASE, __ATOMIC_ACQUIRE))
+ abort ();
+ if (expected != max)
+ abort ();
+ if (v != 0)
+ abort ();
+
+ if (__atomic_compare_exchange_n (&v, &expected, desired, WEAK, __ATOMIC_ACQ_REL, __ATOMIC_ACQUIRE))
+ abort ();
+ if (expected != 0)
+ abort ();
+
+ if (!__atomic_compare_exchange_n (&v, &expected, desired, STRONG , __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST))
+ abort ();
+ if (expected != 0)
+ abort ();
+ if (v != max)
+ abort ();
+
+ /* Now test the generic version. */
+
+ v = 0;
+
+ if (!__atomic_compare_exchange (&v, &expected, &max, STRONG, __ATOMIC_RELAXED, __ATOMIC_RELAXED))
+ abort ();
+ if (expected != 0)
+ abort ();
+
+ if (__atomic_compare_exchange (&v, &expected, &zero, STRONG , __ATOMIC_ACQUIRE, __ATOMIC_RELAXED))
+ abort ();
+ if (expected != max)
+ abort ();
+
+ if (!__atomic_compare_exchange (&v, &expected, &zero, STRONG , __ATOMIC_RELEASE, __ATOMIC_ACQUIRE))
+ abort ();
+ if (expected != max)
+ abort ();
+ if (v != 0)
+ abort ();
+
+ if (__atomic_compare_exchange (&v, &expected, &desired, WEAK, __ATOMIC_ACQ_REL, __ATOMIC_ACQUIRE))
+ abort ();
+ if (expected != 0)
+ abort ();
+
+ if (!__atomic_compare_exchange (&v, &expected, &desired, STRONG , __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST))
+ abort ();
+ if (expected != 0)
+ abort ();
+ if (v != max)
+ abort ();
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/atomic-compare-exchange-2.c b/gcc/testsuite/gcc.dg/atomic-compare-exchange-2.c
new file mode 100644
index 00000000000..73b25977748
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/atomic-compare-exchange-2.c
@@ -0,0 +1,85 @@
+/* Test __atomic routines for existence and proper execution on 2 byte
+ values with each valid memory model. */
+/* { dg-do run } */
+/* { dg-require-effective-target sync_char_short } */
+
+/* Test the execution of the __atomic_compare_exchange_n builtin for a short. */
+
+extern void abort(void);
+
+short v = 0;
+short expected = 0;
+short max = ~0;
+short desired = ~0;
+short zero = 0;
+
+#define STRONG 0
+#define WEAK 1
+
+main ()
+{
+
+ if (!__atomic_compare_exchange_n (&v, &expected, max, STRONG , __ATOMIC_RELAXED, __ATOMIC_RELAXED))
+ abort ();
+ if (expected != 0)
+ abort ();
+
+ if (__atomic_compare_exchange_n (&v, &expected, 0, STRONG , __ATOMIC_ACQUIRE, __ATOMIC_RELAXED))
+ abort ();
+ if (expected != max)
+ abort ();
+
+ if (!__atomic_compare_exchange_n (&v, &expected, 0, STRONG , __ATOMIC_RELEASE, __ATOMIC_ACQUIRE))
+ abort ();
+ if (expected != max)
+ abort ();
+ if (v != 0)
+ abort ();
+
+ if (__atomic_compare_exchange_n (&v, &expected, desired, WEAK, __ATOMIC_ACQ_REL, __ATOMIC_ACQUIRE))
+ abort ();
+ if (expected != 0)
+ abort ();
+
+ if (!__atomic_compare_exchange_n (&v, &expected, desired, STRONG , __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST))
+ abort ();
+ if (expected != 0)
+ abort ();
+ if (v != max)
+ abort ();
+
+ /* Now test the generic version. */
+
+ v = 0;
+
+ if (!__atomic_compare_exchange (&v, &expected, &max, STRONG, __ATOMIC_RELAXED, __ATOMIC_RELAXED))
+ abort ();
+ if (expected != 0)
+ abort ();
+
+ if (__atomic_compare_exchange (&v, &expected, &zero, STRONG , __ATOMIC_ACQUIRE, __ATOMIC_RELAXED))
+ abort ();
+ if (expected != max)
+ abort ();
+
+ if (!__atomic_compare_exchange (&v, &expected, &zero, STRONG , __ATOMIC_RELEASE, __ATOMIC_ACQUIRE))
+ abort ();
+ if (expected != max)
+ abort ();
+ if (v != 0)
+ abort ();
+
+ if (__atomic_compare_exchange (&v, &expected, &desired, WEAK, __ATOMIC_ACQ_REL, __ATOMIC_ACQUIRE))
+ abort ();
+ if (expected != 0)
+ abort ();
+
+ if (!__atomic_compare_exchange (&v, &expected, &desired, STRONG , __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST))
+ abort ();
+ if (expected != 0)
+ abort ();
+ if (v != max)
+ abort ();
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/atomic-compare-exchange-3.c b/gcc/testsuite/gcc.dg/atomic-compare-exchange-3.c
new file mode 100644
index 00000000000..26097288c9d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/atomic-compare-exchange-3.c
@@ -0,0 +1,85 @@
+/* Test __atomic routines for existence and proper execution on 4 byte
+ values with each valid memory model. */
+/* { dg-do run } */
+/* { dg-require-effective-target sync_int_long } */
+
+/* Test the execution of the __atomic_compare_exchange_n builtin for an int. */
+
+extern void abort(void);
+
+int v = 0;
+int expected = 0;
+int max = ~0;
+int desired = ~0;
+int zero = 0;
+
+#define STRONG 0
+#define WEAK 1
+
+main ()
+{
+
+ if (!__atomic_compare_exchange_n (&v, &expected, max, STRONG , __ATOMIC_RELAXED, __ATOMIC_RELAXED))
+ abort ();
+ if (expected != 0)
+ abort ();
+
+ if (__atomic_compare_exchange_n (&v, &expected, 0, STRONG , __ATOMIC_ACQUIRE, __ATOMIC_RELAXED))
+ abort ();
+ if (expected != max)
+ abort ();
+
+ if (!__atomic_compare_exchange_n (&v, &expected, 0, STRONG , __ATOMIC_RELEASE, __ATOMIC_ACQUIRE))
+ abort ();
+ if (expected != max)
+ abort ();
+ if (v != 0)
+ abort ();
+
+ if (__atomic_compare_exchange_n (&v, &expected, desired, WEAK, __ATOMIC_ACQ_REL, __ATOMIC_ACQUIRE))
+ abort ();
+ if (expected != 0)
+ abort ();
+
+ if (!__atomic_compare_exchange_n (&v, &expected, desired, STRONG , __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST))
+ abort ();
+ if (expected != 0)
+ abort ();
+ if (v != max)
+ abort ();
+
+ /* Now test the generic version. */
+
+ v = 0;
+
+ if (!__atomic_compare_exchange (&v, &expected, &max, STRONG, __ATOMIC_RELAXED, __ATOMIC_RELAXED))
+ abort ();
+ if (expected != 0)
+ abort ();
+
+ if (__atomic_compare_exchange (&v, &expected, &zero, STRONG , __ATOMIC_ACQUIRE, __ATOMIC_RELAXED))
+ abort ();
+ if (expected != max)
+ abort ();
+
+ if (!__atomic_compare_exchange (&v, &expected, &zero, STRONG , __ATOMIC_RELEASE, __ATOMIC_ACQUIRE))
+ abort ();
+ if (expected != max)
+ abort ();
+ if (v != 0)
+ abort ();
+
+ if (__atomic_compare_exchange (&v, &expected, &desired, WEAK, __ATOMIC_ACQ_REL, __ATOMIC_ACQUIRE))
+ abort ();
+ if (expected != 0)
+ abort ();
+
+ if (!__atomic_compare_exchange (&v, &expected, &desired, STRONG , __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST))
+ abort ();
+ if (expected != 0)
+ abort ();
+ if (v != max)
+ abort ();
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/atomic-compare-exchange-4.c b/gcc/testsuite/gcc.dg/atomic-compare-exchange-4.c
new file mode 100644
index 00000000000..d89e72f8171
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/atomic-compare-exchange-4.c
@@ -0,0 +1,86 @@
+/* Test __atomic routines for existence and proper execution on 8 byte
+ values with each valid memory model. */
+/* { dg-do run } */
+/* { dg-require-effective-target sync_long_long } */
+/* { dg-options "" } */
+
+/* Test the execution of __atomic_compare_exchange_n builtin for a long_long. */
+
+extern void abort(void);
+
+long long v = 0;
+long long expected = 0;
+long long max = ~0;
+long long desired = ~0;
+long long zero = 0;
+
+#define STRONG 0
+#define WEAK 1
+
+main ()
+{
+
+ if (!__atomic_compare_exchange_n (&v, &expected, max, STRONG , __ATOMIC_RELAXED, __ATOMIC_RELAXED))
+ abort ();
+ if (expected != 0)
+ abort ();
+
+ if (__atomic_compare_exchange_n (&v, &expected, 0, STRONG , __ATOMIC_ACQUIRE, __ATOMIC_RELAXED))
+ abort ();
+ if (expected != max)
+ abort ();
+
+ if (!__atomic_compare_exchange_n (&v, &expected, 0, STRONG , __ATOMIC_RELEASE, __ATOMIC_ACQUIRE))
+ abort ();
+ if (expected != max)
+ abort ();
+ if (v != 0)
+ abort ();
+
+ if (__atomic_compare_exchange_n (&v, &expected, desired, WEAK, __ATOMIC_ACQ_REL, __ATOMIC_ACQUIRE))
+ abort ();
+ if (expected != 0)
+ abort ();
+
+ if (!__atomic_compare_exchange_n (&v, &expected, desired, STRONG , __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST))
+ abort ();
+ if (expected != 0)
+ abort ();
+ if (v != max)
+ abort ();
+
+ /* Now test the generic version. */
+
+ v = 0;
+
+ if (!__atomic_compare_exchange (&v, &expected, &max, STRONG, __ATOMIC_RELAXED, __ATOMIC_RELAXED))
+ abort ();
+ if (expected != 0)
+ abort ();
+
+ if (__atomic_compare_exchange (&v, &expected, &zero, STRONG , __ATOMIC_ACQUIRE, __ATOMIC_RELAXED))
+ abort ();
+ if (expected != max)
+ abort ();
+
+ if (!__atomic_compare_exchange (&v, &expected, &zero, STRONG , __ATOMIC_RELEASE, __ATOMIC_ACQUIRE))
+ abort ();
+ if (expected != max)
+ abort ();
+ if (v != 0)
+ abort ();
+
+ if (__atomic_compare_exchange (&v, &expected, &desired, WEAK, __ATOMIC_ACQ_REL, __ATOMIC_ACQUIRE))
+ abort ();
+ if (expected != 0)
+ abort ();
+
+ if (!__atomic_compare_exchange (&v, &expected, &desired, STRONG , __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST))
+ abort ();
+ if (expected != 0)
+ abort ();
+ if (v != max)
+ abort ();
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/atomic-compare-exchange-5.c b/gcc/testsuite/gcc.dg/atomic-compare-exchange-5.c
new file mode 100644
index 00000000000..e716dcb350c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/atomic-compare-exchange-5.c
@@ -0,0 +1,86 @@
+/* Test __atomic routines for existence and proper execution on 16 byte
+ values with each valid memory model. */
+/* { dg-do run } */
+/* { dg-require-effective-target sync_int_128 } */
+/* { dg-options "-mcx16" { target { x86_64-*-* } } } */
+
+/* Test the execution of __atomic_compare_exchange_n builtin for an int_128. */
+
+extern void abort(void);
+
+__int128_t v = 0;
+__int128_t expected = 0;
+__int128_t max = ~0;
+__int128_t desired = ~0;
+__int128_t zero = 0;
+
+#define STRONG 0
+#define WEAK 1
+
+main ()
+{
+
+ if (!__atomic_compare_exchange_n (&v, &expected, max, STRONG , __ATOMIC_RELAXED, __ATOMIC_RELAXED))
+ abort ();
+ if (expected != 0)
+ abort ();
+
+ if (__atomic_compare_exchange_n (&v, &expected, 0, STRONG , __ATOMIC_ACQUIRE, __ATOMIC_RELAXED))
+ abort ();
+ if (expected != max)
+ abort ();
+
+ if (!__atomic_compare_exchange_n (&v, &expected, 0, STRONG , __ATOMIC_RELEASE, __ATOMIC_ACQUIRE))
+ abort ();
+ if (expected != max)
+ abort ();
+ if (v != 0)
+ abort ();
+
+ if (__atomic_compare_exchange_n (&v, &expected, desired, WEAK, __ATOMIC_ACQ_REL, __ATOMIC_ACQUIRE))
+ abort ();
+ if (expected != 0)
+ abort ();
+
+ if (!__atomic_compare_exchange_n (&v, &expected, desired, STRONG , __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST))
+ abort ();
+ if (expected != 0)
+ abort ();
+ if (v != max)
+ abort ();
+
+ /* Now test the generic version. */
+
+ v = 0;
+
+ if (!__atomic_compare_exchange (&v, &expected, &max, STRONG, __ATOMIC_RELAXED, __ATOMIC_RELAXED))
+ abort ();
+ if (expected != 0)
+ abort ();
+
+ if (__atomic_compare_exchange (&v, &expected, &zero, STRONG , __ATOMIC_ACQUIRE, __ATOMIC_RELAXED))
+ abort ();
+ if (expected != max)
+ abort ();
+
+ if (!__atomic_compare_exchange (&v, &expected, &zero, STRONG , __ATOMIC_RELEASE, __ATOMIC_ACQUIRE))
+ abort ();
+ if (expected != max)
+ abort ();
+ if (v != 0)
+ abort ();
+
+ if (__atomic_compare_exchange (&v, &expected, &desired, WEAK, __ATOMIC_ACQ_REL, __ATOMIC_ACQUIRE))
+ abort ();
+ if (expected != 0)
+ abort ();
+
+ if (!__atomic_compare_exchange (&v, &expected, &desired, STRONG , __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST))
+ abort ();
+ if (expected != 0)
+ abort ();
+ if (v != max)
+ abort ();
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/atomic-exchange-1.c b/gcc/testsuite/gcc.dg/atomic-exchange-1.c
new file mode 100644
index 00000000000..fb78cdbca54
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/atomic-exchange-1.c
@@ -0,0 +1,62 @@
+/* Test __atomic routines for existence and proper execution on 1 byte
+ values with each valid memory model. */
+/* { dg-do run } */
+/* { dg-require-effective-target sync_char_short } */
+
+/* Test the execution of the __atomic_exchange_n builtin for a char. */
+
+extern void abort(void);
+
+char v, count, ret;
+
+main ()
+{
+ v = 0;
+ count = 0;
+
+ if (__atomic_exchange_n (&v, count + 1, __ATOMIC_RELAXED) != count++)
+ abort ();
+
+ if (__atomic_exchange_n (&v, count + 1, __ATOMIC_ACQUIRE) != count++)
+ abort ();
+
+ if (__atomic_exchange_n (&v, count + 1, __ATOMIC_RELEASE) != count++)
+ abort ();
+
+ if (__atomic_exchange_n (&v, count + 1, __ATOMIC_ACQ_REL) != count++)
+ abort ();
+
+ if (__atomic_exchange_n (&v, count + 1, __ATOMIC_SEQ_CST) != count++)
+ abort ();
+
+ /* Now test the generic version. */
+
+ count++;
+
+ __atomic_exchange (&v, &count, &ret, __ATOMIC_RELAXED);
+ if (ret != count - 1 || v != count)
+ abort ();
+ count++;
+
+ __atomic_exchange (&v, &count, &ret, __ATOMIC_ACQUIRE);
+ if (ret != count - 1 || v != count)
+ abort ();
+ count++;
+
+ __atomic_exchange (&v, &count, &ret, __ATOMIC_RELEASE);
+ if (ret != count - 1 || v != count)
+ abort ();
+ count++;
+
+ __atomic_exchange (&v, &count, &ret, __ATOMIC_ACQ_REL);
+ if (ret != count - 1 || v != count)
+ abort ();
+ count++;
+
+ __atomic_exchange (&v, &count, &ret, __ATOMIC_SEQ_CST);
+ if (ret != count - 1 || v != count)
+ abort ();
+ count++;
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/atomic-exchange-2.c b/gcc/testsuite/gcc.dg/atomic-exchange-2.c
new file mode 100644
index 00000000000..153771a2cdc
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/atomic-exchange-2.c
@@ -0,0 +1,62 @@
+/* Test __atomic routines for existence and proper execution on 2 byte
+ values with each valid memory model. */
+/* { dg-do run } */
+/* { dg-require-effective-target sync_char_short } */
+
+/* Test the execution of the __atomic_X builtin for a short. */
+
+extern void abort(void);
+
+short v, count, ret;
+
+main ()
+{
+ v = 0;
+ count = 0;
+
+ if (__atomic_exchange_n (&v, count + 1, __ATOMIC_RELAXED) != count++)
+ abort ();
+
+ if (__atomic_exchange_n (&v, count + 1, __ATOMIC_ACQUIRE) != count++)
+ abort ();
+
+ if (__atomic_exchange_n (&v, count + 1, __ATOMIC_RELEASE) != count++)
+ abort ();
+
+ if (__atomic_exchange_n (&v, count + 1, __ATOMIC_ACQ_REL) != count++)
+ abort ();
+
+ if (__atomic_exchange_n (&v, count + 1, __ATOMIC_SEQ_CST) != count++)
+ abort ();
+
+ /* Now test the generic version. */
+
+ count++;
+
+ __atomic_exchange (&v, &count, &ret, __ATOMIC_RELAXED);
+ if (ret != count - 1 || v != count)
+ abort ();
+ count++;
+
+ __atomic_exchange (&v, &count, &ret, __ATOMIC_ACQUIRE);
+ if (ret != count - 1 || v != count)
+ abort ();
+ count++;
+
+ __atomic_exchange (&v, &count, &ret, __ATOMIC_RELEASE);
+ if (ret != count - 1 || v != count)
+ abort ();
+ count++;
+
+ __atomic_exchange (&v, &count, &ret, __ATOMIC_ACQ_REL);
+ if (ret != count - 1 || v != count)
+ abort ();
+ count++;
+
+ __atomic_exchange (&v, &count, &ret, __ATOMIC_SEQ_CST);
+ if (ret != count - 1 || v != count)
+ abort ();
+ count++;
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/atomic-exchange-3.c b/gcc/testsuite/gcc.dg/atomic-exchange-3.c
new file mode 100644
index 00000000000..fbf8f6b966c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/atomic-exchange-3.c
@@ -0,0 +1,62 @@
+/* Test __atomic routines for existence and proper execution on 4 byte
+ values with each valid memory model. */
+/* { dg-do run } */
+/* { dg-require-effective-target sync_int_long } */
+
+/* Test the execution of the __atomic_X builtin for an int. */
+
+extern void abort(void);
+
+int v, count, ret;
+
+main ()
+{
+ v = 0;
+ count = 0;
+
+ if (__atomic_exchange_n (&v, count + 1, __ATOMIC_RELAXED) != count++)
+ abort ();
+
+ if (__atomic_exchange_n (&v, count + 1, __ATOMIC_ACQUIRE) != count++)
+ abort ();
+
+ if (__atomic_exchange_n (&v, count + 1, __ATOMIC_RELEASE) != count++)
+ abort ();
+
+ if (__atomic_exchange_n (&v, count + 1, __ATOMIC_ACQ_REL) != count++)
+ abort ();
+
+ if (__atomic_exchange_n (&v, count + 1, __ATOMIC_SEQ_CST) != count++)
+ abort ();
+
+ /* Now test the generic version. */
+
+ count++;
+
+ __atomic_exchange (&v, &count, &ret, __ATOMIC_RELAXED);
+ if (ret != count - 1 || v != count)
+ abort ();
+ count++;
+
+ __atomic_exchange (&v, &count, &ret, __ATOMIC_ACQUIRE);
+ if (ret != count - 1 || v != count)
+ abort ();
+ count++;
+
+ __atomic_exchange (&v, &count, &ret, __ATOMIC_RELEASE);
+ if (ret != count - 1 || v != count)
+ abort ();
+ count++;
+
+ __atomic_exchange (&v, &count, &ret, __ATOMIC_ACQ_REL);
+ if (ret != count - 1 || v != count)
+ abort ();
+ count++;
+
+ __atomic_exchange (&v, &count, &ret, __ATOMIC_SEQ_CST);
+ if (ret != count - 1 || v != count)
+ abort ();
+ count++;
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/atomic-exchange-4.c b/gcc/testsuite/gcc.dg/atomic-exchange-4.c
new file mode 100644
index 00000000000..f0530fc462c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/atomic-exchange-4.c
@@ -0,0 +1,63 @@
+/* Test __atomic routines for existence and proper execution on 8 byte
+ values with each valid memory model. */
+/* { dg-do run } */
+/* { dg-require-effective-target sync_long_long } */
+/* { dg-options "" } */
+
+/* Test the execution of the __atomic_X builtin for a long_long. */
+
+extern void abort(void);
+
+long long v, count, ret;
+
+main ()
+{
+ v = 0;
+ count = 0;
+
+ if (__atomic_exchange_n (&v, count + 1, __ATOMIC_RELAXED) != count++)
+ abort ();
+
+ if (__atomic_exchange_n (&v, count + 1, __ATOMIC_ACQUIRE) != count++)
+ abort ();
+
+ if (__atomic_exchange_n (&v, count + 1, __ATOMIC_RELEASE) != count++)
+ abort ();
+
+ if (__atomic_exchange_n (&v, count + 1, __ATOMIC_ACQ_REL) != count++)
+ abort ();
+
+ if (__atomic_exchange_n (&v, count + 1, __ATOMIC_SEQ_CST) != count++)
+ abort ();
+
+ /* Now test the generic version. */
+
+ count++;
+
+ __atomic_exchange (&v, &count, &ret, __ATOMIC_RELAXED);
+ if (ret != count - 1 || v != count)
+ abort ();
+ count++;
+
+ __atomic_exchange (&v, &count, &ret, __ATOMIC_ACQUIRE);
+ if (ret != count - 1 || v != count)
+ abort ();
+ count++;
+
+ __atomic_exchange (&v, &count, &ret, __ATOMIC_RELEASE);
+ if (ret != count - 1 || v != count)
+ abort ();
+ count++;
+
+ __atomic_exchange (&v, &count, &ret, __ATOMIC_ACQ_REL);
+ if (ret != count - 1 || v != count)
+ abort ();
+ count++;
+
+ __atomic_exchange (&v, &count, &ret, __ATOMIC_SEQ_CST);
+ if (ret != count - 1 || v != count)
+ abort ();
+ count++;
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/atomic-exchange-5.c b/gcc/testsuite/gcc.dg/atomic-exchange-5.c
new file mode 100644
index 00000000000..13fd6d1b8ec
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/atomic-exchange-5.c
@@ -0,0 +1,63 @@
+/* Test __atomic routines for existence and proper execution on 16 byte
+ values with each valid memory model. */
+/* { dg-do run } */
+/* { dg-require-effective-target sync_int_128 } */
+/* { dg-options "-mcx16" { target { x86_64-*-* } } } */
+
+/* Test the execution of the __atomic_X builtin for a 16 byte value. */
+
+extern void abort(void);
+
+__int128_t v, count, ret;
+
+main ()
+{
+ v = 0;
+ count = 0;
+
+ if (__atomic_exchange_n (&v, count + 1, __ATOMIC_RELAXED) != count++)
+ abort ();
+
+ if (__atomic_exchange_n (&v, count + 1, __ATOMIC_ACQUIRE) != count++)
+ abort ();
+
+ if (__atomic_exchange_n (&v, count + 1, __ATOMIC_RELEASE) != count++)
+ abort ();
+
+ if (__atomic_exchange_n (&v, count + 1, __ATOMIC_ACQ_REL) != count++)
+ abort ();
+
+ if (__atomic_exchange_n (&v, count + 1, __ATOMIC_SEQ_CST) != count++)
+ abort ();
+
+ /* Now test the generic version. */
+
+ count++;
+
+ __atomic_exchange (&v, &count, &ret, __ATOMIC_RELAXED);
+ if (ret != count - 1 || v != count)
+ abort ();
+ count++;
+
+ __atomic_exchange (&v, &count, &ret, __ATOMIC_ACQUIRE);
+ if (ret != count - 1 || v != count)
+ abort ();
+ count++;
+
+ __atomic_exchange (&v, &count, &ret, __ATOMIC_RELEASE);
+ if (ret != count - 1 || v != count)
+ abort ();
+ count++;
+
+ __atomic_exchange (&v, &count, &ret, __ATOMIC_ACQ_REL);
+ if (ret != count - 1 || v != count)
+ abort ();
+ count++;
+
+ __atomic_exchange (&v, &count, &ret, __ATOMIC_SEQ_CST);
+ if (ret != count - 1 || v != count)
+ abort ();
+ count++;
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/atomic-fence.c b/gcc/testsuite/gcc.dg/atomic-fence.c
new file mode 100644
index 00000000000..1f6d1871a0b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/atomic-fence.c
@@ -0,0 +1,27 @@
+/* Test __atomic routines for existence and execution with each valid
+ memory model. */
+/* { dg-do run } */
+/* { dg-require-effective-target sync_char_short } */
+
+
+/* Test that __atomic_{thread,signal}_fence builtins execute. */
+
+main ()
+{
+ __atomic_thread_fence (__ATOMIC_RELAXED);
+ __atomic_thread_fence (__ATOMIC_CONSUME);
+ __atomic_thread_fence (__ATOMIC_ACQUIRE);
+ __atomic_thread_fence (__ATOMIC_RELEASE);
+ __atomic_thread_fence (__ATOMIC_ACQ_REL);
+ __atomic_thread_fence (__ATOMIC_SEQ_CST);
+
+ __atomic_signal_fence (__ATOMIC_RELAXED);
+ __atomic_signal_fence (__ATOMIC_CONSUME);
+ __atomic_signal_fence (__ATOMIC_ACQUIRE);
+ __atomic_signal_fence (__ATOMIC_RELEASE);
+ __atomic_signal_fence (__ATOMIC_ACQ_REL);
+ __atomic_signal_fence (__ATOMIC_SEQ_CST);
+
+ return 0;
+}
+
diff --git a/gcc/testsuite/gcc.dg/atomic-generic-aux.c b/gcc/testsuite/gcc.dg/atomic-generic-aux.c
new file mode 100644
index 00000000000..a6b552a5dfd
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/atomic-generic-aux.c
@@ -0,0 +1,45 @@
+/* Supply a set of generic atomic functions to test the compiler make the
+ calls properly. */
+/* { dg-do compile } */
+/* { dg-options "-w" } */
+
+/* Test that the generic builtins make calls as expected. */
+
+#include <stdlib.h>
+#include <stdbool.h>
+#include <string.h>
+
+void
+__atomic_exchange (size_t size, void *obj, void *val, void *ret, int model)
+{
+ /* Copy old value into *ret. */
+ memcpy (ret, obj, size);
+ /* Copy val into object. */
+ memcpy (obj, val, size);
+}
+
+
+bool
+__atomic_compare_exchange (size_t size, void *obj, void *expected,
+ void *desired, int model1, int model2)
+{
+ if (!memcmp (obj, expected, size))
+ {
+ memcpy (obj, desired, size);
+ return true;
+ }
+ memcpy (expected, obj, size);
+ return false;
+}
+
+
+void __atomic_load (size_t size, void *obj, void *ret, int model)
+{
+ memcpy (ret, obj, size);
+}
+
+
+void __atomic_store (size_t size, void *obj, void *val, int model)
+{
+ memcpy (obj, val, size);
+}
diff --git a/gcc/testsuite/gcc.dg/atomic-generic.c b/gcc/testsuite/gcc.dg/atomic-generic.c
new file mode 100644
index 00000000000..8a5528c3653
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/atomic-generic.c
@@ -0,0 +1,56 @@
+/* Test generic __atomic routines for proper function calling.
+ memory model. */
+/* { dg-options "-w" } */
+/* { dg-do run } */
+/* { dg-additional-sources "atomic-generic-aux.c" } */
+
+/* Test that the generioc atomic builtins execute as expected..
+ sync-mem-generic-aux.c supplies a functional external entry point for
+ the 4 generic functions. */
+
+#include <stdlib.h>
+#include <stdbool.h>
+
+extern void abort();
+
+typedef struct test {
+ int array[10];
+} test_struct;
+
+test_struct zero = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
+test_struct ones = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 };
+test_struct a,b;
+
+int size = sizeof (test_struct);
+/* Test for consistency on sizes 1, 2, 4, 8, 16 and 32. */
+main ()
+{
+ test_struct c;
+
+ __atomic_store (&a, &zero, __ATOMIC_RELAXED);
+ if (memcmp (&a, &zero, size))
+ abort ();
+
+ __atomic_exchange (&a, &ones, &c, __ATOMIC_SEQ_CST);
+ if (memcmp (&c, &zero, size))
+ abort ();
+ if (memcmp (&a, &ones, size))
+ abort ();
+
+ __atomic_load (&a, &b, __ATOMIC_RELAXED);
+ if (memcmp (&b, &ones, size))
+ abort ();
+
+ if (!__atomic_compare_exchange (&a, &b, &zero, false, __ATOMIC_RELAXED, __ATOMIC_RELAXED))
+ abort();
+ if (memcmp (&a, &zero, size))
+ abort ();
+
+ if (__atomic_compare_exchange (&a, &b, &ones, false, __ATOMIC_RELAXED, __ATOMIC_RELAXED))
+ abort();
+ if (memcmp (&b, &zero, size))
+ abort ();
+
+ return 0;
+}
+
diff --git a/gcc/testsuite/gcc.dg/atomic-invalid.c b/gcc/testsuite/gcc.dg/atomic-invalid.c
new file mode 100644
index 00000000000..2b73c91e7c0
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/atomic-invalid.c
@@ -0,0 +1,29 @@
+/* Test __atomic routines for invalid memory model errors. This only needs
+ to be tested on a single size. */
+/* { dg-do compile } */
+/* { dg-require-effective-target sync_int_long } */
+
+#include <stddef.h>
+
+int i, e, b;
+size_t s;
+
+main ()
+{
+ __atomic_compare_exchange_n (&i, &e, 1, 0, __ATOMIC_RELAXED, __ATOMIC_SEQ_CST); /* { dg-error "failure memory model cannot be stronger" } */
+ __atomic_compare_exchange_n (&i, &e, 1, 0, __ATOMIC_SEQ_CST, __ATOMIC_RELEASE); /* { dg-error "invalid failure memory" } */
+ __atomic_compare_exchange_n (&i, &e, 1, 1, __ATOMIC_SEQ_CST, __ATOMIC_ACQ_REL); /* { dg-error "invalid failure memory" } */
+
+ __atomic_exchange_n (&i, 1, __ATOMIC_CONSUME); /* { dg-error "invalid memory model" } */
+
+ __atomic_load_n (&i, __ATOMIC_RELEASE); /* { dg-error "invalid memory model" } */
+ __atomic_load_n (&i, __ATOMIC_ACQ_REL); /* { dg-error "invalid memory model" } */
+
+ __atomic_store_n (&i, 1, __ATOMIC_ACQUIRE); /* { dg-error "invalid memory model" } */
+ __atomic_store_n (&i, 1, __ATOMIC_CONSUME); /* { dg-error "invalid memory model" } */
+ __atomic_store_n (&i, 1, __ATOMIC_ACQ_REL); /* { dg-error "invalid memory model" } */
+
+ i = __atomic_always_lock_free (s, NULL); /* { dg-error "non-constant argument" } */
+
+ __atomic_load_n (&i, 44); /* { dg-warning "invalid memory model" } */
+}
diff --git a/gcc/testsuite/gcc.dg/atomic-load-1.c b/gcc/testsuite/gcc.dg/atomic-load-1.c
new file mode 100644
index 00000000000..928f9b0f10b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/atomic-load-1.c
@@ -0,0 +1,66 @@
+/* Test __atomic routines for existence and proper execution on 1 byte
+ values with each valid memory model. */
+/* { dg-do run } */
+/* { dg-require-effective-target sync_char_short } */
+
+
+/* Test the execution of the __atomic_load_n builtin for a char. */
+
+extern void abort(void);
+
+char v, count;
+
+main ()
+{
+ v = 0;
+ count = 0;
+
+ if (__atomic_load_n (&v, __ATOMIC_RELAXED) != count++)
+ abort();
+ else
+ v++;
+
+ if (__atomic_load_n (&v, __ATOMIC_ACQUIRE) != count++)
+ abort();
+ else
+ v++;
+
+ if (__atomic_load_n (&v, __ATOMIC_CONSUME) != count++)
+ abort();
+ else
+ v++;
+
+ if (__atomic_load_n (&v, __ATOMIC_SEQ_CST) != count++)
+ abort();
+ else
+ v++;
+
+ /* Now test the generic variants. */
+
+ __atomic_load (&v, &count, __ATOMIC_RELAXED);
+ if (count != v)
+ abort();
+ else
+ v++;
+
+ __atomic_load (&v, &count, __ATOMIC_ACQUIRE);
+ if (count != v)
+ abort();
+ else
+ v++;
+
+ __atomic_load (&v, &count, __ATOMIC_CONSUME);
+ if (count != v)
+ abort();
+ else
+ v++;
+
+ __atomic_load (&v, &count, __ATOMIC_SEQ_CST);
+ if (count != v)
+ abort();
+ else
+ v++;
+
+ return 0;
+}
+
diff --git a/gcc/testsuite/gcc.dg/atomic-load-2.c b/gcc/testsuite/gcc.dg/atomic-load-2.c
new file mode 100644
index 00000000000..3d1df1cfffa
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/atomic-load-2.c
@@ -0,0 +1,68 @@
+/* Test __atomic routines for existence and proper execution on 2 byte
+ values with each valid memory model. */
+/* { dg-do run } */
+/* { dg-require-effective-target sync_char_short } */
+
+
+/* Test the execution of the __atomic_load_n builtin for a short. */
+
+extern void abort(void);
+
+short v, count;
+
+
+main ()
+{
+ v = 0;
+ count = 0;
+
+ if (__atomic_load_n (&v, __ATOMIC_RELAXED) != count++)
+ abort();
+ else
+ v++;
+
+ if (__atomic_load_n (&v, __ATOMIC_ACQUIRE) != count++)
+ abort();
+ else
+ v++;
+
+ if (__atomic_load_n (&v, __ATOMIC_CONSUME) != count++)
+ abort();
+ else
+ v++;
+
+ if (__atomic_load_n (&v, __ATOMIC_SEQ_CST) != count++)
+ abort();
+ else
+ v++;
+
+ /* Now test the generic variants. */
+
+ __atomic_load (&v, &count, __ATOMIC_RELAXED);
+ if (count != v)
+ abort();
+ else
+ v++;
+
+ __atomic_load (&v, &count, __ATOMIC_ACQUIRE);
+ if (count != v)
+ abort();
+ else
+ v++;
+
+ __atomic_load (&v, &count, __ATOMIC_CONSUME);
+ if (count != v)
+ abort();
+ else
+ v++;
+
+ __atomic_load (&v, &count, __ATOMIC_SEQ_CST);
+ if (count != v)
+ abort();
+ else
+ v++;
+
+
+ return 0;
+}
+
diff --git a/gcc/testsuite/gcc.dg/atomic-load-3.c b/gcc/testsuite/gcc.dg/atomic-load-3.c
new file mode 100644
index 00000000000..ec238be9e51
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/atomic-load-3.c
@@ -0,0 +1,65 @@
+/* Test __atomic routines for existence and proper execution on 4 byte
+ values with each valid memory model. */
+/* { dg-do run } */
+/* { dg-require-effective-target sync_int_long } */
+
+extern void abort(void);
+
+int v, count;
+
+
+main ()
+{
+ v = 0;
+ count = 0;
+
+ if (__atomic_load_n (&v, __ATOMIC_RELAXED) != count++)
+ abort();
+ else
+ v++;
+
+ if (__atomic_load_n (&v, __ATOMIC_ACQUIRE) != count++)
+ abort();
+ else
+ v++;
+
+ if (__atomic_load_n (&v, __ATOMIC_CONSUME) != count++)
+ abort();
+ else
+ v++;
+
+ if (__atomic_load_n (&v, __ATOMIC_SEQ_CST) != count++)
+ abort();
+ else
+ v++;
+
+ /* Now test the generic variants. */
+
+ __atomic_load (&v, &count, __ATOMIC_RELAXED);
+ if (count != v)
+ abort();
+ else
+ v++;
+
+ __atomic_load (&v, &count, __ATOMIC_ACQUIRE);
+ if (count != v)
+ abort();
+ else
+ v++;
+
+ __atomic_load (&v, &count, __ATOMIC_CONSUME);
+ if (count != v)
+ abort();
+ else
+ v++;
+
+ __atomic_load (&v, &count, __ATOMIC_SEQ_CST);
+ if (count != v)
+ abort();
+ else
+ v++;
+
+
+ return 0;
+}
+
diff --git a/gcc/testsuite/gcc.dg/atomic-load-4.c b/gcc/testsuite/gcc.dg/atomic-load-4.c
new file mode 100644
index 00000000000..5cb7659da70
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/atomic-load-4.c
@@ -0,0 +1,65 @@
+/* Test __atomic routines for existence and proper execution on 8 byte
+ values with each valid memory model. */
+/* { dg-do run } */
+/* { dg-require-effective-target sync_long_long } */
+/* { dg-options "" } */
+
+extern void abort(void);
+
+long long v, count;
+
+main ()
+{
+ v = 0;
+ count = 0;
+
+ if (__atomic_load_n (&v, __ATOMIC_RELAXED) != count++)
+ abort();
+ else
+ v++;
+
+ if (__atomic_load_n (&v, __ATOMIC_ACQUIRE) != count++)
+ abort();
+ else
+ v++;
+
+ if (__atomic_load_n (&v, __ATOMIC_CONSUME) != count++)
+ abort();
+ else
+ v++;
+
+ if (__atomic_load_n (&v, __ATOMIC_SEQ_CST) != count++)
+ abort();
+ else
+ v++;
+
+ /* Now test the generic variants. */
+
+ __atomic_load (&v, &count, __ATOMIC_RELAXED);
+ if (count != v)
+ abort();
+ else
+ v++;
+
+ __atomic_load (&v, &count, __ATOMIC_ACQUIRE);
+ if (count != v)
+ abort();
+ else
+ v++;
+
+ __atomic_load (&v, &count, __ATOMIC_CONSUME);
+ if (count != v)
+ abort();
+ else
+ v++;
+
+ __atomic_load (&v, &count, __ATOMIC_SEQ_CST);
+ if (count != v)
+ abort();
+ else
+ v++;
+
+
+ return 0;
+}
+
diff --git a/gcc/testsuite/gcc.dg/atomic-load-5.c b/gcc/testsuite/gcc.dg/atomic-load-5.c
new file mode 100644
index 00000000000..2991e4d6c7a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/atomic-load-5.c
@@ -0,0 +1,65 @@
+/* Test __atomic routines for existence and proper execution on 16 byte
+ values with each valid memory model. */
+/* { dg-do run } */
+/* { dg-require-effective-target sync_int_128 } */
+/* { dg-options "-mcx16" { target { x86_64-*-* } } } */
+
+extern void abort(void);
+
+__int128_t v, count;
+
+main ()
+{
+ v = 0;
+ count = 0;
+
+ if (__atomic_load_n (&v, __ATOMIC_RELAXED) != count++)
+ abort();
+ else
+ v++;
+
+ if (__atomic_load_n (&v, __ATOMIC_ACQUIRE) != count++)
+ abort();
+ else
+ v++;
+
+ if (__atomic_load_n (&v, __ATOMIC_CONSUME) != count++)
+ abort();
+ else
+ v++;
+
+ if (__atomic_load_n (&v, __ATOMIC_SEQ_CST) != count++)
+ abort();
+ else
+ v++;
+
+ /* Now test the generic variants. */
+
+ __atomic_load (&v, &count, __ATOMIC_RELAXED);
+ if (count != v)
+ abort();
+ else
+ v++;
+
+ __atomic_load (&v, &count, __ATOMIC_ACQUIRE);
+ if (count != v)
+ abort();
+ else
+ v++;
+
+ __atomic_load (&v, &count, __ATOMIC_CONSUME);
+ if (count != v)
+ abort();
+ else
+ v++;
+
+ __atomic_load (&v, &count, __ATOMIC_SEQ_CST);
+ if (count != v)
+ abort();
+ else
+ v++;
+
+
+ return 0;
+}
+
diff --git a/gcc/testsuite/gcc.dg/atomic-lockfree-aux.c b/gcc/testsuite/gcc.dg/atomic-lockfree-aux.c
new file mode 100644
index 00000000000..0ea872c302b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/atomic-lockfree-aux.c
@@ -0,0 +1,17 @@
+/* Test supply a __atomic_is_lock_free routine for lock-free tests. */
+/* Just compile it on its own. */
+/* { dg-do compile } */
+/* { dg-options "-w" } */
+
+/* Test that __atomic_{is,always}_lock_free builtins execute. */
+
+#include <stdlib.h>
+
+/* Supply a builtin external function which returns a non-standard value so
+ it can be detected that it was called. */
+int
+__atomic_is_lock_free (size_t s, void *p)
+{
+ return 2;
+}
+
diff --git a/gcc/testsuite/gcc.dg/atomic-lockfree.c b/gcc/testsuite/gcc.dg/atomic-lockfree.c
new file mode 100644
index 00000000000..225428223ea
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/atomic-lockfree.c
@@ -0,0 +1,120 @@
+/* Test __atomic routines for existence and execution with each valid
+ memory model. */
+/* { dg-options "-w" } */
+/* { dg-do run } */
+/* { dg-additional-sources "atomic-lockfree-aux.c" } */
+
+/* Test that __atomic_{is,always}_lock_free builtins execute.
+ sync-mem-lockfree-aux.c supplies and external entry point for
+ __atomic_is_lock_free which always returns a 2. We can detect the
+ external routine was called if 2 is returned since that is not a valid
+ result normally. */
+
+#include <stdlib.h>
+
+extern void abort();
+
+int r1, r2;
+
+/* Test for consistency on sizes 1, 2, 4, 8, 16 and 32. */
+main ()
+{
+
+ r1 = __atomic_always_lock_free (sizeof(char), 0);
+ r2 = __atomic_is_lock_free (sizeof(char), 0);
+ /* If always lock free, then is_lock_free must also be true. */
+ if (r1)
+ {
+ if (r2 != 1)
+ abort ();
+ }
+ else
+ {
+ /* If it is not lock free, then the external routine must be called. */
+ if (r2 != 2)
+ abort ();
+ }
+
+ r1 = __atomic_always_lock_free (2, 0);
+ r2 = __atomic_is_lock_free (2, 0);
+ /* If always lock free, then is_lock_free must also be true. */
+ if (r1)
+ {
+ if (r2 != 1)
+ abort ();
+ }
+ else
+ {
+ /* If it is not lock free, then the external routine must be called. */
+ if (r2 != 2)
+ abort ();
+ }
+
+
+ r1 = __atomic_always_lock_free (4, 0);
+ r2 = __atomic_is_lock_free (4, 0); /* Try passing in a variable. */
+ /* If always lock free, then is_lock_free must also be true. */
+ if (r1)
+ {
+ if (r2 != 1)
+ abort ();
+ }
+ else
+ {
+ /* If it is not lock free, then the external routine must be called. */
+ if (r2 != 2)
+ abort ();
+ }
+
+
+ r1 = __atomic_always_lock_free (8, 0);
+ r2 = __atomic_is_lock_free (8, 0);
+ /* If always lock free, then is_lock_free must also be true. */
+ if (r1)
+ {
+ if (r2 != 1)
+ abort ();
+ }
+ else
+ {
+ /* If it is not lock free, then the external routine must be called. */
+ if (r2 != 2)
+ abort ();
+ }
+
+
+ r1 = __atomic_always_lock_free (16, 0);
+ r2 = __atomic_is_lock_free (16, 0);
+ /* If always lock free, then is_lock_free must also be true. */
+ if (r1)
+ {
+ if (r2 != 1)
+ abort ();
+ }
+ else
+ {
+ /* If it is not lock free, then the external routine must be called. */
+ if (r2 != 2)
+ abort ();
+ }
+
+
+ r1 = __atomic_always_lock_free (32, 0);
+ r2 = __atomic_is_lock_free (32, 0);
+ /* If always lock free, then is_lock_free must also be true. */
+ if (r1)
+ {
+ if (r2 != 1)
+ abort ();
+ }
+ else
+ {
+ /* If it is not lock free, then the external routine must be called. */
+ if (r2 != 2)
+ abort ();
+ }
+
+
+ return 0;
+}
+
diff --git a/gcc/testsuite/gcc.dg/atomic-noinline-aux.c b/gcc/testsuite/gcc.dg/atomic-noinline-aux.c
new file mode 100644
index 00000000000..b92fcfcd60f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/atomic-noinline-aux.c
@@ -0,0 +1,51 @@
+/* Supply a set of generic atomic functions to test the compiler make the
+ calls properly. */
+/* { dg-do compile } */
+/* { dg-options "-w" } */
+
+/* Test that the generic builtins make calls as expected. This file provides
+ the exact entry points the test file will require. All these routines
+ simply set the first parameter to 1, and the caller will test for that. */
+
+#include <stdlib.h>
+#include <stdbool.h>
+#include <string.h>
+
+
+char
+__atomic_exchange_1 (char *p, char t, int i)
+{
+ *p = 1;
+}
+
+short
+__atomic_load_2 (short *p, int i)
+{
+ *p = 1;
+}
+
+void
+__atomic_store_1 (char *p, char v, int i)
+{
+ *p = 1;
+}
+
+int __atomic_compare_exchange_2 (short *p, short *a, short b, int x, int y, int z)
+{
+ *p = 1;
+}
+
+char __atomic_fetch_add_1 (char *p, char v, int i)
+{
+ *p = 1;
+}
+
+short __atomic_fetch_add_2 (short *p, short v, short i)
+{
+ *p = 1;
+}
+
+int __atomic_is_lock_free (int i, void *p)
+{
+ return 10;
+}
diff --git a/gcc/testsuite/gcc.dg/atomic-noinline.c b/gcc/testsuite/gcc.dg/atomic-noinline.c
new file mode 100644
index 00000000000..06a93e0058e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/atomic-noinline.c
@@ -0,0 +1,56 @@
+/* Test generic __atomic routines for proper function calling.
+ memory model. */
+/* { dg-options "-w -fno-inline-atomics" } */
+/* { dg-do run } */
+/* { dg-additional-sources "atomic-noinline-aux.c" } */
+
+/* Test that -fno-inline-atomics works as expected.
+ atomic-generic-aux provide the expected routines which simply set the
+ value of the first parameter to */
+
+#include <stdlib.h>
+#include <stdbool.h>
+
+extern void abort();
+
+short as,bs,cs;
+char ac,bc,cc;
+
+main ()
+{
+
+ ac = __atomic_exchange_n (&bc, cc, __ATOMIC_RELAXED);
+ if (bc != 1)
+ abort ();
+
+ as = __atomic_load_n (&bs, __ATOMIC_SEQ_CST);
+ if (bs != 1)
+ abort ();
+
+ __atomic_store_n (&ac, bc, __ATOMIC_RELAXED);
+ if (ac != 1)
+ abort ();
+
+ __atomic_compare_exchange_n (&as, &bs, cs, 0, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST);
+ if (as != 1)
+ abort ();
+
+ ac = __atomic_fetch_add (&cc, 15, __ATOMIC_SEQ_CST);
+ if (cc != 1)
+ abort ();
+
+ /* This should be translated to __atomic_fetch_add for the library */
+ as = __atomic_add_fetch (&cs, 10, __ATOMIC_RELAXED);
+
+ if (cs != 1)
+ abort ();
+
+ /* The fake external function should return 10. */
+ if (__atomic_is_lock_free (4, 0) != 10)
+ abort ();
+
+ return 0;
+}
+
+
+
diff --git a/gcc/testsuite/gcc.dg/atomic-op-1.c b/gcc/testsuite/gcc.dg/atomic-op-1.c
new file mode 100644
index 00000000000..bc1716f7799
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/atomic-op-1.c
@@ -0,0 +1,554 @@
+/* Test __atomic routines for existence and proper execution on 1 byte
+ values with each valid memory model. */
+/* { dg-do run } */
+/* { dg-require-effective-target sync_char_short } */
+
+/* Test the execution of the __atomic_*OP builtin routines for a char. */
+
+extern void abort(void);
+
+char v, count, res;
+const char init = ~0;
+
+/* The fetch_op routines return the original value before the operation. */
+
+void
+test_fetch_add ()
+{
+ v = 0;
+ count = 1;
+
+ if (__atomic_fetch_add (&v, count, __ATOMIC_RELAXED) != 0)
+ abort ();
+
+ if (__atomic_fetch_add (&v, 1, __ATOMIC_CONSUME) != 1)
+ abort ();
+
+ if (__atomic_fetch_add (&v, count, __ATOMIC_ACQUIRE) != 2)
+ abort ();
+
+ if (__atomic_fetch_add (&v, 1, __ATOMIC_RELEASE) != 3)
+ abort ();
+
+ if (__atomic_fetch_add (&v, count, __ATOMIC_ACQ_REL) != 4)
+ abort ();
+
+ if (__atomic_fetch_add (&v, 1, __ATOMIC_SEQ_CST) != 5)
+ abort ();
+}
+
+
+void
+test_fetch_sub()
+{
+ v = res = 20;
+ count = 0;
+
+ if (__atomic_fetch_sub (&v, count + 1, __ATOMIC_RELAXED) != res--)
+ abort ();
+
+ if (__atomic_fetch_sub (&v, 1, __ATOMIC_CONSUME) != res--)
+ abort ();
+
+ if (__atomic_fetch_sub (&v, count + 1, __ATOMIC_ACQUIRE) != res--)
+ abort ();
+
+ if (__atomic_fetch_sub (&v, 1, __ATOMIC_RELEASE) != res--)
+ abort ();
+
+ if (__atomic_fetch_sub (&v, count + 1, __ATOMIC_ACQ_REL) != res--)
+ abort ();
+
+ if (__atomic_fetch_sub (&v, 1, __ATOMIC_SEQ_CST) != res--)
+ abort ();
+}
+
+void
+test_fetch_and ()
+{
+ v = init;
+
+ if (__atomic_fetch_and (&v, 0, __ATOMIC_RELAXED) != init)
+ abort ();
+
+ if (__atomic_fetch_and (&v, init, __ATOMIC_CONSUME) != 0)
+ abort ();
+
+ if (__atomic_fetch_and (&v, 0, __ATOMIC_ACQUIRE) != 0)
+ abort ();
+
+ v = ~v;
+ if (__atomic_fetch_and (&v, init, __ATOMIC_RELEASE) != init)
+ abort ();
+
+ if (__atomic_fetch_and (&v, 0, __ATOMIC_ACQ_REL) != init)
+ abort ();
+
+ if (__atomic_fetch_and (&v, 0, __ATOMIC_SEQ_CST) != 0)
+ abort ();
+}
+
+void
+test_fetch_nand ()
+{
+ v = init;
+
+ if (__atomic_fetch_nand (&v, 0, __ATOMIC_RELAXED) != init)
+ abort ();
+
+ if (__atomic_fetch_nand (&v, init, __ATOMIC_CONSUME) != init)
+ abort ();
+
+ if (__atomic_fetch_nand (&v, 0, __ATOMIC_ACQUIRE) != 0 )
+ abort ();
+
+ if (__atomic_fetch_nand (&v, init, __ATOMIC_RELEASE) != init)
+ abort ();
+
+ if (__atomic_fetch_nand (&v, init, __ATOMIC_ACQ_REL) != 0)
+ abort ();
+
+ if (__atomic_fetch_nand (&v, 0, __ATOMIC_SEQ_CST) != init)
+ abort ();
+}
+
+void
+test_fetch_xor ()
+{
+ v = init;
+ count = 0;
+
+ if (__atomic_fetch_xor (&v, count, __ATOMIC_RELAXED) != init)
+ abort ();
+
+ if (__atomic_fetch_xor (&v, ~count, __ATOMIC_CONSUME) != init)
+ abort ();
+
+ if (__atomic_fetch_xor (&v, 0, __ATOMIC_ACQUIRE) != 0)
+ abort ();
+
+ if (__atomic_fetch_xor (&v, ~count, __ATOMIC_RELEASE) != 0)
+ abort ();
+
+ if (__atomic_fetch_xor (&v, 0, __ATOMIC_ACQ_REL) != init)
+ abort ();
+
+ if (__atomic_fetch_xor (&v, ~count, __ATOMIC_SEQ_CST) != init)
+ abort ();
+}
+
+void
+test_fetch_or ()
+{
+ v = 0;
+ count = 1;
+
+ if (__atomic_fetch_or (&v, count, __ATOMIC_RELAXED) != 0)
+ abort ();
+
+ count *= 2;
+ if (__atomic_fetch_or (&v, 2, __ATOMIC_CONSUME) != 1)
+ abort ();
+
+ count *= 2;
+ if (__atomic_fetch_or (&v, count, __ATOMIC_ACQUIRE) != 3)
+ abort ();
+
+ count *= 2;
+ if (__atomic_fetch_or (&v, 8, __ATOMIC_RELEASE) != 7)
+ abort ();
+
+ count *= 2;
+ if (__atomic_fetch_or (&v, count, __ATOMIC_ACQ_REL) != 15)
+ abort ();
+
+ count *= 2;
+ if (__atomic_fetch_or (&v, count, __ATOMIC_SEQ_CST) != 31)
+ abort ();
+}
+
+/* The OP_fetch routines return the new value after the operation. */
+
+void
+test_add_fetch ()
+{
+ v = 0;
+ count = 1;
+
+ if (__atomic_add_fetch (&v, count, __ATOMIC_RELAXED) != 1)
+ abort ();
+
+ if (__atomic_add_fetch (&v, 1, __ATOMIC_CONSUME) != 2)
+ abort ();
+
+ if (__atomic_add_fetch (&v, count, __ATOMIC_ACQUIRE) != 3)
+ abort ();
+
+ if (__atomic_add_fetch (&v, 1, __ATOMIC_RELEASE) != 4)
+ abort ();
+
+ if (__atomic_add_fetch (&v, count, __ATOMIC_ACQ_REL) != 5)
+ abort ();
+
+ if (__atomic_add_fetch (&v, count, __ATOMIC_SEQ_CST) != 6)
+ abort ();
+}
+
+
+void
+test_sub_fetch ()
+{
+ v = res = 20;
+ count = 0;
+
+ if (__atomic_sub_fetch (&v, count + 1, __ATOMIC_RELAXED) != --res)
+ abort ();
+
+ if (__atomic_sub_fetch (&v, 1, __ATOMIC_CONSUME) != --res)
+ abort ();
+
+ if (__atomic_sub_fetch (&v, count + 1, __ATOMIC_ACQUIRE) != --res)
+ abort ();
+
+ if (__atomic_sub_fetch (&v, 1, __ATOMIC_RELEASE) != --res)
+ abort ();
+
+ if (__atomic_sub_fetch (&v, count + 1, __ATOMIC_ACQ_REL) != --res)
+ abort ();
+
+ if (__atomic_sub_fetch (&v, count + 1, __ATOMIC_SEQ_CST) != --res)
+ abort ();
+}
+
+void
+test_and_fetch ()
+{
+ v = init;
+
+ if (__atomic_and_fetch (&v, 0, __ATOMIC_RELAXED) != 0)
+ abort ();
+
+ v = init;
+ if (__atomic_and_fetch (&v, init, __ATOMIC_CONSUME) != init)
+ abort ();
+
+ if (__atomic_and_fetch (&v, 0, __ATOMIC_ACQUIRE) != 0)
+ abort ();
+
+ v = ~v;
+ if (__atomic_and_fetch (&v, init, __ATOMIC_RELEASE) != init)
+ abort ();
+
+ if (__atomic_and_fetch (&v, 0, __ATOMIC_ACQ_REL) != 0)
+ abort ();
+
+ v = ~v;
+ if (__atomic_and_fetch (&v, 0, __ATOMIC_SEQ_CST) != 0)
+ abort ();
+}
+
+void
+test_nand_fetch ()
+{
+ v = init;
+
+ if (__atomic_nand_fetch (&v, 0, __ATOMIC_RELAXED) != init)
+ abort ();
+
+ if (__atomic_nand_fetch (&v, init, __ATOMIC_CONSUME) != 0)
+ abort ();
+
+ if (__atomic_nand_fetch (&v, 0, __ATOMIC_ACQUIRE) != init)
+ abort ();
+
+ if (__atomic_nand_fetch (&v, init, __ATOMIC_RELEASE) != 0)
+ abort ();
+
+ if (__atomic_nand_fetch (&v, init, __ATOMIC_ACQ_REL) != init)
+ abort ();
+
+ if (__atomic_nand_fetch (&v, 0, __ATOMIC_SEQ_CST) != init)
+ abort ();
+}
+
+
+
+void
+test_xor_fetch ()
+{
+ v = init;
+ count = 0;
+
+ if (__atomic_xor_fetch (&v, count, __ATOMIC_RELAXED) != init)
+ abort ();
+
+ if (__atomic_xor_fetch (&v, ~count, __ATOMIC_CONSUME) != 0)
+ abort ();
+
+ if (__atomic_xor_fetch (&v, 0, __ATOMIC_ACQUIRE) != 0)
+ abort ();
+
+ if (__atomic_xor_fetch (&v, ~count, __ATOMIC_RELEASE) != init)
+ abort ();
+
+ if (__atomic_xor_fetch (&v, 0, __ATOMIC_ACQ_REL) != init)
+ abort ();
+
+ if (__atomic_xor_fetch (&v, ~count, __ATOMIC_SEQ_CST) != 0)
+ abort ();
+}
+
+void
+test_or_fetch ()
+{
+ v = 0;
+ count = 1;
+
+ if (__atomic_or_fetch (&v, count, __ATOMIC_RELAXED) != 1)
+ abort ();
+
+ count *= 2;
+ if (__atomic_or_fetch (&v, 2, __ATOMIC_CONSUME) != 3)
+ abort ();
+
+ count *= 2;
+ if (__atomic_or_fetch (&v, count, __ATOMIC_ACQUIRE) != 7)
+ abort ();
+
+ count *= 2;
+ if (__atomic_or_fetch (&v, 8, __ATOMIC_RELEASE) != 15)
+ abort ();
+
+ count *= 2;
+ if (__atomic_or_fetch (&v, count, __ATOMIC_ACQ_REL) != 31)
+ abort ();
+
+ count *= 2;
+ if (__atomic_or_fetch (&v, count, __ATOMIC_SEQ_CST) != 63)
+ abort ();
+}
+
+
+/* Test the OP routines with a result which isn't used. Use both variations
+ within each function. */
+
+void
+test_add ()
+{
+ v = 0;
+ count = 1;
+
+ __atomic_add_fetch (&v, count, __ATOMIC_RELAXED);
+ if (v != 1)
+ abort ();
+
+ __atomic_fetch_add (&v, count, __ATOMIC_CONSUME);
+ if (v != 2)
+ abort ();
+
+ __atomic_add_fetch (&v, 1 , __ATOMIC_ACQUIRE);
+ if (v != 3)
+ abort ();
+
+ __atomic_fetch_add (&v, 1, __ATOMIC_RELEASE);
+ if (v != 4)
+ abort ();
+
+ __atomic_add_fetch (&v, count, __ATOMIC_ACQ_REL);
+ if (v != 5)
+ abort ();
+
+ __atomic_fetch_add (&v, count, __ATOMIC_SEQ_CST);
+ if (v != 6)
+ abort ();
+}
+
+
+void
+test_sub()
+{
+ v = res = 20;
+ count = 0;
+
+ __atomic_sub_fetch (&v, count + 1, __ATOMIC_RELAXED);
+ if (v != --res)
+ abort ();
+
+ __atomic_fetch_sub (&v, count + 1, __ATOMIC_CONSUME);
+ if (v != --res)
+ abort ();
+
+ __atomic_sub_fetch (&v, 1, __ATOMIC_ACQUIRE);
+ if (v != --res)
+ abort ();
+
+ __atomic_fetch_sub (&v, 1, __ATOMIC_RELEASE);
+ if (v != --res)
+ abort ();
+
+ __atomic_sub_fetch (&v, count + 1, __ATOMIC_ACQ_REL);
+ if (v != --res)
+ abort ();
+
+ __atomic_fetch_sub (&v, count + 1, __ATOMIC_SEQ_CST);
+ if (v != --res)
+ abort ();
+}
+
+void
+test_and ()
+{
+ v = init;
+
+ __atomic_and_fetch (&v, 0, __ATOMIC_RELAXED);
+ if (v != 0)
+ abort ();
+
+ v = init;
+ __atomic_fetch_and (&v, init, __ATOMIC_CONSUME);
+ if (v != init)
+ abort ();
+
+ __atomic_and_fetch (&v, 0, __ATOMIC_ACQUIRE);
+ if (v != 0)
+ abort ();
+
+ v = ~v;
+ __atomic_fetch_and (&v, init, __ATOMIC_RELEASE);
+ if (v != init)
+ abort ();
+
+ __atomic_and_fetch (&v, 0, __ATOMIC_ACQ_REL);
+ if (v != 0)
+ abort ();
+
+ v = ~v;
+ __atomic_fetch_and (&v, 0, __ATOMIC_SEQ_CST);
+ if (v != 0)
+ abort ();
+}
+
+void
+test_nand ()
+{
+ v = init;
+
+ __atomic_fetch_nand (&v, 0, __ATOMIC_RELAXED);
+ if (v != init)
+ abort ();
+
+ __atomic_fetch_nand (&v, init, __ATOMIC_CONSUME);
+ if (v != 0)
+ abort ();
+
+ __atomic_nand_fetch (&v, 0, __ATOMIC_ACQUIRE);
+ if (v != init)
+ abort ();
+
+ __atomic_nand_fetch (&v, init, __ATOMIC_RELEASE);
+ if (v != 0)
+ abort ();
+
+ __atomic_fetch_nand (&v, init, __ATOMIC_ACQ_REL);
+ if (v != init)
+ abort ();
+
+ __atomic_nand_fetch (&v, 0, __ATOMIC_SEQ_CST);
+ if (v != init)
+ abort ();
+}
+
+
+
+void
+test_xor ()
+{
+ v = init;
+ count = 0;
+
+ __atomic_xor_fetch (&v, count, __ATOMIC_RELAXED);
+ if (v != init)
+ abort ();
+
+ __atomic_fetch_xor (&v, ~count, __ATOMIC_CONSUME);
+ if (v != 0)
+ abort ();
+
+ __atomic_xor_fetch (&v, 0, __ATOMIC_ACQUIRE);
+ if (v != 0)
+ abort ();
+
+ __atomic_fetch_xor (&v, ~count, __ATOMIC_RELEASE);
+ if (v != init)
+ abort ();
+
+ __atomic_fetch_xor (&v, 0, __ATOMIC_ACQ_REL);
+ if (v != init)
+ abort ();
+
+ __atomic_xor_fetch (&v, ~count, __ATOMIC_SEQ_CST);
+ if (v != 0)
+ abort ();
+}
+
+void
+test_or ()
+{
+ v = 0;
+ count = 1;
+
+ __atomic_or_fetch (&v, count, __ATOMIC_RELAXED);
+ if (v != 1)
+ abort ();
+
+ count *= 2;
+ __atomic_fetch_or (&v, count, __ATOMIC_CONSUME);
+ if (v != 3)
+ abort ();
+
+ count *= 2;
+ __atomic_or_fetch (&v, 4, __ATOMIC_ACQUIRE);
+ if (v != 7)
+ abort ();
+
+ count *= 2;
+ __atomic_fetch_or (&v, 8, __ATOMIC_RELEASE);
+ if (v != 15)
+ abort ();
+
+ count *= 2;
+ __atomic_or_fetch (&v, count, __ATOMIC_ACQ_REL);
+ if (v != 31)
+ abort ();
+
+ count *= 2;
+ __atomic_fetch_or (&v, count, __ATOMIC_SEQ_CST);
+ if (v != 63)
+ abort ();
+}
+
+main ()
+{
+ test_fetch_add ();
+ test_fetch_sub ();
+ test_fetch_and ();
+ test_fetch_nand ();
+ test_fetch_xor ();
+ test_fetch_or ();
+
+ test_add_fetch ();
+ test_sub_fetch ();
+ test_and_fetch ();
+ test_nand_fetch ();
+ test_xor_fetch ();
+ test_or_fetch ();
+
+ test_add ();
+ test_sub ();
+ test_and ();
+ test_nand ();
+ test_xor ();
+ test_or ();
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/atomic-op-2.c b/gcc/testsuite/gcc.dg/atomic-op-2.c
new file mode 100644
index 00000000000..8755340cca2
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/atomic-op-2.c
@@ -0,0 +1,555 @@
+/* Test __atomic routines for existence and proper execution on 2 byte
+ values with each valid memory model. */
+/* { dg-do run } */
+/* { dg-require-effective-target sync_char_short } */
+
+
+/* Test the execution of the __atomic_*OP builtin routines for a short. */
+
+extern void abort(void);
+
+short v, count, res;
+const short init = ~0;
+
+/* The fetch_op routines return the original value before the operation. */
+
+void
+test_fetch_add ()
+{
+ v = 0;
+ count = 1;
+
+ if (__atomic_fetch_add (&v, count, __ATOMIC_RELAXED) != 0)
+ abort ();
+
+ if (__atomic_fetch_add (&v, 1, __ATOMIC_CONSUME) != 1)
+ abort ();
+
+ if (__atomic_fetch_add (&v, count, __ATOMIC_ACQUIRE) != 2)
+ abort ();
+
+ if (__atomic_fetch_add (&v, 1, __ATOMIC_RELEASE) != 3)
+ abort ();
+
+ if (__atomic_fetch_add (&v, count, __ATOMIC_ACQ_REL) != 4)
+ abort ();
+
+ if (__atomic_fetch_add (&v, 1, __ATOMIC_SEQ_CST) != 5)
+ abort ();
+}
+
+
+void
+test_fetch_sub()
+{
+ v = res = 20;
+ count = 0;
+
+ if (__atomic_fetch_sub (&v, count + 1, __ATOMIC_RELAXED) != res--)
+ abort ();
+
+ if (__atomic_fetch_sub (&v, 1, __ATOMIC_CONSUME) != res--)
+ abort ();
+
+ if (__atomic_fetch_sub (&v, count + 1, __ATOMIC_ACQUIRE) != res--)
+ abort ();
+
+ if (__atomic_fetch_sub (&v, 1, __ATOMIC_RELEASE) != res--)
+ abort ();
+
+ if (__atomic_fetch_sub (&v, count + 1, __ATOMIC_ACQ_REL) != res--)
+ abort ();
+
+ if (__atomic_fetch_sub (&v, 1, __ATOMIC_SEQ_CST) != res--)
+ abort ();
+}
+
+void
+test_fetch_and ()
+{
+ v = init;
+
+ if (__atomic_fetch_and (&v, 0, __ATOMIC_RELAXED) != init)
+ abort ();
+
+ if (__atomic_fetch_and (&v, init, __ATOMIC_CONSUME) != 0)
+ abort ();
+
+ if (__atomic_fetch_and (&v, 0, __ATOMIC_ACQUIRE) != 0)
+ abort ();
+
+ v = ~v;
+ if (__atomic_fetch_and (&v, init, __ATOMIC_RELEASE) != init)
+ abort ();
+
+ if (__atomic_fetch_and (&v, 0, __ATOMIC_ACQ_REL) != init)
+ abort ();
+
+ if (__atomic_fetch_and (&v, 0, __ATOMIC_SEQ_CST) != 0)
+ abort ();
+}
+
+void
+test_fetch_nand ()
+{
+ v = init;
+
+ if (__atomic_fetch_nand (&v, 0, __ATOMIC_RELAXED) != init)
+ abort ();
+
+ if (__atomic_fetch_nand (&v, init, __ATOMIC_CONSUME) != init)
+ abort ();
+
+ if (__atomic_fetch_nand (&v, 0, __ATOMIC_ACQUIRE) != 0 )
+ abort ();
+
+ if (__atomic_fetch_nand (&v, init, __ATOMIC_RELEASE) != init)
+ abort ();
+
+ if (__atomic_fetch_nand (&v, init, __ATOMIC_ACQ_REL) != 0)
+ abort ();
+
+ if (__atomic_fetch_nand (&v, 0, __ATOMIC_SEQ_CST) != init)
+ abort ();
+}
+
+void
+test_fetch_xor ()
+{
+ v = init;
+ count = 0;
+
+ if (__atomic_fetch_xor (&v, count, __ATOMIC_RELAXED) != init)
+ abort ();
+
+ if (__atomic_fetch_xor (&v, ~count, __ATOMIC_CONSUME) != init)
+ abort ();
+
+ if (__atomic_fetch_xor (&v, 0, __ATOMIC_ACQUIRE) != 0)
+ abort ();
+
+ if (__atomic_fetch_xor (&v, ~count, __ATOMIC_RELEASE) != 0)
+ abort ();
+
+ if (__atomic_fetch_xor (&v, 0, __ATOMIC_ACQ_REL) != init)
+ abort ();
+
+ if (__atomic_fetch_xor (&v, ~count, __ATOMIC_SEQ_CST) != init)
+ abort ();
+}
+
+void
+test_fetch_or ()
+{
+ v = 0;
+ count = 1;
+
+ if (__atomic_fetch_or (&v, count, __ATOMIC_RELAXED) != 0)
+ abort ();
+
+ count *= 2;
+ if (__atomic_fetch_or (&v, 2, __ATOMIC_CONSUME) != 1)
+ abort ();
+
+ count *= 2;
+ if (__atomic_fetch_or (&v, count, __ATOMIC_ACQUIRE) != 3)
+ abort ();
+
+ count *= 2;
+ if (__atomic_fetch_or (&v, 8, __ATOMIC_RELEASE) != 7)
+ abort ();
+
+ count *= 2;
+ if (__atomic_fetch_or (&v, count, __ATOMIC_ACQ_REL) != 15)
+ abort ();
+
+ count *= 2;
+ if (__atomic_fetch_or (&v, count, __ATOMIC_SEQ_CST) != 31)
+ abort ();
+}
+
+/* The OP_fetch routines return the new value after the operation. */
+
+void
+test_add_fetch ()
+{
+ v = 0;
+ count = 1;
+
+ if (__atomic_add_fetch (&v, count, __ATOMIC_RELAXED) != 1)
+ abort ();
+
+ if (__atomic_add_fetch (&v, 1, __ATOMIC_CONSUME) != 2)
+ abort ();
+
+ if (__atomic_add_fetch (&v, count, __ATOMIC_ACQUIRE) != 3)
+ abort ();
+
+ if (__atomic_add_fetch (&v, 1, __ATOMIC_RELEASE) != 4)
+ abort ();
+
+ if (__atomic_add_fetch (&v, count, __ATOMIC_ACQ_REL) != 5)
+ abort ();
+
+ if (__atomic_add_fetch (&v, count, __ATOMIC_SEQ_CST) != 6)
+ abort ();
+}
+
+
+void
+test_sub_fetch ()
+{
+ v = res = 20;
+ count = 0;
+
+ if (__atomic_sub_fetch (&v, count + 1, __ATOMIC_RELAXED) != --res)
+ abort ();
+
+ if (__atomic_sub_fetch (&v, 1, __ATOMIC_CONSUME) != --res)
+ abort ();
+
+ if (__atomic_sub_fetch (&v, count + 1, __ATOMIC_ACQUIRE) != --res)
+ abort ();
+
+ if (__atomic_sub_fetch (&v, 1, __ATOMIC_RELEASE) != --res)
+ abort ();
+
+ if (__atomic_sub_fetch (&v, count + 1, __ATOMIC_ACQ_REL) != --res)
+ abort ();
+
+ if (__atomic_sub_fetch (&v, count + 1, __ATOMIC_SEQ_CST) != --res)
+ abort ();
+}
+
+void
+test_and_fetch ()
+{
+ v = init;
+
+ if (__atomic_and_fetch (&v, 0, __ATOMIC_RELAXED) != 0)
+ abort ();
+
+ v = init;
+ if (__atomic_and_fetch (&v, init, __ATOMIC_CONSUME) != init)
+ abort ();
+
+ if (__atomic_and_fetch (&v, 0, __ATOMIC_ACQUIRE) != 0)
+ abort ();
+
+ v = ~v;
+ if (__atomic_and_fetch (&v, init, __ATOMIC_RELEASE) != init)
+ abort ();
+
+ if (__atomic_and_fetch (&v, 0, __ATOMIC_ACQ_REL) != 0)
+ abort ();
+
+ v = ~v;
+ if (__atomic_and_fetch (&v, 0, __ATOMIC_SEQ_CST) != 0)
+ abort ();
+}
+
+void
+test_nand_fetch ()
+{
+ v = init;
+
+ if (__atomic_nand_fetch (&v, 0, __ATOMIC_RELAXED) != init)
+ abort ();
+
+ if (__atomic_nand_fetch (&v, init, __ATOMIC_CONSUME) != 0)
+ abort ();
+
+ if (__atomic_nand_fetch (&v, 0, __ATOMIC_ACQUIRE) != init)
+ abort ();
+
+ if (__atomic_nand_fetch (&v, init, __ATOMIC_RELEASE) != 0)
+ abort ();
+
+ if (__atomic_nand_fetch (&v, init, __ATOMIC_ACQ_REL) != init)
+ abort ();
+
+ if (__atomic_nand_fetch (&v, 0, __ATOMIC_SEQ_CST) != init)
+ abort ();
+}
+
+
+
+void
+test_xor_fetch ()
+{
+ v = init;
+ count = 0;
+
+ if (__atomic_xor_fetch (&v, count, __ATOMIC_RELAXED) != init)
+ abort ();
+
+ if (__atomic_xor_fetch (&v, ~count, __ATOMIC_CONSUME) != 0)
+ abort ();
+
+ if (__atomic_xor_fetch (&v, 0, __ATOMIC_ACQUIRE) != 0)
+ abort ();
+
+ if (__atomic_xor_fetch (&v, ~count, __ATOMIC_RELEASE) != init)
+ abort ();
+
+ if (__atomic_xor_fetch (&v, 0, __ATOMIC_ACQ_REL) != init)
+ abort ();
+
+ if (__atomic_xor_fetch (&v, ~count, __ATOMIC_SEQ_CST) != 0)
+ abort ();
+}
+
+void
+test_or_fetch ()
+{
+ v = 0;
+ count = 1;
+
+ if (__atomic_or_fetch (&v, count, __ATOMIC_RELAXED) != 1)
+ abort ();
+
+ count *= 2;
+ if (__atomic_or_fetch (&v, 2, __ATOMIC_CONSUME) != 3)
+ abort ();
+
+ count *= 2;
+ if (__atomic_or_fetch (&v, count, __ATOMIC_ACQUIRE) != 7)
+ abort ();
+
+ count *= 2;
+ if (__atomic_or_fetch (&v, 8, __ATOMIC_RELEASE) != 15)
+ abort ();
+
+ count *= 2;
+ if (__atomic_or_fetch (&v, count, __ATOMIC_ACQ_REL) != 31)
+ abort ();
+
+ count *= 2;
+ if (__atomic_or_fetch (&v, count, __ATOMIC_SEQ_CST) != 63)
+ abort ();
+}
+
+
+/* Test the OP routines with a result which isn't used. Use both variations
+ within each function. */
+
+void
+test_add ()
+{
+ v = 0;
+ count = 1;
+
+ __atomic_add_fetch (&v, count, __ATOMIC_RELAXED);
+ if (v != 1)
+ abort ();
+
+ __atomic_fetch_add (&v, count, __ATOMIC_CONSUME);
+ if (v != 2)
+ abort ();
+
+ __atomic_add_fetch (&v, 1 , __ATOMIC_ACQUIRE);
+ if (v != 3)
+ abort ();
+
+ __atomic_fetch_add (&v, 1, __ATOMIC_RELEASE);
+ if (v != 4)
+ abort ();
+
+ __atomic_add_fetch (&v, count, __ATOMIC_ACQ_REL);
+ if (v != 5)
+ abort ();
+
+ __atomic_fetch_add (&v, count, __ATOMIC_SEQ_CST);
+ if (v != 6)
+ abort ();
+}
+
+
+void
+test_sub()
+{
+ v = res = 20;
+ count = 0;
+
+ __atomic_sub_fetch (&v, count + 1, __ATOMIC_RELAXED);
+ if (v != --res)
+ abort ();
+
+ __atomic_fetch_sub (&v, count + 1, __ATOMIC_CONSUME);
+ if (v != --res)
+ abort ();
+
+ __atomic_sub_fetch (&v, 1, __ATOMIC_ACQUIRE);
+ if (v != --res)
+ abort ();
+
+ __atomic_fetch_sub (&v, 1, __ATOMIC_RELEASE);
+ if (v != --res)
+ abort ();
+
+ __atomic_sub_fetch (&v, count + 1, __ATOMIC_ACQ_REL);
+ if (v != --res)
+ abort ();
+
+ __atomic_fetch_sub (&v, count + 1, __ATOMIC_SEQ_CST);
+ if (v != --res)
+ abort ();
+}
+
+void
+test_and ()
+{
+ v = init;
+
+ __atomic_and_fetch (&v, 0, __ATOMIC_RELAXED);
+ if (v != 0)
+ abort ();
+
+ v = init;
+ __atomic_fetch_and (&v, init, __ATOMIC_CONSUME);
+ if (v != init)
+ abort ();
+
+ __atomic_and_fetch (&v, 0, __ATOMIC_ACQUIRE);
+ if (v != 0)
+ abort ();
+
+ v = ~v;
+ __atomic_fetch_and (&v, init, __ATOMIC_RELEASE);
+ if (v != init)
+ abort ();
+
+ __atomic_and_fetch (&v, 0, __ATOMIC_ACQ_REL);
+ if (v != 0)
+ abort ();
+
+ v = ~v;
+ __atomic_fetch_and (&v, 0, __ATOMIC_SEQ_CST);
+ if (v != 0)
+ abort ();
+}
+
+void
+test_nand ()
+{
+ v = init;
+
+ __atomic_fetch_nand (&v, 0, __ATOMIC_RELAXED);
+ if (v != init)
+ abort ();
+
+ __atomic_fetch_nand (&v, init, __ATOMIC_CONSUME);
+ if (v != 0)
+ abort ();
+
+ __atomic_nand_fetch (&v, 0, __ATOMIC_ACQUIRE);
+ if (v != init)
+ abort ();
+
+ __atomic_nand_fetch (&v, init, __ATOMIC_RELEASE);
+ if (v != 0)
+ abort ();
+
+ __atomic_fetch_nand (&v, init, __ATOMIC_ACQ_REL);
+ if (v != init)
+ abort ();
+
+ __atomic_nand_fetch (&v, 0, __ATOMIC_SEQ_CST);
+ if (v != init)
+ abort ();
+}
+
+
+
+void
+test_xor ()
+{
+ v = init;
+ count = 0;
+
+ __atomic_xor_fetch (&v, count, __ATOMIC_RELAXED);
+ if (v != init)
+ abort ();
+
+ __atomic_fetch_xor (&v, ~count, __ATOMIC_CONSUME);
+ if (v != 0)
+ abort ();
+
+ __atomic_xor_fetch (&v, 0, __ATOMIC_ACQUIRE);
+ if (v != 0)
+ abort ();
+
+ __atomic_fetch_xor (&v, ~count, __ATOMIC_RELEASE);
+ if (v != init)
+ abort ();
+
+ __atomic_fetch_xor (&v, 0, __ATOMIC_ACQ_REL);
+ if (v != init)
+ abort ();
+
+ __atomic_xor_fetch (&v, ~count, __ATOMIC_SEQ_CST);
+ if (v != 0)
+ abort ();
+}
+
+void
+test_or ()
+{
+ v = 0;
+ count = 1;
+
+ __atomic_or_fetch (&v, count, __ATOMIC_RELAXED);
+ if (v != 1)
+ abort ();
+
+ count *= 2;
+ __atomic_fetch_or (&v, count, __ATOMIC_CONSUME);
+ if (v != 3)
+ abort ();
+
+ count *= 2;
+ __atomic_or_fetch (&v, 4, __ATOMIC_ACQUIRE);
+ if (v != 7)
+ abort ();
+
+ count *= 2;
+ __atomic_fetch_or (&v, 8, __ATOMIC_RELEASE);
+ if (v != 15)
+ abort ();
+
+ count *= 2;
+ __atomic_or_fetch (&v, count, __ATOMIC_ACQ_REL);
+ if (v != 31)
+ abort ();
+
+ count *= 2;
+ __atomic_fetch_or (&v, count, __ATOMIC_SEQ_CST);
+ if (v != 63)
+ abort ();
+}
+
+main ()
+{
+ test_fetch_add ();
+ test_fetch_sub ();
+ test_fetch_and ();
+ test_fetch_nand ();
+ test_fetch_xor ();
+ test_fetch_or ();
+
+ test_add_fetch ();
+ test_sub_fetch ();
+ test_and_fetch ();
+ test_nand_fetch ();
+ test_xor_fetch ();
+ test_or_fetch ();
+
+ test_add ();
+ test_sub ();
+ test_and ();
+ test_nand ();
+ test_xor ();
+ test_or ();
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/atomic-op-3.c b/gcc/testsuite/gcc.dg/atomic-op-3.c
new file mode 100644
index 00000000000..69db4894b63
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/atomic-op-3.c
@@ -0,0 +1,554 @@
+/* Test __atomic routines for existence and proper execution on 4 byte
+ values with each valid memory model. */
+/* { dg-do run } */
+/* { dg-require-effective-target sync_int_long } */
+
+/* Test the execution of the __atomic_*OP builtin routines for an int. */
+
+extern void abort(void);
+
+int v, count, res;
+const int init = ~0;
+
+/* The fetch_op routines return the original value before the operation. */
+
+void
+test_fetch_add ()
+{
+ v = 0;
+ count = 1;
+
+ if (__atomic_fetch_add (&v, count, __ATOMIC_RELAXED) != 0)
+ abort ();
+
+ if (__atomic_fetch_add (&v, 1, __ATOMIC_CONSUME) != 1)
+ abort ();
+
+ if (__atomic_fetch_add (&v, count, __ATOMIC_ACQUIRE) != 2)
+ abort ();
+
+ if (__atomic_fetch_add (&v, 1, __ATOMIC_RELEASE) != 3)
+ abort ();
+
+ if (__atomic_fetch_add (&v, count, __ATOMIC_ACQ_REL) != 4)
+ abort ();
+
+ if (__atomic_fetch_add (&v, 1, __ATOMIC_SEQ_CST) != 5)
+ abort ();
+}
+
+
+void
+test_fetch_sub()
+{
+ v = res = 20;
+ count = 0;
+
+ if (__atomic_fetch_sub (&v, count + 1, __ATOMIC_RELAXED) != res--)
+ abort ();
+
+ if (__atomic_fetch_sub (&v, 1, __ATOMIC_CONSUME) != res--)
+ abort ();
+
+ if (__atomic_fetch_sub (&v, count + 1, __ATOMIC_ACQUIRE) != res--)
+ abort ();
+
+ if (__atomic_fetch_sub (&v, 1, __ATOMIC_RELEASE) != res--)
+ abort ();
+
+ if (__atomic_fetch_sub (&v, count + 1, __ATOMIC_ACQ_REL) != res--)
+ abort ();
+
+ if (__atomic_fetch_sub (&v, 1, __ATOMIC_SEQ_CST) != res--)
+ abort ();
+}
+
+void
+test_fetch_and ()
+{
+ v = init;
+
+ if (__atomic_fetch_and (&v, 0, __ATOMIC_RELAXED) != init)
+ abort ();
+
+ if (__atomic_fetch_and (&v, init, __ATOMIC_CONSUME) != 0)
+ abort ();
+
+ if (__atomic_fetch_and (&v, 0, __ATOMIC_ACQUIRE) != 0)
+ abort ();
+
+ v = ~v;
+ if (__atomic_fetch_and (&v, init, __ATOMIC_RELEASE) != init)
+ abort ();
+
+ if (__atomic_fetch_and (&v, 0, __ATOMIC_ACQ_REL) != init)
+ abort ();
+
+ if (__atomic_fetch_and (&v, 0, __ATOMIC_SEQ_CST) != 0)
+ abort ();
+}
+
+void
+test_fetch_nand ()
+{
+ v = init;
+
+ if (__atomic_fetch_nand (&v, 0, __ATOMIC_RELAXED) != init)
+ abort ();
+
+ if (__atomic_fetch_nand (&v, init, __ATOMIC_CONSUME) != init)
+ abort ();
+
+ if (__atomic_fetch_nand (&v, 0, __ATOMIC_ACQUIRE) != 0 )
+ abort ();
+
+ if (__atomic_fetch_nand (&v, init, __ATOMIC_RELEASE) != init)
+ abort ();
+
+ if (__atomic_fetch_nand (&v, init, __ATOMIC_ACQ_REL) != 0)
+ abort ();
+
+ if (__atomic_fetch_nand (&v, 0, __ATOMIC_SEQ_CST) != init)
+ abort ();
+}
+
+void
+test_fetch_xor ()
+{
+ v = init;
+ count = 0;
+
+ if (__atomic_fetch_xor (&v, count, __ATOMIC_RELAXED) != init)
+ abort ();
+
+ if (__atomic_fetch_xor (&v, ~count, __ATOMIC_CONSUME) != init)
+ abort ();
+
+ if (__atomic_fetch_xor (&v, 0, __ATOMIC_ACQUIRE) != 0)
+ abort ();
+
+ if (__atomic_fetch_xor (&v, ~count, __ATOMIC_RELEASE) != 0)
+ abort ();
+
+ if (__atomic_fetch_xor (&v, 0, __ATOMIC_ACQ_REL) != init)
+ abort ();
+
+ if (__atomic_fetch_xor (&v, ~count, __ATOMIC_SEQ_CST) != init)
+ abort ();
+}
+
+void
+test_fetch_or ()
+{
+ v = 0;
+ count = 1;
+
+ if (__atomic_fetch_or (&v, count, __ATOMIC_RELAXED) != 0)
+ abort ();
+
+ count *= 2;
+ if (__atomic_fetch_or (&v, 2, __ATOMIC_CONSUME) != 1)
+ abort ();
+
+ count *= 2;
+ if (__atomic_fetch_or (&v, count, __ATOMIC_ACQUIRE) != 3)
+ abort ();
+
+ count *= 2;
+ if (__atomic_fetch_or (&v, 8, __ATOMIC_RELEASE) != 7)
+ abort ();
+
+ count *= 2;
+ if (__atomic_fetch_or (&v, count, __ATOMIC_ACQ_REL) != 15)
+ abort ();
+
+ count *= 2;
+ if (__atomic_fetch_or (&v, count, __ATOMIC_SEQ_CST) != 31)
+ abort ();
+}
+
+/* The OP_fetch routines return the new value after the operation. */
+
+void
+test_add_fetch ()
+{
+ v = 0;
+ count = 1;
+
+ if (__atomic_add_fetch (&v, count, __ATOMIC_RELAXED) != 1)
+ abort ();
+
+ if (__atomic_add_fetch (&v, 1, __ATOMIC_CONSUME) != 2)
+ abort ();
+
+ if (__atomic_add_fetch (&v, count, __ATOMIC_ACQUIRE) != 3)
+ abort ();
+
+ if (__atomic_add_fetch (&v, 1, __ATOMIC_RELEASE) != 4)
+ abort ();
+
+ if (__atomic_add_fetch (&v, count, __ATOMIC_ACQ_REL) != 5)
+ abort ();
+
+ if (__atomic_add_fetch (&v, count, __ATOMIC_SEQ_CST) != 6)
+ abort ();
+}
+
+
+void
+test_sub_fetch ()
+{
+ v = res = 20;
+ count = 0;
+
+ if (__atomic_sub_fetch (&v, count + 1, __ATOMIC_RELAXED) != --res)
+ abort ();
+
+ if (__atomic_sub_fetch (&v, 1, __ATOMIC_CONSUME) != --res)
+ abort ();
+
+ if (__atomic_sub_fetch (&v, count + 1, __ATOMIC_ACQUIRE) != --res)
+ abort ();
+
+ if (__atomic_sub_fetch (&v, 1, __ATOMIC_RELEASE) != --res)
+ abort ();
+
+ if (__atomic_sub_fetch (&v, count + 1, __ATOMIC_ACQ_REL) != --res)
+ abort ();
+
+ if (__atomic_sub_fetch (&v, count + 1, __ATOMIC_SEQ_CST) != --res)
+ abort ();
+}
+
+void
+test_and_fetch ()
+{
+ v = init;
+
+ if (__atomic_and_fetch (&v, 0, __ATOMIC_RELAXED) != 0)
+ abort ();
+
+ v = init;
+ if (__atomic_and_fetch (&v, init, __ATOMIC_CONSUME) != init)
+ abort ();
+
+ if (__atomic_and_fetch (&v, 0, __ATOMIC_ACQUIRE) != 0)
+ abort ();
+
+ v = ~v;
+ if (__atomic_and_fetch (&v, init, __ATOMIC_RELEASE) != init)
+ abort ();
+
+ if (__atomic_and_fetch (&v, 0, __ATOMIC_ACQ_REL) != 0)
+ abort ();
+
+ v = ~v;
+ if (__atomic_and_fetch (&v, 0, __ATOMIC_SEQ_CST) != 0)
+ abort ();
+}
+
+void
+test_nand_fetch ()
+{
+ v = init;
+
+ if (__atomic_nand_fetch (&v, 0, __ATOMIC_RELAXED) != init)
+ abort ();
+
+ if (__atomic_nand_fetch (&v, init, __ATOMIC_CONSUME) != 0)
+ abort ();
+
+ if (__atomic_nand_fetch (&v, 0, __ATOMIC_ACQUIRE) != init)
+ abort ();
+
+ if (__atomic_nand_fetch (&v, init, __ATOMIC_RELEASE) != 0)
+ abort ();
+
+ if (__atomic_nand_fetch (&v, init, __ATOMIC_ACQ_REL) != init)
+ abort ();
+
+ if (__atomic_nand_fetch (&v, 0, __ATOMIC_SEQ_CST) != init)
+ abort ();
+}
+
+
+
+void
+test_xor_fetch ()
+{
+ v = init;
+ count = 0;
+
+ if (__atomic_xor_fetch (&v, count, __ATOMIC_RELAXED) != init)
+ abort ();
+
+ if (__atomic_xor_fetch (&v, ~count, __ATOMIC_CONSUME) != 0)
+ abort ();
+
+ if (__atomic_xor_fetch (&v, 0, __ATOMIC_ACQUIRE) != 0)
+ abort ();
+
+ if (__atomic_xor_fetch (&v, ~count, __ATOMIC_RELEASE) != init)
+ abort ();
+
+ if (__atomic_xor_fetch (&v, 0, __ATOMIC_ACQ_REL) != init)
+ abort ();
+
+ if (__atomic_xor_fetch (&v, ~count, __ATOMIC_SEQ_CST) != 0)
+ abort ();
+}
+
+void
+test_or_fetch ()
+{
+ v = 0;
+ count = 1;
+
+ if (__atomic_or_fetch (&v, count, __ATOMIC_RELAXED) != 1)
+ abort ();
+
+ count *= 2;
+ if (__atomic_or_fetch (&v, 2, __ATOMIC_CONSUME) != 3)
+ abort ();
+
+ count *= 2;
+ if (__atomic_or_fetch (&v, count, __ATOMIC_ACQUIRE) != 7)
+ abort ();
+
+ count *= 2;
+ if (__atomic_or_fetch (&v, 8, __ATOMIC_RELEASE) != 15)
+ abort ();
+
+ count *= 2;
+ if (__atomic_or_fetch (&v, count, __ATOMIC_ACQ_REL) != 31)
+ abort ();
+
+ count *= 2;
+ if (__atomic_or_fetch (&v, count, __ATOMIC_SEQ_CST) != 63)
+ abort ();
+}
+
+
+/* Test the OP routines with a result which isn't used. Use both variations
+ within each function. */
+
+void
+test_add ()
+{
+ v = 0;
+ count = 1;
+
+ __atomic_add_fetch (&v, count, __ATOMIC_RELAXED);
+ if (v != 1)
+ abort ();
+
+ __atomic_fetch_add (&v, count, __ATOMIC_CONSUME);
+ if (v != 2)
+ abort ();
+
+ __atomic_add_fetch (&v, 1 , __ATOMIC_ACQUIRE);
+ if (v != 3)
+ abort ();
+
+ __atomic_fetch_add (&v, 1, __ATOMIC_RELEASE);
+ if (v != 4)
+ abort ();
+
+ __atomic_add_fetch (&v, count, __ATOMIC_ACQ_REL);
+ if (v != 5)
+ abort ();
+
+ __atomic_fetch_add (&v, count, __ATOMIC_SEQ_CST);
+ if (v != 6)
+ abort ();
+}
+
+
+void
+test_sub()
+{
+ v = res = 20;
+ count = 0;
+
+ __atomic_sub_fetch (&v, count + 1, __ATOMIC_RELAXED);
+ if (v != --res)
+ abort ();
+
+ __atomic_fetch_sub (&v, count + 1, __ATOMIC_CONSUME);
+ if (v != --res)
+ abort ();
+
+ __atomic_sub_fetch (&v, 1, __ATOMIC_ACQUIRE);
+ if (v != --res)
+ abort ();
+
+ __atomic_fetch_sub (&v, 1, __ATOMIC_RELEASE);
+ if (v != --res)
+ abort ();
+
+ __atomic_sub_fetch (&v, count + 1, __ATOMIC_ACQ_REL);
+ if (v != --res)
+ abort ();
+
+ __atomic_fetch_sub (&v, count + 1, __ATOMIC_SEQ_CST);
+ if (v != --res)
+ abort ();
+}
+
+void
+test_and ()
+{
+ v = init;
+
+ __atomic_and_fetch (&v, 0, __ATOMIC_RELAXED);
+ if (v != 0)
+ abort ();
+
+ v = init;
+ __atomic_fetch_and (&v, init, __ATOMIC_CONSUME);
+ if (v != init)
+ abort ();
+
+ __atomic_and_fetch (&v, 0, __ATOMIC_ACQUIRE);
+ if (v != 0)
+ abort ();
+
+ v = ~v;
+ __atomic_fetch_and (&v, init, __ATOMIC_RELEASE);
+ if (v != init)
+ abort ();
+
+ __atomic_and_fetch (&v, 0, __ATOMIC_ACQ_REL);
+ if (v != 0)
+ abort ();
+
+ v = ~v;
+ __atomic_fetch_and (&v, 0, __ATOMIC_SEQ_CST);
+ if (v != 0)
+ abort ();
+}
+
+void
+test_nand ()
+{
+ v = init;
+
+ __atomic_fetch_nand (&v, 0, __ATOMIC_RELAXED);
+ if (v != init)
+ abort ();
+
+ __atomic_fetch_nand (&v, init, __ATOMIC_CONSUME);
+ if (v != 0)
+ abort ();
+
+ __atomic_nand_fetch (&v, 0, __ATOMIC_ACQUIRE);
+ if (v != init)
+ abort ();
+
+ __atomic_nand_fetch (&v, init, __ATOMIC_RELEASE);
+ if (v != 0)
+ abort ();
+
+ __atomic_fetch_nand (&v, init, __ATOMIC_ACQ_REL);
+ if (v != init)
+ abort ();
+
+ __atomic_nand_fetch (&v, 0, __ATOMIC_SEQ_CST);
+ if (v != init)
+ abort ();
+}
+
+
+
+void
+test_xor ()
+{
+ v = init;
+ count = 0;
+
+ __atomic_xor_fetch (&v, count, __ATOMIC_RELAXED);
+ if (v != init)
+ abort ();
+
+ __atomic_fetch_xor (&v, ~count, __ATOMIC_CONSUME);
+ if (v != 0)
+ abort ();
+
+ __atomic_xor_fetch (&v, 0, __ATOMIC_ACQUIRE);
+ if (v != 0)
+ abort ();
+
+ __atomic_fetch_xor (&v, ~count, __ATOMIC_RELEASE);
+ if (v != init)
+ abort ();
+
+ __atomic_fetch_xor (&v, 0, __ATOMIC_ACQ_REL);
+ if (v != init)
+ abort ();
+
+ __atomic_xor_fetch (&v, ~count, __ATOMIC_SEQ_CST);
+ if (v != 0)
+ abort ();
+}
+
+void
+test_or ()
+{
+ v = 0;
+ count = 1;
+
+ __atomic_or_fetch (&v, count, __ATOMIC_RELAXED);
+ if (v != 1)
+ abort ();
+
+ count *= 2;
+ __atomic_fetch_or (&v, count, __ATOMIC_CONSUME);
+ if (v != 3)
+ abort ();
+
+ count *= 2;
+ __atomic_or_fetch (&v, 4, __ATOMIC_ACQUIRE);
+ if (v != 7)
+ abort ();
+
+ count *= 2;
+ __atomic_fetch_or (&v, 8, __ATOMIC_RELEASE);
+ if (v != 15)
+ abort ();
+
+ count *= 2;
+ __atomic_or_fetch (&v, count, __ATOMIC_ACQ_REL);
+ if (v != 31)
+ abort ();
+
+ count *= 2;
+ __atomic_fetch_or (&v, count, __ATOMIC_SEQ_CST);
+ if (v != 63)
+ abort ();
+}
+
+main ()
+{
+ test_fetch_add ();
+ test_fetch_sub ();
+ test_fetch_and ();
+ test_fetch_nand ();
+ test_fetch_xor ();
+ test_fetch_or ();
+
+ test_add_fetch ();
+ test_sub_fetch ();
+ test_and_fetch ();
+ test_nand_fetch ();
+ test_xor_fetch ();
+ test_or_fetch ();
+
+ test_add ();
+ test_sub ();
+ test_and ();
+ test_nand ();
+ test_xor ();
+ test_or ();
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/atomic-op-4.c b/gcc/testsuite/gcc.dg/atomic-op-4.c
new file mode 100644
index 00000000000..39650213edf
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/atomic-op-4.c
@@ -0,0 +1,555 @@
+/* Test __atomic routines for existence and proper execution on 8 byte
+ values with each valid memory model. */
+/* { dg-do run } */
+/* { dg-require-effective-target sync_long_long } */
+/* { dg-options "" } */
+
+/* Test the execution of the __atomic_*OP builtin routines for long long. */
+
+extern void abort(void);
+
+long long v, count, res;
+const long long init = ~0;
+
+/* The fetch_op routines return the original value before the operation. */
+
+void
+test_fetch_add ()
+{
+ v = 0;
+ count = 1;
+
+ if (__atomic_fetch_add (&v, count, __ATOMIC_RELAXED) != 0)
+ abort ();
+
+ if (__atomic_fetch_add (&v, 1, __ATOMIC_CONSUME) != 1)
+ abort ();
+
+ if (__atomic_fetch_add (&v, count, __ATOMIC_ACQUIRE) != 2)
+ abort ();
+
+ if (__atomic_fetch_add (&v, 1, __ATOMIC_RELEASE) != 3)
+ abort ();
+
+ if (__atomic_fetch_add (&v, count, __ATOMIC_ACQ_REL) != 4)
+ abort ();
+
+ if (__atomic_fetch_add (&v, 1, __ATOMIC_SEQ_CST) != 5)
+ abort ();
+}
+
+
+void
+test_fetch_sub()
+{
+ v = res = 20;
+ count = 0;
+
+ if (__atomic_fetch_sub (&v, count + 1, __ATOMIC_RELAXED) != res--)
+ abort ();
+
+ if (__atomic_fetch_sub (&v, 1, __ATOMIC_CONSUME) != res--)
+ abort ();
+
+ if (__atomic_fetch_sub (&v, count + 1, __ATOMIC_ACQUIRE) != res--)
+ abort ();
+
+ if (__atomic_fetch_sub (&v, 1, __ATOMIC_RELEASE) != res--)
+ abort ();
+
+ if (__atomic_fetch_sub (&v, count + 1, __ATOMIC_ACQ_REL) != res--)
+ abort ();
+
+ if (__atomic_fetch_sub (&v, 1, __ATOMIC_SEQ_CST) != res--)
+ abort ();
+}
+
+void
+test_fetch_and ()
+{
+ v = init;
+
+ if (__atomic_fetch_and (&v, 0, __ATOMIC_RELAXED) != init)
+ abort ();
+
+ if (__atomic_fetch_and (&v, init, __ATOMIC_CONSUME) != 0)
+ abort ();
+
+ if (__atomic_fetch_and (&v, 0, __ATOMIC_ACQUIRE) != 0)
+ abort ();
+
+ v = ~v;
+ if (__atomic_fetch_and (&v, init, __ATOMIC_RELEASE) != init)
+ abort ();
+
+ if (__atomic_fetch_and (&v, 0, __ATOMIC_ACQ_REL) != init)
+ abort ();
+
+ if (__atomic_fetch_and (&v, 0, __ATOMIC_SEQ_CST) != 0)
+ abort ();
+}
+
+void
+test_fetch_nand ()
+{
+ v = init;
+
+ if (__atomic_fetch_nand (&v, 0, __ATOMIC_RELAXED) != init)
+ abort ();
+
+ if (__atomic_fetch_nand (&v, init, __ATOMIC_CONSUME) != init)
+ abort ();
+
+ if (__atomic_fetch_nand (&v, 0, __ATOMIC_ACQUIRE) != 0 )
+ abort ();
+
+ if (__atomic_fetch_nand (&v, init, __ATOMIC_RELEASE) != init)
+ abort ();
+
+ if (__atomic_fetch_nand (&v, init, __ATOMIC_ACQ_REL) != 0)
+ abort ();
+
+ if (__atomic_fetch_nand (&v, 0, __ATOMIC_SEQ_CST) != init)
+ abort ();
+}
+
+void
+test_fetch_xor ()
+{
+ v = init;
+ count = 0;
+
+ if (__atomic_fetch_xor (&v, count, __ATOMIC_RELAXED) != init)
+ abort ();
+
+ if (__atomic_fetch_xor (&v, ~count, __ATOMIC_CONSUME) != init)
+ abort ();
+
+ if (__atomic_fetch_xor (&v, 0, __ATOMIC_ACQUIRE) != 0)
+ abort ();
+
+ if (__atomic_fetch_xor (&v, ~count, __ATOMIC_RELEASE) != 0)
+ abort ();
+
+ if (__atomic_fetch_xor (&v, 0, __ATOMIC_ACQ_REL) != init)
+ abort ();
+
+ if (__atomic_fetch_xor (&v, ~count, __ATOMIC_SEQ_CST) != init)
+ abort ();
+}
+
+void
+test_fetch_or ()
+{
+ v = 0;
+ count = 1;
+
+ if (__atomic_fetch_or (&v, count, __ATOMIC_RELAXED) != 0)
+ abort ();
+
+ count *= 2;
+ if (__atomic_fetch_or (&v, 2, __ATOMIC_CONSUME) != 1)
+ abort ();
+
+ count *= 2;
+ if (__atomic_fetch_or (&v, count, __ATOMIC_ACQUIRE) != 3)
+ abort ();
+
+ count *= 2;
+ if (__atomic_fetch_or (&v, 8, __ATOMIC_RELEASE) != 7)
+ abort ();
+
+ count *= 2;
+ if (__atomic_fetch_or (&v, count, __ATOMIC_ACQ_REL) != 15)
+ abort ();
+
+ count *= 2;
+ if (__atomic_fetch_or (&v, count, __ATOMIC_SEQ_CST) != 31)
+ abort ();
+}
+
+/* The OP_fetch routines return the new value after the operation. */
+
+void
+test_add_fetch ()
+{
+ v = 0;
+ count = 1;
+
+ if (__atomic_add_fetch (&v, count, __ATOMIC_RELAXED) != 1)
+ abort ();
+
+ if (__atomic_add_fetch (&v, 1, __ATOMIC_CONSUME) != 2)
+ abort ();
+
+ if (__atomic_add_fetch (&v, count, __ATOMIC_ACQUIRE) != 3)
+ abort ();
+
+ if (__atomic_add_fetch (&v, 1, __ATOMIC_RELEASE) != 4)
+ abort ();
+
+ if (__atomic_add_fetch (&v, count, __ATOMIC_ACQ_REL) != 5)
+ abort ();
+
+ if (__atomic_add_fetch (&v, count, __ATOMIC_SEQ_CST) != 6)
+ abort ();
+}
+
+
+void
+test_sub_fetch ()
+{
+ v = res = 20;
+ count = 0;
+
+ if (__atomic_sub_fetch (&v, count + 1, __ATOMIC_RELAXED) != --res)
+ abort ();
+
+ if (__atomic_sub_fetch (&v, 1, __ATOMIC_CONSUME) != --res)
+ abort ();
+
+ if (__atomic_sub_fetch (&v, count + 1, __ATOMIC_ACQUIRE) != --res)
+ abort ();
+
+ if (__atomic_sub_fetch (&v, 1, __ATOMIC_RELEASE) != --res)
+ abort ();
+
+ if (__atomic_sub_fetch (&v, count + 1, __ATOMIC_ACQ_REL) != --res)
+ abort ();
+
+ if (__atomic_sub_fetch (&v, count + 1, __ATOMIC_SEQ_CST) != --res)
+ abort ();
+}
+
+void
+test_and_fetch ()
+{
+ v = init;
+
+ if (__atomic_and_fetch (&v, 0, __ATOMIC_RELAXED) != 0)
+ abort ();
+
+ v = init;
+ if (__atomic_and_fetch (&v, init, __ATOMIC_CONSUME) != init)
+ abort ();
+
+ if (__atomic_and_fetch (&v, 0, __ATOMIC_ACQUIRE) != 0)
+ abort ();
+
+ v = ~v;
+ if (__atomic_and_fetch (&v, init, __ATOMIC_RELEASE) != init)
+ abort ();
+
+ if (__atomic_and_fetch (&v, 0, __ATOMIC_ACQ_REL) != 0)
+ abort ();
+
+ v = ~v;
+ if (__atomic_and_fetch (&v, 0, __ATOMIC_SEQ_CST) != 0)
+ abort ();
+}
+
+void
+test_nand_fetch ()
+{
+ v = init;
+
+ if (__atomic_nand_fetch (&v, 0, __ATOMIC_RELAXED) != init)
+ abort ();
+
+ if (__atomic_nand_fetch (&v, init, __ATOMIC_CONSUME) != 0)
+ abort ();
+
+ if (__atomic_nand_fetch (&v, 0, __ATOMIC_ACQUIRE) != init)
+ abort ();
+
+ if (__atomic_nand_fetch (&v, init, __ATOMIC_RELEASE) != 0)
+ abort ();
+
+ if (__atomic_nand_fetch (&v, init, __ATOMIC_ACQ_REL) != init)
+ abort ();
+
+ if (__atomic_nand_fetch (&v, 0, __ATOMIC_SEQ_CST) != init)
+ abort ();
+}
+
+
+
+void
+test_xor_fetch ()
+{
+ v = init;
+ count = 0;
+
+ if (__atomic_xor_fetch (&v, count, __ATOMIC_RELAXED) != init)
+ abort ();
+
+ if (__atomic_xor_fetch (&v, ~count, __ATOMIC_CONSUME) != 0)
+ abort ();
+
+ if (__atomic_xor_fetch (&v, 0, __ATOMIC_ACQUIRE) != 0)
+ abort ();
+
+ if (__atomic_xor_fetch (&v, ~count, __ATOMIC_RELEASE) != init)
+ abort ();
+
+ if (__atomic_xor_fetch (&v, 0, __ATOMIC_ACQ_REL) != init)
+ abort ();
+
+ if (__atomic_xor_fetch (&v, ~count, __ATOMIC_SEQ_CST) != 0)
+ abort ();
+}
+
+void
+test_or_fetch ()
+{
+ v = 0;
+ count = 1;
+
+ if (__atomic_or_fetch (&v, count, __ATOMIC_RELAXED) != 1)
+ abort ();
+
+ count *= 2;
+ if (__atomic_or_fetch (&v, 2, __ATOMIC_CONSUME) != 3)
+ abort ();
+
+ count *= 2;
+ if (__atomic_or_fetch (&v, count, __ATOMIC_ACQUIRE) != 7)
+ abort ();
+
+ count *= 2;
+ if (__atomic_or_fetch (&v, 8, __ATOMIC_RELEASE) != 15)
+ abort ();
+
+ count *= 2;
+ if (__atomic_or_fetch (&v, count, __ATOMIC_ACQ_REL) != 31)
+ abort ();
+
+ count *= 2;
+ if (__atomic_or_fetch (&v, count, __ATOMIC_SEQ_CST) != 63)
+ abort ();
+}
+
+
+/* Test the OP routines with a result which isn't used. Use both variations
+ within each function. */
+
+void
+test_add ()
+{
+ v = 0;
+ count = 1;
+
+ __atomic_add_fetch (&v, count, __ATOMIC_RELAXED);
+ if (v != 1)
+ abort ();
+
+ __atomic_fetch_add (&v, count, __ATOMIC_CONSUME);
+ if (v != 2)
+ abort ();
+
+ __atomic_add_fetch (&v, 1 , __ATOMIC_ACQUIRE);
+ if (v != 3)
+ abort ();
+
+ __atomic_fetch_add (&v, 1, __ATOMIC_RELEASE);
+ if (v != 4)
+ abort ();
+
+ __atomic_add_fetch (&v, count, __ATOMIC_ACQ_REL);
+ if (v != 5)
+ abort ();
+
+ __atomic_fetch_add (&v, count, __ATOMIC_SEQ_CST);
+ if (v != 6)
+ abort ();
+}
+
+
+void
+test_sub()
+{
+ v = res = 20;
+ count = 0;
+
+ __atomic_sub_fetch (&v, count + 1, __ATOMIC_RELAXED);
+ if (v != --res)
+ abort ();
+
+ __atomic_fetch_sub (&v, count + 1, __ATOMIC_CONSUME);
+ if (v != --res)
+ abort ();
+
+ __atomic_sub_fetch (&v, 1, __ATOMIC_ACQUIRE);
+ if (v != --res)
+ abort ();
+
+ __atomic_fetch_sub (&v, 1, __ATOMIC_RELEASE);
+ if (v != --res)
+ abort ();
+
+ __atomic_sub_fetch (&v, count + 1, __ATOMIC_ACQ_REL);
+ if (v != --res)
+ abort ();
+
+ __atomic_fetch_sub (&v, count + 1, __ATOMIC_SEQ_CST);
+ if (v != --res)
+ abort ();
+}
+
+void
+test_and ()
+{
+ v = init;
+
+ __atomic_and_fetch (&v, 0, __ATOMIC_RELAXED);
+ if (v != 0)
+ abort ();
+
+ v = init;
+ __atomic_fetch_and (&v, init, __ATOMIC_CONSUME);
+ if (v != init)
+ abort ();
+
+ __atomic_and_fetch (&v, 0, __ATOMIC_ACQUIRE);
+ if (v != 0)
+ abort ();
+
+ v = ~v;
+ __atomic_fetch_and (&v, init, __ATOMIC_RELEASE);
+ if (v != init)
+ abort ();
+
+ __atomic_and_fetch (&v, 0, __ATOMIC_ACQ_REL);
+ if (v != 0)
+ abort ();
+
+ v = ~v;
+ __atomic_fetch_and (&v, 0, __ATOMIC_SEQ_CST);
+ if (v != 0)
+ abort ();
+}
+
+void
+test_nand ()
+{
+ v = init;
+
+ __atomic_fetch_nand (&v, 0, __ATOMIC_RELAXED);
+ if (v != init)
+ abort ();
+
+ __atomic_fetch_nand (&v, init, __ATOMIC_CONSUME);
+ if (v != 0)
+ abort ();
+
+ __atomic_nand_fetch (&v, 0, __ATOMIC_ACQUIRE);
+ if (v != init)
+ abort ();
+
+ __atomic_nand_fetch (&v, init, __ATOMIC_RELEASE);
+ if (v != 0)
+ abort ();
+
+ __atomic_fetch_nand (&v, init, __ATOMIC_ACQ_REL);
+ if (v != init)
+ abort ();
+
+ __atomic_nand_fetch (&v, 0, __ATOMIC_SEQ_CST);
+ if (v != init)
+ abort ();
+}
+
+
+
+void
+test_xor ()
+{
+ v = init;
+ count = 0;
+
+ __atomic_xor_fetch (&v, count, __ATOMIC_RELAXED);
+ if (v != init)
+ abort ();
+
+ __atomic_fetch_xor (&v, ~count, __ATOMIC_CONSUME);
+ if (v != 0)
+ abort ();
+
+ __atomic_xor_fetch (&v, 0, __ATOMIC_ACQUIRE);
+ if (v != 0)
+ abort ();
+
+ __atomic_fetch_xor (&v, ~count, __ATOMIC_RELEASE);
+ if (v != init)
+ abort ();
+
+ __atomic_fetch_xor (&v, 0, __ATOMIC_ACQ_REL);
+ if (v != init)
+ abort ();
+
+ __atomic_xor_fetch (&v, ~count, __ATOMIC_SEQ_CST);
+ if (v != 0)
+ abort ();
+}
+
+void
+test_or ()
+{
+ v = 0;
+ count = 1;
+
+ __atomic_or_fetch (&v, count, __ATOMIC_RELAXED);
+ if (v != 1)
+ abort ();
+
+ count *= 2;
+ __atomic_fetch_or (&v, count, __ATOMIC_CONSUME);
+ if (v != 3)
+ abort ();
+
+ count *= 2;
+ __atomic_or_fetch (&v, 4, __ATOMIC_ACQUIRE);
+ if (v != 7)
+ abort ();
+
+ count *= 2;
+ __atomic_fetch_or (&v, 8, __ATOMIC_RELEASE);
+ if (v != 15)
+ abort ();
+
+ count *= 2;
+ __atomic_or_fetch (&v, count, __ATOMIC_ACQ_REL);
+ if (v != 31)
+ abort ();
+
+ count *= 2;
+ __atomic_fetch_or (&v, count, __ATOMIC_SEQ_CST);
+ if (v != 63)
+ abort ();
+}
+
+main ()
+{
+ test_fetch_add ();
+ test_fetch_sub ();
+ test_fetch_and ();
+ test_fetch_nand ();
+ test_fetch_xor ();
+ test_fetch_or ();
+
+ test_add_fetch ();
+ test_sub_fetch ();
+ test_and_fetch ();
+ test_nand_fetch ();
+ test_xor_fetch ();
+ test_or_fetch ();
+
+ test_add ();
+ test_sub ();
+ test_and ();
+ test_nand ();
+ test_xor ();
+ test_or ();
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/atomic-op-5.c b/gcc/testsuite/gcc.dg/atomic-op-5.c
new file mode 100644
index 00000000000..2ca71adc8f1
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/atomic-op-5.c
@@ -0,0 +1,555 @@
+/* Test __atomic routines for existence and proper execution on 16 byte
+ values with each valid memory model. */
+/* { dg-do run } */
+/* { dg-require-effective-target sync_int_128 } */
+/* { dg-options "-mcx16" { target { x86_64-*-* } } } */
+
+/* Test the execution of the __atomic_*OP builtin routines for an int_128. */
+
+extern void abort(void);
+
+__int128_t v, count, res;
+const __int128_t init = ~0;
+
+/* The fetch_op routines return the original value before the operation. */
+
+void
+test_fetch_add ()
+{
+ v = 0;
+ count = 1;
+
+ if (__atomic_fetch_add (&v, count, __ATOMIC_RELAXED) != 0)
+ abort ();
+
+ if (__atomic_fetch_add (&v, 1, __ATOMIC_CONSUME) != 1)
+ abort ();
+
+ if (__atomic_fetch_add (&v, count, __ATOMIC_ACQUIRE) != 2)
+ abort ();
+
+ if (__atomic_fetch_add (&v, 1, __ATOMIC_RELEASE) != 3)
+ abort ();
+
+ if (__atomic_fetch_add (&v, count, __ATOMIC_ACQ_REL) != 4)
+ abort ();
+
+ if (__atomic_fetch_add (&v, 1, __ATOMIC_SEQ_CST) != 5)
+ abort ();
+}
+
+
+void
+test_fetch_sub()
+{
+ v = res = 20;
+ count = 0;
+
+ if (__atomic_fetch_sub (&v, count + 1, __ATOMIC_RELAXED) != res--)
+ abort ();
+
+ if (__atomic_fetch_sub (&v, 1, __ATOMIC_CONSUME) != res--)
+ abort ();
+
+ if (__atomic_fetch_sub (&v, count + 1, __ATOMIC_ACQUIRE) != res--)
+ abort ();
+
+ if (__atomic_fetch_sub (&v, 1, __ATOMIC_RELEASE) != res--)
+ abort ();
+
+ if (__atomic_fetch_sub (&v, count + 1, __ATOMIC_ACQ_REL) != res--)
+ abort ();
+
+ if (__atomic_fetch_sub (&v, 1, __ATOMIC_SEQ_CST) != res--)
+ abort ();
+}
+
+void
+test_fetch_and ()
+{
+ v = init;
+
+ if (__atomic_fetch_and (&v, 0, __ATOMIC_RELAXED) != init)
+ abort ();
+
+ if (__atomic_fetch_and (&v, init, __ATOMIC_CONSUME) != 0)
+ abort ();
+
+ if (__atomic_fetch_and (&v, 0, __ATOMIC_ACQUIRE) != 0)
+ abort ();
+
+ v = ~v;
+ if (__atomic_fetch_and (&v, init, __ATOMIC_RELEASE) != init)
+ abort ();
+
+ if (__atomic_fetch_and (&v, 0, __ATOMIC_ACQ_REL) != init)
+ abort ();
+
+ if (__atomic_fetch_and (&v, 0, __ATOMIC_SEQ_CST) != 0)
+ abort ();
+}
+
+void
+test_fetch_nand ()
+{
+ v = init;
+
+ if (__atomic_fetch_nand (&v, 0, __ATOMIC_RELAXED) != init)
+ abort ();
+
+ if (__atomic_fetch_nand (&v, init, __ATOMIC_CONSUME) != init)
+ abort ();
+
+ if (__atomic_fetch_nand (&v, 0, __ATOMIC_ACQUIRE) != 0 )
+ abort ();
+
+ if (__atomic_fetch_nand (&v, init, __ATOMIC_RELEASE) != init)
+ abort ();
+
+ if (__atomic_fetch_nand (&v, init, __ATOMIC_ACQ_REL) != 0)
+ abort ();
+
+ if (__atomic_fetch_nand (&v, 0, __ATOMIC_SEQ_CST) != init)
+ abort ();
+}
+
+void
+test_fetch_xor ()
+{
+ v = init;
+ count = 0;
+
+ if (__atomic_fetch_xor (&v, count, __ATOMIC_RELAXED) != init)
+ abort ();
+
+ if (__atomic_fetch_xor (&v, ~count, __ATOMIC_CONSUME) != init)
+ abort ();
+
+ if (__atomic_fetch_xor (&v, 0, __ATOMIC_ACQUIRE) != 0)
+ abort ();
+
+ if (__atomic_fetch_xor (&v, ~count, __ATOMIC_RELEASE) != 0)
+ abort ();
+
+ if (__atomic_fetch_xor (&v, 0, __ATOMIC_ACQ_REL) != init)
+ abort ();
+
+ if (__atomic_fetch_xor (&v, ~count, __ATOMIC_SEQ_CST) != init)
+ abort ();
+}
+
+void
+test_fetch_or ()
+{
+ v = 0;
+ count = 1;
+
+ if (__atomic_fetch_or (&v, count, __ATOMIC_RELAXED) != 0)
+ abort ();
+
+ count *= 2;
+ if (__atomic_fetch_or (&v, 2, __ATOMIC_CONSUME) != 1)
+ abort ();
+
+ count *= 2;
+ if (__atomic_fetch_or (&v, count, __ATOMIC_ACQUIRE) != 3)
+ abort ();
+
+ count *= 2;
+ if (__atomic_fetch_or (&v, 8, __ATOMIC_RELEASE) != 7)
+ abort ();
+
+ count *= 2;
+ if (__atomic_fetch_or (&v, count, __ATOMIC_ACQ_REL) != 15)
+ abort ();
+
+ count *= 2;
+ if (__atomic_fetch_or (&v, count, __ATOMIC_SEQ_CST) != 31)
+ abort ();
+}
+
+/* The OP_fetch routines return the new value after the operation. */
+
+void
+test_add_fetch ()
+{
+ v = 0;
+ count = 1;
+
+ if (__atomic_add_fetch (&v, count, __ATOMIC_RELAXED) != 1)
+ abort ();
+
+ if (__atomic_add_fetch (&v, 1, __ATOMIC_CONSUME) != 2)
+ abort ();
+
+ if (__atomic_add_fetch (&v, count, __ATOMIC_ACQUIRE) != 3)
+ abort ();
+
+ if (__atomic_add_fetch (&v, 1, __ATOMIC_RELEASE) != 4)
+ abort ();
+
+ if (__atomic_add_fetch (&v, count, __ATOMIC_ACQ_REL) != 5)
+ abort ();
+
+ if (__atomic_add_fetch (&v, count, __ATOMIC_SEQ_CST) != 6)
+ abort ();
+}
+
+
+void
+test_sub_fetch ()
+{
+ v = res = 20;
+ count = 0;
+
+ if (__atomic_sub_fetch (&v, count + 1, __ATOMIC_RELAXED) != --res)
+ abort ();
+
+ if (__atomic_sub_fetch (&v, 1, __ATOMIC_CONSUME) != --res)
+ abort ();
+
+ if (__atomic_sub_fetch (&v, count + 1, __ATOMIC_ACQUIRE) != --res)
+ abort ();
+
+ if (__atomic_sub_fetch (&v, 1, __ATOMIC_RELEASE) != --res)
+ abort ();
+
+ if (__atomic_sub_fetch (&v, count + 1, __ATOMIC_ACQ_REL) != --res)
+ abort ();
+
+ if (__atomic_sub_fetch (&v, count + 1, __ATOMIC_SEQ_CST) != --res)
+ abort ();
+}
+
+void
+test_and_fetch ()
+{
+ v = init;
+
+ if (__atomic_and_fetch (&v, 0, __ATOMIC_RELAXED) != 0)
+ abort ();
+
+ v = init;
+ if (__atomic_and_fetch (&v, init, __ATOMIC_CONSUME) != init)
+ abort ();
+
+ if (__atomic_and_fetch (&v, 0, __ATOMIC_ACQUIRE) != 0)
+ abort ();
+
+ v = ~v;
+ if (__atomic_and_fetch (&v, init, __ATOMIC_RELEASE) != init)
+ abort ();
+
+ if (__atomic_and_fetch (&v, 0, __ATOMIC_ACQ_REL) != 0)
+ abort ();
+
+ v = ~v;
+ if (__atomic_and_fetch (&v, 0, __ATOMIC_SEQ_CST) != 0)
+ abort ();
+}
+
+void
+test_nand_fetch ()
+{
+ v = init;
+
+ if (__atomic_nand_fetch (&v, 0, __ATOMIC_RELAXED) != init)
+ abort ();
+
+ if (__atomic_nand_fetch (&v, init, __ATOMIC_CONSUME) != 0)
+ abort ();
+
+ if (__atomic_nand_fetch (&v, 0, __ATOMIC_ACQUIRE) != init)
+ abort ();
+
+ if (__atomic_nand_fetch (&v, init, __ATOMIC_RELEASE) != 0)
+ abort ();
+
+ if (__atomic_nand_fetch (&v, init, __ATOMIC_ACQ_REL) != init)
+ abort ();
+
+ if (__atomic_nand_fetch (&v, 0, __ATOMIC_SEQ_CST) != init)
+ abort ();
+}
+
+
+
+void
+test_xor_fetch ()
+{
+ v = init;
+ count = 0;
+
+ if (__atomic_xor_fetch (&v, count, __ATOMIC_RELAXED) != init)
+ abort ();
+
+ if (__atomic_xor_fetch (&v, ~count, __ATOMIC_CONSUME) != 0)
+ abort ();
+
+ if (__atomic_xor_fetch (&v, 0, __ATOMIC_ACQUIRE) != 0)
+ abort ();
+
+ if (__atomic_xor_fetch (&v, ~count, __ATOMIC_RELEASE) != init)
+ abort ();
+
+ if (__atomic_xor_fetch (&v, 0, __ATOMIC_ACQ_REL) != init)
+ abort ();
+
+ if (__atomic_xor_fetch (&v, ~count, __ATOMIC_SEQ_CST) != 0)
+ abort ();
+}
+
+void
+test_or_fetch ()
+{
+ v = 0;
+ count = 1;
+
+ if (__atomic_or_fetch (&v, count, __ATOMIC_RELAXED) != 1)
+ abort ();
+
+ count *= 2;
+ if (__atomic_or_fetch (&v, 2, __ATOMIC_CONSUME) != 3)
+ abort ();
+
+ count *= 2;
+ if (__atomic_or_fetch (&v, count, __ATOMIC_ACQUIRE) != 7)
+ abort ();
+
+ count *= 2;
+ if (__atomic_or_fetch (&v, 8, __ATOMIC_RELEASE) != 15)
+ abort ();
+
+ count *= 2;
+ if (__atomic_or_fetch (&v, count, __ATOMIC_ACQ_REL) != 31)
+ abort ();
+
+ count *= 2;
+ if (__atomic_or_fetch (&v, count, __ATOMIC_SEQ_CST) != 63)
+ abort ();
+}
+
+
+/* Test the OP routines with a result which isn't used. Use both variations
+ within each function. */
+
+void
+test_add ()
+{
+ v = 0;
+ count = 1;
+
+ __atomic_add_fetch (&v, count, __ATOMIC_RELAXED);
+ if (v != 1)
+ abort ();
+
+ __atomic_fetch_add (&v, count, __ATOMIC_CONSUME);
+ if (v != 2)
+ abort ();
+
+ __atomic_add_fetch (&v, 1 , __ATOMIC_ACQUIRE);
+ if (v != 3)
+ abort ();
+
+ __atomic_fetch_add (&v, 1, __ATOMIC_RELEASE);
+ if (v != 4)
+ abort ();
+
+ __atomic_add_fetch (&v, count, __ATOMIC_ACQ_REL);
+ if (v != 5)
+ abort ();
+
+ __atomic_fetch_add (&v, count, __ATOMIC_SEQ_CST);
+ if (v != 6)
+ abort ();
+}
+
+
+void
+test_sub()
+{
+ v = res = 20;
+ count = 0;
+
+ __atomic_sub_fetch (&v, count + 1, __ATOMIC_RELAXED);
+ if (v != --res)
+ abort ();
+
+ __atomic_fetch_sub (&v, count + 1, __ATOMIC_CONSUME);
+ if (v != --res)
+ abort ();
+
+ __atomic_sub_fetch (&v, 1, __ATOMIC_ACQUIRE);
+ if (v != --res)
+ abort ();
+
+ __atomic_fetch_sub (&v, 1, __ATOMIC_RELEASE);
+ if (v != --res)
+ abort ();
+
+ __atomic_sub_fetch (&v, count + 1, __ATOMIC_ACQ_REL);
+ if (v != --res)
+ abort ();
+
+ __atomic_fetch_sub (&v, count + 1, __ATOMIC_SEQ_CST);
+ if (v != --res)
+ abort ();
+}
+
+void
+test_and ()
+{
+ v = init;
+
+ __atomic_and_fetch (&v, 0, __ATOMIC_RELAXED);
+ if (v != 0)
+ abort ();
+
+ v = init;
+ __atomic_fetch_and (&v, init, __ATOMIC_CONSUME);
+ if (v != init)
+ abort ();
+
+ __atomic_and_fetch (&v, 0, __ATOMIC_ACQUIRE);
+ if (v != 0)
+ abort ();
+
+ v = ~v;
+ __atomic_fetch_and (&v, init, __ATOMIC_RELEASE);
+ if (v != init)
+ abort ();
+
+ __atomic_and_fetch (&v, 0, __ATOMIC_ACQ_REL);
+ if (v != 0)
+ abort ();
+
+ v = ~v;
+ __atomic_fetch_and (&v, 0, __ATOMIC_SEQ_CST);
+ if (v != 0)
+ abort ();
+}
+
+void
+test_nand ()
+{
+ v = init;
+
+ __atomic_fetch_nand (&v, 0, __ATOMIC_RELAXED);
+ if (v != init)
+ abort ();
+
+ __atomic_fetch_nand (&v, init, __ATOMIC_CONSUME);
+ if (v != 0)
+ abort ();
+
+ __atomic_nand_fetch (&v, 0, __ATOMIC_ACQUIRE);
+ if (v != init)
+ abort ();
+
+ __atomic_nand_fetch (&v, init, __ATOMIC_RELEASE);
+ if (v != 0)
+ abort ();
+
+ __atomic_fetch_nand (&v, init, __ATOMIC_ACQ_REL);
+ if (v != init)
+ abort ();
+
+ __atomic_nand_fetch (&v, 0, __ATOMIC_SEQ_CST);
+ if (v != init)
+ abort ();
+}
+
+
+
+void
+test_xor ()
+{
+ v = init;
+ count = 0;
+
+ __atomic_xor_fetch (&v, count, __ATOMIC_RELAXED);
+ if (v != init)
+ abort ();
+
+ __atomic_fetch_xor (&v, ~count, __ATOMIC_CONSUME);
+ if (v != 0)
+ abort ();
+
+ __atomic_xor_fetch (&v, 0, __ATOMIC_ACQUIRE);
+ if (v != 0)
+ abort ();
+
+ __atomic_fetch_xor (&v, ~count, __ATOMIC_RELEASE);
+ if (v != init)
+ abort ();
+
+ __atomic_fetch_xor (&v, 0, __ATOMIC_ACQ_REL);
+ if (v != init)
+ abort ();
+
+ __atomic_xor_fetch (&v, ~count, __ATOMIC_SEQ_CST);
+ if (v != 0)
+ abort ();
+}
+
+void
+test_or ()
+{
+ v = 0;
+ count = 1;
+
+ __atomic_or_fetch (&v, count, __ATOMIC_RELAXED);
+ if (v != 1)
+ abort ();
+
+ count *= 2;
+ __atomic_fetch_or (&v, count, __ATOMIC_CONSUME);
+ if (v != 3)
+ abort ();
+
+ count *= 2;
+ __atomic_or_fetch (&v, 4, __ATOMIC_ACQUIRE);
+ if (v != 7)
+ abort ();
+
+ count *= 2;
+ __atomic_fetch_or (&v, 8, __ATOMIC_RELEASE);
+ if (v != 15)
+ abort ();
+
+ count *= 2;
+ __atomic_or_fetch (&v, count, __ATOMIC_ACQ_REL);
+ if (v != 31)
+ abort ();
+
+ count *= 2;
+ __atomic_fetch_or (&v, count, __ATOMIC_SEQ_CST);
+ if (v != 63)
+ abort ();
+}
+
+main ()
+{
+ test_fetch_add ();
+ test_fetch_sub ();
+ test_fetch_and ();
+ test_fetch_nand ();
+ test_fetch_xor ();
+ test_fetch_or ();
+
+ test_add_fetch ();
+ test_sub_fetch ();
+ test_and_fetch ();
+ test_nand_fetch ();
+ test_xor_fetch ();
+ test_or_fetch ();
+
+ test_add ();
+ test_sub ();
+ test_and ();
+ test_nand ();
+ test_xor ();
+ test_or ();
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/atomic-param.c b/gcc/testsuite/gcc.dg/atomic-param.c
new file mode 100644
index 00000000000..a1bfc6be87c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/atomic-param.c
@@ -0,0 +1,13 @@
+/* Test __atomic routines for invalid memory model errors. This only needs
+ to be tested on a single size. */
+/* { dg-do compile } */
+/* { dg-require-effective-target sync_int_long } */
+
+int i;
+
+main ()
+{
+
+ __atomic_exchange_n (&i, 1); /* { dg-error "too few arguments" } */
+ __atomic_exchange_n (&i, 1, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST); /* { dg-error "too many arguments" } */
+}
diff --git a/gcc/testsuite/gcc.dg/atomic-store-1.c b/gcc/testsuite/gcc.dg/atomic-store-1.c
new file mode 100644
index 00000000000..f99eb9c844f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/atomic-store-1.c
@@ -0,0 +1,47 @@
+/* Test __atomic routines for existence and proper execution on 1 byte
+ values with each valid memory model. */
+/* { dg-do run } */
+/* { dg-require-effective-target sync_char_short } */
+
+/* Test the execution of the __atomic_store_n builtin for a char. */
+
+extern void abort(void);
+
+char v, count;
+
+main ()
+{
+ v = 0;
+ count = 0;
+
+ __atomic_store_n (&v, count + 1, __ATOMIC_RELAXED);
+ if (v != ++count)
+ abort ();
+
+ __atomic_store_n (&v, count + 1, __ATOMIC_RELEASE);
+ if (v != ++count)
+ abort ();
+
+ __atomic_store_n (&v, count + 1, __ATOMIC_SEQ_CST);
+ if (v != ++count)
+ abort ();
+
+ /* Now test the generic variant. */
+ count++;
+
+ __atomic_store (&v, &count, __ATOMIC_RELAXED);
+ if (v != count++)
+ abort ();
+
+ __atomic_store (&v, &count, __ATOMIC_RELEASE);
+ if (v != count++)
+ abort ();
+
+ __atomic_store (&v, &count, __ATOMIC_SEQ_CST);
+ if (v != count)
+ abort ();
+
+
+ return 0;
+}
+
diff --git a/gcc/testsuite/gcc.dg/atomic-store-2.c b/gcc/testsuite/gcc.dg/atomic-store-2.c
new file mode 100644
index 00000000000..da346fd7de4
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/atomic-store-2.c
@@ -0,0 +1,46 @@
+/* Test __atomic routines for existence and proper execution on 2 byte
+ values with each valid memory model. */
+/* { dg-do run } */
+/* { dg-require-effective-target sync_char_short } */
+
+/* Test the execution of the __atomic_store_n builtin for a short. */
+
+extern void abort(void);
+
+short v, count;
+
+main ()
+{
+ v = 0;
+ count = 0;
+
+ __atomic_store_n (&v, count + 1, __ATOMIC_RELAXED);
+ if (v != ++count)
+ abort ();
+
+ __atomic_store_n (&v, count + 1, __ATOMIC_RELEASE);
+ if (v != ++count)
+ abort ();
+
+ __atomic_store_n (&v, count + 1, __ATOMIC_SEQ_CST);
+ if (v != ++count)
+ abort ();
+
+ /* Now test the generic variant. */
+ count++;
+
+ __atomic_store (&v, &count, __ATOMIC_RELAXED);
+ if (v != count++)
+ abort ();
+
+ __atomic_store (&v, &count, __ATOMIC_RELEASE);
+ if (v != count++)
+ abort ();
+
+ __atomic_store (&v, &count, __ATOMIC_SEQ_CST);
+ if (v != count)
+ abort ();
+
+ return 0;
+}
+
diff --git a/gcc/testsuite/gcc.dg/atomic-store-3.c b/gcc/testsuite/gcc.dg/atomic-store-3.c
new file mode 100644
index 00000000000..b691da4592f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/atomic-store-3.c
@@ -0,0 +1,47 @@
+/* Test __atomic routines for existence and proper execution on 4 byte
+ values with each valid memory model. */
+/* { dg-do run } */
+/* { dg-require-effective-target sync_int_long } */
+
+/* Test the execution of the __atomic_store_n builtin for an int. */
+
+extern void abort(void);
+
+int v, count;
+
+main ()
+{
+ v = 0;
+ count = 0;
+
+ __atomic_store_n (&v, count + 1, __ATOMIC_RELAXED);
+ if (v != ++count)
+ abort ();
+
+ __atomic_store_n (&v, count + 1, __ATOMIC_RELEASE);
+ if (v != ++count)
+ abort ();
+
+ __atomic_store_n (&v, count + 1, __ATOMIC_SEQ_CST);
+ if (v != ++count)
+ abort ();
+
+ /* Now test the generic variant. */
+ count++;
+
+ __atomic_store (&v, &count, __ATOMIC_RELAXED);
+ if (v != count++)
+ abort ();
+
+ __atomic_store (&v, &count, __ATOMIC_RELEASE);
+ if (v != count++)
+ abort ();
+
+ __atomic_store (&v, &count, __ATOMIC_SEQ_CST);
+ if (v != count)
+ abort ();
+
+
+ return 0;
+}
+
diff --git a/gcc/testsuite/gcc.dg/atomic-store-4.c b/gcc/testsuite/gcc.dg/atomic-store-4.c
new file mode 100644
index 00000000000..f77e1831ad8
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/atomic-store-4.c
@@ -0,0 +1,48 @@
+/* Test __atomic routines for existence and proper execution on 8 byte
+ values with each valid memory model. */
+/* { dg-do run } */
+/* { dg-require-effective-target sync_long_long } */
+/* { dg-options "" } */
+
+/* Test the execution of the __atomic_store_n builtin for a long long. */
+
+extern void abort(void);
+
+long long v, count;
+
+main ()
+{
+ v = 0;
+ count = 0;
+
+ __atomic_store_n (&v, count + 1, __ATOMIC_RELAXED);
+ if (v != ++count)
+ abort ();
+
+ __atomic_store_n (&v, count + 1, __ATOMIC_RELEASE);
+ if (v != ++count)
+ abort ();
+
+ __atomic_store_n (&v, count + 1, __ATOMIC_SEQ_CST);
+ if (v != ++count)
+ abort ();
+
+ /* Now test the generic variant. */
+ count++;
+
+ __atomic_store (&v, &count, __ATOMIC_RELAXED);
+ if (v != count++)
+ abort ();
+
+ __atomic_store (&v, &count, __ATOMIC_RELEASE);
+ if (v != count++)
+ abort ();
+
+ __atomic_store (&v, &count, __ATOMIC_SEQ_CST);
+ if (v != count)
+ abort ();
+
+
+ return 0;
+}
+
diff --git a/gcc/testsuite/gcc.dg/atomic-store-5.c b/gcc/testsuite/gcc.dg/atomic-store-5.c
new file mode 100644
index 00000000000..f976a052c7c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/atomic-store-5.c
@@ -0,0 +1,48 @@
+/* Test __atomic routines for existence and proper execution on 16 byte
+ values with each valid memory model. */
+/* { dg-do run } */
+/* { dg-require-effective-target sync_int_128 } */
+/* { dg-options "-mcx16" { target { x86_64-*-* } } } */
+
+/* Test the execution of the __atomic_store_n builtin for a 16 byte value. */
+
+extern void abort(void);
+
+__int128_t v, count;
+
+main ()
+{
+ v = 0;
+ count = 0;
+
+ __atomic_store_n (&v, count + 1, __ATOMIC_RELAXED);
+ if (v != ++count)
+ abort ();
+
+ __atomic_store_n (&v, count + 1, __ATOMIC_RELEASE);
+ if (v != ++count)
+ abort ();
+
+ __atomic_store_n (&v, count + 1, __ATOMIC_SEQ_CST);
+ if (v != ++count)
+ abort ();
+
+ /* Now test the generic variant. */
+ count++;
+
+ __atomic_store (&v, &count, __ATOMIC_RELAXED);
+ if (v != count++)
+ abort ();
+
+ __atomic_store (&v, &count, __ATOMIC_RELEASE);
+ if (v != count++)
+ abort ();
+
+ __atomic_store (&v, &count, __ATOMIC_SEQ_CST);
+ if (v != count)
+ abort ();
+
+
+ return 0;
+}
+
diff --git a/gcc/testsuite/gcc.dg/builtin-apply2.c b/gcc/testsuite/gcc.dg/builtin-apply2.c
index 047a1e85449..c5b841a8496 100644
--- a/gcc/testsuite/gcc.dg/builtin-apply2.c
+++ b/gcc/testsuite/gcc.dg/builtin-apply2.c
@@ -12,7 +12,7 @@
#define INTEGER_ARG 5
-#ifdef __ARM_PCS
+#if defined(__ARM_PCS) || defined(__epiphany__)
/* For Base AAPCS, NAME is passed in r0. D is passed in r2 and r3.
E, F and G are passed on stack. So the size of the stack argument
data is 20. */
diff --git a/gcc/testsuite/gcc.dg/c1x-align-1.c b/gcc/testsuite/gcc.dg/c1x-align-1.c
new file mode 100644
index 00000000000..9fe5757bed0
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/c1x-align-1.c
@@ -0,0 +1,41 @@
+/* Test C1X alignment support. Test valid code. */
+/* { dg-do compile } */
+/* { dg-options "-std=c1x -pedantic-errors" } */
+
+#include <stddef.h>
+
+_Alignas (_Alignof (max_align_t)) char c;
+extern _Alignas (max_align_t) char c;
+extern char c;
+
+extern _Alignas (max_align_t) short s;
+_Alignas (max_align_t) short s;
+
+_Alignas (int) int i;
+extern int i;
+
+_Alignas (max_align_t) long l;
+
+_Alignas (max_align_t) long long ll;
+
+_Alignas (max_align_t) float f;
+
+_Alignas (max_align_t) double d;
+
+_Alignas (max_align_t) _Complex long double cld;
+
+_Alignas (0) _Alignas (int) _Alignas (char) char ca[10];
+
+_Alignas ((int) _Alignof (max_align_t) + 0) int x;
+
+enum e { E = _Alignof (max_align_t) };
+_Alignas (E) int y;
+
+void
+func (void)
+{
+ _Alignas (max_align_t) long long auto_ll;
+}
+
+/* Valid, but useless. */
+_Alignas (0) struct s; /* { dg-warning "useless" } */
diff --git a/gcc/testsuite/gcc.dg/c1x-align-2.c b/gcc/testsuite/gcc.dg/c1x-align-2.c
new file mode 100644
index 00000000000..19f7dd67214
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/c1x-align-2.c
@@ -0,0 +1,92 @@
+/* Test C1X alignment support. Test valid code using stdalign.h. */
+/* { dg-do run } */
+/* { dg-options "-std=c1x -pedantic-errors" } */
+
+#include <stdalign.h>
+#include <stddef.h>
+
+extern int strcmp (const char *, const char *);
+
+extern void exit (int);
+extern void abort (void);
+
+alignas (alignof (max_align_t)) char c;
+extern alignas (max_align_t) char c;
+extern char c;
+
+extern alignas (max_align_t) short s;
+alignas (max_align_t) short s;
+
+alignas (int) int i;
+extern int i;
+
+alignas (max_align_t) long l;
+
+alignas (max_align_t) long long ll;
+
+alignas (max_align_t) float f;
+
+alignas (max_align_t) double d;
+
+alignas (max_align_t) _Complex long double cld;
+
+alignas (0) alignas (int) alignas (char) char ca[10];
+
+alignas ((int) alignof (max_align_t) + 0) int x;
+
+enum e { E = alignof (max_align_t) };
+alignas (E) int y;
+
+void
+func (void)
+{
+ alignas (max_align_t) long long auto_ll;
+}
+
+/* Valid, but useless. */
+alignas (0) struct s; /* { dg-warning "useless" } */
+
+#ifndef alignas
+#error "alignas not defined"
+#endif
+
+#ifndef alignof
+#error "alignof not defined"
+#endif
+
+#ifndef __alignas_is_defined
+#error "__alignas_is_defined not defined"
+#endif
+
+#if __alignas_is_defined != 1
+#error "__alignas_is_defined not 1"
+#endif
+
+#ifndef __alignof_is_defined
+#error "__alignof_is_defined not defined"
+#endif
+
+#if __alignof_is_defined != 1
+#error "__alignof_is_defined not 1"
+#endif
+
+#define str(x) #x
+#define xstr(x) str(x)
+
+const char *s1 = xstr(alignas);
+const char *s2 = xstr(alignof);
+const char *s3 = xstr(__alignas_is_defined);
+const char *s4 = xstr(__alignof_is_defined);
+
+int
+main (void)
+{
+ if (strcmp (s1, "_Alignas") != 0)
+ abort ();
+ if (strcmp (s2, "_Alignof") != 0)
+ abort ();
+ if (strcmp (s3, "1") != 0)
+ abort ();
+ if (strcmp (s4, "1") != 0)
+ abort ();
+}
diff --git a/gcc/testsuite/gcc.dg/c1x-align-3.c b/gcc/testsuite/gcc.dg/c1x-align-3.c
new file mode 100644
index 00000000000..0b2a77fa6fa
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/c1x-align-3.c
@@ -0,0 +1,42 @@
+/* Test C1X alignment support. Test invalid code. */
+/* { dg-do compile } */
+/* { dg-options "-std=c1x -pedantic-errors" } */
+
+int a = _Alignof (void (void)); /* { dg-error "function" } */
+struct s;
+int b = _Alignof (struct s); /* { dg-error "incomplete" } */
+int c = _Alignof (void); /* { dg-error "void" } */
+int d = _Alignof (a); /* { dg-error "expression" } */
+
+_Alignas (void (void)) char e; /* { dg-error "function" } */
+_Alignas (struct s) char f; /* { dg-error "incomplete" } */
+_Alignas (void) char g; /* { dg-error "void" } */
+
+_Alignas (-__INT_MAX__-1) char h; /* { dg-error "too large|power of 2" } */
+_Alignas (-__INT_MAX__) char h2; /* { dg-error "too large|power of 2" } */
+_Alignas ((-__INT_MAX__-1)/2) char h3; /* { dg-error "too large|power of 2" } */
+_Alignas ((-__INT_MAX__-1)/4) char h4; /* { dg-error "too large|power of 2" } */
+_Alignas ((-__INT_MAX__-1)/8) char h5; /* { dg-error "too large|power of 2" } */
+_Alignas (-__LONG_LONG_MAX__-1) char i; /* { dg-error "too large|power of 2" } */
+_Alignas (-(__LONG_LONG_MAX__-1)/2) char i2; /* { dg-error "too large|power of 2" } */
+_Alignas (-(__LONG_LONG_MAX__-1)/4) char i3; /* { dg-error "too large|power of 2" } */
+_Alignas (-(__LONG_LONG_MAX__-1)/8) char i4; /* { dg-error "too large|power of 2" } */
+_Alignas (-(__LONG_LONG_MAX__-1)/16) char i5; /* { dg-error "too large|power of 2" } */
+_Alignas (-1) char j; /* { dg-error "power of 2" } */
+_Alignas (3) char k; /* { dg-error "power of 2" } */
+
+_Alignas ((void *) 1) char k; /* { dg-error "integer constant" } */
+int x;
+_Alignas (x) char l; /* { dg-error "integer constant" } */
+
+_Alignas (0) struct s; /* { dg-error "does not redeclare tag" } */
+
+_Alignas (0) typedef int T; /* { dg-error "alignment specified for typedef" } */
+void func (_Alignas (0) int); /* { dg-error "alignment specified for unnamed parameter" } */
+void f2 (_Alignas (0) int parm2) {} /* { dg-error "alignment specified for parameter" } */
+void
+f3 (void)
+{
+ register _Alignas (0) int reg; /* { dg-error "register" } */
+}
+_Alignas (0) void f4 (void); /* { dg-error "alignment specified for function" } */
diff --git a/gcc/testsuite/gcc.dg/c1x-align-4.c b/gcc/testsuite/gcc.dg/c1x-align-4.c
new file mode 100644
index 00000000000..432650cf5dd
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/c1x-align-4.c
@@ -0,0 +1,8 @@
+/* Test C1X alignment support. Test reducing alignment (assumes there
+ are at least some alignment constraints). */
+/* { dg-do compile } */
+/* { dg-options "-std=c1x -pedantic-errors" } */
+
+#include <stddef.h>
+
+_Alignas (_Alignof (char)) max_align_t x; /* { dg-error "reduce alignment" } */
diff --git a/gcc/testsuite/gcc.dg/c90-align-1.c b/gcc/testsuite/gcc.dg/c90-align-1.c
new file mode 100644
index 00000000000..77510f4e0d9
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/c90-align-1.c
@@ -0,0 +1,6 @@
+/* Test _Alignof and _Alignas not in C90. */
+/* { dg-do compile } */
+/* { dg-options "-std=iso9899:1990 -pedantic-errors" } */
+
+int a = _Alignof (int); /* { dg-error "ISO C90 does not support '_Alignof'" } */
+_Alignas (int) int b; /* { dg-error "ISO C90 does not support '_Alignas'" } */
diff --git a/gcc/testsuite/gcc.dg/c99-align-1.c b/gcc/testsuite/gcc.dg/c99-align-1.c
new file mode 100644
index 00000000000..1fb2cb07110
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/c99-align-1.c
@@ -0,0 +1,6 @@
+/* Test _Alignof and _Alignas not in C99. */
+/* { dg-do compile } */
+/* { dg-options "-std=iso9899:1999 -pedantic-errors" } */
+
+int a = _Alignof (int); /* { dg-error "ISO C99 does not support '_Alignof'" } */
+_Alignas (int) int b; /* { dg-error "ISO C99 does not support '_Alignas'" } */
diff --git a/gcc/testsuite/gcc.dg/gnu89-const-expr-1.c b/gcc/testsuite/gcc.dg/gnu89-const-expr-1.c
index 4fd6671a4db..0cc14da599a 100644
--- a/gcc/testsuite/gcc.dg/gnu89-const-expr-1.c
+++ b/gcc/testsuite/gcc.dg/gnu89-const-expr-1.c
@@ -23,7 +23,7 @@ f (void)
E5 = __imag__ 0,
/* __alignof__ always constant. */
E6 = __alignof__ (int[n]), /* { dg-error "ISO C90 forbids variable length array" } */
- E7 = __alignof__ (a),
+ E7 = __alignof__ (a), /* { dg-error "__alignof__ \\(expression\\)" } */
/* __extension__ ignored for constant expression purposes. */
E8 = __extension__ (1 ? 0 : i++), /* { dg-error "constant expression" } */
E9 = __extension__ 0,
diff --git a/gcc/testsuite/gcc.dg/gnu90-const-expr-1.c b/gcc/testsuite/gcc.dg/gnu90-const-expr-1.c
index 3f7f1af5de0..e052114622c 100644
--- a/gcc/testsuite/gcc.dg/gnu90-const-expr-1.c
+++ b/gcc/testsuite/gcc.dg/gnu90-const-expr-1.c
@@ -23,7 +23,7 @@ f (void)
E5 = __imag__ 0,
/* __alignof__ always constant. */
E6 = __alignof__ (int[n]), /* { dg-error "ISO C90 forbids variable length array" } */
- E7 = __alignof__ (a),
+ E7 = __alignof__ (a), /* { dg-error "__alignof__ \\(expression\\)" } */
/* __extension__ ignored for constant expression purposes. */
E8 = __extension__ (1 ? 0 : i++), /* { dg-error "constant expression" } */
E9 = __extension__ 0,
diff --git a/gcc/testsuite/gcc.dg/gnu99-const-expr-1.c b/gcc/testsuite/gcc.dg/gnu99-const-expr-1.c
index 3f5f25e6d2e..da7076ff899 100644
--- a/gcc/testsuite/gcc.dg/gnu99-const-expr-1.c
+++ b/gcc/testsuite/gcc.dg/gnu99-const-expr-1.c
@@ -23,7 +23,7 @@ f (void)
E5 = __imag__ 0,
/* __alignof__ always constant. */
E6 = __alignof__ (int[n]),
- E7 = __alignof__ (a),
+ E7 = __alignof__ (a), /* { dg-error "__alignof__ \\(expression\\)" } */
/* __extension__ ignored for constant expression purposes. */
E8 = __extension__ (1 ? 0 : i++), /* { dg-error "constant expression" } */
E9 = __extension__ 0,
diff --git a/gcc/testsuite/gcc.dg/gnu99-static-1.c b/gcc/testsuite/gcc.dg/gnu99-static-1.c
index b600a4b1201..3fece615e0e 100644
--- a/gcc/testsuite/gcc.dg/gnu99-static-1.c
+++ b/gcc/testsuite/gcc.dg/gnu99-static-1.c
@@ -11,7 +11,7 @@
/* __alignof__, OK. */
static int f0(void);
-void g0(void) { __alignof__(f0()); }
+void g0(void) { __alignof__(f0()); } /* { dg-error "__alignof__ \\(expression\\)" } */
/* __typeof__ not variably modified, OK. */
static int f1(void);
diff --git a/gcc/testsuite/gcc.dg/gomp/atomic-11.c b/gcc/testsuite/gcc.dg/gomp/atomic-11.c
deleted file mode 100644
index b5647b0bd81..00000000000
--- a/gcc/testsuite/gcc.dg/gomp/atomic-11.c
+++ /dev/null
@@ -1,17 +0,0 @@
-/* PR middle-end/36877 */
-/* { dg-do compile } */
-/* { dg-options "-fopenmp" } */
-/* { dg-options "-fopenmp -march=i386" { target { { i?86-*-* x86_64-*-* } && ia32 } } } */
-
-int i;
-float f;
-
-void foo (void)
-{
-#pragma omp atomic
- i++;
-#pragma omp atomic
- f += 1.0;
-}
-
-/* { dg-final { scan-assembler-not "__sync_(fetch|add|bool|val)" { target i?86-*-* x86_64-*-* powerpc*-*-* ia64-*-* s390*-*-* sparc*-*-* } } } */
diff --git a/gcc/testsuite/gcc.dg/gomp/gomp.exp b/gcc/testsuite/gcc.dg/gomp/gomp.exp
index e4f31cca924..4cb4cafa400 100644
--- a/gcc/testsuite/gcc.dg/gomp/gomp.exp
+++ b/gcc/testsuite/gcc.dg/gomp/gomp.exp
@@ -29,8 +29,7 @@ if ![check_effective_target_fopenmp] {
dg-init
# Main loop.
-dg-runtest [lsort [find $srcdir/$subdir *.c]] \
- "" "-fopenmp"
+dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.c $srcdir/c-c++-common/gomp/*.c]] "" "-fopenmp"
# All done.
dg-finish
diff --git a/gcc/testsuite/gcc.dg/pr50763-5.c b/gcc/testsuite/gcc.dg/pr50763-5.c
new file mode 100644
index 00000000000..e5952d09c86
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr50763-5.c
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -ftree-tail-merge" } */
+
+struct inode
+{
+ unsigned short i_mode;
+ unsigned int i_flags;
+};
+
+static inline int
+is_sxid (unsigned int mode)
+{
+ return (mode & 0004000) || ((mode & 0002000) && (mode & 00010));
+};
+
+void
+gfs2_set_inode_flags (int ip, struct inode *inode)
+{
+ unsigned int flags = inode->i_flags;
+ if ((ip == 0) && !is_sxid (inode->i_mode))
+ inode->i_flags |= 4096;
+ inode->i_flags = flags;
+}
diff --git a/gcc/testsuite/gcc.dg/pr50908-2.c b/gcc/testsuite/gcc.dg/pr50908-2.c
new file mode 100644
index 00000000000..bffea335a70
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr50908-2.c
@@ -0,0 +1,80 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -ftree-tail-merge" } */
+
+typedef struct rtx_def *rtx;
+enum debug_info_levels
+{
+ ARM_FLOAT_ABI_SOFT, ARM_FLOAT_ABI_SOFTFP, ARM_FLOAT_ABI_HARD
+};
+struct gcc_options
+{
+ int x_target_flags;
+};
+extern struct gcc_options global_options;
+extern int arm_arch_thumb2;
+enum rtx_code
+{
+ UNSPEC, UNSPEC_VOLATILE, ADDR_VEC, SET, CLOBBER, CALL, RETURN,
+ SIMPLE_RETURN, EH_RETURN, TRAP_IF, CONST_INT, CONST_FIXED, CONST_DOUBLE,
+ CONST_VECTOR, CONST_STRING, CONST, PC, REG, SCRATCH, SUBREG,
+ STRICT_LOW_PART, CONCAT, CONCATN, MEM, LABEL_REF, SYMBOL_REF, CC0,
+ IF_THEN_ELSE, COMPARE, PLUS, MINUS, NEG, MULT, SS_MULT, US_MULT, DIV,
+ SS_DIV, US_DIV, MOD, UDIV, UMOD, AND, IOR, XOR, NOT, ASHIFT, ROTATE,
+ ASHIFTRT, LSHIFTRT, ROTATERT, PRE_DEC, PRE_INC, POST_DEC, POST_INC,
+ PRE_MODIFY, POST_MODIFY, NE, EQ, GE, GT, LE, LT, GEU, GTU, LEU, LTU,
+ UNORDERED, ORDERED, UNEQ, UNGE, UNGT, UNLE, UNLT, LTGT, SIGN_EXTEND,
+ ZERO_EXTEND, TRUNCATE, FLOAT_EXTEND, FLOAT_TRUNCATE, FLOAT, FIX,
+ UNSIGNED_FLOAT, UNSIGNED_FIX, SIGN_EXTRACT, ZERO_EXTRACT, HIGH, LO_SUM,
+ VEC_MERGE, VEC_SELECT, VEC_CONCAT, VEC_DUPLICATE, SS_PLUS, US_PLUS,
+ SS_MINUS, SS_NEG, US_NEG, SS_ABS, SS_ASHIFT, US_ASHIFT, US_MINUS,
+ SS_TRUNCATE, US_TRUNCATE, FMA, VAR_LOCATION, DEBUG_IMPLICIT_PTR,
+ ENTRY_VALUE, DEBUG_PARAMETER_REF, LAST_AND_UNUSED_RTX_CODE
+};
+union rtunion_def
+{
+};
+struct rtx_def
+{
+ enum rtx_code code:16;
+}
+builtin_info_type;
+enum constraint_num
+{
+ CONSTRAINT__UNKNOWN =
+ 0, CONSTRAINT_f, CONSTRAINT_t, CONSTRAINT_v, CONSTRAINT_w, CONSTRAINT_x,
+ CONSTRAINT_y, CONSTRAINT_z, CONSTRAINT_l, CONSTRAINT_h, CONSTRAINT_j,
+ CONSTRAINT_Pj, CONSTRAINT_PJ, CONSTRAINT_k, CONSTRAINT_b, CONSTRAINT_c,
+ CONSTRAINT_I, CONSTRAINT_J, CONSTRAINT_K, CONSTRAINT_L, CONSTRAINT_M,
+ CONSTRAINT_N, CONSTRAINT_O, CONSTRAINT_Pa, CONSTRAINT_Pb, CONSTRAINT_Pc,
+ CONSTRAINT_Pd, CONSTRAINT_Ps, CONSTRAINT_Pt, CONSTRAINT_Pu, CONSTRAINT_Pv,
+ CONSTRAINT_Pw, CONSTRAINT_Px, CONSTRAINT_Py, CONSTRAINT_G, CONSTRAINT_H,
+ CONSTRAINT_Dz, CONSTRAINT_Da, CONSTRAINT_Db, CONSTRAINT_Dc, CONSTRAINT_Di,
+ CONSTRAINT_Dn, CONSTRAINT_Dl, CONSTRAINT_DL, CONSTRAINT_Dv, CONSTRAINT_Dy,
+ CONSTRAINT_Ut, CONSTRAINT_Uv, CONSTRAINT_Uy, CONSTRAINT_Un, CONSTRAINT_Um,
+ CONSTRAINT_Us, CONSTRAINT_Uq, CONSTRAINT_Q, CONSTRAINT_Uu, CONSTRAINT_Uw,
+ CONSTRAINT__LIMIT
+};
+typedef struct VEC_char_base
+{
+}
+VEC_int_heap;
+static inline int
+satisfies_constraint_j (rtx op)
+{
+ long long ival = 0;
+ return ((((!((global_options.x_target_flags & (1 << 14)) != 0))
+ || arm_arch_thumb2) && arm_arch_thumb2))
+ && ((((enum rtx_code) (op)->code) == HIGH)
+ || ((((enum rtx_code) (op)->code) == CONST_INT)
+ && (((ival & 0xffff0000) == 0))));
+}
+
+int
+constraint_satisfied_p (rtx op, enum constraint_num c)
+{
+ switch (c)
+ {
+ case CONSTRAINT_j:
+ return satisfies_constraint_j (op);
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/pr50908-3.c b/gcc/testsuite/gcc.dg/pr50908-3.c
new file mode 100644
index 00000000000..60db03dae85
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr50908-3.c
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -ftree-tail-merge" } */
+
+extern int v1;
+extern int v2;
+
+void
+f ()
+{
+ if (v2 || v1)
+ (!(v1)) ? (void) 0 : (void) g ();
+}
diff --git a/gcc/testsuite/gcc.dg/pr50908.c b/gcc/testsuite/gcc.dg/pr50908.c
new file mode 100644
index 00000000000..75341f8f105
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr50908.c
@@ -0,0 +1,175 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target lp64 } */
+/* { dg-options "-O2 -ftree-tail-merge" } */
+
+enum Lisp_Type
+{
+ Lisp_Int0 = 0, Lisp_Int1 = 4, Lisp_Symbol = 2, Lisp_Misc = 3, Lisp_String =
+ 1, Lisp_Vectorlike = 5, Lisp_Cons = 6, Lisp_Float = 7,
+};
+typedef long Lisp_Object;
+enum pvec_type
+{
+ PVEC_NORMAL_VECTOR = 0, PVEC_PROCESS = 0x200, PVEC_FRAME =
+ 0x400, PVEC_COMPILED = 0x800, PVEC_WINDOW =
+ 0x1000, PVEC_WINDOW_CONFIGURATION = 0x2000, PVEC_SUBR =
+ 0x4000, PVEC_CHAR_TABLE = 0x8000, PVEC_BOOL_VECTOR =
+ 0x10000, PVEC_BUFFER = 0x20000, PVEC_HASH_TABLE = 0x40000, PVEC_TERMINAL =
+ 0x80000, PVEC_SUB_CHAR_TABLE = 0x100000, PVEC_FONT =
+ 0x200000, PVEC_OTHER = 0x400000, PVEC_TYPE_MASK = 0x7ffe00
+};
+struct Lisp_Vector
+{
+ unsigned long size;
+};
+struct Lisp_Char_Table
+{
+ Lisp_Object defalt;
+ Lisp_Object ascii;
+};
+struct Lisp_Sub_Char_Table
+{
+ Lisp_Object contents[1];
+};
+extern Lisp_Object Qnil, Qt, Qquote, Qlambda, Qsubr, Qunbound;
+struct buffer_text
+{
+ unsigned char *beg;
+ long gpt_byte;
+ long gap_size;
+};
+struct buffer
+{
+ struct buffer_text *text;
+ struct region_cache *width_run_cache;
+ Lisp_Object tab_width;
+ Lisp_Object ctl_arrow;
+};
+extern struct buffer *current_buffer;
+extern Lisp_Object Vchar_width_table;
+struct frame
+{
+ long text_lines, text_cols;
+};
+struct window
+{
+ Lisp_Object frame;
+};
+extern Lisp_Object Vtruncate_partial_width_windows;
+extern struct Lisp_Char_Table *window_display_table (struct window *);
+struct position *
+compute_motion (from, fromvpos, fromhpos, did_motion, to, tovpos, tohpos,
+ width, hscroll, tab_offset, win)
+ long from, fromvpos, fromhpos, to, tovpos, tohpos;
+ struct window *win;
+{
+ register long hpos = fromhpos;
+ register long pos;
+ long pos_byte;
+ register int c = 0;
+ register struct Lisp_Char_Table *dp = window_display_table (win);
+ long wide_column_end_hpos = 0;
+ long continuation_glyph_width;
+ while (1)
+ {
+ if (hpos > width)
+ {
+ int total_width = width + continuation_glyph_width;
+ if (!((Vtruncate_partial_width_windows) == (Qnil))
+ && (total_width <
+ (((void) 0,
+ (struct frame
+ *) ((long) (((win)->frame) & ~((((long) 1) << 3) -
+ 1)))))->text_cols))
+ {
+ if (pos <= to)
+ {
+ pos = find_before_next_newline (pos, to, 1);
+ }
+ if (wide_column_end_hpos > width)
+ {
+ hpos -= width;
+ }
+ }
+ }
+ else
+ {
+ Lisp_Object charvec;
+ c =
+ *(((((pos_byte)) >=
+ (current_buffer->text->gpt_byte) ? (current_buffer->text->
+ gap_size) : 0) +
+ ((pos_byte)) + (current_buffer->text->beg) - ((1))));
+ if (current_buffer->width_run_cache)
+ {
+ if (((((enum Lisp_Type) (((unsigned long) ((charvec))) &
+ ((((long) 1) << 3) - 1))) ==
+ Lisp_Vectorlike)
+ &&
+ !(((void) 0,
+ (struct Lisp_Vector
+ *) ((long) ((charvec) & ~((((long) 1) << 3) - 1))))->
+ size & ((((unsigned long) 1 << (64 - 1)) >> 1)))))
+ {
+ unsigned char *ptr;
+ int bytes, width, wide_column;
+ do
+ {
+ if ((!((*ptr) & 0x80) ? 1 : !((*ptr) & 0x20) ? 2 :
+ !((*ptr) & 0x10) ? 3 : !((*ptr) & 0x08) ? 4 : 5) !=
+ bytes)
+ width = bytes * 4;
+ else
+ {
+ if (dp != 0
+ &&
+ ((((enum
+ Lisp_Type) (((unsigned
+ long) (((((unsigned) (c) <
+ 0x80)
+ ? ((((dp)->ascii) ==
+ (Qnil)) ? (dp)->
+ defalt
+ : (((((enum
+ Lisp_Type)
+ (((unsigned
+ long) (((dp)->ascii))) & ((((long) 1) << 3) - 1))) == Lisp_Vectorlike) && (((((void) 0, (struct Lisp_Vector *) ((long) (((dp)->ascii) & ~((((long) 1) << 3) - 1))))->size & (((((unsigned long) 1 << (64 - 1)) >> 1)) | (PVEC_SUB_CHAR_TABLE)))) == (((((unsigned long) 1 << (64 - 1)) >> 1)) | (PVEC_SUB_CHAR_TABLE)))) ? ((void) 0, (struct Lisp_Sub_Char_Table *) ((long) (((dp)->ascii) & ~((((long) 1) << 3) - 1))))->contents[c] : (dp)->ascii)) : disp_char_vector ((dp), (c)))))) & ((((long) 1) << 3) - 1))) == Lisp_Vectorlike) && !(((void) 0, (struct Lisp_Vector *) ((long) (((((unsigned) (c) < 0x80) ? ((((dp)->ascii) == (Qnil)) ? (dp)->defalt : (((((enum Lisp_Type) (((unsigned long) (((dp)->ascii))) & ((((long) 1) << 3) - 1))) == Lisp_Vectorlike) && (((((void) 0, (struct Lisp_Vector *) ((long) (((dp)->ascii) & ~((((long) 1) << 3) - 1))))->size & (((((unsigned long) 1 << (64 - 1)) >> 1)) | (PVEC_SUB_CHAR_TABLE)))) == (((((unsigned long) 1 << (64 - 1)) >> 1)) | (PVEC_SUB_CHAR_TABLE)))) ? ((void) 0, (struct Lisp_Sub_Char_Table *) ((long) (((dp)->ascii) & ~((((long) 1) << 3) - 1))))->contents[c] : (dp)->ascii)) : disp_char_vector ((dp), (c)))) & ~((((long) 1) << 3) - 1))))->size & ((((unsigned long) 1 << (64 - 1)) >> 1)))))
+ width =
+ ((void) 0,
+ (struct Lisp_Vector
+ *) ((long) (((((unsigned) (c) <
+ 0x80) ? ((((dp)->ascii) ==
+ (Qnil)) ? (dp)->
+ defalt
+ : (((((enum
+ Lisp_Type) (((unsigned long) (((dp)->ascii))) & ((((long) 1) << 3) - 1))) == Lisp_Vectorlike) && (((((void) 0, (struct Lisp_Vector *) ((long) (((dp)->ascii) & ~((((long) 1) << 3) - 1))))->size & (((((unsigned long) 1 << (64 - 1)) >> 1)) | (PVEC_SUB_CHAR_TABLE)))) == (((((unsigned long) 1 << (64 - 1)) >> 1)) | (PVEC_SUB_CHAR_TABLE)))) ? ((void) 0, (struct Lisp_Sub_Char_Table *) ((long) (((dp)->ascii) & ~((((long) 1) << 3) - 1))))->contents[c] : (dp)->ascii)) : disp_char_vector ((dp), (c)))) & ~((((long) 1) << 3) - 1))))->size;
+ else
+ width =
+ (((unsigned) (c) < 0x80) ? (c <
+ 0x20 ? (c ==
+ '\t'
+ ? ((((long)
+ (current_buffer->
+ tab_width))
+ >> (3 -
+ 1)))
+ : (c ==
+ '\n' ? 0
+ : (((current_buffer->ctl_arrow) == (Qnil)) ? 4 : 2))) : (c < 0x7f ? 1 : ((((current_buffer->ctl_arrow) == (Qnil)) ? 4 : 2)))) : (((long) ((((unsigned) (c) < 0x80) ? (
+ {
+ Lisp_Object
+ _val;
+ _val;}
+ ): char_table_ref ((Vchar_width_table), (c))))) >> (3 - 1)));
+ if (width > 1)
+ wide_column = width;
+ }
+ }
+ while (0);
+ if (wide_column)
+ wide_column_end_hpos = hpos + wide_column;
+ }
+ }
+ }
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/pragma-align-2.c b/gcc/testsuite/gcc.dg/pragma-align-2.c
index ac5858cab00..5cdaff9586f 100644
--- a/gcc/testsuite/gcc.dg/pragma-align-2.c
+++ b/gcc/testsuite/gcc.dg/pragma-align-2.c
@@ -1,4 +1,5 @@
/* { dg-do run { target *-*-solaris2.* } } */
+/* { dg-options "-std=gnu99" } */
void abort (void);
diff --git a/gcc/testsuite/gcc.dg/pragma-pack-3.c b/gcc/testsuite/gcc.dg/pragma-pack-3.c
index e276bd007fe..d3843149134 100644
--- a/gcc/testsuite/gcc.dg/pragma-pack-3.c
+++ b/gcc/testsuite/gcc.dg/pragma-pack-3.c
@@ -1,6 +1,7 @@
/* PR c++/25294 */
/* { dg-options "-std=gnu99" } */
-/* { dg-do run } */
+/* Epiphany makes struct S 8-byte aligned. */
+/* { dg-do run { target { ! epiphany-*-* } } } */
extern void abort (void);
diff --git a/gcc/testsuite/gcc.dg/profile-dir-1.c b/gcc/testsuite/gcc.dg/profile-dir-1.c
index 97763721abc..fbe66ad22a8 100644
--- a/gcc/testsuite/gcc.dg/profile-dir-1.c
+++ b/gcc/testsuite/gcc.dg/profile-dir-1.c
@@ -1,6 +1,6 @@
/* { dg-do compile } */
-/* { dg-options "-O -fprofile-generate=. -fdump-ipa-profile" } */
-/* { dg-final { scan-ipa-dump " ./profile-dir-1.gcda" "profile" } } */
+/* { dg-options "-O -fprofile-generate=. -fdump-ipa-cgraph" } */
+/* { dg-final { scan-ipa-dump " ./profile-dir-1.gcda" "cgraph" } } */
int
main(void)
@@ -8,4 +8,4 @@ main(void)
return 0;
}
-/* { dg-final { cleanup-ipa-dump "profile" } } */
+/* { dg-final { cleanup-ipa-dump "cgraph" } } */
diff --git a/gcc/testsuite/gcc.dg/profile-dir-2.c b/gcc/testsuite/gcc.dg/profile-dir-2.c
index d49dcc37605..1708f7b7275 100644
--- a/gcc/testsuite/gcc.dg/profile-dir-2.c
+++ b/gcc/testsuite/gcc.dg/profile-dir-2.c
@@ -1,6 +1,6 @@
/* { dg-do compile } */
-/* { dg-options "-O -fprofile-generate -fdump-ipa-profile" } */
-/* { dg-final { scan-ipa-dump "/profile-dir-2.gcda" "profile" } } */
+/* { dg-options "-O -fprofile-generate -fdump-ipa-cgraph" } */
+/* { dg-final { scan-ipa-dump "/profile-dir-2.gcda" "cgraph" } } */
int
main(void)
@@ -8,4 +8,4 @@ main(void)
return 0;
}
-/* { dg-final { cleanup-ipa-dump "profile" } } */
+/* { dg-final { cleanup-ipa-dump "cgraph" } } */
diff --git a/gcc/testsuite/gcc.dg/profile-dir-3.c b/gcc/testsuite/gcc.dg/profile-dir-3.c
index 0ae329d4698..ccedf0e7447 100644
--- a/gcc/testsuite/gcc.dg/profile-dir-3.c
+++ b/gcc/testsuite/gcc.dg/profile-dir-3.c
@@ -1,6 +1,6 @@
/* { dg-do compile } */
-/* { dg-options "-O -fprofile-generate -fprofile-dir=. -fdump-ipa-profile" } */
-/* { dg-final { scan-ipa-dump " ./profile-dir-3.gcda" "profile" } } */
+/* { dg-options "-O -fprofile-generate -fprofile-dir=. -fdump-ipa-cgraph" } */
+/* { dg-final { scan-ipa-dump " ./profile-dir-3.gcda" "cgraph" } } */
int
main(void)
@@ -8,4 +8,4 @@ main(void)
return 0;
}
-/* { dg-final { cleanup-ipa-dump "profile" } } */
+/* { dg-final { cleanup-ipa-dump "cgraph" } } */
diff --git a/gcc/testsuite/gcc.dg/simulate-thread/atomic-load-int.c b/gcc/testsuite/gcc.dg/simulate-thread/atomic-load-int.c
new file mode 100644
index 00000000000..d03e8318108
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/simulate-thread/atomic-load-int.c
@@ -0,0 +1,116 @@
+/* { dg-do link } */
+/* { dg-require-effective-target sync_int_long } */
+/* { dg-final { simulate-thread } } */
+
+
+#include <stdio.h>
+#include "simulate-thread.h"
+
+
+/* Testing load for atomicity is a little trickier.
+
+ Set up the atomic value so that it changes value after every instruction
+ is executed.
+
+ Simply alternating between 2 values wouldn't be sufficient since a load of
+ one part, followed by the load of the second part 2 instructions later would
+ appear to be valid.
+
+ set up a table of 16 values which change a bit in every byte of the value
+ each time, this will give us a 16 instruction cycle before repetition
+ kicks in, which should be sufficient to detect any issues. Just to be sure,
+ we also change the table cycle size during execution.
+
+ The end result is that all loads should always get one of the values from
+ the table. Any other pattern means the load failed. */
+
+unsigned int ret;
+unsigned int value = 0;
+unsigned int result = 0;
+unsigned int table[16] = {
+0x00000000,
+0x11111111,
+0x22222222,
+0x33333333,
+0x44444444,
+0x55555555,
+0x66666666,
+0x77777777,
+0x88888888,
+0x99999999,
+0xAAAAAAAA,
+0xBBBBBBBB,
+0xCCCCCCCC,
+0xDDDDDDDD,
+0xEEEEEEEE,
+0xFFFFFFFF
+};
+
+int table_cycle_size = 16;
+
+/* Return 0 if 'result' is a valid value to have loaded. */
+int verify_result ()
+{
+ int x;
+ int found = 0;
+
+ /* Check entire table for valid values. */
+ for (x = 0; x < 16 ; x++)
+ if (result == table[x])
+ {
+ found = 1;
+ break;
+ }
+
+ if (!found)
+ printf("FAIL: Invalid result returned from fetch\n");
+
+ return !found;
+}
+
+/* Iterate VALUE through the different valid values. */
+void simulate_thread_other_threads ()
+{
+ static int current = 0;
+
+ if (++current >= table_cycle_size)
+ current = 0;
+ value = table[current];
+}
+
+int simulate_thread_step_verify ()
+{
+ return verify_result ();
+}
+
+int simulate_thread_final_verify ()
+{
+ return verify_result ();
+}
+
+__attribute__((noinline))
+void simulate_thread_main()
+{
+ int x;
+
+ /* Execute loads with value changing at various cyclic values. */
+ for (table_cycle_size = 16; table_cycle_size > 4 ; table_cycle_size--)
+ {
+ ret = __atomic_load_n (&value, __ATOMIC_SEQ_CST);
+ /* In order to verify the returned value (which is not atomic), it needs
+ to be atomically stored into another variable and check that. */
+ __atomic_store_n (&result, ret, __ATOMIC_SEQ_CST);
+
+ /* Execute the fetch/store a couple of times just to ensure the cycles
+ have a chance to be interesting. */
+ ret = __atomic_load_n (&value, __ATOMIC_SEQ_CST);
+ __atomic_store_n (&result, ret, __ATOMIC_SEQ_CST);
+ }
+}
+
+main()
+{
+ simulate_thread_main ();
+ simulate_thread_done ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/simulate-thread/atomic-load-int128.c b/gcc/testsuite/gcc.dg/simulate-thread/atomic-load-int128.c
new file mode 100644
index 00000000000..3ade0d6fad3
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/simulate-thread/atomic-load-int128.c
@@ -0,0 +1,132 @@
+/* { dg-do link } */
+/* { dg-require-effective-target sync_int_128 } */
+/* { dg-options "-mcx16" { target { x86_64-*-* i?86-*-* } } } */
+/* { dg-final { simulate-thread } } */
+
+#include <stdio.h>
+#include "simulate-thread.h"
+
+
+/* Testing load for atomicity is a little trickier.
+
+ Set up the atomic value so that it changes value after every instruction
+ is executed.
+
+ Simply alternating between 2 values wouldn't be sufficient since a load of
+ one part, followed by the load of the second part 2 instructions later would
+ appear to be valid.
+
+ set up a table of 16 values which change a bit in every byte of the value
+ each time, this will give us a 16 instruction cycle before repetition
+ kicks in, which should be sufficient to detect any issues. Just to be sure,
+ we also change the table cycle size during execution.
+
+ The end result is that all loads should always get one of the values from
+ the table. Any other pattern means the load failed. */
+
+__int128_t ret;
+__int128_t value = 0;
+__int128_t result = 0;
+__int128_t table[16] = {
+0x0000000000000000,
+0x1111111111111111,
+0x2222222222222222,
+0x3333333333333333,
+0x4444444444444444,
+0x5555555555555555,
+0x6666666666666666,
+0x7777777777777777,
+0x8888888888888888,
+0x9999999999999999,
+0xAAAAAAAAAAAAAAAA,
+0xBBBBBBBBBBBBBBBB,
+0xCCCCCCCCCCCCCCCC,
+0xDDDDDDDDDDDDDDDD,
+0xEEEEEEEEEEEEEEEE,
+0xFFFFFFFFFFFFFFFF
+};
+
+int table_cycle_size = 16;
+
+/* Since we don't have 128 bit constants, we have to properly pad the table. */
+void fill_table()
+{
+ int x;
+ for (x = 0; x < 16; x++)
+ {
+ ret = table[x];
+ ret = (ret << 64) | ret;
+ table[x] = ret;
+ }
+}
+
+/* Return 0 if 'result' is a valid value to have loaded. */
+int verify_result ()
+{
+ int x;
+ int found = 0;
+
+ /* Check entire table for valid values. */
+ for (x = 0; x < 16; x++)
+ if (result == table[x])
+ {
+ found = 1;
+ break;
+ }
+
+ if (!found)
+ printf("FAIL: Invalid result returned from fetch\n");
+
+ return !found;
+}
+
+/* Iterate VALUE through the different valid values. */
+void simulate_thread_other_threads ()
+{
+ static int current = 0;
+
+ if (++current >= table_cycle_size)
+ current = 0;
+ value = table[current];
+}
+
+int simulate_thread_step_verify ()
+{
+ return verify_result ();
+}
+
+int simulate_thread_final_verify ()
+{
+ return verify_result ();
+}
+
+__attribute__((noinline))
+void simulate_thread_main()
+{
+ int x;
+
+ /* Make sure value starts with an atomic value now. */
+ __atomic_store_n (&value, ret, __ATOMIC_SEQ_CST);
+
+ /* Execute loads with value changing at various cyclic values. */
+ for (table_cycle_size = 16; table_cycle_size > 4 ; table_cycle_size--)
+ {
+ ret = __atomic_load_n (&value, __ATOMIC_SEQ_CST);
+ /* In order to verify the returned value (which is not atomic), it needs
+ to be atomically stored into another variable and check that. */
+ __atomic_store_n (&result, ret, __ATOMIC_SEQ_CST);
+
+ /* Execute the fetch/store a couple of times just to ensure the cycles
+ have a chance to be interesting. */
+ ret = __atomic_load_n (&value, __ATOMIC_SEQ_CST);
+ __atomic_store_n (&result, ret, __ATOMIC_SEQ_CST);
+ }
+}
+
+main()
+{
+ fill_table ();
+ simulate_thread_main ();
+ simulate_thread_done ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/simulate-thread/atomic-load-longlong.c b/gcc/testsuite/gcc.dg/simulate-thread/atomic-load-longlong.c
new file mode 100644
index 00000000000..8bc2eaace65
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/simulate-thread/atomic-load-longlong.c
@@ -0,0 +1,117 @@
+/* { dg-do link } */
+/* { dg-require-effective-target sync_long_long } */
+/* { dg-options "" } */
+/* { dg-final { simulate-thread } } */
+
+
+#include <stdio.h>
+#include "simulate-thread.h"
+
+
+/* Testing load for atomicity is a little trickier.
+
+ Set up the atomic value so that it changes value after every instruction
+ is executed.
+
+ Simply alternating between 2 values wouldn't be sufficient since a load of
+ one part, followed by the load of the second part 2 instructions later would
+ appear to be valid.
+
+ set up a table of 16 values which change a bit in every byte of the value
+ each time, this will give us a 16 instruction cycle before repetition
+ kicks in, which should be sufficient to detect any issues. Just to be sure,
+ we also change the table cycle size during execution.
+
+ The end result is that all loads should always get one of the values from
+ the table. Any other pattern means the load failed. */
+
+unsigned long long ret;
+unsigned long long value = 0;
+unsigned long long result = 0;
+unsigned long long table[16] = {
+0x0000000000000000,
+0x1111111111111111,
+0x2222222222222222,
+0x3333333333333333,
+0x4444444444444444,
+0x5555555555555555,
+0x6666666666666666,
+0x7777777777777777,
+0x8888888888888888,
+0x9999999999999999,
+0xAAAAAAAAAAAAAAAA,
+0xBBBBBBBBBBBBBBBB,
+0xCCCCCCCCCCCCCCCC,
+0xDDDDDDDDDDDDDDDD,
+0xEEEEEEEEEEEEEEEE,
+0xFFFFFFFFFFFFFFFF
+};
+
+int table_cycle_size = 16;
+
+/* Return 0 if 'result' is a valid value to have loaded. */
+int verify_result ()
+{
+ int x;
+ int found = 0;
+
+ /* Check entire table for valid values. */
+ for (x = 0; x < 16 ; x++)
+ if (result == table[x])
+ {
+ found = 1;
+ break;
+ }
+
+ if (!found)
+ printf("FAIL: Invalid result returned from fetch\n");
+
+ return !found;
+}
+
+/* Iterate VALUE through the different valid values. */
+void simulate_thread_other_threads ()
+{
+ static int current = 0;
+
+ if (++current >= table_cycle_size)
+ current = 0;
+ value = table[current];
+}
+
+int simulate_thread_step_verify ()
+{
+ return verify_result ();
+}
+
+int simulate_thread_final_verify ()
+{
+ return verify_result ();
+}
+
+__attribute__((noinline))
+void simulate_thread_main()
+{
+ int x;
+
+ /* Execute loads with value changing at various cyclic values. */
+ for (table_cycle_size = 16; table_cycle_size > 4 ; table_cycle_size--)
+ {
+ ret = __atomic_load_n (&value, __ATOMIC_SEQ_CST);
+ /* In order to verify the returned value (which is not atomic), it needs
+ to be atomically stored into another variable and check that. */
+ __atomic_store_n (&result, ret, __ATOMIC_SEQ_CST);
+
+ /* Execute the fetch/store a couple of times just to ensure the cycles
+ have a chance to be interesting. */
+ ret = __atomic_load_n (&value, __ATOMIC_SEQ_CST);
+ __atomic_store_n (&result, ret, __ATOMIC_SEQ_CST);
+ }
+}
+
+main()
+{
+ simulate_thread_main ();
+ simulate_thread_done ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/simulate-thread/atomic-load-short.c b/gcc/testsuite/gcc.dg/simulate-thread/atomic-load-short.c
new file mode 100644
index 00000000000..e7b54c46bef
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/simulate-thread/atomic-load-short.c
@@ -0,0 +1,116 @@
+/* { dg-do link } */
+/* { dg-require-effective-target sync_char_short } */
+/* { dg-final { simulate-thread } } */
+
+
+#include <stdio.h>
+#include "simulate-thread.h"
+
+
+/* Testing load for atomicity is a little trickier.
+
+ Set up the atomic value so that it changes value after every instruction
+ is executed.
+
+ Simply alternating between 2 values wouldn't be sufficient since a load of
+ one part, followed by the load of the second part 2 instructions later would
+ appear to be valid.
+
+ set up a table of 16 values which change a bit in every byte of the value
+ each time, this will give us a 16 instruction cycle before repetition
+ kicks in, which should be sufficient to detect any issues. Just to be sure,
+ we also change the table cycle size during execution.
+
+ The end result is that all loads should always get one of the values from
+ the table. Any other pattern means the load failed. */
+
+unsigned short ret;
+unsigned short value = 0;
+unsigned short result = 0;
+unsigned short table[16] = {
+0x0000,
+0x1111,
+0x2222,
+0x3333,
+0x4444,
+0x5555,
+0x6666,
+0x7777,
+0x8888,
+0x9999,
+0xAAAA,
+0xBBBB,
+0xCCCC,
+0xDDDD,
+0xEEEE,
+0xFFFF
+};
+
+int table_cycle_size = 16;
+
+/* Return 0 if 'result' is a valid value to have loaded. */
+int verify_result ()
+{
+ int x;
+ int found = 0;
+
+ /* Check entire table for valid values. */
+ for (x = 0; x < 16 ; x++)
+ if (result == table[x])
+ {
+ found = 1;
+ break;
+ }
+
+ if (!found)
+ printf("FAIL: Invalid result returned from fetch\n");
+
+ return !found;
+}
+
+/* Iterate VALUE through the different valid values. */
+void simulate_thread_other_threads ()
+{
+ static int current = 0;
+
+ if (++current >= table_cycle_size)
+ current = 0;
+ value = table[current];
+}
+
+int simulate_thread_step_verify ()
+{
+ return verify_result ();
+}
+
+int simulate_thread_final_verify ()
+{
+ return verify_result ();
+}
+
+__attribute__((noinline))
+void simulate_thread_main()
+{
+ int x;
+
+ /* Execute loads with value changing at various cyclic values. */
+ for (table_cycle_size = 16; table_cycle_size > 4 ; table_cycle_size--)
+ {
+ ret = __atomic_load_n (&value, __ATOMIC_SEQ_CST);
+ /* In order to verify the returned value (which is not atomic), it needs
+ to be atomically stored into another variable and check that. */
+ __atomic_store_n (&result, ret, __ATOMIC_SEQ_CST);
+
+ /* Execute the fetch/store a couple of times just to ensure the cycles
+ have a chance to be interesting. */
+ ret = __atomic_load_n (&value, __ATOMIC_SEQ_CST);
+ __atomic_store_n (&result, ret, __ATOMIC_SEQ_CST);
+ }
+}
+
+main()
+{
+ simulate_thread_main ();
+ simulate_thread_done ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/simulate-thread/atomic-other-int.c b/gcc/testsuite/gcc.dg/simulate-thread/atomic-other-int.c
new file mode 100644
index 00000000000..990310c0f0e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/simulate-thread/atomic-other-int.c
@@ -0,0 +1,118 @@
+/* { dg-do link } */
+/* { dg-require-effective-target sync_int_long } */
+/* { dg-final { simulate-thread } } */
+
+
+#include <stdio.h>
+#include "simulate-thread.h"
+
+/* Test all the __sync routines for proper atomicity on 4 byte values. */
+
+unsigned int zero = 0;
+unsigned int max = ~0;
+
+unsigned int changing_value = 0;
+unsigned int value = 0;
+unsigned int ret;
+
+void test_abort()
+{
+ static int reported = 0;
+ if (!reported)
+ {
+ printf ("FAIL: improper execution of __sync builtin.\n");
+ reported = 1;
+ }
+}
+
+void simulate_thread_other_threads ()
+{
+}
+
+int simulate_thread_step_verify ()
+{
+ if (value != zero && value != max)
+ {
+ printf ("FAIL: invalid intermediate result for value.\n");
+ return 1;
+ }
+ return 0;
+}
+
+int simulate_thread_final_verify ()
+{
+ if (value != 0)
+ {
+ printf ("FAIL: invalid final result for value.\n");
+ return 1;
+ }
+ return 0;
+}
+
+/* All values written to 'value' alternate between 'zero' and
+ 'max'. Any other value detected by simulate_thread_step_verify()
+ between instructions would indicate that the value was only
+ partially written, and would thus fail this atomicity test.
+
+ This function tests each different __atomic routine once, with
+ the exception of the load instruction which requires special
+ testing. */
+__attribute__((noinline))
+void simulate_thread_main()
+{
+
+ ret = __atomic_exchange_n (&value, max, __ATOMIC_SEQ_CST);
+ if (ret != zero || value != max)
+ test_abort();
+
+ __atomic_store_n (&value, zero, __ATOMIC_SEQ_CST);
+ if (value != zero)
+ test_abort();
+
+ ret = __atomic_fetch_add (&value, max, __ATOMIC_SEQ_CST);
+ if (value != max || ret != zero)
+ test_abort ();
+
+ ret = __atomic_fetch_sub (&value, max, __ATOMIC_SEQ_CST);
+ if (value != zero || ret != max)
+ test_abort ();
+
+ ret = __atomic_fetch_or (&value, max, __ATOMIC_SEQ_CST);
+ if (value != max || ret != zero)
+ test_abort ();
+
+ ret = __atomic_fetch_and (&value, max, __ATOMIC_SEQ_CST);
+ if (value != max || ret != max)
+ test_abort ();
+
+ ret = __atomic_fetch_xor (&value, max, __ATOMIC_SEQ_CST);
+ if (value != zero || ret != max)
+ test_abort ();
+
+ ret = __atomic_add_fetch (&value, max, __ATOMIC_SEQ_CST);
+ if (value != max || ret != max)
+ test_abort ();
+
+ ret = __atomic_sub_fetch (&value, max, __ATOMIC_SEQ_CST);
+ if (value != zero || ret != zero)
+ test_abort ();
+
+ ret = __atomic_or_fetch (&value, max, __ATOMIC_SEQ_CST);
+ if (value != max || ret != max)
+ test_abort ();
+
+ ret = __atomic_and_fetch (&value, max, __ATOMIC_SEQ_CST);
+ if (value != max || ret != max)
+ test_abort ();
+
+ ret = __atomic_xor_fetch (&value, max, __ATOMIC_SEQ_CST);
+ if (value != zero || ret != zero)
+ test_abort ();
+}
+
+main ()
+{
+ simulate_thread_main ();
+ simulate_thread_done ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/simulate-thread/atomic-other-int128.c b/gcc/testsuite/gcc.dg/simulate-thread/atomic-other-int128.c
new file mode 100644
index 00000000000..67f84a14a00
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/simulate-thread/atomic-other-int128.c
@@ -0,0 +1,116 @@
+/* { dg-do link } */
+/* { dg-require-effective-target sync_int_128 } */
+/* { dg-options "-mcx16" { target { x86_64-*-* i?86-*-*] } } } */
+/* { dg-final { simulate-thread } } */
+
+#include <stdio.h>
+#include "simulate-thread.h"
+
+/* Test all the __sync routines for proper atomicity on 16 byte values. */
+
+__int128_t zero = 0;
+__int128_t max = ~0;
+__int128_t changing_value = 0;
+__int128_t value = 0;
+__int128_t ret;
+
+void test_abort()
+{
+ static int reported = 0;
+ if (!reported)
+ {
+ printf ("FAIL: improper execution of __sync builtin.\n");
+ reported = 1;
+ }
+}
+
+void simulate_thread_other_threads ()
+{
+}
+
+int simulate_thread_step_verify ()
+{
+ if (value != zero && value != max)
+ {
+ printf ("FAIL: invalid intermediate result for value.\n");
+ return 1;
+ }
+ return 0;
+}
+
+int simulate_thread_final_verify ()
+{
+ if (value != 0)
+ {
+ printf ("FAIL: invalid final result for value.\n");
+ return 1;
+ }
+ return 0;
+}
+
+/* All values written to 'value' alternate between 'zero' and 'max'. Any other
+ value detected by simulate_thread_step_verify() between instructions would indicate
+ that the value was only partially written, and would thus fail this
+ atomicity test.
+
+ This function tests each different __atomic routine once, with the
+ exception of the load instruction which requires special testing. */
+__attribute__((noinline))
+void simulate_thread_main()
+{
+
+ ret = __atomic_exchange_n (&value, max, __ATOMIC_SEQ_CST);
+ if (ret != zero || value != max)
+ test_abort();
+
+ __atomic_store_n (&value, zero, __ATOMIC_SEQ_CST);
+ if (value != zero)
+ test_abort();
+
+ ret = __atomic_fetch_add (&value, max, __ATOMIC_SEQ_CST);
+ if (value != max || ret != zero)
+ test_abort ();
+
+ ret = __atomic_fetch_sub (&value, max, __ATOMIC_SEQ_CST);
+ if (value != zero || ret != max)
+ test_abort ();
+
+ ret = __atomic_fetch_or (&value, max, __ATOMIC_SEQ_CST);
+ if (value != max || ret != zero)
+ test_abort ();
+
+ ret = __atomic_fetch_and (&value, max, __ATOMIC_SEQ_CST);
+ if (value != max || ret != max)
+ test_abort ();
+
+ ret = __atomic_fetch_xor (&value, max, __ATOMIC_SEQ_CST);
+ if (value != zero || ret != max)
+ test_abort ();
+
+ ret = __atomic_add_fetch (&value, max, __ATOMIC_SEQ_CST);
+ if (value != max || ret != max)
+ test_abort ();
+
+ ret = __atomic_sub_fetch (&value, max, __ATOMIC_SEQ_CST);
+ if (value != zero || ret != zero)
+ test_abort ();
+
+ ret = __atomic_or_fetch (&value, max, __ATOMIC_SEQ_CST);
+ if (value != max || ret != max)
+ test_abort ();
+
+ ret = __atomic_and_fetch (&value, max, __ATOMIC_SEQ_CST);
+ if (value != max || ret != max)
+ test_abort ();
+
+ ret = __atomic_xor_fetch (&value, max, __ATOMIC_SEQ_CST);
+ if (value != zero || ret != zero)
+ test_abort ();
+}
+
+int main()
+{
+ simulate_thread_main ();
+ simulate_thread_done ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/simulate-thread/atomic-other-longlong.c b/gcc/testsuite/gcc.dg/simulate-thread/atomic-other-longlong.c
new file mode 100644
index 00000000000..ac4330bd8a4
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/simulate-thread/atomic-other-longlong.c
@@ -0,0 +1,117 @@
+/* { dg-do link } */
+/* { dg-require-effective-target sync_long_long } */
+/* { dg-options "" } */
+/* { dg-final { simulate-thread } } */
+
+
+#include <stdio.h>
+#include "simulate-thread.h"
+
+/* Test all the __sync routines for proper atomicity on 8 byte values. */
+
+unsigned long long zero = 0;
+unsigned long long max = ~0;
+
+unsigned long long changing_value = 0;
+unsigned long long value = 0;
+unsigned long long ret;
+
+void test_abort()
+{
+ static int reported = 0;
+ if (!reported)
+ {
+ printf ("FAIL: improper execution of __sync builtin.\n");
+ reported = 1;
+ }
+}
+
+void simulate_thread_other_threads ()
+{
+}
+
+int simulate_thread_step_verify ()
+{
+ if (value != zero && value != max)
+ {
+ printf ("FAIL: invalid intermediate result for value.\n");
+ return 1;
+ }
+ return 0;
+}
+
+int simulate_thread_final_verify ()
+{
+ if (value != 0)
+ {
+ printf ("FAIL: invalid final result for value.\n");
+ return 1;
+ }
+ return 0;
+}
+
+/* All values written to 'value' alternate between 'zero' and 'max'. Any other
+ value detected by simulate_thread_step_verify() between instructions would indicate
+ that the value was only partially written, and would thus fail this
+ atomicity test.
+
+ This function tests each different __atomic routine once, with the
+ exception of the load instruction which requires special testing. */
+__attribute__((noinline))
+void simulate_thread_main()
+{
+ ret = __atomic_exchange_n (&value, max, __ATOMIC_SEQ_CST);
+ if (ret != zero || value != max)
+ test_abort();
+
+ __atomic_store_n (&value, zero, __ATOMIC_SEQ_CST);
+ if (value != zero)
+ test_abort();
+
+ ret = __atomic_fetch_add (&value, max, __ATOMIC_SEQ_CST);
+ if (value != max || ret != zero)
+ test_abort ();
+
+ ret = __atomic_fetch_sub (&value, max, __ATOMIC_SEQ_CST);
+ if (value != zero || ret != max)
+ test_abort ();
+
+ ret = __atomic_fetch_or (&value, max, __ATOMIC_SEQ_CST);
+ if (value != max || ret != zero)
+ test_abort ();
+
+ ret = __atomic_fetch_and (&value, max, __ATOMIC_SEQ_CST);
+ if (value != max || ret != max)
+ test_abort ();
+
+ ret = __atomic_fetch_xor (&value, max, __ATOMIC_SEQ_CST);
+ if (value != zero || ret != max)
+ test_abort ();
+
+ ret = __atomic_add_fetch (&value, max, __ATOMIC_SEQ_CST);
+ if (value != max || ret != max)
+ test_abort ();
+
+ ret = __atomic_sub_fetch (&value, max, __ATOMIC_SEQ_CST);
+ if (value != zero || ret != zero)
+ test_abort ();
+
+ ret = __atomic_or_fetch (&value, max, __ATOMIC_SEQ_CST);
+ if (value != max || ret != max)
+ test_abort ();
+
+ ret = __atomic_and_fetch (&value, max, __ATOMIC_SEQ_CST);
+ if (value != max || ret != max)
+ test_abort ();
+
+ ret = __atomic_xor_fetch (&value, max, __ATOMIC_SEQ_CST);
+ if (value != zero || ret != zero)
+ test_abort ();
+}
+
+int main ()
+{
+ simulate_thread_main ();
+ simulate_thread_done ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/simulate-thread/atomic-other-short.c b/gcc/testsuite/gcc.dg/simulate-thread/atomic-other-short.c
new file mode 100644
index 00000000000..d823e02fb47
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/simulate-thread/atomic-other-short.c
@@ -0,0 +1,117 @@
+/* { dg-do link } */
+/* { dg-require-effective-target sync_char_short } */
+/* { dg-final { simulate-thread } } */
+
+
+#include <stdio.h>
+#include "simulate-thread.h"
+
+/* Test all the __sync routines for proper atomicity on 2 byte values. */
+
+unsigned short zero = 0;
+unsigned short max = ~0;
+
+unsigned short changing_value = 0;
+unsigned short value = 0;
+unsigned short ret;
+
+void test_abort()
+{
+ static int reported = 0;
+ if (!reported)
+ {
+ printf ("FAIL: improper execution of __sync builtin.\n");
+ reported = 1;
+ }
+}
+
+void simulate_thread_other_threads ()
+{
+}
+
+int simulate_thread_step_verify ()
+{
+ if (value != zero && value != max)
+ {
+ printf ("FAIL: invalid intermediate result for value.\n");
+ return 1;
+ }
+ return 0;
+}
+
+int simulate_thread_final_verify ()
+{
+ if (value != 0)
+ {
+ printf ("FAIL: invalid final result for value.\n");
+ return 1;
+ }
+ return 0;
+}
+
+/* All values written to 'value' alternate between 'zero' and
+ 'max'. Any other value detected by simulate_thread_step_verify()
+ between instructions would indicate that the value was only
+ partially written, and would thus fail this atomicity test.
+
+ This function tests each different __atomic routine once, with
+ the exception of the load instruction which requires special
+ testing. */
+__attribute__((noinline))
+void simulate_thread_main()
+{
+ ret = __atomic_exchange_n (&value, max, __ATOMIC_SEQ_CST);
+ if (ret != zero || value != max)
+ test_abort();
+
+ __atomic_store_n (&value, zero, __ATOMIC_SEQ_CST);
+ if (value != zero)
+ test_abort();
+
+ ret = __atomic_fetch_add (&value, max, __ATOMIC_SEQ_CST);
+ if (value != max || ret != zero)
+ test_abort ();
+
+ ret = __atomic_fetch_sub (&value, max, __ATOMIC_SEQ_CST);
+ if (value != zero || ret != max)
+ test_abort ();
+
+ ret = __atomic_fetch_or (&value, max, __ATOMIC_SEQ_CST);
+ if (value != max || ret != zero)
+ test_abort ();
+
+ ret = __atomic_fetch_and (&value, max, __ATOMIC_SEQ_CST);
+ if (value != max || ret != max)
+ test_abort ();
+
+ ret = __atomic_fetch_xor (&value, max, __ATOMIC_SEQ_CST);
+ if (value != zero || ret != max)
+ test_abort ();
+
+ ret = __atomic_add_fetch (&value, max, __ATOMIC_SEQ_CST);
+ if (value != max || ret != max)
+ test_abort ();
+
+ ret = __atomic_sub_fetch (&value, max, __ATOMIC_SEQ_CST);
+ if (value != zero || ret != zero)
+ test_abort ();
+
+ ret = __atomic_or_fetch (&value, max, __ATOMIC_SEQ_CST);
+ if (value != max || ret != max)
+ test_abort ();
+
+ ret = __atomic_and_fetch (&value, max, __ATOMIC_SEQ_CST);
+ if (value != max || ret != max)
+ test_abort ();
+
+ ret = __atomic_xor_fetch (&value, max, __ATOMIC_SEQ_CST);
+ if (value != zero || ret != zero)
+ test_abort ();
+}
+
+int main ()
+{
+ simulate_thread_main ();
+ simulate_thread_done ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/simulate-thread/speculative-store.c b/gcc/testsuite/gcc.dg/simulate-thread/speculative-store.c
new file mode 100644
index 00000000000..71d1cca9dda
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/simulate-thread/speculative-store.c
@@ -0,0 +1,57 @@
+/* { dg-do link } */
+/* { dg-options "--param allow-store-data-races=0" } */
+/* { dg-final { simulate-thread } } */
+
+#include <stdio.h>
+#include "simulate-thread.h"
+
+/* This file tests that speculative store movement out of a loop doesn't
+ happen. This is disallowed when --param allow-store-data-races is 0. */
+
+int global = 100;
+
+/* Other thread makes sure global is 100 before the next instruction is
+ * exceuted. */
+void simulate_thread_other_threads()
+{
+ global = 100;
+}
+
+int simulate_thread_step_verify()
+{
+ if (global != 100)
+ {
+ printf("FAIL: global variable was assigned to. \n");
+ return 1;
+ }
+}
+
+int simulate_thread_final_verify()
+{
+ return 0;
+}
+
+/* The variable global should never be assigned if func(0) is called.
+ This tests store movement out of loop thats never executed. */
+void test (int y)
+{
+ int x;
+ for (x=0; x< y; x++)
+ {
+ global = y; /* This should never speculatively execute. */
+ }
+}
+
+__attribute__((noinline))
+void simulate_thread_main()
+{
+ test(0);
+ simulate_thread_done();
+}
+
+__attribute__((noinline))
+int main()
+{
+ simulate_thread_main();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/simulate-thread/strict-align-global.c b/gcc/testsuite/gcc.dg/simulate-thread/strict-align-global.c
new file mode 100644
index 00000000000..fdcd7f46af7
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/simulate-thread/strict-align-global.c
@@ -0,0 +1,52 @@
+/* { dg-do link } */
+/* { dg-options "--param allow-packed-store-data-races=0" } */
+/* { dg-final { simulate-thread } } */
+
+#include <stdio.h>
+#include "simulate-thread.h"
+
+/* This test verifies writes to globals do not write to adjacent
+ globals. This mostly happens on strict-align targets that are not
+ byte addressable (old Alphas, etc). */
+
+char a = 0;
+char b = 77;
+
+void simulate_thread_other_threads()
+{
+}
+
+int simulate_thread_step_verify()
+{
+ if (b != 77)
+ {
+ printf("FAIL: Unexpected value. <b> is %d, should be 77\n", b);
+ return 1;
+ }
+ return 0;
+}
+
+/* Verify that every variable has the correct value. */
+int simulate_thread_final_verify()
+{
+ int ret = simulate_thread_step_verify ();
+ if (a != 66)
+ {
+ printf("FAIL: Unexpected value. <a> is %d, should be 66\n", a);
+ return 1;
+ }
+ return ret;
+}
+
+__attribute__((noinline))
+void simulate_thread_main()
+{
+ a = 66;
+}
+
+int main ()
+{
+ simulate_thread_main();
+ simulate_thread_done();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/simulate-thread/subfields.c b/gcc/testsuite/gcc.dg/simulate-thread/subfields.c
new file mode 100644
index 00000000000..2d931176e7d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/simulate-thread/subfields.c
@@ -0,0 +1,93 @@
+/* { dg-do link } */
+/* { dg-options "--param allow-packed-store-data-races=0" } */
+/* { dg-final { simulate-thread } } */
+
+#include <stdio.h>
+#include "simulate-thread.h"
+
+/* This test verifies that data races aren't introduced by structure subfield
+ stores. */
+
+struct test_struct {
+ char a;
+ char b;
+ char c;
+ char d;
+} var = {0,0,0,0};
+
+
+/* This routine sets field a to 'x'. If executed properly, it will
+ not affect any of the other fields in the structure. An improper
+ implementation may load an entire word, change the 8 bits for field
+ 'a' and write the entire word back out. */
+__attribute__((noinline))
+void set_a(char x)
+{
+ var.a = x;
+}
+
+static int global = 0;
+
+/* The other thread increments the value of each of the other fields
+ in the structure every cycle. If the store to the 'a' field does
+ an incorrect full or partial word load, mask and store, it will
+ write back an incorrect value to one or more of the other
+ fields. */
+void simulate_thread_other_threads()
+{
+ global++;
+ var.b = global;
+ var.c = global;
+ var.d = global;
+}
+
+
+/* Make sure that none of the other fields have been changed. */
+int simulate_thread_step_verify()
+{
+ int ret = 0;
+ if (var.b != global)
+ {
+ printf("FAIL: Unexpected value. var.b is %d, should be %d\n",
+ var.b, global);
+ ret = 1;
+ }
+ if (var.c != global)
+ {
+ printf("FAIL: Unexpected value. var.c is %d, should be %d\n",
+ var.c, global);
+ ret = 1;
+ }
+ if (var.d != global)
+ {
+ printf("FAIL: Unexpected value. var.d is %d, should be %d\n",
+ var.d, global);
+ ret = 1;
+ }
+ return ret;
+}
+
+/* Verify that every variable has the correct value. */
+int simulate_thread_final_verify()
+{
+ int ret = simulate_thread_step_verify();
+ if (var.a != 1)
+ {
+ printf("FAIL: Unexpected value. var.a is %d, should be %d\n", var.a, 1);
+ ret = 1;
+ }
+ return ret;
+}
+
+__attribute__((noinline))
+void simulate_thread_main()
+{
+ set_a(1);
+}
+
+int main ()
+{
+ simulate_thread_main();
+ simulate_thread_done();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/stack-usage-1.c b/gcc/testsuite/gcc.dg/stack-usage-1.c
index f55168e9e44..77dd03852fb 100644
--- a/gcc/testsuite/gcc.dg/stack-usage-1.c
+++ b/gcc/testsuite/gcc.dg/stack-usage-1.c
@@ -52,6 +52,8 @@
# define SIZE 160 /* 256 - 96 bytes for register save area */
#elif defined (__SPU__)
# define SIZE 224
+#elif defined (__epiphany__)
+# define SIZE (256 - __EPIPHANY_STACK_OFFSET__)
#else
# define SIZE 256
#endif
diff --git a/gcc/testsuite/gcc.dg/strlenopt-22.c b/gcc/testsuite/gcc.dg/strlenopt-22.c
index 541bfdce467..d6fd4dfbd88 100644
--- a/gcc/testsuite/gcc.dg/strlenopt-22.c
+++ b/gcc/testsuite/gcc.dg/strlenopt-22.c
@@ -1,7 +1,6 @@
/* { dg-do run } */
/* { dg-options "-O2 -fdump-tree-strlen" } */
-#define USE_GNU
#include "strlenopt.h"
__attribute__((noinline, noclone)) size_t
@@ -32,10 +31,10 @@ main ()
return 0;
}
-/* { dg-final { scan-tree-dump-times "strlen \\(" 0 "strlen" } } */
+/* { dg-final { scan-tree-dump-times "strlen \\(" 3 "strlen" } } */
/* { dg-final { scan-tree-dump-times "memcpy \\(" 1 "strlen" } } */
-/* { dg-final { scan-tree-dump-times "strcpy \\(" 0 "strlen" } } */
+/* { dg-final { scan-tree-dump-times "strcpy \\(" 1 "strlen" } } */
/* { dg-final { scan-tree-dump-times "strcat \\(" 0 "strlen" } } */
/* { dg-final { scan-tree-dump-times "strchr \\(" 1 "strlen" } } */
-/* { dg-final { scan-tree-dump-times "stpcpy \\(" 1 "strlen" } } */
+/* { dg-final { scan-tree-dump-times "stpcpy \\(" 0 "strlen" } } *
/* { dg-final { cleanup-tree-dump "strlen" } } */
diff --git a/gcc/testsuite/gcc.dg/strlenopt-22g.c b/gcc/testsuite/gcc.dg/strlenopt-22g.c
new file mode 100644
index 00000000000..45c6345fc8b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/strlenopt-22g.c
@@ -0,0 +1,14 @@
+/* This test needs runtime that provides stpcpy function. */
+/* { dg-do run { target *-*-linux* } } */
+/* { dg-options "-O2 -fdump-tree-strlen" } */
+
+#define USE_GNU
+#include "strlenopt-22.c"
+
+/* { dg-final { scan-tree-dump-times "strlen \\(" 0 "strlen" } } */
+/* { dg-final { scan-tree-dump-times "memcpy \\(" 1 "strlen" } } */
+/* { dg-final { scan-tree-dump-times "strcpy \\(" 0 "strlen" } } */
+/* { dg-final { scan-tree-dump-times "strcat \\(" 0 "strlen" } } */
+/* { dg-final { scan-tree-dump-times "strchr \\(" 1 "strlen" } } */
+/* { dg-final { scan-tree-dump-times "stpcpy \\(" 1 "strlen" } } */
+/* { dg-final { cleanup-tree-dump "strlen" } } */
diff --git a/gcc/testsuite/gcc.dg/tls/thr-cse-1.c b/gcc/testsuite/gcc.dg/tls/thr-cse-1.c
index 7542350d8da..87fdc64688d 100644
--- a/gcc/testsuite/gcc.dg/tls/thr-cse-1.c
+++ b/gcc/testsuite/gcc.dg/tls/thr-cse-1.c
@@ -1,5 +1,8 @@
/* { dg-do compile } */
/* { dg-options "-O1" } */
+/* Using -mshort-calls avoids loading the function addresses in
+ registers and thus getting the counts wrong. */
+/* { dg-additional-options "-mshort-calls" { target epiphany-*-* } } */
/* { dg-require-effective-target tls_emulated } */
/* Test that we only get one call to emutls_get_address when CSE is
diff --git a/gcc/testsuite/gcc.dg/torture/pr50890.c b/gcc/testsuite/gcc.dg/torture/pr50890.c
new file mode 100644
index 00000000000..17240d4fb82
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr50890.c
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+
+static float make_insn_raw (void)
+{
+ return 0;
+}
+
+static int emit_pattern_after_noloc (int (make_raw) ())
+{
+ return make_raw ();
+}
+
+void emit_insn_after_noloc (void)
+{
+ emit_pattern_after_noloc ((void *) make_insn_raw);
+}
+
diff --git a/gcc/testsuite/gcc.dg/torture/pr50902.c b/gcc/testsuite/gcc.dg/torture/pr50902.c
new file mode 100644
index 00000000000..5b7275b839d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr50902.c
@@ -0,0 +1,9 @@
+/* { dg-do compile } */
+
+_Bool data[128];
+void foo (_Bool *init)
+{
+ int i;
+ for (i = 0; i < 128; i++)
+ data[i] = *init;
+}
diff --git a/gcc/testsuite/gcc.dg/torture/stackalign/builtin-apply-2.c b/gcc/testsuite/gcc.dg/torture/stackalign/builtin-apply-2.c
index a1ba20fce53..89c71a99d5b 100644
--- a/gcc/testsuite/gcc.dg/torture/stackalign/builtin-apply-2.c
+++ b/gcc/testsuite/gcc.dg/torture/stackalign/builtin-apply-2.c
@@ -9,6 +9,15 @@
#define INTEGER_ARG 5
+#if defined(__ARM_PCS) || defined(__epiphany__)
+/* For Base AAPCS, NAME is passed in r0. D is passed in r2 and r3.
+ E, F and G are passed on stack. So the size of the stack argument
+ data is 20. */
+#define STACK_ARGUMENTS_SIZE 20
+#else
+#define STACK_ARGUMENTS_SIZE 64
+#endif
+
extern void abort(void);
void foo(char *name, double d, double e, double f, int g)
@@ -19,7 +28,7 @@ void foo(char *name, double d, double e, double f, int g)
void bar(char *name, ...)
{
- __builtin_apply(foo, __builtin_apply_args(), 64);
+ __builtin_apply(foo, __builtin_apply_args(), STACK_ARGUMENTS_SIZE);
}
int main(void)
diff --git a/gcc/testsuite/gcc.dg/torture/vec-cvt-1.c b/gcc/testsuite/gcc.dg/torture/vec-cvt-1.c
new file mode 100644
index 00000000000..601f098889c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/vec-cvt-1.c
@@ -0,0 +1,211 @@
+/* { dg-do run } */
+
+#include <stdlib.h>
+
+#define N 1024
+signed char sc[N];
+short ss[N];
+int si[N];
+long long sl[N];
+unsigned char uc[N];
+unsigned short us[N];
+unsigned int ui[N];
+unsigned long long ul[N];
+float f[N];
+double d[N];
+
+#define FN1(from, to) \
+__attribute__((noinline, noclone)) void \
+from##2##to (void) \
+{ \
+ int i; \
+ for (i = 0; i < N; i++) \
+ to[i] = from[i]; \
+}
+#define FN(intt, fltt) FN1 (intt, fltt) FN1 (fltt, intt)
+
+FN (sc, f)
+FN (ss, f)
+FN (si, f)
+FN (sl, f)
+FN (uc, f)
+FN (us, f)
+FN (ui, f)
+FN (ul, f)
+FN (sc, d)
+FN (ss, d)
+FN (si, d)
+FN (sl, d)
+FN (uc, d)
+FN (us, d)
+FN (ui, d)
+FN (ul, d)
+
+#define FLTTEST(min, max, intt) \
+__attribute__((noinline, noclone)) void \
+flttointtest##intt (void) \
+{ \
+ int i; \
+ volatile float fltmin, fltmax, vf, vf2; \
+ volatile double dblmin, dblmax, vd, vd2; \
+ if (min == 0) \
+ fltmin = 0.0f; \
+ else \
+ { \
+ vf2 = fltmin = min - 1.0f; \
+ for (vf = 1.0f; (fltmin = vf2 + vf) == vf2; vf = vf * 2.0f) \
+ ; \
+ } \
+ vf2 = fltmax = max + 1.0f; \
+ for (vf = 1.0f; (fltmax = vf2 - vf) == vf2; vf = vf * 2.0f) \
+ ; \
+ if (min == 0) \
+ dblmin = 0.0; \
+ else \
+ { \
+ vd2 = dblmin = min - 1.0; \
+ for (vd = 1.0; (dblmin = vd2 + vd) == vd2; vd = vd * 2.0) \
+ ; \
+ } \
+ vd2 = dblmax = max + 1.0; \
+ for (vd = 1.0; (dblmax = vd2 - vd) == vd2; vd = vd * 2.0) \
+ ; \
+ for (i = 0; i < N; i++) \
+ { \
+ asm (""); \
+ if (i == 0) \
+ f[i] = fltmin; \
+ else if (i < N / 4) \
+ f[i] = fltmin + i + 0.25f; \
+ else if (i < 3 * N / 4) \
+ f[i] = (fltmax + fltmin) / 2.0 - N * 8 + 16.0f * i; \
+ else \
+ f[i] = fltmax - N + 1 + i; \
+ if (f[i] < fltmin) f[i] = fltmin; \
+ if (f[i] > fltmax) f[i] = fltmax; \
+ if (i == 0) \
+ d[i] = dblmin; \
+ else if (i < N / 4) \
+ d[i] = dblmin + i + 0.25f; \
+ else if (i < 3 * N / 4) \
+ d[i] = (dblmax + dblmin) / 2.0 - N * 8 + 16.0f * i; \
+ else \
+ d[i] = dblmax - N + 1 + i; \
+ if (d[i] < dblmin) d[i] = dblmin; \
+ if (d[i] > dblmax) d[i] = dblmax; \
+ } \
+ f2##intt (); \
+ for (i = 0; i < N; i++) \
+ if (intt[i] != (__typeof (intt[0])) f[i]) \
+ abort (); \
+ d2##intt (); \
+ for (i = 0; i < N; i++) \
+ if (intt[i] != (__typeof (intt[0])) d[i]) \
+ abort (); \
+ for (i = 0; i < N; i++) \
+ { \
+ unsigned long long r = random (); \
+ r = (r << 21) ^ (unsigned) random (); \
+ r = (r << 21) ^ (unsigned) random (); \
+ asm (""); \
+ f[i] = (r >> 59) / 32.0f + (__typeof (intt[0])) r; \
+ if (f[i] < fltmin) f[i] = fltmin; \
+ if (f[i] > fltmax) f[i] = fltmax; \
+ d[i] = (r >> 59) / 32.0 + (__typeof (intt[0])) r; \
+ if (d[i] < dblmin) f[i] = dblmin; \
+ if (d[i] > dblmax) f[i] = dblmax; \
+ } \
+ f2##intt (); \
+ for (i = 0; i < N; i++) \
+ if (intt[i] != (__typeof (intt[0])) f[i]) \
+ abort (); \
+ d2##intt (); \
+ for (i = 0; i < N; i++) \
+ if (intt[i] != (__typeof (intt[0])) d[i]) \
+ abort (); \
+} \
+ \
+__attribute__((noinline, noclone)) void \
+inttoflttest##intt (void) \
+{ \
+ int i; \
+ volatile float vf; \
+ volatile double vd; \
+ for (i = 0; i < N; i++) \
+ { \
+ asm (""); \
+ if (i < N / 4) \
+ intt[i] = min + i; \
+ else if (i < 3 * N / 4) \
+ intt[i] = (max + min) / 2 - N * 8 + 16 * i; \
+ else \
+ intt[i] = max - N + 1 + i; \
+ } \
+ intt##2f (); \
+ for (i = 0; i < N; i++) \
+ { \
+ vf = intt[i]; \
+ if (f[i] != vf) \
+ abort (); \
+ } \
+ intt##2d (); \
+ for (i = 0; i < N; i++) \
+ { \
+ vd = intt[i]; \
+ if (d[i] != vd) \
+ abort (); \
+ } \
+ for (i = 0; i < N; i++) \
+ { \
+ unsigned long long r = random (); \
+ r = (r << 21) ^ (unsigned) random (); \
+ r = (r << 21) ^ (unsigned) random (); \
+ asm (""); \
+ intt[i] = r; \
+ } \
+ intt##2f (); \
+ for (i = 0; i < N; i++) \
+ { \
+ vf = intt[i]; \
+ if (f[i] != vf) \
+ abort (); \
+ } \
+ intt##2d (); \
+ for (i = 0; i < N; i++) \
+ { \
+ vd = intt[i]; \
+ if (d[i] != vd) \
+ abort (); \
+ } \
+}
+
+FLTTEST (- __SCHAR_MAX__ - 1, __SCHAR_MAX__, sc)
+FLTTEST (- __SHRT_MAX__ - 1, __SHRT_MAX__, ss)
+FLTTEST (- __INT_MAX__ - 1, __INT_MAX__, si)
+FLTTEST (- __LONG_LONG_MAX__ - 1LL, __LONG_LONG_MAX__, sl)
+FLTTEST (0, 2U * __SCHAR_MAX__ + 1, uc)
+FLTTEST (0, 2U * __SHRT_MAX__ + 1, us)
+FLTTEST (0, 2U * __INT_MAX__ + 1, ui)
+FLTTEST (0, 2ULL * __LONG_LONG_MAX__ + 1, ul)
+
+int
+main ()
+{
+ flttointtestsc ();
+ flttointtestss ();
+ flttointtestsi ();
+ flttointtestsl ();
+ flttointtestuc ();
+ flttointtestus ();
+ flttointtestui ();
+ flttointtestul ();
+ inttoflttestsc ();
+ inttoflttestss ();
+ inttoflttestsi ();
+ inttoflttestsl ();
+ inttoflttestuc ();
+ inttoflttestus ();
+ inttoflttestui ();
+ inttoflttestul ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-cond-1.c b/gcc/testsuite/gcc.dg/vect/bb-slp-cond-1.c
new file mode 100644
index 00000000000..ae833e53dc0
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-cond-1.c
@@ -0,0 +1,46 @@
+/* { dg-require-effective-target vect_condition } */
+
+#include "tree-vect.h"
+
+#define N 128
+
+__attribute__((noinline, noclone)) void
+foo (int *a, int stride)
+{
+ int i;
+
+ for (i = 0; i < N/stride; i++, a += stride)
+ {
+ a[0] = a[0] ? 1 : 5;
+ a[1] = a[1] ? 2 : 6;
+ a[2] = a[2] ? 3 : 7;
+ a[3] = a[3] ? 4 : 8;
+ }
+}
+
+
+int a[N];
+int main ()
+{
+ int i;
+
+ check_vect ();
+
+ for (i = 0; i < N; i++)
+ a[i] = i;
+
+ foo (a, 4);
+
+ for (i = 1; i < N; i++)
+ if (a[i] != i%4 + 1)
+ abort ();
+
+ if (a[0] != 5)
+ abort ();
+
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "basic block vectorized using SLP" 1 "slp" { target vect_element_align } } } */
+/* { dg-final { cleanup-tree-dump "slp" } } */
+
diff --git a/gcc/testsuite/gcc.dg/vect/slp-cond-1.c b/gcc/testsuite/gcc.dg/vect/slp-cond-1.c
new file mode 100644
index 00000000000..4b8e3d3b6a3
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/slp-cond-1.c
@@ -0,0 +1,126 @@
+/* { dg-require-effective-target vect_condition } */
+#include "tree-vect.h"
+
+#define N 32
+int a[N], b[N];
+int d[N], e[N];
+int k[N];
+
+__attribute__((noinline, noclone)) void
+f1 (void)
+{
+ int i;
+ for (i = 0; i < N/4; i++)
+ {
+ k[4*i] = a[4*i] < b[4*i] ? 17 : 0;
+ k[4*i+1] = a[4*i+1] < b[4*i+1] ? 17 : 0;
+ k[4*i+2] = a[4*i+2] < b[4*i+2] ? 17 : 0;
+ k[4*i+3] = a[4*i+3] < b[4*i+3] ? 17 : 0;
+ }
+}
+
+__attribute__((noinline, noclone)) void
+f2 (void)
+{
+ int i;
+ for (i = 0; i < N/2; ++i)
+ {
+ k[2*i] = a[2*i] < b[2*i] ? 0 : 24;
+ k[2*i+1] = a[2*i+1] < b[2*i+1] ? 7 : 4;
+ }
+}
+
+__attribute__((noinline, noclone)) void
+f3 (void)
+{
+ int i;
+ for (i = 0; i < N/2; ++i)
+ {
+ k[2*i] = a[2*i] < b[2*i] ? 51 : 12;
+ k[2*i+1] = a[2*i+1] > b[2*i+1] ? 51 : 12;
+ }
+}
+
+__attribute__((noinline, noclone)) void
+f4 (void)
+{
+ int i;
+ for (i = 0; i < N/2; ++i)
+ {
+ int d0 = d[2*i], e0 = e[2*i];
+ int d1 = d[2*i+1], e1 = e[2*i+1];
+ k[2*i] = a[2*i] >= b[2*i] ? d0 : e0;
+ k[2*i+1] = a[2*i+1] >= b[2*i+1] ? d1 : e1;
+ }
+}
+
+int
+main ()
+{
+ int i;
+
+ check_vect ();
+
+ for (i = 0; i < N; i++)
+ {
+ switch (i % 9)
+ {
+ case 0: asm (""); a[i] = - i - 1; b[i] = i + 1; break;
+ case 1: a[i] = 0; b[i] = 0; break;
+ case 2: a[i] = i + 1; b[i] = - i - 1; break;
+ case 3: a[i] = i; b[i] = i + 7; break;
+ case 4: a[i] = i; b[i] = i; break;
+ case 5: a[i] = i + 16; b[i] = i + 3; break;
+ case 6: a[i] = - i - 5; b[i] = - i; break;
+ case 7: a[i] = - i; b[i] = - i; break;
+ case 8: a[i] = - i; b[i] = - i - 7; break;
+ }
+ d[i] = i;
+ e[i] = 2 * i;
+ }
+ f1 ();
+ for (i = 0; i < N; i++)
+ if (k[i] != ((i % 3) == 0 ? 17 : 0))
+ abort ();
+
+ f2 ();
+ for (i = 0; i < N; i++)
+ {
+ switch (i % 9)
+ {
+ case 0:
+ case 6:
+ if (k[i] != ((i/9 % 2) == 0 ? 0 : 7))
+ abort ();
+ break;
+ case 1:
+ case 5:
+ case 7:
+ if (k[i] != ((i/9 % 2) == 0 ? 4 : 24))
+ abort ();
+ break;
+ case 2:
+ case 4:
+ case 8:
+ if (k[i] != ((i/9 % 2) == 0 ? 24 : 4))
+ abort ();
+ break;
+ case 3:
+ if (k[i] != ((i/9 % 2) == 0 ? 7 : 0))
+ abort ();
+ break;
+ }
+ }
+
+ f3 ();
+
+ f4 ();
+ for (i = 0; i < N; i++)
+ if (k[i] != ((i % 3) == 0 ? e[i] : d[i]))
+ abort ();
+
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 3 "vect" } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/slp-cond-2.c b/gcc/testsuite/gcc.dg/vect/slp-cond-2.c
new file mode 100644
index 00000000000..c73933fce0f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/slp-cond-2.c
@@ -0,0 +1,127 @@
+/* { dg-require-effective-target vect_cond_mixed } */
+#include "tree-vect.h"
+
+#define N 32
+int d[N], e[N], f[N];
+unsigned char k[N];
+float a[N], b[N];
+
+__attribute__((noinline, noclone)) void
+f1 (void)
+{
+ int i;
+ for (i = 0; i < N/4; i++)
+ {
+ k[4*i] = a[4*i] < b[4*i] ? 17 : 0;
+ k[4*i+1] = a[4*i+1] < b[4*i+1] ? 17 : 0;
+ k[4*i+2] = a[4*i+2] < b[4*i+2] ? 17 : 0;
+ k[4*i+3] = a[4*i+3] < b[4*i+3] ? 17 : 0;
+ }
+}
+
+__attribute__((noinline, noclone)) void
+f2 (void)
+{
+ int i;
+ for (i = 0; i < N/2; ++i)
+ {
+ k[2*i] = a[2*i] < b[2*i] ? 0 : 24;
+ k[2*i+1] = a[2*i+1] < b[2*i+1] ? 7 : 4;
+ }
+}
+
+__attribute__((noinline, noclone)) void
+f3 (void)
+{
+ int i;
+ for (i = 0; i < N/2; ++i)
+ {
+ k[2*i] = a[2*i] < b[2*i] ? 51 : 12;
+ k[2*i+1] = a[2*i+1] > b[2*i+1] ? 51 : 12;
+ }
+}
+
+__attribute__((noinline, noclone)) void
+f4 (void)
+{
+ int i;
+ for (i = 0; i < N/2; ++i)
+ {
+ int d0 = d[2*i], e0 = e[2*i];
+ int d1 = d[2*i+1], e1 = e[2*i+1];
+ f[2*i] = a[2*i] >= b[2*i] ? d0 : e0;
+ f[2*i+1] = a[2*i+1] >= b[2*i+1] ? d1 : e1;
+ }
+}
+
+int
+main ()
+{
+ int i;
+
+ check_vect ();
+
+ for (i = 0; i < N; i++)
+ {
+ switch (i % 9)
+ {
+ case 0: asm (""); a[i] = - i - 1; b[i] = i + 1; break;
+ case 1: a[i] = 0; b[i] = 0; break;
+ case 2: a[i] = i + 1; b[i] = - i - 1; break;
+ case 3: a[i] = i; b[i] = i + 7; break;
+ case 4: a[i] = i; b[i] = i; break;
+ case 5: a[i] = i + 16; b[i] = i + 3; break;
+ case 6: a[i] = - i - 5; b[i] = - i; break;
+ case 7: a[i] = - i; b[i] = - i; break;
+ case 8: a[i] = - i; b[i] = - i - 7; break;
+ }
+ d[i] = i;
+ e[i] = 2 * i;
+ }
+
+ f1 ();
+ for (i = 0; i < N; i++)
+ if (k[i] != ((i % 3) == 0 ? 17 : 0))
+ abort ();
+
+ f2 ();
+ for (i = 0; i < N; i++)
+ {
+ switch (i % 9)
+ {
+ case 0:
+ case 6:
+ if (k[i] != ((i/9 % 2) == 0 ? 0 : 7))
+ abort ();
+ break;
+ case 1:
+ case 5:
+ case 7:
+ if (k[i] != ((i/9 % 2) == 0 ? 4 : 24))
+ abort ();
+ break;
+ case 2:
+ case 4:
+ case 8:
+ if (k[i] != ((i/9 % 2) == 0 ? 24 : 4))
+ abort ();
+ break;
+ case 3:
+ if (k[i] != ((i/9 % 2) == 0 ? 7 : 0))
+ abort ();
+ break;
+ }
+ }
+
+ f3 ();
+
+ f4 ();
+ for (i = 0; i < N; i++)
+ if (f[i] != ((i % 3) == 0 ? e[i] : d[i]))
+ abort ();
+
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 3 "vect" } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/weak/typeof-2.c b/gcc/testsuite/gcc.dg/weak/typeof-2.c
index 63f427fc8c9..d13235fd972 100644
--- a/gcc/testsuite/gcc.dg/weak/typeof-2.c
+++ b/gcc/testsuite/gcc.dg/weak/typeof-2.c
@@ -5,6 +5,9 @@
/* { dg-require-weak "" } */
/* { dg-require-alias "" } */
/* { dg-options "-O2" } */
+/* Using -mshort-calls avoids loading the function addresses in
+ registers and thus getting the counts wrong. */
+/* { dg-additional-options "-mshort-calls" { target epiphany-*-* } } */
extern int foo1 (int x) __asm ("baz1");
int bar1 (int x) { return x; }
diff --git a/gcc/testsuite/gcc.misc-tests/gcov-12.c b/gcc/testsuite/gcc.misc-tests/gcov-12.c
new file mode 100644
index 00000000000..1898aadb4ce
--- /dev/null
+++ b/gcc/testsuite/gcc.misc-tests/gcov-12.c
@@ -0,0 +1,17 @@
+/* Test gcov weak ellision. */
+
+/* { dg-options "-fprofile-arcs -ftest-coverage" } */
+/* { dg-require-weak "" } */
+/* { dg-do run { target native } } */
+
+int __attribute__ ((weak)) weak ()
+{
+ return 0; /* count(1) */
+}
+
+int main ()
+{
+ return weak (); /* count(1) */
+}
+
+/* { dg-final { run-gcov { -a gcov-12.c } } } */
diff --git a/gcc/testsuite/gcc.misc-tests/gcov-13.c b/gcc/testsuite/gcc.misc-tests/gcov-13.c
new file mode 100644
index 00000000000..605d4d4b382
--- /dev/null
+++ b/gcc/testsuite/gcc.misc-tests/gcov-13.c
@@ -0,0 +1,18 @@
+/* Test gcov weak ellision. */
+
+/* { dg-options "-fprofile-arcs -ftest-coverage" } */
+/* { dg-require-weak "" } */
+/* { dg-do run { target native } } */
+/* { dg-additional-sources "gcovpart-13b.c" } */
+
+int __attribute__ ((weak)) weak ()
+{
+ return 1; /* count(-) */
+}
+
+int main ()
+{
+ return weak (); /* count(1) */
+}
+
+/* { dg-final { run-gcov { -a gcov-13.c } } } */
diff --git a/gcc/testsuite/gcc.misc-tests/gcov-14.c b/gcc/testsuite/gcc.misc-tests/gcov-14.c
new file mode 100644
index 00000000000..0eaf284a9c4
--- /dev/null
+++ b/gcc/testsuite/gcc.misc-tests/gcov-14.c
@@ -0,0 +1,24 @@
+/* Test gcov extern inline. */
+
+/* { dg-options "-O2 -fprofile-arcs -ftest-coverage" } */
+/* { dg-require-weak "" } */
+/* { dg-do run { target native } } */
+
+extern int __attribute__ ((weak)) Foo ();
+
+extern __inline int Foo ()
+{
+ return 0; /* count(-) */
+}
+
+int (* __attribute__ ((noinline)) Bar ()) ()
+{
+ return Foo; /* count(1) */
+}
+
+int main ()
+{
+ return Bar () != 0; /* count(1) */
+}
+
+/* { dg-final { run-gcov { -a gcov-14.c } } } */
diff --git a/gcc/testsuite/gcc.misc-tests/gcov.exp b/gcc/testsuite/gcc.misc-tests/gcov.exp
index d433b996392..85a1c34abd9 100644
--- a/gcc/testsuite/gcc.misc-tests/gcov.exp
+++ b/gcc/testsuite/gcc.misc-tests/gcov.exp
@@ -33,7 +33,7 @@ if { ![is_remote host] && [string match "*/*" [lindex $GCC_UNDER_TEST 0]] } {
dg-init
# Delete old .gcda files.
-set files [glob -nocomplain gcov-*.gcda]
+set files [glob -nocomplain gcov*.gcda]
if { $files != "" } {
eval "remote_file build delete $files"
}
diff --git a/gcc/testsuite/gcc.misc-tests/gcovpart-13b.c b/gcc/testsuite/gcc.misc-tests/gcovpart-13b.c
new file mode 100644
index 00000000000..0900ab48021
--- /dev/null
+++ b/gcc/testsuite/gcc.misc-tests/gcovpart-13b.c
@@ -0,0 +1,4 @@
+int weak ()
+{
+ return 0; /* count(1) */
+}
diff --git a/gcc/testsuite/gcc.target/arm/stack-red-zone.c b/gcc/testsuite/gcc.target/arm/stack-red-zone.c
new file mode 100644
index 00000000000..b9f0f99371e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/stack-red-zone.c
@@ -0,0 +1,12 @@
+/* No stack red zone. PR38644. */
+/* { dg-options "-mthumb -O2" } */
+/* { dg-final { scan-assembler "ldrb\[^\n\]*\\n\[\t \]*add\[\t \]*sp" } } */
+
+extern int doStreamReadBlock (int *, char *, int size, int);
+
+char readStream (int *s)
+{
+ char c = 0;
+ doStreamReadBlock (s, &c, 1, *s);
+ return c;
+}
diff --git a/gcc/testsuite/gcc.target/arm/wmul-1.c b/gcc/testsuite/gcc.target/arm/wmul-1.c
index 426c9393f20..ddddd509fe6 100644
--- a/gcc/testsuite/gcc.target/arm/wmul-1.c
+++ b/gcc/testsuite/gcc.target/arm/wmul-1.c
@@ -1,6 +1,6 @@
/* { dg-do compile } */
/* { dg-require-effective-target arm_dsp } */
-/* { dg-options "-O2" } */
+/* { dg-options "-O1 -fexpensive-optimizations" } */
int mac(const short *a, const short *b, int sqr, int *sum)
{
diff --git a/gcc/testsuite/gcc.target/arm/wmul-2.c b/gcc/testsuite/gcc.target/arm/wmul-2.c
index 898b5f065cb..2ea55f9fbe1 100644
--- a/gcc/testsuite/gcc.target/arm/wmul-2.c
+++ b/gcc/testsuite/gcc.target/arm/wmul-2.c
@@ -1,6 +1,6 @@
/* { dg-do compile } */
/* { dg-require-effective-target arm_dsp } */
-/* { dg-options "-O2" } */
+/* { dg-options "-O1 -fexpensive-optimizations" } */
void vec_mpy(int y[], const short x[], short scaler)
{
diff --git a/gcc/testsuite/gcc.target/arm/wmul-3.c b/gcc/testsuite/gcc.target/arm/wmul-3.c
index 83f73fba727..144b553082e 100644
--- a/gcc/testsuite/gcc.target/arm/wmul-3.c
+++ b/gcc/testsuite/gcc.target/arm/wmul-3.c
@@ -1,6 +1,6 @@
/* { dg-do compile } */
/* { dg-require-effective-target arm_dsp } */
-/* { dg-options "-O2" } */
+/* { dg-options "-O1 -fexpensive-optimizations" } */
int mac(const short *a, const short *b, int sqr, int *sum)
{
diff --git a/gcc/testsuite/gcc.target/arm/wmul-4.c b/gcc/testsuite/gcc.target/arm/wmul-4.c
index a297bda2182..68f9866746d 100644
--- a/gcc/testsuite/gcc.target/arm/wmul-4.c
+++ b/gcc/testsuite/gcc.target/arm/wmul-4.c
@@ -1,6 +1,6 @@
/* { dg-do compile } */
/* { dg-require-effective-target arm_dsp } */
-/* { dg-options "-O2" } */
+/* { dg-options "-O1 -fexpensive-optimizations" } */
int mac(const int *a, const int *b, long long sqr, long long *sum)
{
diff --git a/gcc/testsuite/gcc.target/epiphany/epiphany.exp b/gcc/testsuite/gcc.target/epiphany/epiphany.exp
new file mode 100644
index 00000000000..dc9fecc728e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/epiphany/epiphany.exp
@@ -0,0 +1,41 @@
+# Copyright (C) 2007, 2011 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GCC; see the file COPYING3. If not see
+# <http://www.gnu.org/licenses/>.
+
+# GCC testsuite that uses the `dg.exp' driver.
+
+# Exit immediately if this isn't an epiphany target.
+if ![istarget epiphany*-*-*] then {
+ return
+}
+
+# Load support procs.
+load_lib gcc-dg.exp
+
+# If a testcase doesn't have special options, use these.
+global DEFAULT_CFLAGS
+if ![info exists DEFAULT_CFLAGS] then {
+ set DEFAULT_CFLAGS " -ansi -pedantic-errors"
+}
+
+# Initialize `dg'.
+dg-init
+
+# Main loop.
+dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] \
+ "" $DEFAULT_CFLAGS
+
+# All done.
+dg-finish
diff --git a/gcc/testsuite/gcc.target/epiphany/fmadd-1.c b/gcc/testsuite/gcc.target/epiphany/fmadd-1.c
new file mode 100644
index 00000000000..868d5bd0226
--- /dev/null
+++ b/gcc/testsuite/gcc.target/epiphany/fmadd-1.c
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+/* { dg-final { scan-assembler-times "fmadd\[ \ta-zA-Z0-9\]*," 2 } } */
+
+#include <epiphany_intrinsics.h>
+
+float
+f1 (float a, float b, float c)
+{
+ return __builtin_epiphany_fmadd (a, b, c);
+}
+
+float
+f2 (float a, float b, float c)
+{
+ return a + b * c;
+}
diff --git a/gcc/testsuite/gcc.target/epiphany/fmsub-1.c b/gcc/testsuite/gcc.target/epiphany/fmsub-1.c
new file mode 100644
index 00000000000..ff7fefa7f20
--- /dev/null
+++ b/gcc/testsuite/gcc.target/epiphany/fmsub-1.c
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+/* { dg-final { scan-assembler-times "fmsub\[ \ta-zA-Z0-9\]*," 2 } } */
+
+#include <epiphany_intrinsics.h>
+
+float
+f1 (float a, float b, float c)
+{
+ return __builtin_epiphany_fmsub (a, b, c);
+}
+
+float
+f2 (float a, float b, float c)
+{
+ return a - b * c;
+}
diff --git a/gcc/testsuite/gcc.target/epiphany/interrupt.c b/gcc/testsuite/gcc.target/epiphany/interrupt.c
new file mode 100644
index 00000000000..a44c79e432e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/epiphany/interrupt.c
@@ -0,0 +1,14 @@
+void __attribute__((interrupt("dma0")))
+f (void)
+{
+}
+
+void __attribute__((interrupt("Vss")))
+g (void)
+{ /* { dg-warning "is not \"reset\"" } */
+}
+
+void __attribute__((interrupt(42)))
+h (void)
+{ /* { dg-warning "is not a string constant" } */
+}
diff --git a/gcc/testsuite/gcc.target/i386/47698.c b/gcc/testsuite/gcc.target/i386/47698.c
new file mode 100644
index 00000000000..2c751093ae3
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/47698.c
@@ -0,0 +1,10 @@
+/* { dg-options "-Os" } */
+/* { dg-final { scan-assembler-not "cmov" } } */
+
+extern volatile unsigned long mmio;
+unsigned long foo(int cond)
+{
+ if (cond)
+ return mmio;
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/i386/avx-cvt-2.c b/gcc/testsuite/gcc.target/i386/avx-cvt-2.c
index 78c6398f341..68206f5a0e7 100644
--- a/gcc/testsuite/gcc.target/i386/avx-cvt-2.c
+++ b/gcc/testsuite/gcc.target/i386/avx-cvt-2.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O3 -mavx -mno-avx2 -fdump-tree-vect-details" } */
+/* { dg-options "-O3 -mavx -mno-avx2 -mtune=generic -fdump-tree-vect-details" } */
#include "avx-cvt-1.c"
diff --git a/gcc/testsuite/gcc.target/i386/avx2-cvt-2.c b/gcc/testsuite/gcc.target/i386/avx2-cvt-2.c
index 288e5601a46..4826e9b6d05 100644
--- a/gcc/testsuite/gcc.target/i386/avx2-cvt-2.c
+++ b/gcc/testsuite/gcc.target/i386/avx2-cvt-2.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O3 -mavx2 -fdump-tree-vect-details" } */
+/* { dg-options "-O3 -mavx2 -mtune=generic -fdump-tree-vect-details" } */
#include "avx2-cvt-1.c"
diff --git a/gcc/testsuite/gcc.target/i386/avx2-gather-1.c b/gcc/testsuite/gcc.target/i386/avx2-gather-1.c
new file mode 100644
index 00000000000..7ed567dc491
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx2-gather-1.c
@@ -0,0 +1,215 @@
+/* { dg-do run } */
+/* { dg-require-effective-target avx2 } */
+/* { dg-options "-O3 -mavx2" } */
+
+#include "avx2-check.h"
+
+#define N 1024
+float vf1[N+16], vf2[N];
+double vd1[N+16], vd2[N];
+int k[N];
+long l[N];
+short n[N];
+
+__attribute__((noinline, noclone)) void
+f1 (void)
+{
+ int i;
+ for (i = 0; i < N; i++)
+ vf2[i] = vf1[k[i]];
+}
+
+__attribute__((noinline, noclone)) void
+f2 (void)
+{
+ int i;
+ for (i = 0; i < N; i++)
+ n[i] = (int) vf1[k[i]];
+}
+
+__attribute__((noinline, noclone)) void
+f3 (int x)
+{
+ int i;
+ for (i = 0; i < N; i++)
+ vf2[i] = vf1[k[i] + x];
+}
+
+__attribute__((noinline, noclone)) void
+f4 (int x)
+{
+ int i;
+ for (i = 0; i < N; i++)
+ n[i] = (int) vf1[k[i] + x];
+}
+
+__attribute__((noinline, noclone)) void
+f5 (void)
+{
+ int i;
+ for (i = 0; i < N; i++)
+ vd2[i] = vd1[k[i]];
+}
+
+__attribute__((noinline, noclone)) void
+f6 (void)
+{
+ int i;
+ for (i = 0; i < N; i++)
+ n[i] = (int) vd1[k[i]];
+}
+
+__attribute__((noinline, noclone)) void
+f7 (int x)
+{
+ int i;
+ for (i = 0; i < N; i++)
+ vd2[i] = vd1[k[i] + x];
+}
+
+__attribute__((noinline, noclone)) void
+f8 (int x)
+{
+ int i;
+ for (i = 0; i < N; i++)
+ n[i] = (int) vd1[k[i] + x];
+}
+
+__attribute__((noinline, noclone)) void
+f9 (void)
+{
+ int i;
+ for (i = 0; i < N; i++)
+ vf2[i] = vf1[l[i]];
+}
+
+__attribute__((noinline, noclone)) void
+f10 (void)
+{
+ int i;
+ for (i = 0; i < N; i++)
+ n[i] = (int) vf1[l[i]];
+}
+
+__attribute__((noinline, noclone)) void
+f11 (long x)
+{
+ int i;
+ for (i = 0; i < N; i++)
+ vf2[i] = vf1[l[i] + x];
+}
+
+__attribute__((noinline, noclone)) void
+f12 (long x)
+{
+ int i;
+ for (i = 0; i < N; i++)
+ n[i] = (int) vf1[l[i] + x];
+}
+
+__attribute__((noinline, noclone)) void
+f13 (void)
+{
+ int i;
+ for (i = 0; i < N; i++)
+ vd2[i] = vd1[l[i]];
+}
+
+__attribute__((noinline, noclone)) void
+f14 (void)
+{
+ int i;
+ for (i = 0; i < N; i++)
+ n[i] = (int) vd1[l[i]];
+}
+
+__attribute__((noinline, noclone)) void
+f15 (long x)
+{
+ int i;
+ for (i = 0; i < N; i++)
+ vd2[i] = vd1[l[i] + x];
+}
+
+__attribute__((noinline, noclone)) void
+f16 (long x)
+{
+ int i;
+ for (i = 0; i < N; i++)
+ n[i] = (int) vd1[l[i] + x];
+}
+
+static void
+avx2_test (void)
+{
+ int i;
+
+ for (i = 0; i < N + 16; i++)
+ {
+ asm ("");
+ vf1[i] = 17.0f + i;
+ vd1[i] = 19.0 + i;
+ }
+ for (i = 0; i < N; i++)
+ {
+ asm ("");
+ k[i] = (i * 731) & (N - 1);
+ l[i] = (i * 657) & (N - 1);
+ }
+
+ f1 ();
+ f2 ();
+ for (i = 0; i < N; i++)
+ if (vf2[i] != ((i * 731) & (N - 1)) + 17
+ || n[i] != ((i * 731) & (N - 1)) + 17)
+ abort ();
+
+ f3 (12);
+ f4 (14);
+ for (i = 0; i < N; i++)
+ if (vf2[i] != ((i * 731) & (N - 1)) + 17 + 12
+ || n[i] != ((i * 731) & (N - 1)) + 17 + 14)
+ abort ();
+
+ f5 ();
+ f6 ();
+ for (i = 0; i < N; i++)
+ if (vd2[i] != ((i * 731) & (N - 1)) + 19
+ || n[i] != ((i * 731) & (N - 1)) + 19)
+ abort ();
+
+ f7 (7);
+ f8 (9);
+ for (i = 0; i < N; i++)
+ if (vd2[i] != ((i * 731) & (N - 1)) + 19 + 7
+ || n[i] != ((i * 731) & (N - 1)) + 19 + 9)
+ abort ();
+
+ f9 ();
+ f10 ();
+ for (i = 0; i < N; i++)
+ if (vf2[i] != ((i * 657) & (N - 1)) + 17
+ || n[i] != ((i * 657) & (N - 1)) + 17)
+ abort ();
+
+ f11 (2);
+ f12 (4);
+ for (i = 0; i < N; i++)
+ if (vf2[i] != ((i * 657) & (N - 1)) + 17 + 2
+ || n[i] != ((i * 657) & (N - 1)) + 17 + 4)
+ abort ();
+
+ f13 ();
+ f14 ();
+ for (i = 0; i < N; i++)
+ if (vd2[i] != ((i * 657) & (N - 1)) + 19
+ || n[i] != ((i * 657) & (N - 1)) + 19)
+ abort ();
+
+ f15 (13);
+ f16 (15);
+ for (i = 0; i < N; i++)
+ if (vd2[i] != ((i * 657) & (N - 1)) + 19 + 13
+ || n[i] != ((i * 657) & (N - 1)) + 19 + 15)
+ abort ();
+}
diff --git a/gcc/testsuite/gcc.target/i386/avx2-gather-2.c b/gcc/testsuite/gcc.target/i386/avx2-gather-2.c
new file mode 100644
index 00000000000..8a7fe95a238
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx2-gather-2.c
@@ -0,0 +1,7 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -mavx2 -fdump-tree-vect-details" } */
+
+#include "avx2-gather-1.c"
+
+/* { dg-final { scan-tree-dump-times "note: vectorized 1 loops in function" 16 "vect" } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/gcc.target/i386/avx2-gather-3.c b/gcc/testsuite/gcc.target/i386/avx2-gather-3.c
new file mode 100644
index 00000000000..fb6289c0e7e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx2-gather-3.c
@@ -0,0 +1,167 @@
+/* { dg-do run } */
+/* { dg-require-effective-target avx2 } */
+/* { dg-options "-O3 -mavx2 -ffast-math" } */
+
+#include "avx2-check.h"
+
+#define N 1024
+float f[N];
+double d[N];
+int k[N];
+float *l[N];
+double *n[N];
+int **m[N];
+long **o[N];
+long q[N];
+long *r[N];
+int *s[N];
+
+__attribute__((noinline, noclone)) float
+f1 (void)
+{
+ int i;
+ float g = 0.0;
+ for (i = 0; i < N / 2; i++)
+ g += f[k[i]];
+ return g;
+}
+
+__attribute__((noinline, noclone)) float
+f2 (float *p)
+{
+ int i;
+ float g = 0.0;
+ for (i = 0; i < N / 2; i++)
+ g += p[k[i]];
+ return g;
+}
+
+__attribute__((noinline, noclone)) float
+f3 (void)
+{
+ int i;
+ float g = 0.0;
+ for (i = 0; i < N / 2; i++)
+ g += *l[i];
+ return g;
+}
+
+__attribute__((noinline, noclone)) int
+f4 (void)
+{
+ int i;
+ int g = 0;
+ for (i = 0; i < N / 2; i++)
+ g += **m[i];
+ return g;
+}
+
+__attribute__((noinline, noclone)) double
+f5 (void)
+{
+ int i;
+ double g = 0.0;
+ for (i = 0; i < N / 2; i++)
+ g += d[k[i]];
+ return g;
+}
+
+__attribute__((noinline, noclone)) double
+f6 (double *p)
+{
+ int i;
+ double g = 0.0;
+ for (i = 0; i < N / 2; i++)
+ g += p[k[i]];
+ return g;
+}
+
+__attribute__((noinline, noclone)) double
+f7 (void)
+{
+ int i;
+ double g = 0.0;
+ for (i = 0; i < N / 2; i++)
+ g += *n[i];
+ return g;
+}
+
+__attribute__((noinline, noclone)) int
+f8 (void)
+{
+ int i;
+ int g = 0;
+ for (i = 0; i < N / 2; i++)
+ g += **o[i];
+ return g;
+}
+
+__attribute__((noinline, noclone)) float
+f9 (void)
+{
+ int i;
+ float g = 0.0;
+ for (i = 0; i < N / 2; i++)
+ g += f[q[i]];
+ return g;
+}
+
+__attribute__((noinline, noclone)) float
+f10 (float *p)
+{
+ int i;
+ float g = 0.0;
+ for (i = 0; i < N / 2; i++)
+ g += p[q[i]];
+ return g;
+}
+
+__attribute__((noinline, noclone)) double
+f11 (void)
+{
+ int i;
+ double g = 0.0;
+ for (i = 0; i < N / 2; i++)
+ g += d[q[i]];
+ return g;
+}
+
+__attribute__((noinline, noclone)) double
+f12 (double *p)
+{
+ int i;
+ double g = 0.0;
+ for (i = 0; i < N / 2; i++)
+ g += p[q[i]];
+ return g;
+}
+
+static void
+avx2_test (void)
+{
+ int i;
+
+ for (i = 0; i < N; i++)
+ {
+ asm ("");
+ f[i] = -256.0f + i;
+ d[i] = -258.0 + i;
+ k[i] = (i * 731) & (N - 1);
+ q[i] = (i * 657) & (N - 1);
+ l[i] = &f[(i * 239) & (N - 1)];
+ n[i] = &d[(i * 271) & (N - 1)];
+ r[i] = &q[(i * 323) & (N - 1)];
+ s[i] = &k[(i * 565) & (N - 1)];
+ m[i] = &s[(i * 13) & (N - 1)];
+ o[i] = &r[(i * 19) & (N - 1)];
+ }
+
+ if (f1 () != 136448.0f || f2 (f) != 136448.0f || f3 () != 130304.0)
+ abort ();
+ if (f4 () != 261376 || f5 () != 135424.0 || f6 (d) != 135424.0)
+ abort ();
+ if (f7 () != 129280.0 || f8 () != 259840L || f9 () != 130816.0f)
+ abort ();
+ if (f10 (f) != 130816.0f || f11 () != 129792.0 || f12 (d) != 129792.0)
+ abort ();
+}
diff --git a/gcc/testsuite/gcc.target/i386/avx2-gather-4.c b/gcc/testsuite/gcc.target/i386/avx2-gather-4.c
new file mode 100644
index 00000000000..440a9c9b164
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx2-gather-4.c
@@ -0,0 +1,38 @@
+/* { dg-do run } */
+/* { dg-require-effective-target avx2 } */
+/* { dg-options "-O3 -mavx2" } */
+
+#include "avx2-check.h"
+
+#define N 1024
+int a[N], b[N], c[N], d[N];
+
+__attribute__((noinline, noclone)) void
+foo (float *__restrict p, float *__restrict q, float *__restrict r,
+ long s1, long s2, long s3)
+{
+ int i;
+ for (i = 0; i < N; i++)
+ p[i] = q[a[i] * s1 + b[i] * s2 + s3] * r[c[i] * s1 + d[i] * s2 + s3];
+}
+
+static void
+avx2_test (void)
+{
+ int i;
+ float e[N], f[N], g[N];
+ for (i = 0; i < N; i++)
+ {
+ a[i] = (i * 7) & (N / 8 - 1);
+ b[i] = (i * 13) & (N / 8 - 1);
+ c[i] = (i * 23) & (N / 8 - 1);
+ d[i] = (i * 5) & (N / 8 - 1);
+ e[i] = 16.5 + i;
+ f[i] = 127.5 - i;
+ }
+ foo (g, e, f, 3, 2, 4);
+ for (i = 0; i < N; i++)
+ if (g[i] != (float) ((20.5 + a[i] * 3 + b[i] * 2)
+ * (123.5 - c[i] * 3 - d[i] * 2)))
+ abort ();
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr49781-1.c b/gcc/testsuite/gcc.target/i386/pr49781-1.c
index 80db03416e5..60f9d50d866 100644
--- a/gcc/testsuite/gcc.target/i386/pr49781-1.c
+++ b/gcc/testsuite/gcc.target/i386/pr49781-1.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -fpic" } */
+/* { dg-options "-O2 -fpic -mtune=generic" } */
/* { dg-require-effective-target fpic } */
static int heap[2*(256 +1+29)+1];
diff --git a/gcc/testsuite/gcc.target/i386/sse2-cvt-2.c b/gcc/testsuite/gcc.target/i386/sse2-cvt-2.c
index 9c4519544ca..00f13254c22 100644
--- a/gcc/testsuite/gcc.target/i386/sse2-cvt-2.c
+++ b/gcc/testsuite/gcc.target/i386/sse2-cvt-2.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O3 -msse2 -mno-sse3 -fdump-tree-vect-details" } */
+/* { dg-options "-O3 -msse2 -mno-sse3 -mtune=generic -fdump-tree-vect-details" } */
#include "sse2-cvt-1.c"
diff --git a/gcc/testsuite/gcc.target/i386/vectorize4-avx.c b/gcc/testsuite/gcc.target/i386/vectorize4-avx.c
index 8e4a747a64b..33e99189373 100644
--- a/gcc/testsuite/gcc.target/i386/vectorize4-avx.c
+++ b/gcc/testsuite/gcc.target/i386/vectorize4-avx.c
@@ -11,4 +11,4 @@ calc_freq (int *dest)
dest[i] = sqrt (tmp_out[i]);
}
-/* { dg-final { scan-assembler "vsqrtpd\[ \\t\]+\[^\n\]*%ymm" { xfail *-*-* } } } */
+/* { dg-final { scan-assembler "vsqrtpd\[ \\t\]+\[^\n\]*%ymm" } } */
diff --git a/gcc/testsuite/gcc.target/sparc/20111102-1.c b/gcc/testsuite/gcc.target/sparc/20111102-1.c
new file mode 100644
index 00000000000..d33f103e377
--- /dev/null
+++ b/gcc/testsuite/gcc.target/sparc/20111102-1.c
@@ -0,0 +1,17 @@
+/* PR target/50945 */
+/* { dg-do compile } */
+/* { dg-options "-O -msoft-float" } */
+
+double
+__powidf2 (double x, int m)
+{
+ unsigned int n = m < 0 ? -m : m;
+ double y = n % 2 ? x : 1;
+ while (n >>= 1)
+ {
+ x = x * x;
+ if (n % 2)
+ y = y * x;
+ }
+ return m < 0 ? 1/y : y;
+}
diff --git a/gcc/testsuite/gcc.target/sparc/vec-init-1-vis1.c b/gcc/testsuite/gcc.target/sparc/vec-init-1-vis1.c
new file mode 100644
index 00000000000..4202bfa6e72
--- /dev/null
+++ b/gcc/testsuite/gcc.target/sparc/vec-init-1-vis1.c
@@ -0,0 +1,5 @@
+/* { dg-do run } */
+/* { dg-require-effective-target ultrasparc_hw } */
+/* { dg-options "-mcpu=ultrasparc -mvis -O2" } */
+
+#include "vec-init-1.inc"
diff --git a/gcc/testsuite/gcc.target/sparc/vec-init-1-vis2.c b/gcc/testsuite/gcc.target/sparc/vec-init-1-vis2.c
new file mode 100644
index 00000000000..a5c21323936
--- /dev/null
+++ b/gcc/testsuite/gcc.target/sparc/vec-init-1-vis2.c
@@ -0,0 +1,5 @@
+/* { dg-do run } */
+/* { dg-require-effective-target ultrasparc_vis2_hw } */
+/* { dg-options "-mcpu=ultrasparc3 -O2" } */
+
+#include "vec-init-1.inc"
diff --git a/gcc/testsuite/gcc.target/sparc/vec-init-1-vis3.c b/gcc/testsuite/gcc.target/sparc/vec-init-1-vis3.c
new file mode 100644
index 00000000000..ab916e052cc
--- /dev/null
+++ b/gcc/testsuite/gcc.target/sparc/vec-init-1-vis3.c
@@ -0,0 +1,5 @@
+/* { dg-do run } */
+/* { dg-require-effective-target ultrasparc_vis3_hw } */
+/* { dg-options "-mcpu=niagara3 -O2" } */
+
+#include "vec-init-1.inc"
diff --git a/gcc/testsuite/gcc.target/sparc/vec-init-1.inc b/gcc/testsuite/gcc.target/sparc/vec-init-1.inc
new file mode 100644
index 00000000000..e27bb6e293b
--- /dev/null
+++ b/gcc/testsuite/gcc.target/sparc/vec-init-1.inc
@@ -0,0 +1,85 @@
+typedef int __v1si __attribute__ ((__vector_size__ (4)));
+typedef int __v2si __attribute__ ((__vector_size__ (8)));
+typedef short __v2hi __attribute__ ((__vector_size__ (4)));
+typedef short __v4hi __attribute__ ((__vector_size__ (8)));
+typedef unsigned char __v4qi __attribute__ ((__vector_size__ (4)));
+typedef unsigned char __v8qi __attribute__ ((__vector_size__ (8)));
+
+extern void abort (void);
+
+static void
+compare64 (void *p, unsigned long long val)
+{
+ if (*(unsigned long long *)p != val)
+ abort();
+}
+
+static void
+compare32 (void *p, unsigned int val)
+{
+ if (*(unsigned int *)p != val)
+ abort();
+}
+
+static void
+test_v8qi (unsigned char x)
+{
+ __v8qi v = { x, x, x, x, x, x, x, x };
+
+ compare64(&v, 0x4444444444444444ULL);
+}
+
+static void
+test_v4qi (unsigned char x)
+{
+ __v4qi v = { x, x, x, x };
+
+ compare32(&v, 0x44444444);
+}
+
+static void
+test_v4hi (unsigned short x)
+{
+ __v4hi v = { x, x, x, x, };
+
+ compare64(&v, 0x3344334433443344ULL);
+}
+
+static void
+test_v2hi (unsigned short x)
+{
+ __v2hi v = { x, x, };
+
+ compare32(&v, 0x33443344);
+}
+
+static void
+test_v2si (unsigned int x)
+{
+ __v2si v = { x, x, };
+
+ compare64(&v, 0x1122334411223344ULL);
+}
+
+static void
+test_v1si (unsigned int x)
+{
+ __v1si v = { x };
+
+ compare32(&v, 0x11223344);
+}
+
+unsigned char x8 = 0x44;
+unsigned short x16 = 0x3344;
+unsigned int x32 = 0x11223344;
+
+int main(void)
+{
+ test_v8qi (x8);
+ test_v4qi (x8);
+ test_v4hi (x16);
+ test_v2hi (x16);
+ test_v2si (x32);
+ test_v1si (x32);
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/sparc/vec-init-2-vis1.c b/gcc/testsuite/gcc.target/sparc/vec-init-2-vis1.c
new file mode 100644
index 00000000000..efa08fa248c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/sparc/vec-init-2-vis1.c
@@ -0,0 +1,5 @@
+/* { dg-do run } */
+/* { dg-require-effective-target ultrasparc_hw } */
+/* { dg-options "-mcpu=ultrasparc -mvis -O2" } */
+
+#include "vec-init-2.inc"
diff --git a/gcc/testsuite/gcc.target/sparc/vec-init-2-vis2.c b/gcc/testsuite/gcc.target/sparc/vec-init-2-vis2.c
new file mode 100644
index 00000000000..3aa0f51595f
--- /dev/null
+++ b/gcc/testsuite/gcc.target/sparc/vec-init-2-vis2.c
@@ -0,0 +1,5 @@
+/* { dg-do run } */
+/* { dg-require-effective-target ultrasparc_vis2_hw } */
+/* { dg-options "-mcpu=ultrasparc3 -O2" } */
+
+#include "vec-init-2.inc"
diff --git a/gcc/testsuite/gcc.target/sparc/vec-init-2-vis3.c b/gcc/testsuite/gcc.target/sparc/vec-init-2-vis3.c
new file mode 100644
index 00000000000..5f0c65860bc
--- /dev/null
+++ b/gcc/testsuite/gcc.target/sparc/vec-init-2-vis3.c
@@ -0,0 +1,5 @@
+/* { dg-do run } */
+/* { dg-require-effective-target ultrasparc_vis3_hw } */
+/* { dg-options "-mcpu=niagara3 -O2" } */
+
+#include "vec-init-2.inc"
diff --git a/gcc/testsuite/gcc.target/sparc/vec-init-2.inc b/gcc/testsuite/gcc.target/sparc/vec-init-2.inc
new file mode 100644
index 00000000000..13685a1006e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/sparc/vec-init-2.inc
@@ -0,0 +1,94 @@
+typedef short __v2hi __attribute__ ((__vector_size__ (4)));
+typedef short __v4hi __attribute__ ((__vector_size__ (8)));
+
+extern void abort (void);
+
+static void
+compare64 (int n, void *p, unsigned long long val)
+{
+ unsigned long long *x = (unsigned long long *) p;
+
+ if (*x != val)
+ abort();
+}
+
+static void
+compare32 (int n, void *p, unsigned int val)
+{
+ unsigned int *x = (unsigned int *) p;
+ if (*x != val)
+ abort();
+}
+
+#define V2HI_TEST(N, elt0, elt1) \
+static void \
+test_v2hi_##N (unsigned short x, unsigned short y) \
+{ \
+ __v2hi v = { (elt0), (elt1) }; \
+ compare32(N, &v, ((int)(elt0) << 16) | (elt1)); \
+}
+
+V2HI_TEST(1, x, y)
+V2HI_TEST(2, y, x)
+V2HI_TEST(3, x, x)
+V2HI_TEST(4, x, 0)
+V2HI_TEST(5, 0, x)
+V2HI_TEST(6, y, 1)
+V2HI_TEST(7, 1, y)
+V2HI_TEST(8, 2, 3)
+V2HI_TEST(9, 0x400, x)
+V2HI_TEST(10, y, 0x8000)
+
+#define V4HI_TEST(N, elt0, elt1, elt2, elt3) \
+static void \
+test_v4hi_##N (unsigned short a, unsigned short b, unsigned short c, unsigned short d) \
+{ \
+ __v4hi v = { (elt0), (elt1), (elt2), (elt3) }; \
+ compare64(N, &v, \
+ ((long long)(elt0) << 48) | \
+ ((long long)(elt1) << 32) | \
+ ((long long)(elt2) << 16) | \
+ ((long long)(elt3))); \
+}
+
+V4HI_TEST(1, a, a, a, a)
+V4HI_TEST(2, a, b, c, d)
+V4HI_TEST(3, a, a, b, b)
+V4HI_TEST(4, d, c, b, a)
+V4HI_TEST(5, a, 0, 0, 0)
+V4HI_TEST(6, a, 0, b, 0)
+V4HI_TEST(7, c, 5, 5, 5)
+V4HI_TEST(8, d, 6, a, 6)
+V4HI_TEST(9, 0x200, 0x300, 0x500, 0x8800)
+V4HI_TEST(10, 0x600, a, a, a)
+
+unsigned short a16 = 0x3344;
+unsigned short b16 = 0x5566;
+unsigned short c16 = 0x7788;
+unsigned short d16 = 0x9911;
+
+int main(void)
+{
+ test_v2hi_1 (a16, b16);
+ test_v2hi_2 (a16, b16);
+ test_v2hi_3 (a16, b16);
+ test_v2hi_4 (a16, b16);
+ test_v2hi_5 (a16, b16);
+ test_v2hi_6 (a16, b16);
+ test_v2hi_7 (a16, b16);
+ test_v2hi_8 (a16, b16);
+ test_v2hi_9 (a16, b16);
+ test_v2hi_10 (a16, b16);
+
+ test_v4hi_1 (a16, b16, c16, d16);
+ test_v4hi_2 (a16, b16, c16, d16);
+ test_v4hi_3 (a16, b16, c16, d16);
+ test_v4hi_4 (a16, b16, c16, d16);
+ test_v4hi_5 (a16, b16, c16, d16);
+ test_v4hi_6 (a16, b16, c16, d16);
+ test_v4hi_7 (a16, b16, c16, d16);
+ test_v4hi_8 (a16, b16, c16, d16);
+ test_v4hi_9 (a16, b16, c16, d16);
+ test_v4hi_10 (a16, b16, c16, d16);
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/sparc/vec-init-3-vis1.c b/gcc/testsuite/gcc.target/sparc/vec-init-3-vis1.c
new file mode 100644
index 00000000000..6c826108c29
--- /dev/null
+++ b/gcc/testsuite/gcc.target/sparc/vec-init-3-vis1.c
@@ -0,0 +1,5 @@
+/* { dg-do run } */
+/* { dg-require-effective-target ultrasparc_hw } */
+/* { dg-options "-mcpu=ultrasparc -mvis -O2" } */
+
+#include "vec-init-3.inc"
diff --git a/gcc/testsuite/gcc.target/sparc/vec-init-3-vis2.c b/gcc/testsuite/gcc.target/sparc/vec-init-3-vis2.c
new file mode 100644
index 00000000000..6424e2f1592
--- /dev/null
+++ b/gcc/testsuite/gcc.target/sparc/vec-init-3-vis2.c
@@ -0,0 +1,5 @@
+/* { dg-do run } */
+/* { dg-require-effective-target ultrasparc_vis2_hw } */
+/* { dg-options "-mcpu=ultrasparc3 -O2" } */
+
+#include "vec-init-3.inc"
diff --git a/gcc/testsuite/gcc.target/sparc/vec-init-3-vis3.c b/gcc/testsuite/gcc.target/sparc/vec-init-3-vis3.c
new file mode 100644
index 00000000000..226c108c5e5
--- /dev/null
+++ b/gcc/testsuite/gcc.target/sparc/vec-init-3-vis3.c
@@ -0,0 +1,5 @@
+/* { dg-do run } */
+/* { dg-require-effective-target ultrasparc_vis3_hw } */
+/* { dg-options "-mcpu=niagara3 -O2" } */
+
+#include "vec-init-3.inc"
diff --git a/gcc/testsuite/gcc.target/sparc/vec-init-3.inc b/gcc/testsuite/gcc.target/sparc/vec-init-3.inc
new file mode 100644
index 00000000000..8a3db2600a6
--- /dev/null
+++ b/gcc/testsuite/gcc.target/sparc/vec-init-3.inc
@@ -0,0 +1,105 @@
+typedef unsigned char __v4qi __attribute__ ((__vector_size__ (4)));
+typedef unsigned char __v8qi __attribute__ ((__vector_size__ (8)));
+
+extern void abort (void);
+
+static void
+compare64 (int n, void *p, unsigned long long val)
+{
+ unsigned long long *x = (unsigned long long *) p;
+
+ if (*x != val)
+ abort();
+}
+
+static void
+compare32 (int n, void *p, unsigned int val)
+{
+ unsigned int *x = (unsigned int *) p;
+ if (*x != val)
+ abort();
+}
+
+#define V4QI_TEST(N, elt0, elt1, elt2, elt3) \
+static void \
+test_v4qi_##N (unsigned char a, unsigned char b, unsigned char c, unsigned char d) \
+{ \
+ __v4qi v = { (elt0), (elt1), (elt2), (elt3) }; \
+ compare32(N, &v, ((int)(elt0) << 24) | \
+ ((int)(elt1) << 16) | \
+ ((int)(elt2) << 8) | ((int)(elt3))); \
+}
+
+V4QI_TEST(1, a, a, a, a)
+V4QI_TEST(2, b, b, b, b)
+V4QI_TEST(3, a, b, c, d)
+V4QI_TEST(4, d, c, b, a)
+V4QI_TEST(5, a, 0, 0, 0)
+V4QI_TEST(6, b, 1, 1, b)
+V4QI_TEST(7, c, 5, d, 5)
+V4QI_TEST(8, 0x20, 0x30, b, a)
+V4QI_TEST(9, 0x40, 0x50, 0x60, 0x70)
+V4QI_TEST(10, 0x40, 0x50, 0x60, c)
+
+#define V8QI_TEST(N, elt0, elt1, elt2, elt3, elt4, elt5, elt6, elt7) \
+static void \
+test_v8qi_##N (unsigned char a, unsigned char b, unsigned char c, unsigned char d, \
+ unsigned char e, unsigned char f, unsigned char g, unsigned char h) \
+{ \
+ __v8qi v = { (elt0), (elt1), (elt2), (elt3), \
+ (elt4), (elt5), (elt6), (elt7) }; \
+ compare64(N, &v, ((long long)(elt0) << 56) | \
+ ((long long)(elt1) << 48) | \
+ ((long long)(elt2) << 40) | \
+ ((long long)(elt3) << 32) | \
+ ((long long)(elt4) << 24) | \
+ ((long long)(elt5) << 16) | \
+ ((long long)(elt6) << 8) | \
+ ((long long)(elt7) << 0)); \
+}
+
+V8QI_TEST(1, a, a, a, a, a, a, a, a)
+V8QI_TEST(2, a, b, c, d, e, f, g, h)
+V8QI_TEST(3, h, g, f, e, d, c, b, a)
+V8QI_TEST(4, a, b, a, b, a, b, a, b)
+V8QI_TEST(5, c, b, c, b, c, b, c, a)
+V8QI_TEST(6, a, 0, 0, 0, 0, 0, 0, 0)
+V8QI_TEST(7, b, 1, b, 1, b, 1, b, 1)
+V8QI_TEST(8, c, d, 0x20, a, 0x21, b, 0x23, c)
+V8QI_TEST(9, 1, 2, 3, 4, 5, 6, 7, 8)
+V8QI_TEST(10, a, a, b, b, c, c, d, d)
+
+unsigned char a8 = 0x33;
+unsigned char b8 = 0x55;
+unsigned char c8 = 0x77;
+unsigned char d8 = 0x99;
+unsigned char e8 = 0x11;
+unsigned char f8 = 0x22;
+unsigned char g8 = 0x44;
+unsigned char h8 = 0x66;
+
+int main(void)
+{
+ test_v4qi_1 (a8, b8, c8, d8);
+ test_v4qi_2 (a8, b8, c8, d8);
+ test_v4qi_3 (a8, b8, c8, d8);
+ test_v4qi_4 (a8, b8, c8, d8);
+ test_v4qi_5 (a8, b8, c8, d8);
+ test_v4qi_6 (a8, b8, c8, d8);
+ test_v4qi_7 (a8, b8, c8, d8);
+ test_v4qi_8 (a8, b8, c8, d8);
+ test_v4qi_9 (a8, b8, c8, d8);
+ test_v4qi_10 (a8, b8, c8, d8);
+
+ test_v8qi_1 (a8, b8, c8, d8, e8, f8, g8, h8);
+ test_v8qi_2 (a8, b8, c8, d8, e8, f8, g8, h8);
+ test_v8qi_3 (a8, b8, c8, d8, e8, f8, g8, h8);
+ test_v8qi_4 (a8, b8, c8, d8, e8, f8, g8, h8);
+ test_v8qi_5 (a8, b8, c8, d8, e8, f8, g8, h8);
+ test_v8qi_6 (a8, b8, c8, d8, e8, f8, g8, h8);
+ test_v8qi_7 (a8, b8, c8, d8, e8, f8, g8, h8);
+ test_v8qi_8 (a8, b8, c8, d8, e8, f8, g8, h8);
+ test_v8qi_9 (a8, b8, c8, d8, e8, f8, g8, h8);
+ test_v8qi_10 (a8, b8, c8, d8, e8, f8, g8, h8);
+ return 0;
+}
diff --git a/gcc/testsuite/gfortran.dg/bind_c_dts_5.f90 b/gcc/testsuite/gfortran.dg/bind_c_dts_5.f90
new file mode 100644
index 00000000000..497c0501b11
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/bind_c_dts_5.f90
@@ -0,0 +1,54 @@
+! { dg-do compile }
+!
+! PR fortran/50933
+!
+! Check whether type-compatibility checks for BIND(C) work.
+!
+! Contributed by Richard Maine
+!
+
+MODULE liter_cb_mod
+USE ISO_C_BINDING
+CONTAINS
+ FUNCTION liter_cb(link_info) bind(C)
+ USE ISO_C_BINDING
+ IMPLICIT NONE
+
+ INTEGER(c_int) liter_cb
+
+ TYPE, bind(C) :: info_t
+ INTEGER(c_int) :: type
+ END TYPE info_t
+
+ TYPE(info_t) :: link_info
+
+ liter_cb = 0
+
+ END FUNCTION liter_cb
+
+END MODULE liter_cb_mod
+
+PROGRAM main
+ USE ISO_C_BINDING
+ interface
+ FUNCTION liter_cb(link_info) bind(C)
+ USE ISO_C_BINDING
+ IMPLICIT NONE
+ INTEGER(c_int) liter_cb
+ TYPE, bind(C) :: info_t
+ INTEGER(c_int) :: type
+ END TYPE info_t
+ TYPE(info_t) :: link_info
+ END FUNCTION liter_cb
+ end interface
+
+ TYPE, bind(C) :: info_t
+ INTEGER(c_int) :: type
+ END TYPE info_t
+ type(info_t) :: link_info
+
+ write (*,*) liter_cb(link_info)
+
+END PROGRAM main
+
+! { dg-final { cleanup-modules "liter_cb_mod" } }
diff --git a/gcc/testsuite/gfortran.dg/function_optimize_7.f90 b/gcc/testsuite/gfortran.dg/function_optimize_7.f90
index 212c8fbd491..e0c404b6a2a 100644
--- a/gcc/testsuite/gfortran.dg/function_optimize_7.f90
+++ b/gcc/testsuite/gfortran.dg/function_optimize_7.f90
@@ -12,6 +12,7 @@ subroutine xx(n, m, a, b, c, d, x, z, i, s_in, s_out)
real, intent(out) :: z
character(60) :: line
real, external :: ext_func
+ integer :: one = 1
interface
elemental function element(x)
real, intent(in) :: x
@@ -33,7 +34,7 @@ subroutine xx(n, m, a, b, c, d, x, z, i, s_in, s_out)
z = element(x) + element(x)
i = mypure(x) - mypure(x)
z = elem_impure(x) - elem_impure(x)
- s_out = sum(s_in,1) + 3.14 / sum(s_in,1) ! { dg-warning "Creating array temporary" }
+ s_out = sum(s_in,one) + 3.14 / sum(s_in,one) ! { dg-warning "Creating array temporary" }
end subroutine xx
! { dg-final { scan-tree-dump-times "matmul_r4" 1 "original" } }
! { dg-final { scan-tree-dump-times "__builtin_sinf" 1 "original" } }
diff --git a/gcc/testsuite/gfortran.dg/inline_product_1.f90 b/gcc/testsuite/gfortran.dg/inline_product_1.f90
new file mode 100644
index 00000000000..72c096bff4a
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/inline_product_1.f90
@@ -0,0 +1,32 @@
+! { dg-do compile }
+! { dg-options "-Warray-temporaries -O -fdump-tree-original" }
+!
+! PR fortran/43829
+! Scalarization of reductions.
+! Test that product is properly inlined.
+
+! For more extended tests, see inline_sum_1.f90
+
+ implicit none
+
+
+ integer :: i
+
+ integer, parameter :: q = 2
+ integer, parameter :: nx=3, ny=2*q, nz=5
+ integer, parameter, dimension(nx,ny,nz) :: p = &
+ & reshape ((/ (i, i=1,size(p)) /), shape(p))
+
+
+ integer, dimension(nx,ny,nz) :: a
+ integer, dimension(nx, nz) :: ay
+
+ a = p
+
+ ay = product(a,2)
+
+end
+! { dg-final { scan-tree-dump-times "struct array._integer\\(kind=4\\) atmp" 0 "original" } }
+! { dg-final { scan-tree-dump-times "struct array\[^\\n\]*atmp" 0 "original" } }
+! { dg-final { scan-tree-dump-times "_gfortran_product_" 0 "original" } }
+! { dg-final { cleanup-tree-dump "original" } }
diff --git a/gcc/testsuite/gfortran.dg/inline_sum_1.f90 b/gcc/testsuite/gfortran.dg/inline_sum_1.f90
new file mode 100644
index 00000000000..4538e5e117f
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/inline_sum_1.f90
@@ -0,0 +1,194 @@
+! { dg-do compile }
+! { dg-options "-Warray-temporaries -O -fdump-tree-original" }
+!
+! PR fortran/43829
+! Scalarization of reductions.
+! Test that sum is properly inlined.
+
+! This is the compile time test only; for the runtime test see inline_sum_2.f90
+! We can't test for temporaries on the run time test directly, as it tries
+! several optimization options among which -Os, and sum inlining is disabled
+! at -Os.
+
+
+ implicit none
+
+
+ integer :: i, j, k
+
+ integer, parameter :: q = 2
+ integer, parameter :: nx=3, ny=2*q, nz=5
+ integer, parameter, dimension(nx,ny,nz) :: p = &
+ & reshape ((/ (i**2, i=1,size(p)) /), shape(p))
+
+ integer, parameter, dimension( ny,nz) :: px = &
+ & reshape ((/ (( &
+ & nx*( nx*j+nx*ny*k+1)*( nx*j+nx*ny*k+1+ (nx-1)) &
+ & + nx*(nx-1)*(2*nx-1)/6, &
+ & j=0,ny-1), k=0,nz-1) /), shape(px))
+
+ integer, parameter, dimension(nx, nz) :: py = &
+ & reshape ((/ (( &
+ & ny*(i +nx*ny*k+1)*(i +nx*ny*k+1+nx *(ny-1)) &
+ & +(nx )**2*ny*(ny-1)*(2*ny-1)/6, &
+ & i=0,nx-1), k=0,nz-1) /), shape(py))
+
+ integer, parameter, dimension(nx,ny ) :: pz = &
+ & reshape ((/ (( &
+ & nz*(i+nx*j +1)*(i+nx*j +1+nx*ny*(nz-1)) &
+ & +(nx*ny)**2*nz*(nz-1)*(2*nz-1)/6, &
+ & i=0,nx-1), j=0,ny-1) /), shape(pz))
+
+
+ integer, dimension(nx,ny,nz) :: a
+ integer, dimension( ny,nz) :: ax
+ integer, dimension(nx, nz) :: ay
+ integer, dimension(nx,ny ) :: az
+
+ logical, dimension(nx,ny,nz) :: m, true
+
+
+ integer, dimension(nx,ny) :: b
+
+ integer, dimension(nx,nx) :: onesx
+ integer, dimension(ny,ny) :: onesy
+ integer, dimension(nz,nz) :: onesz
+
+
+ a = p
+ m = reshape((/ ((/ .true., .false. /), i=1,size(m)/2) /), shape(m))
+ true = reshape((/ (.true., i=1,size(true)) /), shape(true))
+
+ onesx = reshape((/ ((1, j=1,i),(0,j=1,nx-i),i=1,size(onesx,2)) /), shape(onesx))
+ onesy = reshape((/ ((1, j=1,i),(0,j=1,ny-i),i=1,size(onesy,2)) /), shape(onesy))
+ onesz = reshape((/ ((1, j=1,i),(0,j=1,nz-i),i=1,size(onesz,2)) /), shape(onesz))
+
+ ! Correct results in simple cases
+ ax = sum(a,1)
+ if (any(ax /= px)) call abort
+
+ ay = sum(a,2)
+ if (any(ay /= py)) call abort
+
+ az = sum(a,3)
+ if (any(az /= pz)) call abort
+
+
+ ! Masks work
+ if (any(sum(a,1,.false.) /= 0)) call abort
+ if (any(sum(a,2,.true.) /= py)) call abort
+ if (any(sum(a,3,m) /= merge(pz,0,m(:,:,1)))) call abort
+ if (any(sum(a,2,m) /= merge(sum(a(:, ::2,:),2),&
+ sum(a(:,2::2,:),2),&
+ m(:,1,:)))) call abort
+
+
+ ! It works too with array constructors ...
+ if (any(sum( &
+ reshape((/ (i*i,i=1,size(a)) /), shape(a)), &
+ 1, &
+ true) /= ax)) call abort
+
+ ! ... and with vector subscripts
+ if (any(sum( &
+ a((/ (i,i=1,nx) /), &
+ (/ (i,i=1,ny) /), &
+ (/ (i,i=1,nz) /)), &
+ 1) /= ax)) call abort
+
+ if (any(sum( &
+ a(sum(onesx(:,:),1), & ! unnecessary { dg-warning "Creating array temporary" }
+ sum(onesy(:,:),1), & ! unnecessary { dg-warning "Creating array temporary" }
+ sum(onesz(:,:),1)), & ! unnecessary { dg-warning "Creating array temporary" }
+ 1) /= ax)) call abort
+
+
+ ! Nested sums work
+ if (sum(sum(sum(a,1),1),1) /= sum(a)) call abort
+ if (sum(sum(sum(a,1),2),1) /= sum(a)) call abort
+ if (sum(sum(sum(a,3),1),1) /= sum(a)) call abort
+ if (sum(sum(sum(a,3),2),1) /= sum(a)) call abort
+
+ if (any(sum(sum(a,1),1) /= sum(sum(a,2),1))) call abort
+ if (any(sum(sum(a,1),2) /= sum(sum(a,3),1))) call abort
+ if (any(sum(sum(a,2),2) /= sum(sum(a,3),2))) call abort
+
+
+ ! Temps are unavoidable here (function call's argument or result)
+ ax = sum(neid3(a),1) ! { dg-warning "Creating array temporary" }
+ ! Sums as part of a bigger expr work
+ if (any(1+sum(eid(a),1)+ax+sum( &
+ neid3(a), & ! { dg-warning "Creating array temporary" }
+ 1)+1 /= 3*ax+2)) call abort
+ if (any(1+eid(sum(a,2))+ay+ &
+ neid2( & ! { dg-warning "Creating array temporary" }
+ sum(a,2) & ! { dg-warning "Creating array temporary" }
+ )+1 /= 3*ay+2)) call abort
+ if (any(sum(eid(sum(a,3))+az+2* &
+ neid2(az) & ! { dg-warning "Creating array temporary" }
+ ,1)+1 /= 4*sum(az,1)+1)) call abort
+
+ if (any(sum(transpose(sum(a,1)),1)+sum(az,1) /= sum(ax,2)+sum(sum(a,3),1))) call abort
+
+
+ ! Creates a temp when needed.
+ a(1,:,:) = sum(a,1) ! unnecessary { dg-warning "Creating array temporary" }
+ if (any(a(1,:,:) /= ax)) call abort
+
+ b = p(:,:,1)
+ call set(b(2:,1), sum(b(:nx-1,:),2)) ! { dg-warning "Creating array temporary" }
+ if (any(b(2:,1) /= ay(1:nx-1,1))) call abort
+
+ b = p(:,:,1)
+ call set(b(:,1), sum(b,2)) ! unnecessary { dg-warning "Creating array temporary" }
+ if (any(b(:,1) /= ay(:,1))) call abort
+
+ b = p(:,:,1)
+ call tes(sum(eid(b(:nx-1,:)),2), b(2:,1)) ! { dg-warning "Creating array temporary" }
+ if (any(b(2:,1) /= ay(1:nx-1,1))) call abort
+
+ b = p(:,:,1)
+ call tes(eid(sum(b,2)), b(:,1)) ! unnecessary { dg-warning "Creating array temporary" }
+ if (any(b(:,1) /= ay(:,1))) call abort
+
+contains
+
+ elemental function eid (x)
+ integer, intent(in) :: x
+ integer :: eid
+
+ eid = x
+ end function eid
+
+ function neid2 (x)
+ integer, intent(in) :: x(:,:)
+ integer :: neid2(size(x,1),size(x,2))
+
+ neid2 = x
+ end function neid2
+
+ function neid3 (x)
+ integer, intent(in) :: x(:,:,:)
+ integer :: neid3(size(x,1),size(x,2),size(x,3))
+
+ neid3 = x
+ end function neid3
+
+ elemental subroutine set (o, i)
+ integer, intent(in) :: i
+ integer, intent(out) :: o
+
+ o = i
+ end subroutine set
+
+ elemental subroutine tes (i, o)
+ integer, intent(in) :: i
+ integer, intent(out) :: o
+
+ o = i
+ end subroutine tes
+end
+! { dg-final { scan-tree-dump-times "struct array._integer\\(kind=4\\) atmp" 13 "original" } }
+! { dg-final { scan-tree-dump-times "struct array\[^\\n\]*atmp" 13 "original" } }
+! { dg-final { scan-tree-dump-times "_gfortran_sum_" 0 "original" } }
+! { dg-final { cleanup-tree-dump "original" } }
diff --git a/gcc/testsuite/gfortran.dg/inline_sum_2.f90 b/gcc/testsuite/gfortran.dg/inline_sum_2.f90
new file mode 100644
index 00000000000..0b7c60ad9e9
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/inline_sum_2.f90
@@ -0,0 +1,12 @@
+! { dg-do run }
+
+! PR fortran/43829
+! Scalarization of reductions.
+! Test that inlined sum is correct.
+
+! We can't check for the absence of temporary arrays generated on the run-time
+! testcase, as inlining is disabled at -Os, so it will fail in that case.
+! Thus, the test is splitted into two independant files, one checking for
+! the absence of temporaries, and one (this one) checking that the code
+! generated remains valid at all optimization levels.
+include 'inline_sum_1.f90'
diff --git a/gcc/testsuite/gfortran.dg/inline_sum_bounds_check_1.f90 b/gcc/testsuite/gfortran.dg/inline_sum_bounds_check_1.f90
new file mode 100644
index 00000000000..39984683d4b
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/inline_sum_bounds_check_1.f90
@@ -0,0 +1,22 @@
+! { dg-do run }
+! { dg-options "-fbounds-check" }
+
+ integer, parameter :: nx = 3, ny = 4
+
+ integer :: i, j, too_big
+
+ integer, parameter, dimension(nx,ny) :: p = &
+ reshape((/ (i*i, i=1,size(p)) /), shape(p))
+
+ integer, dimension(nx,ny) :: a
+
+ integer, dimension(:), allocatable :: b
+
+ allocate(b(nx))
+
+ a = p
+ too_big = ny + 1
+
+ b = sum(a(:,1:too_big),2)
+ end
+! { dg-shouldfail "outside of expected range" }
diff --git a/gcc/testsuite/gfortran.dg/inline_sum_bounds_check_2.f90 b/gcc/testsuite/gfortran.dg/inline_sum_bounds_check_2.f90
new file mode 100644
index 00000000000..8de80fdc9f6
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/inline_sum_bounds_check_2.f90
@@ -0,0 +1,23 @@
+! { dg-do run }
+! { dg-options "-fbounds-check" }
+
+ integer, parameter :: nx = 3, ny = 4
+
+ integer :: i, j, too_big
+
+ integer, parameter, dimension(nx,ny) :: p = &
+ reshape((/ (i*i, i=1,size(p)) /), shape(p))
+
+ integer, dimension(nx,ny) :: a
+
+ integer, dimension(:), allocatable :: c
+
+
+ allocate(c(ny))
+
+ a = p
+ too_big = nx + 1
+
+ c = sum(a(1:too_big,:),2)
+ end
+! { dg-shouldfail "outside of expected range" }
diff --git a/gcc/testsuite/gfortran.dg/module_parameter_array_refs_2.f90 b/gcc/testsuite/gfortran.dg/module_parameter_array_refs_2.f90
new file mode 100644
index 00000000000..385761d1d17
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/module_parameter_array_refs_2.f90
@@ -0,0 +1,23 @@
+! { dg-do compile }
+! { dg-options "-O" }
+! { dg-final { scan-assembler-not "i_am_optimized_away" } }
+!
+! PR fortran/50960
+!
+! PARAMETER arrays and derived types exists as static variables.
+! Check that the their read-only nature is taken into account
+! when optimizations are done.
+!
+
+module m
+ integer, parameter :: PARA(*) = [1,2,3,4,5,6,7,8,9,10]
+end module m
+
+subroutine test()
+use m
+integer :: i
+i = 1
+if (para(i) /= 1) call i_am_optimized_away()
+end
+
+! { dg-final { cleanup-modules "m" } }
diff --git a/gcc/testsuite/gfortran.dg/open_dev_null.f90 b/gcc/testsuite/gfortran.dg/open_dev_null.f90
deleted file mode 100644
index 00394cb55a6..00000000000
--- a/gcc/testsuite/gfortran.dg/open_dev_null.f90
+++ /dev/null
@@ -1,9 +0,0 @@
-! { dg-do run }
-! PR45723 opening /dev/null for appending writes fails
-logical :: thefile
-inquire(file="/dev/null",exist=thefile)
-if (thefile) then
- open(unit=7,file="/dev/null",position="append")
- close(7)
-endif
-end
diff --git a/gcc/testsuite/gfortran.dg/pr50769.f90 b/gcc/testsuite/gfortran.dg/pr50769.f90
new file mode 100644
index 00000000000..3a98543e3a6
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr50769.f90
@@ -0,0 +1,30 @@
+! { dg-do compile }
+! { dg-options "-O2 -ftree-tail-merge -fno-delete-null-pointer-checks -fno-guess-branch-probability" }
+!
+! based on testsuite/gfortran.dg/alloc_comp_optional_1.f90,
+! which was contributed by David Kinniburgh <davidkinniburgh@yahoo.co.uk>
+!
+program test_iso
+ type ivs
+ character(LEN=1), dimension(:), allocatable :: chars
+ end type ivs
+ type(ivs) :: v_str
+ integer :: i
+ call foo(v_str, i)
+ if (v_str%chars(1) .ne. "a") call abort
+ if (i .ne. 0) call abort
+ call foo(flag = i)
+ if (i .ne. 1) call abort
+contains
+ subroutine foo (arg, flag)
+ type(ivs), optional, intent(out) :: arg
+ integer :: flag
+ if (present(arg)) then
+ arg = ivs([(char(i+96), i = 1,10)])
+ flag = 0
+ else
+ flag = 1
+ end if
+ end subroutine
+end
+
diff --git a/gcc/testsuite/gfortran.dg/quad_2.f90 b/gcc/testsuite/gfortran.dg/quad_2.f90
new file mode 100644
index 00000000000..c1334db9cd4
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/quad_2.f90
@@ -0,0 +1,63 @@
+! { dg-do run }
+!
+! This test checks whether the largest possible
+! floating-point number works.
+!
+! This is a run-time check. Depending on the architecture,
+! this tests REAL(8), REAL(10) or REAL(16) and REAL(16)
+! might be a hardware or libquadmath 128bit number.
+!
+program test_qp
+ use iso_fortran_env, only: real_kinds
+ implicit none
+ integer, parameter :: QP = real_kinds(ubound(real_kinds,dim=1))
+ real(qp) :: fp1, fp2, fp3, fp4
+ character(len=80) :: str1, str2, str3, str4
+ fp1 = 1
+ fp2 = sqrt (2.0_qp)
+ write (str1,*) fp1
+ write (str2,'(g0)') fp1
+ write (str3,*) fp2
+ write (str4,'(g0)') fp2
+
+! print '(3a)', '>',trim(str1),'<'
+! print '(3a)', '>',trim(str2),'<'
+! print '(3a)', '>',trim(str3),'<'
+! print '(3a)', '>',trim(str4),'<'
+
+ read (str1, *) fp3
+ if (fp1 /= fp3) call abort()
+ read (str2, *) fp3
+ if (fp1 /= fp3) call abort()
+ read (str3, *) fp4
+ if (fp2 /= fp4) call abort()
+ read (str4, *) fp4
+ if (fp2 /= fp4) call abort()
+
+ select case (qp)
+ case (8)
+ if (str1 /= " 1.0000000000000000") call abort()
+ if (str2 /= "1.0000000000000000") call abort()
+ if (str3 /= " 1.4142135623730951") call abort()
+ if (str4 /= "1.4142135623730951") call abort()
+ case (10)
+ if (str1 /= " 1.00000000000000000000") call abort()
+ if (str2 /= "1.00000000000000000000") call abort()
+ if (str3 /= " 1.41421356237309504876") call abort()
+ if (str4 /= "1.41421356237309504876") call abort()
+ case (16)
+ if (str1 /= " 1.00000000000000000000000000000000000") call abort()
+ if (str2 /= "1.00000000000000000000000000000000000") call abort()
+ if (str3 /= " 1.41421356237309504880168872420969798") call abort()
+ if (str4 /= "1.41421356237309504880168872420969798") call abort()
+ block
+ real(qp), volatile :: fp2a
+ fp2a = 2.0_qp
+ fp2a = sqrt (fp2a)
+ if (abs (fp2a - fp2) > sqrt(2.0_qp)-nearest(sqrt(2.0_qp),-1.0_qp)) call abort()
+ end block
+ case default
+ call abort()
+ end select
+
+end program test_qp
diff --git a/gcc/testsuite/gfortran.dg/typebound_call_21.f03 b/gcc/testsuite/gfortran.dg/typebound_call_21.f03
new file mode 100644
index 00000000000..5f7d67283c4
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/typebound_call_21.f03
@@ -0,0 +1,39 @@
+! { dg-do compile }
+! { dg-options "-fdump-tree-original" }
+!
+! PR 50919: [OOP] Don't use vtable for NON_OVERRIDABLE TBP
+!
+! Contributed by Tobias Burnus <burnus@gcc.gnu.org>
+
+module m
+
+type t
+contains
+ procedure, nopass, NON_OVERRIDABLE :: testsub
+ procedure, nopass, NON_OVERRIDABLE :: testfun
+end type t
+
+contains
+
+ subroutine testsub()
+ print *, "t's test"
+ end subroutine
+
+ integer function testfun()
+ testfun = 1
+ end function
+
+end module m
+
+
+ use m
+ class(t), allocatable :: x
+ allocate(x)
+ call x%testsub()
+ print *,x%testfun()
+end
+
+! { dg-final { scan-tree-dump-times "_vptr->" 0 "original" } }
+
+! { dg-final { cleanup-modules "m" } }
+! { dg-final { cleanup-tree-dump "original" } }
diff --git a/gcc/testsuite/gnat.dg/loop_optimization10.adb b/gcc/testsuite/gnat.dg/loop_optimization10.adb
new file mode 100644
index 00000000000..3b8e8949e1a
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/loop_optimization10.adb
@@ -0,0 +1,18 @@
+-- { dg-do compile }
+-- { dg-options "-O3" }
+-- { dg-options "-O3 -msse2" { target i?86-*-* x86_64-*-* } }
+
+package body Loop_Optimization10 is
+
+ function F (Low, High : in Array_Real_Type) return Array_Limit_Type is
+ Result : Array_Limit_Type;
+ begin
+ for I in Result'Range
+ loop
+ Result (I) := F (Low (I), High (I));
+ end loop;
+ return Result;
+ end;
+
+end Loop_Optimization10;
+
diff --git a/gcc/testsuite/gnat.dg/loop_optimization10.ads b/gcc/testsuite/gnat.dg/loop_optimization10.ads
new file mode 100644
index 00000000000..2f4872d1b5a
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/loop_optimization10.ads
@@ -0,0 +1,11 @@
+with Loop_Optimization10_Pkg; use Loop_Optimization10_Pkg;
+package Loop_Optimization10 is
+
+ type Dual_Axis_Type is (One, Two);
+
+ type Array_Real_Type is array (Dual_Axis_Type) of Float;
+ type Array_Limit_Type is array (Dual_Axis_Type) of Limit_Type;
+
+ function F (Low, High : in Array_Real_Type) return Array_Limit_Type;
+
+end Loop_Optimization10;
diff --git a/gcc/testsuite/gnat.dg/loop_optimization10_pkg.ads b/gcc/testsuite/gnat.dg/loop_optimization10_pkg.ads
new file mode 100644
index 00000000000..6fce4df8a3e
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/loop_optimization10_pkg.ads
@@ -0,0 +1,12 @@
+package Loop_Optimization10_Pkg is
+
+ pragma Pure (Loop_Optimization10_Pkg);
+
+ type Limit_Type is record
+ Low : Float;
+ High : Float;
+ end record;
+
+ function F (Low, High : in Float) return Limit_Type;
+
+end Loop_Optimization10_Pkg;
diff --git a/gcc/testsuite/gnat.dg/specs/private1-sub.ads b/gcc/testsuite/gnat.dg/specs/private1-sub.ads
new file mode 100644
index 00000000000..0dcbbd0569c
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/specs/private1-sub.ads
@@ -0,0 +1,13 @@
+-- { dg-do compile }
+-- { dg-options "-gnatct" }
+
+package Private1.Sub is
+
+ package Nested is
+ type T is limited private;
+ function "=" (X, Y : T) return Boolean;
+ private
+ type T is new Private1.T;
+ end Nested;
+
+end Private1.Sub;
diff --git a/gcc/testsuite/gnat.dg/specs/private1.ads b/gcc/testsuite/gnat.dg/specs/private1.ads
new file mode 100644
index 00000000000..4ef06004352
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/specs/private1.ads
@@ -0,0 +1,5 @@
+package Private1 is
+ type T is private;
+private
+ type T is new Boolean;
+end Private1;
diff --git a/gcc/testsuite/go.test/test/closedchan.go b/gcc/testsuite/go.test/test/closedchan.go
index 95314b3345e..c2bbec59d95 100644
--- a/gcc/testsuite/go.test/test/closedchan.go
+++ b/gcc/testsuite/go.test/test/closedchan.go
@@ -11,6 +11,10 @@
package main
+import "os"
+
+var failed bool
+
type Chan interface {
Send(int)
Nbsend(int) bool
@@ -225,19 +229,23 @@ func test1(c Chan) {
// recv a close signal (a zero value)
if x := c.Recv(); x != 0 {
println("test1: recv on closed:", x, c.Impl())
+ failed = true
}
if x, ok := c.Recv2(); x != 0 || ok {
println("test1: recv2 on closed:", x, ok, c.Impl())
+ failed = true
}
// should work with select: received a value without blocking, so selected == true.
x, selected := c.Nbrecv()
if x != 0 || !selected {
println("test1: recv on closed nb:", x, selected, c.Impl())
+ failed = true
}
x, ok, selected := c.Nbrecv2()
if x != 0 || ok || !selected {
println("test1: recv2 on closed nb:", x, ok, selected, c.Impl())
+ failed = true
}
}
@@ -247,12 +255,14 @@ func test1(c Chan) {
// the value should have been discarded.
if x := c.Recv(); x != 0 {
println("test1: recv on closed got non-zero after send on closed:", x, c.Impl())
+ failed = true
}
// similarly Send.
shouldPanic(func() { c.Send(2) })
if x := c.Recv(); x != 0 {
println("test1: recv on closed got non-zero after send on closed:", x, c.Impl())
+ failed = true
}
}
@@ -260,6 +270,7 @@ func testasync1(c Chan) {
// should be able to get the last value via Recv
if x := c.Recv(); x != 1 {
println("testasync1: Recv did not get 1:", x, c.Impl())
+ failed = true
}
test1(c)
@@ -269,6 +280,7 @@ func testasync2(c Chan) {
// should be able to get the last value via Recv2
if x, ok := c.Recv2(); x != 1 || !ok {
println("testasync1: Recv did not get 1, true:", x, ok, c.Impl())
+ failed = true
}
test1(c)
@@ -278,6 +290,7 @@ func testasync3(c Chan) {
// should be able to get the last value via Nbrecv
if x, selected := c.Nbrecv(); x != 1 || !selected {
println("testasync2: Nbrecv did not get 1, true:", x, selected, c.Impl())
+ failed = true
}
test1(c)
@@ -287,6 +300,7 @@ func testasync4(c Chan) {
// should be able to get the last value via Nbrecv2
if x, ok, selected := c.Nbrecv2(); x != 1 || !ok || !selected {
println("testasync2: Nbrecv did not get 1, true, true:", x, ok, selected, c.Impl())
+ failed = true
}
test1(c)
}
@@ -327,4 +341,19 @@ func main() {
testclosed(mk(closedasync()))
}
}
+
+ var ch chan int
+ shouldPanic(func() {
+ close(ch)
+ })
+
+ ch = make(chan int)
+ close(ch)
+ shouldPanic(func() {
+ close(ch)
+ })
+
+ if failed {
+ os.Exit(1)
+ }
}
diff --git a/gcc/testsuite/lib/gcc-dg.exp b/gcc/testsuite/lib/gcc-dg.exp
index caa057f0746..d0b679d7ad6 100644
--- a/gcc/testsuite/lib/gcc-dg.exp
+++ b/gcc/testsuite/lib/gcc-dg.exp
@@ -73,6 +73,13 @@ if [info exists ADDITIONAL_TORTURE_OPTIONS] {
}
set LTO_TORTURE_OPTIONS ""
+
+# Some torture-options cause intermediate code output, unusable for
+# testing using e.g. scan-assembler. In this variable are the options
+# how to force it, when needed.
+global gcc_force_conventional_output
+set gcc_force_conventional_output ""
+
if [check_effective_target_lto] {
# When having plugin test both slim and fat LTO and plugin/nonplugin
# path.
@@ -81,6 +88,7 @@ if [check_effective_target_lto] {
{ -O2 -flto -fno-use-linker-plugin -flto-partition=none } \
{ -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects }
]
+ set gcc_force_conventional_output "-ffat-lto-objects"
} else {
set LTO_TORTURE_OPTIONS [list \
{ -O2 -flto -flto-partition=none } \
@@ -156,6 +164,19 @@ proc gcc-dg-test-1 { target_compile prog do_what extra_tool_flags } {
}
}
+ # Let { dg-final { action } } force options as returned by an
+ # optional proc ${action}_required_options.
+ upvar 2 dg-final-code finalcode
+ foreach x [split $finalcode "\n"] {
+ set finalcmd [lindex $x 0]
+ if { [info procs ${finalcmd}_required_options] != "" } {
+ set req [${finalcmd}_required_options]
+ if { $req != "" } {
+ lappend extra_tool_flags $req
+ }
+ }
+ }
+
if { $extra_tool_flags != "" } {
lappend options "additional_flags=$extra_tool_flags"
}
diff --git a/gcc/testsuite/lib/scanasm.exp b/gcc/testsuite/lib/scanasm.exp
index 6574ab13a35..3ba22f9dad7 100644
--- a/gcc/testsuite/lib/scanasm.exp
+++ b/gcc/testsuite/lib/scanasm.exp
@@ -85,6 +85,11 @@ proc scan-assembler { args } {
dg-scan "scan-assembler" 1 $testcase $output_file $args
}
+proc scan-assembler_required_options { args } {
+ global gcc_force_conventional_output
+ return $gcc_force_conventional_output
+}
+
# Check that a pattern is not present in the .s file produced by the
# compiler. See dg-scan for details.
@@ -96,6 +101,11 @@ proc scan-assembler-not { args } {
dg-scan "scan-assembler-not" 0 $testcase $output_file $args
}
+proc scan-assembler-not_required_options { args } {
+ global gcc_force_conventional_output
+ return $gcc_force_conventional_output
+}
+
# Return the scan for the assembly for hidden visibility.
proc hidden-scan-for { symbol } {
diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index f19c3c566c6..fd6b2691a97 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -655,6 +655,28 @@ proc check_effective_target_tls_runtime {} {
} [add_options_for_tls ""]]
}
+# Return 1 if atomic compare-and-swap is supported on 'int'
+
+proc check_effective_target_cas_char {} {
+ return [check_no_compiler_messages cas_char assembly {
+ #ifndef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1
+ #error unsupported
+ #endif
+ } ""]
+}
+
+proc check_effective_target_cas_int {} {
+ return [check_no_compiler_messages cas_int assembly {
+ #if __INT_MAX__ == 0x7fff && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_2
+ /* ok */
+ #elif __INT_MAX__ == 0x7fffffff && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4
+ /* ok */
+ #else
+ #error unsupported
+ #endif
+ } ""]
+}
+
# Return 1 if -ffunction-sections is supported, 0 otherwise.
proc check_effective_target_function_sections {} {
@@ -2449,6 +2471,24 @@ proc check_effective_target_ultrasparc_hw { } {
} "-mcpu=ultrasparc"]
}
+# Return 1 if the test environment supports executing UltraSPARC VIS2
+# instructions. We check this by attempting: "bmask %g0, %g0, %g0"
+
+proc check_effective_target_ultrasparc_vis2_hw { } {
+ return [check_runtime ultrasparc_hw {
+ int main() { __asm__(".word 0x81b00320"); return 0; }
+ } "-mcpu=ultrasparc3"]
+}
+
+# Return 1 if the test environment supports executing UltraSPARC VIS3
+# instructions. We check this by attempting: "addxc %g0, %g0, %g0"
+
+proc check_effective_target_ultrasparc_vis3_hw { } {
+ return [check_runtime ultrasparc_hw {
+ int main() { __asm__(".word 0x81b00220"); return 0; }
+ } "-mcpu=niagara3"]
+}
+
# Return 1 if the target supports hardware vector shift operation.
proc check_effective_target_vect_shift { } {
@@ -3499,6 +3539,28 @@ proc check_effective_target_section_anchors { } {
return $et_section_anchors_saved
}
+# Return 1 if the target supports atomic operations on "int_128" values.
+
+proc check_effective_target_sync_int_128 { } {
+ if { ([istarget x86_64-*-*] || [istarget i?86-*-*])
+ && ![is-effective-target ia32] } {
+ return 1
+ } else {
+ return 0
+ }
+}
+
+# Return 1 if the target supports atomic operations on "long long".
+
+proc check_effective_target_sync_long_long { } {
+ if { ([istarget x86_64-*-*] || [istarget i?86-*-*])
+ && ![is-effective-target ia32] } {
+ return 1
+ } else {
+ return 0
+ }
+}
+
# Return 1 if the target supports atomic operations on "int" and "long".
proc check_effective_target_sync_int_long { } {
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c
index 7cb4a3dfb49..d81cc670bf4 100644
--- a/gcc/tree-cfg.c
+++ b/gcc/tree-cfg.c
@@ -1488,8 +1488,8 @@ gimple_can_merge_blocks_p (basic_block a, basic_block b)
break;
lab = gimple_label_label (stmt);
- /* Do not remove user labels. */
- if (!DECL_ARTIFICIAL (lab))
+ /* Do not remove user forced labels or for -O0 any user labels. */
+ if (!DECL_ARTIFICIAL (lab) && (!optimize || FORCED_LABEL (lab)))
return false;
}
@@ -1735,6 +1735,15 @@ gimple_merge_blocks (basic_block a, basic_block b)
gimple_stmt_iterator dest_gsi = gsi_start_bb (a);
gsi_insert_before (&dest_gsi, stmt, GSI_NEW_STMT);
}
+ /* Other user labels keep around in a form of a debug stmt. */
+ else if (!DECL_ARTIFICIAL (label) && MAY_HAVE_DEBUG_STMTS)
+ {
+ gimple dbg = gimple_build_debug_bind (label,
+ integer_zero_node,
+ stmt);
+ gimple_debug_bind_reset_value (dbg);
+ gsi_insert_before (&gsi, dbg, GSI_SAME_STMT);
+ }
lp_nr = EH_LANDING_PAD_NR (label);
if (lp_nr)
@@ -5282,6 +5291,12 @@ gimple_duplicate_bb (basic_block bb)
if (gimple_code (stmt) == GIMPLE_LABEL)
continue;
+ /* Don't duplicate label debug stmts. */
+ if (gimple_debug_bind_p (stmt)
+ && TREE_CODE (gimple_debug_bind_get_var (stmt))
+ == LABEL_DECL)
+ continue;
+
/* Create a new copy of STMT and duplicate STMT's virtual
operands. */
copy = gimple_copy (stmt);
diff --git a/gcc/tree-data-ref.c b/gcc/tree-data-ref.c
index 4e0de052c15..89d123d65e9 100644
--- a/gcc/tree-data-ref.c
+++ b/gcc/tree-data-ref.c
@@ -1351,13 +1351,11 @@ dr_may_alias_p (const struct data_reference *a, const struct data_reference *b,
return refs_may_alias_p (addr_a, addr_b);
}
-static void compute_self_dependence (struct data_dependence_relation *);
-
/* Initialize a data dependence relation between data accesses A and
B. NB_LOOPS is the number of loops surrounding the references: the
size of the classic distance/direction vectors. */
-static struct data_dependence_relation *
+struct data_dependence_relation *
initialize_data_dependence_relation (struct data_reference *a,
struct data_reference *b,
VEC (loop_p, heap) *loop_nest)
@@ -4121,7 +4119,7 @@ compute_affine_dependence (struct data_dependence_relation *ddr,
/* This computes the dependence relation for the same data
reference into DDR. */
-static void
+void
compute_self_dependence (struct data_dependence_relation *ddr)
{
unsigned int i;
diff --git a/gcc/tree-data-ref.h b/gcc/tree-data-ref.h
index c55bd48a81e..0f12962fc93 100644
--- a/gcc/tree-data-ref.h
+++ b/gcc/tree-data-ref.h
@@ -1,5 +1,5 @@
/* Data references and dependences detectors.
- Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+ Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
Free Software Foundation, Inc.
Contributed by Sebastian Pop <pop@cri.ensmp.fr>
@@ -423,6 +423,9 @@ extern bool graphite_find_data_references_in_stmt (loop_p, loop_p, gimple,
VEC (data_reference_p, heap) **);
struct data_reference *create_data_ref (loop_p, loop_p, tree, gimple, bool);
extern bool find_loop_nest (struct loop *, VEC (loop_p, heap) **);
+extern struct data_dependence_relation *initialize_data_dependence_relation
+ (struct data_reference *, struct data_reference *, VEC (loop_p, heap) *);
+extern void compute_self_dependence (struct data_dependence_relation *);
extern void compute_all_dependences (VEC (data_reference_p, heap) *,
VEC (ddr_p, heap) **, VEC (loop_p, heap) *,
bool);
diff --git a/gcc/tree-vect-data-refs.c b/gcc/tree-vect-data-refs.c
index a239216cf2d..0ff8ee83d40 100644
--- a/gcc/tree-vect-data-refs.c
+++ b/gcc/tree-vect-data-refs.c
@@ -2497,6 +2497,199 @@ vect_prune_runtime_alias_test_list (loop_vec_info loop_vinfo)
return true;
}
+/* Check whether a non-affine read in stmt is suitable for gather load
+ and if so, return a builtin decl for that operation. */
+
+tree
+vect_check_gather (gimple stmt, loop_vec_info loop_vinfo, tree *basep,
+ tree *offp, int *scalep)
+{
+ HOST_WIDE_INT scale = 1, pbitpos, pbitsize;
+ struct loop *loop = LOOP_VINFO_LOOP (loop_vinfo);
+ stmt_vec_info stmt_info = vinfo_for_stmt (stmt);
+ struct data_reference *dr = STMT_VINFO_DATA_REF (stmt_info);
+ tree offtype = NULL_TREE;
+ tree decl, base, off;
+ enum machine_mode pmode;
+ int punsignedp, pvolatilep;
+
+ /* The gather builtins need address of the form
+ loop_invariant + vector * {1, 2, 4, 8}
+ or
+ loop_invariant + sign_extend (vector) * { 1, 2, 4, 8 }.
+ Unfortunately DR_BASE_ADDRESS/DR_OFFSET can be a mixture
+ of loop invariants/SSA_NAMEs defined in the loop, with casts,
+ multiplications and additions in it. To get a vector, we need
+ a single SSA_NAME that will be defined in the loop and will
+ contain everything that is not loop invariant and that can be
+ vectorized. The following code attempts to find such a preexistng
+ SSA_NAME OFF and put the loop invariants into a tree BASE
+ that can be gimplified before the loop. */
+ base = get_inner_reference (DR_REF (dr), &pbitsize, &pbitpos, &off,
+ &pmode, &punsignedp, &pvolatilep, false);
+ gcc_assert (base != NULL_TREE && (pbitpos % BITS_PER_UNIT) == 0);
+
+ if (TREE_CODE (base) == MEM_REF)
+ {
+ if (!integer_zerop (TREE_OPERAND (base, 1)))
+ {
+ if (off == NULL_TREE)
+ {
+ double_int moff = mem_ref_offset (base);
+ off = double_int_to_tree (sizetype, moff);
+ }
+ else
+ off = size_binop (PLUS_EXPR, off,
+ fold_convert (sizetype, TREE_OPERAND (base, 1)));
+ }
+ base = TREE_OPERAND (base, 0);
+ }
+ else
+ base = build_fold_addr_expr (base);
+
+ if (off == NULL_TREE)
+ off = size_zero_node;
+
+ /* If base is not loop invariant, either off is 0, then we start with just
+ the constant offset in the loop invariant BASE and continue with base
+ as OFF, otherwise give up.
+ We could handle that case by gimplifying the addition of base + off
+ into some SSA_NAME and use that as off, but for now punt. */
+ if (!expr_invariant_in_loop_p (loop, base))
+ {
+ if (!integer_zerop (off))
+ return NULL_TREE;
+ off = base;
+ base = size_int (pbitpos / BITS_PER_UNIT);
+ }
+ /* Otherwise put base + constant offset into the loop invariant BASE
+ and continue with OFF. */
+ else
+ {
+ base = fold_convert (sizetype, base);
+ base = size_binop (PLUS_EXPR, base, size_int (pbitpos / BITS_PER_UNIT));
+ }
+
+ /* OFF at this point may be either a SSA_NAME or some tree expression
+ from get_inner_reference. Try to peel off loop invariants from it
+ into BASE as long as possible. */
+ STRIP_NOPS (off);
+ while (offtype == NULL_TREE)
+ {
+ enum tree_code code;
+ tree op0, op1, add = NULL_TREE;
+
+ if (TREE_CODE (off) == SSA_NAME)
+ {
+ gimple def_stmt = SSA_NAME_DEF_STMT (off);
+
+ if (expr_invariant_in_loop_p (loop, off))
+ return NULL_TREE;
+
+ if (gimple_code (def_stmt) != GIMPLE_ASSIGN)
+ break;
+
+ op0 = gimple_assign_rhs1 (def_stmt);
+ code = gimple_assign_rhs_code (def_stmt);
+ op1 = gimple_assign_rhs2 (def_stmt);
+ }
+ else
+ {
+ if (get_gimple_rhs_class (TREE_CODE (off)) == GIMPLE_TERNARY_RHS)
+ return NULL_TREE;
+ code = TREE_CODE (off);
+ extract_ops_from_tree (off, &code, &op0, &op1);
+ }
+ switch (code)
+ {
+ case POINTER_PLUS_EXPR:
+ case PLUS_EXPR:
+ if (expr_invariant_in_loop_p (loop, op0))
+ {
+ add = op0;
+ off = op1;
+ do_add:
+ add = fold_convert (sizetype, add);
+ if (scale != 1)
+ add = size_binop (MULT_EXPR, add, size_int (scale));
+ base = size_binop (PLUS_EXPR, base, add);
+ continue;
+ }
+ if (expr_invariant_in_loop_p (loop, op1))
+ {
+ add = op1;
+ off = op0;
+ goto do_add;
+ }
+ break;
+ case MINUS_EXPR:
+ if (expr_invariant_in_loop_p (loop, op1))
+ {
+ add = fold_convert (sizetype, op1);
+ add = size_binop (MINUS_EXPR, size_zero_node, add);
+ off = op0;
+ goto do_add;
+ }
+ break;
+ case MULT_EXPR:
+ if (scale == 1 && host_integerp (op1, 0))
+ {
+ scale = tree_low_cst (op1, 0);
+ off = op0;
+ continue;
+ }
+ break;
+ case SSA_NAME:
+ off = op0;
+ continue;
+ CASE_CONVERT:
+ if (!POINTER_TYPE_P (TREE_TYPE (op0))
+ && !INTEGRAL_TYPE_P (TREE_TYPE (op0)))
+ break;
+ if (TYPE_PRECISION (TREE_TYPE (op0))
+ == TYPE_PRECISION (TREE_TYPE (off)))
+ {
+ off = op0;
+ continue;
+ }
+ if (TYPE_PRECISION (TREE_TYPE (op0))
+ < TYPE_PRECISION (TREE_TYPE (off)))
+ {
+ off = op0;
+ offtype = TREE_TYPE (off);
+ STRIP_NOPS (off);
+ continue;
+ }
+ break;
+ default:
+ break;
+ }
+ break;
+ }
+
+ /* If at the end OFF still isn't a SSA_NAME or isn't
+ defined in the loop, punt. */
+ if (TREE_CODE (off) != SSA_NAME
+ || expr_invariant_in_loop_p (loop, off))
+ return NULL_TREE;
+
+ if (offtype == NULL_TREE)
+ offtype = TREE_TYPE (off);
+
+ decl = targetm.vectorize.builtin_gather (STMT_VINFO_VECTYPE (stmt_info),
+ offtype, scale);
+ if (decl == NULL_TREE)
+ return NULL_TREE;
+
+ if (basep)
+ *basep = base;
+ if (offp)
+ *offp = off;
+ if (scalep)
+ *scalep = scale;
+ return decl;
+}
+
/* Function vect_analyze_data_refs.
@@ -2573,6 +2766,7 @@ vect_analyze_data_refs (loop_vec_info loop_vinfo,
gimple stmt;
stmt_vec_info stmt_info;
tree base, offset, init;
+ bool gather = false;
int vf;
if (!dr || !DR_REF (dr))
@@ -2594,22 +2788,51 @@ vect_analyze_data_refs (loop_vec_info loop_vinfo,
/* Check that analysis of the data-ref succeeded. */
if (!DR_BASE_ADDRESS (dr) || !DR_OFFSET (dr) || !DR_INIT (dr)
- || !DR_STEP (dr))
+ || !DR_STEP (dr))
{
- if (vect_print_dump_info (REPORT_UNVECTORIZED_LOCATIONS))
- {
- fprintf (vect_dump, "not vectorized: data ref analysis failed ");
- print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM);
- }
+ /* If target supports vector gather loads, see if they can't
+ be used. */
+ if (loop_vinfo
+ && DR_IS_READ (dr)
+ && !TREE_THIS_VOLATILE (DR_REF (dr))
+ && targetm.vectorize.builtin_gather != NULL
+ && !nested_in_vect_loop_p (loop, stmt))
+ {
+ struct data_reference *newdr
+ = create_data_ref (NULL, loop_containing_stmt (stmt),
+ DR_REF (dr), stmt, true);
+ gcc_assert (newdr != NULL && DR_REF (newdr));
+ if (DR_BASE_ADDRESS (newdr)
+ && DR_OFFSET (newdr)
+ && DR_INIT (newdr)
+ && DR_STEP (newdr)
+ && integer_zerop (DR_STEP (newdr)))
+ {
+ dr = newdr;
+ gather = true;
+ }
+ else
+ free_data_ref (newdr);
+ }
- if (bb_vinfo)
- {
- STMT_VINFO_VECTORIZABLE (stmt_info) = false;
- stop_bb_analysis = true;
- continue;
- }
+ if (!gather)
+ {
+ if (vect_print_dump_info (REPORT_UNVECTORIZED_LOCATIONS))
+ {
+ fprintf (vect_dump, "not vectorized: data ref analysis "
+ "failed ");
+ print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM);
+ }
- return false;
+ if (bb_vinfo)
+ {
+ STMT_VINFO_VECTORIZABLE (stmt_info) = false;
+ stop_bb_analysis = true;
+ continue;
+ }
+
+ return false;
+ }
}
if (TREE_CODE (DR_BASE_ADDRESS (dr)) == INTEGER_CST)
@@ -2625,7 +2848,9 @@ vect_analyze_data_refs (loop_vec_info loop_vinfo,
continue;
}
- return false;
+ if (gather)
+ free_data_ref (dr);
+ return false;
}
if (TREE_THIS_VOLATILE (DR_REF (dr)))
@@ -2666,6 +2891,8 @@ vect_analyze_data_refs (loop_vec_info loop_vinfo,
continue;
}
+ if (gather)
+ free_data_ref (dr);
return false;
}
@@ -2791,6 +3018,8 @@ vect_analyze_data_refs (loop_vec_info loop_vinfo,
continue;
}
+ if (gather)
+ free_data_ref (dr);
return false;
}
@@ -2818,8 +3047,13 @@ vect_analyze_data_refs (loop_vec_info loop_vinfo,
stop_bb_analysis = true;
continue;
}
- else
- return false;
+
+ if (gather)
+ {
+ STMT_VINFO_DATA_REF (stmt_info) = NULL;
+ free_data_ref (dr);
+ }
+ return false;
}
/* Adjust the minimal vectorization factor according to the
@@ -2827,6 +3061,86 @@ vect_analyze_data_refs (loop_vec_info loop_vinfo,
vf = TYPE_VECTOR_SUBPARTS (STMT_VINFO_VECTYPE (stmt_info));
if (vf > *min_vf)
*min_vf = vf;
+
+ if (gather)
+ {
+ unsigned int j, k, n;
+ struct data_reference *olddr
+ = VEC_index (data_reference_p, datarefs, i);
+ VEC (ddr_p, heap) *ddrs = LOOP_VINFO_DDRS (loop_vinfo);
+ struct data_dependence_relation *ddr, *newddr;
+ bool bad = false;
+ tree off;
+ VEC (loop_p, heap) *nest = LOOP_VINFO_LOOP_NEST (loop_vinfo);
+
+ if (!vect_check_gather (stmt, loop_vinfo, NULL, &off, NULL)
+ || get_vectype_for_scalar_type (TREE_TYPE (off)) == NULL_TREE)
+ {
+ if (vect_print_dump_info (REPORT_UNVECTORIZED_LOCATIONS))
+ {
+ fprintf (vect_dump,
+ "not vectorized: not suitable for gather ");
+ print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM);
+ }
+ return false;
+ }
+
+ n = VEC_length (data_reference_p, datarefs) - 1;
+ for (j = 0, k = i - 1; j < i; j++)
+ {
+ ddr = VEC_index (ddr_p, ddrs, k);
+ gcc_assert (DDR_B (ddr) == olddr);
+ newddr = initialize_data_dependence_relation (DDR_A (ddr), dr,
+ nest);
+ VEC_replace (ddr_p, ddrs, k, newddr);
+ free_dependence_relation (ddr);
+ if (!bad
+ && DR_IS_WRITE (DDR_A (newddr))
+ && DDR_ARE_DEPENDENT (newddr) != chrec_known)
+ bad = true;
+ k += --n;
+ }
+
+ k++;
+ n = k + VEC_length (data_reference_p, datarefs) - i - 1;
+ for (; k < n; k++)
+ {
+ ddr = VEC_index (ddr_p, ddrs, k);
+ gcc_assert (DDR_A (ddr) == olddr);
+ newddr = initialize_data_dependence_relation (dr, DDR_B (ddr),
+ nest);
+ VEC_replace (ddr_p, ddrs, k, newddr);
+ free_dependence_relation (ddr);
+ if (!bad
+ && DR_IS_WRITE (DDR_B (newddr))
+ && DDR_ARE_DEPENDENT (newddr) != chrec_known)
+ bad = true;
+ }
+
+ k = VEC_length (ddr_p, ddrs)
+ - VEC_length (data_reference_p, datarefs) + i;
+ ddr = VEC_index (ddr_p, ddrs, k);
+ gcc_assert (DDR_A (ddr) == olddr && DDR_B (ddr) == olddr);
+ newddr = initialize_data_dependence_relation (dr, dr, nest);
+ compute_self_dependence (newddr);
+ VEC_replace (ddr_p, ddrs, k, newddr);
+ free_dependence_relation (ddr);
+ VEC_replace (data_reference_p, datarefs, i, dr);
+
+ if (bad)
+ {
+ if (vect_print_dump_info (REPORT_UNVECTORIZED_LOCATIONS))
+ {
+ fprintf (vect_dump,
+ "not vectorized: data dependence conflict"
+ " prevents gather");
+ print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM);
+ }
+ return false;
+ }
+
+ STMT_VINFO_GATHER_P (stmt_info) = true;
+ }
}
return true;
diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c
index a04099fc06a..a209b4bb14d 100644
--- a/gcc/tree-vect-loop.c
+++ b/gcc/tree-vect-loop.c
@@ -3537,8 +3537,8 @@ vect_create_epilog_for_reduction (VEC (tree, heap) *vect_defs, gimple stmt,
/* Get the loop-entry arguments. */
if (slp_node)
- vect_get_slp_defs (reduction_op, NULL_TREE, slp_node, &vec_initial_defs,
- NULL, reduc_index);
+ vect_get_vec_defs (reduction_op, NULL_TREE, stmt, &vec_initial_defs,
+ NULL, slp_node, reduc_index);
else
{
vec_initial_defs = VEC_alloc (tree, heap, 1);
@@ -4416,6 +4416,9 @@ vectorizable_reduction (gimple stmt, gimple_stmt_iterator *gsi,
gcc_unreachable ();
}
+ if (code == COND_EXPR && slp_node)
+ return false;
+
scalar_dest = gimple_assign_lhs (stmt);
scalar_type = TREE_TYPE (scalar_dest);
if (!POINTER_TYPE_P (scalar_type) && !INTEGRAL_TYPE_P (scalar_type)
@@ -4502,7 +4505,7 @@ vectorizable_reduction (gimple stmt, gimple_stmt_iterator *gsi,
if (code == COND_EXPR)
{
- if (!vectorizable_condition (stmt, gsi, NULL, ops[reduc_index], 0))
+ if (!vectorizable_condition (stmt, gsi, NULL, ops[reduc_index], 0, NULL))
{
if (vect_print_dump_info (REPORT_DETAILS))
fprintf (vect_dump, "unsupported condition in reduction");
@@ -4774,7 +4777,7 @@ vectorizable_reduction (gimple stmt, gimple_stmt_iterator *gsi,
gcc_assert (!slp_node);
vectorizable_condition (stmt, gsi, vec_stmt,
PHI_RESULT (VEC_index (gimple, phis, 0)),
- reduc_index);
+ reduc_index, NULL);
/* Multiple types are not supported for condition. */
break;
}
@@ -4792,8 +4795,8 @@ vectorizable_reduction (gimple stmt, gimple_stmt_iterator *gsi,
}
if (slp_node)
- vect_get_slp_defs (op0, op1, slp_node, &vec_oprnds0, &vec_oprnds1,
- -1);
+ vect_get_vec_defs (op0, op1, stmt, &vec_oprnds0, &vec_oprnds1,
+ slp_node, -1);
else
{
loop_vec_def0 = vect_get_vec_def_for_operand (ops[!reduc_index],
diff --git a/gcc/tree-vect-slp.c b/gcc/tree-vect-slp.c
index 790f2dd0a75..6628a6fd66d 100644
--- a/gcc/tree-vect-slp.c
+++ b/gcc/tree-vect-slp.c
@@ -68,14 +68,14 @@ find_bb_location (basic_block bb)
static void
vect_free_slp_tree (slp_tree node)
{
+ int i;
+ slp_void_p child;
+
if (!node)
return;
- if (SLP_TREE_LEFT (node))
- vect_free_slp_tree (SLP_TREE_LEFT (node));
-
- if (SLP_TREE_RIGHT (node))
- vect_free_slp_tree (SLP_TREE_RIGHT (node));
+ FOR_EACH_VEC_ELT (slp_void_p, SLP_TREE_CHILDREN (node), i, child)
+ vect_free_slp_tree ((slp_tree)child);
VEC_free (gimple, heap, SLP_TREE_SCALAR_STMTS (node));
@@ -97,48 +97,142 @@ vect_free_slp_instance (slp_instance instance)
}
-/* Get the defs for the rhs of STMT (collect them in DEF_STMTS0/1), check that
- they are of a legal type and that they match the defs of the first stmt of
- the SLP group (stored in FIRST_STMT_...). */
+/* Create an SLP node for SCALAR_STMTS. */
+
+static slp_tree
+vect_create_new_slp_node (VEC (gimple, heap) *scalar_stmts)
+{
+ slp_tree node = XNEW (struct _slp_tree);
+ gimple stmt = VEC_index (gimple, scalar_stmts, 0);
+ unsigned int nops;
+
+ if (is_gimple_call (stmt))
+ nops = gimple_call_num_args (stmt);
+ else if (is_gimple_assign (stmt))
+ {
+ nops = gimple_num_ops (stmt) - 1;
+ if (gimple_assign_rhs_code (stmt) == COND_EXPR)
+ nops++;
+ }
+ else
+ return NULL;
+
+ SLP_TREE_SCALAR_STMTS (node) = scalar_stmts;
+ SLP_TREE_VEC_STMTS (node) = NULL;
+ SLP_TREE_CHILDREN (node) = VEC_alloc (slp_void_p, heap, nops);
+ SLP_TREE_OUTSIDE_OF_LOOP_COST (node) = 0;
+ SLP_TREE_INSIDE_OF_LOOP_COST (node) = 0;
+
+ return node;
+}
+
+
+/* Allocate operands info for NOPS operands, and GROUP_SIZE def-stmts for each
+ operand. */
+static VEC (slp_oprnd_info, heap) *
+vect_create_oprnd_info (int nops, int group_size)
+{
+ int i;
+ slp_oprnd_info oprnd_info;
+ VEC (slp_oprnd_info, heap) *oprnds_info;
+
+ oprnds_info = VEC_alloc (slp_oprnd_info, heap, nops);
+ for (i = 0; i < nops; i++)
+ {
+ oprnd_info = XNEW (struct _slp_oprnd_info);
+ oprnd_info->def_stmts = VEC_alloc (gimple, heap, group_size);
+ oprnd_info->first_dt = vect_uninitialized_def;
+ oprnd_info->first_def_type = NULL_TREE;
+ oprnd_info->first_const_oprnd = NULL_TREE;
+ oprnd_info->first_pattern = false;
+ VEC_quick_push (slp_oprnd_info, oprnds_info, oprnd_info);
+ }
+
+ return oprnds_info;
+}
+
+
+/* Free operands info. Free def-stmts in FREE_DEF_STMTS is true.
+ (FREE_DEF_STMTS is true when the SLP analysis fails, and false when it
+ succeds. In the later case we don't need the operands info that we used to
+ check isomorphism of the stmts, but we still need the def-stmts - they are
+ used as scalar stmts in SLP nodes. */
+static void
+vect_free_oprnd_info (VEC (slp_oprnd_info, heap) **oprnds_info,
+ bool free_def_stmts)
+{
+ int i;
+ slp_oprnd_info oprnd_info;
+
+ if (free_def_stmts)
+ FOR_EACH_VEC_ELT (slp_oprnd_info, *oprnds_info, i, oprnd_info)
+ VEC_free (gimple, heap, oprnd_info->def_stmts);
+
+ VEC_free (slp_oprnd_info, heap, *oprnds_info);
+}
+
+
+/* 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). */
static bool
vect_get_and_check_slp_defs (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo,
slp_tree slp_node, gimple stmt,
- VEC (gimple, heap) **def_stmts0,
- VEC (gimple, heap) **def_stmts1,
- enum vect_def_type *first_stmt_dt0,
- enum vect_def_type *first_stmt_dt1,
- tree *first_stmt_def0_type,
- tree *first_stmt_def1_type,
- tree *first_stmt_const_oprnd,
- int ncopies_for_cost,
- bool *pattern0, bool *pattern1)
+ int ncopies_for_cost, bool first,
+ VEC (slp_oprnd_info, heap) **oprnds_info)
{
tree oprnd;
unsigned int i, number_of_oprnds;
- tree def[2];
+ tree def, def_op0 = NULL_TREE;
gimple def_stmt;
- enum vect_def_type dt[2] = {vect_unknown_def_type, vect_unknown_def_type};
- stmt_vec_info stmt_info =
- vinfo_for_stmt (VEC_index (gimple, SLP_TREE_SCALAR_STMTS (slp_node), 0));
- enum gimple_rhs_class rhs_class;
+ enum vect_def_type dt = vect_uninitialized_def;
+ enum vect_def_type dt_op0 = vect_uninitialized_def;
+ stmt_vec_info stmt_info = vinfo_for_stmt (stmt);
+ tree lhs = gimple_get_lhs (stmt);
struct loop *loop = NULL;
enum tree_code rhs_code;
bool different_types = false;
+ bool pattern = false;
+ slp_oprnd_info oprnd_info, oprnd0_info, oprnd1_info;
+ int op_idx = 1;
+ tree compare_rhs = NULL_TREE;
if (loop_vinfo)
loop = LOOP_VINFO_LOOP (loop_vinfo);
- rhs_class = get_gimple_rhs_class (gimple_assign_rhs_code (stmt));
- number_of_oprnds = gimple_num_ops (stmt) - 1; /* RHS only */
+ if (is_gimple_call (stmt))
+ number_of_oprnds = gimple_call_num_args (stmt);
+ else if (is_gimple_assign (stmt))
+ {
+ number_of_oprnds = gimple_num_ops (stmt) - 1;
+ if (gimple_assign_rhs_code (stmt) == COND_EXPR)
+ number_of_oprnds++;
+ }
+ else
+ return false;
for (i = 0; i < number_of_oprnds; i++)
{
- oprnd = gimple_op (stmt, i + 1);
+ if (compare_rhs)
+ {
+ oprnd = compare_rhs;
+ compare_rhs = NULL_TREE;
+ }
+ else
+ oprnd = gimple_op (stmt, op_idx++);
+
+ oprnd_info = VEC_index (slp_oprnd_info, *oprnds_info, i);
+
+ if (COMPARISON_CLASS_P (oprnd))
+ {
+ compare_rhs = TREE_OPERAND (oprnd, 1);
+ oprnd = TREE_OPERAND (oprnd, 0);
+ }
- if (!vect_is_simple_use (oprnd, loop_vinfo, bb_vinfo, &def_stmt, &def[i],
- &dt[i])
- || (!def_stmt && dt[i] != vect_constant_def))
+ if (!vect_is_simple_use (oprnd, loop_vinfo, bb_vinfo, &def_stmt, &def,
+ &dt)
+ || (!def_stmt && dt != vect_constant_def))
{
if (vect_print_dump_info (REPORT_SLP))
{
@@ -159,29 +253,23 @@ vect_get_and_check_slp_defs (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo,
&& !STMT_VINFO_RELEVANT (vinfo_for_stmt (def_stmt))
&& !STMT_VINFO_LIVE_P (vinfo_for_stmt (def_stmt)))
{
- if (!*first_stmt_dt0)
- *pattern0 = true;
- else
- {
- if (i == 1 && !*first_stmt_dt1)
- *pattern1 = true;
- else if ((i == 0 && !*pattern0) || (i == 1 && !*pattern1))
- {
- if (vect_print_dump_info (REPORT_DETAILS))
- {
- fprintf (vect_dump, "Build SLP failed: some of the stmts"
- " are in a pattern, and others are not ");
- print_generic_expr (vect_dump, oprnd, TDF_SLIM);
- }
+ pattern = true;
+ if (!first && !oprnd_info->first_pattern)
+ {
+ if (vect_print_dump_info (REPORT_DETAILS))
+ {
+ fprintf (vect_dump, "Build SLP failed: some of the stmts"
+ " are in a pattern, and others are not ");
+ print_generic_expr (vect_dump, oprnd, TDF_SLIM);
+ }
- return false;
- }
+ return false;
}
def_stmt = STMT_VINFO_RELATED_STMT (vinfo_for_stmt (def_stmt));
- dt[i] = STMT_VINFO_DEF_TYPE (vinfo_for_stmt (def_stmt));
+ dt = STMT_VINFO_DEF_TYPE (vinfo_for_stmt (def_stmt));
- if (*dt == vect_unknown_def_type)
+ if (dt == vect_unknown_def_type)
{
if (vect_print_dump_info (REPORT_DETAILS))
fprintf (vect_dump, "Unsupported pattern.");
@@ -191,11 +279,11 @@ vect_get_and_check_slp_defs (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo,
switch (gimple_code (def_stmt))
{
case GIMPLE_PHI:
- def[i] = gimple_phi_result (def_stmt);
+ def = gimple_phi_result (def_stmt);
break;
case GIMPLE_ASSIGN:
- def[i] = gimple_assign_lhs (def_stmt);
+ def = gimple_assign_lhs (def_stmt);
break;
default:
@@ -205,125 +293,125 @@ vect_get_and_check_slp_defs (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo,
}
}
- if (!*first_stmt_dt0)
+ if (first)
{
- /* op0 of the first stmt of the group - store its info. */
- *first_stmt_dt0 = dt[i];
- if (def[i])
- *first_stmt_def0_type = TREE_TYPE (def[i]);
+ oprnd_info->first_dt = dt;
+ oprnd_info->first_pattern = pattern;
+ if (def)
+ {
+ oprnd_info->first_def_type = TREE_TYPE (def);
+ oprnd_info->first_const_oprnd = NULL_TREE;
+ }
else
- *first_stmt_const_oprnd = oprnd;
+ {
+ oprnd_info->first_def_type = NULL_TREE;
+ oprnd_info->first_const_oprnd = oprnd;
+ }
- /* Analyze costs (for the first stmt of the group only). */
- if (rhs_class != GIMPLE_SINGLE_RHS)
- /* Not memory operation (we don't call this functions for loads). */
- vect_model_simple_cost (stmt_info, ncopies_for_cost, dt, slp_node);
- else
- /* Store. */
- vect_model_store_cost (stmt_info, ncopies_for_cost, false,
- dt[0], slp_node);
+ if (i == 0)
+ {
+ def_op0 = def;
+ dt_op0 = dt;
+ /* Analyze costs (for the first stmt of the group only). */
+ if (REFERENCE_CLASS_P (lhs))
+ /* Store. */
+ vect_model_store_cost (stmt_info, ncopies_for_cost, false,
+ dt, slp_node);
+ else
+ /* Not memory operation (we don't call this function for
+ loads). */
+ vect_model_simple_cost (stmt_info, ncopies_for_cost, &dt,
+ slp_node);
+ }
}
-
else
{
- if (!*first_stmt_dt1 && i == 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
+ vect_internal_def. */
+ if (((oprnd_info->first_dt != dt
+ && !(oprnd_info->first_dt == vect_reduction_def
+ && dt == vect_internal_def))
+ || (oprnd_info->first_def_type != NULL_TREE
+ && def
+ && !types_compatible_p (oprnd_info->first_def_type,
+ TREE_TYPE (def))))
+ || (!def
+ && !types_compatible_p (TREE_TYPE (oprnd_info->first_const_oprnd),
+ TREE_TYPE (oprnd)))
+ || different_types)
{
- /* op1 of the first stmt of the group - store its info. */
- *first_stmt_dt1 = dt[i];
- if (def[i])
- *first_stmt_def1_type = TREE_TYPE (def[i]);
- else
+ if (number_of_oprnds != 2)
{
- /* We assume that the stmt contains only one constant
- operand. We fail otherwise, to be on the safe side. */
- if (*first_stmt_const_oprnd)
- {
- if (vect_print_dump_info (REPORT_SLP))
- fprintf (vect_dump, "Build SLP failed: two constant "
- "oprnds in stmt");
- return false;
- }
- *first_stmt_const_oprnd = oprnd;
- }
- }
- else
- {
- /* Not first stmt of the group, check that the def-stmt/s match
- the def-stmt/s of the first stmt. Allow different definition
- types for reduction chains: the first stmt must be a
- vect_reduction_def (a phi node), and the rest
- vect_internal_def. */
- if ((i == 0
- && ((*first_stmt_dt0 != dt[i]
- && !(*first_stmt_dt0 == vect_reduction_def
- && dt[i] == vect_internal_def))
- || (*first_stmt_def0_type && def[0]
- && !types_compatible_p (*first_stmt_def0_type,
- TREE_TYPE (def[0])))))
- || (i == 1
- && ((*first_stmt_dt1 != dt[i]
- && !(*first_stmt_dt1 == vect_reduction_def
- && dt[i] == vect_internal_def))
- || (*first_stmt_def1_type && def[1]
- && !types_compatible_p (*first_stmt_def1_type,
- TREE_TYPE (def[1])))))
- || (!def[i]
- && !types_compatible_p (TREE_TYPE (*first_stmt_const_oprnd),
- TREE_TYPE (oprnd)))
- || different_types)
+ if (vect_print_dump_info (REPORT_SLP))
+ fprintf (vect_dump, "Build SLP failed: different types ");
+
+ return false;
+ }
+
+ /* Try to swap operands in case of binary operation. */
+ if (i == 0)
+ different_types = true;
+ else
{
- if (i != number_of_oprnds - 1)
- different_types = true;
- else
- {
- if (is_gimple_assign (stmt)
- && (rhs_code = gimple_assign_rhs_code (stmt))
- && TREE_CODE_CLASS (rhs_code) == tcc_binary
- && commutative_tree_code (rhs_code)
- && *first_stmt_dt0 == dt[1]
- && *first_stmt_dt1 == dt[0]
- && def[0] && def[1]
- && !(*first_stmt_def0_type
- && !types_compatible_p (*first_stmt_def0_type,
- TREE_TYPE (def[1])))
- && !(*first_stmt_def1_type
- && !types_compatible_p (*first_stmt_def1_type,
- TREE_TYPE (def[0]))))
- {
- if (vect_print_dump_info (REPORT_SLP))
- {
- fprintf (vect_dump, "Swapping operands of ");
- print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM);
- }
-
- swap_tree_operands (stmt, gimple_assign_rhs1_ptr (stmt),
- gimple_assign_rhs2_ptr (stmt));
+ oprnd0_info = VEC_index (slp_oprnd_info, *oprnds_info, 0);
+ if (is_gimple_assign (stmt)
+ && (rhs_code = gimple_assign_rhs_code (stmt))
+ && TREE_CODE_CLASS (rhs_code) == tcc_binary
+ && commutative_tree_code (rhs_code)
+ && oprnd0_info->first_dt == dt
+ && oprnd_info->first_dt == dt_op0
+ && def_op0 && def
+ && !(oprnd0_info->first_def_type
+ && !types_compatible_p (oprnd0_info->first_def_type,
+ TREE_TYPE (def)))
+ && !(oprnd_info->first_def_type
+ && !types_compatible_p (oprnd_info->first_def_type,
+ TREE_TYPE (def_op0))))
+ {
+ if (vect_print_dump_info (REPORT_SLP))
+ {
+ fprintf (vect_dump, "Swapping operands of ");
+ print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM);
}
- else
- {
- if (vect_print_dump_info (REPORT_SLP))
- fprintf (vect_dump, "Build SLP failed: different types ");
- return false;
- }
+ swap_tree_operands (stmt, gimple_assign_rhs1_ptr (stmt),
+ gimple_assign_rhs2_ptr (stmt));
+ }
+ else
+ {
+ if (vect_print_dump_info (REPORT_SLP))
+ fprintf (vect_dump, "Build SLP failed: different types ");
+
+ return false;
}
}
}
}
/* Check the types of the definitions. */
- switch (dt[i])
+ switch (dt)
{
case vect_constant_def:
case vect_external_def:
+ case vect_reduction_def:
break;
case vect_internal_def:
- case vect_reduction_def:
- if ((i == 0 && !different_types) || (i == 1 && different_types))
- VEC_safe_push (gimple, heap, *def_stmts0, def_stmt);
+ if (different_types)
+ {
+ oprnd0_info = VEC_index (slp_oprnd_info, *oprnds_info, 0);
+ oprnd1_info = VEC_index (slp_oprnd_info, *oprnds_info, 0);
+ if (i == 0)
+ VEC_quick_push (gimple, oprnd1_info->def_stmts, def_stmt);
+ else
+ VEC_quick_push (gimple, oprnd0_info->def_stmts, def_stmt);
+ }
else
- VEC_safe_push (gimple, heap, *def_stmts1, def_stmt);
+ VEC_quick_push (gimple, oprnd_info->def_stmts, def_stmt);
+
break;
default:
@@ -331,7 +419,7 @@ vect_get_and_check_slp_defs (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo,
if (vect_print_dump_info (REPORT_SLP))
{
fprintf (vect_dump, "Build SLP failed: illegal type of def ");
- print_generic_expr (vect_dump, def[i], TDF_SLIM);
+ print_generic_expr (vect_dump, def, TDF_SLIM);
}
return false;
@@ -356,15 +444,11 @@ vect_build_slp_tree (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo,
VEC (slp_tree, heap) **loads,
unsigned int vectorization_factor, bool *loads_permuted)
{
- VEC (gimple, heap) *def_stmts0 = VEC_alloc (gimple, heap, group_size);
- VEC (gimple, heap) *def_stmts1 = VEC_alloc (gimple, heap, group_size);
unsigned int i;
VEC (gimple, heap) *stmts = SLP_TREE_SCALAR_STMTS (*node);
gimple stmt = VEC_index (gimple, stmts, 0);
- enum vect_def_type first_stmt_dt0 = vect_uninitialized_def;
- enum vect_def_type first_stmt_dt1 = vect_uninitialized_def;
enum tree_code first_stmt_code = ERROR_MARK, rhs_code = ERROR_MARK;
- tree first_stmt_def1_type = NULL_TREE, first_stmt_def0_type = NULL_TREE;
+ enum tree_code first_cond_code = ERROR_MARK;
tree lhs;
bool stop_recursion = false, need_same_oprnds = false;
tree vectype, scalar_type, first_op1 = NULL_TREE;
@@ -373,13 +457,28 @@ vect_build_slp_tree (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo,
int icode;
enum machine_mode optab_op2_mode;
enum machine_mode vec_mode;
- tree first_stmt_const_oprnd = NULL_TREE;
struct data_reference *first_dr;
- bool pattern0 = false, pattern1 = false;
HOST_WIDE_INT dummy;
bool permutation = false;
unsigned int load_place;
gimple first_load, prev_first_load = NULL;
+ VEC (slp_oprnd_info, heap) *oprnds_info;
+ unsigned int nops;
+ slp_oprnd_info oprnd_info;
+ tree cond;
+
+ if (is_gimple_call (stmt))
+ nops = gimple_call_num_args (stmt);
+ else if (is_gimple_assign (stmt))
+ {
+ nops = gimple_num_ops (stmt) - 1;
+ if (gimple_assign_rhs_code (stmt) == COND_EXPR)
+ nops++;
+ }
+ else
+ return false;
+
+ oprnds_info = vect_create_oprnd_info (nops, group_size);
/* For every stmt in NODE find its def stmt/s. */
FOR_EACH_VEC_ELT (gimple, stmts, i, stmt)
@@ -400,6 +499,7 @@ vect_build_slp_tree (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo,
print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM);
}
+ vect_free_oprnd_info (&oprnds_info, true);
return false;
}
@@ -409,13 +509,30 @@ vect_build_slp_tree (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo,
if (vect_print_dump_info (REPORT_SLP))
{
fprintf (vect_dump,
- "Build SLP failed: not GIMPLE_ASSIGN nor GIMPLE_CALL");
+ "Build SLP failed: not GIMPLE_ASSIGN nor GIMPLE_CALL ");
print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM);
}
+ vect_free_oprnd_info (&oprnds_info, true);
return false;
}
+ if (is_gimple_assign (stmt)
+ && gimple_assign_rhs_code (stmt) == COND_EXPR
+ && (cond = gimple_assign_rhs1 (stmt))
+ && !COMPARISON_CLASS_P (cond))
+ {
+ if (vect_print_dump_info (REPORT_SLP))
+ {
+ fprintf (vect_dump,
+ "Build SLP failed: condition is not comparison ");
+ print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM);
+ }
+
+ vect_free_oprnd_info (&oprnds_info, true);
+ return false;
+ }
+
scalar_type = vect_get_smallest_scalar_type (stmt, &dummy, &dummy);
vectype = get_vectype_for_scalar_type (scalar_type);
if (!vectype)
@@ -425,6 +542,8 @@ vect_build_slp_tree (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo,
fprintf (vect_dump, "Build SLP failed: unsupported data-type ");
print_generic_expr (vect_dump, scalar_type, TDF_SLIM);
}
+
+ vect_free_oprnd_info (&oprnds_info, true);
return false;
}
@@ -471,6 +590,7 @@ vect_build_slp_tree (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo,
{
if (vect_print_dump_info (REPORT_SLP))
fprintf (vect_dump, "Build SLP failed: no optab.");
+ vect_free_oprnd_info (&oprnds_info, true);
return false;
}
icode = (int) optab_handler (optab, vec_mode);
@@ -479,6 +599,7 @@ vect_build_slp_tree (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo,
if (vect_print_dump_info (REPORT_SLP))
fprintf (vect_dump, "Build SLP failed: "
"op not supported by target.");
+ vect_free_oprnd_info (&oprnds_info, true);
return false;
}
optab_op2_mode = insn_data[icode].operand[2].mode;
@@ -515,6 +636,7 @@ vect_build_slp_tree (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo,
print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM);
}
+ vect_free_oprnd_info (&oprnds_info, true);
return false;
}
@@ -528,6 +650,7 @@ vect_build_slp_tree (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo,
print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM);
}
+ vect_free_oprnd_info (&oprnds_info, true);
return false;
}
}
@@ -539,15 +662,12 @@ vect_build_slp_tree (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo,
{
/* Store. */
if (!vect_get_and_check_slp_defs (loop_vinfo, bb_vinfo, *node,
- stmt, &def_stmts0, &def_stmts1,
- &first_stmt_dt0,
- &first_stmt_dt1,
- &first_stmt_def0_type,
- &first_stmt_def1_type,
- &first_stmt_const_oprnd,
- ncopies_for_cost,
- &pattern0, &pattern1))
- return false;
+ stmt, ncopies_for_cost,
+ (i == 0), &oprnds_info))
+ {
+ vect_free_oprnd_info (&oprnds_info, true);
+ return false;
+ }
}
else
{
@@ -565,6 +685,7 @@ vect_build_slp_tree (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo,
print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM);
}
+ vect_free_oprnd_info (&oprnds_info, true);
return false;
}
@@ -581,6 +702,7 @@ vect_build_slp_tree (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo,
print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM);
}
+ vect_free_oprnd_info (&oprnds_info, true);
return false;
}
@@ -601,6 +723,7 @@ vect_build_slp_tree (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo,
print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM);
}
+ vect_free_oprnd_info (&oprnds_info, true);
return false;
}
}
@@ -620,6 +743,7 @@ vect_build_slp_tree (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo,
print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM);
}
+ vect_free_oprnd_info (&oprnds_info, true);
return false;
}
@@ -647,7 +771,7 @@ vect_build_slp_tree (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo,
{
if (TREE_CODE_CLASS (rhs_code) == tcc_reference)
{
- /* Not strided load. */
+ /* Not strided load. */
if (vect_print_dump_info (REPORT_SLP))
{
fprintf (vect_dump, "Build SLP failed: not strided load ");
@@ -655,12 +779,14 @@ vect_build_slp_tree (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo,
}
/* FORNOW: Not strided loads are not supported. */
+ vect_free_oprnd_info (&oprnds_info, true);
return false;
}
/* Not memory operation. */
if (TREE_CODE_CLASS (rhs_code) != tcc_binary
- && TREE_CODE_CLASS (rhs_code) != tcc_unary)
+ && TREE_CODE_CLASS (rhs_code) != tcc_unary
+ && rhs_code != COND_EXPR)
{
if (vect_print_dump_info (REPORT_SLP))
{
@@ -669,19 +795,38 @@ vect_build_slp_tree (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo,
print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM);
}
+ vect_free_oprnd_info (&oprnds_info, true);
return false;
}
+ if (rhs_code == COND_EXPR)
+ {
+ tree cond_expr = gimple_assign_rhs1 (stmt);
+
+ if (i == 0)
+ first_cond_code = TREE_CODE (cond_expr);
+ else if (first_cond_code != TREE_CODE (cond_expr))
+ {
+ if (vect_print_dump_info (REPORT_SLP))
+ {
+ fprintf (vect_dump, "Build SLP failed: different"
+ " operation");
+ print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM);
+ }
+
+ vect_free_oprnd_info (&oprnds_info, true);
+ return false;
+ }
+ }
+
/* Find the def-stmts. */
if (!vect_get_and_check_slp_defs (loop_vinfo, bb_vinfo, *node, stmt,
- &def_stmts0, &def_stmts1,
- &first_stmt_dt0, &first_stmt_dt1,
- &first_stmt_def0_type,
- &first_stmt_def1_type,
- &first_stmt_const_oprnd,
- ncopies_for_cost,
- &pattern0, &pattern1))
- return false;
+ ncopies_for_cost, (i == 0),
+ &oprnds_info))
+ {
+ vect_free_oprnd_info (&oprnds_info, true);
+ return false;
+ }
}
}
@@ -714,42 +859,29 @@ vect_build_slp_tree (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo,
}
/* Create SLP_TREE nodes for the definition node/s. */
- if (first_stmt_dt0 == vect_internal_def)
- {
- slp_tree left_node = XNEW (struct _slp_tree);
- SLP_TREE_SCALAR_STMTS (left_node) = def_stmts0;
- SLP_TREE_VEC_STMTS (left_node) = NULL;
- SLP_TREE_LEFT (left_node) = NULL;
- SLP_TREE_RIGHT (left_node) = NULL;
- SLP_TREE_OUTSIDE_OF_LOOP_COST (left_node) = 0;
- SLP_TREE_INSIDE_OF_LOOP_COST (left_node) = 0;
- if (!vect_build_slp_tree (loop_vinfo, bb_vinfo, &left_node, group_size,
- inside_cost, outside_cost, ncopies_for_cost,
- max_nunits, load_permutation, loads,
- vectorization_factor, loads_permuted))
- return false;
+ FOR_EACH_VEC_ELT (slp_oprnd_info, oprnds_info, i, oprnd_info)
+ {
+ slp_tree child;
- SLP_TREE_LEFT (*node) = left_node;
- }
+ if (oprnd_info->first_dt != vect_internal_def)
+ continue;
- if (first_stmt_dt1 == vect_internal_def)
- {
- slp_tree right_node = XNEW (struct _slp_tree);
- SLP_TREE_SCALAR_STMTS (right_node) = def_stmts1;
- SLP_TREE_VEC_STMTS (right_node) = NULL;
- SLP_TREE_LEFT (right_node) = NULL;
- SLP_TREE_RIGHT (right_node) = NULL;
- SLP_TREE_OUTSIDE_OF_LOOP_COST (right_node) = 0;
- SLP_TREE_INSIDE_OF_LOOP_COST (right_node) = 0;
- if (!vect_build_slp_tree (loop_vinfo, bb_vinfo, &right_node, group_size,
+ child = vect_create_new_slp_node (oprnd_info->def_stmts);
+ if (!child
+ || !vect_build_slp_tree (loop_vinfo, bb_vinfo, &child, group_size,
inside_cost, outside_cost, ncopies_for_cost,
max_nunits, load_permutation, loads,
vectorization_factor, loads_permuted))
- return false;
+ {
+ free (child);
+ vect_free_oprnd_info (&oprnds_info, true);
+ return false;
+ }
- SLP_TREE_RIGHT (*node) = right_node;
+ VEC_quick_push (slp_void_p, SLP_TREE_CHILDREN (*node), child);
}
+ vect_free_oprnd_info (&oprnds_info, false);
return true;
}
@@ -759,6 +891,7 @@ vect_print_slp_tree (slp_tree node)
{
int i;
gimple stmt;
+ slp_void_p child;
if (!node)
return;
@@ -771,8 +904,8 @@ vect_print_slp_tree (slp_tree node)
}
fprintf (vect_dump, "\n");
- vect_print_slp_tree (SLP_TREE_LEFT (node));
- vect_print_slp_tree (SLP_TREE_RIGHT (node));
+ FOR_EACH_VEC_ELT (slp_void_p, SLP_TREE_CHILDREN (node), i, child)
+ vect_print_slp_tree ((slp_tree) child);
}
@@ -786,6 +919,7 @@ vect_mark_slp_stmts (slp_tree node, enum slp_vect_type mark, int j)
{
int i;
gimple stmt;
+ slp_void_p child;
if (!node)
return;
@@ -794,8 +928,8 @@ vect_mark_slp_stmts (slp_tree node, enum slp_vect_type mark, int j)
if (j < 0 || i == j)
STMT_SLP_TYPE (vinfo_for_stmt (stmt)) = mark;
- vect_mark_slp_stmts (SLP_TREE_LEFT (node), mark, j);
- vect_mark_slp_stmts (SLP_TREE_RIGHT (node), mark, j);
+ FOR_EACH_VEC_ELT (slp_void_p, SLP_TREE_CHILDREN (node), i, child)
+ vect_mark_slp_stmts ((slp_tree) child, mark, j);
}
@@ -807,6 +941,7 @@ vect_mark_slp_stmts_relevant (slp_tree node)
int i;
gimple stmt;
stmt_vec_info stmt_info;
+ slp_void_p child;
if (!node)
return;
@@ -819,8 +954,8 @@ vect_mark_slp_stmts_relevant (slp_tree node)
STMT_VINFO_RELEVANT (stmt_info) = vect_used_in_scope;
}
- vect_mark_slp_stmts_relevant (SLP_TREE_LEFT (node));
- vect_mark_slp_stmts_relevant (SLP_TREE_RIGHT (node));
+ FOR_EACH_VEC_ELT (slp_void_p, SLP_TREE_CHILDREN (node), i, child)
+ vect_mark_slp_stmts_relevant ((slp_tree) child);
}
@@ -893,12 +1028,13 @@ vect_slp_rearrange_stmts (slp_tree node, unsigned int group_size,
gimple stmt;
VEC (gimple, heap) *tmp_stmts;
unsigned int index, i;
+ slp_void_p child;
if (!node)
return;
- vect_slp_rearrange_stmts (SLP_TREE_LEFT (node), group_size, permutation);
- vect_slp_rearrange_stmts (SLP_TREE_RIGHT (node), group_size, permutation);
+ FOR_EACH_VEC_ELT (slp_void_p, SLP_TREE_CHILDREN (node), i, child)
+ vect_slp_rearrange_stmts ((slp_tree) child, group_size, permutation);
gcc_assert (group_size == VEC_length (gimple, SLP_TREE_SCALAR_STMTS (node)));
tmp_stmts = VEC_alloc (gimple, heap, group_size);
@@ -1263,7 +1399,7 @@ vect_analyze_slp_instance (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo,
gimple stmt)
{
slp_instance new_instance;
- slp_tree node = XNEW (struct _slp_tree);
+ slp_tree node;
unsigned int group_size = GROUP_SIZE (vinfo_for_stmt (stmt));
unsigned int unrolling_factor = 1, nunits;
tree vectype, scalar_type = NULL_TREE;
@@ -1275,6 +1411,7 @@ vect_analyze_slp_instance (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo,
VEC (slp_tree, heap) *loads;
struct data_reference *dr = STMT_VINFO_DATA_REF (vinfo_for_stmt (stmt));
bool loads_permuted = false;
+ VEC (gimple, heap) *scalar_stmts;
if (GROUP_FIRST_ELEMENT (vinfo_for_stmt (stmt)))
{
@@ -1327,32 +1464,31 @@ vect_analyze_slp_instance (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo,
}
/* Create a node (a root of the SLP tree) for the packed strided stores. */
- SLP_TREE_SCALAR_STMTS (node) = VEC_alloc (gimple, heap, group_size);
+ scalar_stmts = VEC_alloc (gimple, heap, group_size);
next = stmt;
if (GROUP_FIRST_ELEMENT (vinfo_for_stmt (stmt)))
{
/* Collect the stores and store them in SLP_TREE_SCALAR_STMTS. */
while (next)
{
- VEC_safe_push (gimple, heap, SLP_TREE_SCALAR_STMTS (node), next);
+ if (STMT_VINFO_IN_PATTERN_P (vinfo_for_stmt (next))
+ && STMT_VINFO_RELATED_STMT (vinfo_for_stmt (next)))
+ VEC_safe_push (gimple, heap, scalar_stmts,
+ STMT_VINFO_RELATED_STMT (vinfo_for_stmt (next)));
+ else
+ VEC_safe_push (gimple, heap, scalar_stmts, next);
next = GROUP_NEXT_ELEMENT (vinfo_for_stmt (next));
}
}
else
{
/* Collect reduction statements. */
- for (i = 0; VEC_iterate (gimple, LOOP_VINFO_REDUCTIONS (loop_vinfo), i,
- next);
- i++)
- VEC_safe_push (gimple, heap, SLP_TREE_SCALAR_STMTS (node), next);
+ VEC (gimple, heap) *reductions = LOOP_VINFO_REDUCTIONS (loop_vinfo);
+ for (i = 0; VEC_iterate (gimple, reductions, i, next); i++)
+ VEC_safe_push (gimple, heap, scalar_stmts, next);
}
- SLP_TREE_VEC_STMTS (node) = NULL;
- SLP_TREE_NUMBER_OF_VEC_STMTS (node) = 0;
- SLP_TREE_LEFT (node) = NULL;
- SLP_TREE_RIGHT (node) = NULL;
- SLP_TREE_OUTSIDE_OF_LOOP_COST (node) = 0;
- SLP_TREE_INSIDE_OF_LOOP_COST (node) = 0;
+ node = vect_create_new_slp_node (scalar_stmts);
/* Calculate the number of vector stmts to create based on the unrolling
factor (number of vectors is 1 if NUNITS >= GROUP_SIZE, and is
@@ -1548,6 +1684,7 @@ vect_detect_hybrid_slp_stmts (slp_tree node)
imm_use_iterator imm_iter;
gimple use_stmt;
stmt_vec_info stmt_vinfo;
+ slp_void_p child;
if (!node)
return;
@@ -1565,8 +1702,8 @@ vect_detect_hybrid_slp_stmts (slp_tree node)
== vect_reduction_def))
vect_mark_slp_stmts (node, hybrid, i);
- vect_detect_hybrid_slp_stmts (SLP_TREE_LEFT (node));
- vect_detect_hybrid_slp_stmts (SLP_TREE_RIGHT (node));
+ FOR_EACH_VEC_ELT (slp_void_p, SLP_TREE_CHILDREN (node), i, child)
+ vect_detect_hybrid_slp_stmts ((slp_tree) child);
}
@@ -1656,13 +1793,14 @@ vect_slp_analyze_node_operations (bb_vec_info bb_vinfo, slp_tree node)
bool dummy;
int i;
gimple stmt;
+ slp_void_p child;
if (!node)
return true;
- if (!vect_slp_analyze_node_operations (bb_vinfo, SLP_TREE_LEFT (node))
- || !vect_slp_analyze_node_operations (bb_vinfo, SLP_TREE_RIGHT (node)))
- return false;
+ FOR_EACH_VEC_ELT (slp_void_p, SLP_TREE_CHILDREN (node), i, child)
+ if (!vect_slp_analyze_node_operations (bb_vinfo, (slp_tree) child))
+ return false;
FOR_EACH_VEC_ELT (gimple, SLP_TREE_SCALAR_STMTS (node), i, stmt)
{
@@ -2086,15 +2224,15 @@ vect_get_constant_vectors (tree op, slp_tree slp_node,
For example, we have two scalar operands, s1 and s2 (e.g., group of
strided accesses of size two), while NUNITS is four (i.e., four scalars
- of this type can be packed in a vector). The output vector will contain
- two copies of each scalar operand: {s1, s2, s1, s2}. (NUMBER_OF_COPIES
+ of this type can be packed in a vector). The output vector will contain
+ two copies of each scalar operand: {s1, s2, s1, s2}. (NUMBER_OF_COPIES
will be 2).
If GROUP_SIZE > NUNITS, the scalars will be split into several vectors
containing the operands.
For example, NUNITS is four as before, and the group size is 8
- (s1, s2, ..., s8). We will create two vectors {s1, s2, s3, s4} and
+ (s1, s2, ..., s8). We will create two vectors {s1, s2, s3, s4} and
{s5, s6, s7, s8}. */
number_of_copies = least_common_multiple (nunits, group_size) / group_size;
@@ -2106,8 +2244,23 @@ vect_get_constant_vectors (tree op, slp_tree slp_node,
{
if (is_store)
op = gimple_assign_rhs1 (stmt);
- else
+ else if (gimple_assign_rhs_code (stmt) != COND_EXPR)
op = gimple_op (stmt, op_num + 1);
+ else
+ {
+ if (op_num == 0 || op_num == 1)
+ {
+ tree cond = gimple_assign_rhs1 (stmt);
+ op = TREE_OPERAND (cond, op_num);
+ }
+ else
+ {
+ if (op_num == 2)
+ op = gimple_assign_rhs2 (stmt);
+ else
+ op = gimple_assign_rhs3 (stmt);
+ }
+ }
if (reduc_index != -1)
{
@@ -2208,85 +2361,100 @@ vect_get_slp_vect_defs (slp_tree slp_node, VEC (tree,heap) **vec_oprnds)
If the scalar definitions are loop invariants or constants, collect them and
call vect_get_constant_vectors() to create vector stmts.
Otherwise, the def-stmts must be already vectorized and the vectorized stmts
- must be stored in the LEFT/RIGHT node of SLP_NODE, and we call
- vect_get_slp_vect_defs() to retrieve them.
- If VEC_OPRNDS1 is NULL, don't get vector defs for the second operand (from
- the right node. This is used when the second operand must remain scalar. */
+ must be stored in the corresponding child of SLP_NODE, and we call
+ vect_get_slp_vect_defs () to retrieve them. */
void
-vect_get_slp_defs (tree op0, tree op1, slp_tree slp_node,
- VEC (tree,heap) **vec_oprnds0,
- VEC (tree,heap) **vec_oprnds1, int reduc_index)
+vect_get_slp_defs (VEC (tree, heap) *ops, slp_tree slp_node,
+ VEC (slp_void_p, heap) **vec_oprnds, int reduc_index)
{
- gimple first_stmt;
- enum tree_code code;
- int number_of_vects;
+ gimple first_stmt, first_def;
+ int number_of_vects = 0, i;
+ unsigned int child_index = 0;
HOST_WIDE_INT lhs_size_unit, rhs_size_unit;
+ slp_tree child = NULL;
+ VEC (tree, heap) *vec_defs;
+ tree oprnd, def_lhs;
+ bool vectorized_defs;
first_stmt = VEC_index (gimple, SLP_TREE_SCALAR_STMTS (slp_node), 0);
- /* The number of vector defs is determined by the number of vector statements
- in the node from which we get those statements. */
- if (SLP_TREE_LEFT (slp_node))
- number_of_vects = SLP_TREE_NUMBER_OF_VEC_STMTS (SLP_TREE_LEFT (slp_node));
- else
- {
- number_of_vects = SLP_TREE_NUMBER_OF_VEC_STMTS (slp_node);
- /* Number of vector stmts was calculated according to LHS in
- vect_schedule_slp_instance(), fix it by replacing LHS with RHS, if
- necessary. See vect_get_smallest_scalar_type () for details. */
- vect_get_smallest_scalar_type (first_stmt, &lhs_size_unit,
- &rhs_size_unit);
- if (rhs_size_unit != lhs_size_unit)
+ FOR_EACH_VEC_ELT (tree, ops, i, oprnd)
+ {
+ /* For each operand we check if it has vectorized definitions in a child
+ node or we need to create them (for invariants and constants). We
+ check if the LHS of the first stmt of the next child matches OPRND.
+ If it does, we found the correct child. Otherwise, we call
+ vect_get_constant_vectors (), and not advance CHILD_INDEX in order
+ to check this child node for the next operand. */
+ vectorized_defs = false;
+ if (VEC_length (slp_void_p, SLP_TREE_CHILDREN (slp_node)) > child_index)
{
- number_of_vects *= rhs_size_unit;
- number_of_vects /= lhs_size_unit;
- }
- }
-
- /* Allocate memory for vectorized defs. */
- *vec_oprnds0 = VEC_alloc (tree, heap, number_of_vects);
-
- /* SLP_NODE corresponds either to a group of stores or to a group of
- unary/binary operations. We don't call this function for loads.
- For reduction defs we call vect_get_constant_vectors(), since we are
- looking for initial loop invariant values. */
- if (SLP_TREE_LEFT (slp_node) && reduc_index == -1)
- /* The defs are already vectorized. */
- vect_get_slp_vect_defs (SLP_TREE_LEFT (slp_node), vec_oprnds0);
- else
- /* Build vectors from scalar defs. */
- vect_get_constant_vectors (op0, slp_node, vec_oprnds0, 0, number_of_vects,
- reduc_index);
+ child = (slp_tree) VEC_index (slp_void_p,
+ SLP_TREE_CHILDREN (slp_node),
+ child_index);
+ first_def = VEC_index (gimple, SLP_TREE_SCALAR_STMTS (child), 0);
+
+ /* In the end of a pattern sequence we have a use of the original stmt,
+ so we need to compare OPRND with the original def. */
+ if (is_pattern_stmt_p (vinfo_for_stmt (first_def))
+ && !STMT_VINFO_IN_PATTERN_P (vinfo_for_stmt (first_stmt))
+ && !is_pattern_stmt_p (vinfo_for_stmt (first_stmt)))
+ first_def = STMT_VINFO_RELATED_STMT (vinfo_for_stmt (first_def));
+
+ if (is_gimple_call (first_def))
+ def_lhs = gimple_call_lhs (first_def);
+ else
+ def_lhs = gimple_assign_lhs (first_def);
- if (STMT_VINFO_DATA_REF (vinfo_for_stmt (first_stmt)))
- /* Since we don't call this function with loads, this is a group of
- stores. */
- return;
+ if (operand_equal_p (oprnd, def_lhs, 0))
+ {
+ /* The number of vector defs is determined by the number of
+ vector statements in the node from which we get those
+ statements. */
+ number_of_vects = SLP_TREE_NUMBER_OF_VEC_STMTS (child);
+ vectorized_defs = true;
+ child_index++;
+ }
+ }
- /* For reductions, we only need initial values. */
- if (reduc_index != -1)
- return;
+ if (!vectorized_defs)
+ {
+ if (i == 0)
+ {
+ number_of_vects = SLP_TREE_NUMBER_OF_VEC_STMTS (slp_node);
+ /* Number of vector stmts was calculated according to LHS in
+ vect_schedule_slp_instance (), fix it by replacing LHS with
+ RHS, if necessary. See vect_get_smallest_scalar_type () for
+ details. */
+ vect_get_smallest_scalar_type (first_stmt, &lhs_size_unit,
+ &rhs_size_unit);
+ if (rhs_size_unit != lhs_size_unit)
+ {
+ number_of_vects *= rhs_size_unit;
+ number_of_vects /= lhs_size_unit;
+ }
+ }
+ }
- code = gimple_assign_rhs_code (first_stmt);
- if (get_gimple_rhs_class (code) != GIMPLE_BINARY_RHS || !vec_oprnds1 || !op1)
- return;
+ /* Allocate memory for vectorized defs. */
+ vec_defs = VEC_alloc (tree, heap, number_of_vects);
- /* The number of vector defs is determined by the number of vector statements
- in the node from which we get those statements. */
- if (SLP_TREE_RIGHT (slp_node))
- number_of_vects = SLP_TREE_NUMBER_OF_VEC_STMTS (SLP_TREE_RIGHT (slp_node));
- else
- number_of_vects = SLP_TREE_NUMBER_OF_VEC_STMTS (slp_node);
+ /* For reduction defs we call vect_get_constant_vectors (), since we are
+ looking for initial loop invariant values. */
+ if (vectorized_defs && reduc_index == -1)
+ /* The defs are already vectorized. */
+ vect_get_slp_vect_defs (child, &vec_defs);
+ else
+ /* Build vectors from scalar defs. */
+ vect_get_constant_vectors (oprnd, slp_node, &vec_defs, i,
+ number_of_vects, reduc_index);
- *vec_oprnds1 = VEC_alloc (tree, heap, number_of_vects);
+ VEC_quick_push (slp_void_p, *vec_oprnds, (slp_void_p) vec_defs);
- if (SLP_TREE_RIGHT (slp_node))
- /* The defs are already vectorized. */
- vect_get_slp_vect_defs (SLP_TREE_RIGHT (slp_node), vec_oprnds1);
- else
- /* Build vectors from scalar defs. */
- vect_get_constant_vectors (op1, slp_node, vec_oprnds1, 1, number_of_vects,
- -1);
+ /* For reductions, we only need initial values. */
+ if (reduc_index != -1)
+ return;
+ }
}
@@ -2593,14 +2761,14 @@ vect_schedule_slp_instance (slp_tree node, slp_instance instance,
tree vectype;
int i;
slp_tree loads_node;
+ slp_void_p child;
if (!node)
return false;
- vect_schedule_slp_instance (SLP_TREE_LEFT (node), instance,
- vectorization_factor);
- vect_schedule_slp_instance (SLP_TREE_RIGHT (node), instance,
- vectorization_factor);
+ FOR_EACH_VEC_ELT (slp_void_p, SLP_TREE_CHILDREN (node), i, child)
+ vect_schedule_slp_instance ((slp_tree) child, instance,
+ vectorization_factor);
stmt = VEC_index (gimple, SLP_TREE_SCALAR_STMTS (node), 0);
stmt_info = vinfo_for_stmt (stmt);
diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c
index c6df30e9310..8b9a2cfa3c7 100644
--- a/gcc/tree-vect-stmts.c
+++ b/gcc/tree-vect-stmts.c
@@ -332,6 +332,8 @@ exist_non_indexing_operands_for_use_p (tree use, gimple stmt)
- LIVE_P, RELEVANT - enum values to be set in the STMT_VINFO of the stmt
that defined USE. This is done by calling mark_relevant and passing it
the WORKLIST (to add DEF_STMT to the WORKLIST in case it is relevant).
+ - FORCE is true if exist_non_indexing_operands_for_use_p check shouldn't
+ be performed.
Outputs:
Generally, LIVE_P and RELEVANT are used to define the liveness and
@@ -351,7 +353,8 @@ exist_non_indexing_operands_for_use_p (tree use, gimple stmt)
static bool
process_use (gimple stmt, tree use, loop_vec_info loop_vinfo, bool live_p,
- enum vect_relevant relevant, VEC(gimple,heap) **worklist)
+ enum vect_relevant relevant, VEC(gimple,heap) **worklist,
+ bool force)
{
struct loop *loop = LOOP_VINFO_LOOP (loop_vinfo);
stmt_vec_info stmt_vinfo = vinfo_for_stmt (stmt);
@@ -363,7 +366,7 @@ process_use (gimple stmt, tree use, loop_vec_info loop_vinfo, bool live_p,
/* case 1: we are only interested in uses that need to be vectorized. Uses
that are used for address computation are not considered relevant. */
- if (!exist_non_indexing_operands_for_use_p (use, stmt))
+ if (!force && !exist_non_indexing_operands_for_use_p (use, stmt))
return true;
if (!vect_is_simple_use (use, loop_vinfo, NULL, &def_stmt, &def, &dt))
@@ -646,7 +649,7 @@ vect_mark_stmts_to_be_vectorized (loop_vec_info loop_vinfo)
break;
}
- if (is_pattern_stmt_p (vinfo_for_stmt (stmt)))
+ if (is_pattern_stmt_p (stmt_vinfo))
{
/* Pattern statements are not inserted into the code, so
FOR_EACH_PHI_OR_STMT_USE optimizes their operands out, and we
@@ -660,9 +663,9 @@ vect_mark_stmts_to_be_vectorized (loop_vec_info loop_vinfo)
if (rhs_code == COND_EXPR && COMPARISON_CLASS_P (op))
{
if (!process_use (stmt, TREE_OPERAND (op, 0), loop_vinfo,
- live_p, relevant, &worklist)
+ live_p, relevant, &worklist, false)
|| !process_use (stmt, TREE_OPERAND (op, 1), loop_vinfo,
- live_p, relevant, &worklist))
+ live_p, relevant, &worklist, false))
{
VEC_free (gimple, heap, worklist);
return false;
@@ -673,7 +676,7 @@ vect_mark_stmts_to_be_vectorized (loop_vec_info loop_vinfo)
{
op = gimple_op (stmt, i);
if (!process_use (stmt, op, loop_vinfo, live_p, relevant,
- &worklist))
+ &worklist, false))
{
VEC_free (gimple, heap, worklist);
return false;
@@ -686,7 +689,7 @@ vect_mark_stmts_to_be_vectorized (loop_vec_info loop_vinfo)
{
tree arg = gimple_call_arg (stmt, i);
if (!process_use (stmt, arg, loop_vinfo, live_p, relevant,
- &worklist))
+ &worklist, false))
{
VEC_free (gimple, heap, worklist);
return false;
@@ -699,12 +702,25 @@ vect_mark_stmts_to_be_vectorized (loop_vec_info loop_vinfo)
{
tree op = USE_FROM_PTR (use_p);
if (!process_use (stmt, op, loop_vinfo, live_p, relevant,
- &worklist))
+ &worklist, false))
{
VEC_free (gimple, heap, worklist);
return false;
}
}
+
+ if (STMT_VINFO_GATHER_P (stmt_vinfo))
+ {
+ tree off;
+ tree decl = vect_check_gather (stmt, loop_vinfo, NULL, &off, NULL);
+ gcc_assert (decl);
+ if (!process_use (stmt, off, loop_vinfo, live_p, relevant,
+ &worklist, true))
+ {
+ VEC_free (gimple, heap, worklist);
+ return false;
+ }
+ }
} /* while worklist */
VEC_free (gimple, heap, worklist);
@@ -1399,16 +1415,35 @@ vect_get_vec_defs_for_stmt_copy (enum vect_def_type *dt,
}
-/* Get vectorized definitions for OP0 and OP1, or SLP_NODE if it is not
- NULL. */
+/* Get vectorized definitions for OP0 and OP1.
+ REDUC_INDEX is the index of reduction operand in case of reduction,
+ and -1 otherwise. */
-static void
+void
vect_get_vec_defs (tree op0, tree op1, gimple stmt,
- VEC(tree,heap) **vec_oprnds0, VEC(tree,heap) **vec_oprnds1,
- slp_tree slp_node)
+ VEC (tree, heap) **vec_oprnds0,
+ VEC (tree, heap) **vec_oprnds1,
+ slp_tree slp_node, int reduc_index)
{
if (slp_node)
- vect_get_slp_defs (op0, op1, slp_node, vec_oprnds0, vec_oprnds1, -1);
+ {
+ int nops = (op1 == NULL_TREE) ? 1 : 2;
+ VEC (tree, heap) *ops = VEC_alloc (tree, heap, nops);
+ VEC (slp_void_p, heap) *vec_defs = VEC_alloc (slp_void_p, heap, nops);
+
+ VEC_quick_push (tree, ops, op0);
+ if (op1)
+ VEC_quick_push (tree, ops, op1);
+
+ vect_get_slp_defs (ops, slp_node, &vec_defs, reduc_index);
+
+ *vec_oprnds0 = (VEC (tree, heap) *) VEC_index (slp_void_p, vec_defs, 0);
+ if (op1)
+ *vec_oprnds1 = (VEC (tree, heap) *) VEC_index (slp_void_p, vec_defs, 1);
+
+ VEC_free (tree, heap, ops);
+ VEC_free (slp_void_p, heap, vec_defs);
+ }
else
{
tree vec_oprnd;
@@ -1824,9 +1859,168 @@ vect_gen_widened_results_half (enum tree_code code,
return new_stmt;
}
+
+/* Get vectorized definitions for loop-based vectorization. For the first
+ operand we call vect_get_vec_def_for_operand() (with OPRND containing
+ scalar operand), and for the rest we get a copy with
+ vect_get_vec_def_for_stmt_copy() using the previous vector definition
+ (stored in OPRND). See vect_get_vec_def_for_stmt_copy() for details.
+ The vectors are collected into VEC_OPRNDS. */
+
+static void
+vect_get_loop_based_defs (tree *oprnd, gimple stmt, enum vect_def_type dt,
+ VEC (tree, heap) **vec_oprnds, int multi_step_cvt)
+{
+ tree vec_oprnd;
+
+ /* Get first vector operand. */
+ /* All the vector operands except the very first one (that is scalar oprnd)
+ are stmt copies. */
+ if (TREE_CODE (TREE_TYPE (*oprnd)) != VECTOR_TYPE)
+ vec_oprnd = vect_get_vec_def_for_operand (*oprnd, stmt, NULL);
+ else
+ vec_oprnd = vect_get_vec_def_for_stmt_copy (dt, *oprnd);
+
+ VEC_quick_push (tree, *vec_oprnds, vec_oprnd);
+
+ /* Get second vector operand. */
+ vec_oprnd = vect_get_vec_def_for_stmt_copy (dt, vec_oprnd);
+ VEC_quick_push (tree, *vec_oprnds, vec_oprnd);
+
+ *oprnd = vec_oprnd;
+
+ /* For conversion in multiple steps, continue to get operands
+ recursively. */
+ if (multi_step_cvt)
+ vect_get_loop_based_defs (oprnd, stmt, dt, vec_oprnds, multi_step_cvt - 1);
+}
+
+
+/* Create vectorized demotion statements for vector operands from VEC_OPRNDS.
+ For multi-step conversions store the resulting vectors and call the function
+ recursively. */
+
+static void
+vect_create_vectorized_demotion_stmts (VEC (tree, heap) **vec_oprnds,
+ int multi_step_cvt, gimple stmt,
+ VEC (tree, heap) *vec_dsts,
+ gimple_stmt_iterator *gsi,
+ slp_tree slp_node, enum tree_code code,
+ stmt_vec_info *prev_stmt_info)
+{
+ unsigned int i;
+ tree vop0, vop1, new_tmp, vec_dest;
+ gimple new_stmt;
+ stmt_vec_info stmt_info = vinfo_for_stmt (stmt);
+
+ vec_dest = VEC_pop (tree, vec_dsts);
+
+ for (i = 0; i < VEC_length (tree, *vec_oprnds); i += 2)
+ {
+ /* Create demotion operation. */
+ vop0 = VEC_index (tree, *vec_oprnds, i);
+ vop1 = VEC_index (tree, *vec_oprnds, i + 1);
+ new_stmt = gimple_build_assign_with_ops (code, vec_dest, vop0, vop1);
+ new_tmp = make_ssa_name (vec_dest, new_stmt);
+ gimple_assign_set_lhs (new_stmt, new_tmp);
+ vect_finish_stmt_generation (stmt, new_stmt, gsi);
+
+ if (multi_step_cvt)
+ /* Store the resulting vector for next recursive call. */
+ VEC_replace (tree, *vec_oprnds, i/2, new_tmp);
+ else
+ {
+ /* This is the last step of the conversion sequence. Store the
+ vectors in SLP_NODE or in vector info of the scalar statement
+ (or in STMT_VINFO_RELATED_STMT chain). */
+ if (slp_node)
+ VEC_quick_push (gimple, SLP_TREE_VEC_STMTS (slp_node), new_stmt);
+ else
+ {
+ if (!*prev_stmt_info)
+ STMT_VINFO_VEC_STMT (stmt_info) = new_stmt;
+ else
+ STMT_VINFO_RELATED_STMT (*prev_stmt_info) = new_stmt;
+
+ *prev_stmt_info = vinfo_for_stmt (new_stmt);
+ }
+ }
+ }
+
+ /* For multi-step demotion operations we first generate demotion operations
+ from the source type to the intermediate types, and then combine the
+ results (stored in VEC_OPRNDS) in demotion operation to the destination
+ type. */
+ if (multi_step_cvt)
+ {
+ /* At each level of recursion we have half of the operands we had at the
+ previous level. */
+ VEC_truncate (tree, *vec_oprnds, (i+1)/2);
+ vect_create_vectorized_demotion_stmts (vec_oprnds, multi_step_cvt - 1,
+ stmt, vec_dsts, gsi, slp_node,
+ VEC_PACK_TRUNC_EXPR,
+ prev_stmt_info);
+ }
+
+ VEC_quick_push (tree, vec_dsts, vec_dest);
+}
+
+
+/* Create vectorized promotion statements for vector operands from VEC_OPRNDS0
+ and VEC_OPRNDS1 (for binary operations). For multi-step conversions store
+ the resulting vectors and call the function recursively. */
+
+static void
+vect_create_vectorized_promotion_stmts (VEC (tree, heap) **vec_oprnds0,
+ VEC (tree, heap) **vec_oprnds1,
+ gimple stmt, tree vec_dest,
+ gimple_stmt_iterator *gsi,
+ enum tree_code code1,
+ enum tree_code code2, tree decl1,
+ tree decl2, int op_type)
+{
+ int i;
+ tree vop0, vop1, new_tmp1, new_tmp2;
+ gimple new_stmt1, new_stmt2;
+ VEC (tree, heap) *vec_tmp = NULL;
+
+ vec_tmp = VEC_alloc (tree, heap, VEC_length (tree, *vec_oprnds0) * 2);
+ FOR_EACH_VEC_ELT (tree, *vec_oprnds0, i, vop0)
+ {
+ if (op_type == binary_op)
+ vop1 = VEC_index (tree, *vec_oprnds1, i);
+ else
+ vop1 = NULL_TREE;
+
+ /* Generate the two halves of promotion operation. */
+ new_stmt1 = vect_gen_widened_results_half (code1, decl1, vop0, vop1,
+ op_type, vec_dest, gsi, stmt);
+ new_stmt2 = vect_gen_widened_results_half (code2, decl2, vop0, vop1,
+ op_type, vec_dest, gsi, stmt);
+ if (is_gimple_call (new_stmt1))
+ {
+ new_tmp1 = gimple_call_lhs (new_stmt1);
+ new_tmp2 = gimple_call_lhs (new_stmt2);
+ }
+ else
+ {
+ new_tmp1 = gimple_assign_lhs (new_stmt1);
+ new_tmp2 = gimple_assign_lhs (new_stmt2);
+ }
+
+ /* Store the results for the next step. */
+ VEC_quick_push (tree, vec_tmp, new_tmp1);
+ VEC_quick_push (tree, vec_tmp, new_tmp2);
+ }
+
+ VEC_free (tree, heap, *vec_oprnds0);
+ *vec_oprnds0 = vec_tmp;
+}
+
+
/* Check if STMT performs a conversion operation, that can be vectorized.
If VEC_STMT is also passed, vectorize the STMT: create a vectorized
- stmt to replace it, put it in VEC_STMT, and insert it at BSI.
+ stmt to replace it, put it in VEC_STMT, and insert it at GSI.
Return FALSE if not a vectorizable STMT, TRUE otherwise. */
static bool
@@ -1835,11 +2029,12 @@ vectorizable_conversion (gimple stmt, gimple_stmt_iterator *gsi,
{
tree vec_dest;
tree scalar_dest;
- tree op0;
+ tree op0, op1 = NULL_TREE;
tree vec_oprnd0 = NULL_TREE, vec_oprnd1 = NULL_TREE;
stmt_vec_info stmt_info = vinfo_for_stmt (stmt);
loop_vec_info loop_vinfo = STMT_VINFO_LOOP_VINFO (stmt_info);
enum tree_code code, code1 = ERROR_MARK, code2 = ERROR_MARK;
+ enum tree_code codecvt1 = ERROR_MARK, codecvt2 = ERROR_MARK;
tree decl1 = NULL_TREE, decl2 = NULL_TREE;
tree new_temp;
tree def;
@@ -1850,21 +2045,22 @@ vectorizable_conversion (gimple stmt, gimple_stmt_iterator *gsi,
int nunits_in;
int nunits_out;
tree vectype_out, vectype_in;
- int ncopies, j;
- tree rhs_type;
+ int ncopies, i, j;
+ tree lhs_type, rhs_type;
enum { NARROW, NONE, WIDEN } modifier;
- int i;
- VEC(tree,heap) *vec_oprnds0 = NULL;
+ VEC (tree,heap) *vec_oprnds0 = NULL, *vec_oprnds1 = NULL;
tree vop0;
- VEC(tree,heap) *dummy = NULL;
- int dummy_int;
+ bb_vec_info bb_vinfo = STMT_VINFO_BB_VINFO (stmt_info);
+ int multi_step_cvt = 0;
+ VEC (tree, heap) *vec_dsts = NULL, *interm_types = NULL;
+ tree last_oprnd, intermediate_type, cvt_type = NULL_TREE;
+ int op_type;
+ enum machine_mode rhs_mode;
+ unsigned short fltsz;
/* Is STMT a vectorizable conversion? */
- /* FORNOW: unsupported in basic block SLP. */
- gcc_assert (loop_vinfo);
-
- if (!STMT_VINFO_RELEVANT_P (stmt_info))
+ if (!STMT_VINFO_RELEVANT_P (stmt_info) && !bb_vinfo)
return false;
if (STMT_VINFO_DEF_TYPE (stmt_info) != vect_internal_def)
@@ -1877,23 +2073,74 @@ vectorizable_conversion (gimple stmt, gimple_stmt_iterator *gsi,
return false;
code = gimple_assign_rhs_code (stmt);
- if (code != FIX_TRUNC_EXPR && code != FLOAT_EXPR)
+ if (!CONVERT_EXPR_CODE_P (code)
+ && code != FIX_TRUNC_EXPR
+ && code != FLOAT_EXPR
+ && code != WIDEN_MULT_EXPR
+ && code != WIDEN_LSHIFT_EXPR)
return false;
+ op_type = TREE_CODE_LENGTH (code);
+
/* Check types of lhs and rhs. */
scalar_dest = gimple_assign_lhs (stmt);
+ lhs_type = TREE_TYPE (scalar_dest);
vectype_out = STMT_VINFO_VECTYPE (stmt_info);
op0 = gimple_assign_rhs1 (stmt);
rhs_type = TREE_TYPE (op0);
+
+ if ((code != FIX_TRUNC_EXPR && code != FLOAT_EXPR)
+ && !((INTEGRAL_TYPE_P (lhs_type)
+ && INTEGRAL_TYPE_P (rhs_type))
+ || (SCALAR_FLOAT_TYPE_P (lhs_type)
+ && SCALAR_FLOAT_TYPE_P (rhs_type))))
+ return false;
+
+ if ((INTEGRAL_TYPE_P (lhs_type)
+ && (TYPE_PRECISION (lhs_type)
+ != GET_MODE_PRECISION (TYPE_MODE (lhs_type))))
+ || (INTEGRAL_TYPE_P (rhs_type)
+ && (TYPE_PRECISION (rhs_type)
+ != GET_MODE_PRECISION (TYPE_MODE (rhs_type)))))
+ {
+ if (vect_print_dump_info (REPORT_DETAILS))
+ fprintf (vect_dump,
+ "type conversion to/from bit-precision unsupported.");
+ return false;
+ }
+
/* Check the operands of the operation. */
- if (!vect_is_simple_use_1 (op0, loop_vinfo, NULL,
+ if (!vect_is_simple_use_1 (op0, loop_vinfo, bb_vinfo,
&def_stmt, &def, &dt[0], &vectype_in))
{
if (vect_print_dump_info (REPORT_DETAILS))
fprintf (vect_dump, "use not simple.");
return false;
}
+ if (op_type == binary_op)
+ {
+ bool ok;
+
+ op1 = gimple_assign_rhs2 (stmt);
+ gcc_assert (code == WIDEN_MULT_EXPR || code == WIDEN_LSHIFT_EXPR);
+ /* For WIDEN_MULT_EXPR, if OP0 is a constant, use the type of
+ OP1. */
+ if (CONSTANT_CLASS_P (op0))
+ ok = vect_is_simple_use_1 (op1, loop_vinfo, NULL,
+ &def_stmt, &def, &dt[1], &vectype_in);
+ else
+ ok = vect_is_simple_use (op1, loop_vinfo, NULL, &def_stmt, &def,
+ &dt[1]);
+
+ if (!ok)
+ {
+ if (vect_print_dump_info (REPORT_DETAILS))
+ fprintf (vect_dump, "use not simple.");
+ return false;
+ }
+ }
+
/* If op0 is an external or constant defs use a vector type of
the same size as the output vector type. */
if (!vectype_in)
@@ -1903,82 +2150,222 @@ vectorizable_conversion (gimple stmt, gimple_stmt_iterator *gsi,
if (!vectype_in)
{
if (vect_print_dump_info (REPORT_DETAILS))
- {
- fprintf (vect_dump, "no vectype for scalar type ");
- print_generic_expr (vect_dump, rhs_type, TDF_SLIM);
- }
+ {
+ fprintf (vect_dump, "no vectype for scalar type ");
+ print_generic_expr (vect_dump, rhs_type, TDF_SLIM);
+ }
return false;
}
- /* FORNOW */
nunits_in = TYPE_VECTOR_SUBPARTS (vectype_in);
nunits_out = TYPE_VECTOR_SUBPARTS (vectype_out);
- if (nunits_in == nunits_out / 2)
+ if (nunits_in < nunits_out)
modifier = NARROW;
else if (nunits_out == nunits_in)
modifier = NONE;
- else if (nunits_out == nunits_in / 2)
- modifier = WIDEN;
else
- return false;
-
- if (modifier == NARROW)
- ncopies = LOOP_VINFO_VECT_FACTOR (loop_vinfo) / nunits_out;
- else
- ncopies = LOOP_VINFO_VECT_FACTOR (loop_vinfo) / nunits_in;
+ modifier = WIDEN;
/* Multiple types in SLP are handled by creating the appropriate number of
vectorized stmts for each SLP node. Hence, NCOPIES is always 1 in
case of SLP. */
if (slp_node || PURE_SLP_STMT (stmt_info))
ncopies = 1;
+ else if (modifier == NARROW)
+ ncopies = LOOP_VINFO_VECT_FACTOR (loop_vinfo) / nunits_out;
+ else
+ ncopies = LOOP_VINFO_VECT_FACTOR (loop_vinfo) / nunits_in;
/* Sanity check: make sure that at least one copy of the vectorized stmt
needs to be generated. */
gcc_assert (ncopies >= 1);
/* Supportable by target? */
- if ((modifier == NONE
- && !supportable_convert_operation (code, vectype_out, vectype_in, &decl1, &code1))
- || (modifier == WIDEN
- && !supportable_widening_operation (code, stmt,
- vectype_out, vectype_in,
- &decl1, &decl2,
- &code1, &code2,
- &dummy_int, &dummy))
- || (modifier == NARROW
- && !supportable_narrowing_operation (code, vectype_out, vectype_in,
- &code1, &dummy_int, &dummy)))
+ switch (modifier)
{
+ case NONE:
+ if (code != FIX_TRUNC_EXPR && code != FLOAT_EXPR)
+ return false;
+ if (supportable_convert_operation (code, vectype_out, vectype_in,
+ &decl1, &code1))
+ break;
+ /* FALLTHRU */
+ unsupported:
if (vect_print_dump_info (REPORT_DETAILS))
- fprintf (vect_dump, "conversion not supported by target.");
+ fprintf (vect_dump, "conversion not supported by target.");
return false;
- }
- if (modifier != NONE)
- {
- /* FORNOW: SLP not supported. */
- if (STMT_SLP_TYPE (stmt_info))
- return false;
+ case WIDEN:
+ if (supportable_widening_operation (code, stmt, vectype_out, vectype_in,
+ &decl1, &decl2, &code1, &code2,
+ &multi_step_cvt, &interm_types))
+ {
+ /* Binary widening operation can only be supported directly by the
+ architecture. */
+ gcc_assert (!(multi_step_cvt && op_type == binary_op));
+ break;
+ }
+
+ if (code != FLOAT_EXPR
+ || (GET_MODE_SIZE (TYPE_MODE (lhs_type))
+ <= GET_MODE_SIZE (TYPE_MODE (rhs_type))))
+ goto unsupported;
+
+ rhs_mode = TYPE_MODE (rhs_type);
+ fltsz = GET_MODE_SIZE (TYPE_MODE (lhs_type));
+ for (rhs_mode = GET_MODE_2XWIDER_MODE (TYPE_MODE (rhs_type));
+ rhs_mode != VOIDmode && GET_MODE_SIZE (rhs_mode) <= fltsz;
+ rhs_mode = GET_MODE_2XWIDER_MODE (rhs_mode))
+ {
+ cvt_type
+ = build_nonstandard_integer_type (GET_MODE_BITSIZE (rhs_mode), 0);
+ cvt_type = get_same_sized_vectype (cvt_type, vectype_in);
+ if (cvt_type == NULL_TREE)
+ goto unsupported;
+
+ if (GET_MODE_SIZE (rhs_mode) == fltsz)
+ {
+ if (!supportable_convert_operation (code, vectype_out,
+ cvt_type, &decl1, &codecvt1))
+ goto unsupported;
+ }
+ else if (!supportable_widening_operation (code, stmt, vectype_out,
+ cvt_type, &decl1, &decl2,
+ &codecvt1, &codecvt2,
+ &multi_step_cvt,
+ &interm_types))
+ continue;
+ else
+ gcc_assert (multi_step_cvt == 0);
+
+ if (supportable_widening_operation (NOP_EXPR, stmt, cvt_type,
+ vectype_in, NULL, NULL, &code1,
+ &code2, &multi_step_cvt,
+ &interm_types))
+ break;
+ }
+
+ if (rhs_mode == VOIDmode || GET_MODE_SIZE (rhs_mode) > fltsz)
+ goto unsupported;
+
+ if (GET_MODE_SIZE (rhs_mode) == fltsz)
+ codecvt2 = ERROR_MARK;
+ else
+ {
+ multi_step_cvt++;
+ VEC_safe_push (tree, heap, interm_types, cvt_type);
+ cvt_type = NULL_TREE;
+ }
+ break;
+
+ case NARROW:
+ gcc_assert (op_type == unary_op);
+ if (supportable_narrowing_operation (code, vectype_out, vectype_in,
+ &code1, &multi_step_cvt,
+ &interm_types))
+ break;
+
+ if (code != FIX_TRUNC_EXPR
+ || (GET_MODE_SIZE (TYPE_MODE (lhs_type))
+ >= GET_MODE_SIZE (TYPE_MODE (rhs_type))))
+ goto unsupported;
+
+ rhs_mode = TYPE_MODE (rhs_type);
+ cvt_type
+ = build_nonstandard_integer_type (GET_MODE_BITSIZE (rhs_mode), 0);
+ cvt_type = get_same_sized_vectype (cvt_type, vectype_in);
+ if (cvt_type == NULL_TREE)
+ goto unsupported;
+ if (!supportable_convert_operation (code, cvt_type, vectype_in,
+ &decl1, &codecvt1))
+ goto unsupported;
+ if (supportable_narrowing_operation (NOP_EXPR, vectype_out, cvt_type,
+ &code1, &multi_step_cvt,
+ &interm_types))
+ break;
+ goto unsupported;
+
+ default:
+ gcc_unreachable ();
}
if (!vec_stmt) /* transformation not required. */
{
- STMT_VINFO_TYPE (stmt_info) = type_conversion_vec_info_type;
+ if (vect_print_dump_info (REPORT_DETAILS))
+ fprintf (vect_dump, "=== vectorizable_conversion ===");
+ if (code == FIX_TRUNC_EXPR || code == FLOAT_EXPR)
+ STMT_VINFO_TYPE (stmt_info) = type_conversion_vec_info_type;
+ else if (modifier == NARROW)
+ {
+ STMT_VINFO_TYPE (stmt_info) = type_demotion_vec_info_type;
+ vect_model_simple_cost (stmt_info, ncopies, dt, NULL);
+ }
+ else
+ {
+ STMT_VINFO_TYPE (stmt_info) = type_promotion_vec_info_type;
+ vect_model_simple_cost (stmt_info, 2 * ncopies, dt, NULL);
+ }
+ VEC_free (tree, heap, interm_types);
return true;
}
/** Transform. **/
if (vect_print_dump_info (REPORT_DETAILS))
- fprintf (vect_dump, "transform conversion.");
+ fprintf (vect_dump, "transform conversion. ncopies = %d.", ncopies);
- /* Handle def. */
+ if (op_type == binary_op)
+ {
+ if (CONSTANT_CLASS_P (op0))
+ op0 = fold_convert (TREE_TYPE (op1), op0);
+ else if (CONSTANT_CLASS_P (op1))
+ op1 = fold_convert (TREE_TYPE (op0), op1);
+ }
+
+ /* In case of multi-step conversion, we first generate conversion operations
+ to the intermediate types, and then from that types to the final one.
+ We create vector destinations for the intermediate type (TYPES) received
+ from supportable_*_operation, and store them in the correct order
+ for future use in vect_create_vectorized_*_stmts (). */
+ vec_dsts = VEC_alloc (tree, heap, multi_step_cvt + 1);
vec_dest = vect_create_destination_var (scalar_dest, vectype_out);
+ VEC_quick_push (tree, vec_dsts, vec_dest);
- if (modifier == NONE && !slp_node)
- vec_oprnds0 = VEC_alloc (tree, heap, 1);
+ if (multi_step_cvt)
+ {
+ for (i = VEC_length (tree, interm_types) - 1;
+ VEC_iterate (tree, interm_types, i, intermediate_type); i--)
+ {
+ vec_dest = vect_create_destination_var (scalar_dest,
+ intermediate_type);
+ VEC_quick_push (tree, vec_dsts, vec_dest);
+ }
+ }
+
+ if (cvt_type)
+ vec_dest = vect_create_destination_var (scalar_dest, cvt_type);
+
+ if (!slp_node)
+ {
+ if (modifier == NONE)
+ vec_oprnds0 = VEC_alloc (tree, heap, 1);
+ else if (modifier == WIDEN)
+ {
+ vec_oprnds0 = VEC_alloc (tree, heap,
+ (multi_step_cvt
+ ? vect_pow2 (multi_step_cvt) : 1));
+ if (op_type == binary_op)
+ vec_oprnds1 = VEC_alloc (tree, heap, 1);
+ }
+ else
+ vec_oprnds0 = VEC_alloc (tree, heap,
+ 2 * (multi_step_cvt
+ ? vect_pow2 (multi_step_cvt) : 1));
+ }
+ else if (code == WIDEN_LSHIFT_EXPR)
+ vec_oprnds1 = VEC_alloc (tree, heap, slp_node->vec_stmts_size);
+ last_oprnd = op0;
prev_stmt_info = NULL;
switch (modifier)
{
@@ -1986,32 +2373,34 @@ vectorizable_conversion (gimple stmt, gimple_stmt_iterator *gsi,
for (j = 0; j < ncopies; j++)
{
if (j == 0)
- vect_get_vec_defs (op0, NULL, stmt, &vec_oprnds0, NULL, slp_node);
+ vect_get_vec_defs (op0, NULL, stmt, &vec_oprnds0, NULL, slp_node,
+ -1);
else
vect_get_vec_defs_for_stmt_copy (dt, &vec_oprnds0, NULL);
FOR_EACH_VEC_ELT (tree, vec_oprnds0, i, vop0)
- {
- /* Arguments are ready, create the new vector stmt. */
- if (code1 == CALL_EXPR)
- {
- new_stmt = gimple_build_call (decl1, 1, vop0);
- new_temp = make_ssa_name (vec_dest, new_stmt);
- gimple_call_set_lhs (new_stmt, new_temp);
- }
- else
- {
- gcc_assert (TREE_CODE_LENGTH (code) == unary_op);
- new_stmt = gimple_build_assign_with_ops (code, vec_dest, vop0,
- NULL);
- new_temp = make_ssa_name (vec_dest, new_stmt);
- gimple_assign_set_lhs (new_stmt, new_temp);
- }
+ {
+ /* Arguments are ready, create the new vector stmt. */
+ if (code1 == CALL_EXPR)
+ {
+ new_stmt = gimple_build_call (decl1, 1, vop0);
+ new_temp = make_ssa_name (vec_dest, new_stmt);
+ gimple_call_set_lhs (new_stmt, new_temp);
+ }
+ else
+ {
+ gcc_assert (TREE_CODE_LENGTH (code1) == unary_op);
+ new_stmt = gimple_build_assign_with_ops (code1, vec_dest,
+ vop0, NULL);
+ new_temp = make_ssa_name (vec_dest, new_stmt);
+ gimple_assign_set_lhs (new_stmt, new_temp);
+ }
- vect_finish_stmt_generation (stmt, new_stmt, gsi);
- if (slp_node)
- VEC_quick_push (gimple, SLP_TREE_VEC_STMTS (slp_node), new_stmt);
- }
+ vect_finish_stmt_generation (stmt, new_stmt, gsi);
+ if (slp_node)
+ VEC_quick_push (gimple, SLP_TREE_VEC_STMTS (slp_node),
+ new_stmt);
+ }
if (j == 0)
STMT_VINFO_VEC_STMT (stmt_info) = *vec_stmt = new_stmt;
@@ -2028,30 +2417,117 @@ vectorizable_conversion (gimple stmt, gimple_stmt_iterator *gsi,
the vector stmt by a factor VF/nunits. */
for (j = 0; j < ncopies; j++)
{
+ /* Handle uses. */
if (j == 0)
- vec_oprnd0 = vect_get_vec_def_for_operand (op0, stmt, NULL);
- else
- vec_oprnd0 = vect_get_vec_def_for_stmt_copy (dt[0], vec_oprnd0);
+ {
+ if (slp_node)
+ {
+ if (code == WIDEN_LSHIFT_EXPR)
+ {
+ unsigned int k;
- /* Generate first half of the widened result: */
- new_stmt
- = vect_gen_widened_results_half (code1, decl1,
- vec_oprnd0, vec_oprnd1,
- unary_op, vec_dest, gsi, stmt);
- if (j == 0)
- STMT_VINFO_VEC_STMT (stmt_info) = new_stmt;
+ vec_oprnd1 = op1;
+ /* Store vec_oprnd1 for every vector stmt to be created
+ for SLP_NODE. We check during the analysis that all
+ the shift arguments are the same. */
+ for (k = 0; k < slp_node->vec_stmts_size - 1; k++)
+ VEC_quick_push (tree, vec_oprnds1, vec_oprnd1);
+
+ vect_get_vec_defs (op0, NULL_TREE, stmt, &vec_oprnds0, NULL,
+ slp_node, -1);
+ }
+ else
+ vect_get_vec_defs (op0, op1, stmt, &vec_oprnds0,
+ &vec_oprnds1, slp_node, -1);
+ }
+ else
+ {
+ vec_oprnd0 = vect_get_vec_def_for_operand (op0, stmt, NULL);
+ VEC_quick_push (tree, vec_oprnds0, vec_oprnd0);
+ if (op_type == binary_op)
+ {
+ if (code == WIDEN_LSHIFT_EXPR)
+ vec_oprnd1 = op1;
+ else
+ vec_oprnd1 = vect_get_vec_def_for_operand (op1, stmt,
+ NULL);
+ VEC_quick_push (tree, vec_oprnds1, vec_oprnd1);
+ }
+ }
+ }
else
- STMT_VINFO_RELATED_STMT (prev_stmt_info) = new_stmt;
- prev_stmt_info = vinfo_for_stmt (new_stmt);
+ {
+ vec_oprnd0 = vect_get_vec_def_for_stmt_copy (dt[0], vec_oprnd0);
+ VEC_truncate (tree, vec_oprnds0, 0);
+ VEC_quick_push (tree, vec_oprnds0, vec_oprnd0);
+ if (op_type == binary_op)
+ {
+ if (code == WIDEN_LSHIFT_EXPR)
+ vec_oprnd1 = op1;
+ else
+ vec_oprnd1 = vect_get_vec_def_for_stmt_copy (dt[1],
+ vec_oprnd1);
+ VEC_truncate (tree, vec_oprnds1, 0);
+ VEC_quick_push (tree, vec_oprnds1, vec_oprnd1);
+ }
+ }
- /* Generate second half of the widened result: */
- new_stmt
- = vect_gen_widened_results_half (code2, decl2,
- vec_oprnd0, vec_oprnd1,
- unary_op, vec_dest, gsi, stmt);
- STMT_VINFO_RELATED_STMT (prev_stmt_info) = new_stmt;
- prev_stmt_info = vinfo_for_stmt (new_stmt);
+ /* Arguments are ready. Create the new vector stmts. */
+ for (i = multi_step_cvt; i >= 0; i--)
+ {
+ tree this_dest = VEC_index (tree, vec_dsts, i);
+ enum tree_code c1 = code1, c2 = code2;
+ if (i == 0 && codecvt2 != ERROR_MARK)
+ {
+ c1 = codecvt1;
+ c2 = codecvt2;
+ }
+ vect_create_vectorized_promotion_stmts (&vec_oprnds0,
+ &vec_oprnds1,
+ stmt, this_dest, gsi,
+ c1, c2, decl1, decl2,
+ op_type);
+ }
+
+ FOR_EACH_VEC_ELT (tree, vec_oprnds0, i, vop0)
+ {
+ if (cvt_type)
+ {
+ if (codecvt1 == CALL_EXPR)
+ {
+ new_stmt = gimple_build_call (decl1, 1, vop0);
+ new_temp = make_ssa_name (vec_dest, new_stmt);
+ gimple_call_set_lhs (new_stmt, new_temp);
+ }
+ else
+ {
+ gcc_assert (TREE_CODE_LENGTH (codecvt1) == unary_op);
+ new_temp = make_ssa_name (vec_dest, NULL);
+ new_stmt = gimple_build_assign_with_ops (codecvt1,
+ new_temp,
+ vop0, NULL);
+ }
+
+ vect_finish_stmt_generation (stmt, new_stmt, gsi);
+ }
+ else
+ new_stmt = SSA_NAME_DEF_STMT (vop0);
+
+ if (slp_node)
+ VEC_quick_push (gimple, SLP_TREE_VEC_STMTS (slp_node),
+ new_stmt);
+ else
+ {
+ if (!prev_stmt_info)
+ STMT_VINFO_VEC_STMT (stmt_info) = new_stmt;
+ else
+ STMT_VINFO_RELATED_STMT (prev_stmt_info) = new_stmt;
+ prev_stmt_info = vinfo_for_stmt (new_stmt);
+ }
+ }
}
+
+ *vec_stmt = STMT_VINFO_VEC_STMT (stmt_info);
break;
case NARROW:
@@ -2062,37 +2538,52 @@ vectorizable_conversion (gimple stmt, gimple_stmt_iterator *gsi,
for (j = 0; j < ncopies; j++)
{
/* Handle uses. */
- if (j == 0)
- {
- vec_oprnd0 = vect_get_vec_def_for_operand (op0, stmt, NULL);
- vec_oprnd1 = vect_get_vec_def_for_stmt_copy (dt[0], vec_oprnd0);
- }
+ if (slp_node)
+ vect_get_vec_defs (op0, NULL_TREE, stmt, &vec_oprnds0, NULL,
+ slp_node, -1);
else
{
- vec_oprnd0 = vect_get_vec_def_for_stmt_copy (dt[0], vec_oprnd1);
- vec_oprnd1 = vect_get_vec_def_for_stmt_copy (dt[0], vec_oprnd0);
+ VEC_truncate (tree, vec_oprnds0, 0);
+ vect_get_loop_based_defs (&last_oprnd, stmt, dt[0], &vec_oprnds0,
+ vect_pow2 (multi_step_cvt) - 1);
}
- /* Arguments are ready. Create the new vector stmt. */
- new_stmt = gimple_build_assign_with_ops (code1, vec_dest, vec_oprnd0,
- vec_oprnd1);
- new_temp = make_ssa_name (vec_dest, new_stmt);
- gimple_assign_set_lhs (new_stmt, new_temp);
- vect_finish_stmt_generation (stmt, new_stmt, gsi);
+ /* Arguments are ready. Create the new vector stmts. */
+ if (cvt_type)
+ FOR_EACH_VEC_ELT (tree, vec_oprnds0, i, vop0)
+ {
+ if (codecvt1 == CALL_EXPR)
+ {
+ new_stmt = gimple_build_call (decl1, 1, vop0);
+ new_temp = make_ssa_name (vec_dest, new_stmt);
+ gimple_call_set_lhs (new_stmt, new_temp);
+ }
+ else
+ {
+ gcc_assert (TREE_CODE_LENGTH (codecvt1) == unary_op);
+ new_temp = make_ssa_name (vec_dest, NULL);
+ new_stmt = gimple_build_assign_with_ops (codecvt1, new_temp,
+ vop0, NULL);
+ }
- if (j == 0)
- STMT_VINFO_VEC_STMT (stmt_info) = new_stmt;
- else
- STMT_VINFO_RELATED_STMT (prev_stmt_info) = new_stmt;
+ vect_finish_stmt_generation (stmt, new_stmt, gsi);
+ VEC_replace (tree, vec_oprnds0, i, new_temp);
+ }
- prev_stmt_info = vinfo_for_stmt (new_stmt);
+ vect_create_vectorized_demotion_stmts (&vec_oprnds0, multi_step_cvt,
+ stmt, vec_dsts, gsi,
+ slp_node, code1,
+ &prev_stmt_info);
}
*vec_stmt = STMT_VINFO_VEC_STMT (stmt_info);
+ break;
}
- if (vec_oprnds0)
- VEC_free (tree, heap, vec_oprnds0);
+ VEC_free (tree, heap, vec_oprnds0);
+ VEC_free (tree, heap, vec_oprnds1);
+ VEC_free (tree, heap, vec_dsts);
+ VEC_free (tree, heap, interm_types);
return true;
}
@@ -2223,7 +2714,7 @@ vectorizable_assignment (gimple stmt, gimple_stmt_iterator *gsi,
{
/* Handle uses. */
if (j == 0)
- vect_get_vec_defs (op, NULL, stmt, &vec_oprnds, NULL, slp_node);
+ vect_get_vec_defs (op, NULL, stmt, &vec_oprnds, NULL, slp_node, -1);
else
vect_get_vec_defs_for_stmt_copy (dt, &vec_oprnds, NULL);
@@ -2617,10 +3108,10 @@ vectorizable_shift (gimple stmt, gimple_stmt_iterator *gsi,
operand 1 should be of a vector type (the usual case). */
if (vec_oprnd1)
vect_get_vec_defs (op0, NULL_TREE, stmt, &vec_oprnds0, NULL,
- slp_node);
+ slp_node, -1);
else
vect_get_vec_defs (op0, op1, stmt, &vec_oprnds0, &vec_oprnds1,
- slp_node);
+ slp_node, -1);
}
else
vect_get_vec_defs_for_stmt_copy (dt, &vec_oprnds0, &vec_oprnds1);
@@ -2942,10 +3433,10 @@ vectorizable_operation (gimple stmt, gimple_stmt_iterator *gsi,
{
if (op_type == binary_op || op_type == ternary_op)
vect_get_vec_defs (op0, op1, stmt, &vec_oprnds0, &vec_oprnds1,
- slp_node);
+ slp_node, -1);
else
vect_get_vec_defs (op0, NULL_TREE, stmt, &vec_oprnds0, NULL,
- slp_node);
+ slp_node, -1);
if (op_type == ternary_op)
{
vec_oprnds2 = VEC_alloc (tree, heap, 1);
@@ -3001,688 +3492,6 @@ vectorizable_operation (gimple stmt, gimple_stmt_iterator *gsi,
}
-/* Get vectorized definitions for loop-based vectorization. For the first
- operand we call vect_get_vec_def_for_operand() (with OPRND containing
- scalar operand), and for the rest we get a copy with
- vect_get_vec_def_for_stmt_copy() using the previous vector definition
- (stored in OPRND). See vect_get_vec_def_for_stmt_copy() for details.
- The vectors are collected into VEC_OPRNDS. */
-
-static void
-vect_get_loop_based_defs (tree *oprnd, gimple stmt, enum vect_def_type dt,
- VEC (tree, heap) **vec_oprnds, int multi_step_cvt)
-{
- tree vec_oprnd;
-
- /* Get first vector operand. */
- /* All the vector operands except the very first one (that is scalar oprnd)
- are stmt copies. */
- if (TREE_CODE (TREE_TYPE (*oprnd)) != VECTOR_TYPE)
- vec_oprnd = vect_get_vec_def_for_operand (*oprnd, stmt, NULL);
- else
- vec_oprnd = vect_get_vec_def_for_stmt_copy (dt, *oprnd);
-
- VEC_quick_push (tree, *vec_oprnds, vec_oprnd);
-
- /* Get second vector operand. */
- vec_oprnd = vect_get_vec_def_for_stmt_copy (dt, vec_oprnd);
- VEC_quick_push (tree, *vec_oprnds, vec_oprnd);
-
- *oprnd = vec_oprnd;
-
- /* For conversion in multiple steps, continue to get operands
- recursively. */
- if (multi_step_cvt)
- vect_get_loop_based_defs (oprnd, stmt, dt, vec_oprnds, multi_step_cvt - 1);
-}
-
-
-/* Create vectorized demotion statements for vector operands from VEC_OPRNDS.
- For multi-step conversions store the resulting vectors and call the function
- recursively. */
-
-static void
-vect_create_vectorized_demotion_stmts (VEC (tree, heap) **vec_oprnds,
- int multi_step_cvt, gimple stmt,
- VEC (tree, heap) *vec_dsts,
- gimple_stmt_iterator *gsi,
- slp_tree slp_node, enum tree_code code,
- stmt_vec_info *prev_stmt_info)
-{
- unsigned int i;
- tree vop0, vop1, new_tmp, vec_dest;
- gimple new_stmt;
- stmt_vec_info stmt_info = vinfo_for_stmt (stmt);
-
- vec_dest = VEC_pop (tree, vec_dsts);
-
- for (i = 0; i < VEC_length (tree, *vec_oprnds); i += 2)
- {
- /* Create demotion operation. */
- vop0 = VEC_index (tree, *vec_oprnds, i);
- vop1 = VEC_index (tree, *vec_oprnds, i + 1);
- new_stmt = gimple_build_assign_with_ops (code, vec_dest, vop0, vop1);
- new_tmp = make_ssa_name (vec_dest, new_stmt);
- gimple_assign_set_lhs (new_stmt, new_tmp);
- vect_finish_stmt_generation (stmt, new_stmt, gsi);
-
- if (multi_step_cvt)
- /* Store the resulting vector for next recursive call. */
- VEC_replace (tree, *vec_oprnds, i/2, new_tmp);
- else
- {
- /* This is the last step of the conversion sequence. Store the
- vectors in SLP_NODE or in vector info of the scalar statement
- (or in STMT_VINFO_RELATED_STMT chain). */
- if (slp_node)
- VEC_quick_push (gimple, SLP_TREE_VEC_STMTS (slp_node), new_stmt);
- else
- {
- if (!*prev_stmt_info)
- STMT_VINFO_VEC_STMT (stmt_info) = new_stmt;
- else
- STMT_VINFO_RELATED_STMT (*prev_stmt_info) = new_stmt;
-
- *prev_stmt_info = vinfo_for_stmt (new_stmt);
- }
- }
- }
-
- /* For multi-step demotion operations we first generate demotion operations
- from the source type to the intermediate types, and then combine the
- results (stored in VEC_OPRNDS) in demotion operation to the destination
- type. */
- if (multi_step_cvt)
- {
- /* At each level of recursion we have have of the operands we had at the
- previous level. */
- VEC_truncate (tree, *vec_oprnds, (i+1)/2);
- vect_create_vectorized_demotion_stmts (vec_oprnds, multi_step_cvt - 1,
- stmt, vec_dsts, gsi, slp_node,
- code, prev_stmt_info);
- }
-}
-
-
-/* Function vectorizable_type_demotion
-
- Check if STMT performs a binary or unary operation that involves
- type demotion, and if it can be vectorized.
- If VEC_STMT is also passed, vectorize the STMT: create a vectorized
- stmt to replace it, put it in VEC_STMT, and insert it at BSI.
- Return FALSE if not a vectorizable STMT, TRUE otherwise. */
-
-static bool
-vectorizable_type_demotion (gimple stmt, gimple_stmt_iterator *gsi,
- gimple *vec_stmt, slp_tree slp_node)
-{
- tree vec_dest;
- tree scalar_dest;
- tree op0;
- stmt_vec_info stmt_info = vinfo_for_stmt (stmt);
- loop_vec_info loop_vinfo = STMT_VINFO_LOOP_VINFO (stmt_info);
- enum tree_code code, code1 = ERROR_MARK;
- tree def;
- gimple def_stmt;
- enum vect_def_type dt[2] = {vect_unknown_def_type, vect_unknown_def_type};
- stmt_vec_info prev_stmt_info;
- int nunits_in;
- int nunits_out;
- tree vectype_out;
- int ncopies;
- int j, i;
- tree vectype_in;
- int multi_step_cvt = 0;
- VEC (tree, heap) *vec_oprnds0 = NULL;
- VEC (tree, heap) *vec_dsts = NULL, *interm_types = NULL, *tmp_vec_dsts = NULL;
- tree last_oprnd, intermediate_type;
- bb_vec_info bb_vinfo = STMT_VINFO_BB_VINFO (stmt_info);
-
- if (!STMT_VINFO_RELEVANT_P (stmt_info) && !bb_vinfo)
- return false;
-
- if (STMT_VINFO_DEF_TYPE (stmt_info) != vect_internal_def)
- return false;
-
- /* Is STMT a vectorizable type-demotion operation? */
- if (!is_gimple_assign (stmt))
- return false;
-
- if (TREE_CODE (gimple_assign_lhs (stmt)) != SSA_NAME)
- return false;
-
- code = gimple_assign_rhs_code (stmt);
- if (!CONVERT_EXPR_CODE_P (code))
- return false;
-
- scalar_dest = gimple_assign_lhs (stmt);
- vectype_out = STMT_VINFO_VECTYPE (stmt_info);
-
- /* Check the operands of the operation. */
- op0 = gimple_assign_rhs1 (stmt);
- if (! ((INTEGRAL_TYPE_P (TREE_TYPE (scalar_dest))
- && INTEGRAL_TYPE_P (TREE_TYPE (op0)))
- || (SCALAR_FLOAT_TYPE_P (TREE_TYPE (scalar_dest))
- && SCALAR_FLOAT_TYPE_P (TREE_TYPE (op0)))))
- return false;
-
- if (INTEGRAL_TYPE_P (TREE_TYPE (scalar_dest))
- && ((TYPE_PRECISION (TREE_TYPE (scalar_dest))
- != GET_MODE_PRECISION (TYPE_MODE (TREE_TYPE (scalar_dest))))
- || ((TYPE_PRECISION (TREE_TYPE (op0))
- != GET_MODE_PRECISION (TYPE_MODE (TREE_TYPE (op0)))))))
- {
- if (vect_print_dump_info (REPORT_DETAILS))
- fprintf (vect_dump, "type demotion to/from bit-precision unsupported.");
- return false;
- }
-
- if (!vect_is_simple_use_1 (op0, loop_vinfo, bb_vinfo,
- &def_stmt, &def, &dt[0], &vectype_in))
- {
- if (vect_print_dump_info (REPORT_DETAILS))
- fprintf (vect_dump, "use not simple.");
- return false;
- }
- /* If op0 is an external def use a vector type with the
- same size as the output vector type if possible. */
- if (!vectype_in)
- vectype_in = get_same_sized_vectype (TREE_TYPE (op0), vectype_out);
- if (vec_stmt)
- gcc_assert (vectype_in);
- if (!vectype_in)
- {
- if (vect_print_dump_info (REPORT_DETAILS))
- {
- fprintf (vect_dump, "no vectype for scalar type ");
- print_generic_expr (vect_dump, TREE_TYPE (op0), TDF_SLIM);
- }
-
- return false;
- }
-
- nunits_in = TYPE_VECTOR_SUBPARTS (vectype_in);
- nunits_out = TYPE_VECTOR_SUBPARTS (vectype_out);
- if (nunits_in >= nunits_out)
- return false;
-
- /* Multiple types in SLP are handled by creating the appropriate number of
- vectorized stmts for each SLP node. Hence, NCOPIES is always 1 in
- case of SLP. */
- if (slp_node || PURE_SLP_STMT (stmt_info))
- ncopies = 1;
- else
- ncopies = LOOP_VINFO_VECT_FACTOR (loop_vinfo) / nunits_out;
- gcc_assert (ncopies >= 1);
-
- /* Supportable by target? */
- if (!supportable_narrowing_operation (code, vectype_out, vectype_in,
- &code1, &multi_step_cvt, &interm_types))
- return false;
-
- if (!vec_stmt) /* transformation not required. */
- {
- STMT_VINFO_TYPE (stmt_info) = type_demotion_vec_info_type;
- if (vect_print_dump_info (REPORT_DETAILS))
- fprintf (vect_dump, "=== vectorizable_demotion ===");
- vect_model_simple_cost (stmt_info, ncopies, dt, NULL);
- return true;
- }
-
- /** Transform. **/
- if (vect_print_dump_info (REPORT_DETAILS))
- fprintf (vect_dump, "transform type demotion operation. ncopies = %d.",
- ncopies);
-
- /* In case of multi-step demotion, we first generate demotion operations to
- the intermediate types, and then from that types to the final one.
- We create vector destinations for the intermediate type (TYPES) received
- from supportable_narrowing_operation, and store them in the correct order
- for future use in vect_create_vectorized_demotion_stmts(). */
- if (multi_step_cvt)
- vec_dsts = VEC_alloc (tree, heap, multi_step_cvt + 1);
- else
- vec_dsts = VEC_alloc (tree, heap, 1);
-
- vec_dest = vect_create_destination_var (scalar_dest, vectype_out);
- VEC_quick_push (tree, vec_dsts, vec_dest);
-
- if (multi_step_cvt)
- {
- for (i = VEC_length (tree, interm_types) - 1;
- VEC_iterate (tree, interm_types, i, intermediate_type); i--)
- {
- vec_dest = vect_create_destination_var (scalar_dest,
- intermediate_type);
- VEC_quick_push (tree, vec_dsts, vec_dest);
- }
- }
-
- /* In case the vectorization factor (VF) is bigger than the number
- of elements that we can fit in a vectype (nunits), we have to generate
- more than one vector stmt - i.e - we need to "unroll" the
- vector stmt by a factor VF/nunits. */
- last_oprnd = op0;
- prev_stmt_info = NULL;
- for (j = 0; j < ncopies; j++)
- {
- /* Handle uses. */
- if (slp_node)
- vect_get_slp_defs (op0, NULL_TREE, slp_node, &vec_oprnds0, NULL, -1);
- else
- {
- VEC_free (tree, heap, vec_oprnds0);
- vec_oprnds0 = VEC_alloc (tree, heap,
- (multi_step_cvt ? vect_pow2 (multi_step_cvt) * 2 : 2));
- vect_get_loop_based_defs (&last_oprnd, stmt, dt[0], &vec_oprnds0,
- vect_pow2 (multi_step_cvt) - 1);
- }
-
- /* Arguments are ready. Create the new vector stmts. */
- tmp_vec_dsts = VEC_copy (tree, heap, vec_dsts);
- vect_create_vectorized_demotion_stmts (&vec_oprnds0,
- multi_step_cvt, stmt, tmp_vec_dsts,
- gsi, slp_node, code1,
- &prev_stmt_info);
- }
-
- VEC_free (tree, heap, vec_oprnds0);
- VEC_free (tree, heap, vec_dsts);
- VEC_free (tree, heap, tmp_vec_dsts);
- VEC_free (tree, heap, interm_types);
-
- *vec_stmt = STMT_VINFO_VEC_STMT (stmt_info);
- return true;
-}
-
-
-/* Create vectorized promotion statements for vector operands from VEC_OPRNDS0
- and VEC_OPRNDS1 (for binary operations). For multi-step conversions store
- the resulting vectors and call the function recursively. */
-
-static void
-vect_create_vectorized_promotion_stmts (VEC (tree, heap) **vec_oprnds0,
- VEC (tree, heap) **vec_oprnds1,
- int multi_step_cvt, gimple stmt,
- VEC (tree, heap) *vec_dsts,
- gimple_stmt_iterator *gsi,
- slp_tree slp_node, enum tree_code code1,
- enum tree_code code2, tree decl1,
- tree decl2, int op_type,
- stmt_vec_info *prev_stmt_info)
-{
- int i;
- tree vop0, vop1, new_tmp1, new_tmp2, vec_dest;
- gimple new_stmt1, new_stmt2;
- stmt_vec_info stmt_info = vinfo_for_stmt (stmt);
- VEC (tree, heap) *vec_tmp;
-
- vec_dest = VEC_pop (tree, vec_dsts);
- vec_tmp = VEC_alloc (tree, heap, VEC_length (tree, *vec_oprnds0) * 2);
-
- FOR_EACH_VEC_ELT (tree, *vec_oprnds0, i, vop0)
- {
- if (op_type == binary_op)
- vop1 = VEC_index (tree, *vec_oprnds1, i);
- else
- vop1 = NULL_TREE;
-
- /* Generate the two halves of promotion operation. */
- new_stmt1 = vect_gen_widened_results_half (code1, decl1, vop0, vop1,
- op_type, vec_dest, gsi, stmt);
- new_stmt2 = vect_gen_widened_results_half (code2, decl2, vop0, vop1,
- op_type, vec_dest, gsi, stmt);
- if (is_gimple_call (new_stmt1))
- {
- new_tmp1 = gimple_call_lhs (new_stmt1);
- new_tmp2 = gimple_call_lhs (new_stmt2);
- }
- else
- {
- new_tmp1 = gimple_assign_lhs (new_stmt1);
- new_tmp2 = gimple_assign_lhs (new_stmt2);
- }
-
- if (multi_step_cvt)
- {
- /* Store the results for the recursive call. */
- VEC_quick_push (tree, vec_tmp, new_tmp1);
- VEC_quick_push (tree, vec_tmp, new_tmp2);
- }
- else
- {
- /* Last step of promotion sequience - store the results. */
- if (slp_node)
- {
- VEC_quick_push (gimple, SLP_TREE_VEC_STMTS (slp_node), new_stmt1);
- VEC_quick_push (gimple, SLP_TREE_VEC_STMTS (slp_node), new_stmt2);
- }
- else
- {
- if (!*prev_stmt_info)
- STMT_VINFO_VEC_STMT (stmt_info) = new_stmt1;
- else
- STMT_VINFO_RELATED_STMT (*prev_stmt_info) = new_stmt1;
-
- *prev_stmt_info = vinfo_for_stmt (new_stmt1);
- STMT_VINFO_RELATED_STMT (*prev_stmt_info) = new_stmt2;
- *prev_stmt_info = vinfo_for_stmt (new_stmt2);
- }
- }
- }
-
- if (multi_step_cvt)
- {
- /* For multi-step promotion operation we first generate we call the
- function recurcively for every stage. We start from the input type,
- create promotion operations to the intermediate types, and then
- create promotions to the output type. */
- *vec_oprnds0 = VEC_copy (tree, heap, vec_tmp);
- vect_create_vectorized_promotion_stmts (vec_oprnds0, vec_oprnds1,
- multi_step_cvt - 1, stmt,
- vec_dsts, gsi, slp_node, code1,
- code2, decl2, decl2, op_type,
- prev_stmt_info);
- }
-
- VEC_free (tree, heap, vec_tmp);
-}
-
-
-/* Function vectorizable_type_promotion
-
- Check if STMT performs a binary or unary operation that involves
- type promotion, and if it can be vectorized.
- If VEC_STMT is also passed, vectorize the STMT: create a vectorized
- stmt to replace it, put it in VEC_STMT, and insert it at BSI.
- Return FALSE if not a vectorizable STMT, TRUE otherwise. */
-
-static bool
-vectorizable_type_promotion (gimple stmt, gimple_stmt_iterator *gsi,
- gimple *vec_stmt, slp_tree slp_node)
-{
- tree vec_dest;
- tree scalar_dest;
- tree op0, op1 = NULL;
- tree vec_oprnd0=NULL, vec_oprnd1=NULL;
- stmt_vec_info stmt_info = vinfo_for_stmt (stmt);
- loop_vec_info loop_vinfo = STMT_VINFO_LOOP_VINFO (stmt_info);
- enum tree_code code, code1 = ERROR_MARK, code2 = ERROR_MARK;
- tree decl1 = NULL_TREE, decl2 = NULL_TREE;
- int op_type;
- tree def;
- gimple def_stmt;
- enum vect_def_type dt[2] = {vect_unknown_def_type, vect_unknown_def_type};
- stmt_vec_info prev_stmt_info;
- int nunits_in;
- int nunits_out;
- tree vectype_out;
- int ncopies;
- int j, i;
- tree vectype_in;
- tree intermediate_type = NULL_TREE;
- int multi_step_cvt = 0;
- VEC (tree, heap) *vec_oprnds0 = NULL, *vec_oprnds1 = NULL;
- VEC (tree, heap) *vec_dsts = NULL, *interm_types = NULL, *tmp_vec_dsts = NULL;
- bb_vec_info bb_vinfo = STMT_VINFO_BB_VINFO (stmt_info);
- unsigned int k;
-
- if (!STMT_VINFO_RELEVANT_P (stmt_info) && !bb_vinfo)
- return false;
-
- if (STMT_VINFO_DEF_TYPE (stmt_info) != vect_internal_def)
- return false;
-
- /* Is STMT a vectorizable type-promotion operation? */
- if (!is_gimple_assign (stmt))
- return false;
-
- if (TREE_CODE (gimple_assign_lhs (stmt)) != SSA_NAME)
- return false;
-
- code = gimple_assign_rhs_code (stmt);
- if (!CONVERT_EXPR_CODE_P (code)
- && code != WIDEN_MULT_EXPR
- && code != WIDEN_LSHIFT_EXPR)
- return false;
-
- scalar_dest = gimple_assign_lhs (stmt);
- vectype_out = STMT_VINFO_VECTYPE (stmt_info);
-
- /* Check the operands of the operation. */
- op0 = gimple_assign_rhs1 (stmt);
- if (! ((INTEGRAL_TYPE_P (TREE_TYPE (scalar_dest))
- && INTEGRAL_TYPE_P (TREE_TYPE (op0)))
- || (SCALAR_FLOAT_TYPE_P (TREE_TYPE (scalar_dest))
- && SCALAR_FLOAT_TYPE_P (TREE_TYPE (op0))
- && CONVERT_EXPR_CODE_P (code))))
- return false;
-
- if (INTEGRAL_TYPE_P (TREE_TYPE (scalar_dest))
- && ((TYPE_PRECISION (TREE_TYPE (scalar_dest))
- != GET_MODE_PRECISION (TYPE_MODE (TREE_TYPE (scalar_dest))))
- || ((TYPE_PRECISION (TREE_TYPE (op0))
- != GET_MODE_PRECISION (TYPE_MODE (TREE_TYPE (op0)))))))
- {
- if (vect_print_dump_info (REPORT_DETAILS))
- fprintf (vect_dump, "type promotion to/from bit-precision "
- "unsupported.");
- return false;
- }
-
- if (!vect_is_simple_use_1 (op0, loop_vinfo, bb_vinfo,
- &def_stmt, &def, &dt[0], &vectype_in))
- {
- if (vect_print_dump_info (REPORT_DETAILS))
- fprintf (vect_dump, "use not simple.");
- return false;
- }
-
- op_type = TREE_CODE_LENGTH (code);
- if (op_type == binary_op)
- {
- bool ok;
-
- op1 = gimple_assign_rhs2 (stmt);
- if (code == WIDEN_MULT_EXPR || code == WIDEN_LSHIFT_EXPR)
- {
- /* For WIDEN_MULT_EXPR, if OP0 is a constant, use the type of
- OP1. */
- if (CONSTANT_CLASS_P (op0))
- ok = vect_is_simple_use_1 (op1, loop_vinfo, NULL,
- &def_stmt, &def, &dt[1], &vectype_in);
- else
- ok = vect_is_simple_use (op1, loop_vinfo, NULL, &def_stmt, &def,
- &dt[1]);
-
- if (!ok)
- {
- if (vect_print_dump_info (REPORT_DETAILS))
- fprintf (vect_dump, "use not simple.");
- return false;
- }
- }
- }
-
- /* If op0 is an external or constant def use a vector type with
- the same size as the output vector type. */
- if (!vectype_in)
- vectype_in = get_same_sized_vectype (TREE_TYPE (op0), vectype_out);
- if (vec_stmt)
- gcc_assert (vectype_in);
- if (!vectype_in)
- {
- if (vect_print_dump_info (REPORT_DETAILS))
- {
- fprintf (vect_dump, "no vectype for scalar type ");
- print_generic_expr (vect_dump, TREE_TYPE (op0), TDF_SLIM);
- }
-
- return false;
- }
-
- nunits_in = TYPE_VECTOR_SUBPARTS (vectype_in);
- nunits_out = TYPE_VECTOR_SUBPARTS (vectype_out);
- if (nunits_in <= nunits_out)
- return false;
-
- /* Multiple types in SLP are handled by creating the appropriate number of
- vectorized stmts for each SLP node. Hence, NCOPIES is always 1 in
- case of SLP. */
- if (slp_node || PURE_SLP_STMT (stmt_info))
- ncopies = 1;
- else
- ncopies = LOOP_VINFO_VECT_FACTOR (loop_vinfo) / nunits_in;
-
- gcc_assert (ncopies >= 1);
-
- /* Supportable by target? */
- if (!supportable_widening_operation (code, stmt, vectype_out, vectype_in,
- &decl1, &decl2, &code1, &code2,
- &multi_step_cvt, &interm_types))
- return false;
-
- /* Binary widening operation can only be supported directly by the
- architecture. */
- gcc_assert (!(multi_step_cvt && op_type == binary_op));
-
- if (!vec_stmt) /* transformation not required. */
- {
- STMT_VINFO_TYPE (stmt_info) = type_promotion_vec_info_type;
- if (vect_print_dump_info (REPORT_DETAILS))
- fprintf (vect_dump, "=== vectorizable_promotion ===");
- vect_model_simple_cost (stmt_info, 2*ncopies, dt, NULL);
- return true;
- }
-
- /** Transform. **/
-
- if (vect_print_dump_info (REPORT_DETAILS))
- fprintf (vect_dump, "transform type promotion operation. ncopies = %d.",
- ncopies);
-
- if (code == WIDEN_MULT_EXPR || code == WIDEN_LSHIFT_EXPR)
- {
- if (CONSTANT_CLASS_P (op0))
- op0 = fold_convert (TREE_TYPE (op1), op0);
- else if (CONSTANT_CLASS_P (op1))
- op1 = fold_convert (TREE_TYPE (op0), op1);
- }
-
- /* Handle def. */
- /* In case of multi-step promotion, we first generate promotion operations
- to the intermediate types, and then from that types to the final one.
- We store vector destination in VEC_DSTS in the correct order for
- recursive creation of promotion operations in
- vect_create_vectorized_promotion_stmts(). Vector destinations are created
- according to TYPES recieved from supportable_widening_operation(). */
- if (multi_step_cvt)
- vec_dsts = VEC_alloc (tree, heap, multi_step_cvt + 1);
- else
- vec_dsts = VEC_alloc (tree, heap, 1);
-
- vec_dest = vect_create_destination_var (scalar_dest, vectype_out);
- VEC_quick_push (tree, vec_dsts, vec_dest);
-
- if (multi_step_cvt)
- {
- for (i = VEC_length (tree, interm_types) - 1;
- VEC_iterate (tree, interm_types, i, intermediate_type); i--)
- {
- vec_dest = vect_create_destination_var (scalar_dest,
- intermediate_type);
- VEC_quick_push (tree, vec_dsts, vec_dest);
- }
- }
-
- if (!slp_node)
- {
- vec_oprnds0 = VEC_alloc (tree, heap,
- (multi_step_cvt ? vect_pow2 (multi_step_cvt) : 1));
- if (op_type == binary_op)
- vec_oprnds1 = VEC_alloc (tree, heap, 1);
- }
- else if (code == WIDEN_LSHIFT_EXPR)
- vec_oprnds1 = VEC_alloc (tree, heap, slp_node->vec_stmts_size);
-
- /* In case the vectorization factor (VF) is bigger than the number
- of elements that we can fit in a vectype (nunits), we have to generate
- more than one vector stmt - i.e - we need to "unroll" the
- vector stmt by a factor VF/nunits. */
-
- prev_stmt_info = NULL;
- for (j = 0; j < ncopies; j++)
- {
- /* Handle uses. */
- if (j == 0)
- {
- if (slp_node)
- {
- if (code == WIDEN_LSHIFT_EXPR)
- {
- vec_oprnd1 = op1;
- /* Store vec_oprnd1 for every vector stmt to be created
- for SLP_NODE. We check during the analysis that all
- the shift arguments are the same. */
- for (k = 0; k < slp_node->vec_stmts_size - 1; k++)
- VEC_quick_push (tree, vec_oprnds1, vec_oprnd1);
-
- vect_get_slp_defs (op0, NULL_TREE, slp_node, &vec_oprnds0, NULL,
- -1);
- }
- else
- vect_get_slp_defs (op0, op1, slp_node, &vec_oprnds0,
- &vec_oprnds1, -1);
- }
- else
- {
- vec_oprnd0 = vect_get_vec_def_for_operand (op0, stmt, NULL);
- VEC_quick_push (tree, vec_oprnds0, vec_oprnd0);
- if (op_type == binary_op)
- {
- if (code == WIDEN_LSHIFT_EXPR)
- vec_oprnd1 = op1;
- else
- vec_oprnd1 = vect_get_vec_def_for_operand (op1, stmt, NULL);
- VEC_quick_push (tree, vec_oprnds1, vec_oprnd1);
- }
- }
- }
- else
- {
- vec_oprnd0 = vect_get_vec_def_for_stmt_copy (dt[0], vec_oprnd0);
- VEC_replace (tree, vec_oprnds0, 0, vec_oprnd0);
- if (op_type == binary_op)
- {
- if (code == WIDEN_LSHIFT_EXPR)
- vec_oprnd1 = op1;
- else
- vec_oprnd1 = vect_get_vec_def_for_stmt_copy (dt[1], vec_oprnd1);
- VEC_replace (tree, vec_oprnds1, 0, vec_oprnd1);
- }
- }
-
- /* Arguments are ready. Create the new vector stmts. */
- tmp_vec_dsts = VEC_copy (tree, heap, vec_dsts);
- vect_create_vectorized_promotion_stmts (&vec_oprnds0, &vec_oprnds1,
- multi_step_cvt, stmt,
- tmp_vec_dsts,
- gsi, slp_node, code1, code2,
- decl1, decl2, op_type,
- &prev_stmt_info);
- }
-
- VEC_free (tree, heap, vec_dsts);
- VEC_free (tree, heap, tmp_vec_dsts);
- VEC_free (tree, heap, interm_types);
- VEC_free (tree, heap, vec_oprnds0);
- VEC_free (tree, heap, vec_oprnds1);
-
- *vec_stmt = STMT_VINFO_VEC_STMT (stmt_info);
- return true;
-}
-
-
/* Function vectorizable_store.
Check if STMT defines a non scalar data-ref (array/pointer/structure) that
@@ -3870,6 +3679,7 @@ vectorizable_store (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt,
vec_num = SLP_TREE_NUMBER_OF_VEC_STMTS (slp_node);
first_stmt = VEC_index (gimple, SLP_TREE_SCALAR_STMTS (slp_node), 0);
first_dr = STMT_VINFO_DATA_REF (vinfo_for_stmt (first_stmt));
+ op = gimple_assign_rhs1 (first_stmt);
}
else
/* VEC_NUM is the number of vect stmts to be created for this
@@ -3952,8 +3762,8 @@ vectorizable_store (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt,
if (slp)
{
/* Get vectorized arguments for SLP_NODE. */
- vect_get_slp_defs (NULL_TREE, NULL_TREE, slp_node, &vec_oprnds,
- NULL, -1);
+ vect_get_vec_defs (op, NULL_TREE, stmt, &vec_oprnds,
+ NULL, slp_node, -1);
vec_oprnd = VEC_index (tree, vec_oprnds, 0);
}
@@ -4120,23 +3930,17 @@ vectorizable_store (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt,
return true;
}
-/* Given a vector type VECTYPE returns a builtin DECL to be used
- for vector permutation and returns the mask that implements
- reversal of the vector elements. If that is impossible to do,
- returns NULL. */
+/* Given a vector type VECTYPE and permutation SEL returns
+ the VECTOR_CST mask that implements the permutation of the
+ vector elements. If that is impossible to do, returns NULL. */
static tree
-perm_mask_for_reverse (tree vectype)
+gen_perm_mask (tree vectype, unsigned char *sel)
{
tree mask_elt_type, mask_type, mask_vec;
int i, nunits;
- unsigned char *sel;
nunits = TYPE_VECTOR_SUBPARTS (vectype);
- sel = XALLOCAVEC (unsigned char, nunits);
-
- for (i = 0; i < nunits; ++i)
- sel[i] = nunits - 1 - i;
if (!can_vec_perm_p (TYPE_MODE (vectype), false, sel))
return NULL;
@@ -4147,33 +3951,52 @@ perm_mask_for_reverse (tree vectype)
mask_type = get_vectype_for_scalar_type (mask_elt_type);
mask_vec = NULL;
- for (i = 0; i < nunits; i++)
- mask_vec = tree_cons (NULL, build_int_cst (mask_elt_type, i), mask_vec);
+ for (i = nunits - 1; i >= 0; i--)
+ mask_vec = tree_cons (NULL, build_int_cst (mask_elt_type, sel[i]),
+ mask_vec);
mask_vec = build_vector (mask_type, mask_vec);
return mask_vec;
}
-/* Given a vector variable X, that was generated for the scalar LHS of
- STMT, generate instructions to reverse the vector elements of X,
- insert them a *GSI and return the permuted vector variable. */
+/* Given a vector type VECTYPE returns the VECTOR_CST mask that implements
+ reversal of the vector elements. If that is impossible to do,
+ returns NULL. */
static tree
-reverse_vec_elements (tree x, gimple stmt, gimple_stmt_iterator *gsi)
+perm_mask_for_reverse (tree vectype)
+{
+ int i, nunits;
+ unsigned char *sel;
+
+ nunits = TYPE_VECTOR_SUBPARTS (vectype);
+ sel = XALLOCAVEC (unsigned char, nunits);
+
+ for (i = 0; i < nunits; ++i)
+ sel[i] = nunits - 1 - i;
+
+ return gen_perm_mask (vectype, sel);
+}
+
+/* Given a vector variable X and Y, that was generated for the scalar
+ STMT, generate instructions to permute the vector elements of X and Y
+ using permutation mask MASK_VEC, insert them at *GSI and return the
+ permuted vector variable. */
+
+static tree
+permute_vec_elements (tree x, tree y, tree mask_vec, gimple stmt,
+ gimple_stmt_iterator *gsi)
{
tree vectype = TREE_TYPE (x);
- tree mask_vec, perm_dest, data_ref;
+ tree perm_dest, data_ref;
gimple perm_stmt;
- mask_vec = perm_mask_for_reverse (vectype);
-
perm_dest = vect_create_destination_var (gimple_assign_lhs (stmt), vectype);
+ data_ref = make_ssa_name (perm_dest, NULL);
/* Generate the permute statement. */
- perm_stmt = gimple_build_assign_with_ops3 (VEC_PERM_EXPR, perm_dest,
- x, x, mask_vec);
- data_ref = make_ssa_name (perm_dest, perm_stmt);
- gimple_set_lhs (perm_stmt, data_ref);
+ perm_stmt = gimple_build_assign_with_ops3 (VEC_PERM_EXPR, data_ref,
+ x, y, mask_vec);
vect_finish_stmt_generation (stmt, perm_stmt, gsi);
return data_ref;
@@ -4232,6 +4055,10 @@ vectorizable_load (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt,
bb_vec_info bb_vinfo = STMT_VINFO_BB_VINFO (stmt_info);
int vf;
tree aggr_type;
+ tree gather_base = NULL_TREE, gather_off = NULL_TREE;
+ tree gather_off_vectype = NULL_TREE, gather_decl = NULL_TREE;
+ int gather_scale = 1;
+ enum vect_def_type gather_dt = vect_unknown_def_type;
if (loop_vinfo)
{
@@ -4312,7 +4139,7 @@ vectorizable_load (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt,
{
strided_load = true;
/* FORNOW */
- gcc_assert (! nested_in_vect_loop);
+ gcc_assert (! nested_in_vect_loop && !STMT_VINFO_GATHER_P (stmt_info));
first_stmt = GROUP_FIRST_ELEMENT (stmt_info);
if (!slp && !PURE_SLP_STMT (stmt_info))
@@ -4327,7 +4154,7 @@ vectorizable_load (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt,
if (negative)
{
- gcc_assert (!strided_load);
+ gcc_assert (!strided_load && !STMT_VINFO_GATHER_P (stmt_info));
alignment_support_scheme = vect_supportable_dr_alignment (dr, false);
if (alignment_support_scheme != dr_aligned
&& alignment_support_scheme != dr_unaligned_supported)
@@ -4344,6 +4171,23 @@ vectorizable_load (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt,
}
}
+ if (STMT_VINFO_GATHER_P (stmt_info))
+ {
+ gimple def_stmt;
+ tree def;
+ gather_decl = vect_check_gather (stmt, loop_vinfo, &gather_base,
+ &gather_off, &gather_scale);
+ gcc_assert (gather_decl);
+ if (!vect_is_simple_use_1 (gather_off, loop_vinfo, bb_vinfo,
+ &def_stmt, &def, &gather_dt,
+ &gather_off_vectype))
+ {
+ if (vect_print_dump_info (REPORT_DETAILS))
+ fprintf (vect_dump, "gather index use not simple.");
+ return false;
+ }
+ }
+
if (!vec_stmt) /* transformation not required. */
{
STMT_VINFO_TYPE (stmt_info) = load_vec_info_type;
@@ -4356,6 +4200,161 @@ vectorizable_load (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt,
/** Transform. **/
+ if (STMT_VINFO_GATHER_P (stmt_info))
+ {
+ tree vec_oprnd0 = NULL_TREE, op;
+ tree arglist = TYPE_ARG_TYPES (TREE_TYPE (gather_decl));
+ tree rettype, srctype, ptrtype, idxtype, masktype, scaletype;
+ tree ptr, mask, var, scale, perm_mask = NULL_TREE, prev_res = NULL_TREE;
+ edge pe = loop_preheader_edge (loop);
+ gimple_seq seq;
+ basic_block new_bb;
+ enum { NARROW, NONE, WIDEN } modifier;
+ int gather_off_nunits = TYPE_VECTOR_SUBPARTS (gather_off_vectype);
+
+ if (nunits == gather_off_nunits)
+ modifier = NONE;
+ else if (nunits == gather_off_nunits / 2)
+ {
+ unsigned char *sel = XALLOCAVEC (unsigned char, gather_off_nunits);
+ modifier = WIDEN;
+
+ for (i = 0; i < gather_off_nunits; ++i)
+ sel[i] = i | nunits;
+
+ perm_mask = gen_perm_mask (gather_off_vectype, sel);
+ gcc_assert (perm_mask != NULL_TREE);
+ }
+ else if (nunits == gather_off_nunits * 2)
+ {
+ unsigned char *sel = XALLOCAVEC (unsigned char, nunits);
+ modifier = NARROW;
+
+ for (i = 0; i < nunits; ++i)
+ sel[i] = i < gather_off_nunits
+ ? i : i + nunits - gather_off_nunits;
+
+ perm_mask = gen_perm_mask (vectype, sel);
+ gcc_assert (perm_mask != NULL_TREE);
+ ncopies *= 2;
+ }
+ else
+ gcc_unreachable ();
+
+ rettype = TREE_TYPE (TREE_TYPE (gather_decl));
+ srctype = TREE_VALUE (arglist); arglist = TREE_CHAIN (arglist);
+ ptrtype = TREE_VALUE (arglist); arglist = TREE_CHAIN (arglist);
+ idxtype = TREE_VALUE (arglist); arglist = TREE_CHAIN (arglist);
+ masktype = TREE_VALUE (arglist); arglist = TREE_CHAIN (arglist);
+ scaletype = TREE_VALUE (arglist);
+ gcc_checking_assert (types_compatible_p (srctype, rettype)
+ && types_compatible_p (srctype, masktype));
+
+ vec_dest = vect_create_destination_var (scalar_dest, vectype);
+
+ ptr = fold_convert (ptrtype, gather_base);
+ if (!is_gimple_min_invariant (ptr))
+ {
+ ptr = force_gimple_operand (ptr, &seq, true, NULL_TREE);
+ new_bb = gsi_insert_seq_on_edge_immediate (pe, seq);
+ gcc_assert (!new_bb);
+ }
+
+ /* Currently we support only unconditional gather loads,
+ so mask should be all ones. */
+ if (TREE_CODE (TREE_TYPE (masktype)) == INTEGER_TYPE)
+ mask = build_int_cst (TREE_TYPE (masktype), -1);
+ else if (SCALAR_FLOAT_TYPE_P (TREE_TYPE (masktype)))
+ {
+ REAL_VALUE_TYPE r;
+ long tmp[6];
+ for (j = 0; j < 6; ++j)
+ tmp[j] = -1;
+ real_from_target (&r, tmp, TYPE_MODE (TREE_TYPE (masktype)));
+ mask = build_real (TREE_TYPE (masktype), r);
+ }
+ else
+ gcc_unreachable ();
+ mask = build_vector_from_val (masktype, mask);
+ mask = vect_init_vector (stmt, mask, masktype, NULL);
+
+ scale = build_int_cst (scaletype, gather_scale);
+
+ prev_stmt_info = NULL;
+ for (j = 0; j < ncopies; ++j)
+ {
+ if (modifier == WIDEN && (j & 1))
+ op = permute_vec_elements (vec_oprnd0, vec_oprnd0,
+ perm_mask, stmt, gsi);
+ else if (j == 0)
+ op = vec_oprnd0
+ = vect_get_vec_def_for_operand (gather_off, stmt, NULL);
+ else
+ op = vec_oprnd0
+ = vect_get_vec_def_for_stmt_copy (gather_dt, vec_oprnd0);
+
+ if (!useless_type_conversion_p (idxtype, TREE_TYPE (op)))
+ {
+ gcc_assert (TYPE_VECTOR_SUBPARTS (TREE_TYPE (op))
+ == TYPE_VECTOR_SUBPARTS (idxtype));
+ var = vect_get_new_vect_var (idxtype, vect_simple_var, NULL);
+ add_referenced_var (var);
+ var = make_ssa_name (var, NULL);
+ op = build1 (VIEW_CONVERT_EXPR, idxtype, op);
+ new_stmt
+ = gimple_build_assign_with_ops (VIEW_CONVERT_EXPR, var,
+ op, NULL_TREE);
+ vect_finish_stmt_generation (stmt, new_stmt, gsi);
+ op = var;
+ }
+
+ new_stmt
+ = gimple_build_call (gather_decl, 5, mask, ptr, op, mask, scale);
+
+ if (!useless_type_conversion_p (vectype, rettype))
+ {
+ gcc_assert (TYPE_VECTOR_SUBPARTS (vectype)
+ == TYPE_VECTOR_SUBPARTS (rettype));
+ var = vect_get_new_vect_var (rettype, vect_simple_var, NULL);
+ add_referenced_var (var);
+ op = make_ssa_name (var, new_stmt);
+ gimple_call_set_lhs (new_stmt, op);
+ vect_finish_stmt_generation (stmt, new_stmt, gsi);
+ var = make_ssa_name (vec_dest, NULL);
+ op = build1 (VIEW_CONVERT_EXPR, vectype, op);
+ new_stmt
+ = gimple_build_assign_with_ops (VIEW_CONVERT_EXPR, var, op,
+ NULL_TREE);
+ }
+ else
+ {
+ var = make_ssa_name (vec_dest, new_stmt);
+ gimple_call_set_lhs (new_stmt, var);
+ }
+
+ vect_finish_stmt_generation (stmt, new_stmt, gsi);
+
+ if (modifier == NARROW)
+ {
+ if ((j & 1) == 0)
+ {
+ prev_res = var;
+ continue;
+ }
+ var = permute_vec_elements (prev_res, var,
+ perm_mask, stmt, gsi);
+ new_stmt = SSA_NAME_DEF_STMT (var);
+ }
+
+ if (prev_stmt_info == NULL)
+ STMT_VINFO_VEC_STMT (stmt_info) = *vec_stmt = new_stmt;
+ else
+ STMT_VINFO_RELATED_STMT (prev_stmt_info) = new_stmt;
+ prev_stmt_info = vinfo_for_stmt (new_stmt);
+ }
+ return true;
+ }
+
if (strided_load)
{
first_stmt = GROUP_FIRST_ELEMENT (stmt_info);
@@ -4726,11 +4725,20 @@ vectorizable_load (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt,
/* 4. Handle invariant-load. */
if (inv_p && !bb_vinfo)
{
- tree vec_inv;
+ tree tem, vec_inv;
gimple_stmt_iterator gsi2 = *gsi;
gcc_assert (!strided_load);
gsi_next (&gsi2);
- vec_inv = build_vector_from_val (vectype, scalar_dest);
+ tem = scalar_dest;
+ if (!useless_type_conversion_p (TREE_TYPE (vectype),
+ TREE_TYPE (tem)))
+ {
+ tem = fold_convert (TREE_TYPE (vectype), tem);
+ tem = force_gimple_operand_gsi (&gsi2, tem, true,
+ NULL_TREE, true,
+ GSI_SAME_STMT);
+ }
+ vec_inv = build_vector_from_val (vectype, tem);
new_temp = vect_init_vector (stmt, vec_inv,
vectype, &gsi2);
new_stmt = SSA_NAME_DEF_STMT (new_temp);
@@ -4738,7 +4746,9 @@ vectorizable_load (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt,
if (negative)
{
- new_temp = reverse_vec_elements (new_temp, stmt, gsi);
+ tree perm_mask = perm_mask_for_reverse (vectype);
+ new_temp = permute_vec_elements (new_temp, new_temp,
+ perm_mask, stmt, gsi);
new_stmt = SSA_NAME_DEF_STMT (new_temp);
}
@@ -4803,7 +4813,8 @@ vectorizable_load (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt,
condition operands are supportable using vec_is_simple_use. */
static bool
-vect_is_simple_cond (tree cond, loop_vec_info loop_vinfo, tree *comp_vectype)
+vect_is_simple_cond (tree cond, loop_vec_info loop_vinfo, bb_vec_info bb_vinfo,
+ tree *comp_vectype)
{
tree lhs, rhs;
tree def;
@@ -4819,7 +4830,7 @@ vect_is_simple_cond (tree cond, loop_vec_info loop_vinfo, tree *comp_vectype)
if (TREE_CODE (lhs) == SSA_NAME)
{
gimple lhs_def_stmt = SSA_NAME_DEF_STMT (lhs);
- if (!vect_is_simple_use_1 (lhs, loop_vinfo, NULL, &lhs_def_stmt, &def,
+ if (!vect_is_simple_use_1 (lhs, loop_vinfo, bb_vinfo, &lhs_def_stmt, &def,
&dt, &vectype1))
return false;
}
@@ -4830,11 +4841,11 @@ vect_is_simple_cond (tree cond, loop_vec_info loop_vinfo, tree *comp_vectype)
if (TREE_CODE (rhs) == SSA_NAME)
{
gimple rhs_def_stmt = SSA_NAME_DEF_STMT (rhs);
- if (!vect_is_simple_use_1 (rhs, loop_vinfo, NULL, &rhs_def_stmt, &def,
+ if (!vect_is_simple_use_1 (rhs, loop_vinfo, bb_vinfo, &rhs_def_stmt, &def,
&dt, &vectype2))
return false;
}
- else if (TREE_CODE (rhs) != INTEGER_CST && TREE_CODE (rhs) != REAL_CST
+ else if (TREE_CODE (rhs) != INTEGER_CST && TREE_CODE (rhs) != REAL_CST
&& TREE_CODE (rhs) != FIXED_CST)
return false;
@@ -4857,7 +4868,8 @@ vect_is_simple_cond (tree cond, loop_vec_info loop_vinfo, tree *comp_vectype)
bool
vectorizable_condition (gimple stmt, gimple_stmt_iterator *gsi,
- gimple *vec_stmt, tree reduc_def, int reduc_index)
+ gimple *vec_stmt, tree reduc_def, int reduc_index,
+ slp_tree slp_node)
{
tree scalar_dest = NULL_TREE;
tree vec_dest = NULL_TREE;
@@ -4873,23 +4885,27 @@ vectorizable_condition (gimple stmt, gimple_stmt_iterator *gsi,
tree def;
enum vect_def_type dt, dts[4];
int nunits = TYPE_VECTOR_SUBPARTS (vectype);
- int ncopies = LOOP_VINFO_VECT_FACTOR (loop_vinfo) / nunits;
+ int ncopies;
enum tree_code code;
stmt_vec_info prev_stmt_info = NULL;
- int j;
-
- /* FORNOW: unsupported in basic block SLP. */
- gcc_assert (loop_vinfo);
+ int i, j;
+ bb_vec_info bb_vinfo = STMT_VINFO_BB_VINFO (stmt_info);
+ VEC (tree, heap) *vec_oprnds0 = NULL, *vec_oprnds1 = NULL;
+ VEC (tree, heap) *vec_oprnds2 = NULL, *vec_oprnds3 = NULL;
- /* FORNOW: SLP not supported. */
- if (STMT_SLP_TYPE (stmt_info))
- return false;
+ if (slp_node || PURE_SLP_STMT (stmt_info))
+ ncopies = 1;
+ else
+ ncopies = LOOP_VINFO_VECT_FACTOR (loop_vinfo) / nunits;
gcc_assert (ncopies >= 1);
if (reduc_index && ncopies > 1)
return false; /* FORNOW */
- if (!STMT_VINFO_RELEVANT_P (stmt_info))
+ if (reduc_index && STMT_SLP_TYPE (stmt_info))
+ return false;
+
+ if (!STMT_VINFO_RELEVANT_P (stmt_info) && !bb_vinfo)
return false;
if (STMT_VINFO_DEF_TYPE (stmt_info) != vect_internal_def
@@ -4918,14 +4934,14 @@ vectorizable_condition (gimple stmt, gimple_stmt_iterator *gsi,
then_clause = gimple_assign_rhs2 (stmt);
else_clause = gimple_assign_rhs3 (stmt);
- if (!vect_is_simple_cond (cond_expr, loop_vinfo, &comp_vectype)
+ if (!vect_is_simple_cond (cond_expr, loop_vinfo, bb_vinfo, &comp_vectype)
|| !comp_vectype)
return false;
if (TREE_CODE (then_clause) == SSA_NAME)
{
gimple then_def_stmt = SSA_NAME_DEF_STMT (then_clause);
- if (!vect_is_simple_use (then_clause, loop_vinfo, NULL,
+ if (!vect_is_simple_use (then_clause, loop_vinfo, bb_vinfo,
&then_def_stmt, &def, &dt))
return false;
}
@@ -4937,7 +4953,7 @@ vectorizable_condition (gimple stmt, gimple_stmt_iterator *gsi,
if (TREE_CODE (else_clause) == SSA_NAME)
{
gimple else_def_stmt = SSA_NAME_DEF_STMT (else_clause);
- if (!vect_is_simple_use (else_clause, loop_vinfo, NULL,
+ if (!vect_is_simple_use (else_clause, loop_vinfo, bb_vinfo,
&else_def_stmt, &def, &dt))
return false;
}
@@ -4952,7 +4968,15 @@ vectorizable_condition (gimple stmt, gimple_stmt_iterator *gsi,
return expand_vec_cond_expr_p (vectype, comp_vectype);
}
- /* Transform */
+ /* Transform. */
+
+ if (!slp_node)
+ {
+ vec_oprnds0 = VEC_alloc (tree, heap, 1);
+ vec_oprnds1 = VEC_alloc (tree, heap, 1);
+ vec_oprnds2 = VEC_alloc (tree, heap, 1);
+ vec_oprnds3 = VEC_alloc (tree, heap, 1);
+ }
/* Handle def. */
scalar_dest = gimple_assign_lhs (stmt);
@@ -4961,67 +4985,118 @@ vectorizable_condition (gimple stmt, gimple_stmt_iterator *gsi,
/* Handle cond expr. */
for (j = 0; j < ncopies; j++)
{
- gimple new_stmt;
+ gimple new_stmt = NULL;
if (j == 0)
{
- gimple gtemp;
- vec_cond_lhs =
+ if (slp_node)
+ {
+ VEC (tree, heap) *ops = VEC_alloc (tree, heap, 4);
+ VEC (slp_void_p, heap) *vec_defs;
+
+ vec_defs = VEC_alloc (slp_void_p, heap, 4);
+ VEC_safe_push (tree, heap, ops, TREE_OPERAND (cond_expr, 0));
+ VEC_safe_push (tree, heap, ops, TREE_OPERAND (cond_expr, 1));
+ VEC_safe_push (tree, heap, ops, then_clause);
+ VEC_safe_push (tree, heap, ops, else_clause);
+ vect_get_slp_defs (ops, slp_node, &vec_defs, -1);
+ vec_oprnds3 = (VEC (tree, heap) *) VEC_pop (slp_void_p, vec_defs);
+ vec_oprnds2 = (VEC (tree, heap) *) VEC_pop (slp_void_p, vec_defs);
+ vec_oprnds1 = (VEC (tree, heap) *) VEC_pop (slp_void_p, vec_defs);
+ vec_oprnds0 = (VEC (tree, heap) *) VEC_pop (slp_void_p, vec_defs);
+
+ VEC_free (tree, heap, ops);
+ VEC_free (slp_void_p, heap, vec_defs);
+ }
+ else
+ {
+ gimple gtemp;
+ vec_cond_lhs =
vect_get_vec_def_for_operand (TREE_OPERAND (cond_expr, 0),
stmt, NULL);
- vect_is_simple_use (TREE_OPERAND (cond_expr, 0), loop_vinfo,
+ vect_is_simple_use (TREE_OPERAND (cond_expr, 0), loop_vinfo,
NULL, &gtemp, &def, &dts[0]);
- vec_cond_rhs =
- vect_get_vec_def_for_operand (TREE_OPERAND (cond_expr, 1),
- stmt, NULL);
- vect_is_simple_use (TREE_OPERAND (cond_expr, 1), loop_vinfo,
- NULL, &gtemp, &def, &dts[1]);
- if (reduc_index == 1)
- vec_then_clause = reduc_def;
- else
- {
- vec_then_clause = vect_get_vec_def_for_operand (then_clause,
- stmt, NULL);
- vect_is_simple_use (then_clause, loop_vinfo,
- NULL, &gtemp, &def, &dts[2]);
- }
- if (reduc_index == 2)
- vec_else_clause = reduc_def;
- else
- {
- vec_else_clause = vect_get_vec_def_for_operand (else_clause,
+
+ vec_cond_rhs =
+ vect_get_vec_def_for_operand (TREE_OPERAND (cond_expr, 1),
+ stmt, NULL);
+ vect_is_simple_use (TREE_OPERAND (cond_expr, 1), loop_vinfo,
+ NULL, &gtemp, &def, &dts[1]);
+ if (reduc_index == 1)
+ vec_then_clause = reduc_def;
+ else
+ {
+ vec_then_clause = vect_get_vec_def_for_operand (then_clause,
+ stmt, NULL);
+ vect_is_simple_use (then_clause, loop_vinfo,
+ NULL, &gtemp, &def, &dts[2]);
+ }
+ if (reduc_index == 2)
+ vec_else_clause = reduc_def;
+ else
+ {
+ vec_else_clause = vect_get_vec_def_for_operand (else_clause,
stmt, NULL);
- vect_is_simple_use (else_clause, loop_vinfo,
+ vect_is_simple_use (else_clause, loop_vinfo,
NULL, &gtemp, &def, &dts[3]);
+ }
}
}
else
{
- vec_cond_lhs = vect_get_vec_def_for_stmt_copy (dts[0], vec_cond_lhs);
- vec_cond_rhs = vect_get_vec_def_for_stmt_copy (dts[1], vec_cond_rhs);
+ vec_cond_lhs = vect_get_vec_def_for_stmt_copy (dts[0],
+ VEC_pop (tree, vec_oprnds0));
+ vec_cond_rhs = vect_get_vec_def_for_stmt_copy (dts[1],
+ VEC_pop (tree, vec_oprnds1));
vec_then_clause = vect_get_vec_def_for_stmt_copy (dts[2],
- vec_then_clause);
+ VEC_pop (tree, vec_oprnds2));
vec_else_clause = vect_get_vec_def_for_stmt_copy (dts[3],
- vec_else_clause);
+ VEC_pop (tree, vec_oprnds3));
+ }
+
+ if (!slp_node)
+ {
+ VEC_quick_push (tree, vec_oprnds0, vec_cond_lhs);
+ VEC_quick_push (tree, vec_oprnds1, vec_cond_rhs);
+ VEC_quick_push (tree, vec_oprnds2, vec_then_clause);
+ VEC_quick_push (tree, vec_oprnds3, vec_else_clause);
}
/* Arguments are ready. Create the new vector stmt. */
- vec_compare = build2 (TREE_CODE (cond_expr), vectype,
- vec_cond_lhs, vec_cond_rhs);
- vec_cond_expr = build3 (VEC_COND_EXPR, vectype,
- vec_compare, vec_then_clause, vec_else_clause);
+ FOR_EACH_VEC_ELT (tree, vec_oprnds0, i, vec_cond_lhs)
+ {
+ vec_cond_rhs = VEC_index (tree, vec_oprnds1, i);
+ vec_then_clause = VEC_index (tree, vec_oprnds2, i);
+ vec_else_clause = VEC_index (tree, vec_oprnds3, i);
- new_stmt = gimple_build_assign (vec_dest, vec_cond_expr);
- new_temp = make_ssa_name (vec_dest, new_stmt);
- gimple_assign_set_lhs (new_stmt, new_temp);
- vect_finish_stmt_generation (stmt, new_stmt, gsi);
- if (j == 0)
- STMT_VINFO_VEC_STMT (stmt_info) = *vec_stmt = new_stmt;
- else
- STMT_VINFO_RELATED_STMT (prev_stmt_info) = new_stmt;
+ vec_compare = build2 (TREE_CODE (cond_expr), vectype,
+ vec_cond_lhs, vec_cond_rhs);
+ vec_cond_expr = build3 (VEC_COND_EXPR, vectype,
+ vec_compare, vec_then_clause, vec_else_clause);
- prev_stmt_info = vinfo_for_stmt (new_stmt);
+ new_stmt = gimple_build_assign (vec_dest, vec_cond_expr);
+ new_temp = make_ssa_name (vec_dest, new_stmt);
+ gimple_assign_set_lhs (new_stmt, new_temp);
+ vect_finish_stmt_generation (stmt, new_stmt, gsi);
+ if (slp_node)
+ VEC_quick_push (gimple, SLP_TREE_VEC_STMTS (slp_node), new_stmt);
+ }
+
+ if (slp_node)
+ continue;
+
+ if (j == 0)
+ STMT_VINFO_VEC_STMT (stmt_info) = *vec_stmt = new_stmt;
+ else
+ STMT_VINFO_RELATED_STMT (prev_stmt_info) = new_stmt;
+
+ prev_stmt_info = vinfo_for_stmt (new_stmt);
}
+ VEC_free (tree, heap, vec_oprnds0);
+ VEC_free (tree, heap, vec_oprnds1);
+ VEC_free (tree, heap, vec_oprnds2);
+ VEC_free (tree, heap, vec_oprnds3);
+
return true;
}
@@ -5060,7 +5135,7 @@ vect_analyze_stmt (gimple stmt, bool *need_to_vectorize, slp_tree node)
In basic blocks we only analyze statements that are a part of some SLP
instance, therefore, all the statements are relevant.
- Pattern statement need to be analyzed instead of the original statement
+ Pattern statement needs to be analyzed instead of the original statement
if the original statement is not relevant. Otherwise, we analyze both
statements. */
@@ -5185,9 +5260,7 @@ vect_analyze_stmt (gimple stmt, bool *need_to_vectorize, slp_tree node)
if (!bb_vinfo
&& (STMT_VINFO_RELEVANT_P (stmt_info)
|| STMT_VINFO_DEF_TYPE (stmt_info) == vect_reduction_def))
- ok = (vectorizable_type_promotion (stmt, NULL, NULL, NULL)
- || vectorizable_type_demotion (stmt, NULL, NULL, NULL)
- || vectorizable_conversion (stmt, NULL, NULL, NULL)
+ ok = (vectorizable_conversion (stmt, NULL, NULL, NULL)
|| vectorizable_shift (stmt, NULL, NULL, NULL)
|| vectorizable_operation (stmt, NULL, NULL, NULL)
|| vectorizable_assignment (stmt, NULL, NULL, NULL)
@@ -5195,17 +5268,17 @@ vect_analyze_stmt (gimple stmt, bool *need_to_vectorize, slp_tree node)
|| vectorizable_call (stmt, NULL, NULL)
|| vectorizable_store (stmt, NULL, NULL, NULL)
|| vectorizable_reduction (stmt, NULL, NULL, NULL)
- || vectorizable_condition (stmt, NULL, NULL, NULL, 0));
+ || vectorizable_condition (stmt, NULL, NULL, NULL, 0, NULL));
else
{
if (bb_vinfo)
- ok = (vectorizable_type_promotion (stmt, NULL, NULL, node)
- || vectorizable_type_demotion (stmt, NULL, NULL, node)
- || vectorizable_shift (stmt, NULL, NULL, node)
+ ok = (vectorizable_conversion (stmt, NULL, NULL, node)
+ || vectorizable_shift (stmt, NULL, NULL, node)
|| vectorizable_operation (stmt, NULL, NULL, node)
|| vectorizable_assignment (stmt, NULL, NULL, node)
|| vectorizable_load (stmt, NULL, NULL, node, NULL)
- || vectorizable_store (stmt, NULL, NULL, node));
+ || vectorizable_store (stmt, NULL, NULL, node)
+ || vectorizable_condition (stmt, NULL, NULL, NULL, 0, node));
}
if (!ok)
@@ -5262,15 +5335,7 @@ vect_transform_stmt (gimple stmt, gimple_stmt_iterator *gsi,
switch (STMT_VINFO_TYPE (stmt_info))
{
case type_demotion_vec_info_type:
- done = vectorizable_type_demotion (stmt, gsi, &vec_stmt, slp_node);
- gcc_assert (done);
- break;
-
case type_promotion_vec_info_type:
- done = vectorizable_type_promotion (stmt, gsi, &vec_stmt, slp_node);
- gcc_assert (done);
- break;
-
case type_conversion_vec_info_type:
done = vectorizable_conversion (stmt, gsi, &vec_stmt, slp_node);
gcc_assert (done);
@@ -5321,8 +5386,7 @@ vect_transform_stmt (gimple stmt, gimple_stmt_iterator *gsi,
break;
case condition_vec_info_type:
- gcc_assert (!slp_node);
- done = vectorizable_condition (stmt, gsi, &vec_stmt, NULL, 0);
+ done = vectorizable_condition (stmt, gsi, &vec_stmt, NULL, 0, slp_node);
gcc_assert (done);
break;
@@ -5846,12 +5910,17 @@ supportable_widening_operation (enum tree_code code, gimple stmt,
tree vectype = vectype_in;
tree wide_vectype = vectype_out;
enum tree_code c1, c2;
+ int i;
+ tree prev_type, intermediate_type;
+ enum machine_mode intermediate_mode, prev_mode;
+ optab optab3, optab4;
+ *multi_step_cvt = 0;
if (loop_info)
vect_loop = LOOP_VINFO_LOOP (loop_info);
/* The result of a vectorized widening operation usually requires two vectors
- (because the widened results do not fit int one vector). The generated
+ (because the widened results do not fit into one vector). The generated
vector results would normally be expected to be generated in the same
order as in the original scalar computation, i.e. if 8 results are
generated in each vector iteration, they are to be organized as follows:
@@ -5896,55 +5965,23 @@ supportable_widening_operation (enum tree_code code, gimple stmt,
switch (code)
{
case WIDEN_MULT_EXPR:
- if (BYTES_BIG_ENDIAN)
- {
- c1 = VEC_WIDEN_MULT_HI_EXPR;
- c2 = VEC_WIDEN_MULT_LO_EXPR;
- }
- else
- {
- c2 = VEC_WIDEN_MULT_HI_EXPR;
- c1 = VEC_WIDEN_MULT_LO_EXPR;
- }
+ c1 = VEC_WIDEN_MULT_LO_EXPR;
+ c2 = VEC_WIDEN_MULT_HI_EXPR;
break;
case WIDEN_LSHIFT_EXPR:
- if (BYTES_BIG_ENDIAN)
- {
- c1 = VEC_WIDEN_LSHIFT_HI_EXPR;
- c2 = VEC_WIDEN_LSHIFT_LO_EXPR;
- }
- else
- {
- c2 = VEC_WIDEN_LSHIFT_HI_EXPR;
- c1 = VEC_WIDEN_LSHIFT_LO_EXPR;
- }
+ c1 = VEC_WIDEN_LSHIFT_LO_EXPR;
+ c2 = VEC_WIDEN_LSHIFT_HI_EXPR;
break;
CASE_CONVERT:
- if (BYTES_BIG_ENDIAN)
- {
- c1 = VEC_UNPACK_HI_EXPR;
- c2 = VEC_UNPACK_LO_EXPR;
- }
- else
- {
- c2 = VEC_UNPACK_HI_EXPR;
- c1 = VEC_UNPACK_LO_EXPR;
- }
+ c1 = VEC_UNPACK_LO_EXPR;
+ c2 = VEC_UNPACK_HI_EXPR;
break;
case FLOAT_EXPR:
- if (BYTES_BIG_ENDIAN)
- {
- c1 = VEC_UNPACK_FLOAT_HI_EXPR;
- c2 = VEC_UNPACK_FLOAT_LO_EXPR;
- }
- else
- {
- c2 = VEC_UNPACK_FLOAT_HI_EXPR;
- c1 = VEC_UNPACK_FLOAT_LO_EXPR;
- }
+ c1 = VEC_UNPACK_FLOAT_LO_EXPR;
+ c2 = VEC_UNPACK_FLOAT_HI_EXPR;
break;
case FIX_TRUNC_EXPR:
@@ -5957,6 +5994,13 @@ supportable_widening_operation (enum tree_code code, gimple stmt,
gcc_unreachable ();
}
+ if (BYTES_BIG_ENDIAN)
+ {
+ enum tree_code ctmp = c1;
+ c1 = c2;
+ c2 = ctmp;
+ }
+
if (code == FIX_TRUNC_EXPR)
{
/* The signedness is determined from output operand. */
@@ -5977,65 +6021,60 @@ supportable_widening_operation (enum tree_code code, gimple stmt,
|| (icode2 = optab_handler (optab2, vec_mode)) == CODE_FOR_nothing)
return false;
+ *code1 = c1;
+ *code2 = c2;
+
+ if (insn_data[icode1].operand[0].mode == TYPE_MODE (wide_vectype)
+ && insn_data[icode2].operand[0].mode == TYPE_MODE (wide_vectype))
+ return true;
+
/* Check if it's a multi-step conversion that can be done using intermediate
types. */
- if (insn_data[icode1].operand[0].mode != TYPE_MODE (wide_vectype)
- || insn_data[icode2].operand[0].mode != TYPE_MODE (wide_vectype))
- {
- int i;
- tree prev_type = vectype, intermediate_type;
- enum machine_mode intermediate_mode, prev_mode = vec_mode;
- optab optab3, optab4;
- if (!CONVERT_EXPR_CODE_P (code))
- return false;
+ prev_type = vectype;
+ prev_mode = vec_mode;
- *code1 = c1;
- *code2 = c2;
+ if (!CONVERT_EXPR_CODE_P (code))
+ return false;
- /* We assume here that there will not be more than MAX_INTERM_CVT_STEPS
- intermediate steps in promotion sequence. We try
- MAX_INTERM_CVT_STEPS to get to NARROW_VECTYPE, and fail if we do
- not. */
- *interm_types = VEC_alloc (tree, heap, MAX_INTERM_CVT_STEPS);
- for (i = 0; i < 3; i++)
- {
- intermediate_mode = insn_data[icode1].operand[0].mode;
- intermediate_type = lang_hooks.types.type_for_mode (intermediate_mode,
- TYPE_UNSIGNED (prev_type));
- optab3 = optab_for_tree_code (c1, intermediate_type, optab_default);
- optab4 = optab_for_tree_code (c2, intermediate_type, optab_default);
-
- if (!optab3 || !optab4
- || ((icode1 = optab_handler (optab1, prev_mode))
- == CODE_FOR_nothing)
- || insn_data[icode1].operand[0].mode != intermediate_mode
- || ((icode2 = optab_handler (optab2, prev_mode))
- == CODE_FOR_nothing)
- || insn_data[icode2].operand[0].mode != intermediate_mode
- || ((icode1 = optab_handler (optab3, intermediate_mode))
- == CODE_FOR_nothing)
- || ((icode2 = optab_handler (optab4, intermediate_mode))
- == CODE_FOR_nothing))
- return false;
-
- VEC_quick_push (tree, *interm_types, intermediate_type);
- (*multi_step_cvt)++;
-
- if (insn_data[icode1].operand[0].mode == TYPE_MODE (wide_vectype)
- && insn_data[icode2].operand[0].mode == TYPE_MODE (wide_vectype))
- return true;
-
- prev_type = intermediate_type;
- prev_mode = intermediate_mode;
- }
+ /* We assume here that there will not be more than MAX_INTERM_CVT_STEPS
+ intermediate steps in promotion sequence. We try
+ MAX_INTERM_CVT_STEPS to get to NARROW_VECTYPE, and fail if we do
+ not. */
+ *interm_types = VEC_alloc (tree, heap, MAX_INTERM_CVT_STEPS);
+ for (i = 0; i < MAX_INTERM_CVT_STEPS; i++)
+ {
+ intermediate_mode = insn_data[icode1].operand[0].mode;
+ intermediate_type
+ = lang_hooks.types.type_for_mode (intermediate_mode,
+ TYPE_UNSIGNED (prev_type));
+ optab3 = optab_for_tree_code (c1, intermediate_type, optab_default);
+ optab4 = optab_for_tree_code (c2, intermediate_type, optab_default);
+
+ if (!optab3 || !optab4
+ || (icode1 = optab_handler (optab1, prev_mode)) == CODE_FOR_nothing
+ || insn_data[icode1].operand[0].mode != intermediate_mode
+ || (icode2 = optab_handler (optab2, prev_mode)) == CODE_FOR_nothing
+ || insn_data[icode2].operand[0].mode != intermediate_mode
+ || ((icode1 = optab_handler (optab3, intermediate_mode))
+ == CODE_FOR_nothing)
+ || ((icode2 = optab_handler (optab4, intermediate_mode))
+ == CODE_FOR_nothing))
+ break;
- return false;
+ VEC_quick_push (tree, *interm_types, intermediate_type);
+ (*multi_step_cvt)++;
+
+ if (insn_data[icode1].operand[0].mode == TYPE_MODE (wide_vectype)
+ && insn_data[icode2].operand[0].mode == TYPE_MODE (wide_vectype))
+ return true;
+
+ prev_type = intermediate_type;
+ prev_mode = intermediate_mode;
}
- *code1 = c1;
- *code2 = c2;
- return true;
+ VEC_free (tree, heap, *interm_types);
+ return false;
}
@@ -6071,9 +6110,12 @@ supportable_narrowing_operation (enum tree_code code,
tree vectype = vectype_in;
tree narrow_vectype = vectype_out;
enum tree_code c1;
- tree intermediate_type, prev_type;
+ tree intermediate_type;
+ enum machine_mode intermediate_mode, prev_mode;
int i;
+ bool uns;
+ *multi_step_cvt = 0;
switch (code)
{
CASE_CONVERT:
@@ -6106,47 +6148,70 @@ supportable_narrowing_operation (enum tree_code code,
if ((icode1 = optab_handler (optab1, vec_mode)) == CODE_FOR_nothing)
return false;
+ *code1 = c1;
+
+ if (insn_data[icode1].operand[0].mode == TYPE_MODE (narrow_vectype))
+ return true;
+
/* Check if it's a multi-step conversion that can be done using intermediate
types. */
- if (insn_data[icode1].operand[0].mode != TYPE_MODE (narrow_vectype))
- {
- enum machine_mode intermediate_mode, prev_mode = vec_mode;
-
- *code1 = c1;
- prev_type = vectype;
- /* We assume here that there will not be more than MAX_INTERM_CVT_STEPS
- intermediate steps in promotion sequence. We try
- MAX_INTERM_CVT_STEPS to get to NARROW_VECTYPE, and fail if we do
- not. */
- *interm_types = VEC_alloc (tree, heap, MAX_INTERM_CVT_STEPS);
- for (i = 0; i < 3; i++)
- {
- intermediate_mode = insn_data[icode1].operand[0].mode;
- intermediate_type = lang_hooks.types.type_for_mode (intermediate_mode,
- TYPE_UNSIGNED (prev_type));
- interm_optab = optab_for_tree_code (c1, intermediate_type,
- optab_default);
- if (!interm_optab
- || ((icode1 = optab_handler (optab1, prev_mode))
- == CODE_FOR_nothing)
- || insn_data[icode1].operand[0].mode != intermediate_mode
- || ((icode1 = optab_handler (interm_optab, intermediate_mode))
- == CODE_FOR_nothing))
- return false;
-
- VEC_quick_push (tree, *interm_types, intermediate_type);
- (*multi_step_cvt)++;
-
- if (insn_data[icode1].operand[0].mode == TYPE_MODE (narrow_vectype))
- return true;
-
- prev_type = intermediate_type;
- prev_mode = intermediate_mode;
- }
+ prev_mode = vec_mode;
+ if (code == FIX_TRUNC_EXPR)
+ uns = TYPE_UNSIGNED (vectype_out);
+ else
+ uns = TYPE_UNSIGNED (vectype);
+
+ /* For multi-step FIX_TRUNC_EXPR prefer signed floating to integer
+ conversion over unsigned, as unsigned FIX_TRUNC_EXPR is often more
+ costly than signed. */
+ if (code == FIX_TRUNC_EXPR && uns)
+ {
+ enum insn_code icode2;
+
+ intermediate_type
+ = lang_hooks.types.type_for_mode (TYPE_MODE (vectype_out), 0);
+ interm_optab
+ = optab_for_tree_code (c1, intermediate_type, optab_default);
+ if (interm_optab != NULL
+ && (icode2 = optab_handler (optab1, vec_mode)) != CODE_FOR_nothing
+ && insn_data[icode1].operand[0].mode
+ == insn_data[icode2].operand[0].mode)
+ {
+ uns = false;
+ optab1 = interm_optab;
+ icode1 = icode2;
+ }
+ }
- return false;
+ /* We assume here that there will not be more than MAX_INTERM_CVT_STEPS
+ intermediate steps in promotion sequence. We try
+ MAX_INTERM_CVT_STEPS to get to NARROW_VECTYPE, and fail if we do not. */
+ *interm_types = VEC_alloc (tree, heap, MAX_INTERM_CVT_STEPS);
+ for (i = 0; i < MAX_INTERM_CVT_STEPS; i++)
+ {
+ intermediate_mode = insn_data[icode1].operand[0].mode;
+ intermediate_type
+ = lang_hooks.types.type_for_mode (intermediate_mode, uns);
+ interm_optab
+ = optab_for_tree_code (VEC_PACK_TRUNC_EXPR, intermediate_type,
+ optab_default);
+ if (!interm_optab
+ || ((icode1 = optab_handler (optab1, prev_mode)) == CODE_FOR_nothing)
+ || insn_data[icode1].operand[0].mode != intermediate_mode
+ || ((icode1 = optab_handler (interm_optab, intermediate_mode))
+ == CODE_FOR_nothing))
+ break;
+
+ VEC_quick_push (tree, *interm_types, intermediate_type);
+ (*multi_step_cvt)++;
+
+ if (insn_data[icode1].operand[0].mode == TYPE_MODE (narrow_vectype))
+ return true;
+
+ prev_mode = intermediate_mode;
+ optab1 = interm_optab;
}
- *code1 = c1;
- return true;
+ VEC_free (tree, heap, *interm_types);
+ return false;
}
diff --git a/gcc/tree-vectorizer.h b/gcc/tree-vectorizer.h
index 6703edb5ee0..927c0bd8cb5 100644
--- a/gcc/tree-vectorizer.h
+++ b/gcc/tree-vectorizer.h
@@ -73,15 +73,15 @@ enum vect_def_type {
/************************************************************************
SLP
************************************************************************/
+typedef void *slp_void_p;
+DEF_VEC_P (slp_void_p);
+DEF_VEC_ALLOC_P (slp_void_p, heap);
-/* A computation tree of an SLP instance. Each node corresponds to a group of
+/* A computation tree of an SLP instance. Each node corresponds to a group of
stmts to be packed in a SIMD stmt. */
typedef struct _slp_tree {
- /* Only binary and unary operations are supported. LEFT child corresponds to
- the first operand and RIGHT child to the second if the operation is
- binary. */
- struct _slp_tree *left;
- struct _slp_tree *right;
+ /* Nodes that contain def-stmts of this node statements operands. */
+ VEC (slp_void_p, heap) *children;
/* A group of scalar stmts to be vectorized together. */
VEC (gimple, heap) *stmts;
/* Vectorized stmt/s. */
@@ -146,14 +146,32 @@ DEF_VEC_ALLOC_P(slp_instance, heap);
#define SLP_INSTANCE_LOADS(S) (S)->loads
#define SLP_INSTANCE_FIRST_LOAD_STMT(S) (S)->first_load
-#define SLP_TREE_LEFT(S) (S)->left
-#define SLP_TREE_RIGHT(S) (S)->right
+#define SLP_TREE_CHILDREN(S) (S)->children
#define SLP_TREE_SCALAR_STMTS(S) (S)->stmts
#define SLP_TREE_VEC_STMTS(S) (S)->vec_stmts
#define SLP_TREE_NUMBER_OF_VEC_STMTS(S) (S)->vec_stmts_size
#define SLP_TREE_OUTSIDE_OF_LOOP_COST(S) (S)->cost.outside_of_loop
#define SLP_TREE_INSIDE_OF_LOOP_COST(S) (S)->cost.inside_of_loop
+/* 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
+ node. */
+typedef struct _slp_oprnd_info
+{
+ /* Def-stmts for the operands. */
+ VEC (gimple, heap) *def_stmts;
+ /* Information about the first statement, its vector def-type, type, the
+ operand itself in case it's constant, and an indication if it's a pattern
+ stmt. */
+ enum vect_def_type first_dt;
+ tree first_def_type;
+ tree first_const_oprnd;
+ bool first_pattern;
+} *slp_oprnd_info;
+
+DEF_VEC_P(slp_oprnd_info);
+DEF_VEC_ALLOC_P(slp_oprnd_info, heap);
+
typedef struct _vect_peel_info
{
@@ -517,6 +535,9 @@ typedef struct _stmt_vec_info {
/* Is this statement vectorizable or should it be skipped in (partial)
vectorization. */
bool vectorizable;
+
+ /* For loads only, true if this is a gather load. */
+ bool gather_p;
} *stmt_vec_info;
/* Access Functions. */
@@ -530,6 +551,7 @@ typedef struct _stmt_vec_info {
#define STMT_VINFO_VEC_STMT(S) (S)->vectorized_stmt
#define STMT_VINFO_VECTORIZABLE(S) (S)->vectorizable
#define STMT_VINFO_DATA_REF(S) (S)->data_ref_info
+#define STMT_VINFO_GATHER_P(S) (S)->gather_p
#define STMT_VINFO_DR_BASE_ADDRESS(S) (S)->dr_base_address
#define STMT_VINFO_DR_INIT(S) (S)->dr_init
@@ -819,11 +841,13 @@ extern bool vect_transform_stmt (gimple, gimple_stmt_iterator *,
extern void vect_remove_stores (gimple);
extern bool vect_analyze_stmt (gimple, bool *, slp_tree);
extern bool vectorizable_condition (gimple, gimple_stmt_iterator *, gimple *,
- tree, int);
+ tree, int, slp_tree);
extern void vect_get_load_cost (struct data_reference *, int, bool,
unsigned int *, unsigned int *);
extern void vect_get_store_cost (struct data_reference *, int, unsigned int *);
extern bool vect_supportable_shift (enum tree_code, tree);
+extern void vect_get_vec_defs (tree, tree, gimple, VEC (tree, heap) **,
+ VEC (tree, heap) **, slp_tree, int);
/* In tree-vect-data-refs.c. */
extern bool vect_can_force_dr_alignment_p (const_tree, unsigned int);
@@ -838,6 +862,8 @@ extern bool vect_analyze_data_refs_alignment (loop_vec_info, bb_vec_info);
extern bool vect_verify_datarefs_alignment (loop_vec_info, bb_vec_info);
extern bool vect_analyze_data_ref_accesses (loop_vec_info, bb_vec_info);
extern bool vect_prune_runtime_alias_test_list (loop_vec_info);
+extern tree vect_check_gather (gimple, loop_vec_info, tree *, tree *,
+ int *);
extern bool vect_analyze_data_refs (loop_vec_info, bb_vec_info, int *);
extern tree vect_create_data_ref_ptr (gimple, tree, struct loop *, tree,
tree *, gimple_stmt_iterator *,
@@ -891,8 +917,9 @@ extern void vect_update_slp_costs_according_to_vf (loop_vec_info);
extern bool vect_analyze_slp (loop_vec_info, bb_vec_info);
extern bool vect_make_slp_decision (loop_vec_info);
extern void vect_detect_hybrid_slp (loop_vec_info);
-extern void vect_get_slp_defs (tree, tree, slp_tree, VEC (tree,heap) **,
- VEC (tree,heap) **, int);
+extern void vect_get_slp_defs (VEC (tree, heap) *, slp_tree,
+ VEC (slp_void_p, heap) **, int);
+
extern LOC find_bb_location (basic_block);
extern bb_vec_info vect_slp_analyze_bb (basic_block);
extern void vect_slp_transform_bb (basic_block);
diff --git a/gcc/tree.h b/gcc/tree.h
index 23108018236..3e1e225bd4e 100644
--- a/gcc/tree.h
+++ b/gcc/tree.h
@@ -1527,6 +1527,7 @@ struct GTY(()) tree_fixed_cst {
};
/* In a STRING_CST */
+/* In C terms, this is sizeof, not strlen. */
#define TREE_STRING_LENGTH(NODE) (STRING_CST_CHECK (NODE)->string.length)
#define TREE_STRING_POINTER(NODE) \
((const char *)(STRING_CST_CHECK (NODE)->string.str))
@@ -2699,7 +2700,9 @@ struct function;
nodes, this points to either the FUNCTION_DECL for the containing
function, the RECORD_TYPE or UNION_TYPE for the containing type, or
NULL_TREE or a TRANSLATION_UNIT_DECL if the given decl has "file
- scope". */
+ scope". In particular, for VAR_DECLs which are virtual table pointers
+ (they have DECL_VIRTUAL set), we use DECL_CONTEXT to determine the type
+ they belong to. */
#define DECL_CONTEXT(NODE) (DECL_MINIMAL_CHECK (NODE)->decl_minimal.context)
#define DECL_FIELD_CONTEXT(NODE) \
(FIELD_DECL_CHECK (NODE)->decl_minimal.context)
diff --git a/gcc/var-tracking.c b/gcc/var-tracking.c
index 11d4efdcdc2..95bc02b183c 100644
--- a/gcc/var-tracking.c
+++ b/gcc/var-tracking.c
@@ -9517,6 +9517,12 @@ vt_initialize (void)
return true;
}
+/* This is *not* reset after each function. It gives each
+ NOTE_INSN_DELETED_DEBUG_LABEL in the entire compilation
+ a unique label number. */
+
+static int debug_label_num = 1;
+
/* Get rid of all debug insns from the insn stream. */
static void
@@ -9532,7 +9538,22 @@ delete_debug_insns (void)
{
FOR_BB_INSNS_SAFE (bb, insn, next)
if (DEBUG_INSN_P (insn))
- delete_insn (insn);
+ {
+ tree decl = INSN_VAR_LOCATION_DECL (insn);
+ if (TREE_CODE (decl) == LABEL_DECL
+ && DECL_NAME (decl)
+ && !DECL_RTL_SET_P (decl))
+ {
+ PUT_CODE (insn, NOTE);
+ NOTE_KIND (insn) = NOTE_INSN_DELETED_DEBUG_LABEL;
+ NOTE_DELETED_LABEL_NAME (insn)
+ = IDENTIFIER_POINTER (DECL_NAME (decl));
+ SET_DECL_RTL (decl, insn);
+ CODE_LABEL_NUMBER (insn) = debug_label_num++;
+ }
+ else
+ delete_insn (insn);
+ }
}
}