[meta-freescale] [PATCH 11/18] gcc : add 4.9 version

Chunrong Guo B40290 at freescale.com
Thu Dec 28 02:05:31 PST 2017


From: Chunrong Guo <chunrong.guo at nxp.com>

*ppc machine only  support gcc 4.9 version

Signed-off-by: Chunrong Guo <chunrong.guo at nxp.com>
---
 recipes-devtools/gcc/gcc-4.9.inc                   |  129 +
 .../0001-gcc-4.3.1-ARCH_FLAGS_FOR_TARGET.patch     |   42 +
 .../gcc/gcc-4.9/0001.gcc.e6500-FSF-49x.patch       | 2613 +++++++++++
 .../gcc/gcc-4.9/0002-uclibc-conf.patch             |   53 +
 .../gcc/gcc-4.9/0002.gcc.builtin_isel-49x.patch    | 1112 +++++
 .../0003-gcc-uclibc-locale-ctype_touplow_t.patch   |   87 +
 .../gcc/gcc-4.9/0003.gcc.widen_types-49x.patch     | 1531 +++++++
 .../gcc/gcc-4.9/0004-uclibc-locale.patch           | 2862 +++++++++++++
 .../gcc/gcc-4.9/0004.gcc.extelim-v4-49x.patch      | 4526 ++++++++++++++++++++
 .../gcc/gcc-4.9/0005-uclibc-locale-no__x.patch     |  257 ++
 .../0005.gcc.extelim_vrp_kugan-v1-49x.patch        |  709 +++
 .../gcc/gcc-4.9/0006-uclibc-locale-wchar_fix.patch |   68 +
 .../gcc-4.9/0006.gcc.opt-array-offset-49x.patch    |  366 ++
 .../gcc/gcc-4.9/0007-uclibc-locale-update.patch    |  542 +++
 .../gcc/gcc-4.9/0007.gcc.aeabi-49x.patch           |  440 ++
 .../gcc/gcc-4.9/0008-missing-execinfo_h.patch      |   28 +
 .../gcc-4.9/0008.gcc.fix_regalloc_for_482.patch    |   23 +
 .../gcc/gcc-4.9/0009-c99-snprintf.patch            |   28 +
 .../gcc/gcc-4.9/0009.gcc.rm_slow_tests-47.patch    |   67 +
 .../gcc/gcc-4.9/0010-c99-complex-ugly-hack.patch   |   29 +
 .../gcc/gcc-4.9/0010.gcc.fix_mingw32.patch         |   12 +
 .../gcc/gcc-4.9/0011-index_macro.patch             |   44 +
 .../gcc-4.9/0011.gcc.no_power_builtins-48.patch    |   24 +
 .../gcc/gcc-4.9/0012.gcc.ld_unaligned-460.patch    |   32 +
 .../gcc/gcc-4.9/0013-libstdc-namespace.patch       |   54 +
 .../gcc-4.9/0013.gcc.local_unaligned_altivec.patch |   32 +
 recipes-devtools/gcc/gcc-4.9/0014-sh-pr24836.patch |   45 +
 .../gcc/gcc-4.9/0014.gcc.soft_float-470.patch      |   16 +
 ...GET_ENDIAN_OPTION-for-determining-MULTILI.patch |   47 +
 .../gcc/gcc-4.9/0015.gcc.case_values-48.patch      |   43 +
 .../0016-gcc-poison-system-directories.patch       |  190 +
 .../0016.gcc.fix_pr63854_pass_manager.patch        |   22 +
 .../gcc/gcc-4.9/0017-gcc-poison-dir-extend.patch   |   39 +
 .../gcc/gcc-4.9/0017.gcc.builtin_isel_doc.patch    |  109 +
 .../0018-gcc-4.3.3-SYSROOT_CFLAGS_FOR_TARGET.patch |   73 +
 .../gcc/gcc-4.9/0018.gcc.experimental_move.patch   |   32 +
 .../gcc/gcc-4.9/0019-64-bit-multilib-hack.patch    |   82 +
 .../gcc/gcc-4.9/0019.gcc.e5500_mfocr.patch         |  181 +
 .../gcc/gcc-4.9/0020-optional-libstdc.patch        |   98 +
 .../0020.gcc.load_on_store_bypass-48x.patch        |  137 +
 ...0021-gcc-disable-MASK_RELAX_PIC_CALLS-bit.patch |   59 +
 .../gcc/gcc-4.9/0021.gcc.fix_constvector.patch     |   43 +
 .../gcc/gcc-4.9/0022-COLLECT_GCC_OPTIONS.patch     |   38 +
 .../gcc-4.9/0022.gcc.fix_pr63908_unwind_info.patch |  170 +
 ...efaults.h-in-B-instead-of-S-and-t-oe-in-B.patch |   96 +
 .../gcc-4.9/0023.gcc.fix_pr60158_fixup_table.patch |  121 +
 .../gcc/gcc-4.9/0024-PR-target-32219.patch         |   62 +
 ...0024.gcc.have-pre-modify-disp-support-49x.patch | 1078 +++++
 .../gcc-4.9/0025-fortran-cross-compile-hack.patch  |   46 +
 ...gcc.fix_ENGR00298583_dwarf-vector-reg_49x.patch |  113 +
 .../gcc/gcc-4.9/0026-libgcc-sjlj-check.patch       |   74 +
 ...26.gcc.fix_MTWX51605-memset-array-init_48.patch |  129 +
 .../gcc/gcc-4.9/0027-cpp-honor-sysroot.patch       |   54 +
 ...027.gcc.fix_altivec_constant_alignment-v2.patch |   33 +
 .../gcc-4.9/0028-MIPS64-Default-to-N64-ABI.patch   |   31 +
 .../gcc-4.9/0028.gcc.fix_altivec_reload_gs8.patch  |   29 +
 ...C_DYNAMIC_LINKER-and-UCLIBC_DYNAMIC_LINKE.patch |  228 +
 .../gcc-4.9/0029.gcc.fix_postfix_gimplifier.patch  |   92 +
 ...0030-gcc-Fix-argument-list-too-long-error.patch |   40 +
 .../gcc-4.9/0030.gcc.fix_adjust_address_cost.patch |  346 ++
 .../gcc/gcc-4.9/0031-Disable-sdt.patch             |  113 +
 .../0031.gcc.fix_adjust_sched_loopinv_cost.patch   |  154 +
 recipes-devtools/gcc/gcc-4.9/0032-libtool.patch    |   42 +
 .../0032.gcc.fix_e5500_mulli_pipeline.patch        |   36 +
 ...4-pass-fix-v4bx-to-linker-to-support-EABI.patch |   40 +
 .../0033.gcc.fix_e500mc_addi_pipeline.patch        |   44 +
 ...tilib-config-files-from-B-instead-of-usin.patch |  102 +
 .../0034.gcc.fix_ENGR00292364_debug_frame.patch    |   63 +
 .../gcc-4.9/0035.gcc.fix_ENGR00215936_49x.patch    |  159 +
 .../0036.gcc.enable_soft_multilib-49x.patch        |   23 +
 .../gcc/gcc-4.9/0037.gcc.fix_49x-doc.patch         |   30 +
 .../gcc-4.9/0038.gcc.fix_emulation_spec_48.patch   |   56 +
 .../gcc/gcc-4.9/0039.gcc.create_maeabi.patch       |  746 ++++
 .../gcc/gcc-4.9/0040-fix-g++-sysroot.patch         |   40 +
 .../gcc/gcc-4.9/0040.gcc.rm_e500v2_loops_48.patch  |  795 ++++
 .../gcc/gcc-4.9/0041-libtool-avoid-libdir.patch    |   19 +
 .../0041.gcc.fix_e5500-e6500-aeabi-multi-lib.patch |   46 +
 .../gcc/gcc-4.9/0042.gcc.fix_ivopts.patch          |  157 +
 recipes-devtools/gcc/gcc-4.9/0043-cpp.patch        |   40 +
 .../gcc-4.9/0043.gcc.sysroot_spec_only_linux.patch |   30 +
 recipes-devtools/gcc/gcc-4.9/0044-gengtypes.patch  |   97 +
 .../gcc/gcc-4.9/0046-libatomic-deptracking.patch   |   41 +
 recipes-devtools/gcc/gcc-4.9/0047-repomembug.patch |   53 +
 ...AltiVec-generation-on-powepc-linux-target.patch |   42 +
 ...Use-dbx_reg_number-for-spanning-registers.patch |   80 +
 recipes-devtools/gcc/gcc-4.9/0051-eabispe.patch    |   23 +
 ...hook-to-override-DWARF2-frame-register-si.patch |  138 +
 ...fault-from-calling-free-on-non-malloc-d-a.patch |   66 +
 ...Makefile.in-fix-parallel-building-failure.patch |   61 +
 .../gcc-4.9/0055-dwarf-reg-processing-helper.patch |  148 +
 .../0056-define-default-cfa-register-mapping.patch |   75 +
 .../gcc/gcc-4.9/0057-aarch64-config.patch          |   32 +
 .../gcc/gcc-4.9/0058-gcc-r212171.patch             |  113 +
 .../0059-gcc-PR-rtl-optimization-63348.patch       |   59 +
 ...e500-double-in-SPE_SIMD_REGNO_P-registers.patch |   55 +
 .../gcc/gcc-4.9/0061-target-gcc-includedir.patch   |   81 +
 ...IBS_DIR-replacement-instead-of-hardcoding.patch |   24 +
 .../gcc/gcc-4.9/0063-nativesdk-gcc-support.patch   |  198 +
 .../0064-handle-target-sysroot-multilib.patch      |   88 +
 ...-gcc-483-universal-initializer-no-warning.patch |  107 +
 .../qoriq-ppc/0019-64-bit-multilib-hack.patch      |   65 +
 ...AltiVec-generation-on-powepc-linux-target.patch |   43 +
 .../qoriq-ppc/0066-cxxflags-for-build.patch        |  126 +
 recipes-devtools/gcc/gcc-configure-common.inc      |  129 +
 recipes-devtools/gcc/gcc-cross-canadian.inc        |  177 +
 recipes-devtools/gcc/gcc-cross-canadian_4.9.bb     |    5 +
 .../gcc/gcc-cross-canadian_4.9.bbappend            |   11 +
 recipes-devtools/gcc/gcc-cross-initial.inc         |   89 +
 recipes-devtools/gcc/gcc-cross-initial_4.9.bb      |    2 +
 .../gcc/gcc-cross-initial_4.9.bbappend             |    1 +
 recipes-devtools/gcc/gcc-cross.inc                 |  216 +
 recipes-devtools/gcc/gcc-cross_4.9.bb              |    3 +
 recipes-devtools/gcc/gcc-cross_4.9.bbappend        |    5 +
 recipes-devtools/gcc/gcc-crosssdk-initial.inc      |   10 +
 recipes-devtools/gcc/gcc-crosssdk-initial_4.9.bb   |    3 +
 .../gcc/gcc-crosssdk-initial_4.9.bbappend          |    1 +
 recipes-devtools/gcc/gcc-crosssdk.inc              |   12 +
 recipes-devtools/gcc/gcc-crosssdk_4.9.bb           |    2 +
 recipes-devtools/gcc/gcc-crosssdk_4.9.bbappend     |    1 +
 recipes-devtools/gcc/gcc-fsl.inc                   |   70 +
 recipes-devtools/gcc/gcc-multilib-config.inc       |  228 +
 recipes-devtools/gcc/gcc-runtime_4.9.bb            |    3 +
 recipes-devtools/gcc/gcc-runtime_4.9.bbappend      |    1 +
 recipes-devtools/gcc/gcc-sanitizers.inc            |  119 +
 recipes-devtools/gcc/gcc-sanitizers_4.9.bb         |    2 +
 recipes-devtools/gcc/gcc-sanitizers_4.9.bbappend   |    1 +
 recipes-devtools/gcc/gcc-shared-source.inc         |   11 +
 recipes-devtools/gcc/gcc-source.inc                |   36 +
 recipes-devtools/gcc/gcc-source_4.9.bb             |    4 +
 recipes-devtools/gcc/gcc-source_4.9.bbappend       |    1 +
 recipes-devtools/gcc/gcc-target.inc                |  214 +
 recipes-devtools/gcc/gcc_4.9.bb                    |   13 +
 recipes-devtools/gcc/gcc_4.9.bbappend              |    1 +
 recipes-devtools/gcc/libgcc-common.inc             |  144 +
 recipes-devtools/gcc/libgcc-initial_4.9.bb         |    2 +
 recipes-devtools/gcc/libgcc-initial_4.9.bbappend   |    1 +
 recipes-devtools/gcc/libgcc_4.9.bb                 |    2 +
 recipes-devtools/gcc/libgcc_4.9.bbappend           |    1 +
 recipes-devtools/gcc/libgfortran.inc               |   74 +
 recipes-devtools/gcc/libgfortran_4.9.bb            |    3 +
 recipes-devtools/gcc/libgfortran_4.9.bbappend      |    1 +
 141 files changed, 25855 insertions(+)
 create mode 100644 recipes-devtools/gcc/gcc-4.9.inc
 create mode 100644 recipes-devtools/gcc/gcc-4.9/0001-gcc-4.3.1-ARCH_FLAGS_FOR_TARGET.patch
 create mode 100644 recipes-devtools/gcc/gcc-4.9/0001.gcc.e6500-FSF-49x.patch
 create mode 100644 recipes-devtools/gcc/gcc-4.9/0002-uclibc-conf.patch
 create mode 100644 recipes-devtools/gcc/gcc-4.9/0002.gcc.builtin_isel-49x.patch
 create mode 100644 recipes-devtools/gcc/gcc-4.9/0003-gcc-uclibc-locale-ctype_touplow_t.patch
 create mode 100644 recipes-devtools/gcc/gcc-4.9/0003.gcc.widen_types-49x.patch
 create mode 100644 recipes-devtools/gcc/gcc-4.9/0004-uclibc-locale.patch
 create mode 100644 recipes-devtools/gcc/gcc-4.9/0004.gcc.extelim-v4-49x.patch
 create mode 100644 recipes-devtools/gcc/gcc-4.9/0005-uclibc-locale-no__x.patch
 create mode 100644 recipes-devtools/gcc/gcc-4.9/0005.gcc.extelim_vrp_kugan-v1-49x.patch
 create mode 100644 recipes-devtools/gcc/gcc-4.9/0006-uclibc-locale-wchar_fix.patch
 create mode 100644 recipes-devtools/gcc/gcc-4.9/0006.gcc.opt-array-offset-49x.patch
 create mode 100644 recipes-devtools/gcc/gcc-4.9/0007-uclibc-locale-update.patch
 create mode 100644 recipes-devtools/gcc/gcc-4.9/0007.gcc.aeabi-49x.patch
 create mode 100644 recipes-devtools/gcc/gcc-4.9/0008-missing-execinfo_h.patch
 create mode 100644 recipes-devtools/gcc/gcc-4.9/0008.gcc.fix_regalloc_for_482.patch
 create mode 100644 recipes-devtools/gcc/gcc-4.9/0009-c99-snprintf.patch
 create mode 100644 recipes-devtools/gcc/gcc-4.9/0009.gcc.rm_slow_tests-47.patch
 create mode 100644 recipes-devtools/gcc/gcc-4.9/0010-c99-complex-ugly-hack.patch
 create mode 100644 recipes-devtools/gcc/gcc-4.9/0010.gcc.fix_mingw32.patch
 create mode 100644 recipes-devtools/gcc/gcc-4.9/0011-index_macro.patch
 create mode 100644 recipes-devtools/gcc/gcc-4.9/0011.gcc.no_power_builtins-48.patch
 create mode 100644 recipes-devtools/gcc/gcc-4.9/0012.gcc.ld_unaligned-460.patch
 create mode 100644 recipes-devtools/gcc/gcc-4.9/0013-libstdc-namespace.patch
 create mode 100644 recipes-devtools/gcc/gcc-4.9/0013.gcc.local_unaligned_altivec.patch
 create mode 100644 recipes-devtools/gcc/gcc-4.9/0014-sh-pr24836.patch
 create mode 100644 recipes-devtools/gcc/gcc-4.9/0014.gcc.soft_float-470.patch
 create mode 100644 recipes-devtools/gcc/gcc-4.9/0015-arm-Use-TARGET_ENDIAN_OPTION-for-determining-MULTILI.patch
 create mode 100644 recipes-devtools/gcc/gcc-4.9/0015.gcc.case_values-48.patch
 create mode 100644 recipes-devtools/gcc/gcc-4.9/0016-gcc-poison-system-directories.patch
 create mode 100644 recipes-devtools/gcc/gcc-4.9/0016.gcc.fix_pr63854_pass_manager.patch
 create mode 100644 recipes-devtools/gcc/gcc-4.9/0017-gcc-poison-dir-extend.patch
 create mode 100644 recipes-devtools/gcc/gcc-4.9/0017.gcc.builtin_isel_doc.patch
 create mode 100644 recipes-devtools/gcc/gcc-4.9/0018-gcc-4.3.3-SYSROOT_CFLAGS_FOR_TARGET.patch
 create mode 100644 recipes-devtools/gcc/gcc-4.9/0018.gcc.experimental_move.patch
 create mode 100644 recipes-devtools/gcc/gcc-4.9/0019-64-bit-multilib-hack.patch
 create mode 100644 recipes-devtools/gcc/gcc-4.9/0019.gcc.e5500_mfocr.patch
 create mode 100644 recipes-devtools/gcc/gcc-4.9/0020-optional-libstdc.patch
 create mode 100644 recipes-devtools/gcc/gcc-4.9/0020.gcc.load_on_store_bypass-48x.patch
 create mode 100644 recipes-devtools/gcc/gcc-4.9/0021-gcc-disable-MASK_RELAX_PIC_CALLS-bit.patch
 create mode 100644 recipes-devtools/gcc/gcc-4.9/0021.gcc.fix_constvector.patch
 create mode 100644 recipes-devtools/gcc/gcc-4.9/0022-COLLECT_GCC_OPTIONS.patch
 create mode 100644 recipes-devtools/gcc/gcc-4.9/0022.gcc.fix_pr63908_unwind_info.patch
 create mode 100644 recipes-devtools/gcc/gcc-4.9/0023-Use-the-defaults.h-in-B-instead-of-S-and-t-oe-in-B.patch
 create mode 100644 recipes-devtools/gcc/gcc-4.9/0023.gcc.fix_pr60158_fixup_table.patch
 create mode 100644 recipes-devtools/gcc/gcc-4.9/0024-PR-target-32219.patch
 create mode 100644 recipes-devtools/gcc/gcc-4.9/0024.gcc.have-pre-modify-disp-support-49x.patch
 create mode 100644 recipes-devtools/gcc/gcc-4.9/0025-fortran-cross-compile-hack.patch
 create mode 100644 recipes-devtools/gcc/gcc-4.9/0025.gcc.fix_ENGR00298583_dwarf-vector-reg_49x.patch
 create mode 100644 recipes-devtools/gcc/gcc-4.9/0026-libgcc-sjlj-check.patch
 create mode 100644 recipes-devtools/gcc/gcc-4.9/0026.gcc.fix_MTWX51605-memset-array-init_48.patch
 create mode 100644 recipes-devtools/gcc/gcc-4.9/0027-cpp-honor-sysroot.patch
 create mode 100644 recipes-devtools/gcc/gcc-4.9/0027.gcc.fix_altivec_constant_alignment-v2.patch
 create mode 100644 recipes-devtools/gcc/gcc-4.9/0028-MIPS64-Default-to-N64-ABI.patch
 create mode 100644 recipes-devtools/gcc/gcc-4.9/0028.gcc.fix_altivec_reload_gs8.patch
 create mode 100644 recipes-devtools/gcc/gcc-4.9/0029-Define-GLIBC_DYNAMIC_LINKER-and-UCLIBC_DYNAMIC_LINKE.patch
 create mode 100644 recipes-devtools/gcc/gcc-4.9/0029.gcc.fix_postfix_gimplifier.patch
 create mode 100644 recipes-devtools/gcc/gcc-4.9/0030-gcc-Fix-argument-list-too-long-error.patch
 create mode 100644 recipes-devtools/gcc/gcc-4.9/0030.gcc.fix_adjust_address_cost.patch
 create mode 100644 recipes-devtools/gcc/gcc-4.9/0031-Disable-sdt.patch
 create mode 100644 recipes-devtools/gcc/gcc-4.9/0031.gcc.fix_adjust_sched_loopinv_cost.patch
 create mode 100644 recipes-devtools/gcc/gcc-4.9/0032-libtool.patch
 create mode 100644 recipes-devtools/gcc/gcc-4.9/0032.gcc.fix_e5500_mulli_pipeline.patch
 create mode 100644 recipes-devtools/gcc/gcc-4.9/0033-gcc-armv4-pass-fix-v4bx-to-linker-to-support-EABI.patch
 create mode 100644 recipes-devtools/gcc/gcc-4.9/0033.gcc.fix_e500mc_addi_pipeline.patch
 create mode 100644 recipes-devtools/gcc/gcc-4.9/0034-Use-the-multilib-config-files-from-B-instead-of-usin.patch
 create mode 100644 recipes-devtools/gcc/gcc-4.9/0034.gcc.fix_ENGR00292364_debug_frame.patch
 create mode 100644 recipes-devtools/gcc/gcc-4.9/0035.gcc.fix_ENGR00215936_49x.patch
 create mode 100644 recipes-devtools/gcc/gcc-4.9/0036.gcc.enable_soft_multilib-49x.patch
 create mode 100644 recipes-devtools/gcc/gcc-4.9/0037.gcc.fix_49x-doc.patch
 create mode 100644 recipes-devtools/gcc/gcc-4.9/0038.gcc.fix_emulation_spec_48.patch
 create mode 100644 recipes-devtools/gcc/gcc-4.9/0039.gcc.create_maeabi.patch
 create mode 100644 recipes-devtools/gcc/gcc-4.9/0040-fix-g++-sysroot.patch
 create mode 100644 recipes-devtools/gcc/gcc-4.9/0040.gcc.rm_e500v2_loops_48.patch
 create mode 100644 recipes-devtools/gcc/gcc-4.9/0041-libtool-avoid-libdir.patch
 create mode 100644 recipes-devtools/gcc/gcc-4.9/0041.gcc.fix_e5500-e6500-aeabi-multi-lib.patch
 create mode 100644 recipes-devtools/gcc/gcc-4.9/0042.gcc.fix_ivopts.patch
 create mode 100644 recipes-devtools/gcc/gcc-4.9/0043-cpp.patch
 create mode 100644 recipes-devtools/gcc/gcc-4.9/0043.gcc.sysroot_spec_only_linux.patch
 create mode 100644 recipes-devtools/gcc/gcc-4.9/0044-gengtypes.patch
 create mode 100644 recipes-devtools/gcc/gcc-4.9/0046-libatomic-deptracking.patch
 create mode 100644 recipes-devtools/gcc/gcc-4.9/0047-repomembug.patch
 create mode 100644 recipes-devtools/gcc/gcc-4.9/0049-Enable-SPE-AltiVec-generation-on-powepc-linux-target.patch
 create mode 100644 recipes-devtools/gcc/gcc-4.9/0050-Revert-Use-dbx_reg_number-for-spanning-registers.patch
 create mode 100644 recipes-devtools/gcc/gcc-4.9/0051-eabispe.patch
 create mode 100644 recipes-devtools/gcc/gcc-4.9/0052-Add-target-hook-to-override-DWARF2-frame-register-si.patch
 create mode 100644 recipes-devtools/gcc/gcc-4.9/0053-gcc-fix-segfault-from-calling-free-on-non-malloc-d-a.patch
 create mode 100644 recipes-devtools/gcc/gcc-4.9/0054-gcc-Makefile.in-fix-parallel-building-failure.patch
 create mode 100644 recipes-devtools/gcc/gcc-4.9/0055-dwarf-reg-processing-helper.patch
 create mode 100644 recipes-devtools/gcc/gcc-4.9/0056-define-default-cfa-register-mapping.patch
 create mode 100644 recipes-devtools/gcc/gcc-4.9/0057-aarch64-config.patch
 create mode 100644 recipes-devtools/gcc/gcc-4.9/0058-gcc-r212171.patch
 create mode 100644 recipes-devtools/gcc/gcc-4.9/0059-gcc-PR-rtl-optimization-63348.patch
 create mode 100644 recipes-devtools/gcc/gcc-4.9/0060-Only-allow-e500-double-in-SPE_SIMD_REGNO_P-registers.patch
 create mode 100644 recipes-devtools/gcc/gcc-4.9/0061-target-gcc-includedir.patch
 create mode 100644 recipes-devtools/gcc/gcc-4.9/0062-Use-SYSTEMLIBS_DIR-replacement-instead-of-hardcoding.patch
 create mode 100644 recipes-devtools/gcc/gcc-4.9/0063-nativesdk-gcc-support.patch
 create mode 100644 recipes-devtools/gcc/gcc-4.9/0064-handle-target-sysroot-multilib.patch
 create mode 100644 recipes-devtools/gcc/gcc-4.9/0065-gcc-483-universal-initializer-no-warning.patch
 create mode 100644 recipes-devtools/gcc/gcc-4.9/qoriq-ppc/0019-64-bit-multilib-hack.patch
 create mode 100644 recipes-devtools/gcc/gcc-4.9/qoriq-ppc/0049-Enable-SPE-AltiVec-generation-on-powepc-linux-target.patch
 create mode 100644 recipes-devtools/gcc/gcc-4.9/qoriq-ppc/0066-cxxflags-for-build.patch
 create mode 100644 recipes-devtools/gcc/gcc-configure-common.inc
 create mode 100644 recipes-devtools/gcc/gcc-cross-canadian.inc
 create mode 100644 recipes-devtools/gcc/gcc-cross-canadian_4.9.bb
 create mode 100644 recipes-devtools/gcc/gcc-cross-canadian_4.9.bbappend
 create mode 100644 recipes-devtools/gcc/gcc-cross-initial.inc
 create mode 100644 recipes-devtools/gcc/gcc-cross-initial_4.9.bb
 create mode 100644 recipes-devtools/gcc/gcc-cross-initial_4.9.bbappend
 create mode 100644 recipes-devtools/gcc/gcc-cross.inc
 create mode 100644 recipes-devtools/gcc/gcc-cross_4.9.bb
 create mode 100644 recipes-devtools/gcc/gcc-cross_4.9.bbappend
 create mode 100644 recipes-devtools/gcc/gcc-crosssdk-initial.inc
 create mode 100644 recipes-devtools/gcc/gcc-crosssdk-initial_4.9.bb
 create mode 100644 recipes-devtools/gcc/gcc-crosssdk-initial_4.9.bbappend
 create mode 100644 recipes-devtools/gcc/gcc-crosssdk.inc
 create mode 100644 recipes-devtools/gcc/gcc-crosssdk_4.9.bb
 create mode 100644 recipes-devtools/gcc/gcc-crosssdk_4.9.bbappend
 create mode 100644 recipes-devtools/gcc/gcc-fsl.inc
 create mode 100644 recipes-devtools/gcc/gcc-multilib-config.inc
 create mode 100644 recipes-devtools/gcc/gcc-runtime_4.9.bb
 create mode 100644 recipes-devtools/gcc/gcc-runtime_4.9.bbappend
 create mode 100644 recipes-devtools/gcc/gcc-sanitizers.inc
 create mode 100644 recipes-devtools/gcc/gcc-sanitizers_4.9.bb
 create mode 100644 recipes-devtools/gcc/gcc-sanitizers_4.9.bbappend
 create mode 100644 recipes-devtools/gcc/gcc-shared-source.inc
 create mode 100644 recipes-devtools/gcc/gcc-source.inc
 create mode 100644 recipes-devtools/gcc/gcc-source_4.9.bb
 create mode 100644 recipes-devtools/gcc/gcc-source_4.9.bbappend
 create mode 100644 recipes-devtools/gcc/gcc-target.inc
 create mode 100644 recipes-devtools/gcc/gcc_4.9.bb
 create mode 100644 recipes-devtools/gcc/gcc_4.9.bbappend
 create mode 100644 recipes-devtools/gcc/libgcc-common.inc
 create mode 100644 recipes-devtools/gcc/libgcc-initial_4.9.bb
 create mode 100644 recipes-devtools/gcc/libgcc-initial_4.9.bbappend
 create mode 100644 recipes-devtools/gcc/libgcc_4.9.bb
 create mode 100644 recipes-devtools/gcc/libgcc_4.9.bbappend
 create mode 100644 recipes-devtools/gcc/libgfortran.inc
 create mode 100644 recipes-devtools/gcc/libgfortran_4.9.bb
 create mode 100644 recipes-devtools/gcc/libgfortran_4.9.bbappend

diff --git a/recipes-devtools/gcc/gcc-4.9.inc b/recipes-devtools/gcc/gcc-4.9.inc
new file mode 100644
index 0000000..5dba399
--- /dev/null
+++ b/recipes-devtools/gcc/gcc-4.9.inc
@@ -0,0 +1,129 @@
+require recipes-devtools/gcc/gcc-common.inc
+
+# Third digit in PV should be incremented after a minor release
+
+PV = "4.9.3"
+
+# BINV should be incremented to a revision after a minor gcc release
+
+BINV = "4.9.3"
+
+FILESEXTRAPATHS =. "${FILE_DIRNAME}/gcc-4.9:"
+
+DEPENDS =+ "mpfr gmp libmpc zlib"
+NATIVEDEPS = "mpfr-native gmp-native libmpc-native zlib-native"
+
+LICENSE = "GPL-3.0-with-GCC-exception & GPLv3"
+
+LIC_FILES_CHKSUM = "\
+    file://COPYING;md5=59530bdf33659b29e73d4adb9f9f6552 \
+    file://COPYING3;md5=d32239bcb673463ab874e80d47fae504 \
+    file://COPYING3.LIB;md5=6a6a8e020838b23406c81b19c1d46df6 \
+    file://COPYING.LIB;md5=2d5025d4aa3495befef8f17206a5b0a1 \
+    file://COPYING.RUNTIME;md5=fe60d87048567d4fe8c8a0ed2448bcc8 \
+"
+
+SRC_URI = "\
+    ${GNU_MIRROR}/gcc/gcc-${PV}/gcc-${PV}.tar.bz2 \
+    file://0001-gcc-4.3.1-ARCH_FLAGS_FOR_TARGET.patch \
+    file://0002-uclibc-conf.patch \
+    file://0003-gcc-uclibc-locale-ctype_touplow_t.patch \
+    file://0004-uclibc-locale.patch \
+    file://0005-uclibc-locale-no__x.patch \
+    file://0006-uclibc-locale-wchar_fix.patch \
+    file://0007-uclibc-locale-update.patch \
+    file://0008-missing-execinfo_h.patch \
+    file://0009-c99-snprintf.patch \
+    file://0010-c99-complex-ugly-hack.patch \
+    file://0011-index_macro.patch \
+    file://0013-libstdc-namespace.patch \
+    file://0014-sh-pr24836.patch \
+    file://0015-arm-Use-TARGET_ENDIAN_OPTION-for-determining-MULTILI.patch \
+    file://0016-gcc-poison-system-directories.patch \
+    file://0017-gcc-poison-dir-extend.patch \
+    file://0018-gcc-4.3.3-SYSROOT_CFLAGS_FOR_TARGET.patch \
+    file://0019-64-bit-multilib-hack.patch \
+    file://0020-optional-libstdc.patch \
+    file://0021-gcc-disable-MASK_RELAX_PIC_CALLS-bit.patch \
+    file://0022-COLLECT_GCC_OPTIONS.patch \
+    file://0023-Use-the-defaults.h-in-B-instead-of-S-and-t-oe-in-B.patch \
+    file://0024-PR-target-32219.patch \
+    file://0025-fortran-cross-compile-hack.patch \
+    file://0026-libgcc-sjlj-check.patch \
+    file://0027-cpp-honor-sysroot.patch \
+    file://0028-MIPS64-Default-to-N64-ABI.patch \
+    file://0029-Define-GLIBC_DYNAMIC_LINKER-and-UCLIBC_DYNAMIC_LINKE.patch \
+    file://0030-gcc-Fix-argument-list-too-long-error.patch \
+    file://0031-Disable-sdt.patch \
+    file://0032-libtool.patch \
+    file://0033-gcc-armv4-pass-fix-v4bx-to-linker-to-support-EABI.patch \
+    file://0034-Use-the-multilib-config-files-from-B-instead-of-usin.patch \
+    file://0040-fix-g++-sysroot.patch \
+    file://0041-libtool-avoid-libdir.patch \
+    file://0043-cpp.patch \
+    file://0044-gengtypes.patch \
+    file://0046-libatomic-deptracking.patch \
+    file://0047-repomembug.patch \
+    file://0049-Enable-SPE-AltiVec-generation-on-powepc-linux-target.patch \
+    file://0050-Revert-Use-dbx_reg_number-for-spanning-registers.patch \
+    file://0051-eabispe.patch \
+    file://0052-Add-target-hook-to-override-DWARF2-frame-register-si.patch \
+    file://0053-gcc-fix-segfault-from-calling-free-on-non-malloc-d-a.patch \
+    file://0054-gcc-Makefile.in-fix-parallel-building-failure.patch \
+    file://0055-dwarf-reg-processing-helper.patch \
+    file://0056-define-default-cfa-register-mapping.patch \
+    file://0057-aarch64-config.patch \
+    file://0058-gcc-r212171.patch \
+    file://0059-gcc-PR-rtl-optimization-63348.patch \
+    file://0060-Only-allow-e500-double-in-SPE_SIMD_REGNO_P-registers.patch \
+    file://0061-target-gcc-includedir.patch \
+    file://0062-Use-SYSTEMLIBS_DIR-replacement-instead-of-hardcoding.patch \
+    file://0063-nativesdk-gcc-support.patch \
+    file://0064-handle-target-sysroot-multilib.patch \
+    file://0065-gcc-483-universal-initializer-no-warning.patch \
+"
+SRC_URI[md5sum] = "6f831b4d251872736e8e9cc09746f327"
+SRC_URI[sha256sum] = "2332b2a5a321b57508b9031354a8503af6fdfb868b8c1748d33028d100a8b67e"
+
+S = "${TMPDIR}/work-shared/gcc-${PV}-${PR}/gcc-${PV}"
+B = "${WORKDIR}/gcc-${PV}/build.${HOST_SYS}.${TARGET_SYS}"
+
+# Language Overrides
+FORTRAN = ""
+JAVA = ""
+
+LTO = "--enable-lto"
+
+EXTRA_OECONF_BASE = "\
+    ${LTO} \
+    --enable-libssp \
+    --disable-bootstrap \
+    --disable-libmudflap \
+    --with-system-zlib \
+    --with-linker-hash-style=${LINKER_HASH_STYLE} \
+    --enable-linker-build-id \
+    --with-ppl=no \
+    --with-cloog=no \
+    --enable-checking=release \
+    --enable-cheaders=c_global \
+"
+
+EXTRA_OECONF_INITIAL = "\
+    --disable-libmudflap \
+    --disable-libgomp \
+    --disable-libssp \
+    --disable-libquadmath \
+    --with-system-zlib \
+    --disable-lto \
+    --disable-plugin \
+    --enable-decimal-float=no \
+"
+
+EXTRA_OECONF_append_libc-uclibc = " --disable-decimal-float "
+
+EXTRA_OECONF_PATHS = "\
+    --with-gxx-include-dir=/not/exist{target_includedir}/c++/${BINV} \
+    --with-sysroot=/not/exist \
+    --with-build-sysroot=${STAGING_DIR_TARGET} \
+"
+INSANE_SKIP_${PN} += "ldflags"
diff --git a/recipes-devtools/gcc/gcc-4.9/0001-gcc-4.3.1-ARCH_FLAGS_FOR_TARGET.patch b/recipes-devtools/gcc/gcc-4.9/0001-gcc-4.3.1-ARCH_FLAGS_FOR_TARGET.patch
new file mode 100644
index 0000000..e588011
--- /dev/null
+++ b/recipes-devtools/gcc/gcc-4.9/0001-gcc-4.3.1-ARCH_FLAGS_FOR_TARGET.patch
@@ -0,0 +1,42 @@
+From bf3d96ae58fa180b8b468d25dc2e0209daca2751 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem at gmail.com>
+Date: Fri, 29 Mar 2013 08:37:11 +0400
+Subject: [PATCH 01/35] gcc-4.3.1: ARCH_FLAGS_FOR_TARGET
+
+Signed-off-by: Khem Raj <raj.khem at gmail.com>
+
+Upstream-Status: Inappropriate [embedded specific]
+---
+ configure    |    2 +-
+ configure.ac |    2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/configure b/configure
+index d809535..1b76c90 100755
+--- a/configure
++++ b/configure
+@@ -7439,7 +7439,7 @@ fi
+ # for target_alias and gcc doesn't manage it consistently.
+ target_configargs="--cache-file=./config.cache ${target_configargs}"
+ 
+-FLAGS_FOR_TARGET=
++FLAGS_FOR_TARGET="$ARCH_FLAGS_FOR_TARGET"
+ case " $target_configdirs " in
+  *" newlib "*)
+   case " $target_configargs " in
+diff --git a/configure.ac b/configure.ac
+index 48ec1aa..89d1d3f 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -2873,7 +2873,7 @@ fi
+ # for target_alias and gcc doesn't manage it consistently.
+ target_configargs="--cache-file=./config.cache ${target_configargs}"
+ 
+-FLAGS_FOR_TARGET=
++FLAGS_FOR_TARGET="$ARCH_FLAGS_FOR_TARGET"
+ case " $target_configdirs " in
+  *" newlib "*)
+   case " $target_configargs " in
+-- 
+1.7.10.4
+
diff --git a/recipes-devtools/gcc/gcc-4.9/0001.gcc.e6500-FSF-49x.patch b/recipes-devtools/gcc/gcc-4.9/0001.gcc.e6500-FSF-49x.patch
new file mode 100644
index 0000000..4d6077b
--- /dev/null
+++ b/recipes-devtools/gcc/gcc-4.9/0001.gcc.e6500-FSF-49x.patch
@@ -0,0 +1,2613 @@
+diff -Naur gcc-4.9.1/gcc/config/rs6000/altivec.h gcc-4.9.1-e6500-FSF/gcc/config/rs6000/altivec.h
+--- gcc-4.9.1/gcc/config/rs6000/altivec.h	2014-03-27 15:07:16.000000000 -0500
++++ gcc-4.9.1-e6500-FSF/gcc/config/rs6000/altivec.h	2014-07-17 02:38:35.039383000 -0500
+@@ -371,6 +371,30 @@
+ #define vec_vupklsw __builtin_vec_vupklsw
+ #endif
+ 
++#ifdef __ALTIVEC2__
++/* New Altivec instructions */
++#define vec_absd __builtin_vec_absd
++#define vec_lvexbx __builtin_vec_lvexbx
++#define vec_lvexhx __builtin_vec_lvexhx
++#define vec_lvexwx __builtin_vec_lvexwx
++#define vec_stvexbx __builtin_vec_stvexbx
++#define vec_stvexhx __builtin_vec_stvexhx
++#define vec_stvexwx __builtin_vec_stvexwx
++#define vec_lvswx __builtin_vec_lvswx
++#define vec_lvswxl __builtin_vec_lvswxl
++#define vec_stvswx __builtin_vec_stvswx
++#define vec_stvswxl __builtin_vec_stvswxl
++#define vec_lvsm __builtin_vec_lvsm
++#define vec_lvtlx __builtin_vec_lvtlx
++#define vec_lvtlxl __builtin_vec_lvtlxl
++#define vec_lvtrx __builtin_vec_lvtrx
++#define vec_lvtrxl __builtin_vec_lvtrxl
++#define vec_stvflx __builtin_vec_stvflx
++#define vec_stvflxl __builtin_vec_stvflxl
++#define vec_stvfrx __builtin_vec_stvfrx
++#define vec_stvfrxl __builtin_vec_stvfrxl
++#endif
++
+ /* Predicates.
+    For C++, we use templates in order to allow non-parenthesized arguments.
+    For C, instead, we use macros since non-parenthesized arguments were
+diff -Naur gcc-4.9.1/gcc/config/rs6000/altivec.md gcc-4.9.1-e6500-FSF/gcc/config/rs6000/altivec.md
+--- gcc-4.9.1/gcc/config/rs6000/altivec.md	2014-04-30 14:30:47.000000000 -0500
++++ gcc-4.9.1-e6500-FSF/gcc/config/rs6000/altivec.md	2014-07-17 02:38:35.041383001 -0500
+@@ -81,9 +81,11 @@
+    UNSPEC_LVSL
+    UNSPEC_LVSR
+    UNSPEC_LVE
++   UNSPEC_LVEX
+    UNSPEC_STVX
+    UNSPEC_STVXL
+    UNSPEC_STVE
++   UNSPEC_STVEX
+    UNSPEC_SET_VSCR
+    UNSPEC_GET_VRSAVE
+    UNSPEC_LVX
+@@ -111,6 +113,19 @@
+    UNSPEC_STVLXL
+    UNSPEC_STVRX
+    UNSPEC_STVRXL
++   UNSPEC_LVTLX
++   UNSPEC_LVTLXL
++   UNSPEC_LVTRX
++   UNSPEC_LVTRXL
++   UNSPEC_STVFLX
++   UNSPEC_STVFLXL
++   UNSPEC_STVFRX
++   UNSPEC_STVFRXL
++   UNSPEC_LVSWX
++   UNSPEC_LVSWXL
++   UNSPEC_STVSWX
++   UNSPEC_STVSWXL
++   UNSPEC_LVSM
+    UNSPEC_VMULWHUB
+    UNSPEC_VMULWLUB
+    UNSPEC_VMULWHSB
+@@ -131,6 +146,9 @@
+    UNSPEC_VUPKLS_V4SF
+    UNSPEC_VUPKHU_V4SF
+    UNSPEC_VUPKLU_V4SF
++   UNSPEC_VABSDUB
++   UNSPEC_VABSDUH
++   UNSPEC_VABSDUW
+    UNSPEC_VGBBD
+    UNSPEC_VMRGH_DIRECT
+    UNSPEC_VMRGL_DIRECT
+@@ -401,6 +419,34 @@
+ 
+ ;; Simple binary operations.
+ 
++;; absd
++(define_insn "altivec_vabsduw"
++  [(set (match_operand:V4SI 0 "register_operand" "=v")
++        (unspec:V4SI [(match_operand:V4SI 1 "register_operand" "v")
++                      (match_operand:V4SI 2 "register_operand" "v")]
++		     UNSPEC_VABSDUW))]
++  "TARGET_ALTIVEC2"
++  "vabsduw %0,%1,%2"
++  [(set_attr "type" "vecsimple")])
++
++(define_insn "altivec_vabsduh"
++  [(set (match_operand:V8HI 0 "register_operand" "=v")
++        (unspec:V8HI [(match_operand:V8HI 1 "register_operand" "v")
++                      (match_operand:V8HI 2 "register_operand" "v")]
++		     UNSPEC_VABSDUH))]
++  "TARGET_ALTIVEC2"
++  "vabsduh %0,%1,%2"
++  [(set_attr "type" "vecsimple")])
++
++(define_insn "altivec_vabsdub"
++  [(set (match_operand:V16QI 0 "register_operand" "=v")
++        (unspec:V16QI [(match_operand:V16QI 1 "register_operand" "v")
++                       (match_operand:V16QI 2 "register_operand" "v")]
++		      UNSPEC_VABSDUB))]
++  "TARGET_ALTIVEC2"
++  "vabsdub %0,%1,%2"
++  [(set_attr "type" "vecsimple")])
++
+ ;; add
+ (define_insn "add<mode>3"
+   [(set (match_operand:VI2 0 "register_operand" "=v")
+@@ -2368,6 +2414,15 @@
+   "lvewx %0,%y1"
+   [(set_attr "type" "vecload")])
+ 
++(define_insn "altivec_lvex<VI_char>x"
++  [(parallel
++    [(set (match_operand:VI 0 "register_operand" "=v")
++         (match_operand:VI 1 "memory_operand" "Z"))
++     (unspec [(const_int 0)] UNSPEC_LVEX)])]
++  "TARGET_ALTIVEC2"
++  "lvex<VI_char>x %0,%y1"
++  [(set_attr "type" "vecload")])
++
+ (define_expand "altivec_lvxl_<mode>"
+   [(parallel
+     [(set (match_operand:VM2 0 "register_operand" "=v")
+@@ -2486,6 +2541,13 @@
+   "stvewx %1,%y0"
+   [(set_attr "type" "vecstore")])
+ 
++(define_insn "altivec_stvex<VI_char>x"
++  [(set (match_operand:<VI_scalar> 0 "memory_operand" "=Z")
++	(unspec:<VI_scalar> [(match_operand:VI 1 "register_operand" "v")] UNSPEC_STVEX))]
++  "TARGET_ALTIVEC2"
++  "stvex<VI_char>x %1,%y0"
++  [(set_attr "type" "vecstore")])
++
+ ;; Generate
+ ;;    xxlxor/vxor SCRATCH0,SCRATCH0,SCRATCH0
+ ;;    vsubu?m SCRATCH2,SCRATCH1,%1
+@@ -3151,6 +3213,116 @@
+   "stvrxl %1,%y0"
+   [(set_attr "type" "vecstore")])
+ 
++(define_insn "altivec_lvtlx"
++  [(set (match_operand:V16QI 0 "register_operand" "=v")
++        (unspec:V16QI [(match_operand 1 "memory_operand" "Z")] 
++		      UNSPEC_LVTLX))]
++  "TARGET_ALTIVEC2"
++  "lvtlx %0,%y1"
++  [(set_attr "type" "vecload")])
++
++(define_insn "altivec_lvtlxl"
++  [(set (match_operand:V16QI 0 "register_operand" "=v")
++        (unspec:V16QI [(match_operand 1 "memory_operand" "Z")] 
++		      UNSPEC_LVTLXL))]
++  "TARGET_ALTIVEC2"
++  "lvtlxl %0,%y1"
++  [(set_attr "type" "vecload")])
++
++(define_insn "altivec_lvtrx"
++  [(set (match_operand:V16QI 0 "register_operand" "=v")
++        (unspec:V16QI [(match_operand 1 "memory_operand" "Z")] 
++		      UNSPEC_LVTRX))]
++  "TARGET_ALTIVEC2"
++  "lvtrx %0,%y1"
++  [(set_attr "type" "vecload")])
++
++(define_insn "altivec_lvtrxl"
++  [(set (match_operand:V16QI 0 "register_operand" "=v")
++        (unspec:V16QI [(match_operand 1 "memory_operand" "Z")] 
++		      UNSPEC_LVTRXL))]
++  "TARGET_ALTIVEC2"
++  "lvtrxl %0,%y1"
++  [(set_attr "type" "vecload")])
++
++(define_insn "altivec_stvflx"
++  [(parallel
++    [(set (match_operand:V16QI 0 "memory_operand" "=Z")
++	  (match_operand:V16QI 1 "register_operand" "v"))
++     (unspec [(const_int 0)] UNSPEC_STVFLX)])]
++  "TARGET_ALTIVEC2"
++  "stvflx %1,%y0"
++  [(set_attr "type" "vecstore")])
++
++(define_insn "altivec_stvflxl"
++  [(parallel
++    [(set (match_operand:V16QI 0 "memory_operand" "=Z")
++	  (match_operand:V16QI 1 "register_operand" "v"))
++     (unspec [(const_int 0)] UNSPEC_STVFLXL)])]
++  "TARGET_ALTIVEC2"
++  "stvflxl %1,%y0"
++  [(set_attr "type" "vecstore")])
++
++(define_insn "altivec_stvfrx"
++  [(parallel
++    [(set (match_operand:V16QI 0 "memory_operand" "=Z")
++	  (match_operand:V16QI 1 "register_operand" "v"))
++     (unspec [(const_int 0)] UNSPEC_STVFRX)])]
++  "TARGET_ALTIVEC2"
++  "stvfrx %1,%y0"
++  [(set_attr "type" "vecstore")])
++
++(define_insn "altivec_stvfrxl"
++  [(parallel
++    [(set (match_operand:V16QI 0 "memory_operand" "=Z")
++	  (match_operand:V16QI 1 "register_operand" "v"))
++     (unspec [(const_int 0)] UNSPEC_STVFRXL)])]
++  "TARGET_ALTIVEC2"
++  "stvfrxl %1,%y0"
++  [(set_attr "type" "vecstore")])
++
++(define_insn "altivec_lvswx"
++  [(set (match_operand:V16QI 0 "register_operand" "=v")
++        (unspec:V16QI [(match_operand 1 "memory_operand" "Z")] 
++		      UNSPEC_LVSWX))]
++  "TARGET_ALTIVEC2"
++  "lvswx %0,%y1"
++  [(set_attr "type" "vecload")])
++
++(define_insn "altivec_lvswxl"
++  [(set (match_operand:V16QI 0 "register_operand" "=v")
++        (unspec:V16QI [(match_operand 1 "memory_operand" "Z")] 
++		      UNSPEC_LVSWXL))]
++  "TARGET_ALTIVEC2"
++  "lvswxl %0,%y1"
++  [(set_attr "type" "vecload")])
++
++(define_insn "altivec_lvsm"
++  [(set (match_operand:V16QI 0 "register_operand" "=v")
++        (unspec:V16QI [(match_operand 1 "memory_operand" "Z")] 
++		      UNSPEC_LVSM))]
++  "TARGET_ALTIVEC2"
++  "lvsm %0,%y1"
++  [(set_attr "type" "vecload")])
++
++(define_insn "altivec_stvswx"
++  [(parallel
++    [(set (match_operand:V16QI 0 "memory_operand" "=Z")
++	  (match_operand:V16QI 1 "register_operand" "v"))
++     (unspec [(const_int 0)] UNSPEC_STVSWX)])]
++  "TARGET_ALTIVEC2"
++  "stvswx %1,%y0"
++  [(set_attr "type" "vecstore")])
++
++(define_insn "altivec_stvswxl"
++  [(parallel
++    [(set (match_operand:V16QI 0 "memory_operand" "=Z")
++	  (match_operand:V16QI 1 "register_operand" "v"))
++     (unspec [(const_int 0)] UNSPEC_STVSWXL)])]
++  "TARGET_ALTIVEC2"
++  "stvswxl %1,%y0"
++  [(set_attr "type" "vecstore")])
++
+ (define_expand "vec_unpacks_float_hi_v8hi"
+  [(set (match_operand:V4SF 0 "register_operand" "")
+         (unspec:V4SF [(match_operand:V8HI 1 "register_operand" "")]
+diff -Naur gcc-4.9.1/gcc/config/rs6000/rs6000-builtin.def gcc-4.9.1-e6500-FSF/gcc/config/rs6000/rs6000-builtin.def
+--- gcc-4.9.1/gcc/config/rs6000/rs6000-builtin.def	2014-06-13 16:56:16.000000000 -0500
++++ gcc-4.9.1-e6500-FSF/gcc/config/rs6000/rs6000-builtin.def	2014-07-17 02:48:57.988383002 -0500
+@@ -632,6 +632,42 @@
+ 		     | RS6000_BTC_BINARY),				\
+ 		    CODE_FOR_ ## ICODE)			/* ICODE */
+ 
++/* Power ISA 2.07 altivec */
++#define BU_ALTIVC2_2(ENUM, NAME, ATTR, ICODE)                          \
++  RS6000_BUILTIN_2 (ALTIVEC_BUILTIN_ ## ENUM,          /* ENUM */      \
++                   "__builtin_altivec_" NAME,          /* NAME */      \
++                   (RS6000_BTM_ALTIVEC                 /* MASK */      \
++                    | RS6000_BTM_ALTIVEC2),                            \
++                   (RS6000_BTC_ ## ATTR                /* ATTR */      \
++                    | RS6000_BTC_BINARY),                              \
++                   CODE_FOR_ ## ICODE)                 /* ICODE */
++
++#define BU_ALTIVC2_X(ENUM, NAME, ATTR)                                 \
++  RS6000_BUILTIN_X (ALTIVEC_BUILTIN_ ## ENUM,          /* ENUM */      \
++                   "__builtin_altivec_" NAME,          /* NAME */      \
++                   (RS6000_BTM_ALTIVEC                 /* MASK */      \
++                    | RS6000_BTM_ALTIVEC2),                            \
++                   (RS6000_BTC_ ## ATTR                /* ATTR */      \
++                    | RS6000_BTC_SPECIAL),                             \
++                   CODE_FOR_nothing)                   /* ICODE */
++
++#define BU_ALTIVC2_OVERLOAD_2(ENUM, NAME)                              \
++  RS6000_BUILTIN_2 (ALTIVEC_BUILTIN_VEC_ ## ENUM,      /* ENUM */      \
++                   "__builtin_vec_" NAME,              /* NAME */      \
++                   (RS6000_BTM_ALTIVEC                 /* MASK */      \
++                    | RS6000_BTM_ALTIVEC2),                            \
++                   (RS6000_BTC_OVERLOADED              /* ATTR */      \
++                    | RS6000_BTC_BINARY),                              \
++                   CODE_FOR_nothing)                   /* ICODE */
++
++#define BU_ALTIVC2_OVERLOAD_X(ENUM, NAME)                              \
++  RS6000_BUILTIN_X (ALTIVEC_BUILTIN_VEC_ ## ENUM,      /* ENUM */      \
++                   "__builtin_vec_" NAME,              /* NAME */      \
++                   (RS6000_BTM_ALTIVEC                 /* MASK */      \
++                    | RS6000_BTM_ALTIVEC2),                            \
++                   (RS6000_BTC_OVERLOADED              /* ATTR */      \
++                    | RS6000_BTC_SPECIAL),                             \
++                   CODE_FOR_nothing)                   /* ICODE */
+ #endif
+ 
+ /* Insure 0 is not a legitimate index.  */
+@@ -685,6 +721,9 @@
+ BU_ALTIVEC_D (DSTSTT,	      "dststt",		MISC,  	altivec_dststt)
+ 
+ /* Altivec 2 argument builtin functions.  */
++BU_ALTIVC2_2 (VABSDUB,        "vabsdub",	CONST,	altivec_vabsdub)
++BU_ALTIVC2_2 (VABSDUH,        "vabsduh",	CONST,	altivec_vabsduh)
++BU_ALTIVC2_2 (VABSDUW,        "vabsduw",	CONST,	altivec_vabsduw)
+ BU_ALTIVEC_2 (VADDUBM,        "vaddubm",	CONST,	addv16qi3)
+ BU_ALTIVEC_2 (VADDUHM,	      "vadduhm",	CONST,	addv8hi3)
+ BU_ALTIVEC_2 (VADDUWM,	      "vadduwm",	CONST,	addv4si3)
+@@ -876,6 +915,9 @@
+ BU_ALTIVEC_X (LVEBX,		"lvebx",	    MEM)
+ BU_ALTIVEC_X (LVEHX,		"lvehx",	    MEM)
+ BU_ALTIVEC_X (LVEWX,		"lvewx",	    MEM)
++BU_ALTIVC2_X (LVEXBX,		"lvexbx",	    MEM)
++BU_ALTIVC2_X (LVEXHX,		"lvexhx",	    MEM)
++BU_ALTIVC2_X (LVEXWX,		"lvexwx",	    MEM)
+ BU_ALTIVEC_X (LVXL,		"lvxl",		    MEM)
+ BU_ALTIVEC_X (LVXL_V2DF,	"lvxl_v2df",	    MEM)
+ BU_ALTIVEC_X (LVXL_V2DI,	"lvxl_v2di",	    MEM)
+@@ -901,9 +943,19 @@
+ BU_ALTIVEC_C (LVLXL,		"lvlxl",	    MEM)
+ BU_ALTIVEC_C (LVRX,		"lvrx",		    MEM)
+ BU_ALTIVEC_C (LVRXL,		"lvrxl",	    MEM)
++BU_ALTIVC2_X (LVTLX,           "lvtlx",            MEM)
++BU_ALTIVC2_X (LVTLXL,          "lvtlxl",           MEM)
++BU_ALTIVC2_X (LVTRX,           "lvtrx",            MEM)
++BU_ALTIVC2_X (LVTRXL,          "lvtrxl",           MEM)
++BU_ALTIVC2_X (LVSWX,           "lvswx",            MEM)
++BU_ALTIVC2_X (LVSWXL,          "lvswxl",           MEM)
++BU_ALTIVC2_X (LVSM,            "lvsm",             MEM)
+ BU_ALTIVEC_X (STVEBX,		"stvebx",	    MEM)
+ BU_ALTIVEC_X (STVEHX,		"stvehx",	    MEM)
+ BU_ALTIVEC_X (STVEWX,		"stvewx",	    MEM)
++BU_ALTIVC2_X (STVEXBX,         "stvexbx",          MEM)
++BU_ALTIVC2_X (STVEXHX,         "stvexhx",          MEM)
++BU_ALTIVC2_X (STVEXWX,         "stvexwx",          MEM)
+ BU_ALTIVEC_X (STVXL,		"stvxl",	    MEM)
+ BU_ALTIVEC_X (STVXL_V2DF,	"stvxl_v2df",	    MEM)
+ BU_ALTIVEC_X (STVXL_V2DI,	"stvxl_v2di",	    MEM)
+@@ -915,6 +967,12 @@
+ BU_ALTIVEC_C (STVLXL,		"stvlxl",	    MEM)
+ BU_ALTIVEC_C (STVRX,		"stvrx",	    MEM)
+ BU_ALTIVEC_C (STVRXL,		"stvrxl",	    MEM)
++BU_ALTIVC2_X (STVFLX,          "stvflx",           MEM)
++BU_ALTIVC2_X (STVFLXL,         "stvflxl",          MEM)
++BU_ALTIVC2_X (STVFRX,          "stvfrx",           MEM)
++BU_ALTIVC2_X (STVFRXL,         "stvfrxl",          MEM)
++BU_ALTIVC2_X (STVSWX,          "stvswx",           MEM)
++BU_ALTIVC2_X (STVSWXL,         "stvswxl",          MEM)
+ BU_ALTIVEC_X (MASK_FOR_LOAD,	"mask_for_load",    MISC)
+ BU_ALTIVEC_X (MASK_FOR_STORE,	"mask_for_store",   MISC)
+ BU_ALTIVEC_X (VEC_INIT_V4SI,	"vec_init_v4si",    CONST)
+@@ -959,6 +1017,10 @@
+ BU_ALTIVEC_OVERLOAD_D (DSTSTT,	   "dststt")
+ 
+ /* 2 argument Altivec overloaded builtins.  */
++BU_ALTIVC2_OVERLOAD_2 (ABSD,	   "absd")
++BU_ALTIVC2_OVERLOAD_2 (ABSDUB,	   "absdub")
++BU_ALTIVC2_OVERLOAD_2 (ABSDUH,	   "absduh")
++BU_ALTIVC2_OVERLOAD_2 (ABSDUW,	   "absduw")
+ BU_ALTIVEC_OVERLOAD_2 (ADD,	   "add")
+ BU_ALTIVEC_OVERLOAD_2 (ADDC,	   "addc")
+ BU_ALTIVEC_OVERLOAD_2 (ADDS,	   "adds")
+@@ -1131,10 +1193,20 @@
+ BU_ALTIVEC_OVERLOAD_X (LVEBX,	   "lvebx")
+ BU_ALTIVEC_OVERLOAD_X (LVEHX,	   "lvehx")
+ BU_ALTIVEC_OVERLOAD_X (LVEWX,	   "lvewx")
++BU_ALTIVC2_OVERLOAD_X (LVEXBX,	   "lvexbx")
++BU_ALTIVC2_OVERLOAD_X (LVEXHX,	   "lvexhx")
++BU_ALTIVC2_OVERLOAD_X (LVEXWX,	   "lvexwx")
+ BU_ALTIVEC_OVERLOAD_X (LVLX,	   "lvlx")
+ BU_ALTIVEC_OVERLOAD_X (LVLXL,	   "lvlxl")
+ BU_ALTIVEC_OVERLOAD_X (LVRX,	   "lvrx")
+ BU_ALTIVEC_OVERLOAD_X (LVRXL,	   "lvrxl")
++BU_ALTIVC2_OVERLOAD_X (LVTLX,	   "lvtlx")
++BU_ALTIVC2_OVERLOAD_X (LVTLXL,	   "lvtlxl")
++BU_ALTIVC2_OVERLOAD_X (LVTRX,	   "lvtrx")
++BU_ALTIVC2_OVERLOAD_X (LVTRXL,	   "lvtrxl")
++BU_ALTIVC2_OVERLOAD_X (LVSWX,	   "lvswx")
++BU_ALTIVC2_OVERLOAD_X (LVSWXL,	   "lvswxl")
++BU_ALTIVC2_OVERLOAD_X (LVSM,	   "lvsm")
+ BU_ALTIVEC_OVERLOAD_X (LVSL,	   "lvsl")
+ BU_ALTIVEC_OVERLOAD_X (LVSR,	   "lvsr")
+ BU_ALTIVEC_OVERLOAD_X (PROMOTE,	   "promote")
+@@ -1148,10 +1220,19 @@
+ BU_ALTIVEC_OVERLOAD_X (STVEBX,	   "stvebx")
+ BU_ALTIVEC_OVERLOAD_X (STVEHX,	   "stvehx")
+ BU_ALTIVEC_OVERLOAD_X (STVEWX,	   "stvewx")
++BU_ALTIVC2_OVERLOAD_X (STVEXBX,	   "stvexbx")
++BU_ALTIVC2_OVERLOAD_X (STVEXHX,	   "stvexhx")
++BU_ALTIVC2_OVERLOAD_X (STVEXWX,	   "stvexwx")
+ BU_ALTIVEC_OVERLOAD_X (STVLX,	   "stvlx")
+ BU_ALTIVEC_OVERLOAD_X (STVLXL,	   "stvlxl")
+ BU_ALTIVEC_OVERLOAD_X (STVRX,	   "stvrx")
+ BU_ALTIVEC_OVERLOAD_X (STVRXL,	   "stvrxl")
++BU_ALTIVC2_OVERLOAD_X (STVFLX,	   "stvflx")
++BU_ALTIVC2_OVERLOAD_X (STVFLXL,	   "stvflxl")
++BU_ALTIVC2_OVERLOAD_X (STVFRX,	   "stvfrx")
++BU_ALTIVC2_OVERLOAD_X (STVFRXL,	   "stvfrxl")
++BU_ALTIVC2_OVERLOAD_X (STVSWX,	   "stvswx")
++BU_ALTIVC2_OVERLOAD_X (STVSWXL,	   "stvswxl")
+ BU_ALTIVEC_OVERLOAD_X (VCFSX,	   "vcfsx")
+ BU_ALTIVEC_OVERLOAD_X (VCFUX,	   "vcfux")
+ BU_ALTIVEC_OVERLOAD_X (VSPLTB,	   "vspltb")
+diff -Naur gcc-4.9.1/gcc/config/rs6000/rs6000.c gcc-4.9.1-e6500-FSF/gcc/config/rs6000/rs6000.c
+--- gcc-4.9.1/gcc/config/rs6000/rs6000.c	2014-06-13 16:56:16.000000000 -0500
++++ gcc-4.9.1-e6500-FSF/gcc/config/rs6000/rs6000.c	2014-07-17 02:38:35.049383001 -0500
+@@ -3024,6 +3024,7 @@
+ rs6000_builtin_mask_calculate (void)
+ {
+   return (((TARGET_ALTIVEC)		    ? RS6000_BTM_ALTIVEC   : 0)
++          | ((TARGET_ALTIVEC2)              ? RS6000_BTM_ALTIVEC2  : 0)
+ 	  | ((TARGET_VSX)		    ? RS6000_BTM_VSX	   : 0)
+ 	  | ((TARGET_SPE)		    ? RS6000_BTM_SPE	   : 0)
+ 	  | ((TARGET_PAIRED_FLOAT)	    ? RS6000_BTM_PAIRED	   : 0)
+@@ -3462,6 +3463,15 @@
+ 	  || rs6000_cpu == PROCESSOR_PPCE6500))
+     rs6000_block_move_inline_limit = 128;
+ 
++  /* Those machines does not have fsqrt instruction */
++  if (rs6000_cpu == PROCESSOR_PPCE5500
++      || rs6000_cpu == PROCESSOR_PPCE6500)
++    target_flags &= ~(MASK_PPC_GPOPT);
++
++  /* Those machines implements a slow mfocr opcode */
++  if (rs6000_cpu == PROCESSOR_PPCE5500)
++    target_flags &= ~MASK_MFCRF;
++
+   /* store_one_arg depends on expand_block_move to handle at least the
+      size of reg_parm_stack_space.  */
+   if (rs6000_block_move_inline_limit < (TARGET_POWERPC64 ? 64 : 32))
+@@ -12895,6 +12905,12 @@
+       return altivec_expand_stv_builtin (CODE_FOR_altivec_stvehx, exp);
+     case ALTIVEC_BUILTIN_STVEWX:
+       return altivec_expand_stv_builtin (CODE_FOR_altivec_stvewx, exp);
++    case ALTIVEC_BUILTIN_STVEXBX:
++      return altivec_expand_stv_builtin (CODE_FOR_altivec_stvexbx, exp);
++    case ALTIVEC_BUILTIN_STVEXHX:
++      return altivec_expand_stv_builtin (CODE_FOR_altivec_stvexhx, exp);
++    case ALTIVEC_BUILTIN_STVEXWX:
++      return altivec_expand_stv_builtin (CODE_FOR_altivec_stvexwx, exp);
+     case ALTIVEC_BUILTIN_STVXL_V2DF:
+       return altivec_expand_stv_builtin (CODE_FOR_altivec_stvxl_v2df, exp);
+     case ALTIVEC_BUILTIN_STVXL_V2DI:
+@@ -12917,6 +12933,18 @@
+       return altivec_expand_stv_builtin (CODE_FOR_altivec_stvrx, exp);
+     case ALTIVEC_BUILTIN_STVRXL:
+       return altivec_expand_stv_builtin (CODE_FOR_altivec_stvrxl, exp);
++    case ALTIVEC_BUILTIN_STVFLX:
++      return altivec_expand_stv_builtin (CODE_FOR_altivec_stvflx, exp);
++    case ALTIVEC_BUILTIN_STVFLXL:
++      return altivec_expand_stv_builtin (CODE_FOR_altivec_stvflxl, exp);
++    case ALTIVEC_BUILTIN_STVFRX:
++      return altivec_expand_stv_builtin (CODE_FOR_altivec_stvfrx, exp);
++    case ALTIVEC_BUILTIN_STVFRXL:
++      return altivec_expand_stv_builtin (CODE_FOR_altivec_stvfrxl, exp);
++    case ALTIVEC_BUILTIN_STVSWX:
++      return altivec_expand_stv_builtin (CODE_FOR_altivec_stvswx, exp);
++    case ALTIVEC_BUILTIN_STVSWXL:
++      return altivec_expand_stv_builtin (CODE_FOR_altivec_stvswxl, exp);
+ 
+     case VSX_BUILTIN_STXVD2X_V1TI:
+       return altivec_expand_stv_builtin (CODE_FOR_vsx_store_v1ti, exp);
+@@ -13065,6 +13093,15 @@
+     case ALTIVEC_BUILTIN_LVXL_V4SF:
+       return altivec_expand_lv_builtin (CODE_FOR_altivec_lvxl_v4sf,
+ 					exp, target, false);
++    case ALTIVEC_BUILTIN_LVEXBX:
++      return altivec_expand_lv_builtin (CODE_FOR_altivec_lvexbx,
++					exp, target, false);
++    case ALTIVEC_BUILTIN_LVEXHX:
++      return altivec_expand_lv_builtin (CODE_FOR_altivec_lvexhx,
++					exp, target, false);
++    case ALTIVEC_BUILTIN_LVEXWX:
++      return altivec_expand_lv_builtin (CODE_FOR_altivec_lvexwx,
++					exp, target, false);
+     case ALTIVEC_BUILTIN_LVXL:
+     case ALTIVEC_BUILTIN_LVXL_V4SI:
+       return altivec_expand_lv_builtin (CODE_FOR_altivec_lvxl_v4si,
+@@ -13106,6 +13143,27 @@
+     case ALTIVEC_BUILTIN_LVRXL:
+       return altivec_expand_lv_builtin (CODE_FOR_altivec_lvrxl,
+ 					exp, target, true);
++    case ALTIVEC_BUILTIN_LVTLX:
++      return altivec_expand_lv_builtin (CODE_FOR_altivec_lvtlx,
++                                        exp, target, true);
++    case ALTIVEC_BUILTIN_LVTLXL:
++      return altivec_expand_lv_builtin (CODE_FOR_altivec_lvtlxl,
++                                        exp, target, true);
++    case ALTIVEC_BUILTIN_LVTRX:
++      return altivec_expand_lv_builtin (CODE_FOR_altivec_lvtrx,
++                                        exp, target, true);
++    case ALTIVEC_BUILTIN_LVTRXL:
++      return altivec_expand_lv_builtin (CODE_FOR_altivec_lvtrxl,
++                                        exp, target, true);
++    case ALTIVEC_BUILTIN_LVSWX:
++      return altivec_expand_lv_builtin (CODE_FOR_altivec_lvswx,
++                                        exp, target, true);
++    case ALTIVEC_BUILTIN_LVSWXL:
++      return altivec_expand_lv_builtin (CODE_FOR_altivec_lvswxl,
++                                        exp, target, true);
++    case ALTIVEC_BUILTIN_LVSM:
++      return altivec_expand_lv_builtin (CODE_FOR_altivec_lvsm,
++                                        exp, target, true);
+     case VSX_BUILTIN_LXVD2X_V1TI:
+       return altivec_expand_lv_builtin (CODE_FOR_vsx_load_v1ti,
+ 					exp, target, false);
+@@ -14489,6 +14547,9 @@
+   def_builtin ("__builtin_altivec_lvebx", v16qi_ftype_long_pcvoid, ALTIVEC_BUILTIN_LVEBX);
+   def_builtin ("__builtin_altivec_lvehx", v8hi_ftype_long_pcvoid, ALTIVEC_BUILTIN_LVEHX);
+   def_builtin ("__builtin_altivec_lvewx", v4si_ftype_long_pcvoid, ALTIVEC_BUILTIN_LVEWX);
++  def_builtin ("__builtin_altivec_lvexbx", v16qi_ftype_long_pcvoid, ALTIVEC_BUILTIN_LVEXBX);
++  def_builtin ("__builtin_altivec_lvexhx", v8hi_ftype_long_pcvoid, ALTIVEC_BUILTIN_LVEXHX);
++  def_builtin ("__builtin_altivec_lvexwx", v4si_ftype_long_pcvoid, ALTIVEC_BUILTIN_LVEXWX);
+   def_builtin ("__builtin_altivec_lvxl", v4si_ftype_long_pcvoid, ALTIVEC_BUILTIN_LVXL);
+   def_builtin ("__builtin_altivec_lvxl_v2df", v2df_ftype_long_pcvoid,
+ 	       ALTIVEC_BUILTIN_LVXL_V2DF);
+@@ -14544,6 +14605,9 @@
+ 	       ALTIVEC_BUILTIN_STVXL_V16QI);
+   def_builtin ("__builtin_altivec_stvebx", void_ftype_v16qi_long_pvoid, ALTIVEC_BUILTIN_STVEBX);
+   def_builtin ("__builtin_altivec_stvehx", void_ftype_v8hi_long_pvoid, ALTIVEC_BUILTIN_STVEHX);
++  def_builtin ("__builtin_altivec_stvexbx", void_ftype_v16qi_long_pvoid, ALTIVEC_BUILTIN_STVEXBX);
++  def_builtin ("__builtin_altivec_stvexhx", void_ftype_v8hi_long_pvoid, ALTIVEC_BUILTIN_STVEXHX);
++  def_builtin ("__builtin_altivec_stvexwx", void_ftype_v4si_long_pvoid, ALTIVEC_BUILTIN_STVEXWX);
+   def_builtin ("__builtin_vec_ld", opaque_ftype_long_pcvoid, ALTIVEC_BUILTIN_VEC_LD);
+   def_builtin ("__builtin_vec_lde", opaque_ftype_long_pcvoid, ALTIVEC_BUILTIN_VEC_LDE);
+   def_builtin ("__builtin_vec_ldl", opaque_ftype_long_pcvoid, ALTIVEC_BUILTIN_VEC_LDL);
+@@ -14552,12 +14616,18 @@
+   def_builtin ("__builtin_vec_lvebx", v16qi_ftype_long_pcvoid, ALTIVEC_BUILTIN_VEC_LVEBX);
+   def_builtin ("__builtin_vec_lvehx", v8hi_ftype_long_pcvoid, ALTIVEC_BUILTIN_VEC_LVEHX);
+   def_builtin ("__builtin_vec_lvewx", v4si_ftype_long_pcvoid, ALTIVEC_BUILTIN_VEC_LVEWX);
++  def_builtin ("__builtin_vec_lvexbx", v16qi_ftype_long_pcvoid, ALTIVEC_BUILTIN_VEC_LVEXBX);
++  def_builtin ("__builtin_vec_lvexhx", v8hi_ftype_long_pcvoid, ALTIVEC_BUILTIN_VEC_LVEXHX);
++  def_builtin ("__builtin_vec_lvexwx", v4si_ftype_long_pcvoid, ALTIVEC_BUILTIN_VEC_LVEXWX);
+   def_builtin ("__builtin_vec_st", void_ftype_opaque_long_pvoid, ALTIVEC_BUILTIN_VEC_ST);
+   def_builtin ("__builtin_vec_ste", void_ftype_opaque_long_pvoid, ALTIVEC_BUILTIN_VEC_STE);
+   def_builtin ("__builtin_vec_stl", void_ftype_opaque_long_pvoid, ALTIVEC_BUILTIN_VEC_STL);
+   def_builtin ("__builtin_vec_stvewx", void_ftype_opaque_long_pvoid, ALTIVEC_BUILTIN_VEC_STVEWX);
+   def_builtin ("__builtin_vec_stvebx", void_ftype_opaque_long_pvoid, ALTIVEC_BUILTIN_VEC_STVEBX);
+   def_builtin ("__builtin_vec_stvehx", void_ftype_opaque_long_pvoid, ALTIVEC_BUILTIN_VEC_STVEHX);
++  def_builtin ("__builtin_vec_stvexwx", void_ftype_opaque_long_pvoid, ALTIVEC_BUILTIN_VEC_STVEXWX);
++  def_builtin ("__builtin_vec_stvexbx", void_ftype_opaque_long_pvoid, ALTIVEC_BUILTIN_VEC_STVEXBX);
++  def_builtin ("__builtin_vec_stvexhx", void_ftype_opaque_long_pvoid, ALTIVEC_BUILTIN_VEC_STVEXHX);
+ 
+   def_builtin ("__builtin_vsx_lxvd2x_v2df", v2df_ftype_long_pcvoid,
+ 	       VSX_BUILTIN_LXVD2X_V2DF);
+@@ -14588,6 +14658,40 @@
+   def_builtin ("__builtin_vec_vsx_st", void_ftype_opaque_long_pvoid,
+ 	       VSX_BUILTIN_VEC_ST);
+ 
++  /* Power ISA 2.07 */
++  def_builtin ("__builtin_altivec_lvtlx",  v16qi_ftype_long_pcvoid, ALTIVEC_BUILTIN_LVTLX);
++  def_builtin ("__builtin_altivec_lvtlxl", v16qi_ftype_long_pcvoid, ALTIVEC_BUILTIN_LVTLXL);
++  def_builtin ("__builtin_altivec_lvtrx",  v16qi_ftype_long_pcvoid, ALTIVEC_BUILTIN_LVTRX);
++  def_builtin ("__builtin_altivec_lvtrxl", v16qi_ftype_long_pcvoid, ALTIVEC_BUILTIN_LVTRXL);
++
++  def_builtin ("__builtin_vec_lvtlx",  v16qi_ftype_long_pcvoid, ALTIVEC_BUILTIN_VEC_LVTLX);
++  def_builtin ("__builtin_vec_lvtlxl", v16qi_ftype_long_pcvoid, ALTIVEC_BUILTIN_VEC_LVTLXL);
++  def_builtin ("__builtin_vec_lvtrx",  v16qi_ftype_long_pcvoid, ALTIVEC_BUILTIN_VEC_LVTRX);
++  def_builtin ("__builtin_vec_lvtrxl", v16qi_ftype_long_pcvoid, ALTIVEC_BUILTIN_VEC_LVTRXL);
++
++  def_builtin ("__builtin_altivec_stvflx",  void_ftype_v16qi_long_pvoid, ALTIVEC_BUILTIN_STVFLX);
++  def_builtin ("__builtin_altivec_stvflxl", void_ftype_v16qi_long_pvoid, ALTIVEC_BUILTIN_STVFLXL);
++  def_builtin ("__builtin_altivec_stvfrx",  void_ftype_v16qi_long_pvoid, ALTIVEC_BUILTIN_STVFRX);
++  def_builtin ("__builtin_altivec_stvfrxl", void_ftype_v16qi_long_pvoid, ALTIVEC_BUILTIN_STVFRXL);
++
++  def_builtin ("__builtin_vec_stvflx",  void_ftype_v16qi_long_pvoid, ALTIVEC_BUILTIN_VEC_STVFLX);
++  def_builtin ("__builtin_vec_stvflxl", void_ftype_v16qi_long_pvoid, ALTIVEC_BUILTIN_VEC_STVFLXL);
++  def_builtin ("__builtin_vec_stvfrx",  void_ftype_v16qi_long_pvoid, ALTIVEC_BUILTIN_VEC_STVFRX);
++  def_builtin ("__builtin_vec_stvfrxl", void_ftype_v16qi_long_pvoid, ALTIVEC_BUILTIN_VEC_STVFRXL);
++
++  def_builtin ("__builtin_altivec_lvswx",  v16qi_ftype_long_pcvoid, ALTIVEC_BUILTIN_LVSWX);
++  def_builtin ("__builtin_altivec_lvswxl", v16qi_ftype_long_pcvoid, ALTIVEC_BUILTIN_LVSWXL);
++  def_builtin ("__builtin_vec_lvswx",  v16qi_ftype_long_pcvoid, ALTIVEC_BUILTIN_VEC_LVSWX);
++  def_builtin ("__builtin_vec_lvswxl", v16qi_ftype_long_pcvoid, ALTIVEC_BUILTIN_VEC_LVSWXL);
++
++  def_builtin ("__builtin_altivec_lvsm",  v16qi_ftype_long_pcvoid, ALTIVEC_BUILTIN_LVSM);
++  def_builtin ("__builtin_vec_lvsm",  v16qi_ftype_long_pcvoid, ALTIVEC_BUILTIN_VEC_LVSM);
++
++  def_builtin ("__builtin_altivec_stvswx",  void_ftype_v16qi_long_pvoid, ALTIVEC_BUILTIN_STVSWX);
++  def_builtin ("__builtin_altivec_stvswxl", void_ftype_v16qi_long_pvoid, ALTIVEC_BUILTIN_STVSWXL);
++  def_builtin ("__builtin_vec_stvswx",  void_ftype_v16qi_long_pvoid, ALTIVEC_BUILTIN_VEC_STVSWX);
++  def_builtin ("__builtin_vec_stvswxl", void_ftype_v16qi_long_pvoid, ALTIVEC_BUILTIN_VEC_STVSWXL);
++
+   def_builtin ("__builtin_vec_step", int_ftype_opaque, ALTIVEC_BUILTIN_VEC_STEP);
+   def_builtin ("__builtin_vec_splats", opaque_ftype_opaque, ALTIVEC_BUILTIN_VEC_SPLATS);
+   def_builtin ("__builtin_vec_promote", opaque_ftype_opaque, ALTIVEC_BUILTIN_VEC_PROMOTE);
+@@ -15007,6 +15111,9 @@
+     case ALTIVEC_BUILTIN_VMULEUH_UNS:
+     case ALTIVEC_BUILTIN_VMULOUB_UNS:
+     case ALTIVEC_BUILTIN_VMULOUH_UNS:
++    case ALTIVEC_BUILTIN_VABSDUB:
++    case ALTIVEC_BUILTIN_VABSDUH:
++    case ALTIVEC_BUILTIN_VABSDUW:
+     case CRYPTO_BUILTIN_VCIPHER:
+     case CRYPTO_BUILTIN_VCIPHERLAST:
+     case CRYPTO_BUILTIN_VNCIPHER:
+@@ -31277,6 +31384,7 @@
+ static struct rs6000_opt_mask const rs6000_opt_masks[] =
+ {
+   { "altivec",			OPTION_MASK_ALTIVEC,		false, true  },
++  { "altivec2",			OPTION_MASK_ALTIVEC2,		false, true  },
+   { "cmpb",			OPTION_MASK_CMPB,		false, true  },
+   { "crypto",			OPTION_MASK_CRYPTO,		false, true  },
+   { "direct-move",		OPTION_MASK_DIRECT_MOVE,	false, true  },
+@@ -31335,6 +31443,7 @@
+ static struct rs6000_opt_mask const rs6000_builtin_mask_names[] =
+ {
+   { "altivec",		 RS6000_BTM_ALTIVEC,	false, false },
++  { "altivec2",		 RS6000_BTM_ALTIVEC2,	false, false },
+   { "vsx",		 RS6000_BTM_VSX,	false, false },
+   { "spe",		 RS6000_BTM_SPE,	false, false },
+   { "paired",		 RS6000_BTM_PAIRED,	false, false },
+diff -Naur gcc-4.9.1/gcc/config/rs6000/rs6000-c.c gcc-4.9.1-e6500-FSF/gcc/config/rs6000/rs6000-c.c
+--- gcc-4.9.1/gcc/config/rs6000/rs6000-c.c	2014-03-27 15:07:16.000000000 -0500
++++ gcc-4.9.1-e6500-FSF/gcc/config/rs6000/rs6000-c.c	2014-07-17 02:38:35.051383001 -0500
+@@ -350,6 +350,8 @@
+       if (!flag_iso)
+ 	rs6000_define_or_undefine_macro (define_p, "__APPLE_ALTIVEC__");
+     }
++  if ((flags & OPTION_MASK_ALTIVEC2) != 0)
++    rs6000_define_or_undefine_macro (define_p, "__ALTIVEC2__");
+   if ((flags & OPTION_MASK_VSX) != 0)
+     rs6000_define_or_undefine_macro (define_p, "__VSX__");
+   if ((flags & OPTION_MASK_HTM) != 0)
+@@ -671,6 +673,24 @@
+     RS6000_BTI_bool_V8HI, RS6000_BTI_bool_V16QI, 0, 0 },
+ 
+   /* Binary AltiVec/VSX builtins.  */
++  { ALTIVEC_BUILTIN_VEC_ABSD, ALTIVEC_BUILTIN_VABSDUB,
++    RS6000_BTI_unsigned_V16QI, RS6000_BTI_bool_V16QI, RS6000_BTI_unsigned_V16QI, 0 },
++  { ALTIVEC_BUILTIN_VEC_ABSD, ALTIVEC_BUILTIN_VABSDUB,
++    RS6000_BTI_unsigned_V16QI, RS6000_BTI_unsigned_V16QI, RS6000_BTI_unsigned_V16QI, 0 },
++  { ALTIVEC_BUILTIN_VEC_ABSD, ALTIVEC_BUILTIN_VABSDUB,
++    RS6000_BTI_unsigned_V16QI, RS6000_BTI_unsigned_V16QI, RS6000_BTI_bool_V16QI, 0 },
++  { ALTIVEC_BUILTIN_VEC_ABSD, ALTIVEC_BUILTIN_VABSDUH,
++    RS6000_BTI_unsigned_V8HI, RS6000_BTI_bool_V8HI, RS6000_BTI_unsigned_V8HI, 0 },
++  { ALTIVEC_BUILTIN_VEC_ABSD, ALTIVEC_BUILTIN_VABSDUH,
++    RS6000_BTI_unsigned_V8HI, RS6000_BTI_unsigned_V8HI, RS6000_BTI_unsigned_V8HI, 0 },
++  { ALTIVEC_BUILTIN_VEC_ABSD, ALTIVEC_BUILTIN_VABSDUH,
++    RS6000_BTI_unsigned_V8HI, RS6000_BTI_unsigned_V8HI, RS6000_BTI_bool_V8HI, 0 },
++  { ALTIVEC_BUILTIN_VEC_ABSD, ALTIVEC_BUILTIN_VABSDUW,
++    RS6000_BTI_unsigned_V4SI, RS6000_BTI_bool_V4SI, RS6000_BTI_unsigned_V4SI, 0 },
++  { ALTIVEC_BUILTIN_VEC_ABSD, ALTIVEC_BUILTIN_VABSDUW,
++    RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI, 0 },
++  { ALTIVEC_BUILTIN_VEC_ABSD, ALTIVEC_BUILTIN_VABSDUW,
++    RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI, RS6000_BTI_bool_V4SI, 0 },
+   { ALTIVEC_BUILTIN_VEC_ADD, ALTIVEC_BUILTIN_VADDUBM,
+     RS6000_BTI_V16QI, RS6000_BTI_bool_V16QI, RS6000_BTI_V16QI, 0 },
+   { ALTIVEC_BUILTIN_VEC_ADD, ALTIVEC_BUILTIN_VADDUBM,
+@@ -1215,6 +1235,24 @@
+     RS6000_BTI_V16QI, RS6000_BTI_INTSI, ~RS6000_BTI_INTQI, 0 },
+   { ALTIVEC_BUILTIN_VEC_LVEBX, ALTIVEC_BUILTIN_LVEBX,
+     RS6000_BTI_unsigned_V16QI, RS6000_BTI_INTSI, ~RS6000_BTI_UINTQI, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVEXWX, ALTIVEC_BUILTIN_LVEXWX,
++    RS6000_BTI_V4SF, RS6000_BTI_INTSI, ~RS6000_BTI_float, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVEXWX, ALTIVEC_BUILTIN_LVEXWX,
++    RS6000_BTI_V4SI, RS6000_BTI_INTSI, ~RS6000_BTI_INTSI, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVEXWX, ALTIVEC_BUILTIN_LVEXWX,
++    RS6000_BTI_unsigned_V4SI, RS6000_BTI_INTSI, ~RS6000_BTI_UINTSI, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVEXWX, ALTIVEC_BUILTIN_LVEXWX,
++    RS6000_BTI_V4SI, RS6000_BTI_INTSI, ~RS6000_BTI_long, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVEXWX, ALTIVEC_BUILTIN_LVEXWX,
++    RS6000_BTI_unsigned_V4SI, RS6000_BTI_INTSI, ~RS6000_BTI_unsigned_long, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVEXHX, ALTIVEC_BUILTIN_LVEXHX,
++    RS6000_BTI_V8HI, RS6000_BTI_INTSI, ~RS6000_BTI_INTHI, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVEXHX, ALTIVEC_BUILTIN_LVEXHX,
++    RS6000_BTI_unsigned_V8HI, RS6000_BTI_INTSI, ~RS6000_BTI_UINTHI, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVEXBX, ALTIVEC_BUILTIN_LVEXBX,
++    RS6000_BTI_V16QI, RS6000_BTI_INTSI, ~RS6000_BTI_INTQI, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVEXBX, ALTIVEC_BUILTIN_LVEXBX,
++    RS6000_BTI_unsigned_V16QI, RS6000_BTI_INTSI, ~RS6000_BTI_UINTQI, 0 },
+   { ALTIVEC_BUILTIN_VEC_LDL, ALTIVEC_BUILTIN_LVXL_V4SF,
+     RS6000_BTI_V4SF, RS6000_BTI_INTSI, ~RS6000_BTI_V4SF, 0 },
+   { ALTIVEC_BUILTIN_VEC_LDL, ALTIVEC_BUILTIN_LVXL_V4SF,
+@@ -1467,6 +1505,258 @@
+     RS6000_BTI_unsigned_V16QI, RS6000_BTI_INTSI, ~RS6000_BTI_unsigned_V16QI, 0 },
+   { ALTIVEC_BUILTIN_VEC_LVRXL, ALTIVEC_BUILTIN_LVRXL,
+     RS6000_BTI_unsigned_V16QI, RS6000_BTI_INTSI, ~RS6000_BTI_UINTQI, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVTLX, ALTIVEC_BUILTIN_LVTLX,
++    RS6000_BTI_V4SF, RS6000_BTI_INTSI, ~RS6000_BTI_V4SF, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVTLX, ALTIVEC_BUILTIN_LVTLX,
++    RS6000_BTI_V4SF, RS6000_BTI_INTSI, ~RS6000_BTI_float, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVTLX, ALTIVEC_BUILTIN_LVTLX,
++    RS6000_BTI_bool_V4SI, RS6000_BTI_INTSI, ~RS6000_BTI_bool_V4SI, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVTLX, ALTIVEC_BUILTIN_LVTLX,
++    RS6000_BTI_V4SI, RS6000_BTI_INTSI, ~RS6000_BTI_V4SI, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVTLX, ALTIVEC_BUILTIN_LVTLX,
++    RS6000_BTI_V4SI, RS6000_BTI_INTSI, ~RS6000_BTI_INTSI, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVTLX, ALTIVEC_BUILTIN_LVTLX,
++    RS6000_BTI_unsigned_V4SI, RS6000_BTI_INTSI, ~RS6000_BTI_unsigned_V4SI, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVTLX, ALTIVEC_BUILTIN_LVTLX,
++    RS6000_BTI_unsigned_V4SI, RS6000_BTI_INTSI, ~RS6000_BTI_UINTSI, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVTLX, ALTIVEC_BUILTIN_LVTLX,
++    RS6000_BTI_bool_V8HI, RS6000_BTI_INTSI, ~RS6000_BTI_bool_V8HI, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVTLX, ALTIVEC_BUILTIN_LVTLX,
++    RS6000_BTI_pixel_V8HI, RS6000_BTI_INTSI, ~RS6000_BTI_pixel_V8HI, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVTLX, ALTIVEC_BUILTIN_LVTLX,
++    RS6000_BTI_V8HI, RS6000_BTI_INTSI, ~RS6000_BTI_V8HI, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVTLX, ALTIVEC_BUILTIN_LVTLX,
++    RS6000_BTI_V8HI, RS6000_BTI_INTSI, ~RS6000_BTI_INTHI, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVTLX, ALTIVEC_BUILTIN_LVTLX,
++    RS6000_BTI_unsigned_V8HI, RS6000_BTI_INTSI, ~RS6000_BTI_unsigned_V8HI, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVTLX, ALTIVEC_BUILTIN_LVTLX,
++    RS6000_BTI_unsigned_V8HI, RS6000_BTI_INTSI, ~RS6000_BTI_UINTHI, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVTLX, ALTIVEC_BUILTIN_LVTLX,
++    RS6000_BTI_bool_V16QI, RS6000_BTI_INTSI, ~RS6000_BTI_bool_V16QI, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVTLX, ALTIVEC_BUILTIN_LVTLX,
++    RS6000_BTI_V16QI, RS6000_BTI_INTSI, ~RS6000_BTI_V16QI, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVTLX, ALTIVEC_BUILTIN_LVTLX,
++    RS6000_BTI_V16QI, RS6000_BTI_INTSI, ~RS6000_BTI_INTQI, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVTLX, ALTIVEC_BUILTIN_LVTLX,
++    RS6000_BTI_unsigned_V16QI, RS6000_BTI_INTSI, ~RS6000_BTI_unsigned_V16QI, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVTLX, ALTIVEC_BUILTIN_LVTLX,
++    RS6000_BTI_unsigned_V16QI, RS6000_BTI_INTSI, ~RS6000_BTI_UINTQI, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVTLXL, ALTIVEC_BUILTIN_LVTLXL,
++    RS6000_BTI_V4SF, RS6000_BTI_INTSI, ~RS6000_BTI_V4SF, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVTLXL, ALTIVEC_BUILTIN_LVTLXL,
++    RS6000_BTI_V4SF, RS6000_BTI_INTSI, ~RS6000_BTI_float, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVTLXL, ALTIVEC_BUILTIN_LVTLXL,
++    RS6000_BTI_bool_V4SI, RS6000_BTI_INTSI, ~RS6000_BTI_bool_V4SI, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVTLXL, ALTIVEC_BUILTIN_LVTLXL,
++    RS6000_BTI_V4SI, RS6000_BTI_INTSI, ~RS6000_BTI_V4SI, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVTLXL, ALTIVEC_BUILTIN_LVTLXL,
++    RS6000_BTI_V4SI, RS6000_BTI_INTSI, ~RS6000_BTI_INTSI, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVTLXL, ALTIVEC_BUILTIN_LVTLXL,
++    RS6000_BTI_unsigned_V4SI, RS6000_BTI_INTSI, ~RS6000_BTI_unsigned_V4SI, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVTLXL, ALTIVEC_BUILTIN_LVTLXL,
++    RS6000_BTI_unsigned_V4SI, RS6000_BTI_INTSI, ~RS6000_BTI_UINTSI, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVTLXL, ALTIVEC_BUILTIN_LVTLXL,
++    RS6000_BTI_bool_V8HI, RS6000_BTI_INTSI, ~RS6000_BTI_bool_V8HI, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVTLXL, ALTIVEC_BUILTIN_LVTLXL,
++    RS6000_BTI_pixel_V8HI, RS6000_BTI_INTSI, ~RS6000_BTI_pixel_V8HI, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVTLXL, ALTIVEC_BUILTIN_LVTLXL,
++    RS6000_BTI_V8HI, RS6000_BTI_INTSI, ~RS6000_BTI_V8HI, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVTLXL, ALTIVEC_BUILTIN_LVTLXL,
++    RS6000_BTI_V8HI, RS6000_BTI_INTSI, ~RS6000_BTI_INTHI, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVTLXL, ALTIVEC_BUILTIN_LVTLXL,
++    RS6000_BTI_unsigned_V8HI, RS6000_BTI_INTSI, ~RS6000_BTI_unsigned_V8HI, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVTLXL, ALTIVEC_BUILTIN_LVTLXL,
++    RS6000_BTI_unsigned_V8HI, RS6000_BTI_INTSI, ~RS6000_BTI_UINTHI, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVTLXL, ALTIVEC_BUILTIN_LVTLXL,
++    RS6000_BTI_bool_V16QI, RS6000_BTI_INTSI, ~RS6000_BTI_bool_V16QI, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVTLXL, ALTIVEC_BUILTIN_LVTLXL,
++    RS6000_BTI_V16QI, RS6000_BTI_INTSI, ~RS6000_BTI_V16QI, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVTLXL, ALTIVEC_BUILTIN_LVTLXL,
++    RS6000_BTI_V16QI, RS6000_BTI_INTSI, ~RS6000_BTI_INTQI, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVTLXL, ALTIVEC_BUILTIN_LVTLXL,
++    RS6000_BTI_unsigned_V16QI, RS6000_BTI_INTSI, ~RS6000_BTI_unsigned_V16QI, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVTLXL, ALTIVEC_BUILTIN_LVTLXL,
++    RS6000_BTI_unsigned_V16QI, RS6000_BTI_INTSI, ~RS6000_BTI_UINTQI, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVTRX, ALTIVEC_BUILTIN_LVTRX,
++    RS6000_BTI_V4SF, RS6000_BTI_INTSI, ~RS6000_BTI_V4SF, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVTRX, ALTIVEC_BUILTIN_LVTRX,
++    RS6000_BTI_V4SF, RS6000_BTI_INTSI, ~RS6000_BTI_float, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVTRX, ALTIVEC_BUILTIN_LVTRX,
++    RS6000_BTI_bool_V4SI, RS6000_BTI_INTSI, ~RS6000_BTI_bool_V4SI, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVTRX, ALTIVEC_BUILTIN_LVTRX,
++    RS6000_BTI_V4SI, RS6000_BTI_INTSI, ~RS6000_BTI_V4SI, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVTRX, ALTIVEC_BUILTIN_LVTRX,
++    RS6000_BTI_V4SI, RS6000_BTI_INTSI, ~RS6000_BTI_INTSI, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVTRX, ALTIVEC_BUILTIN_LVTRX,
++    RS6000_BTI_unsigned_V4SI, RS6000_BTI_INTSI, ~RS6000_BTI_unsigned_V4SI, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVTRX, ALTIVEC_BUILTIN_LVTRX,
++    RS6000_BTI_unsigned_V4SI, RS6000_BTI_INTSI, ~RS6000_BTI_UINTSI, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVTRX, ALTIVEC_BUILTIN_LVTRX,
++    RS6000_BTI_bool_V8HI, RS6000_BTI_INTSI, ~RS6000_BTI_bool_V8HI, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVTRX, ALTIVEC_BUILTIN_LVTRX,
++    RS6000_BTI_pixel_V8HI, RS6000_BTI_INTSI, ~RS6000_BTI_pixel_V8HI, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVTRX, ALTIVEC_BUILTIN_LVTRX,
++    RS6000_BTI_V8HI, RS6000_BTI_INTSI, ~RS6000_BTI_V8HI, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVTRX, ALTIVEC_BUILTIN_LVTRX,
++    RS6000_BTI_V8HI, RS6000_BTI_INTSI, ~RS6000_BTI_INTHI, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVTRX, ALTIVEC_BUILTIN_LVTRX,
++    RS6000_BTI_unsigned_V8HI, RS6000_BTI_INTSI, ~RS6000_BTI_unsigned_V8HI, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVTRX, ALTIVEC_BUILTIN_LVTRX,
++    RS6000_BTI_unsigned_V8HI, RS6000_BTI_INTSI, ~RS6000_BTI_UINTHI, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVTRX, ALTIVEC_BUILTIN_LVTRX,
++    RS6000_BTI_bool_V16QI, RS6000_BTI_INTSI, ~RS6000_BTI_bool_V16QI, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVTRX, ALTIVEC_BUILTIN_LVTRX,
++    RS6000_BTI_V16QI, RS6000_BTI_INTSI, ~RS6000_BTI_V16QI, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVTRX, ALTIVEC_BUILTIN_LVTRX,
++    RS6000_BTI_V16QI, RS6000_BTI_INTSI, ~RS6000_BTI_INTQI, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVTRX, ALTIVEC_BUILTIN_LVTRX,
++    RS6000_BTI_unsigned_V16QI, RS6000_BTI_INTSI, ~RS6000_BTI_unsigned_V16QI, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVTRX, ALTIVEC_BUILTIN_LVTRX,
++    RS6000_BTI_unsigned_V16QI, RS6000_BTI_INTSI, ~RS6000_BTI_UINTQI, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVTRXL, ALTIVEC_BUILTIN_LVTRXL,
++    RS6000_BTI_V4SF, RS6000_BTI_INTSI, ~RS6000_BTI_V4SF, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVTRXL, ALTIVEC_BUILTIN_LVTRXL,
++    RS6000_BTI_V4SF, RS6000_BTI_INTSI, ~RS6000_BTI_float, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVTRXL, ALTIVEC_BUILTIN_LVTRXL,
++    RS6000_BTI_bool_V4SI, RS6000_BTI_INTSI, ~RS6000_BTI_bool_V4SI, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVTRXL, ALTIVEC_BUILTIN_LVTRXL,
++    RS6000_BTI_V4SI, RS6000_BTI_INTSI, ~RS6000_BTI_V4SI, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVTRXL, ALTIVEC_BUILTIN_LVTRXL,
++    RS6000_BTI_V4SI, RS6000_BTI_INTSI, ~RS6000_BTI_INTSI, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVTRXL, ALTIVEC_BUILTIN_LVTRXL,
++    RS6000_BTI_unsigned_V4SI, RS6000_BTI_INTSI, ~RS6000_BTI_unsigned_V4SI, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVTRXL, ALTIVEC_BUILTIN_LVTRXL,
++    RS6000_BTI_unsigned_V4SI, RS6000_BTI_INTSI, ~RS6000_BTI_UINTSI, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVTRXL, ALTIVEC_BUILTIN_LVTRXL,
++    RS6000_BTI_bool_V8HI, RS6000_BTI_INTSI, ~RS6000_BTI_bool_V8HI, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVTRXL, ALTIVEC_BUILTIN_LVTRXL,
++    RS6000_BTI_pixel_V8HI, RS6000_BTI_INTSI, ~RS6000_BTI_pixel_V8HI, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVTRXL, ALTIVEC_BUILTIN_LVTRXL,
++    RS6000_BTI_V8HI, RS6000_BTI_INTSI, ~RS6000_BTI_V8HI, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVTRXL, ALTIVEC_BUILTIN_LVTRXL,
++    RS6000_BTI_V8HI, RS6000_BTI_INTSI, ~RS6000_BTI_INTHI, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVTRXL, ALTIVEC_BUILTIN_LVTRXL,
++    RS6000_BTI_unsigned_V8HI, RS6000_BTI_INTSI, ~RS6000_BTI_unsigned_V8HI, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVTRXL, ALTIVEC_BUILTIN_LVTRXL,
++    RS6000_BTI_unsigned_V8HI, RS6000_BTI_INTSI, ~RS6000_BTI_UINTHI, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVTRXL, ALTIVEC_BUILTIN_LVTRXL,
++    RS6000_BTI_bool_V16QI, RS6000_BTI_INTSI, ~RS6000_BTI_bool_V16QI, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVTRXL, ALTIVEC_BUILTIN_LVTRXL,
++    RS6000_BTI_V16QI, RS6000_BTI_INTSI, ~RS6000_BTI_V16QI, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVTRXL, ALTIVEC_BUILTIN_LVTRXL,
++    RS6000_BTI_V16QI, RS6000_BTI_INTSI, ~RS6000_BTI_INTQI, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVTRXL, ALTIVEC_BUILTIN_LVTRXL,
++    RS6000_BTI_unsigned_V16QI, RS6000_BTI_INTSI, ~RS6000_BTI_unsigned_V16QI, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVTRXL, ALTIVEC_BUILTIN_LVTRXL,
++    RS6000_BTI_unsigned_V16QI, RS6000_BTI_INTSI, ~RS6000_BTI_UINTQI, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVSWX, ALTIVEC_BUILTIN_LVSWX,
++    RS6000_BTI_V4SF, RS6000_BTI_INTSI, ~RS6000_BTI_V4SF, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVSWX, ALTIVEC_BUILTIN_LVSWX,
++    RS6000_BTI_V4SF, RS6000_BTI_INTSI, ~RS6000_BTI_float, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVSWX, ALTIVEC_BUILTIN_LVSWX,
++    RS6000_BTI_bool_V4SI, RS6000_BTI_INTSI, ~RS6000_BTI_bool_V4SI, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVSWX, ALTIVEC_BUILTIN_LVSWX,
++    RS6000_BTI_V4SI, RS6000_BTI_INTSI, ~RS6000_BTI_V4SI, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVSWX, ALTIVEC_BUILTIN_LVSWX,
++    RS6000_BTI_V4SI, RS6000_BTI_INTSI, ~RS6000_BTI_INTSI, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVSWX, ALTIVEC_BUILTIN_LVSWX,
++    RS6000_BTI_unsigned_V4SI, RS6000_BTI_INTSI, ~RS6000_BTI_unsigned_V4SI, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVSWX, ALTIVEC_BUILTIN_LVSWX,
++    RS6000_BTI_unsigned_V4SI, RS6000_BTI_INTSI, ~RS6000_BTI_UINTSI, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVSWX, ALTIVEC_BUILTIN_LVSWX,
++    RS6000_BTI_bool_V8HI, RS6000_BTI_INTSI, ~RS6000_BTI_bool_V8HI, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVSWX, ALTIVEC_BUILTIN_LVSWX,
++    RS6000_BTI_pixel_V8HI, RS6000_BTI_INTSI, ~RS6000_BTI_pixel_V8HI, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVSWX, ALTIVEC_BUILTIN_LVSWX,
++    RS6000_BTI_V8HI, RS6000_BTI_INTSI, ~RS6000_BTI_V8HI, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVSWX, ALTIVEC_BUILTIN_LVSWX,
++    RS6000_BTI_V8HI, RS6000_BTI_INTSI, ~RS6000_BTI_INTHI, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVSWX, ALTIVEC_BUILTIN_LVSWX,
++    RS6000_BTI_unsigned_V8HI, RS6000_BTI_INTSI, ~RS6000_BTI_unsigned_V8HI, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVSWX, ALTIVEC_BUILTIN_LVSWX,
++    RS6000_BTI_unsigned_V8HI, RS6000_BTI_INTSI, ~RS6000_BTI_UINTHI, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVSWX, ALTIVEC_BUILTIN_LVSWX,
++    RS6000_BTI_bool_V16QI, RS6000_BTI_INTSI, ~RS6000_BTI_bool_V16QI, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVSWX, ALTIVEC_BUILTIN_LVSWX,
++    RS6000_BTI_V16QI, RS6000_BTI_INTSI, ~RS6000_BTI_V16QI, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVSWX, ALTIVEC_BUILTIN_LVSWX,
++    RS6000_BTI_V16QI, RS6000_BTI_INTSI, ~RS6000_BTI_INTQI, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVSWX, ALTIVEC_BUILTIN_LVSWX,
++    RS6000_BTI_unsigned_V16QI, RS6000_BTI_INTSI, ~RS6000_BTI_unsigned_V16QI, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVSWX, ALTIVEC_BUILTIN_LVSWX,
++    RS6000_BTI_unsigned_V16QI, RS6000_BTI_INTSI, ~RS6000_BTI_UINTQI, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVSWXL, ALTIVEC_BUILTIN_LVSWXL,
++    RS6000_BTI_V4SF, RS6000_BTI_INTSI, ~RS6000_BTI_V4SF, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVSWXL, ALTIVEC_BUILTIN_LVSWXL,
++    RS6000_BTI_V4SF, RS6000_BTI_INTSI, ~RS6000_BTI_float, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVSWXL, ALTIVEC_BUILTIN_LVSWXL,
++    RS6000_BTI_bool_V4SI, RS6000_BTI_INTSI, ~RS6000_BTI_bool_V4SI, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVSWXL, ALTIVEC_BUILTIN_LVSWXL,
++    RS6000_BTI_V4SI, RS6000_BTI_INTSI, ~RS6000_BTI_V4SI, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVSWXL, ALTIVEC_BUILTIN_LVSWXL,
++    RS6000_BTI_V4SI, RS6000_BTI_INTSI, ~RS6000_BTI_INTSI, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVSWXL, ALTIVEC_BUILTIN_LVSWXL,
++    RS6000_BTI_unsigned_V4SI, RS6000_BTI_INTSI, ~RS6000_BTI_unsigned_V4SI, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVSWXL, ALTIVEC_BUILTIN_LVSWXL,
++    RS6000_BTI_unsigned_V4SI, RS6000_BTI_INTSI, ~RS6000_BTI_UINTSI, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVSWXL, ALTIVEC_BUILTIN_LVSWXL,
++    RS6000_BTI_bool_V8HI, RS6000_BTI_INTSI, ~RS6000_BTI_bool_V8HI, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVSWXL, ALTIVEC_BUILTIN_LVSWXL,
++    RS6000_BTI_pixel_V8HI, RS6000_BTI_INTSI, ~RS6000_BTI_pixel_V8HI, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVSWXL, ALTIVEC_BUILTIN_LVSWXL,
++    RS6000_BTI_V8HI, RS6000_BTI_INTSI, ~RS6000_BTI_V8HI, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVSWXL, ALTIVEC_BUILTIN_LVSWXL,
++    RS6000_BTI_V8HI, RS6000_BTI_INTSI, ~RS6000_BTI_INTHI, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVSWXL, ALTIVEC_BUILTIN_LVSWXL,
++    RS6000_BTI_unsigned_V8HI, RS6000_BTI_INTSI, ~RS6000_BTI_unsigned_V8HI, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVSWXL, ALTIVEC_BUILTIN_LVSWXL,
++    RS6000_BTI_unsigned_V8HI, RS6000_BTI_INTSI, ~RS6000_BTI_UINTHI, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVSWXL, ALTIVEC_BUILTIN_LVSWXL,
++    RS6000_BTI_bool_V16QI, RS6000_BTI_INTSI, ~RS6000_BTI_bool_V16QI, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVSWXL, ALTIVEC_BUILTIN_LVSWXL,
++    RS6000_BTI_V16QI, RS6000_BTI_INTSI, ~RS6000_BTI_V16QI, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVSWXL, ALTIVEC_BUILTIN_LVSWXL,
++    RS6000_BTI_V16QI, RS6000_BTI_INTSI, ~RS6000_BTI_INTQI, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVSWXL, ALTIVEC_BUILTIN_LVSWXL,
++    RS6000_BTI_unsigned_V16QI, RS6000_BTI_INTSI, ~RS6000_BTI_unsigned_V16QI, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVSWXL, ALTIVEC_BUILTIN_LVSWXL,
++    RS6000_BTI_unsigned_V16QI, RS6000_BTI_INTSI, ~RS6000_BTI_UINTQI, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVSM, ALTIVEC_BUILTIN_LVSM,
++    RS6000_BTI_V4SF, RS6000_BTI_INTSI, ~RS6000_BTI_V4SF, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVSM, ALTIVEC_BUILTIN_LVSM,
++    RS6000_BTI_V4SF, RS6000_BTI_INTSI, ~RS6000_BTI_float, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVSM, ALTIVEC_BUILTIN_LVSM,
++    RS6000_BTI_bool_V4SI, RS6000_BTI_INTSI, ~RS6000_BTI_bool_V4SI, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVSM, ALTIVEC_BUILTIN_LVSM,
++    RS6000_BTI_V4SI, RS6000_BTI_INTSI, ~RS6000_BTI_V4SI, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVSM, ALTIVEC_BUILTIN_LVSM,
++    RS6000_BTI_V4SI, RS6000_BTI_INTSI, ~RS6000_BTI_INTSI, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVSM, ALTIVEC_BUILTIN_LVSM,
++    RS6000_BTI_unsigned_V4SI, RS6000_BTI_INTSI, ~RS6000_BTI_unsigned_V4SI, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVSM, ALTIVEC_BUILTIN_LVSM,
++    RS6000_BTI_unsigned_V4SI, RS6000_BTI_INTSI, ~RS6000_BTI_UINTSI, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVSM, ALTIVEC_BUILTIN_LVSM,
++    RS6000_BTI_bool_V8HI, RS6000_BTI_INTSI, ~RS6000_BTI_bool_V8HI, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVSM, ALTIVEC_BUILTIN_LVSM,
++    RS6000_BTI_pixel_V8HI, RS6000_BTI_INTSI, ~RS6000_BTI_pixel_V8HI, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVSM, ALTIVEC_BUILTIN_LVSM,
++    RS6000_BTI_V8HI, RS6000_BTI_INTSI, ~RS6000_BTI_V8HI, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVSM, ALTIVEC_BUILTIN_LVSM,
++    RS6000_BTI_V8HI, RS6000_BTI_INTSI, ~RS6000_BTI_INTHI, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVSM, ALTIVEC_BUILTIN_LVSM,
++    RS6000_BTI_unsigned_V8HI, RS6000_BTI_INTSI, ~RS6000_BTI_unsigned_V8HI, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVSM, ALTIVEC_BUILTIN_LVSM,
++    RS6000_BTI_unsigned_V8HI, RS6000_BTI_INTSI, ~RS6000_BTI_UINTHI, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVSM, ALTIVEC_BUILTIN_LVSM,
++    RS6000_BTI_bool_V16QI, RS6000_BTI_INTSI, ~RS6000_BTI_bool_V16QI, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVSM, ALTIVEC_BUILTIN_LVSM,
++    RS6000_BTI_V16QI, RS6000_BTI_INTSI, ~RS6000_BTI_V16QI, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVSM, ALTIVEC_BUILTIN_LVSM,
++    RS6000_BTI_V16QI, RS6000_BTI_INTSI, ~RS6000_BTI_INTQI, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVSM, ALTIVEC_BUILTIN_LVSM,
++    RS6000_BTI_unsigned_V16QI, RS6000_BTI_INTSI, ~RS6000_BTI_unsigned_V16QI, 0 },
++  { ALTIVEC_BUILTIN_VEC_LVSM, ALTIVEC_BUILTIN_LVSM,
++    RS6000_BTI_unsigned_V16QI, RS6000_BTI_INTSI, ~RS6000_BTI_UINTQI, 0 },
+   { ALTIVEC_BUILTIN_VEC_MAX, ALTIVEC_BUILTIN_VMAXUB,
+     RS6000_BTI_unsigned_V16QI, RS6000_BTI_bool_V16QI, RS6000_BTI_unsigned_V16QI, 0 },
+   { ALTIVEC_BUILTIN_VEC_MAX, ALTIVEC_BUILTIN_VMAXUB,
+@@ -3012,6 +3302,46 @@
+     RS6000_BTI_void, RS6000_BTI_V16QI, RS6000_BTI_INTSI, ~RS6000_BTI_void },
+   { ALTIVEC_BUILTIN_VEC_STVEBX, ALTIVEC_BUILTIN_STVEBX,
+     RS6000_BTI_void, RS6000_BTI_unsigned_V16QI, RS6000_BTI_INTSI, ~RS6000_BTI_void },
++  { ALTIVEC_BUILTIN_VEC_STVEXWX, ALTIVEC_BUILTIN_STVEXWX,
++    RS6000_BTI_void, RS6000_BTI_V4SF, RS6000_BTI_INTSI, ~RS6000_BTI_float },
++  { ALTIVEC_BUILTIN_VEC_STVEXWX, ALTIVEC_BUILTIN_STVEXWX,
++    RS6000_BTI_void, RS6000_BTI_V4SI, RS6000_BTI_INTSI, ~RS6000_BTI_INTSI },
++  { ALTIVEC_BUILTIN_VEC_STVEXWX, ALTIVEC_BUILTIN_STVEXWX,
++    RS6000_BTI_void, RS6000_BTI_unsigned_V4SI, RS6000_BTI_INTSI, ~RS6000_BTI_UINTSI },
++  { ALTIVEC_BUILTIN_VEC_STVEXWX, ALTIVEC_BUILTIN_STVEXWX,
++    RS6000_BTI_void, RS6000_BTI_bool_V4SI, RS6000_BTI_INTSI, ~RS6000_BTI_INTSI },
++  { ALTIVEC_BUILTIN_VEC_STVEXWX, ALTIVEC_BUILTIN_STVEXWX,
++    RS6000_BTI_void, RS6000_BTI_bool_V4SI, RS6000_BTI_INTSI, ~RS6000_BTI_UINTSI },
++  { ALTIVEC_BUILTIN_VEC_STVEXWX, ALTIVEC_BUILTIN_STVEXWX,
++    RS6000_BTI_void, RS6000_BTI_V4SF, RS6000_BTI_INTSI, ~RS6000_BTI_void },
++  { ALTIVEC_BUILTIN_VEC_STVEXWX, ALTIVEC_BUILTIN_STVEXWX,
++    RS6000_BTI_void, RS6000_BTI_V4SI, RS6000_BTI_INTSI, ~RS6000_BTI_void },
++  { ALTIVEC_BUILTIN_VEC_STVEXWX, ALTIVEC_BUILTIN_STVEXWX,
++    RS6000_BTI_void, RS6000_BTI_unsigned_V4SI, RS6000_BTI_INTSI, ~RS6000_BTI_void },
++  { ALTIVEC_BUILTIN_VEC_STVEXHX, ALTIVEC_BUILTIN_STVEXHX,
++    RS6000_BTI_void, RS6000_BTI_V8HI, RS6000_BTI_INTSI, ~RS6000_BTI_INTHI },
++  { ALTIVEC_BUILTIN_VEC_STVEXHX, ALTIVEC_BUILTIN_STVEXHX,
++    RS6000_BTI_void, RS6000_BTI_unsigned_V8HI, RS6000_BTI_INTSI, ~RS6000_BTI_UINTHI },
++  { ALTIVEC_BUILTIN_VEC_STVEXHX, ALTIVEC_BUILTIN_STVEXHX,
++    RS6000_BTI_void, RS6000_BTI_bool_V8HI, RS6000_BTI_INTSI, ~RS6000_BTI_INTHI },
++  { ALTIVEC_BUILTIN_VEC_STVEXHX, ALTIVEC_BUILTIN_STVEXHX,
++    RS6000_BTI_void, RS6000_BTI_bool_V8HI, RS6000_BTI_INTSI, ~RS6000_BTI_UINTHI },
++  { ALTIVEC_BUILTIN_VEC_STVEXHX, ALTIVEC_BUILTIN_STVEXHX,
++    RS6000_BTI_void, RS6000_BTI_V8HI, RS6000_BTI_INTSI, ~RS6000_BTI_void },
++  { ALTIVEC_BUILTIN_VEC_STVEXHX, ALTIVEC_BUILTIN_STVEXHX,
++    RS6000_BTI_void, RS6000_BTI_unsigned_V8HI, RS6000_BTI_INTSI, ~RS6000_BTI_void },
++  { ALTIVEC_BUILTIN_VEC_STVEXBX, ALTIVEC_BUILTIN_STVEXBX,
++    RS6000_BTI_void, RS6000_BTI_V16QI, RS6000_BTI_INTSI, ~RS6000_BTI_INTQI },
++  { ALTIVEC_BUILTIN_VEC_STVEXBX, ALTIVEC_BUILTIN_STVEXBX,
++    RS6000_BTI_void, RS6000_BTI_unsigned_V16QI, RS6000_BTI_INTSI, ~RS6000_BTI_UINTQI },
++  { ALTIVEC_BUILTIN_VEC_STVEXBX, ALTIVEC_BUILTIN_STVEXBX,
++    RS6000_BTI_void, RS6000_BTI_bool_V16QI, RS6000_BTI_INTSI, ~RS6000_BTI_INTQI },
++  { ALTIVEC_BUILTIN_VEC_STVEXBX, ALTIVEC_BUILTIN_STVEXBX,
++    RS6000_BTI_void, RS6000_BTI_bool_V16QI, RS6000_BTI_INTSI, ~RS6000_BTI_UINTQI },
++  { ALTIVEC_BUILTIN_VEC_STVEXBX, ALTIVEC_BUILTIN_STVEXBX,
++    RS6000_BTI_void, RS6000_BTI_V16QI, RS6000_BTI_INTSI, ~RS6000_BTI_void },
++  { ALTIVEC_BUILTIN_VEC_STVEXBX, ALTIVEC_BUILTIN_STVEXBX,
++    RS6000_BTI_void, RS6000_BTI_unsigned_V16QI, RS6000_BTI_INTSI, ~RS6000_BTI_void },
+   { ALTIVEC_BUILTIN_VEC_STL, ALTIVEC_BUILTIN_STVXL_V4SF,
+     RS6000_BTI_void, RS6000_BTI_V4SF, RS6000_BTI_INTSI, ~RS6000_BTI_V4SF },
+   { ALTIVEC_BUILTIN_VEC_STL, ALTIVEC_BUILTIN_STVXL_V4SF,
+@@ -3216,6 +3546,222 @@
+     RS6000_BTI_void, RS6000_BTI_unsigned_V16QI, RS6000_BTI_INTSI, ~RS6000_BTI_unsigned_V16QI },
+   { ALTIVEC_BUILTIN_VEC_STVRXL, ALTIVEC_BUILTIN_STVRXL,
+     RS6000_BTI_void, RS6000_BTI_unsigned_V16QI, RS6000_BTI_INTSI, ~RS6000_BTI_UINTQI },
++  { ALTIVEC_BUILTIN_VEC_STVFLX, ALTIVEC_BUILTIN_STVFLX,
++    RS6000_BTI_void, RS6000_BTI_V4SF, RS6000_BTI_INTSI, ~RS6000_BTI_V4SF },
++  { ALTIVEC_BUILTIN_VEC_STVFLX, ALTIVEC_BUILTIN_STVFLX,
++    RS6000_BTI_void, RS6000_BTI_V4SF, RS6000_BTI_INTSI, ~RS6000_BTI_float },
++  { ALTIVEC_BUILTIN_VEC_STVFLX, ALTIVEC_BUILTIN_STVFLX,
++    RS6000_BTI_void, RS6000_BTI_bool_V4SI, RS6000_BTI_INTSI, ~RS6000_BTI_bool_V4SI },
++  { ALTIVEC_BUILTIN_VEC_STVFLX, ALTIVEC_BUILTIN_STVFLX,
++    RS6000_BTI_void, RS6000_BTI_V4SI, RS6000_BTI_INTSI, ~RS6000_BTI_V4SI },
++  { ALTIVEC_BUILTIN_VEC_STVFLX, ALTIVEC_BUILTIN_STVFLX,
++    RS6000_BTI_void, RS6000_BTI_V4SI, RS6000_BTI_INTSI, ~RS6000_BTI_INTSI },
++  { ALTIVEC_BUILTIN_VEC_STVFLX, ALTIVEC_BUILTIN_STVFLX,
++    RS6000_BTI_void, RS6000_BTI_unsigned_V4SI, RS6000_BTI_INTSI, ~RS6000_BTI_unsigned_V4SI },
++  { ALTIVEC_BUILTIN_VEC_STVFLX, ALTIVEC_BUILTIN_STVFLX,
++    RS6000_BTI_void, RS6000_BTI_unsigned_V4SI, RS6000_BTI_INTSI, ~RS6000_BTI_UINTSI },
++  { ALTIVEC_BUILTIN_VEC_STVFLX, ALTIVEC_BUILTIN_STVFLX,
++    RS6000_BTI_void, RS6000_BTI_bool_V8HI, RS6000_BTI_INTSI, ~RS6000_BTI_bool_V8HI },
++  { ALTIVEC_BUILTIN_VEC_STVFLX, ALTIVEC_BUILTIN_STVFLX,
++    RS6000_BTI_void, RS6000_BTI_pixel_V8HI, RS6000_BTI_INTSI, ~RS6000_BTI_pixel_V8HI },
++  { ALTIVEC_BUILTIN_VEC_STVFLX, ALTIVEC_BUILTIN_STVFLX,
++    RS6000_BTI_void, RS6000_BTI_V8HI, RS6000_BTI_INTSI, ~RS6000_BTI_V8HI },
++  { ALTIVEC_BUILTIN_VEC_STVFLX, ALTIVEC_BUILTIN_STVFLX,
++    RS6000_BTI_void, RS6000_BTI_V8HI, RS6000_BTI_INTSI, ~RS6000_BTI_INTHI },
++  { ALTIVEC_BUILTIN_VEC_STVFLX, ALTIVEC_BUILTIN_STVFLX,
++    RS6000_BTI_void, RS6000_BTI_unsigned_V8HI, RS6000_BTI_INTSI, ~RS6000_BTI_unsigned_V8HI },
++  { ALTIVEC_BUILTIN_VEC_STVFLX, ALTIVEC_BUILTIN_STVFLX,
++    RS6000_BTI_void, RS6000_BTI_unsigned_V8HI, RS6000_BTI_INTSI, ~RS6000_BTI_UINTHI },
++  { ALTIVEC_BUILTIN_VEC_STVFLX, ALTIVEC_BUILTIN_STVFLX,
++    RS6000_BTI_void, RS6000_BTI_bool_V16QI, RS6000_BTI_INTSI, ~RS6000_BTI_bool_V16QI },
++  { ALTIVEC_BUILTIN_VEC_STVFLX, ALTIVEC_BUILTIN_STVFLX,
++    RS6000_BTI_void, RS6000_BTI_V16QI, RS6000_BTI_INTSI, ~RS6000_BTI_V16QI },
++  { ALTIVEC_BUILTIN_VEC_STVFLX, ALTIVEC_BUILTIN_STVFLX,
++    RS6000_BTI_void, RS6000_BTI_V16QI, RS6000_BTI_INTSI, ~RS6000_BTI_INTQI },
++  { ALTIVEC_BUILTIN_VEC_STVFLX, ALTIVEC_BUILTIN_STVFLX,
++    RS6000_BTI_void, RS6000_BTI_unsigned_V16QI, RS6000_BTI_INTSI, ~RS6000_BTI_unsigned_V16QI },
++  { ALTIVEC_BUILTIN_VEC_STVFLX, ALTIVEC_BUILTIN_STVFLX,
++    RS6000_BTI_void, RS6000_BTI_unsigned_V16QI, RS6000_BTI_INTSI, ~RS6000_BTI_UINTQI },
++  { ALTIVEC_BUILTIN_VEC_STVFLXL, ALTIVEC_BUILTIN_STVFLXL,
++    RS6000_BTI_void, RS6000_BTI_V4SF, RS6000_BTI_INTSI, ~RS6000_BTI_V4SF },
++  { ALTIVEC_BUILTIN_VEC_STVFLXL, ALTIVEC_BUILTIN_STVFLXL,
++    RS6000_BTI_void, RS6000_BTI_V4SF, RS6000_BTI_INTSI, ~RS6000_BTI_float },
++  { ALTIVEC_BUILTIN_VEC_STVFLXL, ALTIVEC_BUILTIN_STVFLXL,
++    RS6000_BTI_void, RS6000_BTI_bool_V4SI, RS6000_BTI_INTSI, ~RS6000_BTI_bool_V4SI },
++  { ALTIVEC_BUILTIN_VEC_STVFLXL, ALTIVEC_BUILTIN_STVFLXL,
++    RS6000_BTI_void, RS6000_BTI_V4SI, RS6000_BTI_INTSI, ~RS6000_BTI_V4SI },
++  { ALTIVEC_BUILTIN_VEC_STVFLXL, ALTIVEC_BUILTIN_STVFLXL,
++    RS6000_BTI_void, RS6000_BTI_V4SI, RS6000_BTI_INTSI, ~RS6000_BTI_INTSI },
++  { ALTIVEC_BUILTIN_VEC_STVFLXL, ALTIVEC_BUILTIN_STVFLXL,
++    RS6000_BTI_void, RS6000_BTI_unsigned_V4SI, RS6000_BTI_INTSI, ~RS6000_BTI_unsigned_V4SI },
++  { ALTIVEC_BUILTIN_VEC_STVFLXL, ALTIVEC_BUILTIN_STVFLXL,
++    RS6000_BTI_void, RS6000_BTI_unsigned_V4SI, RS6000_BTI_INTSI, ~RS6000_BTI_UINTSI },
++  { ALTIVEC_BUILTIN_VEC_STVFLXL, ALTIVEC_BUILTIN_STVFLXL,
++    RS6000_BTI_void, RS6000_BTI_bool_V8HI, RS6000_BTI_INTSI, ~RS6000_BTI_bool_V8HI },
++  { ALTIVEC_BUILTIN_VEC_STVFLXL, ALTIVEC_BUILTIN_STVFLXL,
++    RS6000_BTI_void, RS6000_BTI_pixel_V8HI, RS6000_BTI_INTSI, ~RS6000_BTI_pixel_V8HI },
++  { ALTIVEC_BUILTIN_VEC_STVFLXL, ALTIVEC_BUILTIN_STVFLXL,
++    RS6000_BTI_void, RS6000_BTI_V8HI, RS6000_BTI_INTSI, ~RS6000_BTI_V8HI },
++  { ALTIVEC_BUILTIN_VEC_STVFLXL, ALTIVEC_BUILTIN_STVFLXL,
++    RS6000_BTI_void, RS6000_BTI_V8HI, RS6000_BTI_INTSI, ~RS6000_BTI_INTHI },
++  { ALTIVEC_BUILTIN_VEC_STVFLXL, ALTIVEC_BUILTIN_STVFLXL,
++    RS6000_BTI_void, RS6000_BTI_unsigned_V8HI, RS6000_BTI_INTSI, ~RS6000_BTI_unsigned_V8HI },
++  { ALTIVEC_BUILTIN_VEC_STVFLXL, ALTIVEC_BUILTIN_STVFLXL,
++    RS6000_BTI_void, RS6000_BTI_unsigned_V8HI, RS6000_BTI_INTSI, ~RS6000_BTI_UINTHI },
++  { ALTIVEC_BUILTIN_VEC_STVFLXL, ALTIVEC_BUILTIN_STVFLXL,
++    RS6000_BTI_void, RS6000_BTI_bool_V16QI, RS6000_BTI_INTSI, ~RS6000_BTI_bool_V16QI },
++  { ALTIVEC_BUILTIN_VEC_STVFLXL, ALTIVEC_BUILTIN_STVFLXL,
++    RS6000_BTI_void, RS6000_BTI_V16QI, RS6000_BTI_INTSI, ~RS6000_BTI_V16QI },
++  { ALTIVEC_BUILTIN_VEC_STVFLXL, ALTIVEC_BUILTIN_STVFLXL,
++    RS6000_BTI_void, RS6000_BTI_V16QI, RS6000_BTI_INTSI, ~RS6000_BTI_INTQI },
++  { ALTIVEC_BUILTIN_VEC_STVFLXL, ALTIVEC_BUILTIN_STVFLXL,
++    RS6000_BTI_void, RS6000_BTI_unsigned_V16QI, RS6000_BTI_INTSI, ~RS6000_BTI_unsigned_V16QI },
++  { ALTIVEC_BUILTIN_VEC_STVFLXL, ALTIVEC_BUILTIN_STVFLXL,
++    RS6000_BTI_void, RS6000_BTI_unsigned_V16QI, RS6000_BTI_INTSI, ~RS6000_BTI_UINTQI },
++  { ALTIVEC_BUILTIN_VEC_STVFRX, ALTIVEC_BUILTIN_STVFRX,
++    RS6000_BTI_void, RS6000_BTI_V4SF, RS6000_BTI_INTSI, ~RS6000_BTI_V4SF },
++  { ALTIVEC_BUILTIN_VEC_STVFRX, ALTIVEC_BUILTIN_STVFRX,
++    RS6000_BTI_void, RS6000_BTI_V4SF, RS6000_BTI_INTSI, ~RS6000_BTI_float },
++  { ALTIVEC_BUILTIN_VEC_STVFRX, ALTIVEC_BUILTIN_STVFRX,
++    RS6000_BTI_void, RS6000_BTI_bool_V4SI, RS6000_BTI_INTSI, ~RS6000_BTI_bool_V4SI },
++  { ALTIVEC_BUILTIN_VEC_STVFRX, ALTIVEC_BUILTIN_STVFRX,
++    RS6000_BTI_void, RS6000_BTI_V4SI, RS6000_BTI_INTSI, ~RS6000_BTI_V4SI },
++  { ALTIVEC_BUILTIN_VEC_STVFRX, ALTIVEC_BUILTIN_STVFRX,
++    RS6000_BTI_void, RS6000_BTI_V4SI, RS6000_BTI_INTSI, ~RS6000_BTI_INTSI },
++  { ALTIVEC_BUILTIN_VEC_STVFRX, ALTIVEC_BUILTIN_STVFRX,
++    RS6000_BTI_void, RS6000_BTI_unsigned_V4SI, RS6000_BTI_INTSI, ~RS6000_BTI_unsigned_V4SI },
++  { ALTIVEC_BUILTIN_VEC_STVFRX, ALTIVEC_BUILTIN_STVFRX,
++    RS6000_BTI_void, RS6000_BTI_unsigned_V4SI, RS6000_BTI_INTSI, ~RS6000_BTI_UINTSI },
++  { ALTIVEC_BUILTIN_VEC_STVFRX, ALTIVEC_BUILTIN_STVFRX,
++    RS6000_BTI_void, RS6000_BTI_bool_V8HI, RS6000_BTI_INTSI, ~RS6000_BTI_bool_V8HI },
++  { ALTIVEC_BUILTIN_VEC_STVFRX, ALTIVEC_BUILTIN_STVFRX,
++    RS6000_BTI_void, RS6000_BTI_pixel_V8HI, RS6000_BTI_INTSI, ~RS6000_BTI_pixel_V8HI },
++  { ALTIVEC_BUILTIN_VEC_STVFRX, ALTIVEC_BUILTIN_STVFRX,
++    RS6000_BTI_void, RS6000_BTI_V8HI, RS6000_BTI_INTSI, ~RS6000_BTI_V8HI },
++  { ALTIVEC_BUILTIN_VEC_STVFRX, ALTIVEC_BUILTIN_STVFRX,
++    RS6000_BTI_void, RS6000_BTI_V8HI, RS6000_BTI_INTSI, ~RS6000_BTI_INTHI },
++  { ALTIVEC_BUILTIN_VEC_STVFRX, ALTIVEC_BUILTIN_STVFRX,
++    RS6000_BTI_void, RS6000_BTI_unsigned_V8HI, RS6000_BTI_INTSI, ~RS6000_BTI_unsigned_V8HI },
++  { ALTIVEC_BUILTIN_VEC_STVFRX, ALTIVEC_BUILTIN_STVFRX,
++    RS6000_BTI_void, RS6000_BTI_unsigned_V8HI, RS6000_BTI_INTSI, ~RS6000_BTI_UINTHI },
++  { ALTIVEC_BUILTIN_VEC_STVFRX, ALTIVEC_BUILTIN_STVFRX,
++    RS6000_BTI_void, RS6000_BTI_bool_V16QI, RS6000_BTI_INTSI, ~RS6000_BTI_bool_V16QI },
++  { ALTIVEC_BUILTIN_VEC_STVFRX, ALTIVEC_BUILTIN_STVFRX,
++    RS6000_BTI_void, RS6000_BTI_V16QI, RS6000_BTI_INTSI, ~RS6000_BTI_V16QI },
++  { ALTIVEC_BUILTIN_VEC_STVFRX, ALTIVEC_BUILTIN_STVFRX,
++    RS6000_BTI_void, RS6000_BTI_V16QI, RS6000_BTI_INTSI, ~RS6000_BTI_INTQI },
++  { ALTIVEC_BUILTIN_VEC_STVFRX, ALTIVEC_BUILTIN_STVFRX,
++    RS6000_BTI_void, RS6000_BTI_unsigned_V16QI, RS6000_BTI_INTSI, ~RS6000_BTI_unsigned_V16QI },
++  { ALTIVEC_BUILTIN_VEC_STVFRX, ALTIVEC_BUILTIN_STVFRX,
++    RS6000_BTI_void, RS6000_BTI_unsigned_V16QI, RS6000_BTI_INTSI, ~RS6000_BTI_UINTQI },
++  { ALTIVEC_BUILTIN_VEC_STVFRXL, ALTIVEC_BUILTIN_STVFRXL,
++    RS6000_BTI_void, RS6000_BTI_V4SF, RS6000_BTI_INTSI, ~RS6000_BTI_V4SF },
++  { ALTIVEC_BUILTIN_VEC_STVFRXL, ALTIVEC_BUILTIN_STVFRXL,
++    RS6000_BTI_void, RS6000_BTI_V4SF, RS6000_BTI_INTSI, ~RS6000_BTI_float },
++  { ALTIVEC_BUILTIN_VEC_STVFRXL, ALTIVEC_BUILTIN_STVFRXL,
++    RS6000_BTI_void, RS6000_BTI_bool_V4SI, RS6000_BTI_INTSI, ~RS6000_BTI_bool_V4SI },
++  { ALTIVEC_BUILTIN_VEC_STVFRXL, ALTIVEC_BUILTIN_STVFRXL,
++    RS6000_BTI_void, RS6000_BTI_V4SI, RS6000_BTI_INTSI, ~RS6000_BTI_V4SI },
++  { ALTIVEC_BUILTIN_VEC_STVFRXL, ALTIVEC_BUILTIN_STVFRXL,
++    RS6000_BTI_void, RS6000_BTI_V4SI, RS6000_BTI_INTSI, ~RS6000_BTI_INTSI },
++  { ALTIVEC_BUILTIN_VEC_STVFRXL, ALTIVEC_BUILTIN_STVFRXL,
++    RS6000_BTI_void, RS6000_BTI_unsigned_V4SI, RS6000_BTI_INTSI, ~RS6000_BTI_unsigned_V4SI },
++  { ALTIVEC_BUILTIN_VEC_STVFRXL, ALTIVEC_BUILTIN_STVFRXL,
++    RS6000_BTI_void, RS6000_BTI_unsigned_V4SI, RS6000_BTI_INTSI, ~RS6000_BTI_UINTSI },
++  { ALTIVEC_BUILTIN_VEC_STVFRXL, ALTIVEC_BUILTIN_STVFRXL,
++    RS6000_BTI_void, RS6000_BTI_bool_V8HI, RS6000_BTI_INTSI, ~RS6000_BTI_bool_V8HI },
++  { ALTIVEC_BUILTIN_VEC_STVFRXL, ALTIVEC_BUILTIN_STVFRXL,
++    RS6000_BTI_void, RS6000_BTI_pixel_V8HI, RS6000_BTI_INTSI, ~RS6000_BTI_pixel_V8HI },
++  { ALTIVEC_BUILTIN_VEC_STVFRXL, ALTIVEC_BUILTIN_STVFRXL,
++    RS6000_BTI_void, RS6000_BTI_V8HI, RS6000_BTI_INTSI, ~RS6000_BTI_V8HI },
++  { ALTIVEC_BUILTIN_VEC_STVFRXL, ALTIVEC_BUILTIN_STVFRXL,
++    RS6000_BTI_void, RS6000_BTI_V8HI, RS6000_BTI_INTSI, ~RS6000_BTI_INTHI },
++  { ALTIVEC_BUILTIN_VEC_STVFRXL, ALTIVEC_BUILTIN_STVFRXL,
++    RS6000_BTI_void, RS6000_BTI_unsigned_V8HI, RS6000_BTI_INTSI, ~RS6000_BTI_unsigned_V8HI },
++  { ALTIVEC_BUILTIN_VEC_STVFRXL, ALTIVEC_BUILTIN_STVFRXL,
++    RS6000_BTI_void, RS6000_BTI_unsigned_V8HI, RS6000_BTI_INTSI, ~RS6000_BTI_UINTHI },
++  { ALTIVEC_BUILTIN_VEC_STVFRXL, ALTIVEC_BUILTIN_STVFRXL,
++    RS6000_BTI_void, RS6000_BTI_bool_V16QI, RS6000_BTI_INTSI, ~RS6000_BTI_bool_V16QI },
++  { ALTIVEC_BUILTIN_VEC_STVFRXL, ALTIVEC_BUILTIN_STVFRXL,
++    RS6000_BTI_void, RS6000_BTI_V16QI, RS6000_BTI_INTSI, ~RS6000_BTI_V16QI },
++  { ALTIVEC_BUILTIN_VEC_STVFRXL, ALTIVEC_BUILTIN_STVFRXL,
++    RS6000_BTI_void, RS6000_BTI_V16QI, RS6000_BTI_INTSI, ~RS6000_BTI_INTQI },
++  { ALTIVEC_BUILTIN_VEC_STVFRXL, ALTIVEC_BUILTIN_STVFRXL,
++    RS6000_BTI_void, RS6000_BTI_unsigned_V16QI, RS6000_BTI_INTSI, ~RS6000_BTI_unsigned_V16QI },
++  { ALTIVEC_BUILTIN_VEC_STVFRXL, ALTIVEC_BUILTIN_STVFRXL,
++    RS6000_BTI_void, RS6000_BTI_unsigned_V16QI, RS6000_BTI_INTSI, ~RS6000_BTI_UINTQI },
++  { ALTIVEC_BUILTIN_VEC_STVSWX, ALTIVEC_BUILTIN_STVSWX,
++    RS6000_BTI_void, RS6000_BTI_V4SF, RS6000_BTI_INTSI, ~RS6000_BTI_V4SF },
++  { ALTIVEC_BUILTIN_VEC_STVSWX, ALTIVEC_BUILTIN_STVSWX,
++    RS6000_BTI_void, RS6000_BTI_V4SF, RS6000_BTI_INTSI, ~RS6000_BTI_float },
++  { ALTIVEC_BUILTIN_VEC_STVSWX, ALTIVEC_BUILTIN_STVSWX,
++    RS6000_BTI_void, RS6000_BTI_bool_V4SI, RS6000_BTI_INTSI, ~RS6000_BTI_bool_V4SI },
++  { ALTIVEC_BUILTIN_VEC_STVSWX, ALTIVEC_BUILTIN_STVSWX,
++    RS6000_BTI_void, RS6000_BTI_V4SI, RS6000_BTI_INTSI, ~RS6000_BTI_V4SI },
++  { ALTIVEC_BUILTIN_VEC_STVSWX, ALTIVEC_BUILTIN_STVSWX,
++    RS6000_BTI_void, RS6000_BTI_V4SI, RS6000_BTI_INTSI, ~RS6000_BTI_INTSI },
++  { ALTIVEC_BUILTIN_VEC_STVSWX, ALTIVEC_BUILTIN_STVSWX,
++    RS6000_BTI_void, RS6000_BTI_unsigned_V4SI, RS6000_BTI_INTSI, ~RS6000_BTI_unsigned_V4SI },
++  { ALTIVEC_BUILTIN_VEC_STVSWX, ALTIVEC_BUILTIN_STVSWX,
++    RS6000_BTI_void, RS6000_BTI_unsigned_V4SI, RS6000_BTI_INTSI, ~RS6000_BTI_UINTSI },
++  { ALTIVEC_BUILTIN_VEC_STVSWX, ALTIVEC_BUILTIN_STVSWX,
++    RS6000_BTI_void, RS6000_BTI_bool_V8HI, RS6000_BTI_INTSI, ~RS6000_BTI_bool_V8HI },
++  { ALTIVEC_BUILTIN_VEC_STVSWX, ALTIVEC_BUILTIN_STVSWX,
++    RS6000_BTI_void, RS6000_BTI_pixel_V8HI, RS6000_BTI_INTSI, ~RS6000_BTI_pixel_V8HI },
++  { ALTIVEC_BUILTIN_VEC_STVSWX, ALTIVEC_BUILTIN_STVSWX,
++    RS6000_BTI_void, RS6000_BTI_V8HI, RS6000_BTI_INTSI, ~RS6000_BTI_V8HI },
++  { ALTIVEC_BUILTIN_VEC_STVSWX, ALTIVEC_BUILTIN_STVSWX,
++    RS6000_BTI_void, RS6000_BTI_V8HI, RS6000_BTI_INTSI, ~RS6000_BTI_INTHI },
++  { ALTIVEC_BUILTIN_VEC_STVSWX, ALTIVEC_BUILTIN_STVSWX,
++    RS6000_BTI_void, RS6000_BTI_unsigned_V8HI, RS6000_BTI_INTSI, ~RS6000_BTI_unsigned_V8HI },
++  { ALTIVEC_BUILTIN_VEC_STVSWX, ALTIVEC_BUILTIN_STVSWX,
++    RS6000_BTI_void, RS6000_BTI_unsigned_V8HI, RS6000_BTI_INTSI, ~RS6000_BTI_UINTHI },
++  { ALTIVEC_BUILTIN_VEC_STVSWX, ALTIVEC_BUILTIN_STVSWX,
++    RS6000_BTI_void, RS6000_BTI_bool_V16QI, RS6000_BTI_INTSI, ~RS6000_BTI_bool_V16QI },
++  { ALTIVEC_BUILTIN_VEC_STVSWX, ALTIVEC_BUILTIN_STVSWX,
++    RS6000_BTI_void, RS6000_BTI_V16QI, RS6000_BTI_INTSI, ~RS6000_BTI_V16QI },
++  { ALTIVEC_BUILTIN_VEC_STVSWX, ALTIVEC_BUILTIN_STVSWX,
++    RS6000_BTI_void, RS6000_BTI_V16QI, RS6000_BTI_INTSI, ~RS6000_BTI_INTQI },
++  { ALTIVEC_BUILTIN_VEC_STVSWX, ALTIVEC_BUILTIN_STVSWX,
++    RS6000_BTI_void, RS6000_BTI_unsigned_V16QI, RS6000_BTI_INTSI, ~RS6000_BTI_unsigned_V16QI },
++  { ALTIVEC_BUILTIN_VEC_STVSWX, ALTIVEC_BUILTIN_STVSWX,
++    RS6000_BTI_void, RS6000_BTI_unsigned_V16QI, RS6000_BTI_INTSI, ~RS6000_BTI_UINTQI },
++  { ALTIVEC_BUILTIN_VEC_STVSWXL, ALTIVEC_BUILTIN_STVSWXL,
++    RS6000_BTI_void, RS6000_BTI_V4SF, RS6000_BTI_INTSI, ~RS6000_BTI_V4SF },
++  { ALTIVEC_BUILTIN_VEC_STVSWXL, ALTIVEC_BUILTIN_STVSWXL,
++    RS6000_BTI_void, RS6000_BTI_V4SF, RS6000_BTI_INTSI, ~RS6000_BTI_float },
++  { ALTIVEC_BUILTIN_VEC_STVSWXL, ALTIVEC_BUILTIN_STVSWXL,
++    RS6000_BTI_void, RS6000_BTI_bool_V4SI, RS6000_BTI_INTSI, ~RS6000_BTI_bool_V4SI },
++  { ALTIVEC_BUILTIN_VEC_STVSWXL, ALTIVEC_BUILTIN_STVSWXL,
++    RS6000_BTI_void, RS6000_BTI_V4SI, RS6000_BTI_INTSI, ~RS6000_BTI_V4SI },
++  { ALTIVEC_BUILTIN_VEC_STVSWXL, ALTIVEC_BUILTIN_STVSWXL,
++    RS6000_BTI_void, RS6000_BTI_V4SI, RS6000_BTI_INTSI, ~RS6000_BTI_INTSI },
++  { ALTIVEC_BUILTIN_VEC_STVSWXL, ALTIVEC_BUILTIN_STVSWXL,
++    RS6000_BTI_void, RS6000_BTI_unsigned_V4SI, RS6000_BTI_INTSI, ~RS6000_BTI_unsigned_V4SI },
++  { ALTIVEC_BUILTIN_VEC_STVSWXL, ALTIVEC_BUILTIN_STVSWXL,
++    RS6000_BTI_void, RS6000_BTI_unsigned_V4SI, RS6000_BTI_INTSI, ~RS6000_BTI_UINTSI },
++  { ALTIVEC_BUILTIN_VEC_STVSWXL, ALTIVEC_BUILTIN_STVSWXL,
++    RS6000_BTI_void, RS6000_BTI_bool_V8HI, RS6000_BTI_INTSI, ~RS6000_BTI_bool_V8HI },
++  { ALTIVEC_BUILTIN_VEC_STVSWXL, ALTIVEC_BUILTIN_STVSWXL,
++    RS6000_BTI_void, RS6000_BTI_pixel_V8HI, RS6000_BTI_INTSI, ~RS6000_BTI_pixel_V8HI },
++  { ALTIVEC_BUILTIN_VEC_STVSWXL, ALTIVEC_BUILTIN_STVSWXL,
++    RS6000_BTI_void, RS6000_BTI_V8HI, RS6000_BTI_INTSI, ~RS6000_BTI_V8HI },
++  { ALTIVEC_BUILTIN_VEC_STVSWXL, ALTIVEC_BUILTIN_STVSWXL,
++    RS6000_BTI_void, RS6000_BTI_V8HI, RS6000_BTI_INTSI, ~RS6000_BTI_INTHI },
++  { ALTIVEC_BUILTIN_VEC_STVSWXL, ALTIVEC_BUILTIN_STVSWXL,
++    RS6000_BTI_void, RS6000_BTI_unsigned_V8HI, RS6000_BTI_INTSI, ~RS6000_BTI_unsigned_V8HI },
++  { ALTIVEC_BUILTIN_VEC_STVSWXL, ALTIVEC_BUILTIN_STVSWXL,
++    RS6000_BTI_void, RS6000_BTI_unsigned_V8HI, RS6000_BTI_INTSI, ~RS6000_BTI_UINTHI },
++  { ALTIVEC_BUILTIN_VEC_STVSWXL, ALTIVEC_BUILTIN_STVSWXL,
++    RS6000_BTI_void, RS6000_BTI_bool_V16QI, RS6000_BTI_INTSI, ~RS6000_BTI_bool_V16QI },
++  { ALTIVEC_BUILTIN_VEC_STVSWXL, ALTIVEC_BUILTIN_STVSWXL,
++    RS6000_BTI_void, RS6000_BTI_V16QI, RS6000_BTI_INTSI, ~RS6000_BTI_V16QI },
++  { ALTIVEC_BUILTIN_VEC_STVSWXL, ALTIVEC_BUILTIN_STVSWXL,
++    RS6000_BTI_void, RS6000_BTI_V16QI, RS6000_BTI_INTSI, ~RS6000_BTI_INTQI },
++  { ALTIVEC_BUILTIN_VEC_STVSWXL, ALTIVEC_BUILTIN_STVSWXL,
++    RS6000_BTI_void, RS6000_BTI_unsigned_V16QI, RS6000_BTI_INTSI, ~RS6000_BTI_unsigned_V16QI },
++  { ALTIVEC_BUILTIN_VEC_STVSWXL, ALTIVEC_BUILTIN_STVSWXL,
++    RS6000_BTI_void, RS6000_BTI_unsigned_V16QI, RS6000_BTI_INTSI, ~RS6000_BTI_UINTQI },
+   { VSX_BUILTIN_VEC_XXSLDWI, VSX_BUILTIN_XXSLDWI_16QI,
+     RS6000_BTI_V16QI, RS6000_BTI_V16QI, RS6000_BTI_V16QI, RS6000_BTI_NOT_OPAQUE },
+   { VSX_BUILTIN_VEC_XXSLDWI, VSX_BUILTIN_XXSLDWI_16QI,
+diff -Naur gcc-4.9.1/gcc/config/rs6000/rs6000-cpus.def gcc-4.9.1-e6500-FSF/gcc/config/rs6000/rs6000-cpus.def
+--- gcc-4.9.1/gcc/config/rs6000/rs6000-cpus.def	2014-01-23 19:56:48.000000000 -0600
++++ gcc-4.9.1-e6500-FSF/gcc/config/rs6000/rs6000-cpus.def	2014-07-17 02:38:35.051383001 -0500
+@@ -95,6 +95,7 @@
+ 				 | OPTION_MASK_SOFT_FLOAT		\
+ 				 | OPTION_MASK_STRICT_ALIGN_OPTIONAL	\
+ 				 | OPTION_MASK_VSX			\
++				 | OPTION_MASK_ALTIVEC2			\
+ 				 | OPTION_MASK_VSX_TIMODE)
+ 
+ #endif
+diff -Naur gcc-4.9.1/gcc/config/rs6000/rs6000.h gcc-4.9.1-e6500-FSF/gcc/config/rs6000/rs6000.h
+--- gcc-4.9.1/gcc/config/rs6000/rs6000.h	2014-06-13 16:56:16.000000000 -0500
++++ gcc-4.9.1-e6500-FSF/gcc/config/rs6000/rs6000.h	2014-07-17 02:38:35.052383000 -0500
+@@ -523,13 +523,15 @@
+ 
+ #define TARGET_FCTIDZ	TARGET_FCFID
+ #define TARGET_STFIWX	TARGET_PPC_GFXOPT
+-#define TARGET_LFIWAX	TARGET_CMPB
+-#define TARGET_LFIWZX	TARGET_POPCNTD
+-#define TARGET_FCFIDS	TARGET_POPCNTD
+-#define TARGET_FCFIDU	TARGET_POPCNTD
+-#define TARGET_FCFIDUS	TARGET_POPCNTD
+-#define TARGET_FCTIDUZ	TARGET_POPCNTD
+-#define TARGET_FCTIWUZ	TARGET_POPCNTD
++#define TARGET_LFIWAX	(TARGET_CMPB && rs6000_cpu != PROCESSOR_PPCE5500 \
++			 && rs6000_cpu != PROCESSOR_PPCE6500)
++#define TARGET_LFIWZX	(TARGET_POPCNTD && rs6000_cpu != PROCESSOR_PPCE5500 \
++			 && rs6000_cpu != PROCESSOR_PPCE6500)
++#define TARGET_FCFIDS	TARGET_LFIWZX
++#define TARGET_FCFIDU	TARGET_LFIWZX
++#define TARGET_FCFIDUS	TARGET_LFIWZX
++#define TARGET_FCTIDUZ	TARGET_LFIWZX
++#define TARGET_FCTIWUZ	TARGET_LFIWZX
+ 
+ #define TARGET_XSCVDPSPN	(TARGET_DIRECT_MOVE || TARGET_P8_VECTOR)
+ #define TARGET_XSCVSPDPN	(TARGET_DIRECT_MOVE || TARGET_P8_VECTOR)
+@@ -657,10 +659,14 @@
+ 
+ #define TARGET_FRE	(TARGET_HARD_FLOAT && TARGET_FPRS \
+ 			 && TARGET_DOUBLE_FLOAT \
+-			 && (TARGET_POPCNTB || VECTOR_UNIT_VSX_P (DFmode)))
++			 && (TARGET_POPCNTB || VECTOR_UNIT_VSX_P (DFmode)) \
++			 && rs6000_cpu != PROCESSOR_PPCE5500 \
++			 && rs6000_cpu != PROCESSOR_PPCE6500)
+ 
+ #define TARGET_FRSQRTES	(TARGET_HARD_FLOAT && TARGET_POPCNTB \
+-			 && TARGET_FPRS && TARGET_SINGLE_FLOAT)
++			 && TARGET_FPRS && TARGET_SINGLE_FLOAT \
++			 && rs6000_cpu != PROCESSOR_PPCE5500 \
++			 && rs6000_cpu != PROCESSOR_PPCE6500)
+ 
+ #define TARGET_FRSQRTE	(TARGET_HARD_FLOAT && TARGET_FPRS \
+ 			 && TARGET_DOUBLE_FLOAT \
+@@ -2512,6 +2518,7 @@
+    aren't in target_flags.  */
+ #define RS6000_BTM_ALWAYS	0		/* Always enabled.  */
+ #define RS6000_BTM_ALTIVEC	MASK_ALTIVEC	/* VMX/altivec vectors.  */
++#define RS6000_BTM_ALTIVEC2	OPTION_MASK_ALTIVEC2 /* ISA 2.07 altivec vectors.  */
+ #define RS6000_BTM_VSX		MASK_VSX	/* VSX (vector/scalar).  */
+ #define RS6000_BTM_P8_VECTOR	MASK_P8_VECTOR	/* ISA 2.07 vector.  */
+ #define RS6000_BTM_CRYPTO	MASK_CRYPTO	/* crypto funcs.  */
+@@ -2529,6 +2536,7 @@
+ #define RS6000_BTM_LDBL128	MASK_MULTIPLE	/* 128-bit long double.  */
+ 
+ #define RS6000_BTM_COMMON	(RS6000_BTM_ALTIVEC			\
++				 | RS6000_BTM_ALTIVEC2			\
+ 				 | RS6000_BTM_VSX			\
+ 				 | RS6000_BTM_P8_VECTOR			\
+ 				 | RS6000_BTM_CRYPTO			\
+diff -Naur gcc-4.9.1/gcc/config/rs6000/rs6000.md gcc-4.9.1-e6500-FSF/gcc/config/rs6000/rs6000.md
+--- gcc-4.9.1/gcc/config/rs6000/rs6000.md	2014-06-13 16:56:16.000000000 -0500
++++ gcc-4.9.1-e6500-FSF/gcc/config/rs6000/rs6000.md	2014-07-17 02:38:35.053383000 -0500
+@@ -5342,10 +5342,10 @@
+    && ((TARGET_PPC_GFXOPT
+         && !HONOR_NANS (<MODE>mode)
+         && !HONOR_SIGNED_ZEROS (<MODE>mode))
+-       || TARGET_CMPB
++       || TARGET_LFIWAX
+        || VECTOR_UNIT_VSX_P (<MODE>mode))"
+ {
+-  if (TARGET_CMPB || VECTOR_UNIT_VSX_P (<MODE>mode))
++  if (TARGET_LFIWAX || VECTOR_UNIT_VSX_P (<MODE>mode))
+     {
+       emit_insn (gen_copysign<mode>3_fcpsgn (operands[0], operands[1],
+ 					     operands[2]));
+@@ -5364,7 +5364,7 @@
+ 	(unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>")
+ 		      (match_operand:SFDF 2 "gpc_reg_operand" "<Ff>,<Fv>")]
+ 		     UNSPEC_COPYSIGN))]
+-  "TARGET_<MODE>_FPR && TARGET_CMPB"
++  "TARGET_<MODE>_FPR && TARGET_LFIWAX"
+   "@
+    fcpsgn %0,%2,%1
+    xscpsgn<Fvsx> %x0,%x2,%x1"
+diff -Naur gcc-4.9.1/gcc/config/rs6000/rs6000.opt gcc-4.9.1-e6500-FSF/gcc/config/rs6000/rs6000.opt
+--- gcc-4.9.1/gcc/config/rs6000/rs6000.opt	2014-01-23 19:56:48.000000000 -0600
++++ gcc-4.9.1-e6500-FSF/gcc/config/rs6000/rs6000.opt	2014-07-17 02:38:35.054383000 -0500
+@@ -148,6 +148,10 @@
+ Target Report RejectNegative Var(rs6000_altivec_element_order, 2)
+ Generate Altivec instructions using big-endian element order
+ 
++maltivec2
++Target Report Mask(ALTIVEC2) Var(rs6000_isa_flags)
++Use AltiVec PowerPC V2.07 instructions
++
+ mhard-dfp
+ Target Report Mask(DFP) Var(rs6000_isa_flags)
+ Use decimal floating point instructions
+diff -Naur gcc-4.9.1/gcc/testsuite/gcc.target/powerpc/altivec2_builtin-10.c gcc-4.9.1-e6500-FSF/gcc/testsuite/gcc.target/powerpc/altivec2_builtin-10.c
+--- gcc-4.9.1/gcc/testsuite/gcc.target/powerpc/altivec2_builtin-10.c	1969-12-31 18:00:00.000000000 -0600
++++ gcc-4.9.1-e6500-FSF/gcc/testsuite/gcc.target/powerpc/altivec2_builtin-10.c	2014-07-17 02:38:35.054383000 -0500
+@@ -0,0 +1,66 @@
++/* { dg-do compile { target { powerpc*-*-* } } } */
++/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
++/* { dg-require-effective-target powerpc_altivec_ok } */
++/* { dg-options "-O2 -maltivec -maltivec2" } */
++/* { dg-final { scan-assembler-times "lvtlx" 37 } } */
++
++#include <altivec.h>
++
++typedef __vector signed char vsc;
++typedef __vector signed short vss;
++typedef __vector signed int vsi;
++typedef __vector unsigned char vuc;
++typedef __vector unsigned short vus;
++typedef __vector unsigned int vui;
++typedef __vector bool char vbc;
++typedef __vector bool short vbs;
++typedef __vector bool int vbi;
++typedef __vector float vsf;
++typedef __vector pixel vp;
++typedef signed char sc;
++typedef signed short ss;
++typedef signed int si;
++typedef signed long sl;
++typedef unsigned char uc;
++typedef unsigned short us;
++typedef unsigned int ui;
++typedef unsigned long ul;
++typedef float sf;
++
++vsc  lc1(long a, void *p)           { return __builtin_altivec_lvtlx (a,p); }
++vsf  llx01(long a, vsf *p)          { return __builtin_vec_lvtlx (a,p); }
++vsf  llx02(long a, sf *p)           { return __builtin_vec_lvtlx (a,p); }
++vbi  llx03(long a, vbi *p)          { return __builtin_vec_lvtlx (a,p); }
++vsi  llx04(long a, vsi *p)          { return __builtin_vec_lvtlx (a,p); }
++vsi  llx05(long a, si *p)           { return __builtin_vec_lvtlx (a,p); }
++vui  llx06(long a, vui *p)          { return __builtin_vec_lvtlx (a,p); }
++vui  llx07(long a, ui *p)           { return __builtin_vec_lvtlx (a,p); }
++vbs  llx08(long a, vbs *p)          { return __builtin_vec_lvtlx (a,p); }
++vp   llx09(long a, vp *p)           { return __builtin_vec_lvtlx (a,p); }
++vss  llx10(long a, vss *p)          { return __builtin_vec_lvtlx (a,p); }
++vss  llx11(long a, ss *p)           { return __builtin_vec_lvtlx (a,p); }
++vus  llx12(long a, vus *p)          { return __builtin_vec_lvtlx (a,p); }
++vus  llx13(long a, us *p)           { return __builtin_vec_lvtlx (a,p); }
++vbc  llx14(long a, vbc *p)          { return __builtin_vec_lvtlx (a,p); }
++vsc  llx15(long a, vsc *p)          { return __builtin_vec_lvtlx (a,p); }
++vsc  llx16(long a, sc *p)           { return __builtin_vec_lvtlx (a,p); }
++vuc  llx17(long a, vuc *p)          { return __builtin_vec_lvtlx (a,p); }
++vuc  llx18(long a, uc *p)           { return __builtin_vec_lvtlx (a,p); }
++vsf  Dllx01(long a, vsf *p)         { return vec_lvtlx (a,p); }
++vsf  Dllx02(long a, sf *p)          { return vec_lvtlx (a,p); }
++vbi  Dllx03(long a, vbi *p)         { return vec_lvtlx (a,p); }
++vsi  Dllx04(long a, vsi *p)         { return vec_lvtlx (a,p); }
++vsi  Dllx05(long a, si *p)          { return vec_lvtlx (a,p); }
++vui  Dllx06(long a, vui *p)         { return vec_lvtlx (a,p); }
++vui  Dllx07(long a, ui *p)          { return vec_lvtlx (a,p); }
++vbs  Dllx08(long a, vbs *p)         { return vec_lvtlx (a,p); }
++vp   Dllx09(long a, vp *p)          { return vec_lvtlx (a,p); }
++vss  Dllx10(long a, vss *p)         { return vec_lvtlx (a,p); }
++vss  Dllx11(long a, ss *p)          { return vec_lvtlx (a,p); }
++vus  Dllx12(long a, vus *p)         { return vec_lvtlx (a,p); }
++vus  Dllx13(long a, us *p)          { return vec_lvtlx (a,p); }
++vbc  Dllx14(long a, vbc *p)         { return vec_lvtlx (a,p); }
++vsc  Dllx15(long a, vsc *p)         { return vec_lvtlx (a,p); }
++vsc  Dllx16(long a, sc *p)          { return vec_lvtlx (a,p); }
++vuc  Dllx17(long a, vuc *p)         { return vec_lvtlx (a,p); }
++vuc  Dllx18(long a, uc *p)          { return vec_lvtlx (a,p); }
+diff -Naur gcc-4.9.1/gcc/testsuite/gcc.target/powerpc/altivec2_builtin-11.c gcc-4.9.1-e6500-FSF/gcc/testsuite/gcc.target/powerpc/altivec2_builtin-11.c
+--- gcc-4.9.1/gcc/testsuite/gcc.target/powerpc/altivec2_builtin-11.c	1969-12-31 18:00:00.000000000 -0600
++++ gcc-4.9.1-e6500-FSF/gcc/testsuite/gcc.target/powerpc/altivec2_builtin-11.c	2014-07-17 02:38:35.054383000 -0500
+@@ -0,0 +1,66 @@
++/* { dg-do compile { target { powerpc*-*-* } } } */
++/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
++/* { dg-require-effective-target powerpc_altivec_ok } */
++/* { dg-options "-O2 -maltivec -maltivec2" } */
++/* { dg-final { scan-assembler-times "lvtlxl" 37 } } */
++
++#include <altivec.h>
++
++typedef __vector signed char vsc;
++typedef __vector signed short vss;
++typedef __vector signed int vsi;
++typedef __vector unsigned char vuc;
++typedef __vector unsigned short vus;
++typedef __vector unsigned int vui;
++typedef __vector bool char vbc;
++typedef __vector bool short vbs;
++typedef __vector bool int vbi;
++typedef __vector float vsf;
++typedef __vector pixel vp;
++typedef signed char sc;
++typedef signed short ss;
++typedef signed int si;
++typedef signed long sl;
++typedef unsigned char uc;
++typedef unsigned short us;
++typedef unsigned int ui;
++typedef unsigned long ul;
++typedef float sf;
++
++vsc  lc2(long a, void *p)           { return __builtin_altivec_lvtlxl (a,p); }
++vsf  llxl01(long a, vsf *p)         { return __builtin_vec_lvtlxl (a,p); }
++vsf  llxl02(long a, sf *p)          { return __builtin_vec_lvtlxl (a,p); }
++vbi  llxl03(long a, vbi *p)         { return __builtin_vec_lvtlxl (a,p); }
++vsi  llxl04(long a, vsi *p)         { return __builtin_vec_lvtlxl (a,p); }
++vsi  llxl05(long a, si *p)          { return __builtin_vec_lvtlxl (a,p); }
++vui  llxl06(long a, vui *p)         { return __builtin_vec_lvtlxl (a,p); }
++vui  llxl07(long a, ui *p)          { return __builtin_vec_lvtlxl (a,p); }
++vbs  llxl08(long a, vbs *p)         { return __builtin_vec_lvtlxl (a,p); }
++vp   llxl09(long a, vp *p)          { return __builtin_vec_lvtlxl (a,p); }
++vss  llxl10(long a, vss *p)         { return __builtin_vec_lvtlxl (a,p); }
++vss  llxl11(long a, ss *p)          { return __builtin_vec_lvtlxl (a,p); }
++vus  llxl12(long a, vus *p)         { return __builtin_vec_lvtlxl (a,p); }
++vus  llxl13(long a, us *p)          { return __builtin_vec_lvtlxl (a,p); }
++vbc  llxl14(long a, vbc *p)         { return __builtin_vec_lvtlxl (a,p); }
++vsc  llxl15(long a, vsc *p)         { return __builtin_vec_lvtlxl (a,p); }
++vsc  llxl16(long a, sc *p)          { return __builtin_vec_lvtlxl (a,p); }
++vuc  llxl17(long a, vuc *p)         { return __builtin_vec_lvtlxl (a,p); }
++vuc  llxl18(long a, uc *p)          { return __builtin_vec_lvtlxl (a,p); }
++vsf  Dllxl01(long a, vsf *p)        { return vec_lvtlxl (a,p); }
++vsf  Dllxl02(long a, sf *p)         { return vec_lvtlxl (a,p); }
++vbi  Dllxl03(long a, vbi *p)        { return vec_lvtlxl (a,p); }
++vsi  Dllxl04(long a, vsi *p)        { return vec_lvtlxl (a,p); }
++vsi  Dllxl05(long a, si *p)         { return vec_lvtlxl (a,p); }
++vui  Dllxl06(long a, vui *p)        { return vec_lvtlxl (a,p); }
++vui  Dllxl07(long a, ui *p)         { return vec_lvtlxl (a,p); }
++vbs  Dllxl08(long a, vbs *p)        { return vec_lvtlxl (a,p); }
++vp   Dllxl09(long a, vp *p)         { return vec_lvtlxl (a,p); }
++vss  Dllxl10(long a, vss *p)        { return vec_lvtlxl (a,p); }
++vss  Dllxl11(long a, ss *p)         { return vec_lvtlxl (a,p); }
++vus  Dllxl12(long a, vus *p)        { return vec_lvtlxl (a,p); }
++vus  Dllxl13(long a, us *p)         { return vec_lvtlxl (a,p); }
++vbc  Dllxl14(long a, vbc *p)        { return vec_lvtlxl (a,p); }
++vsc  Dllxl15(long a, vsc *p)        { return vec_lvtlxl (a,p); }
++vsc  Dllxl16(long a, sc *p)         { return vec_lvtlxl (a,p); }
++vuc  Dllxl17(long a, vuc *p)        { return vec_lvtlxl (a,p); }
++vuc  Dllxl18(long a, uc *p)         { return vec_lvtlxl (a,p); }
+diff -Naur gcc-4.9.1/gcc/testsuite/gcc.target/powerpc/altivec2_builtin-12.c gcc-4.9.1-e6500-FSF/gcc/testsuite/gcc.target/powerpc/altivec2_builtin-12.c
+--- gcc-4.9.1/gcc/testsuite/gcc.target/powerpc/altivec2_builtin-12.c	1969-12-31 18:00:00.000000000 -0600
++++ gcc-4.9.1-e6500-FSF/gcc/testsuite/gcc.target/powerpc/altivec2_builtin-12.c	2014-07-17 02:38:35.054383000 -0500
+@@ -0,0 +1,66 @@
++/* { dg-do compile { target { powerpc*-*-* } } } */
++/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
++/* { dg-require-effective-target powerpc_altivec_ok } */
++/* { dg-options "-O2 -maltivec -maltivec2" } */
++/* { dg-final { scan-assembler-times "lvtrx" 37 } } */
++
++#include <altivec.h>
++
++typedef __vector signed char vsc;
++typedef __vector signed short vss;
++typedef __vector signed int vsi;
++typedef __vector unsigned char vuc;
++typedef __vector unsigned short vus;
++typedef __vector unsigned int vui;
++typedef __vector bool char vbc;
++typedef __vector bool short vbs;
++typedef __vector bool int vbi;
++typedef __vector float vsf;
++typedef __vector pixel vp;
++typedef signed char sc;
++typedef signed short ss;
++typedef signed int si;
++typedef signed long sl;
++typedef unsigned char uc;
++typedef unsigned short us;
++typedef unsigned int ui;
++typedef unsigned long ul;
++typedef float sf;
++
++vsc  lc3(long a, void *p)           { return __builtin_altivec_lvtrx (a,p); }
++vsf  lrx01(long a, vsf *p)          { return __builtin_vec_lvtrx (a,p); }
++vsf  lrx02(long a, sf *p)           { return __builtin_vec_lvtrx (a,p); }
++vbi  lrx03(long a, vbi *p)          { return __builtin_vec_lvtrx (a,p); }
++vsi  lrx04(long a, vsi *p)          { return __builtin_vec_lvtrx (a,p); }
++vsi  lrx05(long a, si *p)           { return __builtin_vec_lvtrx (a,p); }
++vui  lrx06(long a, vui *p)          { return __builtin_vec_lvtrx (a,p); }
++vui  lrx07(long a, ui *p)           { return __builtin_vec_lvtrx (a,p); }
++vbs  lrx08(long a, vbs *p)          { return __builtin_vec_lvtrx (a,p); }
++vp   lrx09(long a, vp *p)           { return __builtin_vec_lvtrx (a,p); }
++vss  lrx10(long a, vss *p)          { return __builtin_vec_lvtrx (a,p); }
++vss  lrx11(long a, ss *p)           { return __builtin_vec_lvtrx (a,p); }
++vus  lrx12(long a, vus *p)          { return __builtin_vec_lvtrx (a,p); }
++vus  lrx13(long a, us *p)           { return __builtin_vec_lvtrx (a,p); }
++vbc  lrx14(long a, vbc *p)          { return __builtin_vec_lvtrx (a,p); }
++vsc  lrx15(long a, vsc *p)          { return __builtin_vec_lvtrx (a,p); }
++vsc  lrx16(long a, sc *p)           { return __builtin_vec_lvtrx (a,p); }
++vuc  lrx17(long a, vuc *p)          { return __builtin_vec_lvtrx (a,p); }
++vuc  lrx18(long a, uc *p)           { return __builtin_vec_lvtrx (a,p); }
++vsf  Dlrx01(long a, vsf *p)         { return vec_lvtrx (a,p); }
++vsf  Dlrx02(long a, sf *p)          { return vec_lvtrx (a,p); }
++vbi  Dlrx03(long a, vbi *p)         { return vec_lvtrx (a,p); }
++vsi  Dlrx04(long a, vsi *p)         { return vec_lvtrx (a,p); }
++vsi  Dlrx05(long a, si *p)          { return vec_lvtrx (a,p); }
++vui  Dlrx06(long a, vui *p)         { return vec_lvtrx (a,p); }
++vui  Dlrx07(long a, ui *p)          { return vec_lvtrx (a,p); }
++vbs  Dlrx08(long a, vbs *p)         { return vec_lvtrx (a,p); }
++vp   Dlrx09(long a, vp *p)          { return vec_lvtrx (a,p); }
++vss  Dlrx10(long a, vss *p)         { return vec_lvtrx (a,p); }
++vss  Dlrx11(long a, ss *p)          { return vec_lvtrx (a,p); }
++vus  Dlrx12(long a, vus *p)         { return vec_lvtrx (a,p); }
++vus  Dlrx13(long a, us *p)          { return vec_lvtrx (a,p); }
++vbc  Dlrx14(long a, vbc *p)         { return vec_lvtrx (a,p); }
++vsc  Dlrx15(long a, vsc *p)         { return vec_lvtrx (a,p); }
++vsc  Dlrx16(long a, sc *p)          { return vec_lvtrx (a,p); }
++vuc  Dlrx17(long a, vuc *p)         { return vec_lvtrx (a,p); }
++vuc  Dlrx18(long a, uc *p)          { return vec_lvtrx (a,p); }
+diff -Naur gcc-4.9.1/gcc/testsuite/gcc.target/powerpc/altivec2_builtin-13.c gcc-4.9.1-e6500-FSF/gcc/testsuite/gcc.target/powerpc/altivec2_builtin-13.c
+--- gcc-4.9.1/gcc/testsuite/gcc.target/powerpc/altivec2_builtin-13.c	1969-12-31 18:00:00.000000000 -0600
++++ gcc-4.9.1-e6500-FSF/gcc/testsuite/gcc.target/powerpc/altivec2_builtin-13.c	2014-07-17 02:38:35.054383000 -0500
+@@ -0,0 +1,66 @@
++/* { dg-do compile { target { powerpc*-*-* } } } */
++/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
++/* { dg-require-effective-target powerpc_altivec_ok } */
++/* { dg-options "-O2 -maltivec -maltivec2" } */
++/* { dg-final { scan-assembler-times "lvtrxl" 37 } } */
++
++#include <altivec.h>
++
++typedef __vector signed char vsc;
++typedef __vector signed short vss;
++typedef __vector signed int vsi;
++typedef __vector unsigned char vuc;
++typedef __vector unsigned short vus;
++typedef __vector unsigned int vui;
++typedef __vector bool char vbc;
++typedef __vector bool short vbs;
++typedef __vector bool int vbi;
++typedef __vector float vsf;
++typedef __vector pixel vp;
++typedef signed char sc;
++typedef signed short ss;
++typedef signed int si;
++typedef signed long sl;
++typedef unsigned char uc;
++typedef unsigned short us;
++typedef unsigned int ui;
++typedef unsigned long ul;
++typedef float sf;
++
++vsc  lc4(long a, void *p)           { return __builtin_altivec_lvtrxl (a,p); }
++vsf  lrxl01(long a, vsf *p)         { return __builtin_vec_lvtrxl (a,p); }
++vsf  lrxl02(long a, sf *p)          { return __builtin_vec_lvtrxl (a,p); }
++vbi  lrxl03(long a, vbi *p)         { return __builtin_vec_lvtrxl (a,p); }
++vsi  lrxl04(long a, vsi *p)         { return __builtin_vec_lvtrxl (a,p); }
++vsi  lrxl05(long a, si *p)          { return __builtin_vec_lvtrxl (a,p); }
++vui  lrxl06(long a, vui *p)         { return __builtin_vec_lvtrxl (a,p); }
++vui  lrxl07(long a, ui *p)          { return __builtin_vec_lvtrxl (a,p); }
++vbs  lrxl08(long a, vbs *p)         { return __builtin_vec_lvtrxl (a,p); }
++vp   lrxl09(long a, vp *p)          { return __builtin_vec_lvtrxl (a,p); }
++vss  lrxl10(long a, vss *p)         { return __builtin_vec_lvtrxl (a,p); }
++vss  lrxl11(long a, ss *p)          { return __builtin_vec_lvtrxl (a,p); }
++vus  lrxl12(long a, vus *p)         { return __builtin_vec_lvtrxl (a,p); }
++vus  lrxl13(long a, us *p)          { return __builtin_vec_lvtrxl (a,p); }
++vbc  lrxl14(long a, vbc *p)         { return __builtin_vec_lvtrxl (a,p); }
++vsc  lrxl15(long a, vsc *p)         { return __builtin_vec_lvtrxl (a,p); }
++vsc  lrxl16(long a, sc *p)          { return __builtin_vec_lvtrxl (a,p); }
++vuc  lrxl17(long a, vuc *p)         { return __builtin_vec_lvtrxl (a,p); }
++vuc  lrxl18(long a, uc *p)          { return __builtin_vec_lvtrxl (a,p); }
++vsf  Dlrxl01(long a, vsf *p)        { return vec_lvtrxl (a,p); }
++vsf  Dlrxl02(long a, sf *p)         { return vec_lvtrxl (a,p); }
++vbi  Dlrxl03(long a, vbi *p)        { return vec_lvtrxl (a,p); }
++vsi  Dlrxl04(long a, vsi *p)        { return vec_lvtrxl (a,p); }
++vsi  Dlrxl05(long a, si *p)         { return vec_lvtrxl (a,p); }
++vui  Dlrxl06(long a, vui *p)        { return vec_lvtrxl (a,p); }
++vui  Dlrxl07(long a, ui *p)         { return vec_lvtrxl (a,p); }
++vbs  Dlrxl08(long a, vbs *p)        { return vec_lvtrxl (a,p); }
++vp   Dlrxl09(long a, vp *p)         { return vec_lvtrxl (a,p); }
++vss  Dlrxl10(long a, vss *p)        { return vec_lvtrxl (a,p); }
++vss  Dlrxl11(long a, ss *p)         { return vec_lvtrxl (a,p); }
++vus  Dlrxl12(long a, vus *p)        { return vec_lvtrxl (a,p); }
++vus  Dlrxl13(long a, us *p)         { return vec_lvtrxl (a,p); }
++vbc  Dlrxl14(long a, vbc *p)        { return vec_lvtrxl (a,p); }
++vsc  Dlrxl15(long a, vsc *p)        { return vec_lvtrxl (a,p); }
++vsc  Dlrxl16(long a, sc *p)         { return vec_lvtrxl (a,p); }
++vuc  Dlrxl17(long a, vuc *p)        { return vec_lvtrxl (a,p); }
++vuc  Dlrxl18(long a, uc *p)         { return vec_lvtrxl (a,p); }
+diff -Naur gcc-4.9.1/gcc/testsuite/gcc.target/powerpc/altivec2_builtin-14.c gcc-4.9.1-e6500-FSF/gcc/testsuite/gcc.target/powerpc/altivec2_builtin-14.c
+--- gcc-4.9.1/gcc/testsuite/gcc.target/powerpc/altivec2_builtin-14.c	1969-12-31 18:00:00.000000000 -0600
++++ gcc-4.9.1-e6500-FSF/gcc/testsuite/gcc.target/powerpc/altivec2_builtin-14.c	2014-07-17 02:38:35.054383000 -0500
+@@ -0,0 +1,66 @@
++/* { dg-do compile { target { powerpc*-*-* } } } */
++/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
++/* { dg-require-effective-target powerpc_altivec_ok } */
++/* { dg-options "-O2 -maltivec -maltivec2" } */
++/* { dg-final { scan-assembler-times "stvflx" 37 } } */
++
++#include <altivec.h>
++
++typedef __vector signed char vsc;
++typedef __vector signed short vss;
++typedef __vector signed int vsi;
++typedef __vector unsigned char vuc;
++typedef __vector unsigned short vus;
++typedef __vector unsigned int vui;
++typedef __vector bool char vbc;
++typedef __vector bool short vbs;
++typedef __vector bool int vbi;
++typedef __vector float vsf;
++typedef __vector pixel vp;
++typedef signed char sc;
++typedef signed short ss;
++typedef signed int si;
++typedef signed long sl;
++typedef unsigned char uc;
++typedef unsigned short us;
++typedef unsigned int ui;
++typedef unsigned long ul;
++typedef float sf;
++
++void sc1(vsc v, long a, void *p)    { __builtin_altivec_stvflx (v,a,p); }
++void slx01(vsf v, long a, vsf *p)   { __builtin_vec_stvflx (v,a,p); }
++void slx02(vsf v, long a, sf *p)    { __builtin_vec_stvflx (v,a,p); }
++void slx03(vbi v, long a, vbi *p)   { __builtin_vec_stvflx (v,a,p); }
++void slx04(vsi v, long a, vsi *p)   { __builtin_vec_stvflx (v,a,p); }
++void slx05(vsi v, long a, si *p)    { __builtin_vec_stvflx (v,a,p); }
++void slx06(vui v, long a, vui *p)   { __builtin_vec_stvflx (v,a,p); }
++void slx07(vui v, long a, ui *p)    { __builtin_vec_stvflx (v,a,p); }
++void slx08(vbs v, long a, vbs *p)   { __builtin_vec_stvflx (v,a,p); }
++void slx09(vp v, long a, vp *p)     { __builtin_vec_stvflx (v,a,p); }
++void slx10(vss v, long a, vss *p)   { __builtin_vec_stvflx (v,a,p); }
++void slx11(vss v, long a, ss *p)    { __builtin_vec_stvflx (v,a,p); }
++void slx12(vus v, long a, vus *p)   { __builtin_vec_stvflx (v,a,p); }
++void slx13(vus v, long a, us *p)    { __builtin_vec_stvflx (v,a,p); }
++void slx14(vbc v, long a, vbc *p)   { __builtin_vec_stvflx (v,a,p); }
++void slx15(vsc v, long a, vsc *p)   { __builtin_vec_stvflx (v,a,p); }
++void slx16(vsc v, long a, sc *p)    { __builtin_vec_stvflx (v,a,p); }
++void slx17(vuc v, long a, vuc *p)   { __builtin_vec_stvflx (v,a,p); }
++void slx18(vuc v, long a, uc *p)    { __builtin_vec_stvflx (v,a,p); }
++void Dslx01(vsf v, long a, vsf *p)  { vec_stvflx (v,a,p); }
++void Dslx02(vsf v, long a, sf *p)   { vec_stvflx (v,a,p); }
++void Dslx03(vbi v, long a, vbi *p)  { vec_stvflx (v,a,p); }
++void Dslx04(vsi v, long a, vsi *p)  { vec_stvflx (v,a,p); }
++void Dslx05(vsi v, long a, si *p)   { vec_stvflx (v,a,p); }
++void Dslx06(vui v, long a, vui *p)  { vec_stvflx (v,a,p); }
++void Dslx07(vui v, long a, ui *p)   { vec_stvflx (v,a,p); }
++void Dslx08(vbs v, long a, vbs *p)  { vec_stvflx (v,a,p); }
++void Dslx09(vp v, long a, vp *p)    { vec_stvflx (v,a,p); }
++void Dslx10(vss v, long a, vss *p)  { vec_stvflx (v,a,p); }
++void Dslx11(vss v, long a, ss *p)   { vec_stvflx (v,a,p); }
++void Dslx12(vus v, long a, vus *p)  { vec_stvflx (v,a,p); }
++void Dslx13(vus v, long a, us *p)   { vec_stvflx (v,a,p); }
++void Dslx14(vbc v, long a, vbc *p)  { vec_stvflx (v,a,p); }
++void Dslx15(vsc v, long a, vsc *p)  { vec_stvflx (v,a,p); }
++void Dslx16(vsc v, long a, sc *p)   { vec_stvflx (v,a,p); }
++void Dslx17(vuc v, long a, vuc *p)  { vec_stvflx (v,a,p); }
++void Dslx18(vuc v, long a, uc *p)   { vec_stvflx (v,a,p); }
+diff -Naur gcc-4.9.1/gcc/testsuite/gcc.target/powerpc/altivec2_builtin-15.c gcc-4.9.1-e6500-FSF/gcc/testsuite/gcc.target/powerpc/altivec2_builtin-15.c
+--- gcc-4.9.1/gcc/testsuite/gcc.target/powerpc/altivec2_builtin-15.c	1969-12-31 18:00:00.000000000 -0600
++++ gcc-4.9.1-e6500-FSF/gcc/testsuite/gcc.target/powerpc/altivec2_builtin-15.c	2014-07-17 02:38:35.055383000 -0500
+@@ -0,0 +1,66 @@
++/* { dg-do compile { target { powerpc*-*-* } } } */
++/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
++/* { dg-require-effective-target powerpc_altivec_ok } */
++/* { dg-options "-O2 -maltivec -maltivec2" } */
++/* { dg-final { scan-assembler-times "stvflxl" 37 } } */
++
++#include <altivec.h>
++
++typedef __vector signed char vsc;
++typedef __vector signed short vss;
++typedef __vector signed int vsi;
++typedef __vector unsigned char vuc;
++typedef __vector unsigned short vus;
++typedef __vector unsigned int vui;
++typedef __vector bool char vbc;
++typedef __vector bool short vbs;
++typedef __vector bool int vbi;
++typedef __vector float vsf;
++typedef __vector pixel vp;
++typedef signed char sc;
++typedef signed short ss;
++typedef signed int si;
++typedef signed long sl;
++typedef unsigned char uc;
++typedef unsigned short us;
++typedef unsigned int ui;
++typedef unsigned long ul;
++typedef float sf;
++
++void sc2(vsc v, long a, void *p)    { __builtin_altivec_stvflxl (v,a,p); }
++void slxl01(vsf v, long a, vsf *p)  { __builtin_vec_stvflxl (v,a,p); }
++void slxl02(vsf v, long a, sf *p)   { __builtin_vec_stvflxl (v,a,p); }
++void slxl03(vbi v, long a, vbi *p)  { __builtin_vec_stvflxl (v,a,p); }
++void slxl04(vsi v, long a, vsi *p)  { __builtin_vec_stvflxl (v,a,p); }
++void slxl05(vsi v, long a, si *p)   { __builtin_vec_stvflxl (v,a,p); }
++void slxl06(vui v, long a, vui *p)  { __builtin_vec_stvflxl (v,a,p); }
++void slxl07(vui v, long a, ui *p)   { __builtin_vec_stvflxl (v,a,p); }
++void slxl08(vbs v, long a, vbs *p)  { __builtin_vec_stvflxl (v,a,p); }
++void slxl09(vp v, long a, vp *p)    { __builtin_vec_stvflxl (v,a,p); }
++void slxl10(vss v, long a, vss *p)  { __builtin_vec_stvflxl (v,a,p); }
++void slxl11(vss v, long a, ss *p)   { __builtin_vec_stvflxl (v,a,p); }
++void slxl12(vus v, long a, vus *p)  { __builtin_vec_stvflxl (v,a,p); }
++void slxl13(vus v, long a, us *p)   { __builtin_vec_stvflxl (v,a,p); }
++void slxl14(vbc v, long a, vbc *p)  { __builtin_vec_stvflxl (v,a,p); }
++void slxl15(vsc v, long a, vsc *p)  { __builtin_vec_stvflxl (v,a,p); }
++void slxl16(vsc v, long a, sc *p)   { __builtin_vec_stvflxl (v,a,p); }
++void slxl17(vuc v, long a, vuc *p)  { __builtin_vec_stvflxl (v,a,p); }
++void slxl18(vuc v, long a, uc *p)   { __builtin_vec_stvflxl (v,a,p); }
++void Dslxl01(vsf v, long a, vsf *p) { vec_stvflxl (v,a,p); }
++void Dslxl02(vsf v, long a, sf *p)  { vec_stvflxl (v,a,p); }
++void Dslxl03(vbi v, long a, vbi *p) { vec_stvflxl (v,a,p); }
++void Dslxl04(vsi v, long a, vsi *p) { vec_stvflxl (v,a,p); }
++void Dslxl05(vsi v, long a, si *p)  { vec_stvflxl (v,a,p); }
++void Dslxl06(vui v, long a, vui *p) { vec_stvflxl (v,a,p); }
++void Dslxl07(vui v, long a, ui *p)  { vec_stvflxl (v,a,p); }
++void Dslxl08(vbs v, long a, vbs *p) { vec_stvflxl (v,a,p); }
++void Dslxl09(vp v, long a, vp *p)   { vec_stvflxl (v,a,p); }
++void Dslxl10(vss v, long a, vss *p) { vec_stvflxl (v,a,p); }
++void Dslxl11(vss v, long a, ss *p)  { vec_stvflxl (v,a,p); }
++void Dslxl12(vus v, long a, vus *p) { vec_stvflxl (v,a,p); }
++void Dslxl13(vus v, long a, us *p)  { vec_stvflxl (v,a,p); }
++void Dslxl14(vbc v, long a, vbc *p) { vec_stvflxl (v,a,p); }
++void Dslxl15(vsc v, long a, vsc *p) { vec_stvflxl (v,a,p); }
++void Dslxl16(vsc v, long a, sc *p)  { vec_stvflxl (v,a,p); }
++void Dslxl17(vuc v, long a, vuc *p) { vec_stvflxl (v,a,p); }
++void Dslxl18(vuc v, long a, uc *p)  { vec_stvflxl (v,a,p); }
+diff -Naur gcc-4.9.1/gcc/testsuite/gcc.target/powerpc/altivec2_builtin-16.c gcc-4.9.1-e6500-FSF/gcc/testsuite/gcc.target/powerpc/altivec2_builtin-16.c
+--- gcc-4.9.1/gcc/testsuite/gcc.target/powerpc/altivec2_builtin-16.c	1969-12-31 18:00:00.000000000 -0600
++++ gcc-4.9.1-e6500-FSF/gcc/testsuite/gcc.target/powerpc/altivec2_builtin-16.c	2014-07-17 02:38:35.055383000 -0500
+@@ -0,0 +1,66 @@
++/* { dg-do compile { target { powerpc*-*-* } } } */
++/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
++/* { dg-require-effective-target powerpc_altivec_ok } */
++/* { dg-options "-O2 -maltivec -maltivec2" } */
++/* { dg-final { scan-assembler-times "stvfrx" 37 } } */
++
++#include <altivec.h>
++
++typedef __vector signed char vsc;
++typedef __vector signed short vss;
++typedef __vector signed int vsi;
++typedef __vector unsigned char vuc;
++typedef __vector unsigned short vus;
++typedef __vector unsigned int vui;
++typedef __vector bool char vbc;
++typedef __vector bool short vbs;
++typedef __vector bool int vbi;
++typedef __vector float vsf;
++typedef __vector pixel vp;
++typedef signed char sc;
++typedef signed short ss;
++typedef signed int si;
++typedef signed long sl;
++typedef unsigned char uc;
++typedef unsigned short us;
++typedef unsigned int ui;
++typedef unsigned long ul;
++typedef float sf;
++
++void sc3(vsc v, long a, void *p)    { __builtin_altivec_stvfrx (v,a,p); }
++void srx01(vsf v, long a, vsf *p)   { __builtin_vec_stvfrx (v,a,p); }
++void srx02(vsf v, long a, sf *p)    { __builtin_vec_stvfrx (v,a,p); }
++void srx03(vbi v, long a, vbi *p)   { __builtin_vec_stvfrx (v,a,p); }
++void srx04(vsi v, long a, vsi *p)   { __builtin_vec_stvfrx (v,a,p); }
++void srx05(vsi v, long a, si *p)    { __builtin_vec_stvfrx (v,a,p); }
++void srx06(vui v, long a, vui *p)   { __builtin_vec_stvfrx (v,a,p); }
++void srx07(vui v, long a, ui *p)    { __builtin_vec_stvfrx (v,a,p); }
++void srx08(vbs v, long a, vbs *p)   { __builtin_vec_stvfrx (v,a,p); }
++void srx09(vp v, long a, vp *p)     { __builtin_vec_stvfrx (v,a,p); }
++void srx10(vss v, long a, vss *p)   { __builtin_vec_stvfrx (v,a,p); }
++void srx11(vss v, long a, ss *p)    { __builtin_vec_stvfrx (v,a,p); }
++void srx12(vus v, long a, vus *p)   { __builtin_vec_stvfrx (v,a,p); }
++void srx13(vus v, long a, us *p)    { __builtin_vec_stvfrx (v,a,p); }
++void srx14(vbc v, long a, vbc *p)   { __builtin_vec_stvfrx (v,a,p); }
++void srx15(vsc v, long a, vsc *p)   { __builtin_vec_stvfrx (v,a,p); }
++void srx16(vsc v, long a, sc *p)    { __builtin_vec_stvfrx (v,a,p); }
++void srx17(vuc v, long a, vuc *p)   { __builtin_vec_stvfrx (v,a,p); }
++void srx18(vuc v, long a, uc *p)    { __builtin_vec_stvfrx (v,a,p); }
++void Dsrx01(vsf v, long a, vsf *p)  { vec_stvfrx (v,a,p); }
++void Dsrx02(vsf v, long a, sf *p)   { vec_stvfrx (v,a,p); }
++void Dsrx03(vbi v, long a, vbi *p)  { vec_stvfrx (v,a,p); }
++void Dsrx04(vsi v, long a, vsi *p)  { vec_stvfrx (v,a,p); }
++void Dsrx05(vsi v, long a, si *p)   { vec_stvfrx (v,a,p); }
++void Dsrx06(vui v, long a, vui *p)  { vec_stvfrx (v,a,p); }
++void Dsrx07(vui v, long a, ui *p)   { vec_stvfrx (v,a,p); }
++void Dsrx08(vbs v, long a, vbs *p)  { vec_stvfrx (v,a,p); }
++void Dsrx09(vp v, long a, vp *p)    { vec_stvfrx (v,a,p); }
++void Dsrx10(vss v, long a, vss *p)  { vec_stvfrx (v,a,p); }
++void Dsrx11(vss v, long a, ss *p)   { vec_stvfrx (v,a,p); }
++void Dsrx12(vus v, long a, vus *p)  { vec_stvfrx (v,a,p); }
++void Dsrx13(vus v, long a, us *p)   { vec_stvfrx (v,a,p); }
++void Dsrx14(vbc v, long a, vbc *p)  { vec_stvfrx (v,a,p); }
++void Dsrx15(vsc v, long a, vsc *p)  { vec_stvfrx (v,a,p); }
++void Dsrx16(vsc v, long a, sc *p)   { vec_stvfrx (v,a,p); }
++void Dsrx17(vuc v, long a, vuc *p)  { vec_stvfrx (v,a,p); }
++void Dsrx18(vuc v, long a, uc *p)   { vec_stvfrx (v,a,p); }
+diff -Naur gcc-4.9.1/gcc/testsuite/gcc.target/powerpc/altivec2_builtin-17.c gcc-4.9.1-e6500-FSF/gcc/testsuite/gcc.target/powerpc/altivec2_builtin-17.c
+--- gcc-4.9.1/gcc/testsuite/gcc.target/powerpc/altivec2_builtin-17.c	1969-12-31 18:00:00.000000000 -0600
++++ gcc-4.9.1-e6500-FSF/gcc/testsuite/gcc.target/powerpc/altivec2_builtin-17.c	2014-07-17 02:38:35.055383000 -0500
+@@ -0,0 +1,66 @@
++/* { dg-do compile { target { powerpc*-*-* } } } */
++/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
++/* { dg-require-effective-target powerpc_altivec_ok } */
++/* { dg-options "-O2 -maltivec -maltivec2" } */
++/* { dg-final { scan-assembler-times "stvfrxl" 37 } } */
++
++#include <altivec.h>
++
++typedef __vector signed char vsc;
++typedef __vector signed short vss;
++typedef __vector signed int vsi;
++typedef __vector unsigned char vuc;
++typedef __vector unsigned short vus;
++typedef __vector unsigned int vui;
++typedef __vector bool char vbc;
++typedef __vector bool short vbs;
++typedef __vector bool int vbi;
++typedef __vector float vsf;
++typedef __vector pixel vp;
++typedef signed char sc;
++typedef signed short ss;
++typedef signed int si;
++typedef signed long sl;
++typedef unsigned char uc;
++typedef unsigned short us;
++typedef unsigned int ui;
++typedef unsigned long ul;
++typedef float sf;
++
++void sc4(vsc v, long a, void *p)    { __builtin_altivec_stvfrxl (v,a,p); }
++void srxl01(vsf v, long a, vsf *p)  { __builtin_vec_stvfrxl (v,a,p); }
++void srxl02(vsf v, long a, sf *p)   { __builtin_vec_stvfrxl (v,a,p); }
++void srxl03(vbi v, long a, vbi *p)  { __builtin_vec_stvfrxl (v,a,p); }
++void srxl04(vsi v, long a, vsi *p)  { __builtin_vec_stvfrxl (v,a,p); }
++void srxl05(vsi v, long a, si *p)   { __builtin_vec_stvfrxl (v,a,p); }
++void srxl06(vui v, long a, vui *p)  { __builtin_vec_stvfrxl (v,a,p); }
++void srxl07(vui v, long a, ui *p)   { __builtin_vec_stvfrxl (v,a,p); }
++void srxl08(vbs v, long a, vbs *p)  { __builtin_vec_stvfrxl (v,a,p); }
++void srxl09(vp v, long a, vp *p)    { __builtin_vec_stvfrxl (v,a,p); }
++void srxl10(vss v, long a, vss *p)  { __builtin_vec_stvfrxl (v,a,p); }
++void srxl11(vss v, long a, ss *p)   { __builtin_vec_stvfrxl (v,a,p); }
++void srxl12(vus v, long a, vus *p)  { __builtin_vec_stvfrxl (v,a,p); }
++void srxl13(vus v, long a, us *p)   { __builtin_vec_stvfrxl (v,a,p); }
++void srxl14(vbc v, long a, vbc *p)  { __builtin_vec_stvfrxl (v,a,p); }
++void srxl15(vsc v, long a, vsc *p)  { __builtin_vec_stvfrxl (v,a,p); }
++void srxl16(vsc v, long a, sc *p)   { __builtin_vec_stvfrxl (v,a,p); }
++void srxl17(vuc v, long a, vuc *p)  { __builtin_vec_stvfrxl (v,a,p); }
++void srxl18(vuc v, long a, uc *p)   { __builtin_vec_stvfrxl (v,a,p); }
++void Dsrxl01(vsf v, long a, vsf *p) { vec_stvfrxl (v,a,p); }
++void Dsrxl02(vsf v, long a, sf *p)  { vec_stvfrxl (v,a,p); }
++void Dsrxl03(vbi v, long a, vbi *p) { vec_stvfrxl (v,a,p); }
++void Dsrxl04(vsi v, long a, vsi *p) { vec_stvfrxl (v,a,p); }
++void Dsrxl05(vsi v, long a, si *p)  { vec_stvfrxl (v,a,p); }
++void Dsrxl06(vui v, long a, vui *p) { vec_stvfrxl (v,a,p); }
++void Dsrxl07(vui v, long a, ui *p)  { vec_stvfrxl (v,a,p); }
++void Dsrxl08(vbs v, long a, vbs *p) { vec_stvfrxl (v,a,p); }
++void Dsrxl09(vp v, long a, vp *p)   { vec_stvfrxl (v,a,p); }
++void Dsrxl10(vss v, long a, vss *p) { vec_stvfrxl (v,a,p); }
++void Dsrxl11(vss v, long a, ss *p)  { vec_stvfrxl (v,a,p); }
++void Dsrxl12(vus v, long a, vus *p) { vec_stvfrxl (v,a,p); }
++void Dsrxl13(vus v, long a, us *p)  { vec_stvfrxl (v,a,p); }
++void Dsrxl14(vbc v, long a, vbc *p) { vec_stvfrxl (v,a,p); }
++void Dsrxl15(vsc v, long a, vsc *p) { vec_stvfrxl (v,a,p); }
++void Dsrxl16(vsc v, long a, sc *p)  { vec_stvfrxl (v,a,p); }
++void Dsrxl17(vuc v, long a, vuc *p) { vec_stvfrxl (v,a,p); }
++void Dsrxl18(vuc v, long a, uc *p)  { vec_stvfrxl (v,a,p); }
+diff -Naur gcc-4.9.1/gcc/testsuite/gcc.target/powerpc/altivec2_builtin-18.c gcc-4.9.1-e6500-FSF/gcc/testsuite/gcc.target/powerpc/altivec2_builtin-18.c
+--- gcc-4.9.1/gcc/testsuite/gcc.target/powerpc/altivec2_builtin-18.c	1969-12-31 18:00:00.000000000 -0600
++++ gcc-4.9.1-e6500-FSF/gcc/testsuite/gcc.target/powerpc/altivec2_builtin-18.c	2014-07-17 02:38:35.055383000 -0500
+@@ -0,0 +1,66 @@
++/* { dg-do compile { target { powerpc*-*-* } } } */
++/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
++/* { dg-require-effective-target powerpc_altivec_ok } */
++/* { dg-options "-O2 -maltivec -maltivec2" } */
++/* { dg-final { scan-assembler-times "lvswx" 37 } } */
++
++#include <altivec.h>
++
++typedef __vector signed char vsc;
++typedef __vector signed short vss;
++typedef __vector signed int vsi;
++typedef __vector unsigned char vuc;
++typedef __vector unsigned short vus;
++typedef __vector unsigned int vui;
++typedef __vector bool char vbc;
++typedef __vector bool short vbs;
++typedef __vector bool int vbi;
++typedef __vector float vsf;
++typedef __vector pixel vp;
++typedef signed char sc;
++typedef signed short ss;
++typedef signed int si;
++typedef signed long sl;
++typedef unsigned char uc;
++typedef unsigned short us;
++typedef unsigned int ui;
++typedef unsigned long ul;
++typedef float sf;
++
++vsc  ls1(long a, void *p)           { return __builtin_altivec_lvswx (a,p); }
++vsf  ls01(long a, vsf *p)           { return __builtin_vec_lvswx (a,p); }
++vsf  ls02(long a, sf *p)            { return __builtin_vec_lvswx (a,p); }
++vbi  ls03(long a, vbi *p)           { return __builtin_vec_lvswx (a,p); }
++vsi  ls04(long a, vsi *p)           { return __builtin_vec_lvswx (a,p); }
++vsi  ls05(long a, si *p)            { return __builtin_vec_lvswx (a,p); }
++vui  ls06(long a, vui *p)           { return __builtin_vec_lvswx (a,p); }
++vui  ls07(long a, ui *p)            { return __builtin_vec_lvswx (a,p); }
++vbs  ls08(long a, vbs *p)           { return __builtin_vec_lvswx (a,p); }
++vp   ls09(long a, vp *p)            { return __builtin_vec_lvswx (a,p); }
++vss  ls10(long a, vss *p)           { return __builtin_vec_lvswx (a,p); }
++vss  ls11(long a, ss *p)            { return __builtin_vec_lvswx (a,p); }
++vus  ls12(long a, vus *p)           { return __builtin_vec_lvswx (a,p); }
++vus  ls13(long a, us *p)            { return __builtin_vec_lvswx (a,p); }
++vbc  ls14(long a, vbc *p)           { return __builtin_vec_lvswx (a,p); }
++vsc  ls15(long a, vsc *p)           { return __builtin_vec_lvswx (a,p); }
++vsc  ls16(long a, sc *p)            { return __builtin_vec_lvswx (a,p); }
++vuc  ls17(long a, vuc *p)           { return __builtin_vec_lvswx (a,p); }
++vuc  ls18(long a, uc *p)            { return __builtin_vec_lvswx (a,p); }
++vsf  Dls01(long a, vsf *p)          { return vec_lvswx (a,p); }
++vsf  Dls02(long a, sf *p)           { return vec_lvswx (a,p); }
++vbi  Dls03(long a, vbi *p)          { return vec_lvswx (a,p); }
++vsi  Dls04(long a, vsi *p)          { return vec_lvswx (a,p); }
++vsi  Dls05(long a, si *p)           { return vec_lvswx (a,p); }
++vui  Dls06(long a, vui *p)          { return vec_lvswx (a,p); }
++vui  Dls07(long a, ui *p)           { return vec_lvswx (a,p); }
++vbs  Dls08(long a, vbs *p)          { return vec_lvswx (a,p); }
++vp   Dls09(long a, vp *p)           { return vec_lvswx (a,p); }
++vss  Dls10(long a, vss *p)          { return vec_lvswx (a,p); }
++vss  Dls11(long a, ss *p)           { return vec_lvswx (a,p); }
++vus  Dls12(long a, vus *p)          { return vec_lvswx (a,p); }
++vus  Dls13(long a, us *p)           { return vec_lvswx (a,p); }
++vbc  Dls14(long a, vbc *p)          { return vec_lvswx (a,p); }
++vsc  Dls15(long a, vsc *p)          { return vec_lvswx (a,p); }
++vsc  Dls16(long a, sc *p)           { return vec_lvswx (a,p); }
++vuc  Dls17(long a, vuc *p)          { return vec_lvswx (a,p); }
++vuc  Dls18(long a, uc *p)           { return vec_lvswx (a,p); }
+diff -Naur gcc-4.9.1/gcc/testsuite/gcc.target/powerpc/altivec2_builtin-19.c gcc-4.9.1-e6500-FSF/gcc/testsuite/gcc.target/powerpc/altivec2_builtin-19.c
+--- gcc-4.9.1/gcc/testsuite/gcc.target/powerpc/altivec2_builtin-19.c	1969-12-31 18:00:00.000000000 -0600
++++ gcc-4.9.1-e6500-FSF/gcc/testsuite/gcc.target/powerpc/altivec2_builtin-19.c	2014-07-17 02:38:35.055383000 -0500
+@@ -0,0 +1,66 @@
++/* { dg-do compile { target { powerpc*-*-* } } } */
++/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
++/* { dg-require-effective-target powerpc_altivec_ok } */
++/* { dg-options "-O2 -maltivec -maltivec2" } */
++/* { dg-final { scan-assembler-times "lvswxl" 37 } } */
++
++#include <altivec.h>
++
++typedef __vector signed char vsc;
++typedef __vector signed short vss;
++typedef __vector signed int vsi;
++typedef __vector unsigned char vuc;
++typedef __vector unsigned short vus;
++typedef __vector unsigned int vui;
++typedef __vector bool char vbc;
++typedef __vector bool short vbs;
++typedef __vector bool int vbi;
++typedef __vector float vsf;
++typedef __vector pixel vp;
++typedef signed char sc;
++typedef signed short ss;
++typedef signed int si;
++typedef signed long sl;
++typedef unsigned char uc;
++typedef unsigned short us;
++typedef unsigned int ui;
++typedef unsigned long ul;
++typedef float sf;
++
++vsc  ls2l(long a, void *p)          { return __builtin_altivec_lvswxl (a,p); }
++vsf  lsl01(long a, vsf *p)          { return __builtin_vec_lvswxl (a,p); }
++vsf  lsl02(long a, sf *p)           { return __builtin_vec_lvswxl (a,p); }
++vbi  lsl03(long a, vbi *p)          { return __builtin_vec_lvswxl (a,p); }
++vsi  lsl04(long a, vsi *p)          { return __builtin_vec_lvswxl (a,p); }
++vsi  lsl05(long a, si *p)           { return __builtin_vec_lvswxl (a,p); }
++vui  lsl06(long a, vui *p)          { return __builtin_vec_lvswxl (a,p); }
++vui  lsl07(long a, ui *p)           { return __builtin_vec_lvswxl (a,p); }
++vbs  lsl08(long a, vbs *p)          { return __builtin_vec_lvswxl (a,p); }
++vp   lsl09(long a, vp *p)           { return __builtin_vec_lvswxl (a,p); }
++vss  lsl10(long a, vss *p)          { return __builtin_vec_lvswxl (a,p); }
++vss  lsl11(long a, ss *p)           { return __builtin_vec_lvswxl (a,p); }
++vus  lsl12(long a, vus *p)          { return __builtin_vec_lvswxl (a,p); }
++vus  lsl13(long a, us *p)           { return __builtin_vec_lvswxl (a,p); }
++vbc  lsl14(long a, vbc *p)          { return __builtin_vec_lvswxl (a,p); }
++vsc  lsl15(long a, vsc *p)          { return __builtin_vec_lvswxl (a,p); }
++vsc  lsl16(long a, sc *p)           { return __builtin_vec_lvswxl (a,p); }
++vuc  lsl17(long a, vuc *p)          { return __builtin_vec_lvswxl (a,p); }
++vuc  lsl18(long a, uc *p)           { return __builtin_vec_lvswxl (a,p); }
++vsf  Dlsl01(long a, vsf *p)         { return vec_lvswxl (a,p); }
++vsf  Dlsl02(long a, sf *p)          { return vec_lvswxl (a,p); }
++vbi  Dlsl03(long a, vbi *p)         { return vec_lvswxl (a,p); }
++vsi  Dlsl04(long a, vsi *p)         { return vec_lvswxl (a,p); }
++vsi  Dlsl05(long a, si *p)          { return vec_lvswxl (a,p); }
++vui  Dlsl06(long a, vui *p)         { return vec_lvswxl (a,p); }
++vui  Dlsl07(long a, ui *p)          { return vec_lvswxl (a,p); }
++vbs  Dlsl08(long a, vbs *p)         { return vec_lvswxl (a,p); }
++vp   Dlsl09(long a, vp *p)          { return vec_lvswxl (a,p); }
++vss  Dlsl10(long a, vss *p)         { return vec_lvswxl (a,p); }
++vss  Dlsl11(long a, ss *p)          { return vec_lvswxl (a,p); }
++vus  Dlsl12(long a, vus *p)         { return vec_lvswxl (a,p); }
++vus  Dlsl13(long a, us *p)          { return vec_lvswxl (a,p); }
++vbc  Dlsl14(long a, vbc *p)         { return vec_lvswxl (a,p); }
++vsc  Dlsl15(long a, vsc *p)         { return vec_lvswxl (a,p); }
++vsc  Dlsl16(long a, sc *p)          { return vec_lvswxl (a,p); }
++vuc  Dlsl17(long a, vuc *p)         { return vec_lvswxl (a,p); }
++vuc  Dlsl18(long a, uc *p)          { return vec_lvswxl (a,p); }
+diff -Naur gcc-4.9.1/gcc/testsuite/gcc.target/powerpc/altivec2_builtin-1.c gcc-4.9.1-e6500-FSF/gcc/testsuite/gcc.target/powerpc/altivec2_builtin-1.c
+--- gcc-4.9.1/gcc/testsuite/gcc.target/powerpc/altivec2_builtin-1.c	1969-12-31 18:00:00.000000000 -0600
++++ gcc-4.9.1-e6500-FSF/gcc/testsuite/gcc.target/powerpc/altivec2_builtin-1.c	2014-07-17 02:38:35.055383000 -0500
+@@ -0,0 +1,36 @@
++/* { dg-do compile { target { powerpc*-*-* } } } */
++/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
++/* { dg-require-effective-target powerpc_altivec_ok } */
++/* { dg-options "-O2 -maltivec -maltivec2" } */
++/* { dg-final { scan-assembler-times "vabsdub" 7 } } */
++
++#include <altivec.h>
++
++typedef __vector signed char vsc;
++typedef __vector signed short vss;
++typedef __vector signed int vsi;
++typedef __vector unsigned char vuc;
++typedef __vector unsigned short vus;
++typedef __vector unsigned int vui;
++typedef __vector bool char vbc;
++typedef __vector bool short vbs;
++typedef __vector bool int vbi;
++typedef __vector float vsf;
++typedef __vector pixel vp;
++typedef signed char sc;
++typedef signed short ss;
++typedef signed int si;
++typedef signed long sl;
++typedef unsigned char uc;
++typedef unsigned short us;
++typedef unsigned int ui;
++typedef unsigned long ul;
++typedef float sf;
++
++vuc  fa1b(vuc a, vuc b)             { return __builtin_altivec_vabsdub (a,b); }
++vuc  ad1(vuc a, vuc b)              { return __builtin_vec_absd (a,b); }
++vuc  ad2(vbc a, vuc b)              { return __builtin_vec_absd (a,b); }
++vuc  ad3(vuc a, vbc b)              { return __builtin_vec_absd (a,b); }
++vuc  Dad1(vuc a, vuc b)             { return vec_absd (a,b); }
++vuc  Dad2(vbc a, vuc b)             { return vec_absd (a,b); }
++vuc  Dad3(vuc a, vbc b)             { return vec_absd (a,b); }
+diff -Naur gcc-4.9.1/gcc/testsuite/gcc.target/powerpc/altivec2_builtin-20.c gcc-4.9.1-e6500-FSF/gcc/testsuite/gcc.target/powerpc/altivec2_builtin-20.c
+--- gcc-4.9.1/gcc/testsuite/gcc.target/powerpc/altivec2_builtin-20.c	1969-12-31 18:00:00.000000000 -0600
++++ gcc-4.9.1-e6500-FSF/gcc/testsuite/gcc.target/powerpc/altivec2_builtin-20.c	2014-07-17 02:38:35.055383000 -0500
+@@ -0,0 +1,66 @@
++/* { dg-do compile { target { powerpc*-*-* } } } */
++/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
++/* { dg-require-effective-target powerpc_altivec_ok } */
++/* { dg-options "-O2 -maltivec -maltivec2" } */
++/* { dg-final { scan-assembler-times "stvswx" 37 } } */
++
++#include <altivec.h>
++
++typedef __vector signed char vsc;
++typedef __vector signed short vss;
++typedef __vector signed int vsi;
++typedef __vector unsigned char vuc;
++typedef __vector unsigned short vus;
++typedef __vector unsigned int vui;
++typedef __vector bool char vbc;
++typedef __vector bool short vbs;
++typedef __vector bool int vbi;
++typedef __vector float vsf;
++typedef __vector pixel vp;
++typedef signed char sc;
++typedef signed short ss;
++typedef signed int si;
++typedef signed long sl;
++typedef unsigned char uc;
++typedef unsigned short us;
++typedef unsigned int ui;
++typedef unsigned long ul;
++typedef float sf;
++
++void ss1(vsc v, long a, vsc *p)     { __builtin_altivec_stvswx (v,a,p); }
++void ssx01(vsf v, long a, vsf *p)   { __builtin_vec_stvswx (v,a,p); }
++void ssx02(vsf v, long a, sf  *p)   { __builtin_vec_stvswx (v,a,p); }
++void ssx03(vbi v, long a, vbi *p)   { __builtin_vec_stvswx (v,a,p); }
++void ssx04(vsi v, long a, vsi *p)   { __builtin_vec_stvswx (v,a,p); }
++void ssx05(vsi v, long a, si  *p)   { __builtin_vec_stvswx (v,a,p); }
++void ssx06(vui v, long a, vui *p)   { __builtin_vec_stvswx (v,a,p); }
++void ssx07(vui v, long a, ui  *p)   { __builtin_vec_stvswx (v,a,p); }
++void ssx08(vbs v, long a, vbs *p)   { __builtin_vec_stvswx (v,a,p); }
++void ssx09(vp  v, long a, vp  *p)   { __builtin_vec_stvswx (v,a,p); }
++void ssx10(vss v, long a, vss *p)   { __builtin_vec_stvswx (v,a,p); }
++void ssx11(vss v, long a, ss  *p)   { __builtin_vec_stvswx (v,a,p); }
++void ssx12(vus v, long a, vus *p)   { __builtin_vec_stvswx (v,a,p); }
++void ssx13(vus v, long a, us  *p)   { __builtin_vec_stvswx (v,a,p); }
++void ssx14(vbc v, long a, vbc *p)   { __builtin_vec_stvswx (v,a,p); }
++void ssx15(vsc v, long a, vsc *p)   { __builtin_vec_stvswx (v,a,p); }
++void ssx16(vsc v, long a, sc  *p)   { __builtin_vec_stvswx (v,a,p); }
++void ssx17(vuc v, long a, vuc *p)   { __builtin_vec_stvswx (v,a,p); }
++void ssx18(vuc v, long a, uc  *p)   { __builtin_vec_stvswx (v,a,p); }
++void Dssx01(vsf v, long a, vsf *p)  { vec_stvswx (v,a,p); }
++void Dssx02(vsf v, long a, sf  *p)  { vec_stvswx (v,a,p); }
++void Dssx03(vbi v, long a, vbi *p)  { vec_stvswx (v,a,p); }
++void Dssx04(vsi v, long a, vsi *p)  { vec_stvswx (v,a,p); }
++void Dssx05(vsi v, long a, si  *p)  { vec_stvswx (v,a,p); }
++void Dssx06(vui v, long a, vui *p)  { vec_stvswx (v,a,p); }
++void Dssx07(vui v, long a, ui  *p)  { vec_stvswx (v,a,p); }
++void Dssx08(vbs v, long a, vbs *p)  { vec_stvswx (v,a,p); }
++void Dssx09(vp  v, long a, vp  *p)  { vec_stvswx (v,a,p); }
++void Dssx10(vss v, long a, vss *p)  { vec_stvswx (v,a,p); }
++void Dssx11(vss v, long a, ss  *p)  { vec_stvswx (v,a,p); }
++void Dssx12(vus v, long a, vus *p)  { vec_stvswx (v,a,p); }
++void Dssx13(vus v, long a, us  *p)  { vec_stvswx (v,a,p); }
++void Dssx14(vbc v, long a, vbc *p)  { vec_stvswx (v,a,p); }
++void Dssx15(vsc v, long a, vsc *p)  { vec_stvswx (v,a,p); }
++void Dssx16(vsc v, long a, sc  *p)  { vec_stvswx (v,a,p); }
++void Dssx17(vuc v, long a, vuc *p)  { vec_stvswx (v,a,p); }
++void Dssx18(vuc v, long a, uc  *p)  { vec_stvswx (v,a,p); }
+diff -Naur gcc-4.9.1/gcc/testsuite/gcc.target/powerpc/altivec2_builtin-21.c gcc-4.9.1-e6500-FSF/gcc/testsuite/gcc.target/powerpc/altivec2_builtin-21.c
+--- gcc-4.9.1/gcc/testsuite/gcc.target/powerpc/altivec2_builtin-21.c	1969-12-31 18:00:00.000000000 -0600
++++ gcc-4.9.1-e6500-FSF/gcc/testsuite/gcc.target/powerpc/altivec2_builtin-21.c	2014-07-17 02:38:35.055383001 -0500
+@@ -0,0 +1,66 @@
++/* { dg-do compile { target { powerpc*-*-* } } } */
++/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
++/* { dg-require-effective-target powerpc_altivec_ok } */
++/* { dg-options "-O2 -maltivec -maltivec2" } */
++/* { dg-final { scan-assembler-times "stvswxl" 37 } } */
++
++#include <altivec.h>
++
++typedef __vector signed char vsc;
++typedef __vector signed short vss;
++typedef __vector signed int vsi;
++typedef __vector unsigned char vuc;
++typedef __vector unsigned short vus;
++typedef __vector unsigned int vui;
++typedef __vector bool char vbc;
++typedef __vector bool short vbs;
++typedef __vector bool int vbi;
++typedef __vector float vsf;
++typedef __vector pixel vp;
++typedef signed char sc;
++typedef signed short ss;
++typedef signed int si;
++typedef signed long sl;
++typedef unsigned char uc;
++typedef unsigned short us;
++typedef unsigned int ui;
++typedef unsigned long ul;
++typedef float sf;
++
++void ss2l(vsc v, long a, vsc *p)    { __builtin_altivec_stvswxl (v,a,p); }
++void ssxl01(vsf v, long a, vsf *p)  { __builtin_vec_stvswxl (v,a,p); }
++void ssxl02(vsf v, long a, sf  *p)  { __builtin_vec_stvswxl (v,a,p); }
++void ssxl03(vbi v, long a, vbi *p)  { __builtin_vec_stvswxl (v,a,p); }
++void ssxl04(vsi v, long a, vsi *p)  { __builtin_vec_stvswxl (v,a,p); }
++void ssxl05(vsi v, long a, si  *p)  { __builtin_vec_stvswxl (v,a,p); }
++void ssxl06(vui v, long a, vui *p)  { __builtin_vec_stvswxl (v,a,p); }
++void ssxl07(vui v, long a, ui  *p)  { __builtin_vec_stvswxl (v,a,p); }
++void ssxl08(vbs v, long a, vbs *p)  { __builtin_vec_stvswxl (v,a,p); }
++void ssxl09(vp  v, long a, vp  *p)  { __builtin_vec_stvswxl (v,a,p); }
++void ssxl10(vss v, long a, vss *p)  { __builtin_vec_stvswxl (v,a,p); }
++void ssxl11(vss v, long a, ss  *p)  { __builtin_vec_stvswxl (v,a,p); }
++void ssxl12(vus v, long a, vus *p)  { __builtin_vec_stvswxl (v,a,p); }
++void ssxl13(vus v, long a, us  *p)  { __builtin_vec_stvswxl (v,a,p); }
++void ssxl14(vbc v, long a, vbc *p)  { __builtin_vec_stvswxl (v,a,p); }
++void ssxl15(vsc v, long a, vsc *p)  { __builtin_vec_stvswxl (v,a,p); }
++void ssxl16(vsc v, long a, sc  *p)  { __builtin_vec_stvswxl (v,a,p); }
++void ssxl17(vuc v, long a, vuc *p)  { __builtin_vec_stvswxl (v,a,p); }
++void ssxl18(vuc v, long a, uc  *p)  { __builtin_vec_stvswxl (v,a,p); }
++void Dssxl01(vsf v, long a, vsf *p) { vec_stvswxl (v,a,p); }
++void Dssxl02(vsf v, long a, sf  *p) { vec_stvswxl (v,a,p); }
++void Dssxl03(vbi v, long a, vbi *p) { vec_stvswxl (v,a,p); }
++void Dssxl04(vsi v, long a, vsi *p) { vec_stvswxl (v,a,p); }
++void Dssxl05(vsi v, long a, si  *p) { vec_stvswxl (v,a,p); }
++void Dssxl06(vui v, long a, vui *p) { vec_stvswxl (v,a,p); }
++void Dssxl07(vui v, long a, ui  *p) { vec_stvswxl (v,a,p); }
++void Dssxl08(vbs v, long a, vbs *p) { vec_stvswxl (v,a,p); }
++void Dssxl09(vp  v, long a, vp  *p) { vec_stvswxl (v,a,p); }
++void Dssxl10(vss v, long a, vss *p) { vec_stvswxl (v,a,p); }
++void Dssxl11(vss v, long a, ss  *p) { vec_stvswxl (v,a,p); }
++void Dssxl12(vus v, long a, vus *p) { vec_stvswxl (v,a,p); }
++void Dssxl13(vus v, long a, us  *p) { vec_stvswxl (v,a,p); }
++void Dssxl14(vbc v, long a, vbc *p) { vec_stvswxl (v,a,p); }
++void Dssxl15(vsc v, long a, vsc *p) { vec_stvswxl (v,a,p); }
++void Dssxl16(vsc v, long a, sc  *p) { vec_stvswxl (v,a,p); }
++void Dssxl17(vuc v, long a, vuc *p) { vec_stvswxl (v,a,p); }
++void Dssxl18(vuc v, long a, uc  *p) { vec_stvswxl (v,a,p); }
+diff -Naur gcc-4.9.1/gcc/testsuite/gcc.target/powerpc/altivec2_builtin-22.c gcc-4.9.1-e6500-FSF/gcc/testsuite/gcc.target/powerpc/altivec2_builtin-22.c
+--- gcc-4.9.1/gcc/testsuite/gcc.target/powerpc/altivec2_builtin-22.c	1969-12-31 18:00:00.000000000 -0600
++++ gcc-4.9.1-e6500-FSF/gcc/testsuite/gcc.target/powerpc/altivec2_builtin-22.c	2014-07-17 02:38:35.055383001 -0500
+@@ -0,0 +1,66 @@
++/* { dg-do compile { target { powerpc*-*-* } } } */
++/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
++/* { dg-require-effective-target powerpc_altivec_ok } */
++/* { dg-options "-O2 -maltivec -maltivec2" } */
++/* { dg-final { scan-assembler-times "lvsm" 37 } } */
++
++#include <altivec.h>
++
++typedef __vector signed char vsc;
++typedef __vector signed short vss;
++typedef __vector signed int vsi;
++typedef __vector unsigned char vuc;
++typedef __vector unsigned short vus;
++typedef __vector unsigned int vui;
++typedef __vector bool char vbc;
++typedef __vector bool short vbs;
++typedef __vector bool int vbi;
++typedef __vector float vsf;
++typedef __vector pixel vp;
++typedef signed char sc;
++typedef signed short ss;
++typedef signed int si;
++typedef signed long sl;
++typedef unsigned char uc;
++typedef unsigned short us;
++typedef unsigned int ui;
++typedef unsigned long ul;
++typedef float sf;
++
++vsc  lsm(long a, void *p)           { return __builtin_altivec_lvsm (a,p); }
++vsf  lm01(long a, vsf *p)           { return __builtin_vec_lvsm (a,p); }
++vsf  lm02(long a, sf *p)            { return __builtin_vec_lvsm (a,p); }
++vbi  lm03(long a, vbi *p)           { return __builtin_vec_lvsm (a,p); }
++vsi  lm04(long a, vsi *p)           { return __builtin_vec_lvsm (a,p); }
++vsi  lm05(long a, si *p)            { return __builtin_vec_lvsm (a,p); }
++vui  lm06(long a, vui *p)           { return __builtin_vec_lvsm (a,p); }
++vui  lm07(long a, ui *p)            { return __builtin_vec_lvsm (a,p); }
++vbs  lm08(long a, vbs *p)           { return __builtin_vec_lvsm (a,p); }
++vp   lm09(long a, vp *p)            { return __builtin_vec_lvsm (a,p); }
++vss  lm10(long a, vss *p)           { return __builtin_vec_lvsm (a,p); }
++vss  lm11(long a, ss *p)            { return __builtin_vec_lvsm (a,p); }
++vus  lm12(long a, vus *p)           { return __builtin_vec_lvsm (a,p); }
++vus  lm13(long a, us *p)            { return __builtin_vec_lvsm (a,p); }
++vbc  lm14(long a, vbc *p)           { return __builtin_vec_lvsm (a,p); }
++vsc  lm15(long a, vsc *p)           { return __builtin_vec_lvsm (a,p); }
++vsc  lm16(long a, sc *p)            { return __builtin_vec_lvsm (a,p); }
++vuc  lm17(long a, vuc *p)           { return __builtin_vec_lvsm (a,p); }
++vuc  lm18(long a, uc *p)            { return __builtin_vec_lvsm (a,p); }
++vsf  Dlm01(long a, vsf *p)          { return vec_lvsm (a,p); }
++vsf  Dlm02(long a, sf *p)           { return vec_lvsm (a,p); }
++vbi  Dlm03(long a, vbi *p)          { return vec_lvsm (a,p); }
++vsi  Dlm04(long a, vsi *p)          { return vec_lvsm (a,p); }
++vsi  Dlm05(long a, si *p)           { return vec_lvsm (a,p); }
++vui  Dlm06(long a, vui *p)          { return vec_lvsm (a,p); }
++vui  Dlm07(long a, ui *p)           { return vec_lvsm (a,p); }
++vbs  Dlm08(long a, vbs *p)          { return vec_lvsm (a,p); }
++vp   Dlm09(long a, vp *p)           { return vec_lvsm (a,p); }
++vss  Dlm10(long a, vss *p)          { return vec_lvsm (a,p); }
++vss  Dlm11(long a, ss *p)           { return vec_lvsm (a,p); }
++vus  Dlm12(long a, vus *p)          { return vec_lvsm (a,p); }
++vus  Dlm13(long a, us *p)           { return vec_lvsm (a,p); }
++vbc  Dlm14(long a, vbc *p)          { return vec_lvsm (a,p); }
++vsc  Dlm15(long a, vsc *p)          { return vec_lvsm (a,p); }
++vsc  Dlm16(long a, sc *p)           { return vec_lvsm (a,p); }
++vuc  Dlm17(long a, vuc *p)          { return vec_lvsm (a,p); }
++vuc  Dlm18(long a, uc *p)           { return vec_lvsm (a,p); }
+diff -Naur gcc-4.9.1/gcc/testsuite/gcc.target/powerpc/altivec2_builtin-2.c gcc-4.9.1-e6500-FSF/gcc/testsuite/gcc.target/powerpc/altivec2_builtin-2.c
+--- gcc-4.9.1/gcc/testsuite/gcc.target/powerpc/altivec2_builtin-2.c	1969-12-31 18:00:00.000000000 -0600
++++ gcc-4.9.1-e6500-FSF/gcc/testsuite/gcc.target/powerpc/altivec2_builtin-2.c	2014-07-17 02:38:35.055383001 -0500
+@@ -0,0 +1,36 @@
++/* { dg-do compile { target { powerpc*-*-* } } } */
++/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
++/* { dg-require-effective-target powerpc_altivec_ok } */
++/* { dg-options "-O2 -maltivec -maltivec2" } */
++/* { dg-final { scan-assembler-times "vabsduh" 7 } } */
++
++#include <altivec.h>
++
++typedef __vector signed char vsc;
++typedef __vector signed short vss;
++typedef __vector signed int vsi;
++typedef __vector unsigned char vuc;
++typedef __vector unsigned short vus;
++typedef __vector unsigned int vui;
++typedef __vector bool char vbc;
++typedef __vector bool short vbs;
++typedef __vector bool int vbi;
++typedef __vector float vsf;
++typedef __vector pixel vp;
++typedef signed char sc;
++typedef signed short ss;
++typedef signed int si;
++typedef signed long sl;
++typedef unsigned char uc;
++typedef unsigned short us;
++typedef unsigned int ui;
++typedef unsigned long ul;
++typedef float sf;
++
++vus  fa2h(vus a, vus b)             { return __builtin_altivec_vabsduh (a,b); }
++vus  ad4(vus a, vus b)              { return __builtin_vec_absd (a,b); }
++vus  ad5(vbs a, vus b)              { return __builtin_vec_absd (a,b); }
++vus  ad6(vus a, vbs b)              { return __builtin_vec_absd (a,b); }
++vus  Dad4(vus a, vus b)             { return vec_absd (a,b); }
++vus  Dad5(vbs a, vus b)             { return vec_absd (a,b); }
++vus  Dad6(vus a, vbs b)             { return vec_absd (a,b); }
+diff -Naur gcc-4.9.1/gcc/testsuite/gcc.target/powerpc/altivec2_builtin-3.c gcc-4.9.1-e6500-FSF/gcc/testsuite/gcc.target/powerpc/altivec2_builtin-3.c
+--- gcc-4.9.1/gcc/testsuite/gcc.target/powerpc/altivec2_builtin-3.c	1969-12-31 18:00:00.000000000 -0600
++++ gcc-4.9.1-e6500-FSF/gcc/testsuite/gcc.target/powerpc/altivec2_builtin-3.c	2014-07-17 02:38:35.055383001 -0500
+@@ -0,0 +1,36 @@
++/* { dg-do compile { target { powerpc*-*-* } } } */
++/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
++/* { dg-require-effective-target powerpc_altivec_ok } */
++/* { dg-options "-O2 -maltivec -maltivec2" } */
++/* { dg-final { scan-assembler-times "vabsduw" 7 } } */
++
++#include <altivec.h>
++
++typedef __vector signed char vsc;
++typedef __vector signed short vss;
++typedef __vector signed int vsi;
++typedef __vector unsigned char vuc;
++typedef __vector unsigned short vus;
++typedef __vector unsigned int vui;
++typedef __vector bool char vbc;
++typedef __vector bool short vbs;
++typedef __vector bool int vbi;
++typedef __vector float vsf;
++typedef __vector pixel vp;
++typedef signed char sc;
++typedef signed short ss;
++typedef signed int si;
++typedef signed long sl;
++typedef unsigned char uc;
++typedef unsigned short us;
++typedef unsigned int ui;
++typedef unsigned long ul;
++typedef float sf;
++
++vui  fa3w(vui a, vui b)             { return __builtin_altivec_vabsduw (a,b); }
++vui  ad7(vui a, vui b)              { return __builtin_vec_absd (a,b); }
++vui  ad8(vbi a, vui b)              { return __builtin_vec_absd (a,b); }
++vui  ad9(vui a, vbi b)              { return __builtin_vec_absd (a,b); }
++vui  Dad7(vui a, vui b)             { return vec_absd (a,b); }
++vui  Dad8(vbi a, vui b)             { return vec_absd (a,b); }
++vui  Dad9(vui a, vbi b)             { return vec_absd (a,b); }
+diff -Naur gcc-4.9.1/gcc/testsuite/gcc.target/powerpc/altivec2_builtin-4.c gcc-4.9.1-e6500-FSF/gcc/testsuite/gcc.target/powerpc/altivec2_builtin-4.c
+--- gcc-4.9.1/gcc/testsuite/gcc.target/powerpc/altivec2_builtin-4.c	1969-12-31 18:00:00.000000000 -0600
++++ gcc-4.9.1-e6500-FSF/gcc/testsuite/gcc.target/powerpc/altivec2_builtin-4.c	2014-07-17 02:38:35.055383001 -0500
+@@ -0,0 +1,34 @@
++/* { dg-do compile { target { powerpc*-*-* } } } */
++/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
++/* { dg-require-effective-target powerpc_altivec_ok } */
++/* { dg-options "-O2 -maltivec -maltivec2" } */
++/* { dg-final { scan-assembler-times "lvexbx" 5 } } */
++
++#include <altivec.h>
++
++typedef __vector signed char vsc;
++typedef __vector signed short vss;
++typedef __vector signed int vsi;
++typedef __vector unsigned char vuc;
++typedef __vector unsigned short vus;
++typedef __vector unsigned int vui;
++typedef __vector bool char vbc;
++typedef __vector bool short vbs;
++typedef __vector bool int vbi;
++typedef __vector float vsf;
++typedef __vector pixel vp;
++typedef signed char sc;
++typedef signed short ss;
++typedef signed int si;
++typedef signed long sl;
++typedef unsigned char uc;
++typedef unsigned short us;
++typedef unsigned int ui;
++typedef unsigned long ul;
++typedef float sf;
++
++vsc  le1b(long a, void *p)          { return __builtin_altivec_lvexbx (a,p); }
++vsc  leb1(long a, sc *p)            { return __builtin_vec_lvexbx (a,p); }
++vuc  leb2(long a, uc *p)            { return __builtin_vec_lvexbx (a,p); }
++vsc  Dleb1(long a, sc *p)           { return vec_lvexbx (a,p); }
++vuc  Dleb2(long a, uc *p)           { return vec_lvexbx (a,p); }
+diff -Naur gcc-4.9.1/gcc/testsuite/gcc.target/powerpc/altivec2_builtin-5.c gcc-4.9.1-e6500-FSF/gcc/testsuite/gcc.target/powerpc/altivec2_builtin-5.c
+--- gcc-4.9.1/gcc/testsuite/gcc.target/powerpc/altivec2_builtin-5.c	1969-12-31 18:00:00.000000000 -0600
++++ gcc-4.9.1-e6500-FSF/gcc/testsuite/gcc.target/powerpc/altivec2_builtin-5.c	2014-07-17 02:38:35.055383001 -0500
+@@ -0,0 +1,34 @@
++/* { dg-do compile { target { powerpc*-*-* } } } */
++/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
++/* { dg-require-effective-target powerpc_altivec_ok } */
++/* { dg-options "-O2 -maltivec -maltivec2" } */
++/* { dg-final { scan-assembler-times "lvexhx" 5 } } */
++
++#include <altivec.h>
++
++typedef __vector signed char vsc;
++typedef __vector signed short vss;
++typedef __vector signed int vsi;
++typedef __vector unsigned char vuc;
++typedef __vector unsigned short vus;
++typedef __vector unsigned int vui;
++typedef __vector bool char vbc;
++typedef __vector bool short vbs;
++typedef __vector bool int vbi;
++typedef __vector float vsf;
++typedef __vector pixel vp;
++typedef signed char sc;
++typedef signed short ss;
++typedef signed int si;
++typedef signed long sl;
++typedef unsigned char uc;
++typedef unsigned short us;
++typedef unsigned int ui;
++typedef unsigned long ul;
++typedef float sf;
++
++vss  le2h(long a, void *p)          { return __builtin_altivec_lvexhx (a,p); }
++vss  leh1(long a, ss *p)            { return __builtin_vec_lvexhx (a,p); }
++vus  leh2(long a, us *p)            { return __builtin_vec_lvexhx (a,p); }
++vss  Dleh1(long a, ss *p)           { return vec_lvexhx (a,p); }
++vus  Dleh2(long a, us *p)           { return vec_lvexhx (a,p); }
+diff -Naur gcc-4.9.1/gcc/testsuite/gcc.target/powerpc/altivec2_builtin-6.c gcc-4.9.1-e6500-FSF/gcc/testsuite/gcc.target/powerpc/altivec2_builtin-6.c
+--- gcc-4.9.1/gcc/testsuite/gcc.target/powerpc/altivec2_builtin-6.c	1969-12-31 18:00:00.000000000 -0600
++++ gcc-4.9.1-e6500-FSF/gcc/testsuite/gcc.target/powerpc/altivec2_builtin-6.c	2014-07-17 02:38:35.055383001 -0500
+@@ -0,0 +1,40 @@
++/* { dg-do compile { target { powerpc*-*-* } } } */
++/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
++/* { dg-require-effective-target powerpc_altivec_ok } */
++/* { dg-options "-O2 -maltivec -maltivec2" } */
++/* { dg-final { scan-assembler-times "lvexwx" 11 } } */
++
++#include <altivec.h>
++
++typedef __vector signed char vsc;
++typedef __vector signed short vss;
++typedef __vector signed int vsi;
++typedef __vector unsigned char vuc;
++typedef __vector unsigned short vus;
++typedef __vector unsigned int vui;
++typedef __vector bool char vbc;
++typedef __vector bool short vbs;
++typedef __vector bool int vbi;
++typedef __vector float vsf;
++typedef __vector pixel vp;
++typedef signed char sc;
++typedef signed short ss;
++typedef signed int si;
++typedef signed long sl;
++typedef unsigned char uc;
++typedef unsigned short us;
++typedef unsigned int ui;
++typedef unsigned long ul;
++typedef float sf;
++
++vsi  le3w(long a, void *p)          { return __builtin_altivec_lvexwx (a,p); }
++vsf  lew1(long a, sf *p)            { return __builtin_vec_lvexwx (a,p); }
++vsi  lew2(long a, si *p)            { return __builtin_vec_lvexwx (a,p); }
++vui  lew3(long a, ui *p)            { return __builtin_vec_lvexwx (a,p); }
++vsi  lew4(long a, sl *p)            { return __builtin_vec_lvexwx (a,p); }
++vui  lew5(long a, ul *p)            { return __builtin_vec_lvexwx (a,p); }
++vsf  Dlew1(long a, sf *p)           { return vec_lvexwx (a,p); }
++vsi  Dlew2(long a, si *p)           { return vec_lvexwx (a,p); }
++vui  Dlew3(long a, ui *p)           { return vec_lvexwx (a,p); }
++vsi  Dlew4(long a, sl *p)           { return vec_lvexwx (a,p); }
++vui  Dlew5(long a, ul *p)           { return vec_lvexwx (a,p); }
+diff -Naur gcc-4.9.1/gcc/testsuite/gcc.target/powerpc/altivec2_builtin-7.c gcc-4.9.1-e6500-FSF/gcc/testsuite/gcc.target/powerpc/altivec2_builtin-7.c
+--- gcc-4.9.1/gcc/testsuite/gcc.target/powerpc/altivec2_builtin-7.c	1969-12-31 18:00:00.000000000 -0600
++++ gcc-4.9.1-e6500-FSF/gcc/testsuite/gcc.target/powerpc/altivec2_builtin-7.c	2014-07-17 02:38:35.055383001 -0500
+@@ -0,0 +1,42 @@
++/* { dg-do compile { target { powerpc*-*-* } } } */
++/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
++/* { dg-require-effective-target powerpc_altivec_ok } */
++/* { dg-options "-O2 -maltivec -maltivec2" } */
++/* { dg-final { scan-assembler-times "stvexbx" 13 } } */
++
++#include <altivec.h>
++
++typedef __vector signed char vsc;
++typedef __vector signed short vss;
++typedef __vector signed int vsi;
++typedef __vector unsigned char vuc;
++typedef __vector unsigned short vus;
++typedef __vector unsigned int vui;
++typedef __vector bool char vbc;
++typedef __vector bool short vbs;
++typedef __vector bool int vbi;
++typedef __vector float vsf;
++typedef __vector pixel vp;
++typedef signed char sc;
++typedef signed short ss;
++typedef signed int si;
++typedef signed long sl;
++typedef unsigned char uc;
++typedef unsigned short us;
++typedef unsigned int ui;
++typedef unsigned long ul;
++typedef float sf;
++
++void se1b(vsc v, long a, vsc *p)    { __builtin_altivec_stvexbx (v,a,p); }
++void seb1(vsc v, long a, sc *p)     { __builtin_vec_stvexbx (v,a,p); }
++void seb2(vuc v, long a, uc *p)     { __builtin_vec_stvexbx (v,a,p); }
++void seb3(vbc v, long a, sc *p)     { __builtin_vec_stvexbx (v,a,p); }
++void seb4(vbc v, long a, uc *p)     { __builtin_vec_stvexbx (v,a,p); }
++void seb5(vsc v, long a, void *p)   { __builtin_vec_stvexbx (v,a,p); }
++void seb6(vuc v, long a, void *p)   { __builtin_vec_stvexbx (v,a,p); }
++void Dseb1(vsc v, long a, sc *p)    { vec_stvexbx (v,a,p); }
++void Dseb2(vuc v, long a, uc *p)    { vec_stvexbx (v,a,p); }
++void Dseb3(vbc v, long a, sc *p)    { vec_stvexbx (v,a,p); }
++void Dseb4(vbc v, long a, uc *p)    { vec_stvexbx (v,a,p); }
++void Dseb5(vsc v, long a, void *p)  { vec_stvexbx (v,a,p); }
++void Dseb6(vuc v, long a, void *p)  { vec_stvexbx (v,a,p); }
+diff -Naur gcc-4.9.1/gcc/testsuite/gcc.target/powerpc/altivec2_builtin-8.c gcc-4.9.1-e6500-FSF/gcc/testsuite/gcc.target/powerpc/altivec2_builtin-8.c
+--- gcc-4.9.1/gcc/testsuite/gcc.target/powerpc/altivec2_builtin-8.c	1969-12-31 18:00:00.000000000 -0600
++++ gcc-4.9.1-e6500-FSF/gcc/testsuite/gcc.target/powerpc/altivec2_builtin-8.c	2014-07-17 02:38:35.055383001 -0500
+@@ -0,0 +1,42 @@
++/* { dg-do compile { target { powerpc*-*-* } } } */
++/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
++/* { dg-require-effective-target powerpc_altivec_ok } */
++/* { dg-options "-O2 -maltivec -maltivec2" } */
++/* { dg-final { scan-assembler-times "stvexhx" 13 } } */
++
++#include <altivec.h>
++
++typedef __vector signed char vsc;
++typedef __vector signed short vss;
++typedef __vector signed int vsi;
++typedef __vector unsigned char vuc;
++typedef __vector unsigned short vus;
++typedef __vector unsigned int vui;
++typedef __vector bool char vbc;
++typedef __vector bool short vbs;
++typedef __vector bool int vbi;
++typedef __vector float vsf;
++typedef __vector pixel vp;
++typedef signed char sc;
++typedef signed short ss;
++typedef signed int si;
++typedef signed long sl;
++typedef unsigned char uc;
++typedef unsigned short us;
++typedef unsigned int ui;
++typedef unsigned long ul;
++typedef float sf;
++
++void se2h(vss v, long a, vss *p)    { __builtin_altivec_stvexhx (v,a,p); }
++void seh1(vss v, long a, ss *p)     { __builtin_vec_stvexhx (v,a,p); }
++void seh2(vus v, long a, us *p)     { __builtin_vec_stvexhx (v,a,p); }
++void seh3(vbs v, long a, ss *p)     { __builtin_vec_stvexhx (v,a,p); }
++void seh4(vbs v, long a, us *p)     { __builtin_vec_stvexhx (v,a,p); }
++void seh5(vss v, long a, void *p)   { __builtin_vec_stvexhx (v,a,p); }
++void seh6(vus v, long a, void *p)   { __builtin_vec_stvexhx (v,a,p); }
++void Dseh1(vss v, long a, ss *p)    { vec_stvexhx (v,a,p); }
++void Dseh2(vus v, long a, us *p)    { vec_stvexhx (v,a,p); }
++void Dseh3(vbs v, long a, ss *p)    { vec_stvexhx (v,a,p); }
++void Dseh4(vbs v, long a, us *p)    { vec_stvexhx (v,a,p); }
++void Dseh5(vss v, long a, void *p)  { vec_stvexhx (v,a,p); }
++void Dseh6(vus v, long a, void *p)  { vec_stvexhx (v,a,p); }
+diff -Naur gcc-4.9.1/gcc/testsuite/gcc.target/powerpc/altivec2_builtin-9.c gcc-4.9.1-e6500-FSF/gcc/testsuite/gcc.target/powerpc/altivec2_builtin-9.c
+--- gcc-4.9.1/gcc/testsuite/gcc.target/powerpc/altivec2_builtin-9.c	1969-12-31 18:00:00.000000000 -0600
++++ gcc-4.9.1-e6500-FSF/gcc/testsuite/gcc.target/powerpc/altivec2_builtin-9.c	2014-07-17 02:38:35.057383001 -0500
+@@ -0,0 +1,46 @@
++/* { dg-do compile { target { powerpc*-*-* } } } */
++/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
++/* { dg-require-effective-target powerpc_altivec_ok } */
++/* { dg-options "-O2 -maltivec -maltivec2" } */
++/* { dg-final { scan-assembler-times "stvexwx" 17 } } */
++
++#include <altivec.h>
++
++typedef __vector signed char vsc;
++typedef __vector signed short vss;
++typedef __vector signed int vsi;
++typedef __vector unsigned char vuc;
++typedef __vector unsigned short vus;
++typedef __vector unsigned int vui;
++typedef __vector bool char vbc;
++typedef __vector bool short vbs;
++typedef __vector bool int vbi;
++typedef __vector float vsf;
++typedef __vector pixel vp;
++typedef signed char sc;
++typedef signed short ss;
++typedef signed int si;
++typedef signed long sl;
++typedef unsigned char uc;
++typedef unsigned short us;
++typedef unsigned int ui;
++typedef unsigned long ul;
++typedef float sf;
++
++void se3w(vsi v, long a, vsi *p)    { __builtin_altivec_stvexwx (v,a,p); }
++void sew1(vsf v, long a, sf *p)     { __builtin_vec_stvexwx (v,a,p); }
++void sew2(vsi v, long a, si *p)     { __builtin_vec_stvexwx (v,a,p); }
++void sew3(vui v, long a, ui *p)     { __builtin_vec_stvexwx (v,a,p); }
++void sew4(vbi v, long a, si *p)     { __builtin_vec_stvexwx (v,a,p); }
++void sew5(vbi v, long a, ui *p)     { __builtin_vec_stvexwx (v,a,p); }
++void sew6(vsf v, long a, void *p)   { __builtin_vec_stvexwx (v,a,p); }
++void sew7(vsi v, long a, void *p)   { __builtin_vec_stvexwx (v,a,p); }
++void sew8(vui v, long a, void *p)   { __builtin_vec_stvexwx (v,a,p); }
++void Dsew1(vsf v, long a, sf *p)    { vec_stvexwx (v,a,p); }
++void Dsew2(vsi v, long a, si *p)    { vec_stvexwx (v,a,p); }
++void Dsew3(vui v, long a, ui *p)    { vec_stvexwx (v,a,p); }
++void Dsew4(vbi v, long a, si *p)    { vec_stvexwx (v,a,p); }
++void Dsew5(vbi v, long a, ui *p)    { vec_stvexwx (v,a,p); }
++void Dsew6(vsf v, long a, void *p)  { vec_stvexwx (v,a,p); }
++void Dsew7(vsi v, long a, void *p)  { vec_stvexwx (v,a,p); }
++void Dsew8(vui v, long a, void *p)  { vec_stvexwx (v,a,p); }
diff --git a/recipes-devtools/gcc/gcc-4.9/0002-uclibc-conf.patch b/recipes-devtools/gcc/gcc-4.9/0002-uclibc-conf.patch
new file mode 100644
index 0000000..dda3b10
--- /dev/null
+++ b/recipes-devtools/gcc/gcc-4.9/0002-uclibc-conf.patch
@@ -0,0 +1,53 @@
+From d030973c872c00d916921d84deee0af2c0d38081 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem at gmail.com>
+Date: Fri, 29 Mar 2013 08:38:25 +0400
+Subject: [PATCH 02/35] uclibc-conf
+
+Signed-off-by: Khem Raj <raj.khem at gmail.com>
+
+Upstream-Status: Pending
+---
+ contrib/regression/objs-gcc.sh |    4 ++++
+ libjava/classpath/ltconfig     |    4 ++--
+ 2 files changed, 6 insertions(+), 2 deletions(-)
+
+diff --git a/contrib/regression/objs-gcc.sh b/contrib/regression/objs-gcc.sh
+index 60b0497..6dc7ead 100755
+--- a/contrib/regression/objs-gcc.sh
++++ b/contrib/regression/objs-gcc.sh
+@@ -106,6 +106,10 @@ if [ $H_REAL_TARGET = $H_REAL_HOST -a $H_REAL_TARGET = i686-pc-linux-gnu ]
+  then
+   make all-gdb all-dejagnu all-ld || exit 1
+   make install-gdb install-dejagnu install-ld || exit 1
++elif [ $H_REAL_TARGET = $H_REAL_HOST -a $H_REAL_TARGET = i686-pc-linux-uclibc ]
++ then
++  make all-gdb all-dejagnu all-ld || exit 1
++  make install-gdb install-dejagnu install-ld || exit 1
+ elif [ $H_REAL_TARGET = $H_REAL_HOST ] ; then
+   make bootstrap || exit 1
+   make install || exit 1
+diff --git a/libjava/classpath/ltconfig b/libjava/classpath/ltconfig
+index 743d951..ae4ea60 100755
+--- a/libjava/classpath/ltconfig
++++ b/libjava/classpath/ltconfig
+@@ -603,7 +603,7 @@ host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+ 
+ # Transform linux* to *-*-linux-gnu*, to support old configure scripts.
+ case $host_os in
+-linux-gnu*) ;;
++linux-gnu*|linux-uclibc*) ;;
+ linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'`
+ esac
+ 
+@@ -1247,7 +1247,7 @@ linux-gnuoldld* | linux-gnuaout* | linux-gnucoff*)
+   ;;
+ 
+ # This must be Linux ELF.
+-linux-gnu*)
++linux*)
+   version_type=linux
+   need_lib_prefix=no
+   need_version=no
+-- 
+1.7.10.4
+
diff --git a/recipes-devtools/gcc/gcc-4.9/0002.gcc.builtin_isel-49x.patch b/recipes-devtools/gcc/gcc-4.9/0002.gcc.builtin_isel-49x.patch
new file mode 100644
index 0000000..6e000e5
--- /dev/null
+++ b/recipes-devtools/gcc/gcc-4.9/0002.gcc.builtin_isel-49x.patch
@@ -0,0 +1,1112 @@
+diff -Naur gcc-4.9.1/gcc/config/rs6000/rs6000-builtin.def gcc-4.9.1-isel/gcc/config/rs6000/rs6000-builtin.def
+--- gcc-4.9.1/gcc/config/rs6000/rs6000-builtin.def	2014-06-13 16:56:16.000000000 -0500
++++ gcc-4.9.1-isel/gcc/config/rs6000/rs6000-builtin.def	2014-07-17 02:22:16.013383000 -0500
+@@ -1928,6 +1928,81 @@
+ BU_SPE_X (MFSPEFSCR,	      "mfspefscr",	MISC)
+ BU_SPE_X (MTSPEFSCR,	      "mtspefscr",	MISC)
+ 
++#define BU_ISEL_X(ENUM, NAME)						\
++  RS6000_BUILTIN_X (RS6000_BUILTIN_ISEL ## ENUM,	/* ENUM */	\
++		    "__builtin_isel" NAME,		/* NAME */	\
++		    RS6000_BTM_ISEL,			/* MASK */	\
++		    (RS6000_BTC_OVERLOADED | RS6000_BTC_PURE),		        /* ATTR */	\
++		    CODE_FOR_nothing)			/* ICODE */
++#define BU_ISEL_OVERLOAD_X(ENUM, NAME)				\
++  RS6000_BUILTIN_X (RS6000_BUILTIN_ISEL_ ## ENUM,	/* ENUM */	\
++		    "__builtin_isel" NAME,		/* NAME */	\
++		    RS6000_BTM_ISEL,			/* MASK */	\
++		    (RS6000_BTC_OVERLOADED		/* ATTR */	\
++		     | RS6000_BTC_PURE),				\
++		    CODE_FOR_nothing)			/* ICODE */
++/* ISEL builtins.  */
++/* Generic versions that get resolved to specific builtins.  */
++BU_ISEL_X(EQ, "eq")
++BU_ISEL_X(GT, "gt")
++BU_ISEL_X(LT, "lt")
++BU_ISEL_X(GTU, "gtu")
++BU_ISEL_X(LTU, "ltu")
++/* Same deal, but for 64-bit comparisons.  */
++BU_ISEL_X(EQD, "eqd")
++BU_ISEL_X(GTD, "gtd")
++BU_ISEL_X(LTD, "ltd")
++BU_ISEL_X(GTDU, "gtdu")
++BU_ISEL_X(LTDU, "ltdu")
++
++/* Each set of arguments is polymorphic in selected arguments and return
++   value.  */
++#undef RS6000_ISEL_BASE
++#define RS6000_ISEL_BASE(ARG, PRED, CMP, NAME)     \
++  BU_ISEL_OVERLOAD_X(PRED##CMP##_##ARG##_SS, NAME) \
++  BU_ISEL_OVERLOAD_X(PRED##CMP##_##ARG##_PP, NAME) \
++  BU_ISEL_OVERLOAD_X(PRED##CMP##_##ARG##_UU, NAME)
++
++#undef RS6000_ISEL_PTR_ARG
++#define RS6000_ISEL_PTR_ARG(PRED, CMP, NAME) RS6000_ISEL_BASE(PP, PRED, CMP, NAME)
++#undef RS6000_ISEL_SIGNED_ARG
++#define RS6000_ISEL_SIGNED_ARG(PRED, CMP, NAME) RS6000_ISEL_BASE(SS, PRED, CMP, NAME)
++#undef RS6000_ISEL_UNSIGNED_ARG
++#define RS6000_ISEL_UNSIGNED_ARG(PRED, CMP, NAME) RS6000_ISEL_BASE(UU, PRED, CMP, NAME)
++
++#undef RS6000_ISEL_EQ
++#define RS6000_ISEL_EQ(CMP, NAME)          \
++  RS6000_ISEL_PTR_ARG(EQ, CMP, NAME)       \
++  RS6000_ISEL_SIGNED_ARG(EQ, CMP, NAME)    \
++  RS6000_ISEL_UNSIGNED_ARG(EQ, CMP, NAME)
++
++#undef RS6000_ISEL_LT
++#define RS6000_ISEL_LT(CMP, NAME) RS6000_ISEL_SIGNED_ARG(LT, CMP, NAME)
++
++#undef RS6000_ISEL_GT
++#define RS6000_ISEL_GT(CMP, NAME) RS6000_ISEL_SIGNED_ARG(GT, CMP, NAME)
++
++#undef RS6000_ISEL_LTU
++#define RS6000_ISEL_LTU(CMP, NAME)         \
++  RS6000_ISEL_PTR_ARG(LTU, CMP, NAME)      \
++  RS6000_ISEL_UNSIGNED_ARG(LTU, CMP, NAME)
++
++#undef RS6000_ISEL_GTU
++#define RS6000_ISEL_GTU(CMP, NAME)         \
++  RS6000_ISEL_PTR_ARG(GTU, CMP, NAME)      \
++  RS6000_ISEL_UNSIGNED_ARG(GTU, CMP, NAME)
++
++RS6000_ISEL_EQ(CMPW, "eq")
++RS6000_ISEL_LT(CMPW, "lt")
++RS6000_ISEL_GT(CMPW, "gt")
++RS6000_ISEL_LTU(CMPW, "ltu")
++RS6000_ISEL_GTU(CMPW, "gtu")
++RS6000_ISEL_EQ(CMPD, "eqd")
++RS6000_ISEL_LT(CMPD, "ltd")
++RS6000_ISEL_GT(CMPD, "gtd")
++RS6000_ISEL_LTU(CMPD, "ltdu")
++RS6000_ISEL_GTU(CMPD, "gtdu")
++
+ 
+ /* Power7 builtins, that aren't VSX instructions.  */
+ BU_SPECIAL_X (POWER7_BUILTIN_BPERMD, "__builtin_bpermd", RS6000_BTM_POPCNTD,
+diff -Naur gcc-4.9.1/gcc/config/rs6000/rs6000.c gcc-4.9.1-isel/gcc/config/rs6000/rs6000.c
+--- gcc-4.9.1/gcc/config/rs6000/rs6000.c	2014-06-13 16:56:16.000000000 -0500
++++ gcc-4.9.1-isel/gcc/config/rs6000/rs6000.c	2014-07-17 02:36:19.310382993 -0500
+@@ -3033,6 +3033,7 @@
+ 	  | ((TARGET_FRSQRTES)		    ? RS6000_BTM_FRSQRTES  : 0)
+ 	  | ((TARGET_POPCNTD)		    ? RS6000_BTM_POPCNTD   : 0)
+ 	  | ((rs6000_cpu == PROCESSOR_CELL) ? RS6000_BTM_CELL      : 0)
++	  | ((TARGET_ISEL) 		    ? RS6000_BTM_ISEL      : 0)
+ 	  | ((TARGET_P8_VECTOR)		    ? RS6000_BTM_P8_VECTOR : 0)
+ 	  | ((TARGET_CRYPTO)		    ? RS6000_BTM_CRYPTO	   : 0)
+ 	  | ((TARGET_HTM)		    ? RS6000_BTM_HTM	   : 0)
+@@ -13602,11 +13603,296 @@
+ 	   " -mlong-double-128 options", name);
+   else if ((fnmask & RS6000_BTM_HARD_FLOAT) != 0)
+     error ("Builtin function %s requires the -mhard-float option", name);
++  else if ((fnmask & RS6000_BTM_ISEL) != 0)
++    error ("Builtin function %s requires the -misel option", name);
+   else
+     error ("Builtin function %s is not supported with the current options",
+ 	   name);
+ }
+ 
++/* isel builtins are a bit funny, because we want the user to be able to do:
++ *
++ *    char *p, *q, *r;
++ *       int x, y, z;
++ *          unsigned int a, b, c;
++ *             ...
++ *                p = __builtin_iseleq (i, j, q, r);
++ *                   x = __builtin_iseleq (i, j, y, z);
++ *                      a = __builtin_iseleq (i, j, b, c);
++ *
++ *                         and, of course, i and j may be of several different types depending on the
++ *                            condition.
++ *
++ *                               We handle this by having generic builtins that
++ *                                  TARGET_RESOLVE_OVERLOADED_BUILTIN takes and turns into calls to our
++ *                                     specific builtins.  */
++
++/* Macros to help constructing the isel_builtin_desc arrays.
++ *    These closely mirror the macros in rs6000-builtins.def.  */
++/* HACK: Use VOIDmode here as a constant approximation to Pmode and fix
++ *    at runtime.  We can't use Pmode because in biarch its definition is
++ *       not constant.  */
++#define ISEL_Pmode VOIDmode
++#define ISEL_BASE(FLAGS, ARG, RESULT, PRED, CMP, MODE, RMODE)          \
++  { NULL, FLAGS, RS6000_BUILTIN_ISEL_##PRED##CMP##_##ARG##_##RESULT,   \
++      PRED, MODE, RMODE },
++#define ISEL_P_RESULT(FLAGS, ARG, PRED, CMP, MODE, RMODE)              \
++  ISEL_BASE (FLAGS | ISEL_FLAG_SEL_PTR, ARG, PP, PRED,         \
++            CMP, MODE, ISEL_Pmode)
++#define ISEL_S_RESULT(FLAGS, ARG, PRED, CMP, MODE, RMODE)              \
++  ISEL_BASE (FLAGS | ISEL_FLAG_SEL_SIGNED, ARG, SS, PRED,              \
++            CMP, MODE, RMODE)
++#define ISEL_U_RESULT(FLAGS, ARG, PRED, CMP, MODE, RMODE)              \
++  ISEL_BASE (FLAGS | ISEL_FLAG_SEL_UNSIGNED, ARG, UU, PRED,            \
++            CMP, MODE, RMODE)
++
++#define ISEL_EXPAND_ARG(FLAG, ARG, PRED, CMP, MODE, RMODE)             \
++  ISEL_P_RESULT (FLAG, ARG, PRED, CMP, MODE, RMODE)            \
++  ISEL_S_RESULT (FLAG, ARG, PRED, CMP, MODE, RMODE)            \
++  ISEL_U_RESULT (FLAG, ARG, PRED, CMP, MODE, RMODE)
++#define ISEL_PTR_ARG(PRED, CMP, MODE)                          \
++  ISEL_EXPAND_ARG (ISEL_FLAG_CMP_PTR, PP, PRED, CMP, ISEL_Pmode, MODE)
++#define ISEL_SIGNED_ARG(PRED, CMP, MODE)                       \
++  ISEL_EXPAND_ARG (ISEL_FLAG_CMP_SIGNED, SS, PRED, CMP, MODE, MODE)
++#define ISEL_UNSIGNED_ARG(PRED, CMP, MODE)                     \
++  ISEL_EXPAND_ARG (ISEL_FLAG_CMP_UNSIGNED, UU, PRED, CMP, MODE, MODE)
++
++#define ISEL_EQ(CMP, MODE)                                     \
++  ISEL_PTR_ARG (EQ, CMP, MODE)                                 \
++  ISEL_SIGNED_ARG (EQ, CMP, MODE)                              \
++  ISEL_UNSIGNED_ARG (EQ, CMP, MODE)
++#define ISEL_LT(CMP, MODE) ISEL_SIGNED_ARG (LT, CMP, MODE)
++#define ISEL_GT(CMP, MODE) ISEL_SIGNED_ARG (GT, CMP, MODE)
++#define ISEL_LTU(CMP, MODE)                                    \
++  ISEL_PTR_ARG (LTU, CMP, MODE)                                        \
++  ISEL_UNSIGNED_ARG (LTU, CMP, MODE)
++#define ISEL_GTU(CMP, MODE)                                    \
++  ISEL_PTR_ARG (GTU, CMP, MODE)                                        \
++  ISEL_UNSIGNED_ARG (GTU, CMP, MODE)
++
++const struct isel_builtin_desc builtin_iselw[32] = {
++  ISEL_EQ (CMPW, SImode)
++  ISEL_LT (CMPW, SImode)
++  ISEL_GT (CMPW, SImode)
++  ISEL_LTU (CMPW, SImode)
++  ISEL_GTU (CMPW, SImode)
++  { "__builtin_iseleq", 0, RS6000_BUILTIN_ISELEQ, EQ, SImode, SImode },
++  { "__builtin_isellt", 0, RS6000_BUILTIN_ISELLT, LT, SImode, SImode },
++  { "__builtin_iselgt", 0, RS6000_BUILTIN_ISELGT, GT, SImode, SImode },
++  { "__builtin_iselltu", 0, RS6000_BUILTIN_ISELLTU, LTU, SImode, SImode },
++  { "__builtin_iselgtu", 0, RS6000_BUILTIN_ISELGTU, GTU, SImode, SImode }
++};
++
++const struct isel_builtin_desc builtin_iseld[32] = {
++  ISEL_EQ (CMPD, DImode)
++  ISEL_LT (CMPD, DImode)
++  ISEL_GT (CMPD, DImode)
++  ISEL_LTU (CMPD, DImode)
++  ISEL_GTU (CMPD, DImode)
++  { "__builtin_isel64eq", 0, RS6000_BUILTIN_ISELEQD, EQ, DImode, DImode },
++  { "__builtin_isel64lt", 0, RS6000_BUILTIN_ISELLTD, LT, DImode, DImode },
++  { "__builtin_isel64gt", 0, RS6000_BUILTIN_ISELGTD, GT, DImode, DImode },
++  { "__builtin_isel64ltu", 0, RS6000_BUILTIN_ISELLTDU, LTU, DImode, DImode },
++  { "__builtin_isel64gtu", 0, RS6000_BUILTIN_ISELGTDU, GTU, DImode, DImode }
++};
++
++/* Return the mode which DESC uses for comparisons.  */
++
++static enum machine_mode
++isel_cmp_mode (const struct isel_builtin_desc *desc)
++{
++  enum machine_mode mode = (enum machine_mode) desc->cmp_mode;
++
++  return (mode == VOIDmode ? Pmode : mode);
++}
++
++/* Return the mode in which DESC selects arguments.  */
++
++static enum machine_mode
++isel_sel_mode (const struct isel_builtin_desc *desc)
++{
++  enum machine_mode mode = (enum machine_mode) desc->sel_mode;
++
++  return (mode == VOIDmode ? Pmode : mode);
++}
++
++/* Return a tree describing the arguments for DESC according to CMPP:
++ *    true for comparison arguments, false for select arguments.  */
++
++static tree
++isel_argtype (const struct isel_builtin_desc *desc, bool cmpp)
++{
++  switch (desc->arg_flags & (cmpp
++                            ? ISEL_FLAG_CMP_MASK
++                            : ISEL_FLAG_SEL_MASK))
++    {
++    case ISEL_FLAG_CMP_PTR:
++    case ISEL_FLAG_SEL_PTR:
++      return ptr_type_node;
++    case ISEL_FLAG_CMP_SIGNED:
++      return (isel_cmp_mode (desc) == SImode
++             ? integer_type_node
++             : long_integer_type_node);
++    case ISEL_FLAG_SEL_SIGNED:
++      return (isel_sel_mode (desc) == SImode
++             ? integer_type_node
++             : long_integer_type_node);
++    case ISEL_FLAG_CMP_UNSIGNED:
++      return (isel_cmp_mode (desc) == SImode
++             ? unsigned_type_node
++             : long_unsigned_type_node);
++    case ISEL_FLAG_SEL_UNSIGNED:
++    default:
++      return (isel_sel_mode (desc) == SImode
++             ? unsigned_type_node
++             : long_unsigned_type_node);
++    }
++}
++
++/* Return a mnemonic string describing the argument or result of FLAGS
++ *    depending on CMPP.  */
++
++static const char *
++isel_strdesc (int flags, bool cmpp)
++{
++  switch (flags & (cmpp ? ISEL_FLAG_CMP_MASK : ISEL_FLAG_SEL_MASK))
++    {
++    case ISEL_FLAG_CMP_PTR:
++    case ISEL_FLAG_SEL_PTR:
++      return "p";
++    case ISEL_FLAG_CMP_SIGNED:
++    case ISEL_FLAG_SEL_SIGNED:
++      return "s";
++    case ISEL_FLAG_CMP_UNSIGNED:
++    case ISEL_FLAG_SEL_UNSIGNED:
++      return "u";
++    default:
++      gcc_unreachable ();
++    }
++}
++
++/* Initialize N_DESC isel builtins from DESC.  SIGNED_TYPE holds the
++ *    basic type for signed variants of isel, UNSIGNED_TYPE the type for
++ *       unsigned variants.  */
++
++static void
++rs6000_init_isel_builtins (const struct isel_builtin_desc *desc, int n_descs)
++{
++  int i;
++  const char *is64 = (desc == &builtin_iselw[0] ? "32" : "64");
++
++  for (i = 0; i < n_descs; i++)
++    {
++      const struct isel_builtin_desc *d = &desc[i];
++      tree cmptype, seltype, ftype;
++
++      cmptype = isel_argtype (d, true);
++      seltype = isel_argtype (d, false);
++
++      ftype = build_function_type_list (seltype, cmptype, cmptype,
++                                       seltype, seltype, NULL_TREE);
++
++      if (d->name)
++       def_builtin (d->name, ftype, d->code);
++      else
++       {
++         char builtin_name[40];
++
++         sprintf (builtin_name, "__builtin_isel%s%s%s%s%s%s",
++                  is64,
++                  GET_RTX_NAME (d->cmp_code),
++                  GET_MODE_NAME (isel_cmp_mode (d)),
++                  isel_strdesc (d->arg_flags, true),
++                  isel_strdesc (d->arg_flags, false),
++                  GET_MODE_NAME (isel_sel_mode (d)));
++
++         def_builtin (ggc_strdup (builtin_name), ftype, d->code);
++       }
++    }
++}
++
++static rtx
++rs6000_expand_isel_builtin (const struct isel_builtin_desc *desc,
++                           int n_descs, tree exp, rtx target, int fcode)
++{
++  int i;
++
++  for (i = 0; i < n_descs; i++)
++    {
++      const struct isel_builtin_desc *d = &desc[i];
++
++      if (fcode == (int) d->code)
++       {
++         int opidx;
++         unsigned int j;
++         rtx cmp;
++         rtx operands[4];
++         enum insn_code icode;
++         enum machine_mode opmode;
++         enum machine_mode cmpmode = isel_cmp_mode (d);
++         enum machine_mode selmode = isel_sel_mode (d);
++
++         /* Determine underlying isel insn.  */
++         switch (d->cmp_code)
++           {
++           case GTU:
++           case LTU:
++             icode = (Pmode == SImode
++                      ? CODE_FOR_isel_unsigned_si
++                      : CODE_FOR_isel_unsigned_di);
++             break;
++           default:
++             icode = (Pmode == SImode
++                      ? CODE_FOR_isel_signed_si
++                      : CODE_FOR_isel_signed_di);
++             break;
++           }
++
++         for (j = 0; j < ARRAY_SIZE (operands); j++)
++           {
++             tree arg = CALL_EXPR_ARG (exp, j);
++
++             /* If we got invalid arguments, bail out before generating
++ *                 bad rtl.  */
++             if (arg == error_mark_node)
++               return const0_rtx;
++
++             operands[j] = expand_normal (arg);
++
++             /* Validate.  */
++             /* HACK: The isel pattern doesn't actually consume all the
++                operands to the builtin; it only consumes 2 and 3.  The
++                other two will be handed off to a compare
++                insn. Unfortunately, said insn is not named, so we
++                can't directly access its insn_data here.  Fake it by
++                validating operands 0 and 1 with the isel pattern; that
++                should be good enough.  */
++             opidx = (j < 2 ? 2 : j);
++             opmode = (j < 2 ? cmpmode : selmode);
++             if (! (*insn_data[icode].operand[opidx].predicate) (operands[j],
++                                                                 opmode))
++               operands[j] = copy_to_mode_reg (opmode, operands[j]);
++           }
++
++         /* Validate target.  */
++         if (target == NULL_RTX
++             || GET_MODE (target) != selmode
++             || ! (*insn_data[icode].operand[0].predicate) (target, selmode))
++           target = gen_reg_rtx (selmode);
++
++         /* Generate comparison.  */
++         cmp = gen_rtx_fmt_ee ((enum rtx_code)d->cmp_code, cmpmode,
++                               operands[0], operands[1]);
++
++         rs6000_emit_int_cmove (target, cmp, operands[2], operands[3]);
++
++         return target;
++       }
++    }
++
++  return NULL_RTX;
++}
++
+ /* Expand an expression EXP that calls a built-in function,
+    with result going to TARGET if that's convenient
+    (and in mode MODE if that's convenient).
+@@ -14019,6 +14305,10 @@
+     paired_init_builtins ();
+   if (TARGET_SPE)
+     spe_init_builtins ();
++  if (TARGET_ISEL)
++    rs6000_init_isel_builtins (builtin_iselw, ARRAY_SIZE (builtin_iselw));
++  if (TARGET_ISEL64)
++    rs6000_init_isel_builtins (builtin_iseld, ARRAY_SIZE (builtin_iseld));
+   if (TARGET_EXTRA_BUILTINS)
+     altivec_init_builtins ();
+   if (TARGET_HTM)
+@@ -31344,6 +31634,7 @@
+   { "frsqrtes",		 RS6000_BTM_FRSQRTES,	false, false },
+   { "popcntd",		 RS6000_BTM_POPCNTD,	false, false },
+   { "cell",		 RS6000_BTM_CELL,	false, false },
++  { "isel",              RS6000_BTM_ISEL,       false, false },
+   { "power8-vector",	 RS6000_BTM_P8_VECTOR,	false, false },
+   { "crypto",		 RS6000_BTM_CRYPTO,	false, false },
+   { "htm",		 RS6000_BTM_HTM,	false, false },
+diff -Naur gcc-4.9.1/gcc/config/rs6000/rs6000-c.c gcc-4.9.1-isel/gcc/config/rs6000/rs6000-c.c
+--- gcc-4.9.1/gcc/config/rs6000/rs6000-c.c	2014-03-27 15:07:16.000000000 -0500
++++ gcc-4.9.1-isel/gcc/config/rs6000/rs6000-c.c	2014-07-17 02:22:16.027383000 -0500
+@@ -4167,7 +4167,7 @@
+ /* Implementation of the resolve_overloaded_builtin target hook, to
+    support Altivec's overloaded builtins.  */
+ 
+-tree
++static tree
+ altivec_resolve_overloaded_builtin (location_t loc, tree fndecl,
+ 				    void *passed_arglist)
+ {
+@@ -4561,3 +4561,147 @@
+   error ("invalid parameter combination for AltiVec intrinsic");
+   return error_mark_node;
+ }
++
++/* Return true if the pair of arguments in ARGS is acceptable according
++   to DECLTYPES and FLAGS.  CMPP determines whether this is for the
++   comparison arguments.  */
++
++static bool
++isel_arguments_valid (tree *args, tree *decltypes, int flags, bool cmpp)
++{
++  tree type0 = TREE_TYPE (args[0]);
++  tree type1 = TREE_TYPE (args[1]);
++  tree decltype0 = decltypes[0];
++  tree decltype1 = decltypes[1];
++
++  switch (flags & (cmpp ? ISEL_FLAG_CMP_MASK : ISEL_FLAG_SEL_MASK))
++    {
++      /* For pointer arguments and results, we just need to make sure
++        we're receiving pointers, and they can be freely converted to
++        and from void *.  For pointer results, we also need to ensure
++        that the types of the passed arguments are compatible: this is
++        similar to what the ?: construct would need to ensure.  */
++    case ISEL_FLAG_CMP_PTR:
++    case ISEL_FLAG_SEL_PTR:
++      {
++       /* Results compatible with each other?  */
++       if (!lang_hooks.types_compatible_p (type0, type1))
++         return false;
++
++       return (POINTER_TYPE_P (type0)
++               && POINTER_TYPE_P (type1));
++      }
++      break;
++      /* For signed and unsigned arguments and results, we just need to
++        make sure that the argument types are compatible with the
++        declared types; we can insert conversions to make everything
++        match up.  */
++    case ISEL_FLAG_CMP_SIGNED:
++    case ISEL_FLAG_SEL_SIGNED:
++    case ISEL_FLAG_CMP_UNSIGNED:
++    case ISEL_FLAG_SEL_UNSIGNED:
++      return (lang_hooks.types_compatible_p (type0, decltype0)
++             && lang_hooks.types_compatible_p (type1, decltype1));
++    default:
++      ;
++    }
++
++  gcc_unreachable ();
++}
++
++/* Determine if FNDECL is a generic isel intrinsic and if it can be
++   resolved to a non-generic version with a proper type using the
++   descriptions found in DESC.  Return a call to the non-generic builtin
++   if so.  */
++
++static tree
++rs6000_resolve_isel_builtin (location_t loc, tree fndecl,
++                            void *passed_arglist,
++                            const struct isel_builtin_desc *desc,
++                            int n_descs)
++{
++  vec<tree, va_gc> *arglist = static_cast<vec<tree, va_gc> *> (passed_arglist);
++  unsigned int nargs = vec_safe_length (arglist);
++  int i;
++  enum rs6000_builtins fcode
++    = (enum rs6000_builtins)DECL_FUNCTION_CODE (fndecl);
++  const struct isel_builtin_desc *generic = NULL;
++
++  /* Is this even a builtin we care about?  */
++  if (!rs6000_overloaded_builtin_p (fcode))
++    return NULL_TREE;
++
++  if (nargs != 4)
++    {
++      return NULL_TREE;
++    }
++
++  /* Find the generic builtin we're resolving.  */
++  for (i = 0; i < n_descs; i++)
++    if (desc[i].code == fcode)
++      {
++       generic = &desc[i];
++       break;
++      }
++
++  /* Happens if we're looking for a 64-bit builtin in the 32-bit
++     descriptors.  */
++  if (generic == NULL)
++    return NULL_TREE;
++
++  /* Try all the builtins whose comparison matches the generic one.  */
++  for (i = 0; i < n_descs; i++)
++    {
++      const struct isel_builtin_desc *d = &desc[i];
++      int j;
++      tree *argp = vec_safe_address (arglist);
++      tree impl_fndecl;
++      tree decltypes[4], t;
++      tree converted_args[4];
++
++      if (d == generic || d->cmp_code != generic->cmp_code)
++       continue;
++
++      impl_fndecl = rs6000_builtin_decls[d->code];
++      t = TYPE_ARG_TYPES (TREE_TYPE (impl_fndecl));
++      for (j = 0 ; t != void_list_node; j++, t = TREE_CHAIN (t))
++       decltypes[j] = TREE_VALUE (t);
++
++      if (!isel_arguments_valid (argp, decltypes, d->arg_flags, true)
++         || !isel_arguments_valid (argp+2, decltypes+2, d->arg_flags, false))
++       continue;
++
++      /* We got here, we're ok.  Build a new, resolved CALL_EXPR.  */
++      for (j = 0; j < 4; j++)
++       converted_args[j] = fold_convert (decltypes[j], argp[j]);
++
++      return build_call_expr_loc (loc, impl_fndecl, 4,
++                                 converted_args[0], converted_args[1],
++                                 converted_args[2], converted_args[3]);
++    }
++
++  error ("invalid parameter combination for isel intrinsic");
++  return error_mark_node;
++}
++
++tree
++rs6000_resolve_overloaded_builtin (location_t loc, tree fndecl, void *arglist)
++{
++  tree t;
++
++  t = rs6000_resolve_isel_builtin (loc, fndecl, arglist,
++                                  builtin_iselw, ARRAY_SIZE (builtin_iselw));
++  if (t)
++    return t;
++
++  t = rs6000_resolve_isel_builtin (loc, fndecl, arglist,
++                                  builtin_iseld, ARRAY_SIZE (builtin_iseld));
++  if (t)
++    return t;
++
++  t = altivec_resolve_overloaded_builtin (loc, fndecl, arglist);
++  if (t)
++    return t;
++
++  return NULL_TREE;
++}
+diff -Naur gcc-4.9.1/gcc/config/rs6000/rs6000.h gcc-4.9.1-isel/gcc/config/rs6000/rs6000.h
+--- gcc-4.9.1/gcc/config/rs6000/rs6000.h	2014-06-13 16:56:16.000000000 -0500
++++ gcc-4.9.1-isel/gcc/config/rs6000/rs6000.h	2014-07-17 02:25:23.949383003 -0500
+@@ -695,7 +695,7 @@
+ #define REGISTER_TARGET_PRAGMAS() do {				\
+   c_register_pragma (0, "longcall", rs6000_pragma_longcall);	\
+   targetm.target_option.pragma_parse = rs6000_pragma_target_parse; \
+-  targetm.resolve_overloaded_builtin = altivec_resolve_overloaded_builtin; \
++  targetm.resolve_overloaded_builtin = rs6000_resolve_overloaded_builtin; \
+   rs6000_target_modify_macros_ptr = rs6000_target_modify_macros; \
+ } while (0)
+ 
+@@ -2527,6 +2527,7 @@
+ #define RS6000_BTM_DFP		MASK_DFP	/* Decimal floating point.  */
+ #define RS6000_BTM_HARD_FLOAT	MASK_SOFT_FLOAT	/* Hardware floating point.  */
+ #define RS6000_BTM_LDBL128	MASK_MULTIPLE	/* 128-bit long double.  */
++#define RS6000_BTM_ISEL		MASK_ISEL	/* Target supports isel instruction */
+ 
+ #define RS6000_BTM_COMMON	(RS6000_BTM_ALTIVEC			\
+ 				 | RS6000_BTM_VSX			\
+@@ -2541,7 +2542,8 @@
+ 				 | RS6000_BTM_CELL			\
+ 				 | RS6000_BTM_DFP			\
+ 				 | RS6000_BTM_HARD_FLOAT		\
+-				 | RS6000_BTM_LDBL128)
++				 | RS6000_BTM_LDBL128			\
++				 | RS6000_BTM_ISEL)
+ 
+ /* Define builtin enum index.  */
+ 
+@@ -2698,3 +2700,41 @@
+ extern GTY(()) tree rs6000_builtin_types[RS6000_BTI_MAX];
+ extern GTY(()) tree rs6000_builtin_decls[RS6000_BUILTIN_COUNT];
+ 
++/* Values for struct isel_builtin_desc.arg_flags.  */
++enum {
++  ISEL_FLAG_CMP_PTR = 0x1,
++  ISEL_FLAG_CMP_SIGNED = 0x2,
++  ISEL_FLAG_CMP_UNSIGNED = 0x4,
++  ISEL_FLAG_CMP_MASK = 0x7,
++  ISEL_FLAG_SEL_PTR = 0x10,
++  ISEL_FLAG_SEL_SIGNED = 0x20,
++  ISEL_FLAG_SEL_UNSIGNED = 0x40,
++  ISEL_FLAG_SEL_MASK = 0x70
++};
++
++struct isel_builtin_desc {
++  /* Name of this builtin.  NULL if we should construct it.  */
++  const char *name;
++
++  /* Flags for argument combinations accepted by the builtin.
++     Zero if this builtin is a generic builtin, to be resolved later.  */
++  int arg_flags;
++
++  /* The code of the builtin.  */
++  enum rs6000_builtins code;
++
++  /* rtx_code and machine_mode are not available here; use ints instead.  */
++  /* The comparison code the builtin uses.  */
++  int cmp_code;
++
++  /* The mode the builtin does comparisons in.  */
++  int cmp_mode;
++
++  /* The mode the builtin's selected arguments are in.
++     Also happens to be its result mode.  */
++  int sel_mode;
++};
++
++/* Arrays describing isel builtins.  */
++extern const struct isel_builtin_desc builtin_iselw[32];
++extern const struct isel_builtin_desc builtin_iseld[32];
+diff -Naur gcc-4.9.1/gcc/config/rs6000/rs6000-protos.h gcc-4.9.1-isel/gcc/config/rs6000/rs6000-protos.h
+--- gcc-4.9.1/gcc/config/rs6000/rs6000-protos.h	2014-06-11 18:49:49.000000000 -0500
++++ gcc-4.9.1-isel/gcc/config/rs6000/rs6000-protos.h	2014-07-17 02:22:16.029383000 -0500
+@@ -159,7 +159,7 @@
+ 						     unsigned int);
+ extern unsigned int darwin_rs6000_special_round_type_align (tree, unsigned int,
+ 							    unsigned int);
+-extern tree altivec_resolve_overloaded_builtin (location_t, tree, void *);
++extern tree rs6000_resolve_overloaded_builtin (location_t, tree, void *);
+ extern rtx rs6000_libcall_value (enum machine_mode);
+ extern rtx rs6000_va_arg (tree, tree);
+ extern int function_ok_for_sibcall (tree);
+diff -Naur gcc-4.9.1/gcc/testsuite/gcc.target/powerpc/builtin-isel64.c gcc-4.9.1-isel/gcc/testsuite/gcc.target/powerpc/builtin-isel64.c
+--- gcc-4.9.1/gcc/testsuite/gcc.target/powerpc/builtin-isel64.c	1969-12-31 18:00:00.000000000 -0600
++++ gcc-4.9.1-isel/gcc/testsuite/gcc.target/powerpc/builtin-isel64.c	2014-07-17 02:22:16.029383000 -0500
+@@ -0,0 +1,75 @@
++/* { dg-do compile { target { powerpc*-*-* && lp64 } } } */
++/* { dg-options "-mcpu=e5500" } */
++
++#include "builtin-isel.h"
++
++/* Equality comparisons.  */
++
++#undef FUNCTION_NAME
++#define FUNCTION_NAME isel64eq
++
++SIGNED64_PROTO
++{
++  L = ISEL_BUILTIN (x, y, a, b);
++  U = ISEL_BUILTIN (x, y, (unsigned long) a, (unsigned long) b);
++  r = ISEL_BUILTIN (x, y, p, q);
++  r = ISEL_BUILTIN (x, y, (char *) p, (char *) q);
++  L = ISEL_BUILTIN (p, q, a, b);
++  /* Equality checks explicitly permit unsigned comparison operands.  */
++  L = ISEL_BUILTIN ((unsigned long) x, (unsigned long) y, a, b);
++  r = ISEL_BUILTIN ((unsigned long) x, (unsigned long) y, p, q);
++}
++
++/* less-than, greater-than.  */
++
++#undef FUNCTION_NAME
++#define FUNCTION_NAME isel64lt
++
++SIGNED64_PROTO
++{
++  L = ISEL_BUILTIN (x, y, a, b);
++  U = ISEL_BUILTIN (x, y, (unsigned long) a, (unsigned long) b);
++  r = ISEL_BUILTIN (x, y, p, q);
++  r = ISEL_BUILTIN (x, y, (char *) p, (char *) q);
++}
++
++#undef FUNCTION_NAME
++#define FUNCTION_NAME isel64gt
++
++SIGNED64_PROTO
++{
++  L = ISEL_BUILTIN (x, y, a, b);
++  U = ISEL_BUILTIN (x, y, (unsigned long) a, (unsigned long) b);
++  r = ISEL_BUILTIN (x, y, p, q);
++  r = ISEL_BUILTIN (x, y, (char *) p, (char *) q);
++}
++
++/* Unsigned variants.  These permit unsigned and pointer operands for
++   comparison only.  */
++
++#undef FUNCTION_NAME
++#define FUNCTION_NAME isel64ltu
++
++UNSIGNED64_PROTO
++{
++  L = ISEL_BUILTIN (x, y, a, b);
++  U = ISEL_BUILTIN (x, y, (unsigned long) a, (unsigned long) b);
++  r = ISEL_BUILTIN (x, y, p, q);
++  r = ISEL_BUILTIN (x, y, (char *) p, (char *) q);
++  L = ISEL_BUILTIN (p, q, a, b);
++}
++
++#undef FUNCTION_NAME
++#define FUNCTION_NAME isel64gtu
++
++UNSIGNED64_PROTO
++{
++  L = ISEL_BUILTIN (x, y, a, b);
++  U = ISEL_BUILTIN (x, y, (unsigned long) a, (unsigned long) b);
++  r = ISEL_BUILTIN (x, y, p, q);
++  r = ISEL_BUILTIN (x, y, (char *) p, (char *) q);
++  L = ISEL_BUILTIN (p, q, a, b);
++}
++
++/* Don't use bare isel, as that'll match function names and the like.  */
++/* { dg-final { scan-assembler-times "isel " 25 } } */
+diff -Naur gcc-4.9.1/gcc/testsuite/gcc.target/powerpc/builtin-isel64-errors.c gcc-4.9.1-isel/gcc/testsuite/gcc.target/powerpc/builtin-isel64-errors.c
+--- gcc-4.9.1/gcc/testsuite/gcc.target/powerpc/builtin-isel64-errors.c	1969-12-31 18:00:00.000000000 -0600
++++ gcc-4.9.1-isel/gcc/testsuite/gcc.target/powerpc/builtin-isel64-errors.c	2014-07-17 02:22:16.029383000 -0500
+@@ -0,0 +1,110 @@
++/* Test rejection of invalid parameter combinations in isel builtins.  */
++/* { dg-do compile { target { powerpc*-*-* && lp64 } } } */
++/* { dg-options "-mcpu=e5500" } */
++
++#include "builtin-isel.h"
++
++
++/* Equality comparisons.  */
++
++#undef FUNCTION_NAME
++#define FUNCTION_NAME isel64eq
++
++SIGNED64_PROTO
++{
++  /* Mismatches in argument type.  */
++  ISEL_BUILTIN ((unsigned long) x, y, a, b); /* { dg-error "isel intrinsic" } */
++  ISEL_BUILTIN (x, (unsigned long) y, a, b); /* { dg-error "isel intrinsic" } */
++  ISEL_BUILTIN ((long *) p, q, a, b); /* { dg-error "isel intrinsic" } */
++  ISEL_BUILTIN (p, (long *) q, a, b); /* { dg-error "isel intrinsic" } */
++  /* Mismatches in return type.  */
++  ISEL_BUILTIN (x, y, (unsigned long) a, b); /* { dg-error "isel intrinsic" } */
++  ISEL_BUILTIN (x, y, a, (unsigned long) b); /* { dg-error "isel intrinsic" } */
++  ISEL_BUILTIN (x, y, (long *) p, q); /* { dg-error "isel intrinsic" } */
++  ISEL_BUILTIN (x, y, p, (long *) q); /* { dg-error "isel intrinsic" } */
++}
++
++/* less-than, greater-than.  */
++
++#undef FUNCTION_NAME
++#define FUNCTION_NAME isel64lt
++
++SIGNED64_PROTO
++{
++  /* Unsigned comparison should be done with the *u variants.  */
++  ISEL_BUILTIN ((unsigned long) x, (unsigned long) y, a, b); /* { dg-error "isel intrinsic" } */
++  /* So should pointer comparison.  */
++  ISEL_BUILTIN (p, q, a, b); /* { dg-error "isel intrinsic" } */
++  /* Mismatches in argument type.  */
++  ISEL_BUILTIN ((unsigned long) x, y, a, b); /* { dg-error "isel intrinsic" } */
++  ISEL_BUILTIN (x, (unsigned long) y, a, b); /* { dg-error "isel intrinsic" } */
++  ISEL_BUILTIN ((long *) p, q, a, b); /* { dg-error "isel intrinsic" } */
++  ISEL_BUILTIN (p, (long *) q, a, b); /* { dg-error "isel intrinsic" } */
++  /* Mismatches in return type.  */
++  ISEL_BUILTIN (x, y, (unsigned long) a, b); /* { dg-error "isel intrinsic" } */
++  ISEL_BUILTIN (x, y, a, (unsigned long) b); /* { dg-error "isel intrinsic" } */
++  ISEL_BUILTIN (x, y, (long *) p, q); /* { dg-error "isel intrinsic" } */
++  ISEL_BUILTIN (x, y, p, (long *) q); /* { dg-error "isel intrinsic" } */
++}
++
++#undef FUNCTION_NAME
++#define FUNCTION_NAME isel64gt
++
++SIGNED64_PROTO
++{
++  /* Unsigned comparison should be done with the *u variants.  */
++  ISEL_BUILTIN ((unsigned long) x, (unsigned long) y, a, b); /* { dg-error "isel intrinsic" } */
++  /* So should pointer comparison.  */
++  ISEL_BUILTIN (p, q, a, b); /* { dg-error "isel intrinsic" } */
++  /* Mismatches in argument type.  */
++  ISEL_BUILTIN ((unsigned long) x, y, a, b); /* { dg-error "isel intrinsic" } */
++  ISEL_BUILTIN (x, (unsigned long) y, a, b); /* { dg-error "isel intrinsic" } */
++  ISEL_BUILTIN ((long *) p, q, a, b); /* { dg-error "isel intrinsic" } */
++  ISEL_BUILTIN (p, (long *) q, a, b); /* { dg-error "isel intrinsic" } */
++  /* Mismatches in return type.  */
++  ISEL_BUILTIN (x, y, (unsigned long) a, b); /* { dg-error "isel intrinsic" } */
++  ISEL_BUILTIN (x, y, a, (unsigned long) b); /* { dg-error "isel intrinsic" } */
++  ISEL_BUILTIN (x, y, (long *) p, q); /* { dg-error "isel intrinsic" } */
++  ISEL_BUILTIN (x, y, p, (long *) q); /* { dg-error "isel intrinsic" } */
++}
++
++/* Unsigned variants.  These permit unsigned and pointer operands for
++   comparison only.  */
++
++#undef FUNCTION_NAME
++#define FUNCTION_NAME isel64ltu
++
++UNSIGNED64_PROTO
++{
++  /* Signed comparison should be done with the signed variants.  */
++  ISEL_BUILTIN ((long) x, (long) y, a, b); /* { dg-error "isel intrinsic" } */
++  /* Mismatches in argument type.  */
++  ISEL_BUILTIN ((long) x, y, a, b); /* { dg-error "isel intrinsic" } */
++  ISEL_BUILTIN (x, (long) y, a, b); /* { dg-error "isel intrinsic" } */
++  ISEL_BUILTIN ((long *) p, q, a, b); /* { dg-error "isel intrinsic" } */
++  ISEL_BUILTIN (p, (long *) q, a, b); /* { dg-error "isel intrinsic" } */
++  /* Mismatches in return type.  */
++  ISEL_BUILTIN (x, y, (unsigned long) a, b); /* { dg-error "isel intrinsic" } */
++  ISEL_BUILTIN (x, y, a, (unsigned long) b); /* { dg-error "isel intrinsic" } */
++  ISEL_BUILTIN (x, y, (long *) p, q); /* { dg-error "isel intrinsic" } */
++  ISEL_BUILTIN (x, y, p, (long *) q); /* { dg-error "isel intrinsic" } */
++}
++
++#undef FUNCTION_NAME
++#define FUNCTION_NAME isel64gtu
++
++UNSIGNED64_PROTO
++{
++  /* Signed comparison should be done with the signed variants.  */
++  ISEL_BUILTIN ((long) x, (long) y, a, b); /* { dg-error "isel intrinsic" } */
++  /* Mismatches in argument type.  */
++  ISEL_BUILTIN ((long) x, y, a, b); /* { dg-error "isel intrinsic" } */
++  ISEL_BUILTIN (x, (long) y, a, b); /* { dg-error "isel intrinsic" } */
++  ISEL_BUILTIN ((long *) p, q, a, b); /* { dg-error "isel intrinsic" } */
++  ISEL_BUILTIN (p, (long *) q, a, b); /* { dg-error "isel intrinsic" } */
++  /* Mismatches in return type.  */
++  ISEL_BUILTIN (x, y, (unsigned long) a, b); /* { dg-error "isel intrinsic" } */
++  ISEL_BUILTIN (x, y, a, (unsigned long) b); /* { dg-error "isel intrinsic" } */
++  ISEL_BUILTIN (x, y, (long *) p, q); /* { dg-error "isel intrinsic" } */
++  ISEL_BUILTIN (x, y, p, (long *) q); /* { dg-error "isel intrinsic" } */
++}
+diff -Naur gcc-4.9.1/gcc/testsuite/gcc.target/powerpc/builtin-isel.c gcc-4.9.1-isel/gcc/testsuite/gcc.target/powerpc/builtin-isel.c
+--- gcc-4.9.1/gcc/testsuite/gcc.target/powerpc/builtin-isel.c	1969-12-31 18:00:00.000000000 -0600
++++ gcc-4.9.1-isel/gcc/testsuite/gcc.target/powerpc/builtin-isel.c	2014-07-17 02:22:16.029383000 -0500
+@@ -0,0 +1,81 @@
++/* { dg-do compile } */
++/* { dg-options "-mcpu=e500mc" } */
++
++#include "builtin-isel.h"
++
++/* We're not being clever with the preprocessor here because DejaGNU
++   will get confused.  We do try to use it to eliminate what duplication
++   we can.  */
++
++/* We check to see that the resolution permits polymorphic results.  */
++
++/* Equality comparisons.  */
++
++#undef FUNCTION_NAME
++#define FUNCTION_NAME iseleq
++
++SIGNED_PROTO
++{
++  i = ISEL_BUILTIN (x, y, a, b);
++  u = ISEL_BUILTIN (x, y, (unsigned int) a, (unsigned int) b);
++  r = ISEL_BUILTIN (x, y, p, q);
++  r = ISEL_BUILTIN (x, y, (char *) p, (char *) q);
++  i = ISEL_BUILTIN (p, q, a, b);
++  /* Equality checks explicitly permit unsigned comparison operands.  */
++  i = ISEL_BUILTIN ((unsigned int) x, (unsigned int) y, a, b);
++  r = ISEL_BUILTIN ((unsigned int) x, (unsigned int) y, p, q);
++}
++
++/* less-than, greater-than.  */
++
++#undef FUNCTION_NAME
++#define FUNCTION_NAME isellt
++
++SIGNED_PROTO
++{
++  i = ISEL_BUILTIN (x, y, a, b);
++  u = ISEL_BUILTIN (x, y, (unsigned int) a, (unsigned int) b);
++  r = ISEL_BUILTIN (x, y, p, q);
++  r = ISEL_BUILTIN (x, y, (char *) p, (char *) q);
++}
++
++#undef FUNCTION_NAME
++#define FUNCTION_NAME iselgt
++
++SIGNED_PROTO
++{
++  i = ISEL_BUILTIN (x, y, a, b);
++  u = ISEL_BUILTIN (x, y, (unsigned int) a, (unsigned int) b);
++  r = ISEL_BUILTIN (x, y, p, q);
++  r = ISEL_BUILTIN (x, y, (char *) p, (char *) q);
++}
++
++/* Unsigned variants.  These permit unsigned and pointer operands for
++   comparison only.  */
++
++#undef FUNCTION_NAME
++#define FUNCTION_NAME iselltu
++
++UNSIGNED_PROTO
++{
++  i = ISEL_BUILTIN (x, y, a, b);
++  u = ISEL_BUILTIN (x, y, (unsigned int) a, (unsigned int) b);
++  r = ISEL_BUILTIN (x, y, p, q);
++  r = ISEL_BUILTIN (x, y, (char *) p, (char *) q);
++  i = ISEL_BUILTIN (p, q, a, b);
++}
++
++#undef FUNCTION_NAME
++#define FUNCTION_NAME iselgtu
++
++UNSIGNED_PROTO
++{
++  i = ISEL_BUILTIN (x, y, a, b);
++  u = ISEL_BUILTIN (x, y, (unsigned int) a, (unsigned int) b);
++  r = ISEL_BUILTIN (x, y, p, q);
++  r = ISEL_BUILTIN (x, y, (char *) p, (char *) q);
++  i = ISEL_BUILTIN (p, q, a, b);
++}
++
++/* Don't use bare isel, as that'll match function names and the like.  */
++/* { dg-final { scan-assembler-times "isel " 25 } } */
+diff -Naur gcc-4.9.1/gcc/testsuite/gcc.target/powerpc/builtin-isel-errors.c gcc-4.9.1-isel/gcc/testsuite/gcc.target/powerpc/builtin-isel-errors.c
+--- gcc-4.9.1/gcc/testsuite/gcc.target/powerpc/builtin-isel-errors.c	1969-12-31 18:00:00.000000000 -0600
++++ gcc-4.9.1-isel/gcc/testsuite/gcc.target/powerpc/builtin-isel-errors.c	2014-07-17 02:22:16.030383000 -0500
+@@ -0,0 +1,117 @@
++/* Test rejection of invalid parameter combinations in isel builtins.  */
++/* { dg-do compile } */
++/* { dg-options "-mcpu=e500mc" } */
++
++#include "builtin-isel.h"
++
++/* We're not being clever with the preprocessor here because DejaGNU
++   will get confused.  We do try to use it to eliminate what duplication
++   we can.  */
++
++/* We check basic resolution of each builtin.  We also check to see that
++   the resolution permits polymorphic results.  Argument type mismatches
++   and result type mismatches are not permitted, except where noted.  */
++
++/* Equality comparisons.  */
++
++#undef FUNCTION_NAME
++#define FUNCTION_NAME iseleq
++
++SIGNED_PROTO
++{
++  /* Mismatches in argument type.  */
++  ISEL_BUILTIN ((unsigned int) x, y, a, b); /* { dg-error "isel intrinsic" } */
++  ISEL_BUILTIN (x, (unsigned int) y, a, b); /* { dg-error "isel intrinsic" } */
++  ISEL_BUILTIN ((int *) p, q, a, b); /* { dg-error "isel intrinsic" } */
++  ISEL_BUILTIN (p, (int *) q, a, b); /* { dg-error "isel intrinsic" } */
++  /* Mismatches in return type.  */
++  ISEL_BUILTIN (x, y, (unsigned int) a, b); /* { dg-error "isel intrinsic" } */
++  ISEL_BUILTIN (x, y, a, (unsigned int) b); /* { dg-error "isel intrinsic" } */
++  ISEL_BUILTIN (x, y, (int *) p, q); /* { dg-error "isel intrinsic" } */
++  ISEL_BUILTIN (x, y, p, (int *) q); /* { dg-error "isel intrinsic" } */
++}
++
++/* less-than, greater-than.  */
++
++#undef FUNCTION_NAME
++#define FUNCTION_NAME isellt
++
++SIGNED_PROTO
++{
++  /* Unsigned comparison should be done with the *u variants.  */
++  ISEL_BUILTIN ((unsigned int) x, (unsigned int) y, a, b); /* { dg-error "isel intrinsic" } */
++  /* So should pointer comparison.  */
++  ISEL_BUILTIN (p, q, a, b); /* { dg-error "isel intrinsic" } */
++  /* Mismatches in argument type.  */
++  ISEL_BUILTIN ((unsigned int) x, y, a, b); /* { dg-error "isel intrinsic" } */
++  ISEL_BUILTIN (x, (unsigned int) y, a, b); /* { dg-error "isel intrinsic" } */
++  ISEL_BUILTIN ((int *) p, q, a, b); /* { dg-error "isel intrinsic" } */
++  ISEL_BUILTIN (p, (int *) q, a, b); /* { dg-error "isel intrinsic" } */
++  /* Mismatches in return type.  */
++  ISEL_BUILTIN (x, y, (unsigned int) a, b); /* { dg-error "isel intrinsic" } */
++  ISEL_BUILTIN (x, y, a, (unsigned int) b); /* { dg-error "isel intrinsic" } */
++  ISEL_BUILTIN (x, y, (int *) p, q); /* { dg-error "isel intrinsic" } */
++  ISEL_BUILTIN (x, y, p, (int *) q); /* { dg-error "isel intrinsic" } */
++}
++
++#undef FUNCTION_NAME
++#define FUNCTION_NAME iselgt
++
++SIGNED_PROTO
++{
++  /* Unsigned comparison should be done with the *u variants.  */
++  ISEL_BUILTIN ((unsigned int) x, (unsigned int) y, a, b); /* { dg-error "isel intrinsic" } */
++  /* So should pointer comparison.  */
++  ISEL_BUILTIN (p, q, a, b); /* { dg-error "isel intrinsic" } */
++  /* Mismatches in argument type.  */
++  ISEL_BUILTIN ((unsigned int) x, y, a, b); /* { dg-error "isel intrinsic" } */
++  ISEL_BUILTIN (x, (unsigned int) y, a, b); /* { dg-error "isel intrinsic" } */
++  ISEL_BUILTIN ((int *) p, q, a, b); /* { dg-error "isel intrinsic" } */
++  ISEL_BUILTIN (p, (int *) q, a, b); /* { dg-error "isel intrinsic" } */
++  /* Mismatches in return type.  */
++  ISEL_BUILTIN (x, y, (unsigned int) a, b); /* { dg-error "isel intrinsic" } */
++  ISEL_BUILTIN (x, y, a, (unsigned int) b); /* { dg-error "isel intrinsic" } */
++  ISEL_BUILTIN (x, y, (int *) p, q); /* { dg-error "isel intrinsic" } */
++  ISEL_BUILTIN (x, y, p, (int *) q); /* { dg-error "isel intrinsic" } */
++}
++
++/* Unsigned variants.  These permit unsigned and pointer operands for
++   comparison only.  */
++
++#undef FUNCTION_NAME
++#define FUNCTION_NAME iselltu
++
++UNSIGNED_PROTO
++{
++  /* Signed comparison should be done with the signed variants.  */
++  ISEL_BUILTIN ((int) x, (int) y, a, b); /* { dg-error "isel intrinsic" } */
++  /* Mismatches in argument type.  */
++  ISEL_BUILTIN ((int) x, y, a, b); /* { dg-error "isel intrinsic" } */
++  ISEL_BUILTIN (x, (int) y, a, b); /* { dg-error "isel intrinsic" } */
++  ISEL_BUILTIN ((int *) p, q, a, b); /* { dg-error "isel intrinsic" } */
++  ISEL_BUILTIN (p, (int *) q, a, b); /* { dg-error "isel intrinsic" } */
++  /* Mismatches in return type.  */
++  ISEL_BUILTIN (x, y, (unsigned int) a, b); /* { dg-error "isel intrinsic" } */
++  ISEL_BUILTIN (x, y, a, (unsigned int) b); /* { dg-error "isel intrinsic" } */
++  ISEL_BUILTIN (x, y, (int *) p, q); /* { dg-error "isel intrinsic" } */
++  ISEL_BUILTIN (x, y, p, (int *) q); /* { dg-error "isel intrinsic" } */
++}
++
++#undef FUNCTION_NAME
++#define FUNCTION_NAME iselgtu
++
++UNSIGNED_PROTO
++{
++  /* Signed comparison should be done with the signed variants.  */
++  ISEL_BUILTIN ((int) x, (int) y, a, b); /* { dg-error "isel intrinsic" } */
++  /* Mismatches in argument type.  */
++  ISEL_BUILTIN ((int) x, y, a, b); /* { dg-error "isel intrinsic" } */
++  ISEL_BUILTIN (x, (int) y, a, b); /* { dg-error "isel intrinsic" } */
++  ISEL_BUILTIN ((int *) p, q, a, b); /* { dg-error "isel intrinsic" } */
++  ISEL_BUILTIN (p, (int *) q, a, b); /* { dg-error "isel intrinsic" } */
++  /* Mismatches in return type.  */
++  ISEL_BUILTIN (x, y, (unsigned int) a, b); /* { dg-error "isel intrinsic" } */
++  ISEL_BUILTIN (x, y, a, (unsigned int) b); /* { dg-error "isel intrinsic" } */
++  ISEL_BUILTIN (x, y, (int *) p, q); /* { dg-error "isel intrinsic" } */
++  ISEL_BUILTIN (x, y, p, (int *) q); /* { dg-error "isel intrinsic" } */
++}
+diff -Naur gcc-4.9.1/gcc/testsuite/gcc.target/powerpc/builtin-isel.h gcc-4.9.1-isel/gcc/testsuite/gcc.target/powerpc/builtin-isel.h
+--- gcc-4.9.1/gcc/testsuite/gcc.target/powerpc/builtin-isel.h	1969-12-31 18:00:00.000000000 -0600
++++ gcc-4.9.1-isel/gcc/testsuite/gcc.target/powerpc/builtin-isel.h	2014-07-17 02:22:16.030383000 -0500
+@@ -0,0 +1,25 @@
++/* Common definitions for builtin isel testing.  */
++
++#define SIGNED_ARGLIST (int x, int y, int a, int b, void *p, void *q)
++#define UNSIGNED_ARGLIST (unsigned int x, unsigned int y, \
++			  int a, int b, void *p, void *q)
++
++#define SIGNED_PROTO void FUNCTION_NAME SIGNED_ARGLIST
++#define UNSIGNED_PROTO void FUNCTION_NAME UNSIGNED_ARGLIST
++
++#define SIGNED64_ARGLIST (long x, long y, long a, long b, void *p, void *q)
++#define UNSIGNED64_ARGLIST (unsigned long x, unsigned long y, \
++			    long a, long b, void *p, void *q)
++
++#define SIGNED64_PROTO void FUNCTION_NAME SIGNED64_ARGLIST
++#define UNSIGNED64_PROTO void FUNCTION_NAME UNSIGNED64_ARGLIST
++
++#define CONCAT2(X,Y) X##Y
++#define CONCAT(X,Y) CONCAT2(X, Y)
++#define ISEL_BUILTIN CONCAT(__builtin_, FUNCTION_NAME)
++
++volatile int i;
++volatile unsigned int u;
++volatile void *r;
++volatile long L;
++volatile unsigned long U;
+diff -Naur gcc-4.9.1/gcc/config/rs6000/rs6000.c gcc-4.9.1-isel/gcc/config/rs6000/rs6000.c
+--- gcc-4.9.1/gcc/config/rs6000/rs6000.c	2014-09-05 05:24:16.267412011 -0500
++++ gcc-4.9.1-isel/gcc/config/rs6000/rs6000.c	2014-09-05 05:35:48.430413515 -0500
+@@ -14047,6 +14047,24 @@
+       break;
+     }
+ 
++  if (TARGET_ISEL)
++    {
++      ret = rs6000_expand_isel_builtin (builtin_iselw,
++                                       ARRAY_SIZE (builtin_iselw),
++                                       exp, target, fcode);
++
++      if (ret != NULL_RTX)
++       return ret;
++    }
++  if (TARGET_ISEL64)
++    {
++      ret = rs6000_expand_isel_builtin (builtin_iseld,
++                                       ARRAY_SIZE (builtin_iseld),
++                                       exp, target, fcode);
++
++      if (ret != NULL_RTX)
++       return ret;
++    }
+   if (TARGET_ALTIVEC)
+     {
+       ret = altivec_expand_builtin (exp, target, &success);
diff --git a/recipes-devtools/gcc/gcc-4.9/0003-gcc-uclibc-locale-ctype_touplow_t.patch b/recipes-devtools/gcc/gcc-4.9/0003-gcc-uclibc-locale-ctype_touplow_t.patch
new file mode 100644
index 0000000..7098e99
--- /dev/null
+++ b/recipes-devtools/gcc/gcc-4.9/0003-gcc-uclibc-locale-ctype_touplow_t.patch
@@ -0,0 +1,87 @@
+From d2d9dd756c4356d14dd7ae003856344cb4f37985 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem at gmail.com>
+Date: Fri, 29 Mar 2013 08:40:12 +0400
+Subject: [PATCH 03/35] gcc-uclibc-locale-ctype_touplow_t
+
+Signed-off-by: Khem Raj <raj.khem at gmail.com>
+
+Upstream-Status: Pending
+---
+ libstdc++-v3/config/locale/generic/c_locale.cc |    5 +++++
+ libstdc++-v3/config/locale/generic/c_locale.h  |    9 +++++++++
+ libstdc++-v3/config/os/gnu-linux/ctype_base.h  |    9 +++++++++
+ 3 files changed, 23 insertions(+)
+
+diff --git a/libstdc++-v3/config/locale/generic/c_locale.cc b/libstdc++-v3/config/locale/generic/c_locale.cc
+index 0d309a5..f2f1e1f 100644
+--- a/libstdc++-v3/config/locale/generic/c_locale.cc
++++ b/libstdc++-v3/config/locale/generic/c_locale.cc
+@@ -263,5 +263,10 @@ _GLIBCXX_END_NAMESPACE_VERSION
+ #ifdef _GLIBCXX_LONG_DOUBLE_COMPAT
+ #define _GLIBCXX_LDBL_COMPAT(dbl, ldbl) \
+   extern "C" void ldbl (void) __attribute__ ((alias (#dbl)))
++#ifdef __UCLIBC__
++// This is because __c_locale is of type __ctype_touplow_t* which is short on uclibc. for glibc its int*
++_GLIBCXX_LDBL_COMPAT(_ZSt14__convert_to_vIdEvPKcRT_RSt12_Ios_IostateRKPs, _ZSt14__convert_to_vIeEvPKcRT_RSt12_Ios_IostateRKPs);
++#else
+ _GLIBCXX_LDBL_COMPAT(_ZSt14__convert_to_vIdEvPKcRT_RSt12_Ios_IostateRKPi, _ZSt14__convert_to_vIeEvPKcRT_RSt12_Ios_IostateRKPi);
++#endif
+ #endif // _GLIBCXX_LONG_DOUBLE_COMPAT
+diff --git a/libstdc++-v3/config/locale/generic/c_locale.h b/libstdc++-v3/config/locale/generic/c_locale.h
+index b5fd989..3da9a5d 100644
+--- a/libstdc++-v3/config/locale/generic/c_locale.h
++++ b/libstdc++-v3/config/locale/generic/c_locale.h
+@@ -40,13 +40,22 @@
+ 
+ #include <clocale>
+ 
++#ifdef __UCLIBC__
++#include <features.h>
++#include <ctype.h>
++#endif
++
+ #define _GLIBCXX_NUM_CATEGORIES 0
+ 
+ namespace std _GLIBCXX_VISIBILITY(default)
+ {
+ _GLIBCXX_BEGIN_NAMESPACE_VERSION
+ 
++#ifdef __UCLIBC__
++  typedef __ctype_touplow_t*	__c_locale;
++#else
+   typedef int*			__c_locale;
++#endif
+ 
+   // Convert numeric value of type double and long double to string and
+   // return length of string.  If vsnprintf is available use it, otherwise
+diff --git a/libstdc++-v3/config/os/gnu-linux/ctype_base.h b/libstdc++-v3/config/os/gnu-linux/ctype_base.h
+index 2d8e978..14eb08f 100644
+--- a/libstdc++-v3/config/os/gnu-linux/ctype_base.h
++++ b/libstdc++-v3/config/os/gnu-linux/ctype_base.h
+@@ -33,6 +33,11 @@
+ 
+ // Information as gleaned from /usr/include/ctype.h
+ 
++#ifdef __UCLIBC__
++#include <features.h>
++#include <ctype.h>
++#endif
++
+ namespace std _GLIBCXX_VISIBILITY(default)
+ {
+ _GLIBCXX_BEGIN_NAMESPACE_VERSION
+@@ -41,7 +46,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
+   struct ctype_base
+   {
+     // Non-standard typedefs.
++#ifdef __UCLIBC__
++    typedef const __ctype_touplow_t*	__to_type;
++#else
+     typedef const int* 		__to_type;
++#endif
+ 
+     // NB: Offsets into ctype<char>::_M_table force a particular size
+     // on the mask type. Because of this, we don't use an enum.
+-- 
+1.7.10.4
+
diff --git a/recipes-devtools/gcc/gcc-4.9/0003.gcc.widen_types-49x.patch b/recipes-devtools/gcc/gcc-4.9/0003.gcc.widen_types-49x.patch
new file mode 100644
index 0000000..53bc8ef
--- /dev/null
+++ b/recipes-devtools/gcc/gcc-4.9/0003.gcc.widen_types-49x.patch
@@ -0,0 +1,1531 @@
+# Problem Statement:
+  Locals and temporaries having signed integral types, whose address has
+  not been taken, are not volatile qualified, and having type precision
+  less than that of type long are widened to type long (with any other
+  qualifiers retained).
+
+  Changes under flag '-fwiden-types'
+
+# Owned by:
+  Edmar Wienskoski
+
+diff -Naur gcc-4.9.1/gcc/common.opt gcc-4.9.1-widen-types/gcc/common.opt
+--- gcc-4.9.1/gcc/common.opt	2014-04-07 08:27:39.000000000 -0500
++++ gcc-4.9.1-widen-types/gcc/common.opt	2014-09-13 07:20:52.659455039 -0500
+@@ -2014,6 +2014,10 @@
+ Common Joined RejectNegative Enum(tls_model) Var(flag_tls_default) Init(TLS_MODEL_GLOBAL_DYNAMIC)
+ -ftls-model=[global-dynamic|local-dynamic|initial-exec|local-exec]	Set the default thread-local storage code generation model
+ 
++fwiden-types
++Common Report Var(flag_widen_types)
++Widen signed integral variables (local, whose address has not been taken, non-volatile and having precision less than that of long) to long (retaining original qualifiers)
++
+ Enum
+ Name(tls_model) Type(enum tls_model) UnknownError(unknown TLS model %qs)
+ 
+diff -Naur gcc-4.9.1/gcc/Makefile.in gcc-4.9.1-widen-types/gcc/Makefile.in
+--- gcc-4.9.1/gcc/Makefile.in	2014-04-15 03:04:17.000000000 -0500
++++ gcc-4.9.1-widen-types/gcc/Makefile.in	2014-09-13 07:20:52.667454976 -0500
+@@ -1465,6 +1465,7 @@
+ 	vmsdbgout.o \
+ 	vtable-verify.o \
+ 	web.o \
++	widen-types.o \
+ 	xcoffout.o \
+ 	$(out_object_file) \
+ 	$(EXTRA_OBJS) \
+diff -Naur gcc-4.9.1/gcc/passes.def gcc-4.9.1-widen-types/gcc/passes.def
+--- gcc-4.9.1/gcc/passes.def	2014-01-17 11:50:10.000000000 -0600
++++ gcc-4.9.1-widen-types/gcc/passes.def	2014-09-13 07:20:52.667454976 -0500
+@@ -31,6 +31,7 @@
+     backend might produce already lowered functions that are not processed
+     by these passes.  */
+   INSERT_PASSES_AFTER (all_lowering_passes)
++  NEXT_PASS (pass_widen_types_stmts);
+   NEXT_PASS (pass_warn_unused_result);
+   NEXT_PASS (pass_diagnose_omp_blocks);
+   NEXT_PASS (pass_diagnose_tm_blocks);
+@@ -53,6 +54,7 @@
+   PUSH_INSERT_PASSES_WITHIN (pass_early_local_passes)
+       NEXT_PASS (pass_fixup_cfg);
+       NEXT_PASS (pass_init_datastructures);
++      NEXT_PASS (pass_widen_types_bbs);
+ 
+       NEXT_PASS (pass_build_ssa);
+       NEXT_PASS (pass_ubsan);
+diff -Naur gcc-4.9.1/gcc/tree-pass.h gcc-4.9.1-widen-types/gcc/tree-pass.h
+--- gcc-4.9.1/gcc/tree-pass.h	2014-01-02 16:23:26.000000000 -0600
++++ gcc-4.9.1-widen-types/gcc/tree-pass.h	2014-09-13 07:20:52.668454979 -0500
+@@ -343,6 +343,7 @@
+ extern void register_pass (opt_pass* pass, pass_positioning_ops pos,
+ 			   const char* ref_pass_name, int ref_pass_inst_number);
+ 
++extern gimple_opt_pass *make_pass_widen_types_stmts (gcc::context *ctxt);
+ extern gimple_opt_pass *make_pass_asan (gcc::context *ctxt);
+ extern gimple_opt_pass *make_pass_asan_O0 (gcc::context *ctxt);
+ extern gimple_opt_pass *make_pass_tsan (gcc::context *ctxt);
+@@ -404,6 +405,7 @@
+ extern gimple_opt_pass *make_pass_lower_vector_ssa (gcc::context *ctxt);
+ extern gimple_opt_pass *make_pass_lower_omp (gcc::context *ctxt);
+ extern gimple_opt_pass *make_pass_diagnose_omp_blocks (gcc::context *ctxt);
++extern gimple_opt_pass *make_pass_widen_types_bbs (gcc::context *ctxt);
+ extern gimple_opt_pass *make_pass_expand_omp (gcc::context *ctxt);
+ extern gimple_opt_pass *make_pass_object_sizes (gcc::context *ctxt);
+ extern gimple_opt_pass *make_pass_strlen (gcc::context *ctxt);
+diff -Naur gcc-4.9.1/gcc/widen-types.c gcc-4.9.1-widen-types/gcc/widen-types.c
+--- gcc-4.9.1/gcc/widen-types.c	1969-12-31 18:00:00.000000000 -0600
++++ gcc-4.9.1-widen-types/gcc/widen-types.c	2014-09-13 07:55:01.565455390 -0500
+@@ -0,0 +1,1453 @@
++/*
++ Type Widening:
++  
++ Locals and temporaries having signed integral types, whose address has
++ not been taken, are not volatile qualified, and having type precision
++ less than that of type long are widened to type long (with any other
++ qualifiers retained).
++ 
++   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/>.  */
++
++#include "config.h"
++#include "system.h"
++#include "coretypes.h"
++#include "tm.h"
++
++#include "tree.h"
++#include "stor-layout.h"
++#include "basic-block.h"
++#include "tree-ssa-alias.h"
++#include "internal-fn.h"
++#include "gimple-expr.h"
++#include "is-a.h"
++#include "gimple.h"
++#include "gimple-iterator.h"
++#include "tree-cfg.h"
++#include "langhooks.h"
++#include "tree-pass.h"
++#include "diagnostic-core.h"
++#include "pointer-set.h"
++
++/* define TW_FINALIZE_STMTS to 1, if you want to run the widening
++ * pass just after gimplification - over the sequence of statements.
++ */
++#define TW_FINALIZE_STMTS 1
++
++#define TW_DEBUG 0
++#if TW_DEBUG
++
++#define TWDBG_STMT(stmt) fprintf (stderr, "%s: ", __FUNCTION__); \
++                         debug_gimple_stmt (stmt);
++
++#define TWDBG_TREE(tree)            \
++{                                   \
++  fprintf (stderr, "%s:\n", #tree); \
++  debug_tree (tree);                \
++  fprintf (stderr, "\n");           \
++}
++
++#define TWDBG_MSG(fmt) \
++fprintf (stderr, "%s: ", __FUNCTION__); \
++fprintf (stderr, fmt)
++
++#define TWDBG_MSG1(fmt, msg) \
++fprintf (stderr, "%s: ", __FUNCTION__); \
++fprintf (stderr, fmt, msg)
++
++#else
++#define TWDBG_STMT(stmt)
++#define TWDBG_TREE(tree)
++#define TWDBG_MSG(fmt)
++#define TWDBG_MSG1(fmt, msg)
++#endif
++
++#if TW_DEBUG
++static void tw_dump_candidate_list (void);
++static bool tw_debug_candidate (const void *t, void **candidacy, void *data);
++#endif
++static void tw_init (void);
++static void tw_reset (void);
++static long tw_candidate (tree node);
++static long tw_candidate_const (tree node);
++static long *tw_log_candidate (tree node);
++static long tw_candidacy_valid (tree node);
++static void tw_candidacy (tree node, long value);
++static long tw_in_candidate_list (tree node);
++static tree tw_widen_constant (tree node);
++static tree tw_widen_variable (tree node);
++#ifdef TW_FINALIZE_STMTS
++static long tw_fn_has_openmp (gimple_seq stmts);
++#endif
++static void tw_log_parms (tree fndecl);
++#ifdef TW_FINALIZE_STMTS
++static void tw_log_vars (gimple_seq stmts);
++#endif
++static void tw_log_local_decls (void);
++#ifdef TW_FINALIZE_STMTS
++static bool gate_tw_stmts (void);
++static unsigned int tw_finalize_stmts (void);
++#endif
++static bool gate_tw_bbs (void);
++static unsigned int tw_finalize_bbs (void);
++static long tw_gimple_in_seq (gimple_seq stmts, long widen);
++static long tw_gimple_in_bb (basic_block bb, long widen);
++static long tw_switch (gimple stmt, long widen);
++static long tw_gimple_stmt (gimple stmt, long widen);
++static long tw_gimple_assign (gimple stmt, long widen);
++static long tw_gimple_assign_single (gimple stmt, long widen);
++static long tw_gimple_assign_unary (gimple stmt, long widen);
++static long tw_gimple_assign_binary (gimple stmt, long widen);
++static long tw_gimple_assign_ternary (gimple stmt, long widen);
++static bool is_formatted_IO_fn (tree decl);
++static long tw_gimple_call (gimple stmt, long widen);
++static long tw_gimple_comparison (gimple stmt, long widen);
++static long tw_gimple_switch (gimple stmt, long widen);
++static long tw_gimple_return (gimple stmt, long widen);
++static long tw_gimple_asm (gimple stmt, long widen);
++static long tw_gimple_debug (gimple stmt, long widen);
++
++static struct pointer_map_t *tw_candidate_list;
++
++#if TW_DEBUG
++static void
++tw_dump_candidate_list (void)
++{
++  TWDBG_MSG ("Dumping candidate list:\n"); 
++  pointer_map_traverse (tw_candidate_list, tw_debug_candidate, NULL);
++  TWDBG_MSG ("Done dumping candidate list\n"); 
++}
++
++static
++bool tw_debug_candidate (const void *t, void **candidacy, void *data)
++{
++  debug_tree (t);
++  fprintf(stderr, "candidacy: %ld\n data (ignore): %p", *((long *) candidacy), data);
++  return true;
++}
++#endif
++
++static void
++tw_init (void)
++{
++  gcc_assert (tw_candidate_list == NULL);
++  tw_candidate_list = pointer_map_create ();
++}
++
++static void
++tw_reset (void)
++{
++  if (tw_candidate_list)
++    {
++      pointer_map_destroy (tw_candidate_list);
++      tw_candidate_list = NULL;
++    }
++}
++
++/* gcc.dg/torture/pr43879_[12].c
++ * Initialized statics should not be widened:
++ *
++ * void bar(int c)
++ * {
++ *  static int x = 1; // if widened, x gets initialized to (2^32)
++ *  if (c != x) __builtin_abort();
++ *   x--;
++ * }
++ *
++ *  int main()
++ *  {
++ *   int c = 1;
++ *   bar (1);
++ *   return 0;
++ *  }
++ *
++ * Likely, the initial value is laid out/translated to RTL way before
++ * the rest of the code is translated to GIMPLE; so when we widen the
++ * type, it's already too late.
++ */
++
++/* tw_candidate() has no way to tell if it was passed a local variable
++ * (or not) - so make sure it is passed local variables or parameters only.
++ */
++static long
++tw_candidate (tree node)
++{
++  long rv = 0;
++
++  if (!node || TREE_TYPE (node) == error_mark_node)
++    return 0;
++
++  if (node && TREE_TYPE (node) != error_mark_node &&
++      ((TREE_CODE (node) == VAR_DECL &&
++        /* See note: Initialized statics should not be widened. */
++        (!TREE_STATIC (node) || !DECL_INITIAL (node))) ||
++       TREE_CODE (node) == PARM_DECL ||
++       TREE_CODE (node) == DEBUG_EXPR_DECL) &&
++      !TYPE_VOLATILE (TREE_TYPE (node)) &&
++      !TREE_ADDRESSABLE (node) &&
++      !POINTER_TYPE_P (TREE_TYPE (node)) &&
++      INTEGRAL_TYPE_P (TREE_TYPE (node)) &&
++      !TYPE_UNSIGNED (TREE_TYPE (node))  &&
++      (TYPE_PRECISION (TREE_TYPE (node)) < TYPE_PRECISION (long_integer_type_node)))
++    rv = 1;
++  return rv;
++}
++
++static long
++tw_candidate_const (tree node)
++{
++  long rv = 0;
++
++  if (node && TREE_TYPE (node) != error_mark_node &&
++      INTEGRAL_TYPE_P (TREE_TYPE (node)) &&
++      TREE_CONSTANT (node) &&
++      (TYPE_PRECISION (TREE_TYPE (node)) < TYPE_PRECISION (long_integer_type_node)))
++    rv = 1;
++  return rv;
++}
++
++static long *
++tw_log_candidate (tree node)
++{
++  long *pval = NULL;
++
++  if (tw_candidate_list && node && TREE_TYPE (node) != error_mark_node)
++    {
++      pval = (long *) pointer_map_contains (tw_candidate_list, node);
++      if (!pval)
++        {
++          pval = (long *) pointer_map_insert (tw_candidate_list, node);
++          *pval = 1;
++          TWDBG_MSG ("Logged variable:\n");
++          TWDBG_TREE (node);
++        }
++    }
++  return pval; 
++}
++
++static long
++tw_candidacy_valid (tree node)
++{
++  long rval = 0;
++  long *pval = NULL;
++
++  if (tw_candidate_list && node && TREE_TYPE (node) != error_mark_node)
++    pval = (long *) pointer_map_contains (tw_candidate_list, node); 
++  if (pval)
++    rval = *pval ? 1 : 0;
++  return rval;
++}
++
++static void
++tw_candidacy (tree node, long value)
++{
++  long *pval;
++
++  if (tw_candidate_list && node)
++    {
++      pval = (long *) pointer_map_contains (tw_candidate_list, node);
++      if (pval)
++        {
++          *pval = value;
++#if TW_DEBUG
++          fprintf (stderr, "Setting candidacy of node:\n");
++          TWDBG_TREE (node);
++          fprintf (stderr, "to: %ld\n", value);
++#endif
++        }
++    }
++}
++
++static long
++tw_in_candidate_list (tree node)
++{
++  long *pval;
++  long rval = 0;
++
++  if (tw_candidate_list && node && TREE_TYPE (node) != error_mark_node)
++    {
++     pval = (long *) pointer_map_contains (tw_candidate_list, node);
++     rval = pval ? 1 : 0;
++    }
++  return rval;
++}
++
++static tree
++tw_widen_constant (tree node)
++{
++  if (node && tw_candidate_const (node))
++    node = build_int_cst (long_integer_type_node, TREE_INT_CST_LOW (node));
++
++  return node;
++}
++
++static tree
++tw_widen_variable (tree node)
++{
++  if (node && tw_candidacy_valid (node))
++  {
++    TWDBG_MSG ("Widening:\n");
++    TWDBG_TREE(node);
++
++    TREE_TYPE (node) = build_qualified_type (long_integer_type_node,
++                                             TYPE_QUALS (TREE_TYPE (node)));
++
++    if (TREE_CODE (node) != DEBUG_EXPR_DECL)
++      relayout_decl (node);
++  }
++  return node;
++}
++
++#ifdef TW_FINALIZE_STMTS
++static long
++tw_fn_has_openmp (gimple_seq stmts)
++{
++  gimple_stmt_iterator ittr;
++  long found_openmp = 0;
++
++  for (ittr = gsi_start (stmts); !gsi_end_p (ittr) && !found_openmp; gsi_next (&ittr))
++    {
++      gimple stmt = gsi_stmt (ittr);
++
++      switch (gimple_code (stmt))
++        {
++	case GIMPLE_BIND:
++	  found_openmp = tw_fn_has_openmp (gimple_bind_body (stmt));
++	  break;
++
++	case GIMPLE_TRY:
++	  found_openmp = tw_fn_has_openmp (gimple_try_eval (stmt));
++	  found_openmp = tw_fn_has_openmp (gimple_try_cleanup (stmt));
++	  break;
++
++	case GIMPLE_EH_FILTER:
++	  found_openmp = tw_fn_has_openmp (gimple_eh_filter_failure (stmt));
++	  break;
++
++	case GIMPLE_CATCH:
++	  found_openmp = tw_fn_has_openmp (gimple_catch_handler (stmt));
++	  break;
++
++	default:
++          switch (gimple_code (stmt))
++            {
++            CASE_GIMPLE_OMP:
++            found_openmp = 1;
++            break;
++            default:
++            break;
++            }
++	}
++    }
++  return found_openmp;  
++}
++#endif
++
++static
++void
++tw_log_parms (tree fndecl)
++{
++  tree parm;
++
++  if (!fndecl)
++    return;
++  for (parm = DECL_ARGUMENTS (fndecl); parm; parm = DECL_CHAIN (parm))
++    if (tw_candidate (parm))
++      tw_log_candidate (parm);
++  return;
++}
++
++#ifdef TW_FINALIZE_STMTS
++static
++void
++tw_log_vars (gimple_seq stmts)
++{
++  gimple_stmt_iterator ittr;
++  tree vars, vindex;
++
++  if (!stmts)
++    return;
++
++  gcc_assert (tw_candidate_list != NULL);
++
++  for (ittr = gsi_start (stmts); !gsi_end_p (ittr); gsi_next (&ittr))
++    {
++      gimple stmt = gsi_stmt (ittr);
++
++      switch (gimple_code (stmt))
++        {
++	case GIMPLE_BIND:
++          vars = gimple_bind_vars (stmt);
++          for (vindex = vars; vindex; vindex = DECL_CHAIN (vindex))
++            if (tw_candidate (vindex))
++              tw_log_candidate (vindex);
++          tw_log_vars (gimple_bind_body (stmt));
++	  break;
++
++	case GIMPLE_TRY:
++	  tw_log_vars (gimple_try_eval (stmt));
++	  tw_log_vars (gimple_try_cleanup (stmt));
++	  break;
++
++	case GIMPLE_EH_FILTER:
++	  tw_log_vars (gimple_eh_filter_failure (stmt));
++	  break;
++
++	case GIMPLE_CATCH:
++	  tw_log_vars (gimple_catch_handler (stmt));
++	  break;
++
++	default:
++          break;
++	}
++    }
++
++  return;
++}
++#endif
++
++static
++void
++tw_log_local_decls (void)
++{
++  tree decl;
++  unsigned ix;
++
++  FOR_EACH_LOCAL_DECL (cfun, ix, decl)
++    {
++      TWDBG_MSG ("Testing decl:\n");
++      TWDBG_TREE (decl);
++      if (tw_candidate (decl))
++        tw_log_candidate (decl);
++    }
++}
++
++/* Assumes that we have run verify_gimple_in_seq (stmts)
++ * i.e. that we have valid gimple.
++ */
++static long
++tw_gimple_in_seq (gimple_seq stmts, long widen)
++{
++  gimple_stmt_iterator ittr;
++  long iv = 0;
++
++  for (ittr = gsi_start (stmts); !gsi_end_p (ittr); gsi_next (&ittr))
++    {
++      gimple stmt = gsi_stmt (ittr);
++      iv += tw_switch (stmt, widen);
++    }
++  return iv;  
++}
++
++static long
++tw_gimple_in_bb (basic_block bb, long widen)
++{
++  gimple_stmt_iterator ittr;
++  long iv = 0;
++
++#if TW_DEBUG
++  fprintf (stderr, "Dumping basic block (widen = %ld):\n", widen);
++  debug_bb (bb);
++  fprintf (stderr, "Done dumping basic block (widen = %ld)\n", widen);
++#endif
++  for (ittr = gsi_start_bb (bb); !gsi_end_p (ittr); gsi_next (&ittr))
++    {
++      gimple stmt = gsi_stmt (ittr);
++      iv += tw_switch (stmt, widen);
++    }
++  return iv;  
++}
++
++static long
++tw_switch (gimple stmt, long widen)
++{
++  long iv = 0;
++
++  switch (gimple_code (stmt))
++    {
++    case GIMPLE_BIND:
++      iv += tw_gimple_in_seq (gimple_bind_body (stmt), widen);
++      break;
++
++    case GIMPLE_TRY:
++      iv += tw_gimple_in_seq (gimple_try_eval (stmt), widen);
++      iv += tw_gimple_in_seq (gimple_try_cleanup (stmt), widen);
++      break;
++
++    case GIMPLE_EH_FILTER:
++      iv += tw_gimple_in_seq (gimple_eh_filter_failure (stmt), widen);
++      break;
++
++    case GIMPLE_CATCH:
++      iv += tw_gimple_in_seq (gimple_catch_handler (stmt), widen);
++      break;
++
++    default:
++      iv += tw_gimple_stmt (stmt, widen);
++      break;
++    }
++  return iv;  
++}
++
++/* tw_gimple_stmt () mimics verify_gimple_stmt ()
++ */
++static long
++tw_gimple_stmt (gimple stmt, long widen)
++{
++  long iv = 0;
++
++  switch (gimple_code (stmt))
++    {
++    case GIMPLE_ASSIGN:
++      iv = tw_gimple_assign (stmt, widen);
++      break;
++
++    case GIMPLE_CALL:
++      iv = tw_gimple_call (stmt, widen);
++      break;
++
++    case GIMPLE_COND:
++      iv = tw_gimple_comparison (stmt, widen);
++      break;
++
++    case GIMPLE_SWITCH:
++      iv = tw_gimple_switch (stmt, widen);
++      break;
++
++    case GIMPLE_RETURN:
++      iv = tw_gimple_return (stmt, widen);
++      break;
++
++    case GIMPLE_LABEL:
++      TWDBG_STMT(stmt);
++      break;
++
++    case GIMPLE_GOTO:
++      TWDBG_STMT(stmt);
++      break;
++
++    case GIMPLE_ASM:
++      iv = tw_gimple_asm (stmt, widen);
++      break;
++
++    /* Tuples that do not have tree operands.  */
++    case GIMPLE_NOP:
++    case GIMPLE_PREDICT:
++    case GIMPLE_RESX:
++    case GIMPLE_EH_DISPATCH:
++    case GIMPLE_EH_MUST_NOT_THROW:
++      TWDBG_STMT(stmt);
++      break;
++
++    CASE_GIMPLE_OMP:
++      TWDBG_STMT(stmt);
++      break;
++
++    case GIMPLE_DEBUG:
++      iv = tw_gimple_debug (stmt, widen);
++      break;
++
++    default:
++      gcc_unreachable ();
++    }
++  return iv;  
++}
++
++static long
++tw_gimple_assign (gimple stmt, long widen)
++{
++  long iv = 0;
++
++  switch (gimple_assign_rhs_class (stmt))
++    {
++    case GIMPLE_SINGLE_RHS:
++      iv = tw_gimple_assign_single (stmt, widen);
++      break;
++
++    case GIMPLE_UNARY_RHS:
++      iv = tw_gimple_assign_unary (stmt, widen);
++      break;
++
++    case GIMPLE_BINARY_RHS:
++      iv = tw_gimple_assign_binary (stmt, widen);
++      break;
++
++    case GIMPLE_TERNARY_RHS:
++      iv = tw_gimple_assign_ternary (stmt, widen);
++      break;
++
++    default:
++      gcc_unreachable ();
++    }
++  return iv;  
++}
++
++static long
++tw_gimple_assign_single (gimple stmt, long widen)
++{
++  tree lhs = gimple_assign_lhs (stmt);
++  tree rhs1 = gimple_assign_rhs1 (stmt);
++  tree value;
++  long iv = 0;
++  unsigned int idx;
++
++  TWDBG_STMT(stmt);
++  TWDBG_TREE(lhs);
++  TWDBG_TREE(rhs1);
++
++  if (widen)
++    {
++      TWDBG_MSG ("Widening run.\n");
++      if (TREE_CODE (rhs1) == ARRAY_REF &&
++          tw_candidacy_valid (TREE_OPERAND (rhs1, 1)))
++        {
++          /* Note that we are widening the array index, hence no 
++           * gimple_assign_set_rhs1 () */
++          tw_widen_variable (TREE_OPERAND (rhs1, 1));
++        }
++      else if (TREE_CODE (lhs) == ARRAY_REF &&
++          tw_candidacy_valid (TREE_OPERAND (lhs, 1)))
++        {
++          /* Note that we are widening the array index, hence no 
++           * gimple_assign_set_lhs () */
++          tw_widen_variable (TREE_OPERAND (lhs, 1));
++        }
++      else if (tw_candidacy_valid (lhs) && tw_candidate_const (rhs1))
++        {
++          gimple_assign_set_lhs (stmt, tw_widen_variable (lhs));
++          gimple_assign_set_rhs1 (stmt, tw_widen_constant (rhs1));
++        }
++      else if (tw_candidacy_valid (lhs) && tw_candidacy_valid (rhs1))
++        {
++          gimple_assign_set_lhs (stmt, tw_widen_variable (lhs));
++          gimple_assign_set_rhs1 (stmt, tw_widen_variable (rhs1));
++        }
++    }
++  else
++    {
++      TWDBG_MSG ("Validating run.\n");
++      if (tw_candidacy_valid (lhs) && tw_candidate_const (rhs1))
++        return iv;
++      if (tw_candidacy_valid (lhs) && tw_candidacy_valid (rhs1))
++        return iv;
++      if (TREE_CODE (lhs) == VAR_DECL && TREE_CODE (TREE_TYPE (lhs)) == VECTOR_TYPE &&
++          TREE_CODE (rhs1) == CONSTRUCTOR && TREE_CODE (TREE_TYPE (rhs1)) == VECTOR_TYPE)
++        { 
++          FOR_EACH_CONSTRUCTOR_VALUE (CONSTRUCTOR_ELTS (rhs1), idx, value)
++            {
++              if (tw_candidacy_valid (value))
++                {
++                  TWDBG_MSG ("Invalidating candidacy of constructor element:\n");
++                  TWDBG_TREE (value);
++                  tw_candidacy (value, 0);
++                  iv++;
++                }
++            }
++        }
++      if (tw_candidacy_valid (lhs))
++        {
++          tw_candidacy (lhs, 0);
++          iv++;
++        }
++      if (tw_candidacy_valid (rhs1))
++        {
++          tw_candidacy (rhs1, 0);
++          iv++;
++        }
++    }
++  return iv;
++}
++
++static long
++tw_gimple_assign_unary (gimple stmt, long widen)
++{
++  tree lhs = gimple_assign_lhs (stmt);
++  tree rhs1 = gimple_assign_rhs1 (stmt);
++  long iv = 0;
++
++  TWDBG_STMT(stmt);
++  TWDBG_TREE(lhs);
++  TWDBG_TREE(rhs1);
++  
++  if (widen)
++    {
++      TWDBG_MSG ("Widening run.\n");
++      if (gimple_assign_rhs_code (stmt) == NOP_EXPR &&
++          tw_candidacy_valid (rhs1) &&
++          (TREE_TYPE (lhs) == long_unsigned_type_node ||
++           TREE_TYPE (lhs) == long_integer_type_node))
++        gimple_assign_set_rhs1 (stmt, tw_widen_variable (rhs1));
++    }
++  else
++    {
++      TWDBG_MSG ("Validating run.\n");
++      if (gimple_assign_rhs_code (stmt) == NOP_EXPR &&
++          tw_candidacy_valid (rhs1) &&
++          (TREE_TYPE (lhs) == long_unsigned_type_node ||
++           TREE_TYPE (lhs) == long_integer_type_node))
++        return iv;
++      if (tw_candidacy_valid (lhs))
++        {
++          tw_candidacy (lhs, 0);
++          iv++;
++        }
++      if (tw_candidacy_valid (rhs1))
++        {
++          tw_candidacy (rhs1, 0);
++          iv++;
++        }
++    }
++    return iv;
++}
++
++static long
++tw_gimple_assign_binary (gimple stmt, long widen)
++{
++  tree lhs = gimple_assign_lhs (stmt);
++  tree rhs1 = gimple_assign_rhs1 (stmt);
++  tree rhs2 = gimple_assign_rhs2 (stmt);
++  long iv = 0;
++
++  TWDBG_STMT(stmt);
++  TWDBG_TREE(lhs);
++  TWDBG_TREE(rhs1);
++  TWDBG_TREE(rhs2);
++
++  if (widen)
++    {
++      TWDBG_MSG ("Widening run.\n");
++      if (tw_candidacy_valid (lhs) && tw_candidacy_valid (rhs1) && tw_candidate_const (rhs2))
++        {
++          gimple_assign_set_lhs (stmt, tw_widen_variable (lhs));
++          gimple_assign_set_rhs1 (stmt, tw_widen_variable (rhs1));
++          gimple_assign_set_rhs2 (stmt, tw_widen_constant (rhs2));
++        }
++      else if (tw_candidacy_valid (lhs) && tw_candidacy_valid (rhs1) && tw_candidacy_valid (rhs2))
++        {
++          gimple_assign_set_lhs (stmt, tw_widen_variable (lhs));
++          gimple_assign_set_rhs1 (stmt, tw_widen_variable (rhs1));
++          gimple_assign_set_rhs2 (stmt, tw_widen_variable (rhs2));
++        }
++    }
++  else
++    {
++      TWDBG_MSG ("Validating run.\n");
++      if (tw_candidacy_valid (lhs) && tw_candidacy_valid (rhs1) && tw_candidate_const (rhs2))
++        return iv;
++      if (tw_candidacy_valid (lhs) && tw_candidacy_valid (rhs1) && tw_candidacy_valid (rhs2))
++        return iv;
++      if (tw_candidacy_valid (lhs))
++        {
++          tw_candidacy (lhs, 0);
++          iv++;
++        }
++      if (tw_candidacy_valid (rhs1))
++        {
++          tw_candidacy (rhs1, 0);
++          iv++;
++        }
++      if (tw_candidacy_valid (rhs2))
++        {
++          tw_candidacy (rhs2, 0);
++          iv++;
++        }
++    }
++    return iv;
++}
++
++static long
++tw_gimple_assign_ternary (gimple stmt, long widen)
++{
++  tree lhs = gimple_assign_lhs (stmt);
++  tree rhs1 = gimple_assign_rhs1 (stmt);
++  tree rhs2 = gimple_assign_rhs2 (stmt);
++  tree rhs3 = gimple_assign_rhs3 (stmt);
++  long iv = 0;
++
++  TWDBG_STMT(stmt);
++  TWDBG_TREE(lhs);
++  TWDBG_TREE(rhs1);
++  TWDBG_TREE(rhs2);
++  TWDBG_TREE(rhs3);
++
++  if (widen)
++    {
++     TWDBG_MSG ("Widening run.\n");
++     return iv;
++    }
++
++  TWDBG_MSG ("Validating run.\n");
++  if (tw_candidacy_valid (lhs))
++    {
++      tw_candidacy (lhs, 0);
++      iv++;
++    }
++  if (tw_candidacy_valid (rhs1))
++    {
++      tw_candidacy (rhs1, 0);
++      iv++;
++    }
++  if (tw_candidacy_valid (rhs2))
++    {
++      tw_candidacy (rhs2, 0);
++      iv++;
++    }
++  if (tw_candidacy_valid (rhs3))
++    {
++      tw_candidacy (rhs3, 0);
++      iv++;
++    }
++  return iv;
++}
++
++/* Ref. WG14/N1256 Committee Draft - September 7, 2007 ISO/IEC 9899:TC3
++ * 7.19.6 Formatted input/output functions
++ * Sec. 17.19.6.[1 ... 14]
++ */
++#define IO_FN_COUNT 14
++static const char *IO_fn_names[IO_FN_COUNT] =
++{
++  "fprintf", "fscanf",
++  "printf",  "scanf",
++  "snprintf",
++  "sprintf", "sscanf",
++  "vfprintf", "vfscanf",
++  "vprintf", "vscanf",
++  "vsnprintf",
++  "vsprintf", "vsscanf",
++};
++
++static bool
++is_formatted_IO_fn (tree decl)
++{
++  const char *fn_name;
++  long i;
++
++  if (decl && TREE_CODE (decl) == FUNCTION_DECL &&
++      DECL_NAME (decl) /* TREE_CODE (decl) == IDENTIFIER_NODE */ &&
++      (fn_name = IDENTIFIER_POINTER (DECL_NAME (decl))))
++    {
++      for (i = 0; i < IO_FN_COUNT; i++)
++        if (strcmp (IO_fn_names[i], fn_name) == 0)
++          return true;
++    }
++  return false;
++}
++
++/* TODO: If you have:
++ * 
++ *  int i, n, f();
++ *
++ *  n = f();
++ *
++ *  for (i = 0; i < n; i++) 
++ *    // stuff
++ *
++ *  then (after the candidate set stabilizes) do:
++ *
++ *  int n, f();
++ *  long twl.n;
++ *
++ *  n = f();
++ *  twl.n = (long) n;
++ *
++ *  for (i = 0; i < twl.n; i++) 
++ *    // stuff
++ *
++ *  only if adding twl.n does not decrease the size of the stabilized
++ *  candidate set or "cause any other damage".
++ *
++ * This should help in benchmarks where parameters are set via function
++ * calls to prevent them from being optimized away.
++ *
++ */
++static long
++tw_gimple_call (gimple stmt, long widen)
++{
++#if TW_DEBUG
++  tree fn = gimple_call_fn (stmt);
++#endif
++  long iv = 0;
++  unsigned i;
++  tree arg;
++
++  TWDBG_STMT(stmt);
++  TWDBG_TREE(fn);
++  TWDBG_TREE(gimple_call_fndecl (stmt));
++
++  if (widen)
++    {
++      TWDBG_MSG ("Widening run.\n");
++      for (i = 0; i < gimple_call_num_args (stmt); i++)
++        {
++          arg = gimple_call_arg (stmt, i);
++          if (arg && tw_candidacy_valid (arg))
++            gimple_call_set_arg (stmt, i, tw_widen_variable (arg));
++        }
++      return iv;
++    }
++
++  TWDBG_MSG ("Validating run.\n");
++  if (gimple_call_lhs (stmt) && tw_candidacy_valid (gimple_call_lhs (stmt)))
++    {
++      tw_candidacy (gimple_call_lhs (stmt), 0);
++      iv++;
++    }
++  if (gimple_call_fndecl (stmt) &&
++      (is_builtin_fn (gimple_call_fndecl (stmt)) ||
++       is_formatted_IO_fn (gimple_call_fndecl (stmt))))
++    {
++      /* Certain types of function (printf-scanf family,
++       * formatted IO functions, builtin functions) ought
++       * not to have their args widened.
++       *
++       * e.g. A call to printf () such as:
++       * int x;
++       * printf ("%d", x);
++       * because, we cannot change the %d to a %ld.
++       *
++       * or e.g. in:
++       *
++       * int D.2852;
++       * int si;
++       *
++       * si = 2;
++       * __builtin_altivec_dst (&vi, si, 0);
++       * D.2852 = 0;
++       *
++       * si should not be widened.
++       *
++       * PS: We could generate code for casts to their original types in the
++       *     call, but that would slow-down performance and we do not expect
++       *     a loop index to be used in a call to a formatted IO function.
++       */
++      for (i = 0; i < gimple_call_num_args (stmt); i++)
++        {
++          arg = gimple_call_arg (stmt, i);
++          if (arg && tw_candidacy_valid (arg))
++            {
++              tw_candidacy (arg, 0);
++              iv++;
++            }
++        }
++    }
++  return iv;
++}
++
++static long
++tw_gimple_comparison (gimple stmt, long widen)
++{
++  tree lhs = gimple_cond_lhs (stmt);
++  tree rhs = gimple_cond_rhs (stmt);
++  long iv = 0;
++
++  TWDBG_STMT(stmt);
++  TWDBG_TREE(lhs); 
++  TWDBG_TREE(rhs); 
++
++  if (widen)
++    {
++      TWDBG_MSG ("Widening run.\n");
++      if (tw_candidacy_valid (lhs) && tw_candidate_const (rhs))
++        {
++          gimple_cond_set_lhs (stmt, tw_widen_variable (lhs));
++          gimple_cond_set_rhs (stmt, tw_widen_constant (rhs));
++        }
++      else if (tw_candidate_const (lhs) && tw_candidacy_valid (rhs))
++        {
++          gimple_cond_set_lhs (stmt, tw_widen_constant (lhs));
++          gimple_cond_set_rhs (stmt, tw_widen_variable (rhs));
++        }
++      else if (tw_candidacy_valid (lhs) && tw_candidacy_valid (rhs))
++        {
++          gimple_cond_set_lhs (stmt, tw_widen_variable (lhs));
++          gimple_cond_set_rhs (stmt, tw_widen_variable (rhs));
++        }
++    }
++  else
++    {
++      TWDBG_MSG ("Validating run.\n");
++      if (tw_candidacy_valid (lhs) && tw_candidate_const (rhs))
++        return iv;
++      if (tw_candidate_const (lhs) && tw_candidacy_valid (rhs))
++        return iv;
++      if (tw_candidacy_valid (lhs) && tw_candidacy_valid (rhs))
++        return iv;
++      if (tw_candidacy_valid (lhs))
++        {
++          tw_candidacy (lhs, 0);
++          iv++;
++        }
++      if (tw_candidacy_valid (rhs))
++        {
++          tw_candidacy (rhs, 0);
++          iv++;
++        }
++    }
++  return iv;
++}
++
++static long
++tw_gimple_switch (gimple stmt, long widen)
++{
++  tree index = gimple_switch_index (stmt);
++  long iv = 0;
++
++  TWDBG_STMT(stmt);
++  TWDBG_TREE(index); 
++
++  if (widen && tw_candidacy_valid (index))
++    {
++      TWDBG_MSG ("Widening run.\n");
++      gimple_switch_set_index (stmt, tw_widen_variable (index));
++      return iv;
++    }
++   
++  TWDBG_MSG ("Validating run.\n");
++  return iv;
++}
++
++static long
++tw_gimple_return (gimple stmt, long widen)
++{
++  tree op = gimple_return_retval (stmt);
++  long iv = 0;
++
++  TWDBG_STMT(stmt);
++  TWDBG_TREE(op); 
++
++  if (widen)
++    {
++      TWDBG_MSG ("Widening run.\n");
++      return iv;
++    }
++
++  TWDBG_MSG ("Validating run.\n");
++  if (tw_candidacy_valid (op))
++    {
++      tw_candidacy (op, 0);
++      iv++;
++    }
++  return iv;
++}
++
++static long
++tw_gimple_asm (gimple stmt, long widen)
++{
++  long iv = 0;
++  unsigned int ninputs = gimple_asm_ninputs (stmt);
++  unsigned int noutputs = gimple_asm_noutputs (stmt);
++  unsigned int nclobbers = gimple_asm_nclobbers (stmt);
++  unsigned int i;
++
++  TWDBG_STMT(stmt);
++  TWDBG_MSG("Inputs:\n");
++  for (i = 0; i < ninputs; i++)
++    {
++      TWDBG_MSG1 ("input %d\n", i);
++      TWDBG_TREE (gimple_asm_input_op (stmt, i));
++    }
++  TWDBG_MSG("Outputs:\n");
++  for (i = 0; i < noutputs; i++)
++    {
++      TWDBG_MSG1 ("output %d\n", i);
++      TWDBG_TREE (gimple_asm_output_op (stmt, i));
++    }
++  TWDBG_MSG("Clobbers:\n");
++  for (i = 0; i < nclobbers; i++)
++    {
++      TWDBG_MSG1 ("clobber %d\n", i);
++      TWDBG_TREE (gimple_asm_clobber_op (stmt, i));
++    }
++  if (widen)
++    {
++      TWDBG_MSG ("Widening run.\n");
++      return iv;
++    }
++  TWDBG_MSG ("Validating run.\n");
++  for (i = 0; i < ninputs; i++)
++    {
++      if (tw_candidacy_valid (gimple_asm_input_op (stmt, i)))
++        {
++          tw_candidacy (gimple_asm_input_op (stmt, i), 0);
++          iv++;
++        }
++    }
++  for (i = 0; i < noutputs; i++)
++    {
++      if (tw_candidacy_valid (gimple_asm_output_op (stmt, i)))
++        {
++          tw_candidacy (gimple_asm_output_op (stmt, i), 0);
++          iv++;
++        }
++    }
++  for (i = 0; i < nclobbers; i++)
++    {
++      if (tw_candidacy_valid (gimple_asm_clobber_op (stmt, i)))
++        {
++          tw_candidacy (gimple_asm_clobber_op (stmt, i), 0);
++          iv++;
++        }
++    }
++  return iv;
++}
++
++static long
++tw_gimple_debug (gimple stmt, long widen)
++{
++  long iv = 0;
++  tree var, value;
++
++  var = gimple_debug_bind_get_var (stmt);
++  value = gimple_debug_bind_get_value (stmt);
++
++  TWDBG_STMT(stmt);
++  TWDBG_TREE(var);
++  TWDBG_TREE(value);
++
++  /* TODO: What if the value is a constant? */
++ 
++  if (widen)
++    {
++      TWDBG_MSG ("Widening run.\n");
++      if (tw_candidacy_valid (var) && tw_candidacy_valid (value))
++        {
++          gimple_debug_bind_set_var (stmt, tw_widen_variable (var));
++          gimple_debug_bind_set_value (stmt, tw_widen_variable (value));
++        }
++      else if (tw_candidacy_valid (var) && tw_candidate_const (value))
++        {
++          gimple_debug_bind_set_var (stmt, tw_widen_variable (var));
++          gimple_debug_bind_set_value (stmt, tw_widen_constant (value));
++        }
++    }
++  else
++    {
++      TWDBG_MSG ("Validating run.\n");
++
++      if (var && !tw_in_candidate_list (var) && tw_candidate (var))
++        tw_log_candidate (var);
++      if (value && !tw_in_candidate_list (value) && tw_candidate (value))
++        tw_log_candidate (value);
++      if (tw_candidacy_valid (var) && tw_candidacy_valid (value))
++        return iv;
++      if (tw_candidacy_valid (var))
++        {
++          tw_candidacy (var, 0);
++          iv++;
++        }
++      if (tw_candidacy_valid (value))
++        {
++          tw_candidacy (value, 0);
++          iv++;
++        }
++    }
++   
++  return iv;
++}
++
++namespace {
++
++#ifdef TW_FINALIZE_STMTS
++const pass_data pass_data_widen_types_stmts =
++{
++  GIMPLE_PASS,				/* type */
++  "tw-stmts",				/* name */
++  OPTGROUP_NONE,			/* optinfo_flags */
++  true,					/* has_gate */
++  true,					/* has_execute */
++  TV_NONE,				/* tv_id */
++  PROP_gimple_any,			/* properties_required */
++  0,					/* properties_provided */
++  0,					/* properties_destroyed */
++  0,					/* todo_flags_start */
++  0,					/* todo_flags_finish */
++};
++
++class pass_widen_types_stmts : public gimple_opt_pass
++{
++public:
++  pass_widen_types_stmts (gcc::context *ctxt)
++    : gimple_opt_pass (pass_data_widen_types_stmts, ctxt)
++  {}
++
++  bool gate () { return gate_tw_stmts (); }
++  unsigned int execute () { return tw_finalize_stmts (); }
++
++}; // class pass_widen_types_stmts
++#endif
++
++const pass_data pass_data_widen_types_bbs =
++{
++  GIMPLE_PASS,				/* type */
++  "tw-bbs",				/* name */
++  OPTGROUP_NONE,			/* optinfo_flags */
++  true,					/* has_gate */
++  true,					/* has_execute */
++  TV_NONE,				/* tv_id */
++  PROP_gimple_any,			/* properties_required */
++  0,					/* properties_provided */
++  0,					/* properties_destroyed */
++  0,					/* todo_flags_start */
++  0,					/* todo_flags_finish */
++};
++
++class pass_widen_types_bbs : public gimple_opt_pass
++{
++public:
++  pass_widen_types_bbs (gcc::context *ctxt)
++    : gimple_opt_pass (pass_data_widen_types_bbs, ctxt)
++  {}
++
++  bool gate () { return gate_tw_bbs (); }
++  unsigned int execute () { return tw_finalize_bbs (); }
++
++}; // class pass_widen_types_bbs
++
++} // anon namespace
++
++/* Widen types. tw_finalize_stmts () can be run anytime immediately after
++ * gimplification but before the CFG pass (see comment * accompanying
++ * gimple_body ()).
++ *
++ * After gimplification has occurred, the emitted GIMPLE is
++ * scanned to check if these variables are only used among
++ * themselves (with the exception of being cast to unsigned long);
++ * invalidating the candidacy of any variable that is used with
++ * another outside this set (and so on recursively). The variables
++ * that remain after this process all occur in operations with other
++ * such candidate variables, (or with constants) - the type of all
++ * such residual candidate variables (and of constants that appear
++ * with these in operations) is changed to long (along with the
++ * original accompannying qualifiers on the type).
++ *
++ * void
++ * init_optimization_passes (void)
++ *
++ * p = &all_lowering_passes;
++ * NEXT_PASS (pass_widen_types_stmts);
++ * NEXT_PASS (pass_warn_unused_result);
++ */
++#ifdef TW_FINALIZE_STMTS
++static bool
++gate_tw_stmts (void)
++{
++  /* Skip if: Language not C or seen error or -fno-strict-overflow
++   * or -fno-widen-types or -fwrapv (gcc.dg/pr23518.c execution test */
++  return !(strcmp (lang_hooks.name, "GNU C") != 0 ||
++      seen_error () ||
++      !flag_strict_overflow ||
++      !flag_widen_types ||
++      flag_wrapv || flag_trapv);
++}
++
++static unsigned int
++tw_finalize_stmts ()
++{
++  long iv = 0;
++  gimple_seq stmts;
++  tree fndecl = current_function_decl; 
++
++  if (debug_info_level == DINFO_LEVEL_NONE)
++    {
++      /* PS: That we cannot call relayout_decl () on DEBUG_EXPR_DECL is an
++      * issue: Debug information is generated after lowering from tree to 
++      * GIMPLE; unless we widen before debug information is generated, the
++      * debug information will record pre-widening information - and that
++      * cannot be changed because relayout_decl () cannot be invoked on 
++      * DEBUG_EXPR_DECL. expand_debug_locations () during cfgexpand will
++      * fail gcc_assert ()'s on the DEBUG_INSN's since e.g. the modes will
++      * not agree, etc. So if we are compiling -g, we ought to run the 
++      * pass_widen_types_stmts.
++      *
++      * In short: pass_widen_types_stmts runs iff we're generating debug
++      *           information.
++      */
++      TWDBG_MSG ("Skipping: Debug level none.\n");
++      return 0;
++    }
++  gcc_assert (debug_info_level != DINFO_LEVEL_NONE);
++
++  if (!fndecl)
++    {
++      TWDBG_MSG ("Skipping: !fndecl.\n");
++      return 0;
++    }
++
++  TWDBG_MSG ("Widening function:\n");
++  TWDBG_TREE (fndecl);
++
++  stmts = gimple_body (fndecl);
++
++  if (!stmts)
++    {
++      TWDBG_MSG ("Skipping: !stmts.\n");
++      return 0;
++    }
++
++  if (tw_fn_has_openmp (stmts))
++    {
++      TWDBG_MSG ("Skipping: OpenMP stmts found.\n");
++      return 0;
++    }
++
++  /* Assume for now that we do not need to check for nested functions:
++   * (cgraph_get_node (fndecl) && cgraph_get_node (fndecl)->nested != NULL) ||
++   * TREE_CODE (DECL_CONTEXT (fndecl)) != TRANSLATION_UNIT_DECL ||
++   * Well, turns out that a nested function is processed only if it is 
++   * actually invoked from within the function, so we are in good shape.
++   */
++
++  tw_init ();
++  tw_log_parms (fndecl);
++  tw_log_vars (stmts);
++#if TW_DEBUG
++  tw_dump_candidate_list ();
++#endif
++
++  do
++    {
++      iv = tw_gimple_in_seq (stmts, 0);
++    } while (iv);
++  tw_gimple_in_seq (stmts, 1);
++  verify_gimple_in_seq (stmts);
++
++  tw_reset ();
++
++  return 0;
++}
++#endif
++
++static bool
++gate_tw_bbs (void)
++{
++  /* Skip if: Language not C or seen error or -fno-strict-overflow
++   * or -fno-widen-types or -fwrapv (gcc.dg/pr23518.c execution test */
++  return !(strcmp (lang_hooks.name, "GNU C") != 0 ||
++      seen_error () ||
++      !flag_strict_overflow ||
++      !flag_widen_types ||
++      flag_wrapv || flag_trapv);
++}
++
++static unsigned int
++tw_finalize_bbs ()
++{
++  long iv = 0;
++  basic_block bb;
++  tree fndecl;
++
++  if (debug_info_level != DINFO_LEVEL_NONE && flag_openmp)
++    {
++      /* Cannot run this pass as the debug information has already
++       * been recorded; If we type widen now, it'll lead to assert
++       * failures during RTL expansion in expandcfg.c since the
++       * debug information would all be prewidening and would
++       * mismatch with the postwidening information for the variables
++       * that got widened (but whoose debug information was already
++       * generated). This is all because we cannot call relayout_decl ()
++       * on DEBUG_EXPR_DECL's - see note elsewhere.
++       */
++      TWDBG_MSG ("Skipping: Non-zero debug level and -fopenmp specified.\n");
++      return 0;
++    }
++
++  if (!cfun || !(fndecl = cfun->decl) || !(cfun->cfg))
++    {
++      TWDBG_MSG ("Skipping: !cfun or !fndecl or !(cfun->cfg).\n");
++      return 0;
++    }
++
++  TWDBG_MSG ("Widening function:\n");
++  TWDBG_TREE (fndecl);
++
++  /* Assume for now that we do not need to check for nested functions:
++   * (cgraph_get_node (fndecl) && cgraph_get_node (fndecl)->nested != NULL) ||
++   * TREE_CODE (DECL_CONTEXT (fndecl)) != TRANSLATION_UNIT_DECL ||
++   * Well, turns out that a nested function is processed only if it is 
++   * actually invoked from within the function, so we are in good shape.
++   */
++
++  tw_init ();
++  tw_log_parms (fndecl);
++  tw_log_local_decls (); 
++#if TW_DEBUG
++  tw_dump_candidate_list ();
++#endif
++
++  do
++    {
++      iv = 0;
++      FOR_EACH_BB_FN (bb, cfun)
++        iv += tw_gimple_in_bb (bb, 0);
++    } while (iv);
++  FOR_EACH_BB_FN (bb, cfun)
++    tw_gimple_in_bb (bb, 1);
++  FOR_EACH_BB_FN (bb, cfun)
++    verify_gimple_in_seq (bb_seq (bb));
++
++  tw_reset ();
++
++  return 0;
++}
++
++/* Originally, we implemented type widening over the emitted GIMPLE
++ *  * sequence. Later on, we discovered that we needed to wait till
++ *   * after OpenMP expansion, so we implemented type widening over the
++ *    * CFG-BB form.
++ *     */
++#ifdef TW_FINALIZE_STMTS
++gimple_opt_pass *
++make_pass_widen_types_stmts (gcc::context *ctxt)
++{
++  return new pass_widen_types_stmts (ctxt);
++}
++#endif
++
++gimple_opt_pass *
++make_pass_widen_types_bbs (gcc::context *ctxt)
++{
++  return new pass_widen_types_bbs (ctxt);
++}
++
++/* Notes:
++ * ------
++ *
++ * Limitations to be documented:
++ * 0. -g -fopenmp not supported.
++ *
++ * Known DejaGNU failures:
++ * 0. FAIL: gcc.dg/pr38245-2.c scan-tree-dump-not optimized "link_error"
++ *    This failure is because the optimization is dependent on the type of the variable;
++ *    once the type of the variable has changed from int to long, the inequalities in
++ *    this test case no longer hold and the code cannot be optimized anymore, consequently,
++ *    the test fails.
++ *
++ * DejaGNU failures that are not due to type-widening:
++ * 0. gcc.dg/vect/vect-120.c scan-tree-dump-times vect "vectorized 1 loops" 1
++ * 1.gcc.dg/vect/vect-120.c -flto scan-tree-dump-times vect "vectorized 1 loops" 1
++ *
++ * DejaGNU PASS'es with -fwiden-types (but FAIL's in the baseline - the baseline needs
++ * to be fixed - it just so happens that the debug information happens to be better in
++ * the type-converted case. We have verified that the generated assembly is the same in
++ * either case (or has extsw eliminated)):
++ * gcc.dg/guality/pr45882.c
++ * gcc.dg/guality/pr43177.c
++ *
++ */
diff --git a/recipes-devtools/gcc/gcc-4.9/0004-uclibc-locale.patch b/recipes-devtools/gcc/gcc-4.9/0004-uclibc-locale.patch
new file mode 100644
index 0000000..49f5f33
--- /dev/null
+++ b/recipes-devtools/gcc/gcc-4.9/0004-uclibc-locale.patch
@@ -0,0 +1,2862 @@
+From a55c751a449c2cbf0b3fcc07aab1b86bf9661510 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem at gmail.com>
+Date: Fri, 29 Mar 2013 08:41:39 +0400
+Subject: [PATCH 04/35] uclibc-locale
+
+Signed-off-by: Khem Raj <raj.khem at gmail.com>
+
+Upstream-Status: Pending
+---
+ libstdc++-v3/acinclude.m4                          |   37 ++
+ .../config/locale/uclibc/c++locale_internal.h      |   63 ++
+ libstdc++-v3/config/locale/uclibc/c_locale.cc      |  160 +++++
+ libstdc++-v3/config/locale/uclibc/c_locale.h       |  117 ++++
+ .../config/locale/uclibc/codecvt_members.cc        |  308 +++++++++
+ .../config/locale/uclibc/collate_members.cc        |   80 +++
+ libstdc++-v3/config/locale/uclibc/ctype_members.cc |  300 +++++++++
+ .../config/locale/uclibc/messages_members.cc       |  100 +++
+ .../config/locale/uclibc/messages_members.h        |  118 ++++
+ .../config/locale/uclibc/monetary_members.cc       |  692 ++++++++++++++++++++
+ .../config/locale/uclibc/numeric_members.cc        |  160 +++++
+ libstdc++-v3/config/locale/uclibc/time_members.cc  |  406 ++++++++++++
+ libstdc++-v3/config/locale/uclibc/time_members.h   |   68 ++
+ libstdc++-v3/configure                             |   75 +++
+ libstdc++-v3/include/c_compatibility/wchar.h       |    2 +
+ libstdc++-v3/include/c_std/cwchar                  |    2 +
+ 16 files changed, 2688 insertions(+)
+ create mode 100644 libstdc++-v3/config/locale/uclibc/c++locale_internal.h
+ create mode 100644 libstdc++-v3/config/locale/uclibc/c_locale.cc
+ create mode 100644 libstdc++-v3/config/locale/uclibc/c_locale.h
+ create mode 100644 libstdc++-v3/config/locale/uclibc/codecvt_members.cc
+ create mode 100644 libstdc++-v3/config/locale/uclibc/collate_members.cc
+ create mode 100644 libstdc++-v3/config/locale/uclibc/ctype_members.cc
+ create mode 100644 libstdc++-v3/config/locale/uclibc/messages_members.cc
+ create mode 100644 libstdc++-v3/config/locale/uclibc/messages_members.h
+ create mode 100644 libstdc++-v3/config/locale/uclibc/monetary_members.cc
+ create mode 100644 libstdc++-v3/config/locale/uclibc/numeric_members.cc
+ create mode 100644 libstdc++-v3/config/locale/uclibc/time_members.cc
+ create mode 100644 libstdc++-v3/config/locale/uclibc/time_members.h
+
+diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4
+index 0871a6a..326d7ef 100644
+--- a/libstdc++-v3/acinclude.m4
++++ b/libstdc++-v3/acinclude.m4
+@@ -1905,6 +1905,9 @@ AC_DEFUN([GLIBCXX_ENABLE_CLOCALE], [
+   # Default to "generic".
+   if test $enable_clocale_flag = auto; then
+     case ${target_os} in
++      *-uclibc*)
++        enable_clocale_flag=uclibc
++        ;;
+       linux* | gnu* | kfreebsd*-gnu | knetbsd*-gnu)
+ 	enable_clocale_flag=gnu
+ 	;;
+@@ -2069,6 +2072,40 @@ AC_DEFUN([GLIBCXX_ENABLE_CLOCALE], [
+       CTIME_CC=config/locale/generic/time_members.cc
+       CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h
+       ;;
++    uclibc)
++      AC_MSG_RESULT(uclibc)
++
++      # Declare intention to use gettext, and add support for specific
++      # languages.
++      # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT
++      ALL_LINGUAS="de fr"
++
++      # Don't call AM-GNU-GETTEXT here. Instead, assume glibc.
++      AC_CHECK_PROG(check_msgfmt, msgfmt, yes, no)
++      if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then
++        USE_NLS=yes
++      fi
++      # Export the build objects.
++      for ling in $ALL_LINGUAS; do \
++        glibcxx_MOFILES="$glibcxx_MOFILES $ling.mo"; \
++        glibcxx_POFILES="$glibcxx_POFILES $ling.po"; \
++      done
++      AC_SUBST(glibcxx_MOFILES)
++      AC_SUBST(glibcxx_POFILES)
++
++      CLOCALE_H=config/locale/uclibc/c_locale.h
++      CLOCALE_CC=config/locale/uclibc/c_locale.cc
++      CCODECVT_CC=config/locale/uclibc/codecvt_members.cc
++      CCOLLATE_CC=config/locale/uclibc/collate_members.cc
++      CCTYPE_CC=config/locale/uclibc/ctype_members.cc
++      CMESSAGES_H=config/locale/uclibc/messages_members.h
++      CMESSAGES_CC=config/locale/uclibc/messages_members.cc
++      CMONEY_CC=config/locale/uclibc/monetary_members.cc
++      CNUMERIC_CC=config/locale/uclibc/numeric_members.cc
++      CTIME_H=config/locale/uclibc/time_members.h
++      CTIME_CC=config/locale/uclibc/time_members.cc
++      CLOCALE_INTERNAL_H=config/locale/uclibc/c++locale_internal.h
++      ;;
+   esac
+ 
+   # This is where the testsuite looks for locale catalogs, using the
+diff --git a/libstdc++-v3/config/locale/uclibc/c++locale_internal.h b/libstdc++-v3/config/locale/uclibc/c++locale_internal.h
+new file mode 100644
+index 0000000..2ae3e4a
+--- /dev/null
++++ b/libstdc++-v3/config/locale/uclibc/c++locale_internal.h
+@@ -0,0 +1,63 @@
++// Prototypes for GLIBC thread locale __-prefixed functions -*- C++ -*-
++
++// Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
++//
++// This file is part of the GNU ISO C++ Library.  This library is free
++// software; you can redistribute it and/or modify it under the
++// terms of the GNU General Public License as published by the
++// Free Software Foundation; either version 2, or (at your option)
++// any later version.
++
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++// GNU General Public License for more details.
++
++// You should have received a copy of the GNU General Public License along
++// with this library; see the file COPYING.  If not, write to the Free
++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
++// USA.
++
++// As a special exception, you may use this file as part of a free software
++// library without restriction.  Specifically, if other files instantiate
++// templates or use macros or inline functions from this file, or you compile
++// this file and link it with other files to produce an executable, this
++// file does not by itself cause the resulting executable to be covered by
++// the GNU General Public License.  This exception does not however
++// invalidate any other reasons why the executable file might be covered by
++// the GNU General Public License.
++
++// Written by Jakub Jelinek <jakub at redhat.com>
++
++#include <bits/c++config.h>
++#include <clocale>
++
++#ifdef __UCLIBC_MJN3_ONLY__
++#warning clean this up
++#endif
++
++#ifdef __UCLIBC_HAS_XLOCALE__
++
++extern "C" __typeof(nl_langinfo_l) __nl_langinfo_l;
++extern "C" __typeof(strcoll_l) __strcoll_l;
++extern "C" __typeof(strftime_l) __strftime_l;
++extern "C" __typeof(strtod_l) __strtod_l;
++extern "C" __typeof(strtof_l) __strtof_l;
++extern "C" __typeof(strtold_l) __strtold_l;
++extern "C" __typeof(strxfrm_l) __strxfrm_l;
++extern "C" __typeof(newlocale) __newlocale;
++extern "C" __typeof(freelocale) __freelocale;
++extern "C" __typeof(duplocale) __duplocale;
++extern "C" __typeof(uselocale) __uselocale;
++
++#ifdef _GLIBCXX_USE_WCHAR_T
++extern "C" __typeof(iswctype_l) __iswctype_l;
++extern "C" __typeof(towlower_l) __towlower_l;
++extern "C" __typeof(towupper_l) __towupper_l;
++extern "C" __typeof(wcscoll_l) __wcscoll_l;
++extern "C" __typeof(wcsftime_l) __wcsftime_l;
++extern "C" __typeof(wcsxfrm_l) __wcsxfrm_l;
++extern "C" __typeof(wctype_l) __wctype_l;
++#endif
++
++#endif // GLIBC 2.3 and later
+diff --git a/libstdc++-v3/config/locale/uclibc/c_locale.cc b/libstdc++-v3/config/locale/uclibc/c_locale.cc
+new file mode 100644
+index 0000000..5081dc1
+--- /dev/null
++++ b/libstdc++-v3/config/locale/uclibc/c_locale.cc
+@@ -0,0 +1,160 @@
++// Wrapper for underlying C-language localization -*- C++ -*-
++
++// Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
++//
++// This file is part of the GNU ISO C++ Library.  This library is free
++// software; you can redistribute it and/or modify it under the
++// terms of the GNU General Public License as published by the
++// Free Software Foundation; either version 2, or (at your option)
++// any later version.
++
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++// GNU General Public License for more details.
++
++// You should have received a copy of the GNU General Public License along
++// with this library; see the file COPYING.  If not, write to the Free
++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
++// USA.
++
++// As a special exception, you may use this file as part of a free software
++// library without restriction.  Specifically, if other files instantiate
++// templates or use macros or inline functions from this file, or you compile
++// this file and link it with other files to produce an executable, this
++// file does not by itself cause the resulting executable to be covered by
++// the GNU General Public License.  This exception does not however
++// invalidate any other reasons why the executable file might be covered by
++// the GNU General Public License.
++
++//
++// ISO C++ 14882: 22.8  Standard locale categories.
++//
++
++// Written by Benjamin Kosnik <bkoz at redhat.com>
++
++#include <cerrno>  // For errno
++#include <locale>
++#include <stdexcept>
++#include <langinfo.h>
++#include <bits/c++locale_internal.h>
++
++#ifndef __UCLIBC_HAS_XLOCALE__
++#define __strtol_l(S, E, B, L)      strtol((S), (E), (B))
++#define __strtoul_l(S, E, B, L)     strtoul((S), (E), (B))
++#define __strtoll_l(S, E, B, L)     strtoll((S), (E), (B))
++#define __strtoull_l(S, E, B, L)    strtoull((S), (E), (B))
++#define __strtof_l(S, E, L)         strtof((S), (E))
++#define __strtod_l(S, E, L)         strtod((S), (E))
++#define __strtold_l(S, E, L)        strtold((S), (E))
++#warning should dummy __newlocale check for C|POSIX ?
++#define __newlocale(a, b, c)        NULL
++#define __freelocale(a)             ((void)0)
++#define __duplocale(a)              __c_locale()
++#endif
++
++namespace std
++{
++  template<>
++    void
++    __convert_to_v(const char* __s, float& __v, ios_base::iostate& __err,
++		   const __c_locale& __cloc)
++    {
++      if (!(__err & ios_base::failbit))
++	{
++	  char* __sanity;
++	  errno = 0;
++	  float __f = __strtof_l(__s, &__sanity, __cloc);
++          if (__sanity != __s && errno != ERANGE)
++	    __v = __f;
++	  else
++	    __err |= ios_base::failbit;
++	}
++    }
++
++  template<>
++    void
++    __convert_to_v(const char* __s, double& __v, ios_base::iostate& __err,
++		   const __c_locale& __cloc)
++    {
++      if (!(__err & ios_base::failbit))
++	{
++	  char* __sanity;
++	  errno = 0;
++	  double __d = __strtod_l(__s, &__sanity, __cloc);
++          if (__sanity != __s && errno != ERANGE)
++	    __v = __d;
++	  else
++	    __err |= ios_base::failbit;
++	}
++    }
++
++  template<>
++    void
++    __convert_to_v(const char* __s, long double& __v, ios_base::iostate& __err,
++		   const __c_locale& __cloc)
++    {
++      if (!(__err & ios_base::failbit))
++	{
++	  char* __sanity;
++	  errno = 0;
++	  long double __ld = __strtold_l(__s, &__sanity, __cloc);
++          if (__sanity != __s && errno != ERANGE)
++	    __v = __ld;
++	  else
++	    __err |= ios_base::failbit;
++	}
++    }
++
++  void
++  locale::facet::_S_create_c_locale(__c_locale& __cloc, const char* __s,
++				    __c_locale __old)
++  {
++    __cloc = __newlocale(1 << LC_ALL, __s, __old);
++#ifdef __UCLIBC_HAS_XLOCALE__
++    if (!__cloc)
++      {
++	// This named locale is not supported by the underlying OS.
++	__throw_runtime_error(__N("locale::facet::_S_create_c_locale "
++			      "name not valid"));
++      }
++#endif
++  }
++
++  void
++  locale::facet::_S_destroy_c_locale(__c_locale& __cloc)
++  {
++    if (_S_get_c_locale() != __cloc)
++      __freelocale(__cloc);
++  }
++
++  __c_locale
++  locale::facet::_S_clone_c_locale(__c_locale& __cloc)
++  { return __duplocale(__cloc); }
++} // namespace std
++
++namespace __gnu_cxx
++{
++  const char* const category_names[6 + _GLIBCXX_NUM_CATEGORIES] =
++    {
++      "LC_CTYPE",
++      "LC_NUMERIC",
++      "LC_TIME",
++      "LC_COLLATE",
++      "LC_MONETARY",
++      "LC_MESSAGES",
++#if _GLIBCXX_NUM_CATEGORIES != 0
++      "LC_PAPER",
++      "LC_NAME",
++      "LC_ADDRESS",
++      "LC_TELEPHONE",
++      "LC_MEASUREMENT",
++      "LC_IDENTIFICATION"
++#endif
++    };
++}
++
++namespace std
++{
++  const char* const* const locale::_S_categories = __gnu_cxx::category_names;
++}  // namespace std
+diff --git a/libstdc++-v3/config/locale/uclibc/c_locale.h b/libstdc++-v3/config/locale/uclibc/c_locale.h
+new file mode 100644
+index 0000000..da07c1f
+--- /dev/null
++++ b/libstdc++-v3/config/locale/uclibc/c_locale.h
+@@ -0,0 +1,117 @@
++// Wrapper for underlying C-language localization -*- C++ -*-
++
++// Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
++//
++// This file is part of the GNU ISO C++ Library.  This library is free
++// software; you can redistribute it and/or modify it under the
++// terms of the GNU General Public License as published by the
++// Free Software Foundation; either version 2, or (at your option)
++// any later version.
++
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++// GNU General Public License for more details.
++
++// You should have received a copy of the GNU General Public License along
++// with this library; see the file COPYING.  If not, write to the Free
++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
++// USA.
++
++// As a special exception, you may use this file as part of a free software
++// library without restriction.  Specifically, if other files instantiate
++// templates or use macros or inline functions from this file, or you compile
++// this file and link it with other files to produce an executable, this
++// file does not by itself cause the resulting executable to be covered by
++// the GNU General Public License.  This exception does not however
++// invalidate any other reasons why the executable file might be covered by
++// the GNU General Public License.
++
++//
++// ISO C++ 14882: 22.8  Standard locale categories.
++//
++
++// Written by Benjamin Kosnik <bkoz at redhat.com>
++
++#ifndef _C_LOCALE_H
++#define _C_LOCALE_H 1
++
++#pragma GCC system_header
++
++#include <cstring>              // get std::strlen
++#include <cstdio>               // get std::snprintf or std::sprintf
++#include <clocale>
++#include <langinfo.h>		// For codecvt
++#ifdef __UCLIBC_MJN3_ONLY__
++#warning fix this
++#endif
++#ifdef __UCLIBC_HAS_LOCALE__
++#include <iconv.h>		// For codecvt using iconv, iconv_t
++#endif
++#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
++#include <libintl.h> 		// For messages
++#endif
++
++#ifdef __UCLIBC_MJN3_ONLY__
++#warning what is _GLIBCXX_C_LOCALE_GNU for
++#endif
++#define _GLIBCXX_C_LOCALE_GNU 1
++
++#ifdef __UCLIBC_MJN3_ONLY__
++#warning fix categories
++#endif
++// #define _GLIBCXX_NUM_CATEGORIES 6
++#define _GLIBCXX_NUM_CATEGORIES 0
++
++#ifdef __UCLIBC_HAS_XLOCALE__
++namespace __gnu_cxx
++{
++  extern "C" __typeof(uselocale) __uselocale;
++}
++#endif
++
++namespace std
++{
++#ifdef __UCLIBC_HAS_XLOCALE__
++  typedef __locale_t		__c_locale;
++#else
++  typedef int*			__c_locale;
++#endif
++
++  // Convert numeric value of type _Tv to string and return length of
++  // string.  If snprintf is available use it, otherwise fall back to
++  // the unsafe sprintf which, in general, can be dangerous and should
++  // be avoided.
++  template<typename _Tv>
++    int
++    __convert_from_v(char* __out,
++		     const int __size __attribute__ ((__unused__)),
++		     const char* __fmt,
++#ifdef __UCLIBC_HAS_XCLOCALE__
++		     _Tv __v, const __c_locale& __cloc, int __prec)
++    {
++      __c_locale __old = __gnu_cxx::__uselocale(__cloc);
++#else
++		     _Tv __v, const __c_locale&, int __prec)
++    {
++# ifdef __UCLIBC_HAS_LOCALE__
++      char* __old = std::setlocale(LC_ALL, NULL);
++      char* __sav = new char[std::strlen(__old) + 1];
++      std::strcpy(__sav, __old);
++      std::setlocale(LC_ALL, "C");
++# endif
++#endif
++
++      const int __ret = std::snprintf(__out, __size, __fmt, __prec, __v);
++
++#ifdef __UCLIBC_HAS_XCLOCALE__
++      __gnu_cxx::__uselocale(__old);
++#elif defined __UCLIBC_HAS_LOCALE__
++      std::setlocale(LC_ALL, __sav);
++      delete [] __sav;
++#endif
++      return __ret;
++    }
++}
++
++#endif
+diff --git a/libstdc++-v3/config/locale/uclibc/codecvt_members.cc b/libstdc++-v3/config/locale/uclibc/codecvt_members.cc
+new file mode 100644
+index 0000000..64aa962
+--- /dev/null
++++ b/libstdc++-v3/config/locale/uclibc/codecvt_members.cc
+@@ -0,0 +1,308 @@
++// std::codecvt implementation details, GNU version -*- C++ -*-
++
++// Copyright (C) 2002, 2003 Free Software Foundation, Inc.
++//
++// This file is part of the GNU ISO C++ Library.  This library is free
++// software; you can redistribute it and/or modify it under the
++// terms of the GNU General Public License as published by the
++// Free Software Foundation; either version 2, or (at your option)
++// any later version.
++
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++// GNU General Public License for more details.
++
++// You should have received a copy of the GNU General Public License along
++// with this library; see the file COPYING.  If not, write to the Free
++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
++// USA.
++
++// As a special exception, you may use this file as part of a free software
++// library without restriction.  Specifically, if other files instantiate
++// templates or use macros or inline functions from this file, or you compile
++// this file and link it with other files to produce an executable, this
++// file does not by itself cause the resulting executable to be covered by
++// the GNU General Public License.  This exception does not however
++// invalidate any other reasons why the executable file might be covered by
++// the GNU General Public License.
++
++//
++// ISO C++ 14882: 22.2.1.5 - Template class codecvt
++//
++
++// Written by Benjamin Kosnik <bkoz at redhat.com>
++
++#include <locale>
++#include <cstdlib>  // For MB_CUR_MAX
++#include <climits>  // For MB_LEN_MAX
++#include <bits/c++locale_internal.h>
++
++namespace std
++{
++  // Specializations.
++#ifdef _GLIBCXX_USE_WCHAR_T
++  codecvt_base::result
++  codecvt<wchar_t, char, mbstate_t>::
++  do_out(state_type& __state, const intern_type* __from,
++	 const intern_type* __from_end, const intern_type*& __from_next,
++	 extern_type* __to, extern_type* __to_end,
++	 extern_type*& __to_next) const
++  {
++    result __ret = ok;
++    state_type __tmp_state(__state);
++
++#ifdef __UCLIBC_HAS_XLOCALE__
++    __c_locale __old = __uselocale(_M_c_locale_codecvt);
++#endif
++
++    // wcsnrtombs is *very* fast but stops if encounters NUL characters:
++    // in case we fall back to wcrtomb and then continue, in a loop.
++    // NB: wcsnrtombs is a GNU extension
++    for (__from_next = __from, __to_next = __to;
++	 __from_next < __from_end && __to_next < __to_end
++	 && __ret == ok;)
++      {
++	const intern_type* __from_chunk_end = wmemchr(__from_next, L'\0',
++						      __from_end - __from_next);
++	if (!__from_chunk_end)
++	  __from_chunk_end = __from_end;
++
++	__from = __from_next;
++	const size_t __conv = wcsnrtombs(__to_next, &__from_next,
++					 __from_chunk_end - __from_next,
++					 __to_end - __to_next, &__state);
++	if (__conv == static_cast<size_t>(-1))
++	  {
++	    // In case of error, in order to stop at the exact place we
++	    // have to start again from the beginning with a series of
++	    // wcrtomb.
++	    for (; __from < __from_next; ++__from)
++	      __to_next += wcrtomb(__to_next, *__from, &__tmp_state);
++	    __state = __tmp_state;
++	    __ret = error;
++	  }
++	else if (__from_next && __from_next < __from_chunk_end)
++	  {
++	    __to_next += __conv;
++	    __ret = partial;
++	  }
++	else
++	  {
++	    __from_next = __from_chunk_end;
++	    __to_next += __conv;
++	  }
++
++	if (__from_next < __from_end && __ret == ok)
++	  {
++	    extern_type __buf[MB_LEN_MAX];
++	    __tmp_state = __state;
++	    const size_t __conv = wcrtomb(__buf, *__from_next, &__tmp_state);
++	    if (__conv > static_cast<size_t>(__to_end - __to_next))
++	      __ret = partial;
++	    else
++	      {
++		memcpy(__to_next, __buf, __conv);
++		__state = __tmp_state;
++		__to_next += __conv;
++		++__from_next;
++	      }
++	  }
++      }
++
++#ifdef __UCLIBC_HAS_XLOCALE__
++    __uselocale(__old);
++#endif
++
++    return __ret;
++  }
++
++  codecvt_base::result
++  codecvt<wchar_t, char, mbstate_t>::
++  do_in(state_type& __state, const extern_type* __from,
++	const extern_type* __from_end, const extern_type*& __from_next,
++	intern_type* __to, intern_type* __to_end,
++	intern_type*& __to_next) const
++  {
++    result __ret = ok;
++    state_type __tmp_state(__state);
++
++#ifdef __UCLIBC_HAS_XLOCALE__
++    __c_locale __old = __uselocale(_M_c_locale_codecvt);
++#endif
++
++    // mbsnrtowcs is *very* fast but stops if encounters NUL characters:
++    // in case we store a L'\0' and then continue, in a loop.
++    // NB: mbsnrtowcs is a GNU extension
++    for (__from_next = __from, __to_next = __to;
++	 __from_next < __from_end && __to_next < __to_end
++	 && __ret == ok;)
++      {
++	const extern_type* __from_chunk_end;
++	__from_chunk_end = static_cast<const extern_type*>(memchr(__from_next, '\0',
++								  __from_end
++								  - __from_next));
++	if (!__from_chunk_end)
++	  __from_chunk_end = __from_end;
++
++	__from = __from_next;
++	size_t __conv = mbsnrtowcs(__to_next, &__from_next,
++				   __from_chunk_end - __from_next,
++				   __to_end - __to_next, &__state);
++	if (__conv == static_cast<size_t>(-1))
++	  {
++	    // In case of error, in order to stop at the exact place we
++	    // have to start again from the beginning with a series of
++	    // mbrtowc.
++	    for (;; ++__to_next, __from += __conv)
++	      {
++		__conv = mbrtowc(__to_next, __from, __from_end - __from,
++				 &__tmp_state);
++		if (__conv == static_cast<size_t>(-1)
++		    || __conv == static_cast<size_t>(-2))
++		  break;
++	      }
++	    __from_next = __from;
++	    __state = __tmp_state;
++	    __ret = error;
++	  }
++	else if (__from_next && __from_next < __from_chunk_end)
++	  {
++	    // It is unclear what to return in this case (see DR 382).
++	    __to_next += __conv;
++	    __ret = partial;
++	  }
++	else
++	  {
++	    __from_next = __from_chunk_end;
++	    __to_next += __conv;
++	  }
++
++	if (__from_next < __from_end && __ret == ok)
++	  {
++	    if (__to_next < __to_end)
++	      {
++		// XXX Probably wrong for stateful encodings
++		__tmp_state = __state;
++		++__from_next;
++		*__to_next++ = L'\0';
++	      }
++	    else
++	      __ret = partial;
++	  }
++      }
++
++#ifdef __UCLIBC_HAS_XLOCALE__
++    __uselocale(__old);
++#endif
++
++    return __ret;
++  }
++
++  int
++  codecvt<wchar_t, char, mbstate_t>::
++  do_encoding() const throw()
++  {
++    // XXX This implementation assumes that the encoding is
++    // stateless and is either single-byte or variable-width.
++    int __ret = 0;
++#ifdef __UCLIBC_HAS_XLOCALE__
++    __c_locale __old = __uselocale(_M_c_locale_codecvt);
++#endif
++    if (MB_CUR_MAX == 1)
++      __ret = 1;
++#ifdef __UCLIBC_HAS_XLOCALE__
++    __uselocale(__old);
++#endif
++    return __ret;
++  }
++
++  int
++  codecvt<wchar_t, char, mbstate_t>::
++  do_max_length() const throw()
++  {
++#ifdef __UCLIBC_HAS_XLOCALE__
++    __c_locale __old = __uselocale(_M_c_locale_codecvt);
++#endif
++    // XXX Probably wrong for stateful encodings.
++    int __ret = MB_CUR_MAX;
++#ifdef __UCLIBC_HAS_XLOCALE__
++    __uselocale(__old);
++#endif
++    return __ret;
++  }
++
++  int
++  codecvt<wchar_t, char, mbstate_t>::
++  do_length(state_type& __state, const extern_type* __from,
++	    const extern_type* __end, size_t __max) const
++  {
++    int __ret = 0;
++    state_type __tmp_state(__state);
++
++#ifdef __UCLIBC_HAS_XLOCALE__
++    __c_locale __old = __uselocale(_M_c_locale_codecvt);
++#endif
++
++    // mbsnrtowcs is *very* fast but stops if encounters NUL characters:
++    // in case we advance past it and then continue, in a loop.
++    // NB: mbsnrtowcs is a GNU extension
++
++    // A dummy internal buffer is needed in order for mbsnrtocws to consider
++    // its fourth parameter (it wouldn't with NULL as first parameter).
++    wchar_t* __to = static_cast<wchar_t*>(__builtin_alloca(sizeof(wchar_t)
++							   * __max));
++    while (__from < __end && __max)
++      {
++	const extern_type* __from_chunk_end;
++	__from_chunk_end = static_cast<const extern_type*>(memchr(__from, '\0',
++								  __end
++								  - __from));
++	if (!__from_chunk_end)
++	  __from_chunk_end = __end;
++
++	const extern_type* __tmp_from = __from;
++	size_t __conv = mbsnrtowcs(__to, &__from,
++				   __from_chunk_end - __from,
++				   __max, &__state);
++	if (__conv == static_cast<size_t>(-1))
++	  {
++	    // In case of error, in order to stop at the exact place we
++	    // have to start again from the beginning with a series of
++	    // mbrtowc.
++	    for (__from = __tmp_from;; __from += __conv)
++	      {
++		__conv = mbrtowc(NULL, __from, __end - __from,
++				 &__tmp_state);
++		if (__conv == static_cast<size_t>(-1)
++		    || __conv == static_cast<size_t>(-2))
++		  break;
++	      }
++	    __state = __tmp_state;
++	    __ret += __from - __tmp_from;
++	    break;
++	  }
++	if (!__from)
++	  __from = __from_chunk_end;
++
++	__ret += __from - __tmp_from;
++	__max -= __conv;
++
++	if (__from < __end && __max)
++	  {
++	    // XXX Probably wrong for stateful encodings
++	    __tmp_state = __state;
++	    ++__from;
++	    ++__ret;
++	    --__max;
++	  }
++      }
++
++#ifdef __UCLIBC_HAS_XLOCALE__
++    __uselocale(__old);
++#endif
++
++    return __ret;
++  }
++#endif
++}
+diff --git a/libstdc++-v3/config/locale/uclibc/collate_members.cc b/libstdc++-v3/config/locale/uclibc/collate_members.cc
+new file mode 100644
+index 0000000..c2664a7
+--- /dev/null
++++ b/libstdc++-v3/config/locale/uclibc/collate_members.cc
+@@ -0,0 +1,80 @@
++// std::collate implementation details, GNU version -*- C++ -*-
++
++// Copyright (C) 2001, 2002 Free Software Foundation, Inc.
++//
++// This file is part of the GNU ISO C++ Library.  This library is free
++// software; you can redistribute it and/or modify it under the
++// terms of the GNU General Public License as published by the
++// Free Software Foundation; either version 2, or (at your option)
++// any later version.
++
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++// GNU General Public License for more details.
++
++// You should have received a copy of the GNU General Public License along
++// with this library; see the file COPYING.  If not, write to the Free
++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
++// USA.
++
++// As a special exception, you may use this file as part of a free software
++// library without restriction.  Specifically, if other files instantiate
++// templates or use macros or inline functions from this file, or you compile
++// this file and link it with other files to produce an executable, this
++// file does not by itself cause the resulting executable to be covered by
++// the GNU General Public License.  This exception does not however
++// invalidate any other reasons why the executable file might be covered by
++// the GNU General Public License.
++
++//
++// ISO C++ 14882: 22.2.4.1.2  collate virtual functions
++//
++
++// Written by Benjamin Kosnik <bkoz at redhat.com>
++
++#include <locale>
++#include <bits/c++locale_internal.h>
++
++#ifndef __UCLIBC_HAS_XLOCALE__
++#define __strcoll_l(S1, S2, L)      strcoll((S1), (S2))
++#define __strxfrm_l(S1, S2, N, L)   strxfrm((S1), (S2), (N))
++#define __wcscoll_l(S1, S2, L)      wcscoll((S1), (S2))
++#define __wcsxfrm_l(S1, S2, N, L)   wcsxfrm((S1), (S2), (N))
++#endif
++
++namespace std
++{
++  // These are basically extensions to char_traits, and perhaps should
++  // be put there instead of here.
++  template<>
++    int
++    collate<char>::_M_compare(const char* __one, const char* __two) const
++    {
++      int __cmp = __strcoll_l(__one, __two, _M_c_locale_collate);
++      return (__cmp >> (8 * sizeof (int) - 2)) | (__cmp != 0);
++    }
++
++  template<>
++    size_t
++    collate<char>::_M_transform(char* __to, const char* __from,
++				size_t __n) const
++    { return __strxfrm_l(__to, __from, __n, _M_c_locale_collate); }
++
++#ifdef _GLIBCXX_USE_WCHAR_T
++  template<>
++    int
++    collate<wchar_t>::_M_compare(const wchar_t* __one,
++				 const wchar_t* __two) const
++    {
++      int __cmp = __wcscoll_l(__one, __two, _M_c_locale_collate);
++      return (__cmp >> (8 * sizeof (int) - 2)) | (__cmp != 0);
++    }
++
++  template<>
++    size_t
++    collate<wchar_t>::_M_transform(wchar_t* __to, const wchar_t* __from,
++				   size_t __n) const
++    { return __wcsxfrm_l(__to, __from, __n, _M_c_locale_collate); }
++#endif
++}
+diff --git a/libstdc++-v3/config/locale/uclibc/ctype_members.cc b/libstdc++-v3/config/locale/uclibc/ctype_members.cc
+new file mode 100644
+index 0000000..7294e3a
+--- /dev/null
++++ b/libstdc++-v3/config/locale/uclibc/ctype_members.cc
+@@ -0,0 +1,300 @@
++// std::ctype implementation details, GNU version -*- C++ -*-
++
++// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
++//
++// This file is part of the GNU ISO C++ Library.  This library is free
++// software; you can redistribute it and/or modify it under the
++// terms of the GNU General Public License as published by the
++// Free Software Foundation; either version 2, or (at your option)
++// any later version.
++
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++// GNU General Public License for more details.
++
++// You should have received a copy of the GNU General Public License along
++// with this library; see the file COPYING.  If not, write to the Free
++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
++// USA.
++
++// As a special exception, you may use this file as part of a free software
++// library without restriction.  Specifically, if other files instantiate
++// templates or use macros or inline functions from this file, or you compile
++// this file and link it with other files to produce an executable, this
++// file does not by itself cause the resulting executable to be covered by
++// the GNU General Public License.  This exception does not however
++// invalidate any other reasons why the executable file might be covered by
++// the GNU General Public License.
++
++//
++// ISO C++ 14882: 22.2.1.1.2  ctype virtual functions.
++//
++
++// Written by Benjamin Kosnik <bkoz at redhat.com>
++
++#define _LIBC
++#include <locale>
++#undef _LIBC
++#include <bits/c++locale_internal.h>
++
++#ifndef __UCLIBC_HAS_XLOCALE__
++#define __wctype_l(S, L)           wctype((S))
++#define __towupper_l(C, L)         towupper((C))
++#define __towlower_l(C, L)         towlower((C))
++#define __iswctype_l(C, M, L)      iswctype((C), (M))
++#endif
++
++namespace std
++{
++  // NB: The other ctype<char> specializations are in src/locale.cc and
++  // various /config/os/* files.
++  template<>
++    ctype_byname<char>::ctype_byname(const char* __s, size_t __refs)
++    : ctype<char>(0, false, __refs)
++    {
++      if (std::strcmp(__s, "C") != 0 && std::strcmp(__s, "POSIX") != 0)
++	{
++	  this->_S_destroy_c_locale(this->_M_c_locale_ctype);
++	  this->_S_create_c_locale(this->_M_c_locale_ctype, __s);
++#ifdef __UCLIBC_HAS_XLOCALE__
++	  this->_M_toupper = this->_M_c_locale_ctype->__ctype_toupper;
++	  this->_M_tolower = this->_M_c_locale_ctype->__ctype_tolower;
++	  this->_M_table = this->_M_c_locale_ctype->__ctype_b;
++#endif
++	}
++    }
++
++#ifdef _GLIBCXX_USE_WCHAR_T
++  ctype<wchar_t>::__wmask_type
++  ctype<wchar_t>::_M_convert_to_wmask(const mask __m) const
++  {
++    __wmask_type __ret;
++    switch (__m)
++      {
++      case space:
++	__ret = __wctype_l("space", _M_c_locale_ctype);
++	break;
++      case print:
++	__ret = __wctype_l("print", _M_c_locale_ctype);
++	break;
++      case cntrl:
++	__ret = __wctype_l("cntrl", _M_c_locale_ctype);
++	break;
++      case upper:
++	__ret = __wctype_l("upper", _M_c_locale_ctype);
++	break;
++      case lower:
++	__ret = __wctype_l("lower", _M_c_locale_ctype);
++	break;
++      case alpha:
++	__ret = __wctype_l("alpha", _M_c_locale_ctype);
++	break;
++      case digit:
++	__ret = __wctype_l("digit", _M_c_locale_ctype);
++	break;
++      case punct:
++	__ret = __wctype_l("punct", _M_c_locale_ctype);
++	break;
++      case xdigit:
++	__ret = __wctype_l("xdigit", _M_c_locale_ctype);
++	break;
++      case alnum:
++	__ret = __wctype_l("alnum", _M_c_locale_ctype);
++	break;
++      case graph:
++	__ret = __wctype_l("graph", _M_c_locale_ctype);
++	break;
++      default:
++	__ret = __wmask_type();
++      }
++    return __ret;
++  }
++
++  wchar_t
++  ctype<wchar_t>::do_toupper(wchar_t __c) const
++  { return __towupper_l(__c, _M_c_locale_ctype); }
++
++  const wchar_t*
++  ctype<wchar_t>::do_toupper(wchar_t* __lo, const wchar_t* __hi) const
++  {
++    while (__lo < __hi)
++      {
++        *__lo = __towupper_l(*__lo, _M_c_locale_ctype);
++        ++__lo;
++      }
++    return __hi;
++  }
++
++  wchar_t
++  ctype<wchar_t>::do_tolower(wchar_t __c) const
++  { return __towlower_l(__c, _M_c_locale_ctype); }
++
++  const wchar_t*
++  ctype<wchar_t>::do_tolower(wchar_t* __lo, const wchar_t* __hi) const
++  {
++    while (__lo < __hi)
++      {
++        *__lo = __towlower_l(*__lo, _M_c_locale_ctype);
++        ++__lo;
++      }
++    return __hi;
++  }
++
++  bool
++  ctype<wchar_t>::
++  do_is(mask __m, wchar_t __c) const
++  {
++    // Highest bitmask in ctype_base == 10, but extra in "C"
++    // library for blank.
++    bool __ret = false;
++    const size_t __bitmasksize = 11;
++    for (size_t __bitcur = 0; __bitcur <= __bitmasksize; ++__bitcur)
++      if (__m & _M_bit[__bitcur]
++	  && __iswctype_l(__c, _M_wmask[__bitcur], _M_c_locale_ctype))
++	{
++	  __ret = true;
++	  break;
++	}
++    return __ret;
++  }
++
++  const wchar_t*
++  ctype<wchar_t>::
++  do_is(const wchar_t* __lo, const wchar_t* __hi, mask* __vec) const
++  {
++    for (; __lo < __hi; ++__vec, ++__lo)
++      {
++	// Highest bitmask in ctype_base == 10, but extra in "C"
++	// library for blank.
++	const size_t __bitmasksize = 11;
++	mask __m = 0;
++	for (size_t __bitcur = 0; __bitcur <= __bitmasksize; ++__bitcur)
++	  if (__iswctype_l(*__lo, _M_wmask[__bitcur], _M_c_locale_ctype))
++	    __m |= _M_bit[__bitcur];
++	*__vec = __m;
++      }
++    return __hi;
++  }
++
++  const wchar_t*
++  ctype<wchar_t>::
++  do_scan_is(mask __m, const wchar_t* __lo, const wchar_t* __hi) const
++  {
++    while (__lo < __hi && !this->do_is(__m, *__lo))
++      ++__lo;
++    return __lo;
++  }
++
++  const wchar_t*
++  ctype<wchar_t>::
++  do_scan_not(mask __m, const char_type* __lo, const char_type* __hi) const
++  {
++    while (__lo < __hi && this->do_is(__m, *__lo) != 0)
++      ++__lo;
++    return __lo;
++  }
++
++  wchar_t
++  ctype<wchar_t>::
++  do_widen(char __c) const
++  { return _M_widen[static_cast<unsigned char>(__c)]; }
++
++  const char*
++  ctype<wchar_t>::
++  do_widen(const char* __lo, const char* __hi, wchar_t* __dest) const
++  {
++    while (__lo < __hi)
++      {
++	*__dest = _M_widen[static_cast<unsigned char>(*__lo)];
++	++__lo;
++	++__dest;
++      }
++    return __hi;
++  }
++
++  char
++  ctype<wchar_t>::
++  do_narrow(wchar_t __wc, char __dfault) const
++  {
++    if (__wc >= 0 && __wc < 128 && _M_narrow_ok)
++      return _M_narrow[__wc];
++#ifdef __UCLIBC_HAS_XLOCALE__
++    __c_locale __old = __uselocale(_M_c_locale_ctype);
++#endif
++    const int __c = wctob(__wc);
++#ifdef __UCLIBC_HAS_XLOCALE__
++    __uselocale(__old);
++#endif
++    return (__c == EOF ? __dfault : static_cast<char>(__c));
++  }
++
++  const wchar_t*
++  ctype<wchar_t>::
++  do_narrow(const wchar_t* __lo, const wchar_t* __hi, char __dfault,
++	    char* __dest) const
++  {
++#ifdef __UCLIBC_HAS_XLOCALE__
++    __c_locale __old = __uselocale(_M_c_locale_ctype);
++#endif
++    if (_M_narrow_ok)
++      while (__lo < __hi)
++	{
++	  if (*__lo >= 0 && *__lo < 128)
++	    *__dest = _M_narrow[*__lo];
++	  else
++	    {
++	      const int __c = wctob(*__lo);
++	      *__dest = (__c == EOF ? __dfault : static_cast<char>(__c));
++	    }
++	  ++__lo;
++	  ++__dest;
++	}
++    else
++      while (__lo < __hi)
++	{
++	  const int __c = wctob(*__lo);
++	  *__dest = (__c == EOF ? __dfault : static_cast<char>(__c));
++	  ++__lo;
++	  ++__dest;
++	}
++#ifdef __UCLIBC_HAS_XLOCALE__
++    __uselocale(__old);
++#endif
++    return __hi;
++  }
++
++  void
++  ctype<wchar_t>::_M_initialize_ctype()
++  {
++#ifdef __UCLIBC_HAS_XLOCALE__
++    __c_locale __old = __uselocale(_M_c_locale_ctype);
++#endif
++    wint_t __i;
++    for (__i = 0; __i < 128; ++__i)
++      {
++	const int __c = wctob(__i);
++	if (__c == EOF)
++	  break;
++	else
++	  _M_narrow[__i] = static_cast<char>(__c);
++      }
++    if (__i == 128)
++      _M_narrow_ok = true;
++    else
++      _M_narrow_ok = false;
++    for (size_t __j = 0;
++	 __j < sizeof(_M_widen) / sizeof(wint_t); ++__j)
++      _M_widen[__j] = btowc(__j);
++
++    for (size_t __k = 0; __k <= 11; ++__k)
++      {
++	_M_bit[__k] = static_cast<mask>(_ISbit(__k));
++	_M_wmask[__k] = _M_convert_to_wmask(_M_bit[__k]);
++      }
++#ifdef __UCLIBC_HAS_XLOCALE__
++    __uselocale(__old);
++#endif
++  }
++#endif //  _GLIBCXX_USE_WCHAR_T
++}
+diff --git a/libstdc++-v3/config/locale/uclibc/messages_members.cc b/libstdc++-v3/config/locale/uclibc/messages_members.cc
+new file mode 100644
+index 0000000..13594d9
+--- /dev/null
++++ b/libstdc++-v3/config/locale/uclibc/messages_members.cc
+@@ -0,0 +1,100 @@
++// std::messages implementation details, GNU version -*- C++ -*-
++
++// Copyright (C) 2001, 2002 Free Software Foundation, Inc.
++//
++// This file is part of the GNU ISO C++ Library.  This library is free
++// software; you can redistribute it and/or modify it under the
++// terms of the GNU General Public License as published by the
++// Free Software Foundation; either version 2, or (at your option)
++// any later version.
++
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++// GNU General Public License for more details.
++
++// You should have received a copy of the GNU General Public License along
++// with this library; see the file COPYING.  If not, write to the Free
++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
++// USA.
++
++// As a special exception, you may use this file as part of a free software
++// library without restriction.  Specifically, if other files instantiate
++// templates or use macros or inline functions from this file, or you compile
++// this file and link it with other files to produce an executable, this
++// file does not by itself cause the resulting executable to be covered by
++// the GNU General Public License.  This exception does not however
++// invalidate any other reasons why the executable file might be covered by
++// the GNU General Public License.
++
++//
++// ISO C++ 14882: 22.2.7.1.2  messages virtual functions
++//
++
++// Written by Benjamin Kosnik <bkoz at redhat.com>
++
++#include <locale>
++#include <bits/c++locale_internal.h>
++
++#ifdef __UCLIBC_MJN3_ONLY__
++#warning fix gettext stuff
++#endif
++#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
++extern "C" char *__dcgettext(const char *domainname,
++			     const char *msgid, int category);
++#undef gettext
++#define gettext(msgid) __dcgettext(NULL, msgid, LC_MESSAGES)
++#else
++#undef gettext
++#define gettext(msgid) (msgid)
++#endif
++
++namespace std
++{
++  // Specializations.
++  template<>
++    string
++    messages<char>::do_get(catalog, int, int, const string& __dfault) const
++    {
++#ifdef __UCLIBC_HAS_XLOCALE__
++      __c_locale __old = __uselocale(_M_c_locale_messages);
++      const char* __msg = const_cast<const char*>(gettext(__dfault.c_str()));
++      __uselocale(__old);
++      return string(__msg);
++#elif defined __UCLIBC_HAS_LOCALE__
++      char* __old = strdup(setlocale(LC_ALL, NULL));
++      setlocale(LC_ALL, _M_name_messages);
++      const char* __msg = gettext(__dfault.c_str());
++      setlocale(LC_ALL, __old);
++      free(__old);
++      return string(__msg);
++#else
++      const char* __msg = gettext(__dfault.c_str());
++      return string(__msg);
++#endif
++    }
++
++#ifdef _GLIBCXX_USE_WCHAR_T
++  template<>
++    wstring
++    messages<wchar_t>::do_get(catalog, int, int, const wstring& __dfault) const
++    {
++# ifdef __UCLIBC_HAS_XLOCALE__
++      __c_locale __old = __uselocale(_M_c_locale_messages);
++      char* __msg = gettext(_M_convert_to_char(__dfault));
++      __uselocale(__old);
++      return _M_convert_from_char(__msg);
++# elif defined __UCLIBC_HAS_LOCALE__
++      char* __old = strdup(setlocale(LC_ALL, NULL));
++      setlocale(LC_ALL, _M_name_messages);
++      char* __msg = gettext(_M_convert_to_char(__dfault));
++      setlocale(LC_ALL, __old);
++      free(__old);
++      return _M_convert_from_char(__msg);
++# else
++      char* __msg = gettext(_M_convert_to_char(__dfault));
++      return _M_convert_from_char(__msg);
++# endif
++    }
++#endif
++}
+diff --git a/libstdc++-v3/config/locale/uclibc/messages_members.h b/libstdc++-v3/config/locale/uclibc/messages_members.h
+new file mode 100644
+index 0000000..1424078
+--- /dev/null
++++ b/libstdc++-v3/config/locale/uclibc/messages_members.h
+@@ -0,0 +1,118 @@
++// std::messages implementation details, GNU version -*- C++ -*-
++
++// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
++//
++// This file is part of the GNU ISO C++ Library.  This library is free
++// software; you can redistribute it and/or modify it under the
++// terms of the GNU General Public License as published by the
++// Free Software Foundation; either version 2, or (at your option)
++// any later version.
++
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++// GNU General Public License for more details.
++
++// You should have received a copy of the GNU General Public License along
++// with this library; see the file COPYING.  If not, write to the Free
++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
++// USA.
++
++// As a special exception, you may use this file as part of a free software
++// library without restriction.  Specifically, if other files instantiate
++// templates or use macros or inline functions from this file, or you compile
++// this file and link it with other files to produce an executable, this
++// file does not by itself cause the resulting executable to be covered by
++// the GNU General Public License.  This exception does not however
++// invalidate any other reasons why the executable file might be covered by
++// the GNU General Public License.
++
++//
++// ISO C++ 14882: 22.2.7.1.2  messages functions
++//
++
++// Written by Benjamin Kosnik <bkoz at redhat.com>
++
++#ifdef __UCLIBC_MJN3_ONLY__
++#warning fix prototypes for *textdomain funcs
++#endif
++#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
++extern "C" char *__textdomain(const char *domainname);
++extern "C" char *__bindtextdomain(const char *domainname,
++				  const char *dirname);
++#else
++#undef __textdomain
++#undef __bindtextdomain
++#define __textdomain(D)           ((void)0)
++#define __bindtextdomain(D,P)     ((void)0)
++#endif
++
++  // Non-virtual member functions.
++  template<typename _CharT>
++     messages<_CharT>::messages(size_t __refs)
++     : facet(__refs), _M_c_locale_messages(_S_get_c_locale()),
++     _M_name_messages(_S_get_c_name())
++     { }
++
++  template<typename _CharT>
++     messages<_CharT>::messages(__c_locale __cloc, const char* __s,
++				size_t __refs)
++     : facet(__refs), _M_c_locale_messages(_S_clone_c_locale(__cloc)),
++     _M_name_messages(__s)
++     {
++       char* __tmp = new char[std::strlen(__s) + 1];
++       std::strcpy(__tmp, __s);
++       _M_name_messages = __tmp;
++     }
++
++  template<typename _CharT>
++    typename messages<_CharT>::catalog
++    messages<_CharT>::open(const basic_string<char>& __s, const locale& __loc,
++			   const char* __dir) const
++    {
++      __bindtextdomain(__s.c_str(), __dir);
++      return this->do_open(__s, __loc);
++    }
++
++  // Virtual member functions.
++  template<typename _CharT>
++    messages<_CharT>::~messages()
++    {
++      if (_M_name_messages != _S_get_c_name())
++	delete [] _M_name_messages;
++      _S_destroy_c_locale(_M_c_locale_messages);
++    }
++
++  template<typename _CharT>
++    typename messages<_CharT>::catalog
++    messages<_CharT>::do_open(const basic_string<char>& __s,
++			      const locale&) const
++    {
++      // No error checking is done, assume the catalog exists and can
++      // be used.
++      __textdomain(__s.c_str());
++      return 0;
++    }
++
++  template<typename _CharT>
++    void
++    messages<_CharT>::do_close(catalog) const
++    { }
++
++   // messages_byname
++   template<typename _CharT>
++     messages_byname<_CharT>::messages_byname(const char* __s, size_t __refs)
++     : messages<_CharT>(__refs)
++     {
++       if (this->_M_name_messages != locale::facet::_S_get_c_name())
++	 delete [] this->_M_name_messages;
++       char* __tmp = new char[std::strlen(__s) + 1];
++       std::strcpy(__tmp, __s);
++       this->_M_name_messages = __tmp;
++
++       if (std::strcmp(__s, "C") != 0 && std::strcmp(__s, "POSIX") != 0)
++	 {
++	   this->_S_destroy_c_locale(this->_M_c_locale_messages);
++	   this->_S_create_c_locale(this->_M_c_locale_messages, __s);
++	 }
++     }
+diff --git a/libstdc++-v3/config/locale/uclibc/monetary_members.cc b/libstdc++-v3/config/locale/uclibc/monetary_members.cc
+new file mode 100644
+index 0000000..aa52731
+--- /dev/null
++++ b/libstdc++-v3/config/locale/uclibc/monetary_members.cc
+@@ -0,0 +1,692 @@
++// std::moneypunct implementation details, GNU version -*- C++ -*-
++
++// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
++//
++// This file is part of the GNU ISO C++ Library.  This library is free
++// software; you can redistribute it and/or modify it under the
++// terms of the GNU General Public License as published by the
++// Free Software Foundation; either version 2, or (at your option)
++// any later version.
++
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++// GNU General Public License for more details.
++
++// You should have received a copy of the GNU General Public License along
++// with this library; see the file COPYING.  If not, write to the Free
++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
++// USA.
++
++// As a special exception, you may use this file as part of a free software
++// library without restriction.  Specifically, if other files instantiate
++// templates or use macros or inline functions from this file, or you compile
++// this file and link it with other files to produce an executable, this
++// file does not by itself cause the resulting executable to be covered by
++// the GNU General Public License.  This exception does not however
++// invalidate any other reasons why the executable file might be covered by
++// the GNU General Public License.
++
++//
++// ISO C++ 14882: 22.2.6.3.2  moneypunct virtual functions
++//
++
++// Written by Benjamin Kosnik <bkoz at redhat.com>
++
++#define _LIBC
++#include <locale>
++#undef _LIBC
++#include <bits/c++locale_internal.h>
++
++#ifdef __UCLIBC_MJN3_ONLY__
++#warning optimize this for uclibc
++#warning tailor for stub locale support
++#endif
++
++#ifndef __UCLIBC_HAS_XLOCALE__
++#define __nl_langinfo_l(N, L)         nl_langinfo((N))
++#endif
++
++namespace std
++{
++  // Construct and return valid pattern consisting of some combination of:
++  // space none symbol sign value
++  money_base::pattern
++  money_base::_S_construct_pattern(char __precedes, char __space, char __posn)
++  {
++    pattern __ret;
++
++    // This insanely complicated routine attempts to construct a valid
++    // pattern for use with monyepunct. A couple of invariants:
++
++    // if (__precedes) symbol -> value
++    // else value -> symbol
++
++    // if (__space) space
++    // else none
++
++    // none == never first
++    // space never first or last
++
++    // Any elegant implementations of this are welcome.
++    switch (__posn)
++      {
++      case 0:
++      case 1:
++	// 1 The sign precedes the value and symbol.
++	__ret.field[0] = sign;
++	if (__space)
++	  {
++	    // Pattern starts with sign.
++	    if (__precedes)
++	      {
++		__ret.field[1] = symbol;
++		__ret.field[3] = value;
++	      }
++	    else
++	      {
++		__ret.field[1] = value;
++		__ret.field[3] = symbol;
++	      }
++	    __ret.field[2] = space;
++	  }
++	else
++	  {
++	    // Pattern starts with sign and ends with none.
++	    if (__precedes)
++	      {
++		__ret.field[1] = symbol;
++		__ret.field[2] = value;
++	      }
++	    else
++	      {
++		__ret.field[1] = value;
++		__ret.field[2] = symbol;
++	      }
++	    __ret.field[3] = none;
++	  }
++	break;
++      case 2:
++	// 2 The sign follows the value and symbol.
++	if (__space)
++	  {
++	    // Pattern either ends with sign.
++	    if (__precedes)
++	      {
++		__ret.field[0] = symbol;
++		__ret.field[2] = value;
++	      }
++	    else
++	      {
++		__ret.field[0] = value;
++		__ret.field[2] = symbol;
++	      }
++	    __ret.field[1] = space;
++	    __ret.field[3] = sign;
++	  }
++	else
++	  {
++	    // Pattern ends with sign then none.
++	    if (__precedes)
++	      {
++		__ret.field[0] = symbol;
++		__ret.field[1] = value;
++	      }
++	    else
++	      {
++		__ret.field[0] = value;
++		__ret.field[1] = symbol;
++	      }
++	    __ret.field[2] = sign;
++	    __ret.field[3] = none;
++	  }
++	break;
++      case 3:
++	// 3 The sign immediately precedes the symbol.
++	if (__precedes)
++	  {
++	    __ret.field[0] = sign;
++	    __ret.field[1] = symbol;
++	    if (__space)
++	      {
++		__ret.field[2] = space;
++		__ret.field[3] = value;
++	      }
++	    else
++	      {
++		__ret.field[2] = value;
++		__ret.field[3] = none;
++	      }
++	  }
++	else
++	  {
++	    __ret.field[0] = value;
++	    if (__space)
++	      {
++		__ret.field[1] = space;
++		__ret.field[2] = sign;
++		__ret.field[3] = symbol;
++	      }
++	    else
++	      {
++		__ret.field[1] = sign;
++		__ret.field[2] = symbol;
++		__ret.field[3] = none;
++	      }
++	  }
++	break;
++      case 4:
++	// 4 The sign immediately follows the symbol.
++	if (__precedes)
++	  {
++	    __ret.field[0] = symbol;
++	    __ret.field[1] = sign;
++	    if (__space)
++	      {
++		__ret.field[2] = space;
++		__ret.field[3] = value;
++	      }
++	    else
++	      {
++		__ret.field[2] = value;
++		__ret.field[3] = none;
++	      }
++	  }
++	else
++	  {
++	    __ret.field[0] = value;
++	    if (__space)
++	      {
++		__ret.field[1] = space;
++		__ret.field[2] = symbol;
++		__ret.field[3] = sign;
++	      }
++	    else
++	      {
++		__ret.field[1] = symbol;
++		__ret.field[2] = sign;
++		__ret.field[3] = none;
++	      }
++	  }
++	break;
++      default:
++	;
++      }
++    return __ret;
++  }
++
++  template<>
++    void
++    moneypunct<char, true>::_M_initialize_moneypunct(__c_locale __cloc,
++						     const char*)
++    {
++      if (!_M_data)
++	_M_data = new __moneypunct_cache<char, true>;
++
++      if (!__cloc)
++	{
++	  // "C" locale
++	  _M_data->_M_decimal_point = '.';
++	  _M_data->_M_thousands_sep = ',';
++	  _M_data->_M_grouping = "";
++	  _M_data->_M_grouping_size = 0;
++	  _M_data->_M_curr_symbol = "";
++	  _M_data->_M_curr_symbol_size = 0;
++	  _M_data->_M_positive_sign = "";
++	  _M_data->_M_positive_sign_size = 0;
++	  _M_data->_M_negative_sign = "";
++	  _M_data->_M_negative_sign_size = 0;
++	  _M_data->_M_frac_digits = 0;
++	  _M_data->_M_pos_format = money_base::_S_default_pattern;
++	  _M_data->_M_neg_format = money_base::_S_default_pattern;
++
++	  for (size_t __i = 0; __i < money_base::_S_end; ++__i)
++	    _M_data->_M_atoms[__i] = money_base::_S_atoms[__i];
++	}
++      else
++	{
++	  // Named locale.
++	  _M_data->_M_decimal_point = *(__nl_langinfo_l(__MON_DECIMAL_POINT,
++							__cloc));
++	  _M_data->_M_thousands_sep = *(__nl_langinfo_l(__MON_THOUSANDS_SEP,
++							__cloc));
++	  _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc);
++	  _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
++	  _M_data->_M_positive_sign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
++	  _M_data->_M_positive_sign_size = strlen(_M_data->_M_positive_sign);
++
++	  char __nposn = *(__nl_langinfo_l(__INT_N_SIGN_POSN, __cloc));
++	  if (!__nposn)
++	    _M_data->_M_negative_sign = "()";
++	  else
++	    _M_data->_M_negative_sign = __nl_langinfo_l(__NEGATIVE_SIGN,
++							__cloc);
++	  _M_data->_M_negative_sign_size = strlen(_M_data->_M_negative_sign);
++
++	  // _Intl == true
++	  _M_data->_M_curr_symbol = __nl_langinfo_l(__INT_CURR_SYMBOL, __cloc);
++	  _M_data->_M_curr_symbol_size = strlen(_M_data->_M_curr_symbol);
++	  _M_data->_M_frac_digits = *(__nl_langinfo_l(__INT_FRAC_DIGITS,
++						      __cloc));
++	  char __pprecedes = *(__nl_langinfo_l(__INT_P_CS_PRECEDES, __cloc));
++	  char __pspace = *(__nl_langinfo_l(__INT_P_SEP_BY_SPACE, __cloc));
++	  char __pposn = *(__nl_langinfo_l(__INT_P_SIGN_POSN, __cloc));
++	  _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace,
++							__pposn);
++	  char __nprecedes = *(__nl_langinfo_l(__INT_N_CS_PRECEDES, __cloc));
++	  char __nspace = *(__nl_langinfo_l(__INT_N_SEP_BY_SPACE, __cloc));
++	  _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace,
++							__nposn);
++	}
++    }
++
++  template<>
++    void
++    moneypunct<char, false>::_M_initialize_moneypunct(__c_locale __cloc,
++						      const char*)
++    {
++      if (!_M_data)
++	_M_data = new __moneypunct_cache<char, false>;
++
++      if (!__cloc)
++	{
++	  // "C" locale
++	  _M_data->_M_decimal_point = '.';
++	  _M_data->_M_thousands_sep = ',';
++	  _M_data->_M_grouping = "";
++	  _M_data->_M_grouping_size = 0;
++	  _M_data->_M_curr_symbol = "";
++	  _M_data->_M_curr_symbol_size = 0;
++	  _M_data->_M_positive_sign = "";
++	  _M_data->_M_positive_sign_size = 0;
++	  _M_data->_M_negative_sign = "";
++	  _M_data->_M_negative_sign_size = 0;
++	  _M_data->_M_frac_digits = 0;
++	  _M_data->_M_pos_format = money_base::_S_default_pattern;
++	  _M_data->_M_neg_format = money_base::_S_default_pattern;
++
++	  for (size_t __i = 0; __i < money_base::_S_end; ++__i)
++	    _M_data->_M_atoms[__i] = money_base::_S_atoms[__i];
++	}
++      else
++	{
++	  // Named locale.
++	  _M_data->_M_decimal_point = *(__nl_langinfo_l(__MON_DECIMAL_POINT,
++							__cloc));
++	  _M_data->_M_thousands_sep = *(__nl_langinfo_l(__MON_THOUSANDS_SEP,
++							__cloc));
++	  _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc);
++	  _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
++	  _M_data->_M_positive_sign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
++	  _M_data->_M_positive_sign_size = strlen(_M_data->_M_positive_sign);
++
++	  char __nposn = *(__nl_langinfo_l(__N_SIGN_POSN, __cloc));
++	  if (!__nposn)
++	    _M_data->_M_negative_sign = "()";
++	  else
++	    _M_data->_M_negative_sign = __nl_langinfo_l(__NEGATIVE_SIGN,
++							__cloc);
++	  _M_data->_M_negative_sign_size = strlen(_M_data->_M_negative_sign);
++
++	  // _Intl == false
++	  _M_data->_M_curr_symbol = __nl_langinfo_l(__CURRENCY_SYMBOL, __cloc);
++	  _M_data->_M_curr_symbol_size = strlen(_M_data->_M_curr_symbol);
++	  _M_data->_M_frac_digits = *(__nl_langinfo_l(__FRAC_DIGITS, __cloc));
++	  char __pprecedes = *(__nl_langinfo_l(__P_CS_PRECEDES, __cloc));
++	  char __pspace = *(__nl_langinfo_l(__P_SEP_BY_SPACE, __cloc));
++	  char __pposn = *(__nl_langinfo_l(__P_SIGN_POSN, __cloc));
++	  _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace,
++							__pposn);
++	  char __nprecedes = *(__nl_langinfo_l(__N_CS_PRECEDES, __cloc));
++	  char __nspace = *(__nl_langinfo_l(__N_SEP_BY_SPACE, __cloc));
++	  _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace,
++							__nposn);
++	}
++    }
++
++  template<>
++    moneypunct<char, true>::~moneypunct()
++    { delete _M_data; }
++
++  template<>
++    moneypunct<char, false>::~moneypunct()
++    { delete _M_data; }
++
++#ifdef _GLIBCXX_USE_WCHAR_T
++  template<>
++    void
++    moneypunct<wchar_t, true>::_M_initialize_moneypunct(__c_locale __cloc,
++#ifdef __UCLIBC_HAS_XLOCALE__
++							const char*)
++#else
++							const char* __name)
++#endif
++    {
++      if (!_M_data)
++	_M_data = new __moneypunct_cache<wchar_t, true>;
++
++      if (!__cloc)
++	{
++	  // "C" locale
++	  _M_data->_M_decimal_point = L'.';
++	  _M_data->_M_thousands_sep = L',';
++	  _M_data->_M_grouping = "";
++	  _M_data->_M_grouping_size = 0;
++	  _M_data->_M_curr_symbol = L"";
++	  _M_data->_M_curr_symbol_size = 0;
++	  _M_data->_M_positive_sign = L"";
++	  _M_data->_M_positive_sign_size = 0;
++	  _M_data->_M_negative_sign = L"";
++	  _M_data->_M_negative_sign_size = 0;
++	  _M_data->_M_frac_digits = 0;
++	  _M_data->_M_pos_format = money_base::_S_default_pattern;
++	  _M_data->_M_neg_format = money_base::_S_default_pattern;
++
++	  // Use ctype::widen code without the facet...
++	  for (size_t __i = 0; __i < money_base::_S_end; ++__i)
++	    _M_data->_M_atoms[__i] =
++	      static_cast<wchar_t>(money_base::_S_atoms[__i]);
++	}
++      else
++	{
++	  // Named locale.
++#ifdef __UCLIBC_HAS_XLOCALE__
++	  __c_locale __old = __uselocale(__cloc);
++#else
++	  // Switch to named locale so that mbsrtowcs will work.
++	  char* __old = strdup(setlocale(LC_ALL, NULL));
++	  setlocale(LC_ALL, __name);
++#endif
++
++#ifdef __UCLIBC_MJN3_ONLY__
++#warning fix this... should be monetary
++#endif
++#ifdef __UCLIBC__
++# ifdef __UCLIBC_HAS_XLOCALE__
++	  _M_data->_M_decimal_point = __cloc->decimal_point_wc;
++	  _M_data->_M_thousands_sep = __cloc->thousands_sep_wc;
++# else
++	  _M_data->_M_decimal_point = __global_locale->decimal_point_wc;
++	  _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc;
++# endif
++#else
++	  union { char *__s; wchar_t __w; } __u;
++	  __u.__s = __nl_langinfo_l(_NL_MONETARY_DECIMAL_POINT_WC, __cloc);
++	  _M_data->_M_decimal_point = __u.__w;
++
++	  __u.__s = __nl_langinfo_l(_NL_MONETARY_THOUSANDS_SEP_WC, __cloc);
++	  _M_data->_M_thousands_sep = __u.__w;
++#endif
++	  _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc);
++	  _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
++
++	  const char* __cpossign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
++	  const char* __cnegsign = __nl_langinfo_l(__NEGATIVE_SIGN, __cloc);
++	  const char* __ccurr = __nl_langinfo_l(__INT_CURR_SYMBOL, __cloc);
++
++	  wchar_t* __wcs_ps = 0;
++	  wchar_t* __wcs_ns = 0;
++	  const char __nposn = *(__nl_langinfo_l(__INT_N_SIGN_POSN, __cloc));
++	  try
++	    {
++	      mbstate_t __state;
++	      size_t __len = strlen(__cpossign);
++	      if (__len)
++		{
++		  ++__len;
++		  memset(&__state, 0, sizeof(mbstate_t));
++		  __wcs_ps = new wchar_t[__len];
++		  mbsrtowcs(__wcs_ps, &__cpossign, __len, &__state);
++		  _M_data->_M_positive_sign = __wcs_ps;
++		}
++	      else
++		_M_data->_M_positive_sign = L"";
++	      _M_data->_M_positive_sign_size = wcslen(_M_data->_M_positive_sign);
++
++	      __len = strlen(__cnegsign);
++	      if (!__nposn)
++		_M_data->_M_negative_sign = L"()";
++	      else if (__len)
++		{
++		  ++__len;
++		  memset(&__state, 0, sizeof(mbstate_t));
++		  __wcs_ns = new wchar_t[__len];
++		  mbsrtowcs(__wcs_ns, &__cnegsign, __len, &__state);
++		  _M_data->_M_negative_sign = __wcs_ns;
++		}
++	      else
++		_M_data->_M_negative_sign = L"";
++	      _M_data->_M_negative_sign_size = wcslen(_M_data->_M_negative_sign);
++
++	      // _Intl == true.
++	      __len = strlen(__ccurr);
++	      if (__len)
++		{
++		  ++__len;
++		  memset(&__state, 0, sizeof(mbstate_t));
++		  wchar_t* __wcs = new wchar_t[__len];
++		  mbsrtowcs(__wcs, &__ccurr, __len, &__state);
++		  _M_data->_M_curr_symbol = __wcs;
++		}
++	      else
++		_M_data->_M_curr_symbol = L"";
++	      _M_data->_M_curr_symbol_size = wcslen(_M_data->_M_curr_symbol);
++	    }
++	  catch (...)
++	    {
++	      delete _M_data;
++	      _M_data = 0;
++	      delete __wcs_ps;
++	      delete __wcs_ns;
++#ifdef __UCLIBC_HAS_XLOCALE__
++	      __uselocale(__old);
++#else
++	      setlocale(LC_ALL, __old);
++	      free(__old);
++#endif
++	      __throw_exception_again;
++	    }
++
++	  _M_data->_M_frac_digits = *(__nl_langinfo_l(__INT_FRAC_DIGITS,
++						      __cloc));
++	  char __pprecedes = *(__nl_langinfo_l(__INT_P_CS_PRECEDES, __cloc));
++	  char __pspace = *(__nl_langinfo_l(__INT_P_SEP_BY_SPACE, __cloc));
++	  char __pposn = *(__nl_langinfo_l(__INT_P_SIGN_POSN, __cloc));
++	  _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace,
++							__pposn);
++	  char __nprecedes = *(__nl_langinfo_l(__INT_N_CS_PRECEDES, __cloc));
++	  char __nspace = *(__nl_langinfo_l(__INT_N_SEP_BY_SPACE, __cloc));
++	  _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace,
++							__nposn);
++
++#ifdef __UCLIBC_HAS_XLOCALE__
++	  __uselocale(__old);
++#else
++	  setlocale(LC_ALL, __old);
++	  free(__old);
++#endif
++	}
++    }
++
++  template<>
++  void
++  moneypunct<wchar_t, false>::_M_initialize_moneypunct(__c_locale __cloc,
++#ifdef __UCLIBC_HAS_XLOCALE__
++						       const char*)
++#else
++                                                       const char* __name)
++#endif
++  {
++    if (!_M_data)
++      _M_data = new __moneypunct_cache<wchar_t, false>;
++
++    if (!__cloc)
++	{
++	  // "C" locale
++	  _M_data->_M_decimal_point = L'.';
++	  _M_data->_M_thousands_sep = L',';
++	  _M_data->_M_grouping = "";
++          _M_data->_M_grouping_size = 0;
++	  _M_data->_M_curr_symbol = L"";
++	  _M_data->_M_curr_symbol_size = 0;
++	  _M_data->_M_positive_sign = L"";
++	  _M_data->_M_positive_sign_size = 0;
++	  _M_data->_M_negative_sign = L"";
++	  _M_data->_M_negative_sign_size = 0;
++	  _M_data->_M_frac_digits = 0;
++	  _M_data->_M_pos_format = money_base::_S_default_pattern;
++	  _M_data->_M_neg_format = money_base::_S_default_pattern;
++
++	  // Use ctype::widen code without the facet...
++	  for (size_t __i = 0; __i < money_base::_S_end; ++__i)
++	    _M_data->_M_atoms[__i] =
++	      static_cast<wchar_t>(money_base::_S_atoms[__i]);
++	}
++      else
++	{
++	  // Named locale.
++#ifdef __UCLIBC_HAS_XLOCALE__
++	  __c_locale __old = __uselocale(__cloc);
++#else
++	  // Switch to named locale so that mbsrtowcs will work.
++	  char* __old = strdup(setlocale(LC_ALL, NULL));
++	  setlocale(LC_ALL, __name);
++#endif
++
++#ifdef __UCLIBC_MJN3_ONLY__
++#warning fix this... should be monetary
++#endif
++#ifdef __UCLIBC__
++# ifdef __UCLIBC_HAS_XLOCALE__
++	  _M_data->_M_decimal_point = __cloc->decimal_point_wc;
++	  _M_data->_M_thousands_sep = __cloc->thousands_sep_wc;
++# else
++	  _M_data->_M_decimal_point = __global_locale->decimal_point_wc;
++	  _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc;
++# endif
++#else
++          union { char *__s; wchar_t __w; } __u;
++	  __u.__s = __nl_langinfo_l(_NL_MONETARY_DECIMAL_POINT_WC, __cloc);
++	  _M_data->_M_decimal_point = __u.__w;
++
++	  __u.__s = __nl_langinfo_l(_NL_MONETARY_THOUSANDS_SEP_WC, __cloc);
++	  _M_data->_M_thousands_sep = __u.__w;
++#endif
++	  _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc);
++          _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
++
++	  const char* __cpossign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
++	  const char* __cnegsign = __nl_langinfo_l(__NEGATIVE_SIGN, __cloc);
++	  const char* __ccurr = __nl_langinfo_l(__CURRENCY_SYMBOL, __cloc);
++
++	  wchar_t* __wcs_ps = 0;
++	  wchar_t* __wcs_ns = 0;
++	  const char __nposn = *(__nl_langinfo_l(__N_SIGN_POSN, __cloc));
++	  try
++            {
++              mbstate_t __state;
++              size_t __len;
++              __len = strlen(__cpossign);
++              if (__len)
++                {
++		  ++__len;
++		  memset(&__state, 0, sizeof(mbstate_t));
++		  __wcs_ps = new wchar_t[__len];
++		  mbsrtowcs(__wcs_ps, &__cpossign, __len, &__state);
++		  _M_data->_M_positive_sign = __wcs_ps;
++		}
++	      else
++		_M_data->_M_positive_sign = L"";
++              _M_data->_M_positive_sign_size = wcslen(_M_data->_M_positive_sign);
++
++	      __len = strlen(__cnegsign);
++	      if (!__nposn)
++		_M_data->_M_negative_sign = L"()";
++	      else if (__len)
++		{
++		  ++__len;
++		  memset(&__state, 0, sizeof(mbstate_t));
++		  __wcs_ns = new wchar_t[__len];
++		  mbsrtowcs(__wcs_ns, &__cnegsign, __len, &__state);
++		  _M_data->_M_negative_sign = __wcs_ns;
++		}
++	      else
++		_M_data->_M_negative_sign = L"";
++              _M_data->_M_negative_sign_size = wcslen(_M_data->_M_negative_sign);
++
++	      // _Intl == true.
++	      __len = strlen(__ccurr);
++	      if (__len)
++		{
++		  ++__len;
++		  memset(&__state, 0, sizeof(mbstate_t));
++		  wchar_t* __wcs = new wchar_t[__len];
++		  mbsrtowcs(__wcs, &__ccurr, __len, &__state);
++		  _M_data->_M_curr_symbol = __wcs;
++		}
++	      else
++		_M_data->_M_curr_symbol = L"";
++              _M_data->_M_curr_symbol_size = wcslen(_M_data->_M_curr_symbol);
++	    }
++          catch (...)
++	    {
++	      delete _M_data;
++              _M_data = 0;
++	      delete __wcs_ps;
++	      delete __wcs_ns;
++#ifdef __UCLIBC_HAS_XLOCALE__
++	      __uselocale(__old);
++#else
++	      setlocale(LC_ALL, __old);
++	      free(__old);
++#endif
++              __throw_exception_again;
++	    }
++
++	  _M_data->_M_frac_digits = *(__nl_langinfo_l(__FRAC_DIGITS, __cloc));
++	  char __pprecedes = *(__nl_langinfo_l(__P_CS_PRECEDES, __cloc));
++	  char __pspace = *(__nl_langinfo_l(__P_SEP_BY_SPACE, __cloc));
++	  char __pposn = *(__nl_langinfo_l(__P_SIGN_POSN, __cloc));
++	  _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace,
++	                                                __pposn);
++	  char __nprecedes = *(__nl_langinfo_l(__N_CS_PRECEDES, __cloc));
++	  char __nspace = *(__nl_langinfo_l(__N_SEP_BY_SPACE, __cloc));
++	  _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace,
++	                                                __nposn);
++
++#ifdef __UCLIBC_HAS_XLOCALE__
++	  __uselocale(__old);
++#else
++	  setlocale(LC_ALL, __old);
++	  free(__old);
++#endif
++	}
++    }
++
++  template<>
++    moneypunct<wchar_t, true>::~moneypunct()
++    {
++      if (_M_data->_M_positive_sign_size)
++	delete [] _M_data->_M_positive_sign;
++      if (_M_data->_M_negative_sign_size
++          && wcscmp(_M_data->_M_negative_sign, L"()") != 0)
++	delete [] _M_data->_M_negative_sign;
++      if (_M_data->_M_curr_symbol_size)
++	delete [] _M_data->_M_curr_symbol;
++      delete _M_data;
++    }
++
++  template<>
++    moneypunct<wchar_t, false>::~moneypunct()
++    {
++      if (_M_data->_M_positive_sign_size)
++	delete [] _M_data->_M_positive_sign;
++      if (_M_data->_M_negative_sign_size
++          && wcscmp(_M_data->_M_negative_sign, L"()") != 0)
++	delete [] _M_data->_M_negative_sign;
++      if (_M_data->_M_curr_symbol_size)
++	delete [] _M_data->_M_curr_symbol;
++      delete _M_data;
++    }
++#endif
++}
+diff --git a/libstdc++-v3/config/locale/uclibc/numeric_members.cc b/libstdc++-v3/config/locale/uclibc/numeric_members.cc
+new file mode 100644
+index 0000000..883ec1a
+--- /dev/null
++++ b/libstdc++-v3/config/locale/uclibc/numeric_members.cc
+@@ -0,0 +1,160 @@
++// std::numpunct implementation details, GNU version -*- C++ -*-
++
++// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
++//
++// This file is part of the GNU ISO C++ Library.  This library is free
++// software; you can redistribute it and/or modify it under the
++// terms of the GNU General Public License as published by the
++// Free Software Foundation; either version 2, or (at your option)
++// any later version.
++
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++// GNU General Public License for more details.
++
++// You should have received a copy of the GNU General Public License along
++// with this library; see the file COPYING.  If not, write to the Free
++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
++// USA.
++
++// As a special exception, you may use this file as part of a free software
++// library without restriction.  Specifically, if other files instantiate
++// templates or use macros or inline functions from this file, or you compile
++// this file and link it with other files to produce an executable, this
++// file does not by itself cause the resulting executable to be covered by
++// the GNU General Public License.  This exception does not however
++// invalidate any other reasons why the executable file might be covered by
++// the GNU General Public License.
++
++//
++// ISO C++ 14882: 22.2.3.1.2  numpunct virtual functions
++//
++
++// Written by Benjamin Kosnik <bkoz at redhat.com>
++
++#define _LIBC
++#include <locale>
++#undef _LIBC
++#include <bits/c++locale_internal.h>
++
++#ifdef __UCLIBC_MJN3_ONLY__
++#warning tailor for stub locale support
++#endif
++#ifndef __UCLIBC_HAS_XLOCALE__
++#define __nl_langinfo_l(N, L)         nl_langinfo((N))
++#endif
++
++namespace std
++{
++  template<>
++    void
++    numpunct<char>::_M_initialize_numpunct(__c_locale __cloc)
++    {
++      if (!_M_data)
++	_M_data = new __numpunct_cache<char>;
++
++      if (!__cloc)
++	{
++	  // "C" locale
++	  _M_data->_M_grouping = "";
++	  _M_data->_M_grouping_size = 0;
++	  _M_data->_M_use_grouping = false;
++
++	  _M_data->_M_decimal_point = '.';
++	  _M_data->_M_thousands_sep = ',';
++
++	  for (size_t __i = 0; __i < __num_base::_S_oend; ++__i)
++	    _M_data->_M_atoms_out[__i] = __num_base::_S_atoms_out[__i];
++
++	  for (size_t __j = 0; __j < __num_base::_S_iend; ++__j)
++	    _M_data->_M_atoms_in[__j] = __num_base::_S_atoms_in[__j];
++	}
++      else
++	{
++	  // Named locale.
++	  _M_data->_M_decimal_point = *(__nl_langinfo_l(DECIMAL_POINT,
++							__cloc));
++	  _M_data->_M_thousands_sep = *(__nl_langinfo_l(THOUSANDS_SEP,
++							__cloc));
++
++	  // Check for NULL, which implies no grouping.
++	  if (_M_data->_M_thousands_sep == '\0')
++	    _M_data->_M_grouping = "";
++	  else
++	    _M_data->_M_grouping = __nl_langinfo_l(GROUPING, __cloc);
++	  _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
++	}
++
++      // NB: There is no way to extact this info from posix locales.
++      // _M_truename = __nl_langinfo_l(YESSTR, __cloc);
++      _M_data->_M_truename = "true";
++      _M_data->_M_truename_size = 4;
++      // _M_falsename = __nl_langinfo_l(NOSTR, __cloc);
++      _M_data->_M_falsename = "false";
++      _M_data->_M_falsename_size = 5;
++    }
++
++  template<>
++    numpunct<char>::~numpunct()
++    { delete _M_data; }
++
++#ifdef _GLIBCXX_USE_WCHAR_T
++  template<>
++    void
++    numpunct<wchar_t>::_M_initialize_numpunct(__c_locale __cloc)
++    {
++      if (!_M_data)
++	_M_data = new __numpunct_cache<wchar_t>;
++
++      if (!__cloc)
++	{
++	  // "C" locale
++	  _M_data->_M_grouping = "";
++	  _M_data->_M_grouping_size = 0;
++	  _M_data->_M_use_grouping = false;
++
++	  _M_data->_M_decimal_point = L'.';
++	  _M_data->_M_thousands_sep = L',';
++
++	  // Use ctype::widen code without the facet...
++	  for (size_t __i = 0; __i < __num_base::_S_oend; ++__i)
++	    _M_data->_M_atoms_out[__i] =
++	      static_cast<wchar_t>(__num_base::_S_atoms_out[__i]);
++
++	  for (size_t __j = 0; __j < __num_base::_S_iend; ++__j)
++	    _M_data->_M_atoms_in[__j] =
++	      static_cast<wchar_t>(__num_base::_S_atoms_in[__j]);
++	}
++      else
++	{
++	  // Named locale.
++	  // NB: In the GNU model wchar_t is always 32 bit wide.
++	  union { char *__s; wchar_t __w; } __u;
++	  __u.__s = __nl_langinfo_l(_NL_NUMERIC_DECIMAL_POINT_WC, __cloc);
++	  _M_data->_M_decimal_point = __u.__w;
++
++	  __u.__s = __nl_langinfo_l(_NL_NUMERIC_THOUSANDS_SEP_WC, __cloc);
++	  _M_data->_M_thousands_sep = __u.__w;
++
++	  if (_M_data->_M_thousands_sep == L'\0')
++	    _M_data->_M_grouping = "";
++	  else
++	    _M_data->_M_grouping = __nl_langinfo_l(GROUPING, __cloc);
++	  _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
++	}
++
++      // NB: There is no way to extact this info from posix locales.
++      // _M_truename = __nl_langinfo_l(YESSTR, __cloc);
++      _M_data->_M_truename = L"true";
++      _M_data->_M_truename_size = 4;
++      // _M_falsename = __nl_langinfo_l(NOSTR, __cloc);
++      _M_data->_M_falsename = L"false";
++      _M_data->_M_falsename_size = 5;
++    }
++
++  template<>
++    numpunct<wchar_t>::~numpunct()
++    { delete _M_data; }
++ #endif
++}
+diff --git a/libstdc++-v3/config/locale/uclibc/time_members.cc b/libstdc++-v3/config/locale/uclibc/time_members.cc
+new file mode 100644
+index 0000000..e0707d7
+--- /dev/null
++++ b/libstdc++-v3/config/locale/uclibc/time_members.cc
+@@ -0,0 +1,406 @@
++// std::time_get, std::time_put implementation, GNU version -*- C++ -*-
++
++// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
++//
++// This file is part of the GNU ISO C++ Library.  This library is free
++// software; you can redistribute it and/or modify it under the
++// terms of the GNU General Public License as published by the
++// Free Software Foundation; either version 2, or (at your option)
++// any later version.
++
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++// GNU General Public License for more details.
++
++// You should have received a copy of the GNU General Public License along
++// with this library; see the file COPYING.  If not, write to the Free
++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
++// USA.
++
++// As a special exception, you may use this file as part of a free software
++// library without restriction.  Specifically, if other files instantiate
++// templates or use macros or inline functions from this file, or you compile
++// this file and link it with other files to produce an executable, this
++// file does not by itself cause the resulting executable to be covered by
++// the GNU General Public License.  This exception does not however
++// invalidate any other reasons why the executable file might be covered by
++// the GNU General Public License.
++
++//
++// ISO C++ 14882: 22.2.5.1.2 - time_get virtual functions
++// ISO C++ 14882: 22.2.5.3.2 - time_put virtual functions
++//
++
++// Written by Benjamin Kosnik <bkoz at redhat.com>
++
++#include <locale>
++#include <bits/c++locale_internal.h>
++
++#ifdef __UCLIBC_MJN3_ONLY__
++#warning tailor for stub locale support
++#endif
++#ifndef __UCLIBC_HAS_XLOCALE__
++#define __nl_langinfo_l(N, L)         nl_langinfo((N))
++#endif
++
++namespace std
++{
++  template<>
++    void
++    __timepunct<char>::
++    _M_put(char* __s, size_t __maxlen, const char* __format,
++	   const tm* __tm) const
++    {
++#ifdef __UCLIBC_HAS_XLOCALE__
++      const size_t __len = __strftime_l(__s, __maxlen, __format, __tm,
++					_M_c_locale_timepunct);
++#else
++      char* __old = strdup(setlocale(LC_ALL, NULL));
++      setlocale(LC_ALL, _M_name_timepunct);
++      const size_t __len = strftime(__s, __maxlen, __format, __tm);
++      setlocale(LC_ALL, __old);
++      free(__old);
++#endif
++      // Make sure __s is null terminated.
++      if (__len == 0)
++	__s[0] = '\0';
++    }
++
++  template<>
++    void
++    __timepunct<char>::_M_initialize_timepunct(__c_locale __cloc)
++    {
++      if (!_M_data)
++	_M_data = new __timepunct_cache<char>;
++
++      if (!__cloc)
++	{
++	  // "C" locale
++	  _M_c_locale_timepunct = _S_get_c_locale();
++
++	  _M_data->_M_date_format = "%m/%d/%y";
++	  _M_data->_M_date_era_format = "%m/%d/%y";
++	  _M_data->_M_time_format = "%H:%M:%S";
++	  _M_data->_M_time_era_format = "%H:%M:%S";
++	  _M_data->_M_date_time_format = "";
++	  _M_data->_M_date_time_era_format = "";
++	  _M_data->_M_am = "AM";
++	  _M_data->_M_pm = "PM";
++	  _M_data->_M_am_pm_format = "";
++
++	  // Day names, starting with "C"'s Sunday.
++	  _M_data->_M_day1 = "Sunday";
++	  _M_data->_M_day2 = "Monday";
++	  _M_data->_M_day3 = "Tuesday";
++	  _M_data->_M_day4 = "Wednesday";
++	  _M_data->_M_day5 = "Thursday";
++	  _M_data->_M_day6 = "Friday";
++	  _M_data->_M_day7 = "Saturday";
++
++	  // Abbreviated day names, starting with "C"'s Sun.
++	  _M_data->_M_aday1 = "Sun";
++	  _M_data->_M_aday2 = "Mon";
++	  _M_data->_M_aday3 = "Tue";
++	  _M_data->_M_aday4 = "Wed";
++	  _M_data->_M_aday5 = "Thu";
++	  _M_data->_M_aday6 = "Fri";
++	  _M_data->_M_aday7 = "Sat";
++
++	  // Month names, starting with "C"'s January.
++	  _M_data->_M_month01 = "January";
++	  _M_data->_M_month02 = "February";
++	  _M_data->_M_month03 = "March";
++	  _M_data->_M_month04 = "April";
++	  _M_data->_M_month05 = "May";
++	  _M_data->_M_month06 = "June";
++	  _M_data->_M_month07 = "July";
++	  _M_data->_M_month08 = "August";
++	  _M_data->_M_month09 = "September";
++	  _M_data->_M_month10 = "October";
++	  _M_data->_M_month11 = "November";
++	  _M_data->_M_month12 = "December";
++
++	  // Abbreviated month names, starting with "C"'s Jan.
++	  _M_data->_M_amonth01 = "Jan";
++	  _M_data->_M_amonth02 = "Feb";
++	  _M_data->_M_amonth03 = "Mar";
++	  _M_data->_M_amonth04 = "Apr";
++	  _M_data->_M_amonth05 = "May";
++	  _M_data->_M_amonth06 = "Jun";
++	  _M_data->_M_amonth07 = "Jul";
++	  _M_data->_M_amonth08 = "Aug";
++	  _M_data->_M_amonth09 = "Sep";
++	  _M_data->_M_amonth10 = "Oct";
++	  _M_data->_M_amonth11 = "Nov";
++	  _M_data->_M_amonth12 = "Dec";
++	}
++      else
++	{
++	  _M_c_locale_timepunct = _S_clone_c_locale(__cloc);
++
++	  _M_data->_M_date_format = __nl_langinfo_l(D_FMT, __cloc);
++	  _M_data->_M_date_era_format = __nl_langinfo_l(ERA_D_FMT, __cloc);
++	  _M_data->_M_time_format = __nl_langinfo_l(T_FMT, __cloc);
++	  _M_data->_M_time_era_format = __nl_langinfo_l(ERA_T_FMT, __cloc);
++	  _M_data->_M_date_time_format = __nl_langinfo_l(D_T_FMT, __cloc);
++	  _M_data->_M_date_time_era_format = __nl_langinfo_l(ERA_D_T_FMT,
++							     __cloc);
++	  _M_data->_M_am = __nl_langinfo_l(AM_STR, __cloc);
++	  _M_data->_M_pm = __nl_langinfo_l(PM_STR, __cloc);
++	  _M_data->_M_am_pm_format = __nl_langinfo_l(T_FMT_AMPM, __cloc);
++
++	  // Day names, starting with "C"'s Sunday.
++	  _M_data->_M_day1 = __nl_langinfo_l(DAY_1, __cloc);
++	  _M_data->_M_day2 = __nl_langinfo_l(DAY_2, __cloc);
++	  _M_data->_M_day3 = __nl_langinfo_l(DAY_3, __cloc);
++	  _M_data->_M_day4 = __nl_langinfo_l(DAY_4, __cloc);
++	  _M_data->_M_day5 = __nl_langinfo_l(DAY_5, __cloc);
++	  _M_data->_M_day6 = __nl_langinfo_l(DAY_6, __cloc);
++	  _M_data->_M_day7 = __nl_langinfo_l(DAY_7, __cloc);
++
++	  // Abbreviated day names, starting with "C"'s Sun.
++	  _M_data->_M_aday1 = __nl_langinfo_l(ABDAY_1, __cloc);
++	  _M_data->_M_aday2 = __nl_langinfo_l(ABDAY_2, __cloc);
++	  _M_data->_M_aday3 = __nl_langinfo_l(ABDAY_3, __cloc);
++	  _M_data->_M_aday4 = __nl_langinfo_l(ABDAY_4, __cloc);
++	  _M_data->_M_aday5 = __nl_langinfo_l(ABDAY_5, __cloc);
++	  _M_data->_M_aday6 = __nl_langinfo_l(ABDAY_6, __cloc);
++	  _M_data->_M_aday7 = __nl_langinfo_l(ABDAY_7, __cloc);
++
++	  // Month names, starting with "C"'s January.
++	  _M_data->_M_month01 = __nl_langinfo_l(MON_1, __cloc);
++	  _M_data->_M_month02 = __nl_langinfo_l(MON_2, __cloc);
++	  _M_data->_M_month03 = __nl_langinfo_l(MON_3, __cloc);
++	  _M_data->_M_month04 = __nl_langinfo_l(MON_4, __cloc);
++	  _M_data->_M_month05 = __nl_langinfo_l(MON_5, __cloc);
++	  _M_data->_M_month06 = __nl_langinfo_l(MON_6, __cloc);
++	  _M_data->_M_month07 = __nl_langinfo_l(MON_7, __cloc);
++	  _M_data->_M_month08 = __nl_langinfo_l(MON_8, __cloc);
++	  _M_data->_M_month09 = __nl_langinfo_l(MON_9, __cloc);
++	  _M_data->_M_month10 = __nl_langinfo_l(MON_10, __cloc);
++	  _M_data->_M_month11 = __nl_langinfo_l(MON_11, __cloc);
++	  _M_data->_M_month12 = __nl_langinfo_l(MON_12, __cloc);
++
++	  // Abbreviated month names, starting with "C"'s Jan.
++	  _M_data->_M_amonth01 = __nl_langinfo_l(ABMON_1, __cloc);
++	  _M_data->_M_amonth02 = __nl_langinfo_l(ABMON_2, __cloc);
++	  _M_data->_M_amonth03 = __nl_langinfo_l(ABMON_3, __cloc);
++	  _M_data->_M_amonth04 = __nl_langinfo_l(ABMON_4, __cloc);
++	  _M_data->_M_amonth05 = __nl_langinfo_l(ABMON_5, __cloc);
++	  _M_data->_M_amonth06 = __nl_langinfo_l(ABMON_6, __cloc);
++	  _M_data->_M_amonth07 = __nl_langinfo_l(ABMON_7, __cloc);
++	  _M_data->_M_amonth08 = __nl_langinfo_l(ABMON_8, __cloc);
++	  _M_data->_M_amonth09 = __nl_langinfo_l(ABMON_9, __cloc);
++	  _M_data->_M_amonth10 = __nl_langinfo_l(ABMON_10, __cloc);
++	  _M_data->_M_amonth11 = __nl_langinfo_l(ABMON_11, __cloc);
++	  _M_data->_M_amonth12 = __nl_langinfo_l(ABMON_12, __cloc);
++	}
++    }
++
++#ifdef _GLIBCXX_USE_WCHAR_T
++  template<>
++    void
++    __timepunct<wchar_t>::
++    _M_put(wchar_t* __s, size_t __maxlen, const wchar_t* __format,
++	   const tm* __tm) const
++    {
++#ifdef __UCLIBC_HAS_XLOCALE__
++      __wcsftime_l(__s, __maxlen, __format, __tm, _M_c_locale_timepunct);
++      const size_t __len = __wcsftime_l(__s, __maxlen, __format, __tm,
++					_M_c_locale_timepunct);
++#else
++      char* __old = strdup(setlocale(LC_ALL, NULL));
++      setlocale(LC_ALL, _M_name_timepunct);
++      const size_t __len = wcsftime(__s, __maxlen, __format, __tm);
++      setlocale(LC_ALL, __old);
++      free(__old);
++#endif
++      // Make sure __s is null terminated.
++      if (__len == 0)
++	__s[0] = L'\0';
++    }
++
++  template<>
++    void
++    __timepunct<wchar_t>::_M_initialize_timepunct(__c_locale __cloc)
++    {
++      if (!_M_data)
++	_M_data = new __timepunct_cache<wchar_t>;
++
++#warning wide time stuff
++//       if (!__cloc)
++	{
++	  // "C" locale
++	  _M_c_locale_timepunct = _S_get_c_locale();
++
++	  _M_data->_M_date_format = L"%m/%d/%y";
++	  _M_data->_M_date_era_format = L"%m/%d/%y";
++	  _M_data->_M_time_format = L"%H:%M:%S";
++	  _M_data->_M_time_era_format = L"%H:%M:%S";
++	  _M_data->_M_date_time_format = L"";
++	  _M_data->_M_date_time_era_format = L"";
++	  _M_data->_M_am = L"AM";
++	  _M_data->_M_pm = L"PM";
++	  _M_data->_M_am_pm_format = L"";
++
++	  // Day names, starting with "C"'s Sunday.
++	  _M_data->_M_day1 = L"Sunday";
++	  _M_data->_M_day2 = L"Monday";
++	  _M_data->_M_day3 = L"Tuesday";
++	  _M_data->_M_day4 = L"Wednesday";
++	  _M_data->_M_day5 = L"Thursday";
++	  _M_data->_M_day6 = L"Friday";
++	  _M_data->_M_day7 = L"Saturday";
++
++	  // Abbreviated day names, starting with "C"'s Sun.
++	  _M_data->_M_aday1 = L"Sun";
++	  _M_data->_M_aday2 = L"Mon";
++	  _M_data->_M_aday3 = L"Tue";
++	  _M_data->_M_aday4 = L"Wed";
++	  _M_data->_M_aday5 = L"Thu";
++	  _M_data->_M_aday6 = L"Fri";
++	  _M_data->_M_aday7 = L"Sat";
++
++	  // Month names, starting with "C"'s January.
++	  _M_data->_M_month01 = L"January";
++	  _M_data->_M_month02 = L"February";
++	  _M_data->_M_month03 = L"March";
++	  _M_data->_M_month04 = L"April";
++	  _M_data->_M_month05 = L"May";
++	  _M_data->_M_month06 = L"June";
++	  _M_data->_M_month07 = L"July";
++	  _M_data->_M_month08 = L"August";
++	  _M_data->_M_month09 = L"September";
++	  _M_data->_M_month10 = L"October";
++	  _M_data->_M_month11 = L"November";
++	  _M_data->_M_month12 = L"December";
++
++	  // Abbreviated month names, starting with "C"'s Jan.
++	  _M_data->_M_amonth01 = L"Jan";
++	  _M_data->_M_amonth02 = L"Feb";
++	  _M_data->_M_amonth03 = L"Mar";
++	  _M_data->_M_amonth04 = L"Apr";
++	  _M_data->_M_amonth05 = L"May";
++	  _M_data->_M_amonth06 = L"Jun";
++	  _M_data->_M_amonth07 = L"Jul";
++	  _M_data->_M_amonth08 = L"Aug";
++	  _M_data->_M_amonth09 = L"Sep";
++	  _M_data->_M_amonth10 = L"Oct";
++	  _M_data->_M_amonth11 = L"Nov";
++	  _M_data->_M_amonth12 = L"Dec";
++	}
++#if 0
++      else
++	{
++	  _M_c_locale_timepunct = _S_clone_c_locale(__cloc);
++
++	  union { char *__s; wchar_t *__w; } __u;
++
++	  __u.__s = __nl_langinfo_l(_NL_WD_FMT, __cloc);
++	  _M_data->_M_date_format = __u.__w;
++	  __u.__s = __nl_langinfo_l(_NL_WERA_D_FMT, __cloc);
++	  _M_data->_M_date_era_format = __u.__w;
++	  __u.__s = __nl_langinfo_l(_NL_WT_FMT, __cloc);
++	  _M_data->_M_time_format = __u.__w;
++	  __u.__s = __nl_langinfo_l(_NL_WERA_T_FMT, __cloc);
++	  _M_data->_M_time_era_format = __u.__w;
++	  __u.__s = __nl_langinfo_l(_NL_WD_T_FMT, __cloc);
++	  _M_data->_M_date_time_format = __u.__w;
++	  __u.__s = __nl_langinfo_l(_NL_WERA_D_T_FMT, __cloc);
++	  _M_data->_M_date_time_era_format = __u.__w;
++	  __u.__s = __nl_langinfo_l(_NL_WAM_STR, __cloc);
++	  _M_data->_M_am = __u.__w;
++	  __u.__s = __nl_langinfo_l(_NL_WPM_STR, __cloc);
++	  _M_data->_M_pm = __u.__w;
++	  __u.__s = __nl_langinfo_l(_NL_WT_FMT_AMPM, __cloc);
++	  _M_data->_M_am_pm_format = __u.__w;
++
++	  // Day names, starting with "C"'s Sunday.
++	  __u.__s = __nl_langinfo_l(_NL_WDAY_1, __cloc);
++	  _M_data->_M_day1 = __u.__w;
++	  __u.__s = __nl_langinfo_l(_NL_WDAY_2, __cloc);
++	  _M_data->_M_day2 = __u.__w;
++	  __u.__s = __nl_langinfo_l(_NL_WDAY_3, __cloc);
++	  _M_data->_M_day3 = __u.__w;
++	  __u.__s = __nl_langinfo_l(_NL_WDAY_4, __cloc);
++	  _M_data->_M_day4 = __u.__w;
++	  __u.__s = __nl_langinfo_l(_NL_WDAY_5, __cloc);
++	  _M_data->_M_day5 = __u.__w;
++	  __u.__s = __nl_langinfo_l(_NL_WDAY_6, __cloc);
++	  _M_data->_M_day6 = __u.__w;
++	  __u.__s = __nl_langinfo_l(_NL_WDAY_7, __cloc);
++	  _M_data->_M_day7 = __u.__w;
++
++	  // Abbreviated day names, starting with "C"'s Sun.
++	  __u.__s = __nl_langinfo_l(_NL_WABDAY_1, __cloc);
++	  _M_data->_M_aday1 = __u.__w;
++	  __u.__s = __nl_langinfo_l(_NL_WABDAY_2, __cloc);
++	  _M_data->_M_aday2 = __u.__w;
++	  __u.__s = __nl_langinfo_l(_NL_WABDAY_3, __cloc);
++	  _M_data->_M_aday3 = __u.__w;
++	  __u.__s = __nl_langinfo_l(_NL_WABDAY_4, __cloc);
++	  _M_data->_M_aday4 = __u.__w;
++	  __u.__s = __nl_langinfo_l(_NL_WABDAY_5, __cloc);
++	  _M_data->_M_aday5 = __u.__w;
++	  __u.__s = __nl_langinfo_l(_NL_WABDAY_6, __cloc);
++	  _M_data->_M_aday6 = __u.__w;
++	  __u.__s = __nl_langinfo_l(_NL_WABDAY_7, __cloc);
++	  _M_data->_M_aday7 = __u.__w;
++
++	  // Month names, starting with "C"'s January.
++	  __u.__s = __nl_langinfo_l(_NL_WMON_1, __cloc);
++	  _M_data->_M_month01 = __u.__w;
++	  __u.__s = __nl_langinfo_l(_NL_WMON_2, __cloc);
++	  _M_data->_M_month02 = __u.__w;
++	  __u.__s = __nl_langinfo_l(_NL_WMON_3, __cloc);
++	  _M_data->_M_month03 = __u.__w;
++	  __u.__s = __nl_langinfo_l(_NL_WMON_4, __cloc);
++	  _M_data->_M_month04 = __u.__w;
++	  __u.__s = __nl_langinfo_l(_NL_WMON_5, __cloc);
++	  _M_data->_M_month05 = __u.__w;
++	  __u.__s = __nl_langinfo_l(_NL_WMON_6, __cloc);
++	  _M_data->_M_month06 = __u.__w;
++	  __u.__s = __nl_langinfo_l(_NL_WMON_7, __cloc);
++	  _M_data->_M_month07 = __u.__w;
++	  __u.__s = __nl_langinfo_l(_NL_WMON_8, __cloc);
++	  _M_data->_M_month08 = __u.__w;
++	  __u.__s = __nl_langinfo_l(_NL_WMON_9, __cloc);
++	  _M_data->_M_month09 = __u.__w;
++	  __u.__s = __nl_langinfo_l(_NL_WMON_10, __cloc);
++	  _M_data->_M_month10 = __u.__w;
++	  __u.__s = __nl_langinfo_l(_NL_WMON_11, __cloc);
++	  _M_data->_M_month11 = __u.__w;
++	  __u.__s = __nl_langinfo_l(_NL_WMON_12, __cloc);
++	  _M_data->_M_month12 = __u.__w;
++
++	  // Abbreviated month names, starting with "C"'s Jan.
++	  __u.__s = __nl_langinfo_l(_NL_WABMON_1, __cloc);
++	  _M_data->_M_amonth01 = __u.__w;
++	  __u.__s = __nl_langinfo_l(_NL_WABMON_2, __cloc);
++	  _M_data->_M_amonth02 = __u.__w;
++	  __u.__s = __nl_langinfo_l(_NL_WABMON_3, __cloc);
++	  _M_data->_M_amonth03 = __u.__w;
++	  __u.__s = __nl_langinfo_l(_NL_WABMON_4, __cloc);
++	  _M_data->_M_amonth04 = __u.__w;
++	  __u.__s = __nl_langinfo_l(_NL_WABMON_5, __cloc);
++	  _M_data->_M_amonth05 = __u.__w;
++	  __u.__s = __nl_langinfo_l(_NL_WABMON_6, __cloc);
++	  _M_data->_M_amonth06 = __u.__w;
++	  __u.__s = __nl_langinfo_l(_NL_WABMON_7, __cloc);
++	  _M_data->_M_amonth07 = __u.__w;
++	  __u.__s = __nl_langinfo_l(_NL_WABMON_8, __cloc);
++	  _M_data->_M_amonth08 = __u.__w;
++	  __u.__s = __nl_langinfo_l(_NL_WABMON_9, __cloc);
++	  _M_data->_M_amonth09 = __u.__w;
++	  __u.__s = __nl_langinfo_l(_NL_WABMON_10, __cloc);
++	  _M_data->_M_amonth10 = __u.__w;
++	  __u.__s = __nl_langinfo_l(_NL_WABMON_11, __cloc);
++	  _M_data->_M_amonth11 = __u.__w;
++	  __u.__s = __nl_langinfo_l(_NL_WABMON_12, __cloc);
++	  _M_data->_M_amonth12 = __u.__w;
++	}
++#endif // 0
++    }
++#endif
++}
+diff --git a/libstdc++-v3/config/locale/uclibc/time_members.h b/libstdc++-v3/config/locale/uclibc/time_members.h
+new file mode 100644
+index 0000000..ba8e858
+--- /dev/null
++++ b/libstdc++-v3/config/locale/uclibc/time_members.h
+@@ -0,0 +1,68 @@
++// std::time_get, std::time_put implementation, GNU version -*- C++ -*-
++
++// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
++//
++// This file is part of the GNU ISO C++ Library.  This library is free
++// software; you can redistribute it and/or modify it under the
++// terms of the GNU General Public License as published by the
++// Free Software Foundation; either version 2, or (at your option)
++// any later version.
++
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++// GNU General Public License for more details.
++
++// You should have received a copy of the GNU General Public License along
++// with this library; see the file COPYING.  If not, write to the Free
++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
++// USA.
++
++// As a special exception, you may use this file as part of a free software
++// library without restriction.  Specifically, if other files instantiate
++// templates or use macros or inline functions from this file, or you compile
++// this file and link it with other files to produce an executable, this
++// file does not by itself cause the resulting executable to be covered by
++// the GNU General Public License.  This exception does not however
++// invalidate any other reasons why the executable file might be covered by
++// the GNU General Public License.
++
++//
++// ISO C++ 14882: 22.2.5.1.2 - time_get functions
++// ISO C++ 14882: 22.2.5.3.2 - time_put functions
++//
++
++// Written by Benjamin Kosnik <bkoz at redhat.com>
++
++  template<typename _CharT>
++    __timepunct<_CharT>::__timepunct(size_t __refs)
++    : facet(__refs), _M_data(NULL), _M_c_locale_timepunct(NULL),
++    _M_name_timepunct(_S_get_c_name())
++    { _M_initialize_timepunct(); }
++
++  template<typename _CharT>
++    __timepunct<_CharT>::__timepunct(__cache_type* __cache, size_t __refs)
++    : facet(__refs), _M_data(__cache), _M_c_locale_timepunct(NULL),
++    _M_name_timepunct(_S_get_c_name())
++    { _M_initialize_timepunct(); }
++
++  template<typename _CharT>
++    __timepunct<_CharT>::__timepunct(__c_locale __cloc, const char* __s,
++				     size_t __refs)
++    : facet(__refs), _M_data(NULL), _M_c_locale_timepunct(NULL),
++    _M_name_timepunct(__s)
++    {
++      char* __tmp = new char[std::strlen(__s) + 1];
++      std::strcpy(__tmp, __s);
++      _M_name_timepunct = __tmp;
++      _M_initialize_timepunct(__cloc);
++    }
++
++  template<typename _CharT>
++    __timepunct<_CharT>::~__timepunct()
++    {
++      if (_M_name_timepunct != _S_get_c_name())
++	delete [] _M_name_timepunct;
++      delete _M_data;
++      _S_destroy_c_locale(_M_c_locale_timepunct);
++    }
+diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure
+index f40ddcf..c57a751 100755
+--- a/libstdc++-v3/configure
++++ b/libstdc++-v3/configure
+@@ -15822,6 +15822,9 @@ fi
+   # Default to "generic".
+   if test $enable_clocale_flag = auto; then
+     case ${target_os} in
++      *-uclibc*)
++        enable_clocale_flag=uclibc
++        ;;
+       linux* | gnu* | kfreebsd*-gnu | knetbsd*-gnu)
+ 	enable_clocale_flag=gnu
+ 	;;
+@@ -16079,6 +16082,78 @@ $as_echo "newlib" >&6; }
+       CTIME_CC=config/locale/generic/time_members.cc
+       CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h
+       ;;
++    uclibc)
++      { $as_echo "$as_me:${as_lineno-$LINENO}: result: uclibc" >&5
++$as_echo "uclibc" >&6; }
++
++      # Declare intention to use gettext, and add support for specific
++      # languages.
++      # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT
++      ALL_LINGUAS="de fr"
++
++      # Don't call AM-GNU-GETTEXT here. Instead, assume glibc.
++      # Extract the first word of "msgfmt", so it can be a program name with args.
++set dummy msgfmt; ac_word=$2
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
++$as_echo_n "checking for $ac_word... " >&6; }
++if test "${ac_cv_prog_check_msgfmt+set}" = set; then :
++  $as_echo_n "(cached) " >&6
++else
++  if test -n "$check_msgfmt"; then
++  ac_cv_prog_check_msgfmt="$check_msgfmt" # Let the user override the test.
++else
++as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
++for as_dir in $PATH
++do
++  IFS=$as_save_IFS
++  test -z "$as_dir" && as_dir=.
++    for ac_exec_ext in '' $ac_executable_extensions; do
++  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
++    ac_cv_prog_check_msgfmt="yes"
++    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
++    break 2
++  fi
++done
++  done
++IFS=$as_save_IFS
++
++  test -z "$ac_cv_prog_check_msgfmt" && ac_cv_prog_check_msgfmt="no"
++fi
++fi
++check_msgfmt=$ac_cv_prog_check_msgfmt
++if test -n "$check_msgfmt"; then
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $check_msgfmt" >&5
++$as_echo "$check_msgfmt" >&6; }
++else
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
++fi
++
++
++      if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then
++        USE_NLS=yes
++      fi
++      # Export the build objects.
++      for ling in $ALL_LINGUAS; do \
++        glibcxx_MOFILES="$glibcxx_MOFILES $ling.mo"; \
++        glibcxx_POFILES="$glibcxx_POFILES $ling.po"; \
++      done
++
++
++
++      CLOCALE_H=config/locale/uclibc/c_locale.h
++      CLOCALE_CC=config/locale/uclibc/c_locale.cc
++      CCODECVT_CC=config/locale/uclibc/codecvt_members.cc
++      CCOLLATE_CC=config/locale/uclibc/collate_members.cc
++      CCTYPE_CC=config/locale/uclibc/ctype_members.cc
++      CMESSAGES_H=config/locale/uclibc/messages_members.h
++      CMESSAGES_CC=config/locale/uclibc/messages_members.cc
++      CMONEY_CC=config/locale/uclibc/monetary_members.cc
++      CNUMERIC_CC=config/locale/uclibc/numeric_members.cc
++      CTIME_H=config/locale/uclibc/time_members.h
++      CTIME_CC=config/locale/uclibc/time_members.cc
++      CLOCALE_INTERNAL_H=config/locale/uclibc/c++locale_internal.h
++      ;;
+   esac
+ 
+   # This is where the testsuite looks for locale catalogs, using the
+diff --git a/libstdc++-v3/include/c_compatibility/wchar.h b/libstdc++-v3/include/c_compatibility/wchar.h
+index 580d725..3fe61b8 100644
+--- a/libstdc++-v3/include/c_compatibility/wchar.h
++++ b/libstdc++-v3/include/c_compatibility/wchar.h
+@@ -101,7 +101,9 @@ using std::wmemcmp;
+ using std::wmemcpy;
+ using std::wmemmove;
+ using std::wmemset;
++#if _GLIBCXX_HAVE_WCSFTIME
+ using std::wcsftime;
++#endif
+ 
+ #if _GLIBCXX_USE_C99
+ using std::wcstold;
+diff --git a/libstdc++-v3/include/c_std/cwchar b/libstdc++-v3/include/c_std/cwchar
+index 0e6b1fc..405aee2 100644
+--- a/libstdc++-v3/include/c_std/cwchar
++++ b/libstdc++-v3/include/c_std/cwchar
+@@ -175,7 +175,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
+   using ::wcscoll;
+   using ::wcscpy;
+   using ::wcscspn;
++#if _GLIBCXX_HAVE_WCSFTIME
+   using ::wcsftime;
++#endif
+   using ::wcslen;
+   using ::wcsncat;
+   using ::wcsncmp;
+-- 
+1.7.10.4
+
diff --git a/recipes-devtools/gcc/gcc-4.9/0004.gcc.extelim-v4-49x.patch b/recipes-devtools/gcc/gcc-4.9/0004.gcc.extelim-v4-49x.patch
new file mode 100644
index 0000000..14d7a17
--- /dev/null
+++ b/recipes-devtools/gcc/gcc-4.9/0004.gcc.extelim-v4-49x.patch
@@ -0,0 +1,4526 @@
+# Problem Statement:
+  Eliminate sign and zero extensions in PPC generated code
+
+# Owned by:
+  Edmar Wienskoski and John Russo
+
+# Action:
+  a) Eliminate sign and zero extensions in PPC generated code
+     A new module is introduced 'extelim.c' and a new RTL pass is introduced.
+     The '-f[no-]extelim' flag controls this pass and is enabled at -O2 and above.
+     The algorithm is based on the paper "Effective Sign Extension Elimination", Kawahito, et. al.
+     More details on implementation in the extelim.c module.
+
+  b) Combine clrldi and rldicr into a single rldic instruction. The particular difficulty in the
+     presented test case is that the clrldi reaches the rldicr instruction via a branch from the
+     bottom of a loop. This make the combination inappropriate for the combine phase
+     (reaches across basic blocks). The solution is to duplicate the clrldi at a reaching point at
+     rldicr and let the extension elimination eliminate the now redundant original clrldi.  The
+     instruction selector now sees the adjacent clrldi,rldicr (int rtl form) and selects the rldic
+     instruction.
+
+     This is only effective for 64-bit targets that have rldic instructions.
+     The test case rldic-1.c and tests that rldic is generated for the test case.
+
+  c) This patch also contains extension elimination fix for ENGR00225973 (segmentation fault at -O3).
+
+  d) Append patch to fix spec2k perlbmk issue when using -flto -funroll-loops
+
+  e) Append patch to select active 'prev_insn', else we end up with consecutive extensions 
+    (one inserted, one previously there) for return instructions. 
+
+  f) Updated changes to match with GCC v4.9.x source base.
+
+  g) Update vect-reduc-pattern-2b-big-array.c test case to prevent signed overflow.
+
+  h) The main entry point of extension elimination algorithm was returning void.
+     With v4.9.x source base, this file is compiled by C++ compiler which optimizes this code.
+     Update changes to work with v4.9.x source base.
+     Remove unused variables from 'init_flags_vector'.
+
+  i) spec2k.gap relies on signed arithmetic overflow being well-defined.
+     Disable extension elimination for '-fwrapv, -ftrapv, -fno-strict-overflow'.
+
+  j) Fix 20040709-2.c [-Os] and 20111227-1.c [-O2,-O3,-Os].
+     "operation_extends_to_upper_bits_size" had one of the conditional check reversed
+     which eliminated a required sign extension instruction.
+
+  k) Update gcc.dg/sms-1.c and gcc.dg/sms-6.c test cases so that Swing Modulo Scheduling happens
+
+  l) Added target macro header file to fix ICE in windows build with GCC v4.9.x
+
+  m) Add test case from coriant team which got fixed by (j).
+
+diff -Naur gcc-4.7.1/gcc/common.opt gcc-4.7.1-extelim-v4/gcc/common.opt
+--- gcc-4.7.1/gcc/common.opt	2012-05-04 06:34:25.000000000 -0500
++++ gcc-4.7.1-extelim-v4/gcc/common.opt	2012-10-31 03:12:42.109238187 -0500
+@@ -1054,6 +1054,10 @@
+ Common Report Var(flag_eliminate_dwarf2_dups)
+ Perform DWARF2 duplicate elimination
+ 
++fextelim
++Common Report Var(flag_extelim)
++Perform zero/sign extension removal
++
+ fipa-sra
+ Common Report Var(flag_ipa_sra) Init(0) Optimization
+ Perform interprocedural reduction of aggregates
+diff -Naur gcc-4.7.1/gcc/config/rs6000/extelim.c gcc-4.7.1-extelim-v4/gcc/config/rs6000/extelim.c
+--- gcc-4.7.1/gcc/config/rs6000/extelim.c	1969-12-31 18:00:00.000000000 -0600
++++ gcc-4.7.1-extelim-v4/gcc/config/rs6000/extelim.c	2012-11-05 00:43:33.642238016 -0600
+@@ -0,0 +1,3431 @@
++/* Redundant extension elimination 
++   Copyright (C) 2010 Free Software Foundation, Inc.
++   Contributed by John Russo (john.russo at freescale.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/>.  */
++
++/*
++PURPOSE: Implement a method for eliminating redundant and superflous sign
++extension instructions from 64-bit PPC e5500 generated code.
++
++MOTIVATING EXAMPLE:
++The Nullstone loop_6.c kernel looks like:
++  int i;
++  int a[100];
++  
++  ref_int_p (&a[0]);
++  
++  for (i=2; i<100; i++)
++    a[i] = a[i-1] + a[i-2];
++  
++The final, generated code for the loop body is:
++
++32-bit                  64-bit
++add     r25,r11,r0	add     r5,r5,r8
++add     r26,r0,r25	addi    r4,r4,12
++stw     r25,0(r9)	add     r27,r5,r8
++add     r27,r25,r26	stw     r5,0(r9)
++stw     r26,4(r9)	extsw   r12,r27       <===
++add     r28,r26,r27	stw     r27,4(r9)
++stw     r27,8(r9)	add     r6,r5,r12
++add     r29,r27,r28	add     r28,r6,r12
++stw     r28,12(r9)	stw     r6,8(r9)
++add     r30,r28,r29	extsw   r0,r28        <===
++stw     r29,16(r9)	stw     r28,12(r9)
++add     r12,r29,r30	add     r7,r6,r0
++stw     r30,20(r9)	add     r29,r7,r0
++add     r3,r30,r12	stw     r7,16(r9)
++stw     r12,24(r9)	extsw   r3,r29        <===
++add     r4,r12,r3	stw     r29,20(r9)
++stw     r3,28(r9)	add     r10,r7,r3
++add     r5,r3,r4	add     r30,r10,r3
++stw     r4,32(r9)	stw     r10,24(r9)
++add     r6,r4,r5	extsw   r8,r30        <===
++stw     r5,36(r9)	stw     r30,28(r9)
++add     r7,r5,r6	add     r11,r10,r8
++stw     r6,40(r9)	add     r12,r11,r8
++add     r8,r6,r7	stw     r11,32(r9)
++stw     r7,44(r9)	extsw   r26,r12       <===
++add     r10,r7,r8	stw     r12,36(r9)
++stw     r8,48(r9)	add     r0,r11,r26
++add     r11,r8,r10	add     r3,r0,r26
++stw     r10,52(r9)	stw     r0,40(r9)
++add     r0,r10,r11	subfic  r26,r4,100
++stw     r11,56(r9)	stw     r3,44(r9)
++stw     r0,60(r9)	extsw   r5,r0         <===
++addi    r9,r9,64	extsw   r8,r3         <===
++bdnz+   10000640        extsw   r4,r4         <===
++                        clrldi  r26,r26,32
++                        addi    r9,r9,48
++                        bdnz+   10000890 
++
++GENERAL APPROACH:
++Consider a machine whose native register size is 64-bits
++
++0          3132         63
++|-----------||-----------|
++
++where bit 63 is the LSB and bit 0 is the MSB of a long int
++and bit 63 is the LSB and bit 32 is the MSB of an int.
++
++Sign and zero extension are inserted to RTL to preserve the
++operation's semantics when the operands used are not the 
++native register size since normally the machine only performs
++the operation using a native register size. In practice, many
++of the inserted extensions are not necessary.
++
++First, the extension may simply be redundant. That is, the 
++same operation is performed on the same operands. The redundant
++extensions can be eliminated.
++
++Secondly, if the extended portion of the register (the "upper" bits)
++are not essential to the calculations performed on the output of the
++extension, then the extension is not necessary. For example, given
++int (32-bit) inputs and outputs:
++
++c = a + b
++d = sxt(c)
++e = d + 1; 
++
++The "upper" bits of d (bit 0-31) do not affect the calculation
++of e. It doesn't matter what the "upper" bits of d are, the int result
++e is the same regardless of the sxt instruction.
++
++Thirdly, the extensions may not be necessary if the operands are
++already extended and the operation preserves the extended bits.
++
++a = mem[&b] ; sign extending load
++c = a + 1
++d = sxt(c)
++
++Here, a is generated by a sign extending load, the operation
++does nothing to invalidate the extension to c, thus the extension
++on c to d is not necessary.
++
++In each case, the redundant extension must be replaced by a copy,
++with the copy to be optimized out in later phases.
++
++The three cases described above form the general idea behind the
++algorithms implemented here to eliminate redundant and unneccessary
++extensions. 
++
++Sign extensions do not have to be preserved for overflow conditions
++since signed overflow behavior is not defined in C. For example,
++take a 16-bit variable in a 32-bit register. It is ok
++for 0x0000_7fff to overflow to 0x0000_8000 and not 0xffff_8000.
++This implies that it is not necessary to preserve the sign
++extension.
++
++Unsigned overflow extension need to be preserved because 
++unsigned overflow is modulo. For example, a 16-bit unsigned 
++overflow of 0x0000_FFFF must be 0x0000_0000 in a 32-bit register, 
++not 0x0001_0000. In order to remove the unsigned zero extension,
++we would need to range check the variable to be sure it doesn't
++overflow.  
++
++RTL ANALYSIS:
++I looked at the RTL representation after RTL generation (.expand) and
++after the first forward propagation (.fwprop1). Since RTL is not compact
++when printing out, I reduced the .fwprop1 RTL to this pseudocode:
++
++(note: sxt,zxt mean double word length, 64-bit, extension).
++
++(1)     r198 = m[r113+ #112]     ; load a[0]
++(2)     r174 = sxt(r198)
++(3)     r199 = m[r113+ #116]     ; load a[1] 
++(4)     r186 = sxt(r199)
++(5)     r181 = r113 + #120       ; load &a[2]
++(6)     r180 = 2                 ; i = 2
++(7)     L1:
++(8)     r200 = r174 + r186       ; t1 = a[i-1] + a[i-2]
++(9)     r174 = sxt(r200)
++(10)    m[r181] = r200           ; a[i] = t1
++(11)    r201 = r200 + r186       ; t2 = t1 + a[i-1]
++(12)    r186 = sxt(r201)
++(13)    m[r181+4] = r201         ; a[i+1] = t2
++(14)    r202 = r180 + 2          ; i += 2
++(14.1)  r180 = sxt(r202)     
++(15)    r203 = 100 - r202        ; used to calc loop remainder
++(16)    r185 = zxt(r203)         ; used to calc loop remainder
++(17)    r181 = r181 + 8          ; address induction var
++(18)    ccr204 = cmp(r202,#98)   ; set CC
++(19)    BNE ccr204,L1            ; branch 
++
++In the pseudo-code, you see several sign extension candidates: (2),(4),
++(9), (12), (14.1), (16).  
++
++ALGORITHM:
++To eliminate the extra sign ext you have to look at (1) the definitions
++of the source of the sign extensions and/or (2) look at the uses of the target
++of the sign extensions. In either case, if doing a global elimination
++pass, you'll need def-use chain information. 
++
++The algorithms are recursive. Using the use/def and def/use chains
++we attempt to find ultimately whether the extension is relevant
++or not. 
++
++
++Example 1.
++Extensions (2) and (4) are not put in the candidate list because
++they are combined into a load/ext pair that is ultimately generated
++as sign extending loads.
++
++Take the sign extension at (9), r174 = sxt(r200).
++Def analysis shows that r200 is defined by 2 registers, thus no
++further def analysis recursion can occur.
++Use analysis. Find all the uses of r174. There is 1 use at (8) r200 = r174 + r186. 
++The extension does not affect the add operation results. Continuing, we look at
++the uses of r200 to see if the results of operations on r200 need the sign extended bits.
++We see 2 uses of r200 at (10) and (11). (10) is a 32-bit store of r200,
++so the sign extended bits are irrelevant. (11), however, is an unknown,
++so we must look that the uses of this result, r201. A similar sequence
++occurs for r201 when it defines r186. Looking at the uses of r186 at 
++(8) and (11), we have already visited those statements so they have
++been covered already. So it appears that the sxt to r174 at (9) ultimately
++dead-ends to a store instruction that doesn't case about the sign extended
++bits. The sxt at (9) can be removed.
++
++The remaining extensions are processed similarly.
++
++PROGRAM STRUCTURE:
++
++extension elimination                            -- main entry point
++ find extensions                                 -- identify extension candidates
++ extension duplication                           -- insert extension at strategic points to
++                                                    enable removal of extensions at more frequently
++                                                    executed points.
++ find extensions                                 -- recreate extension candidate list
++ sort extensions                                 -- sort extension candidate list by loop depth
++ for each ext in list                            -- process each extension candidate
++  eliminate one extension
++ replace marked candidates with copy             -- optimize the extension
++
++PSEUDOCODE:
++
++Create working list of sign extensions, sxt_list
++
++For each insn, insn_sxt,  in sxt_list 
++   ext_needed = true 
++   For all insns, insn_def, that DEFINE and REACH the SOURCE_REG(insn_sxt)
++     ext_needed = analyze_def(insn_def, insn_sxt)
++     if (ext_needed)
++       break;
++   end_loop
++   if (ext_needed)
++     For all insns, insn_use, that USE and are REACHED by the DEST_REG(insn_sxt)
++       ext_needed = analyze_use(insn_use, insn_sxt)
++       if (ext_needed)
++         break;
++     end_loop
++    
++   if (!ext_needed)
++     mark_for_replace_with_copy(I)
++end_loop
++
++For each insn, insn_sxt, in sxt_list
++   if (insn_sxt is marked for replacement)
++     replace_insn_with_copy(insn_sxt)
++end_loop
++
++--------------------------
++function: analyze_def(def)
++---------------------------
++return true if extension is needed, false otherwise.
++
++destination_operand = defined operand of source 
++source_operand = source operand of def 
++
++if (have_seen_this_insn_already (def))
++ return true;
++
++set_seen_this_insn_flag (def)
++
++analysis_result = analyze_result_def (def)
++switch (analysis_result)
++ case source_operand_is_extended:
++  return false
++ case stop_recursion:
++  return true
++ case continue_recursion: 
++  break;
++
++ext_needed = true;
++
++For all insns, insn_def, that USE and REACHED by the register of destination_operand 
++ ext_needed = analyze_def(insn_def))
++ if (ext_needed)
++  break;
++end_loop
++
++return ext_needed 
++
++--------------------------
++function: analyze_use(use)
++---------------------------
++return true if extension is needed, false otherwise.
++
++destination_operand = destination operand of use
++source_operand = source operand of use
++
++if (have_seen_this_insn_already (use))
++ return false;
++
++set_seen_this_insn_flag (use)
++
++analysis_result = analyze_result_use (use)
++switch (analysis_result)
++ case low_bits_not_affected_by_use:
++  return false
++ case low_bits_affected_by_use:
++  return true
++ case look_at_uses_of_destination_operand
++  break;
++
++ext_needed = true;
++For all insns, insn_use, that USE the register of destination_operand 
++    ext_needed = analyze_use(insn_use))
++    if (ext_needed)
++     break;
++end_loop
++
++return ext_needed 
++
++REFERENCES:
++
++"Effective Sign Extension Elimination", Kawahito, Komatsu, Nakatani. 
++IBM Tokyo Researc Laboratory.
++
++"New sign/zero extension elimination pass", deVries.
++http://gcc.gnu.org/ml/gcc-patches/2010-10/msg01529.html
++*/
++
++/*
++Iteration 4: pre-ZERO_EXTEND version, duplicates sign_extend at uses
++Iteration 5: begin supporting ZERO_EXTEND, crashes on Coremark.
++Iteration 6: revert to 4, support SI:HI sign_extensions.
++Iteration 7: Add support for zero extend. This version deletes
++ "inserted" duplicate extensions when redundant and propagates
++ the copied value. This propagate fails in other_tests/test2.sh.
++ I am reverting back to replacing the "inserted" extension to a copy.
++ Copy propagation should always be able to eliminate this copy.
++ Coremark was stable, however.
++Iteration 8: Revert to change extensions to copy, regardless of whether
++ the extension was duplicated or not. 
++ Refactor setting of dest,src in analyze_ext_use, analyze_ext_def, now
++ handled with a single function.
++Iteration 9: 
++ Inserted redundant extensions at function return points.
++ Sorted the order that extensions are processed by loop depth.
++ Additional cases in upper_bits_do_not_affect_dest
++Iteration 10:
++ Fixes for test failures. A major problem was uncovered where
++ the "visited" flag was not properly cleared. This meant that
++ each time a new extension was processed, it appeared that some
++ extensions were visited already and there were not. The result
++ was false removals. This fix significantly affects the benchmark.
++ Another change was to comment out the duplicate_exts_at_uses. This
++ seemed to have little effect now that the visited flag issue is
++ fixed. 
++Iteration 11:
++ Cleanup warnings during build.
++Iteration 12:
++ QImode support started.
++Iteration 13:
++ Redesign and refactor analyze_ext_use, analyze_ext_def
++Iteration 14:
++ Continue redesign and refactor of analyze_ext_use, analyze_ext_def
++ Debugging paper_example.c
++Iteration 15:
++ cond_c fix
++Iteration 16: (not tested)
++ Refactor check_compare code 
++ Refactor action decision in PARALLEL 
++ Allow pass-thru on insns that are marked for replace copy 
++ instead of stopping recursion if we see a marked insn.
++ Examining lshiftrt.c program (signed and unsigned).
++Iteration 17: 
++ Refactor mostly complete. Passed all local testing including
++ nas and perfect. Best coremark results so far.
++Iteration 18:
++ Oops. analyze_ext_def was disabled. Enabling it improves
++ Coremark. Passed coremark, perfect.
++Iteration 19:
++ Local tests are passing. Tested with glibc.
++ Added statistics.
++ Fixed elimination from CALL output in operand_is_extended.
++  This impacted Coremark went from 6300 to 6170. But is necessary.
++ More safety for used regs in analyze_ext_def.
++ More safety for the types of extensions.
++Iteration 20:
++ Fixes for various tests.
++Iteration 21:
++ pr43017 -funroll_loops fix.
++Iteration 22:
++ Fixes for AND immediate in operand_is_extended.
++ Cosmetic cleanup.
++Iteration 23:
++ Fixes for consumer-2,spec2k,spec2k6. Handle 
++ SUBREG_PROMOTED_VAR_P flags on operands whose
++ dependent extension has been eliminated.
++Iteration 24:
++ Fixed problem in native build during bootstrapping.
++ Extelim was considering debug_insns and should have
++ ignored them. This resulted in a compare fail between
++ stage2 and stage3.
++Iteration 25:
++ - Post-release 4.6.1 development
++ - Full duplication of extensions at uses turned on.
++ - Recursion into original extension no longer kills optimization (analyze_ext_def only)
++ - Allow some duplication into the same block if it enables insn selection
++ - Allow CCmode and CCUNSmode into mode_supported_p
++Iteration 26:
++ - Solve ICEs due to null df-ref.
++Iteration 27:
++ - Fixed issue with duplication of extension at a self-assign.
++ - Some fixes for copying flags during duplication
++ - Some fixes for counting register uses.
++Iteration 28:
++ - Fixed issue with duplication of extension when use has multiple
++   reaching definitions.
++Iteration 29:
++ - Release candidate for Q42011 release iteration.
++Iteration 30:
++ - Turn off extension duplication - minimally effective
++Iteration 31:
++ - Turn on extension duplication for specific case to allow
++   'rldic' insn generation.
++Iteration 32:
++ - Fix issue with spec2k6 soplex where zero-extends duplicated
++   even if shift is already zero-extended.
++*/
++
++#include "config.h"
++#include "system.h"
++#include "coretypes.h"
++#include "tm.h"
++#include "rtl.h"
++#include "tree.h"
++#include "tm_p.h"
++#include "flags.h"
++#include "regs.h"
++#include "hard-reg-set.h"
++#include "basic-block.h"
++#include "insn-config.h"
++#include "function.h"
++#include "expr.h"
++#include "insn-attr.h"
++#include "recog.h"
++#include "toplev.h"
++#include "target.h"
++#include "timevar.h"
++#include "optabs.h"
++#include "insn-codes.h"
++#include "rtlhooks-def.h"
++#include "output.h"
++#include "params.h"
++#include "timevar.h"
++#include "tree-pass.h"
++#include "cgraph.h"
++#include "df.h"
++#include "vec.h"
++
++/* Feature flags */
++/* Duplicate extensions at each immediate use */
++#define EXTELIM_DUPLICATE_EXTS_AT_USES 1
++/* Dump DF information also in dump */
++#define EXTELIM_DF_DUMP 0
++
++
++/* Typedefs */
++typedef unsigned int insn_flag_t;       /* Insn flags type */
++typedef int extelim_uid_t;      /* UID type */
++DEF_VEC_I (insn_flag_t);        /* Define vector type and allocation type */
++DEF_VEC_ALLOC_I (insn_flag_t, heap);
++
++typedef struct GTY (()) ext_record
++{
++  rtx ext;                      /* The extension insn */
++  VEC (rtx, heap) * ext_uses;   /* List of use records for this extension. For some
++                                   some extensions, we will duplicate the extension
++                                   at these use points. */
++  VEC (rtx, heap) * ext_updates;/* List of rtx that need to be updated if the extension
++                                   is to be eliminated. For example, SUBREG_PROMOTED flags
++                                   on SUBREG uses defined by this extension should
++                                   be reset since the extension is eliminated. The PROMOTED
++                                   flag is no longer valid. */
++} *ext_record_t;
++
++typedef struct regspec_cb_data
++{
++  unsigned int regno;
++  rtx exp;
++} regspec_cb_data_t;
++
++/* Static variables */
++DEF_VEC_P (ext_record_t);
++DEF_VEC_ALLOC_P (ext_record_t, heap);
++VEC (ext_record_t, heap) * extensions;  /* Vector holding all extension records */
++VEC (insn_flag_t, heap) * insn_flags;   /* Vector holding flags for all insns */
++VEC (rtx, heap) * returns;      /* Vector holding return insns for this function */
++
++     static extelim_uid_t max_uid;      /* Max UID insn value for insn_flags allocation */
++     static ext_record_t current_ext_record; /* Current extension record being processed */
++
++/* Statistics */
++     static int num_cand;       /* Number of extensions detected */
++     static int num_cand_ignored;       /* Number of extensions ignored */
++     static int num_cand_transformed;   /* Number of extensions transformed to copy */
++
++/* Basic information about the extension being processed */
++     enum machine_mode ext_to_mode;     /* Mode extended to */
++     enum machine_mode ext_from_mode;   /* Mode extended from */
++     enum rtx_code ext_code;    /* Sign or zero extend */
++
++/* Insn use analysis possible results */
++     enum insn_use_results
++     {
++       EXTELIM_ANALYSIS_RESULT_LOWBITS_NOT_AFFECTED,
++       EXTELIM_ANALYSIS_RESULT_LOWBITS_AFFECTED,
++       EXTELIM_ANALYSIS_RESULT_CONTINUE_RECURSION
++     };
++
++/* Insn def analysis possible results */
++     enum insn_def_results
++     {
++       EXTELIM_ANALYSIS_RESULT_DEF_EXTENDED,
++       EXTELIM_ANALYSIS_RESULT_DEF_STOP_RECURSION,
++       EXTELIM_ANALYSIS_RESULT_DEF_CONTINUE_RECURSION
++     };
++
++/* Insn flags for this pass */
++#define       EXTELIM_NONE           0
++#define       EXTELIM_SEEN           (1<<0)     /* Mark insn as visited during DF traversal */
++#define       EXTELIM_REPLACE_COPY   (1<<1)     /* Mark ext insn as replace with copy */
++#define       EXTELIM_INSERTED       (1<<2)     /* Mark ext insn as algorithmically inserted */
++#define       EXTELIM_INSERTED_FOR   (1<<3)     /* Mark use insn for which ext has been inserted */
++
++
++/* Query the insn flag */
++
++     static bool insn_flag_p (insn_flag_t set_p, extelim_uid_t uid)
++{
++  insn_flag_t flags;
++
++  if (((flags = VEC_index (insn_flag_t, insn_flags, uid)) & set_p) == set_p)
++    return true;
++
++  return false;
++}
++
++/* Set the insn flags */
++
++static void
++insn_flag_set (insn_flag_t flags, extelim_uid_t uid)
++{
++  insn_flag_t set;
++  set = VEC_index (insn_flag_t, insn_flags, uid);
++  set |= flags;
++  VEC_replace (insn_flag_t, insn_flags, uid, set);
++}
++
++/* Clear insn flags */
++
++static void
++insn_flag_clear (insn_flag_t flags, extelim_uid_t uid)
++{
++  insn_flag_t clear;
++  clear = VEC_index (insn_flag_t, insn_flags, uid);
++  clear &= ~flags;
++  VEC_replace (insn_flag_t, insn_flags, uid, clear);
++}
++
++/* Set static variable max_uid to the largest
++   insn uid found in the module plus 1. This will be the
++   size of the vector for insn flags. */
++
++static void
++set_max_uid (void)
++{
++  basic_block bb;
++  rtx insn;
++  extelim_uid_t lmax_uid = 0;
++
++  FOR_EACH_BB (bb) FOR_BB_INSNS (bb, insn)
++  {
++    if (INSN_P (insn))
++      {
++        if (INSN_UID (insn) > lmax_uid)
++          lmax_uid = INSN_UID (insn);
++      }
++  }
++  max_uid = lmax_uid + 1;
++}
++
++/* Re-initializes the requested insn flags to their reset state */
++
++static void
++reinit_insn_flags (insn_flag_t flags_to_be_reset)
++{
++  extelim_uid_t i;
++
++  /* Account for new insns */
++  set_max_uid ();
++
++  for (i = 0; i < max_uid; i++)
++    {
++      insn_flag_clear (flags_to_be_reset, i);
++    }
++}
++
++/* Init the vector for insn flags. One
++   vector element per insn is created.
++   The flags are init'd to EXTELIM_NONE. */
++
++static void
++init_flags_vector (void)
++{
++  extelim_uid_t i;
++  /* Get the maximum uid value. We'll use this
++     information to set up a vector of max_uid
++     length. Each element of the vector will hold
++     the pass-specific flags for each insn. */
++  max_uid = 0;
++  set_max_uid ();
++
++  /* Allocate the vector of insn flags */
++  insn_flags = VEC_alloc (insn_flag_t, heap, max_uid);
++
++  /* Initialize the insn flags vector */
++  for (i = 0; i < max_uid; i++)
++    {
++      VEC_quick_insert (insn_flag_t, insn_flags, i, EXTELIM_NONE);
++    }
++}
++
++/* Initialize this pass */
++
++static void
++init_pass (void)
++{
++  /* Init insn flags vector */
++  init_flags_vector ();
++
++  /* This pass requires def-use chain information */
++  df_chain_add_problem (DF_DU_CHAIN + DF_UD_CHAIN);
++  df_analyze ();
++}
++
++static void
++free_extensions (void)
++{
++  ext_record_t ext_record;
++  unsigned i;
++
++  FOR_EACH_VEC_ELT (ext_record_t, extensions, i, ext_record)
++  {
++    if (!VEC_empty (rtx, ext_record->ext_uses))
++      VEC_free (rtx, heap, ext_record->ext_uses);
++
++    if (!VEC_empty (rtx, ext_record->ext_updates))
++      VEC_free (rtx, heap, ext_record->ext_updates);
++  }
++  VEC_free (ext_record_t, heap, extensions);
++}
++
++/* Clean up this pass */
++
++static void
++finish_pass (void)
++{
++  free_extensions ();
++  VEC_free (insn_flag_t, heap, insn_flags);
++  VEC_free (rtx, heap, returns);
++}
++
++static void
++update_uid_vectors (extelim_uid_t uid)
++{
++  VEC_safe_grow_cleared (insn_flag_t, heap, insn_flags, uid + 1);
++}
++
++/* Emit a insn before a given insn, update vector lengths
++   of those vectors that are indexed by uid. Return uid
++   of the inserted insn. */
++
++static extelim_uid_t
++extelim_emit_before (rtx new_insn, rtx before_insn)
++{
++  rtx seq;
++  extelim_uid_t new_uid;
++
++  start_sequence ();
++  emit_insn (new_insn);
++  seq = get_insns ();
++  end_sequence ();
++  new_insn = emit_insn_before (seq, before_insn);
++
++  /* Expand the flags vector to hold the new insn and set the
++     inserted flag on the insn. */
++  new_uid = INSN_UID (new_insn);
++  update_uid_vectors (new_uid);
++  return new_uid;
++}
++
++/* Utility function to find the REG exp 
++   given an rtx */
++
++static rtx
++register_exp (rtx exp)
++{
++  if (REG_P (exp))
++    {
++      return exp;
++    }
++  else if (GET_CODE (exp) == SUBREG)
++    {
++      return SUBREG_REG (exp);
++    }
++  else
++    return NULL;
++}
++
++/* Check whether this is a sign extension.  */
++
++static bool
++extension_p (rtx insn, rtx * dest, rtx * inner, int *preserved_size)
++{
++  rtx src, op0;
++
++  /* Detect set of reg.  */
++  if (GET_CODE (PATTERN (insn)) != SET)
++    return false;
++
++  src = SET_SRC (PATTERN (insn));
++  *dest = SET_DEST (PATTERN (insn));
++
++  if (!REG_P (*dest))
++    return false;
++
++  if (GET_CODE (src) == SIGN_EXTEND || GET_CODE (src) == ZERO_EXTEND)
++    {
++      op0 = XEXP (src, 0);
++
++      /* Determine amount of least significant bits preserved by operation.  */
++      if (GET_CODE (src) == AND)
++        *preserved_size = ctz_hwi (~UINTVAL (XEXP (src, 1)));
++      else
++        *preserved_size = GET_MODE_BITSIZE (GET_MODE (op0));
++
++      if (GET_CODE (op0) == SUBREG)
++        {
++          if (subreg_lsb (op0) != 0)
++            return false;
++
++          *inner = SUBREG_REG (op0);
++          return true;
++        }
++      else if (REG_P (op0))
++        {
++          *inner = op0;
++          return true;
++        }
++    }
++
++  return false;
++}
++
++/* Return true if this is the last use of a
++   register, false otherwise.  */
++
++static bool
++reg_is_dead_p (rtx insn, rtx reg_expr)
++{
++  rtx link;
++  gcc_assert (REG_P (reg_expr));
++
++  for (link = REG_NOTES (insn); link; link = XEXP (link, 1))
++    {
++      if (REG_NOTE_KIND (link) == REG_DEAD && REG_P (XEXP (link, 0)))
++        {
++          if (REGNO (XEXP (link, 0)) == REGNO (reg_expr))
++            return true;
++        }
++    }
++  return false;
++}
++
++/* Return true if we don't want to place this
++   extension in the candidate extensions list because of the
++   previous insn. Return false otherwise. */
++
++static bool
++ignore_extension_prev_p (rtx ext_insn, rtx prev_insn)
++{
++  rtx prev_dest, prev_src, prev = PATTERN (prev_insn);
++  rtx ext_src, ext = PATTERN (ext_insn);
++
++  /* It's OK to allow extension with no accompanying prev real insn */
++  if (!NONDEBUG_INSN_P (prev_insn) || NOTE_P (prev_insn))
++    return false;
++
++  if (GET_CODE (prev) != SET)
++    return false;
++
++  if (GET_CODE (ext) != SET)
++    return false;
++
++  prev_dest = SET_DEST (prev);
++  prev_src = SET_SRC (prev);
++
++  /* Source register of sign extension */
++  ext_src = XEXP (SET_SRC (ext), 0);
++
++  /* Check previous insns */
++
++  /* Previous insn is a load whose dest is the
++     extension's source  and the dest reg is
++     dead */
++  if (MEM_P (prev_src) && (prev_dest = register_exp (prev_dest)))
++    {
++      if ((ext_src = register_exp (ext_src)))
++        {
++          if ((REGNO (prev_dest) == REGNO (ext_src))
++              && reg_is_dead_p (ext_insn, ext_src))
++            return true;
++        }
++    }
++  return false;
++}
++
++/* Return true if we don't want to place this
++   extension in the candidate extensions list because of the
++   next insn. Return false otherwise. */
++
++static bool
++ignore_extension_next_p (rtx ext_insn, rtx next_insn)
++{
++  rtx next = PATTERN (next_insn);
++  rtx ext = PATTERN (ext_insn);
++
++  if (GET_CODE (ext) != SET)
++    return false;
++
++  /* Check next insns */
++  if (!NONDEBUG_INSN_P (next_insn) || NOTE_P (next_insn))
++    return false;
++
++  if (GET_CODE (next) != SET)
++    return false;
++
++  /* zero-extend followed by left shift by 1 -- this sequence will be
++     detected by the insn selection. */
++  if (GET_CODE (SET_SRC (ext)) == ZERO_EXTEND)
++    {
++      if (GET_CODE (SET_SRC (next)) == ASHIFT
++          && CONST_INT_P (XEXP (SET_SRC (next), 1))
++          && UINTVAL (XEXP (SET_SRC (next), 1)) == 0x1)
++        return true;
++    }
++
++  return false;
++}
++
++/* Find extensions and store them in the extensions vector.  */
++
++static bool
++find_extensions (void)
++{
++  basic_block bb;
++  rtx insn, dest, inner;
++  int preserved_size;
++  ext_record_t extrec;
++
++  /* For all insns, call note_use for each use in insn.  */
++  FOR_EACH_BB (bb)
++  {
++    FOR_BB_INSNS (bb, insn)
++    {
++      if (!NONDEBUG_INSN_P (insn))
++        continue;
++
++      if (!extension_p (insn, &dest, &inner, &preserved_size))
++        {
++          continue;
++        }
++
++      /* We do not consider extensions that follow a load for
++         this target, as the code selector optimizes the sequence
++         to a load with sign extend or load with zero extend. */
++      if (PREV_INSN (insn)
++          && ignore_extension_prev_p (insn, PREV_INSN (insn)))
++        {
++          if (dump_file)
++            fprintf (dump_file, "extension at uid=%d ignored\n",
++                     INSN_UID (insn));
++          num_cand_ignored++;
++          continue;
++        }
++      /* We don't consider certain sequences that are picked up by
++         insn selection. */
++      if (NEXT_INSN (insn)
++          && ignore_extension_next_p (insn, NEXT_INSN (insn)))
++        {
++          if (dump_file)
++            fprintf (dump_file, "extension at uid=%d ignored\n",
++                     INSN_UID (insn));
++          num_cand_ignored++;
++          continue;
++        }
++
++      /* Only looking at sign extensions to DImode, SImode, or HImode  */
++      if (GET_MODE_BITSIZE (SImode) != preserved_size
++          && GET_MODE_BITSIZE (HImode) != preserved_size
++          && GET_MODE_BITSIZE (QImode) != preserved_size)
++        continue;
++
++      extrec = (ext_record_t) xmalloc (sizeof (struct ext_record));
++      extrec->ext = insn;
++      extrec->ext_uses = NULL;
++      extrec->ext_updates = NULL;
++      VEC_safe_push (ext_record_t, heap, extensions, extrec);
++      num_cand++;
++    }
++  }
++
++  if (dump_file)
++    {
++      if (!VEC_empty (ext_record_t, extensions))
++        fprintf (dump_file, "\n");
++      else
++        fprintf (dump_file, "no extensions found.\n");
++    }
++
++  return !VEC_empty (ext_record_t, extensions);
++}
++
++/* Return true if the rtx mode is a supported mode for
++   this optimization, false otherwise. */
++
++static bool
++mode_supported_p (rtx exp)
++{
++  if (GET_MODE (exp) != QImode
++      && GET_MODE (exp) != HImode
++      && GET_MODE (exp) != SImode 
++      && GET_MODE (exp) != DImode
++      && GET_MODE (exp) != CCmode
++      && GET_MODE (exp) != CCUNSmode)
++    return false;
++
++  return true;
++}
++
++/* Return true if the rtx is a function return expr, false otherwise */
++
++static bool
++return_val_p (rtx dest)
++{
++  if ((REG_P (dest) || GET_CODE (dest) == PARALLEL) &&
++      REG_FUNCTION_VALUE_P (dest))
++    {
++      return true;
++    }
++  return false;
++}
++
++
++/* A 'for_each_rtx' callback returning 1 if the rtx is a
++   REG or SUBREG rtx. The first matching rtx found stops the 
++   rtx traversal. */
++
++static int
++reg_or_subreg_rtx (rtx * x, void *data)
++{
++  regspec_cb_data_t *ldata = (regspec_cb_data_t *) data;
++
++  if (REG_P (*x))
++    {
++      ldata->exp = *x;
++      return 1;
++    }
++
++  if (GET_CODE (*x) == SUBREG)
++    {
++      ldata->exp = SUBREG_REG (*x);
++      return 1;
++    }
++
++  return 0;
++}
++
++/* A 'for_each_rtx' callback returning 1 if the rtx is a
++   REG or SUBREG rtx whose register number is that passed
++   in the data parameter. Data parameter's rtx value is
++   set to the matching rtx if found. */
++
++static int
++reg_or_subreg_rtx_regno (rtx * x, void *data)
++{
++  regspec_cb_data_t *ldata = (regspec_cb_data_t *) data;
++
++  if (REG_P (*x) && (REGNO (*x) == ldata->regno))
++    {
++      ldata->exp = *x;
++      return 1;
++    }
++  if (GET_CODE (*x) == SUBREG && (REGNO (SUBREG_REG (*x)) == ldata->regno))
++    {
++      ldata->exp = SUBREG_REG (*x);
++      return 1;
++    }
++  return 0;
++}
++
++/* Callback that counts the number of register operands
++   in an expression. Return 0 to allow all rtxs to be
++   traversed. */
++
++static int
++count_reg_operands (rtx * x, void *data)
++{
++  regspec_cb_data_t *ldata = (regspec_cb_data_t *) data;
++
++  if (register_exp (*x) != NULL)
++    {
++      ldata->regno++;
++    }
++  return 0;
++}
++
++/* Count the number of register operands in an expression.
++   We use the regspec_cb_data_t regno field as the number
++   of register operands we found in an expression. */
++
++static int
++num_reg_operands (rtx x)
++{
++  int rv;
++  regspec_cb_data_t data;
++  data.regno = 0;
++  data.exp = NULL_RTX;
++
++  if ((rv = for_each_rtx (&x, count_reg_operands, (void *) &data)) == 0)
++    return (data.regno);        /* contains the count */
++  else
++    return 0;
++}
++
++/* Find the SUBREG or REG rtx corresponding to regno in the given rtx.
++   Return NULL_RTX if the regno rtx is not found. */
++
++static rtx
++find_regspec_regno (unsigned int regno, rtx x)
++{
++  int rv;
++  regspec_cb_data_t data;
++  data.regno = regno;
++  data.exp = NULL_RTX;
++
++  if ((rv = for_each_rtx (&x, reg_or_subreg_rtx_regno, (void *) &data)) != 0)
++    return (data.exp);
++  else
++    return NULL_RTX;
++}
++
++/* Find a REG or SUBREG rtx, starting at expr x.
++   Return NULL_RTX if no REG or SUBREG rtx is found.
++   If found, the rtx returned is a REG (not SUBREG) */
++
++static rtx
++find_regspec (rtx x)
++{
++  int rv;
++  regspec_cb_data_t data;
++  data.regno = -1;              /* not used */
++  data.exp = NULL_RTX;
++
++  if ((rv = for_each_rtx (&x, reg_or_subreg_rtx, (void *) &data)) != 0)
++    return (data.exp);
++  else
++    return NULL_RTX;
++}
++
++/* Return true if the expression defines single register, regno. */
++
++static bool
++expr_defines_regno_p (rtx insn, unsigned int regno)
++{
++  rtx reg;
++  if (GET_CODE (insn) == SET)
++    {
++      reg = SET_DEST (insn);
++      if (find_regspec_regno (regno, reg) != NULL_RTX)
++        return true;
++    }
++  return false;
++}
++
++/* Return true if the insn defines a single register, regno.
++   Return false otherwise */
++
++static bool
++defines_regno_p (rtx insn_insn, unsigned int regno, int indent)
++{
++  extelim_uid_t uid = INSN_UID (insn_insn);
++  df_ref *p_def;
++
++  /* Get the operands defined */
++  p_def = DF_INSN_UID_DEFS (uid);
++
++  if (!p_def)
++    return false;
++
++  if (*(p_def + 1) != NULL)
++    {
++      if (dump_file)
++        fprintf (dump_file, "%*suid=%d defines multiple registers\n",
++                 indent, " ", uid);
++      return false;
++    }
++
++  if (DF_REF_REGNO (*p_def) != regno)
++    {
++      if (dump_file)
++        fprintf (dump_file, "%*suid=%d defines does not define %d\n",
++                 indent, " ", uid, regno);
++      return false;
++    }
++
++  return true;
++}
++
++/* The operand is already extended and the extension is compatible with
++   the originating extension with respect to type and size.
++   E.g. zero_extend:HI meets and AND r,#0xffff. Another example
++   is LSHIFT:SI left or right and zero_extend:SI, because the 
++   instruction selected is rlwinm and clears the upper 32 bits.
++   Other examples in the code. Return true if a compatible extension
++   is found, false otherwise. */
++
++static bool
++operand_is_extended (rtx dest, rtx srcexp, int indent)
++{
++  /* Output of a CALL is already extended. 
++     To ensure that the return value is not modified by the extend,
++     the extend from mode size must be at least the size of the CALL output. 
++     Example - this is redundant since output of CALL is extended.
++     X:SI = CALL ...
++     Y:DI = sign_extend:DI (X:SI) */
++  if (GET_CODE (srcexp) == CALL
++      && (GET_MODE_BITSIZE (ext_from_mode)) >=
++      GET_MODE_BITSIZE (GET_MODE (dest)))
++    {
++      if (dump_file)
++        fprintf (dump_file,
++                 "%*s...is extended already (CALL insn output)\n", indent,
++                 " ");
++      return true;
++    }
++
++  /* Output is load immediate or load constant */
++  if (CONST_INT_P (srcexp))
++    {
++      bool is_extended;
++      if (ext_from_mode == QImode && (UINTVAL (srcexp) <= 0xff))
++        is_extended = true;
++      else if (ext_from_mode == HImode && (UINTVAL (srcexp) <= 0xffff))
++        is_extended = true;
++      else if (ext_from_mode == SImode && (UINTVAL (srcexp) <= 0xffffffff))
++        is_extended = true;
++      else
++        is_extended = false;
++
++      if (is_extended)
++        {
++          if (dump_file)
++            fprintf (dump_file,
++                     "%*s... is extended already (CONST_INT load)\n", indent,
++                     " ");
++          return true;
++        }
++    }
++
++  /* Sign extension of the same type as the originating extension.
++     Here the candidate defines the register used in the originating extension.
++     The originating extension will be replaced by a copy if it is found to be
++     redundant with respect to the candidate extension. 
++     The candidate (this extension dest,src) must write the at least the same bits as the 
++     originating extension in order to be redundant. So, we follow these rules:
++
++     cand_to_mode == machine mode of the destination for this candidate extension
++     cand_from_mode == machine mode of the source for this candidate extension
++     ext_to_mode == machine mode of the originating extension output
++     ext_from_mode == machine mode of the originating extension input
++
++     SIZE(cand_to_mode) >= SIZE(extend_to_mode) && SIZE(cand_from_mode) <= SIZE(extend_from_mode)
++
++     Example 1:
++     Candidate (HI->SI extension)
++     DI       SI   HI QI 0
++     |        |<---|  |  |
++
++     Originating (SI->DI)
++     DI       SI   HI QI 0
++     |<-------|    |  |  |
++
++     Not redundant, candidate does not cover the original bits:
++     SIZE(cand_to_mode)[SI] !>= SIZE(extend_to_mode)[DI]
++
++     Example 2:
++     Candidate (QI->DI extension)
++     DI       SI   HI QI 0
++     |<-------|----|--|  |
++
++     Originating (HI->SI)
++     DI       SI   HI QI 0
++     |        |<---|  |  |
++
++     Redundant, candidate covers the original bits:
++     SIZE(cand_to_mode) [DI] >= SIZE(extend_to_mode) [SI]
++     AND
++     SIZE(cand_from_mode) [QI] <= SIZE(extend_from_mode) [HI]
++   */
++  if (GET_CODE (srcexp) == ext_code)
++    {
++      enum machine_mode cand_from_mode = GET_MODE (XEXP (srcexp, 0));
++      enum machine_mode cand_to_mode = GET_MODE (dest);
++      if ((GET_MODE_BITSIZE (cand_to_mode) >= GET_MODE_BITSIZE (ext_to_mode))
++          && (GET_MODE_BITSIZE (cand_from_mode) <=
++              GET_MODE_BITSIZE (ext_from_mode)))
++        {
++          if (dump_file)
++            fprintf (dump_file,
++                     "%*s...is already extended (redundant extension)\n",
++                     indent, " ");
++          return true;
++        }
++    }
++
++  /* Encountered an insn with the same effect as extension, e.g.
++     AND (regspec) (const_int). E.g. AND (reg:SI) (0x7fff) is equivalent
++     to ZERO_EXTEND:DI (reg:HI) or SIGN_EXTEND:DI (reg:HI). The code selection
++     for AND zero extends the entire register, so we don't have to
++     check that srcexp extends to at least ext_to_mode size. */
++  if ((GET_CODE (srcexp) == AND) && CONST_INT_P (XEXP (srcexp, 1)))
++    {
++      if (ext_from_mode == QImode && (UINTVAL (XEXP (srcexp, 1)) <= 0x7f))
++        return true;
++      else if (ext_from_mode == HImode
++               && (UINTVAL (XEXP (srcexp, 1)) <= 0x7fff))
++        return true;
++      else if (ext_from_mode == SImode
++               && (UINTVAL (XEXP (srcexp, 1)) <= 0x7fffffff))
++        return true;
++    }
++
++  return false;
++}
++
++/* Determine if the operation allows us to continue the propagation. 
++   We kill the propagation for all operations except copy. This
++   ensures that the extended operand that we may find eventually
++   is not modified by insns in the def-use chain. It's harsh,
++   but it's safest eliminate all but the most benign (copy) operations
++   in the propagation chain. */
++
++static bool
++continue_def_propagation (rtx srcexp)
++{
++  /* Only continue if its a copy -- that is, the srcexp is a register expression */
++  if ( register_exp (srcexp) )
++    return true;
++
++  return false;
++}
++
++/* Helper for insn_def_analysis_result.
++   The register operand, src is set here. Recall we
++   can only handle one register operand in the src expression.
++   We one of 3 states:
++   1) Determine the operand is extended, ...DEF_EXTENDED returned.
++   2) Determine the propagation can continue, ...DEF_CONTINUE_RECURSION returned. 
++   3) Otherwise, ...DEF_STOP_RECURSION is returned. */
++static enum insn_def_results
++insn_def_analysis_result_1 (rtx insn, bool treat_as_copy,
++                            unsigned int regno_def ATTRIBUTE_UNUSED,
++                            rtx * src, int indent)
++{
++  rtx dest, srcexp;
++  int num_operands;
++
++  /* Insn has to be an expression we can analyze */
++  if (GET_CODE (insn) != SET)
++    {
++      if (dump_file)
++        fprintf (dump_file, "%*s...is not a SET expression\n", indent, " ");
++      return EXTELIM_ANALYSIS_RESULT_DEF_STOP_RECURSION;
++    }
++  dest = SET_DEST (insn);
++  srcexp = SET_SRC (insn);
++
++  /* Dest must be a reg, not expression */
++  if (!REG_P (dest))
++    {
++      if (dump_file)
++        fprintf (dump_file,
++                 "%*s...dest is not a simple register\n", indent, " ");
++      return EXTELIM_ANALYSIS_RESULT_DEF_STOP_RECURSION;
++    }
++
++  /* First check whether the operand is extended already. If so,
++     we can leave immediately successfully. */
++  if (operand_is_extended (dest, srcexp, indent) && !treat_as_copy)
++    return (EXTELIM_ANALYSIS_RESULT_DEF_EXTENDED);
++
++
++  /* Failing to determine that the operand is already extended, 
++     we have to validate that we have register operands to propagate. */
++  num_operands = num_reg_operands (srcexp);
++
++  /* At least one register operand required for propagation. */
++  if (num_operands == 0)
++    {
++      if (dump_file)
++        fprintf (dump_file,
++                 "%*s...no register operands in RHS\n", indent, " ");
++      return EXTELIM_ANALYSIS_RESULT_DEF_STOP_RECURSION;
++    }
++
++  /* Only one register operand is allowed in the RHS since we can't
++     can't propagate more than one register. */
++  if (num_operands > 1)
++    {
++      if (dump_file)
++        fprintf (dump_file,
++                 "%*s...found multiple register operands in RHS\n", indent,
++                 " ");
++      return EXTELIM_ANALYSIS_RESULT_DEF_STOP_RECURSION;
++    }
++
++  /* Find the used operand in the src expression */
++  *src = find_regspec (srcexp);
++  if (*src == NULL_RTX || !mode_supported_p (*src))
++    {
++      if (dump_file)
++        fprintf (dump_file,
++                 "%*s...src operand reg=%d cannot be found or is unsupported mode\n",
++                 indent, " ", regno_def);
++      return EXTELIM_ANALYSIS_RESULT_DEF_STOP_RECURSION;
++    }
++
++  /* This is an extension, but it is previously marked to be transformed to a copy.
++     We just treat it as a copy even though it hasn't been transformed yet. So 
++     continue the propagation. */
++  if (treat_as_copy)
++    {
++      if (dump_file)
++        fprintf (dump_file,
++                 "%*s...%s is treated as a copy (marked for replace)\n",
++                 indent, " ", GET_RTX_NAME (GET_CODE (srcexp)));
++      return (EXTELIM_ANALYSIS_RESULT_DEF_CONTINUE_RECURSION);
++    }
++
++  /* Validate that it's ok to continue propagation with this operand. */
++  if (continue_def_propagation (srcexp))
++    return (EXTELIM_ANALYSIS_RESULT_DEF_CONTINUE_RECURSION);
++
++  /* Else we default to halting the search for a redundant extension */
++  return (EXTELIM_ANALYSIS_RESULT_DEF_STOP_RECURSION);
++}
++
++/* Determine if the insn extends it's destination register in
++   a manner such that the original extension is redundant. */
++
++static enum insn_def_results
++insn_def_analysis_result (rtx insn_insn, unsigned int regno_def, rtx * src,
++                          int indent)
++{
++  bool treat_as_copy = false;
++
++  /* Insn must only define one output */
++  if (!defines_regno_p (insn_insn, regno_def, indent))
++    {
++      if (dump_file)
++        fprintf (dump_file,
++                 "%*s...defines more than 1 output\n", indent, " ");
++      return EXTELIM_ANALYSIS_RESULT_DEF_STOP_RECURSION;
++    }
++
++  /* We want to treat this extension as a copy and continue propagation.
++     Otherwise, it would be detected again as redundant. */
++  if (insn_flag_p (EXTELIM_REPLACE_COPY, INSN_UID (insn_insn)))
++    {
++      if (dump_file)
++        fprintf (dump_file,
++                 "%*suse at uid=%d is marked to transform to copy\n", indent,
++                 " ", INSN_UID (insn_insn));
++      treat_as_copy = true;
++    }
++
++  /* Do the analysis */
++  return (insn_def_analysis_result_1
++          (PATTERN (insn_insn), treat_as_copy, regno_def, src, indent));
++}
++
++/* Analyze each of the expressions in a PARALLEL expression. As each of
++   the expressions may yield a different state, select the most conservative
++   state to return. */
++
++static enum insn_def_results
++insn_def_analysis_2 (rtx insn_def, unsigned int regno_def, rtx * src,
++                     int indent)
++{
++  int i;
++  rtx insn = PATTERN (insn_def);
++  enum insn_def_results action;
++  enum insn_def_results return_action =
++    EXTELIM_ANALYSIS_RESULT_DEF_STOP_RECURSION;
++
++  gcc_assert (GET_CODE (insn) == PARALLEL);
++
++  for (i = XVECLEN (insn, 0) - 1; i >= 0; i--)
++    {
++      rtx body = XVECEXP (insn, 0, i);
++      /* Only act on the expressions that define regno_def */
++      if (!expr_defines_regno_p (body, regno_def))
++        continue;
++      /* Determine the next action */
++      action = insn_def_analysis_result_1 (body, false /* treat_as_copy */ ,
++                                           regno_def, src, indent);
++      /* The result of this expression stops the recursion, i.e. no
++         longer reasonable to continue looking at further recursion. */
++      if (action == EXTELIM_ANALYSIS_RESULT_DEF_STOP_RECURSION)
++        return action;
++      /* Only return EXTENDED if there are no other different actions
++         in the series. Otherwise, CONTINUE_RECURSION is returned. */
++      if (action == EXTELIM_ANALYSIS_RESULT_DEF_CONTINUE_RECURSION)
++        return_action = action;
++      else if (return_action ==
++               EXTELIM_ANALYSIS_RESULT_DEF_CONTINUE_RECURSION)
++        return_action = EXTELIM_ANALYSIS_RESULT_DEF_CONTINUE_RECURSION;
++      else
++        return_action = action;
++    }
++  return (return_action);
++}
++
++/* Helper 1 for insn_def_analysis */
++
++static enum insn_def_results
++insn_def_analysis_1 (rtx insn_def, unsigned int regno_def, rtx * src,
++                     int indent)
++{
++  rtx def = PATTERN (insn_def);
++  enum insn_def_results action;
++
++  switch (GET_CODE (def))
++    {
++    case PARALLEL:
++      action = insn_def_analysis_2 (insn_def, regno_def, src, indent);
++      break;
++    default:
++      action = insn_def_analysis_result (insn_def, regno_def, src, indent);
++      break;
++    }
++  return action;
++}
++
++/* We look at the definition of a register that is either the
++   sign or zero extend source register or a definition that that
++   has been propagated to here via analyze_ext_def. The objective
++   is to determine, by looking at the operation and operands, whether
++   the register is sign/zero extended by virtue of the operation and/or
++   operands. If so, the original extension is redundant.
++   The function returns one of 3 possible states after analyzing the
++   insn:
++   1. EXTELIM_ANALYSIS_RESULT_DEF_EXTENDED - we determined that the
++   insn does indeed extend the original source extension register.
++   analyze_ext_def returns FALSE, therefore, ending the recursion
++   and propagation.
++   2. EXTELIM_ANALYSIS_RESULT_DEF_STOP_RECURSION - we determined that 
++   the insn does not meet the criteria to continue the recursive search.
++   Some conditions causing this may be multiple operands defining this
++   register (we only propagate on a single input operand) or the insn
++   defines more than one output or the operation does not allow
++   a previous extension to propagate, e.g. an arithmetic shift on
++   a SI value clears the upper bits using rlwinm. MUL, DIV, MOD
++   stop recursion because the result is longer than the input size,
++   thus impacting the possible previous extension.
++   3. EXTELIM_ANALYSIS_RESULT_DEF_CONTINUE_RECURSION - we found an
++   operation with one register operand and the operation will not
++   affect a previous extension if one exists. ADD, SUB are examples.
++   We continue looking up the chain at the definition of the operand
++   for an extended result. 
++   If we run into a previous extension marked for replacement during
++   recursion, we treat it as a copy (CONTINUE_RECURSION since the
++   extension is preserved by the copy). */
++
++static enum insn_def_results
++insn_def_analysis (rtx insn_def, unsigned int regno_def, rtx * src,
++                   int indent)
++{
++  return (insn_def_analysis_1 (insn_def, regno_def, src, indent));
++}
++
++/* Analyze the insn defining the source of the sign extension.
++   If it can be determined that the definition is already
++   sign extended, return false. Otherwise, return true if 
++   extension is needed. */
++
++static bool
++analyze_ext_def (rtx insn_def, unsigned int regno_def, int indent)
++{
++  extelim_uid_t uid;
++  rtx def = PATTERN (insn_def);
++  rtx src;
++  df_ref df_def, *p_use;
++  bool ext_needed, indent_once;
++  struct df_link *link;
++  enum insn_def_results analysis_result;
++
++  gcc_assert (def != NULL);
++
++  uid = INSN_UID (insn_def);
++
++  /* If we seen the originating extension again, return false (ext not needed) */
++  if (current_ext_record->ext == insn_def)
++    {
++      if (dump_file)
++        fprintf (dump_file,
++                 "%*sdef at uid=%d is original extension\n", indent, " ", uid);
++      return false;
++    }
++
++  /* The recursion has to definitively end with an operand being
++     extended (and compatible with the originating extension). If
++     we see the insn again, this could return a faulty positive (false),
++     so we return true here instead of false. See pr43017 (-funroll-loops)
++     as an example. */
++  if (insn_flag_p (EXTELIM_SEEN, uid))
++    {
++      if (dump_file)
++        fprintf (dump_file,
++                 "%*sdef at uid=%d is visited already\n", indent, " ", uid);
++      return true;
++    }
++
++  /* Mark this insn as seen */
++  insn_flag_set (EXTELIM_SEEN, uid);
++
++  analysis_result = insn_def_analysis (insn_def, regno_def, &src, indent);
++  switch (analysis_result)
++    {
++      /* We know conclusively that the register defined in this expression
++         is already extended. */
++    case EXTELIM_ANALYSIS_RESULT_DEF_EXTENDED:
++      if (dump_file)
++        fprintf (dump_file, "%*sdef at uid=%d is extended\n", indent, " ",
++                 uid);
++      return false;
++      break;
++      /* We know conclusively that we cannot continue the recursion. Perhaps 
++         the expression defines multiple registers, etc. */
++    case EXTELIM_ANALYSIS_RESULT_DEF_STOP_RECURSION:
++      if (dump_file)
++        fprintf (dump_file, "%*sdef at uid=%d cannot be propagated\n", indent,
++                 " ", uid);
++      return true;
++      break;
++      /* Continue to look at the operands of this expression. They may be extended
++         already. */
++    case EXTELIM_ANALYSIS_RESULT_DEF_CONTINUE_RECURSION:
++      break;
++    default:
++      gcc_unreachable ();
++    }
++
++  /* This is the operand for which we want to find definitions. There should
++     only be one operand as we have previously checked for operations with only
++     one register operand as the src previously. */
++  p_use = DF_INSN_UID_USES (uid);
++  gcc_assert (p_use != NULL);
++
++  /* Make sure that this use is the one returned in src. Otherwise we simply
++     stop the propagation. Note the DF_INSN_UID_USES works at the insn
++     level, so a PARALLEL pattern may return many uses, hence the need
++     to validate the correct use here. */
++  if ((*p_use == NULL) || (DF_REF_REGNO (*p_use) != REGNO (src)))
++    return true;
++
++  ext_needed = true;
++  indent_once = true;
++  for (link = DF_REF_CHAIN (*p_use); link; link = link->next)
++    {
++      rtx insn_def;
++      df_def = link->ref;
++      if (!df_def)
++        continue;
++      /* Link must be to a definition of the use */
++      if (!DF_REF_REG_DEF_P (df_def))
++        continue;
++      /* Ignore ARTIFICIAL defs */
++      if (DF_REF_IS_ARTIFICIAL (df_def))
++        continue;
++      insn_def = DF_REF_INSN (df_def);
++      /* Don't consider debug_insns */
++      if (!NONDEBUG_INSN_P (insn_def))
++        continue;
++      if (dump_file)
++        fprintf (dump_file,
++                 "%*sdef of reg=%d at uid=%d\n", indent, " ",
++                 DF_REF_REGNO (df_def), INSN_UID (insn_def));
++      /* Set indent for dump formatting */
++      if (indent_once)
++        {
++          ++indent;
++          indent_once = false;
++        }
++      ext_needed = analyze_ext_def (insn_def, DF_REF_REGNO (df_def), indent);
++      if (ext_needed)
++        break;
++    }
++
++  if (dump_file)
++    fprintf (dump_file,
++             "%*sext %s needed\n", indent, " ", ext_needed ? "" : "not");
++
++  return ext_needed;
++}
++
++/* Determine whether the expression needs to be saved for this extension.
++   The expression will be updated in some way if the extension is ultimately
++   eliminated. */
++
++static bool
++exp_needs_update_p (rtx exp)
++{
++  if (GET_CODE (exp) == SUBREG
++      && (SUBREG_PROMOTED_VAR_P (exp)))
++    {
++      return true;
++    }
++  return false;
++}
++
++/* Some expressions may need to be updated if the originating extension
++   is eliminated. For example, SUBREG_PROMOTED flags on uses are no longer
++   valid if the extension is eliminated. Save the expression here. */
++
++static void
++save_ext_update (ext_record_t extrec, rtx exp)
++{
++  /* Save this expression to be updated if the extension is eliminated. */
++  VEC_safe_push (rtx, heap, extrec->ext_updates, exp);
++}
++
++/* Check a compare operation to determine whether the operands
++   of the compare use the upper bits of the extension. Return
++   true if the upper bits are not relevant in the compare, false
++   otherwise. */
++
++static bool
++check_compare (rtx dest, rtx src)
++{
++  /* Detect 
++     (set (reg:CC r0) (compare:CC (REGSPEC) (REGSPEC)))
++     or
++     (set (reg:CC r0) (compare:CC (REGSPEC) (CONST)))
++     where REGSPEC is (reg:mm r) or (subreg:mm (reg:MM r) n) 
++     CONST is a constant integer.
++     The mode size of compare ops must be less than the
++     mode of the original extension for the upper bits to
++     be irrelevant. 
++     An exception is made for mode sizes less than a word size.
++     For our targets, there is no 'cmph' insn, so we bail out 
++     if we see a comparison of sizes less than a word (SI). */
++  if (REG_P (dest)
++      && (GET_MODE (dest) == CCmode || GET_MODE (dest) == CCUNSmode)
++      && GET_CODE (src) == COMPARE
++      && (GET_MODE (src) == CCmode || GET_MODE (src) == CCUNSmode))
++    {
++      rtx compare_op0 = XEXP (src, 0);
++      rtx compare_op1 = XEXP (src, 1);
++
++      /* Check the first operand, op0, size. */
++      if ((REG_P (compare_op0) || GET_CODE (compare_op0) == SUBREG)
++          && (GET_MODE_BITSIZE (GET_MODE (compare_op0)) <=
++              GET_MODE_BITSIZE (ext_from_mode)))
++        {
++          /* Half word compares and smaller are performed as word compares, so upper bits are used. */
++          if (GET_MODE_BITSIZE (GET_MODE (compare_op0)) < SImode)
++            return false;
++
++          /* Now check the other operand, op1. */
++          if ((REG_P (compare_op1) || GET_CODE (compare_op1) == SUBREG)
++              && (GET_MODE_BITSIZE (GET_MODE (compare_op1)) <=
++                  GET_MODE_BITSIZE (ext_from_mode)))
++            return true;
++
++          /* Compare to constant, we know op0 already meets size constraints. */
++          if (CONST_INT_P (compare_op1))
++            return true;
++        }
++    }
++  return false;
++}
++
++/* Determine condition a, whether the upper bits are relevant to the operation.
++   Return false if we prove the upper bits are not relevant in the operation,
++   true otherwise. */
++
++static bool
++operation_uses_upper_bits (rtx dest, rtx src, unsigned int regno_use,
++                           int indent ATTRIBUTE_UNUSED)
++{
++  rtx regspec_src = find_regspec_regno (regno_use, src);
++
++  if (check_compare (dest, src))
++    return false;
++
++  /* Store of regno to mem, size stored is the same or smaller than the extended from size */
++  if (MEM_P (dest)
++      && (GET_MODE_BITSIZE (GET_MODE (dest)) <=
++          GET_MODE_BITSIZE (ext_from_mode))
++      /* Ensure the used register is being stored and not used in another capacity, say, as a pointer. */
++      && (regspec_src))
++    return false;
++
++  /* Operation operand size is the same or smaller than the extended from size */
++  if (regspec_src)
++    {
++      if (GET_MODE_BITSIZE (GET_MODE (regspec_src)) <=
++          GET_MODE_BITSIZE (ext_from_mode))
++        return false;
++    }
++
++  /* Default to the safest result */
++  return true;
++}
++
++/* Determine if this insn also extends to the size or greater of the original extension.
++   Sign extend can propagate to zero extend and vice-versa because the upper bits
++   haven't affected the low bits up to now throughout the propagation. */
++
++static bool
++operation_extends_to_upper_bits_size (rtx src, int indent ATTRIBUTE_UNUSED)
++{
++  /* Sign extension of the same type as the originating extension.
++     Here the candidate uses the register defined by the originating extension.
++     If the candidate is found to be redundant, the originating extension is
++     replaced with a copy.
++
++     We follow these rules:
++
++     dest_mode == machine mode of the destination for this candidate extension
++     (it's the same mode as the src, e,g, reg:DI = sign_extend:DI ...)
++     src_mode == machine mode of the source for this candidate extension
++     (the mode of the used register, SI in this case, e.g. reg:DI = sign_extend:DI (subreg:SI (reg:DI))
++     ext_to_mode == machine mode of the originating extension output
++     ext_from_mode == machine mode of the originating extension input
++
++     SIZE(cand_from_mode) >= SIZE(extend_from_mode) && SIZE(cand_to_mode) <= SIZE(extend_to_mode)  
++
++     Example 1:
++     Originating (SI->DI)
++     DI       SI   HI QI 0
++     |<-------|    |  |  |
++
++     Candidate (HI->SI extension)
++     DI       SI   HI QI 0
++     |        |<---|  |  |
++
++     Not redundant, candidate does not cover the original bits:
++     SIZE(dest_mode)[SI] !<= SIZE(extend_to_mode)[DI]
++
++     Example 2:
++     Originating (HI->SI)
++     DI       SI   HI QI 0
++     |        |<---|  |  |
++
++     Candidate (QI->DI extension)
++     DI       SI   HI QI 0
++     |<-------|----|--|  |
++
++     Redundant, candidate covers the original bits:
++     SIZE(cand_to_mode) [DI] >= SIZE(extend_to_mode) [SI]
++     AND
++     SIZE(cand_from_mode) [QI] <= SIZE(extend_from_mode) [HI] */
++  if (GET_CODE (src) == ext_code)
++    {
++      /* Extend is redundant if we don't overwrite the source of the
++         previous extension and extends to at least the extent of the original. */
++      enum machine_mode cand_from_mode = GET_MODE (XEXP (src, 0));
++      enum machine_mode cand_to_mode = GET_MODE (src);
++      if (GET_MODE_BITSIZE (cand_from_mode) >=
++          GET_MODE_BITSIZE (ext_from_mode)
++          && (GET_MODE_BITSIZE (cand_to_mode) <=
++              GET_MODE_BITSIZE (ext_to_mode)))
++        return true;
++    }
++
++  /* Encountered an insn with the same effect as extension, e.g.
++     AND (regspec) (const_int). E.g. AND (reg:SI) (0xffff) is equivalent
++     to ZERO_EXTEND:DI (reg:HI) */
++  if ((GET_CODE (src) == AND) && CONST_INT_P (XEXP (src, 1)))
++    {
++      /* Extends to at least the original extension size */
++      if (GET_MODE_BITSIZE (GET_MODE (src)) >= GET_MODE_BITSIZE (ext_to_mode))
++        {
++          if (ext_from_mode == QImode && (UINTVAL (XEXP (src, 1)) <= 0xff))
++            return true;
++          else if (ext_from_mode == HImode
++                   && (UINTVAL (XEXP (src, 1)) <= 0xffff))
++            return true;
++          else if (ext_from_mode == SImode
++                   && (UINTVAL (XEXP (src, 1)) <= 0xffffffff))
++            return true;
++          else
++            return false;
++        }
++    }
++  return false;
++}
++
++/* Determine whether the operation's upper bits subtly or overtly affects the low bits. */
++
++static bool
++operation_implicitly_affects_lowbits (rtx dest, rtx src,
++                                      unsigned int regno_use, int indent)
++{
++  rtx regspec = find_regspec_regno (regno_use, src);
++
++  /* First, a return expression must be assumed to affect the lowbits as the return value
++     must be extended properly. */
++  if (return_val_p (dest))
++    {
++      if (dump_file)
++        {
++          fprintf (dump_file, "%*sDestination is a return value\n", indent,
++                   " ");
++        }
++      return true;
++    }
++
++  /* These operations implicitly affect the lowbits, except where noted. */
++  switch (GET_CODE (src))
++    {
++    case MULT:
++    case DIV:
++    case UDIV:
++    case UMOD:
++    case MOD:
++      /* Normally, yes, these operations return true (affects low bits). But when the 
++         the operand size is less than or equal to the "low bits" size AND the operation size
++         is the same as the operand size, the operation is performed only on the "low bits"
++         and the "upper bits" do not contribute to the output. */
++      if (regspec
++          && (GET_MODE_BITSIZE (GET_MODE (regspec)) <=
++              GET_MODE_BITSIZE (ext_from_mode))
++          && GET_MODE_BITSIZE (GET_MODE (src)) ==
++          GET_MODE_BITSIZE (GET_MODE (regspec)))
++        return false;
++      return true;
++
++      break;
++      /* Shift rights normally affect the low bits. There can be special cases where this
++         is not true, such a the operand size is smaller than the extended from size, e.g.
++         set (reg:SI Y) (zero_extend:SI (subreg:HI (reg:SI X)))
++         set (reg:QI Z) (lshiftrt (subreg:QI (reg:SI Y))
++         The shift of the QI data is not affected by the extension of HI data unless the
++         shift is large enough to encroach into the QI bits. This seems rare and I do not
++         check for it. */
++    case LSHIFTRT:
++    case ASHIFTRT:
++      return true;
++      break;
++      /* Other operations are known not to impact the low bits */
++    default:
++      return false;
++    }
++
++}
++
++/* The operation directly defines a propagatable output. Several
++   operations do not define such output. E.g. MEM (loads) do not
++   define an output based on the operation. USE is another example,
++   as it isn't a real operation. */
++
++static bool
++operation_directly_defines_an_output (rtx dest, rtx src,
++                                      int indent ATTRIBUTE_UNUSED)
++{
++  switch (GET_CODE (src))
++    {
++    case REG:
++    case SUBREG:
++    case PLUS:
++    case MINUS:
++    case NEG:
++    case MULT:
++    case DIV:
++    case MOD:
++    case UDIV:
++    case UMOD:
++    case AND:
++    case IOR:
++    case XOR:
++    case NOT:
++    case ASHIFT:
++    case ROTATE:
++    case ASHIFTRT:
++    case LSHIFTRT:
++    case ROTATERT:
++    case SIGN_EXTEND:
++    case ZERO_EXTEND:
++    case TRUNCATE:
++      return true;
++      break;
++      /* OK to propagate if the output of IF_THEN_ELSE is a register */
++    case IF_THEN_ELSE:
++      if (REG_P (dest))
++        return true;
++      break;
++      /* All others are assumed not to generate a normal output */
++    default:
++      break;
++    }
++  return false;
++}
++
++/* Helper for insn_use_analysis_result */
++
++static enum insn_use_results
++insn_use_analysis_result_1 (rtx insn, bool treat_as_copy,
++                            unsigned int regno_use, rtx * dest, int indent)
++{
++  rtx src;
++  bool cond_a, cond_b, cond_c, cond_d;
++
++  if (GET_CODE (insn) != SET)
++    return EXTELIM_ANALYSIS_RESULT_LOWBITS_AFFECTED;
++
++  *dest = SET_DEST (insn);
++  src = SET_SRC (insn);
++
++  /* Bail out on inline assembly also */
++  if (GET_CODE (src) == ASM_INPUT || GET_CODE (src) == ASM_OPERANDS)
++    return EXTELIM_ANALYSIS_RESULT_LOWBITS_AFFECTED;
++
++  /* Bail out on non supported types */
++  if (!mode_supported_p (*dest))
++    return EXTELIM_ANALYSIS_RESULT_LOWBITS_AFFECTED;
++
++  /* First, we determine cond_c (is a redundant extension) because it gates the
++     other conditions. */
++  if ((cond_c = operation_extends_to_upper_bits_size (src, indent)))
++    {
++      if (treat_as_copy)
++        {
++          if (dump_file)
++            fprintf (dump_file,
++                     "%*s...%s is treated as a copy (marked for replace)\n",
++                     indent, " ", GET_RTX_NAME (GET_CODE (src)));
++          return EXTELIM_ANALYSIS_RESULT_CONTINUE_RECURSION;
++        }
++
++      if (dump_file)
++        fprintf (dump_file,
++                 "%*s...%s is a redundant extension\n",
++                 indent, " ", GET_RTX_NAME (GET_CODE (src)));
++      return EXTELIM_ANALYSIS_RESULT_LOWBITS_NOT_AFFECTED;
++    }
++
++  cond_a = operation_uses_upper_bits (*dest, src, regno_use, indent);
++
++  cond_b =
++    operation_implicitly_affects_lowbits (*dest, src, regno_use, indent);
++
++  cond_d = operation_directly_defines_an_output (*dest, src, indent);
++
++  /* Operation implicitly affects low bits */
++  if (cond_b)
++    {
++      if (dump_file)
++        fprintf (dump_file,
++                 "%*s...%s implicitly affects low bits\n",
++                 indent, " ", GET_RTX_NAME (GET_CODE (src)));
++      return EXTELIM_ANALYSIS_RESULT_LOWBITS_AFFECTED;
++    }
++
++  /* Neither cond_a nor cond_b affects the low bits */
++  if (!cond_a)
++    {
++      if (dump_file)
++        fprintf (dump_file,
++                 "%*s...%s does not use upper bits\n",
++                 indent, " ", GET_RTX_NAME (GET_CODE (src)));
++      return EXTELIM_ANALYSIS_RESULT_LOWBITS_NOT_AFFECTED;
++    }
++
++  /* To continue recursion, the operation must define a 
++     meaningful output. */
++  if (!cond_d)
++    {
++      if (dump_file)
++        fprintf (dump_file,
++                 "%*s...%s does not define a propagatable output\n",
++                 indent, " ", GET_RTX_NAME (GET_CODE (src)));
++      return EXTELIM_ANALYSIS_RESULT_LOWBITS_AFFECTED;
++    }
++
++  /* This leaves cond_a, meaning we need to continue down the chain
++     to see if the low bits are ultimately affected by the upper bits. */
++  return EXTELIM_ANALYSIS_RESULT_CONTINUE_RECURSION;
++}
++
++/* Determine the action based on the insn conditions. The truth table is
++   simplified using if statements. Insns previously marked for replace by copy
++   are identified, these will be essentially be treated as copies now and not
++   be detected as redundant for this use. */
++static enum insn_use_results
++insn_use_analysis_result (rtx insn_insn, unsigned int regno_use, rtx * dest,
++                          int indent)
++{
++  bool treat_as_copy = false;
++  if (insn_flag_p (EXTELIM_REPLACE_COPY, INSN_UID (insn_insn)))
++    {
++      if (dump_file)
++        fprintf (dump_file,
++                 "%*suse at uid=%d is marked to transform to copy\n", indent,
++                 " ", INSN_UID (insn_insn));
++      treat_as_copy = true;
++    }
++  return (insn_use_analysis_result_1
++          (PATTERN (insn_insn), treat_as_copy, regno_use, dest, indent));
++}
++
++/* We have to analyze each expression action in a PARALLEL series.
++   Return the appropriate action for a series of expressions in a PARALLEL insn. 
++   LOWBITS_AFFECTED stops the loop. This leaves only CONTINUE_RECURSION
++   or LOWBITS_NOT_AFFECTED. LOWBITS_NOT_AFFECTED is only returned
++   if there are no other different actions in the series (no CONTINUE_RECURSION
++   states). For each CONTINUE_RECURSION action we encounter, the destination
++   registers must be identical since we can only propagate one use (one definition
++   of dest) should CONTINUE_RECURSION be returned. */
++
++static enum insn_use_results
++analyze_action (enum insn_use_results cur_action,
++                enum insn_use_results prev_action,
++                rtx * dest, rtx * prev_dest)
++{
++  enum insn_use_results return_action;
++
++  if (cur_action == EXTELIM_ANALYSIS_RESULT_LOWBITS_AFFECTED)
++    return cur_action;
++
++  if (cur_action == EXTELIM_ANALYSIS_RESULT_CONTINUE_RECURSION)
++    return_action = cur_action;
++  else if (prev_action == EXTELIM_ANALYSIS_RESULT_CONTINUE_RECURSION)
++    return_action = EXTELIM_ANALYSIS_RESULT_CONTINUE_RECURSION;
++  else
++    return_action = cur_action;
++
++  if (return_action == EXTELIM_ANALYSIS_RESULT_CONTINUE_RECURSION)
++    {
++      if (*prev_dest)
++        {
++          /* All bets off if the series defines multiple outputs */
++          if (*prev_dest != *dest)
++            return_action = EXTELIM_ANALYSIS_RESULT_LOWBITS_AFFECTED;
++        }
++    }
++  /* Set prev_dest */
++  *prev_dest = *dest;
++
++  return return_action;
++}
++
++/* Helper 2 for insn_use_analysis. Return the appropriate action
++   for a series of expressions in a PARALLEL insn. */
++
++static enum insn_use_results
++insn_use_analysis_2 (rtx insn_use, unsigned int regno_use, rtx * dest,
++                     int indent)
++{
++  int i;
++  rtx insn = PATTERN (insn_use);
++  rtx prev_dest = NULL_RTX;
++  enum insn_use_results action;
++  enum insn_use_results return_action =
++    EXTELIM_ANALYSIS_RESULT_LOWBITS_NOT_AFFECTED;
++
++  gcc_assert (GET_CODE (insn) == PARALLEL);
++
++  /* We make a quick decision about call_insns here. Since the use reached
++     a call, we assume it's an outgoing parameter and thus must be extended
++     as per the ABI. */
++  if (CALL_P (insn_use))
++    {
++      if (dump_file)
++        fprintf (dump_file, "%*s...is a call parameter\n", indent, " ");
++      return EXTELIM_ANALYSIS_RESULT_LOWBITS_AFFECTED;
++    }
++
++  for (i = XVECLEN (insn, 0) - 1; i >= 0; i--)
++    {
++      rtx body = XVECEXP (insn, 0, i);
++      /* Only act on the expressions containing a use of regno_use. */
++      if (regno_use_in (regno_use, body) == NULL_RTX)
++        continue;
++
++      /* Determine the next action */
++      action = insn_use_analysis_result_1 (body, false /* treat as copy */ ,
++                                           regno_use, dest, indent);
++
++      /* Here we make a decision on the return action based on the previous actions.
++         This is done to accomodate different actions from different elements in the
++         PARALLEL series of expressions. */
++      return_action =
++        analyze_action (action, return_action, dest, &prev_dest);
++
++      /* The result of this expression stops the recursion, i.e.  "low bits"
++         are affected by the operation. */
++      if (return_action == EXTELIM_ANALYSIS_RESULT_LOWBITS_AFFECTED)
++        break;
++    }
++  return (return_action);
++}
++
++/* Helper 1 for insn_use_analysis */
++
++static enum insn_use_results
++insn_use_analysis_1 (rtx insn_use, unsigned int regno_use, rtx * dest,
++                     int indent)
++{
++  rtx use = PATTERN (insn_use);
++  enum insn_use_results action;
++
++  switch (GET_CODE (use))
++    {
++    case PARALLEL:
++      action = insn_use_analysis_2 (insn_use, regno_use, dest, indent);
++      break;
++    default:
++      action = insn_use_analysis_result (insn_use, regno_use, dest, indent);
++      break;
++    }
++
++  return action;
++}
++
++/* Analyze the insn and determine the next course of action in the
++   use analysis loop.
++   There are several conditions to consider:
++
++   1. The "extended from" mode. This is an enum machine_mode value
++   that determines what is the size extended. It is derived from the
++   source of the original extension. It is the "low bits" value.
++   It is these range of bits that cannot be affected by the operation's
++   "upper bits" in order to determine whether the extend is useful or not.
++   Examples: 
++   (1) set (reg:DI Y (zero_extend:DI (subreg:QI (reg:DI X))) ==> low bits = QI
++   (2) set (reg:SI Y (sign_extend:SI (reg:HI X) ==> low bits = HI
++
++   2. The "extend to" mode. This is the size extended to in the original
++   extension. It is the "upper bits" value. The entire extended to size may 
++   be used subsequently or it may be subreg'd to a smaller or larger sizes 
++   later in the propagation.
++   For example (1) above, "upper bits" is DI, and (2) "upper bits" is SI.
++
++   3. The code, ext_code, of the original extension, either ZERO_EXTEND or SIGN_EXTEND.
++
++   4. Operation code. For an insn, the actual operation code corresponding to
++   a machine instruction. For certain codes, we know that the "low bits" of the
++   result are modified by the insn because of the values in the "upper bits" of the
++   input operand. We say the operation implicitly uses the "upper bits" to modify the
++   "low bits". For other codes, the "upper bits" do not affect the output result
++   in the "low bits". 
++
++   If the operation does implicitly use the "upper bits" to modify
++   the "low bits", it is instantly a deal killer. The original extension must be 
++   preserved. 
++
++   If the operation does not implicitly use "upper bits" to modify the "low bits",
++   then the action to take depends on the operation operand size relative to 
++   "low bits" size.
++
++   We only want to deal with codes that map to real instructions,
++   like ADD, SUB, MULT, LSHIFTRT, etc. Codes such as PARALLEL, etc. do not map to
++   instruction and must be dissected to extract the real instructions.
++
++   Furthermode, for recursion to continue, the operation and operand must define
++   an output related to the input operand (the use register). This doesn't happen
++   for operations such as "mem" where the output is indirectly related to the
++   input operand. 
++
++   5. Operation mode. The operation mode of the operation code. This sometimes impacts
++   the effect of the operation. For example MULT:SI and MULT:DI map to two different
++   machine instructions and both may have operands of SI mode. However, the MULT:SI 
++   results will be oblivious to the upper bits of the DI register whereas, SI part of
++   MULT:DI result will be affected by the upper bits of the DI register.
++
++   Several conditions determine the action to take based on the various inputs.
++
++   The truth table inputs are A, B, and C. The truth table output is the action to take. 
++
++   A. True if the used operand mode size is greater than the extended_from ("low bits") mode size.
++   B. True if the operation implicitly uses upper bits to define the low bits  
++   C. True if the operation also extends the output to upper bits size
++   D. True if the operation and input operand directly define an output operand.
++
++   Condition A. means the upper bits are in use in the operation. The extend _may_ be needed, 
++   all things being equal, so the action would be to continue recursion to the use of the
++   defined operand, i.e. return CONTINUE_RECURSION.
++
++   Condition B. means the "low bits" are modified by the extended portion of the register
++   by virtue of the operation. For example, logical shift right, where the extended
++   portion is shifted into the "low bits". Another example, multiply, where the machine
++   uses the extended portion implicitly to calculate the results, some of which are 
++   reflected in the "low bits" of the result. The extension is definitely needed in these 
++   cases for this use, so return LOWBITS_AFFECTED. Recursion is stopped and analysis of 
++   this extension is halted.
++
++   Condition C. means the operation and it's operands perform the same extension as
++   the originating extension. The operation must extend to the same size _or higher_ of
++   the original extension. In this case, the original extension is truly redundant and
++   we return LOWBITS_NOT_AFFECTED for this use.
++
++   Condtion D. means the operation and operand directly define an output operand. For most
++   arithmetic and unary operations this is true. For mem and other internal operations,
++   e.g. USE, this is false.
++
++      Condition                      Action                 Comments
++    ==================================================================
++    A.     B.     C.     D.
++    ------------------------------------------------------------------
++    X      X      true   true     LOW_BITS_NOT_AFFECTED  extend is redundant
++    ------------------------------------------------------------------
++    false  false  false  X        LOW_BITS_NOT_AFFECTED  used operand is smaller than "low bits"
++    ------------------------------------------------------------------
++    false  true   false  true     LOW_BITS_AFFECTED      "low bits" modified implicitly by operation
++    ------------------------------------------------------------------
++    true   false  false  true     CONTINUE_RECURSION     "low bits" _may_ be impacted by next uses
++    ------------------------------------------------------------------
++    true   true   false  true     LOW_BITS_AFFECTED      "low bits" modified implicitly by operation */
++
++static enum insn_use_results
++insn_use_analysis (rtx insn_use, unsigned int regno_use, rtx * dest,
++                   int indent)
++{
++  return (insn_use_analysis_1 (insn_use, regno_use, dest, indent));
++}
++
++/* Analyze the operation and operands of this use of a sign extension
++   target register. If the target register's upper bits do not
++   affect the result of the operation, then the sign extension is
++   useless. Returns true if the extension is needed, false 
++   otherwise. */
++
++static bool
++analyze_ext_use (rtx insn_use, unsigned int regno_use, int indent)
++{
++  bool ext_needed, indent_once;
++  unsigned int dest_target_regno;
++  extelim_uid_t uid;
++  rtx use = PATTERN (insn_use), dest;
++  df_ref df_use, *p_def;
++  struct df_link *link;
++  enum insn_use_results analysis_result;
++
++  gcc_assert (use != NULL);
++
++  uid = INSN_UID (insn_use);
++
++  if (insn_flag_p (EXTELIM_SEEN, uid))
++    {
++      if (dump_file)
++        fprintf (dump_file,
++                 "%*suse at uid=%d is visited already\n", indent, " ", uid);
++      return false;
++    }
++
++  /* Mark this insn as seen */
++  insn_flag_set (EXTELIM_SEEN, uid);
++
++  analysis_result = insn_use_analysis (insn_use, regno_use, &dest, indent);
++  switch (analysis_result)
++    {
++      /* We know conclusively that the "upper bits" of the extended
++         entity do not impact the "low bits" of the output of the operation. */
++    case EXTELIM_ANALYSIS_RESULT_LOWBITS_NOT_AFFECTED:
++      if (dump_file)
++        fprintf (dump_file, "%*suse at uid=%d is not affected\n", indent, " ",
++                 uid);
++      return false;
++      break;
++      /* We know conclusively that the "upper bits" of the extended
++         entity _do_ impact the "low bits" of the output of the operation. */
++    case EXTELIM_ANALYSIS_RESULT_LOWBITS_AFFECTED:
++      if (dump_file)
++        fprintf (dump_file, "%*suse at uid=%d is affected\n", indent, " ",
++                 uid);
++      return true;
++      break;
++      /* Continue to look at the uses of the result to determine the impact
++         of the "upper bits" */
++    case EXTELIM_ANALYSIS_RESULT_CONTINUE_RECURSION:
++      break;
++    default:
++      gcc_unreachable ();
++    }
++
++  /* We reach here because the action taken is CONTINUE_RECURSION.
++     Continue to look at the uses of the destination register recursively. 
++     If the propagation ultimately ends where the upper bits are not significant 
++     to the final output, then the extension can be removed. */
++  if (!REG_P (dest))
++    {
++      if (dump_file)
++        fprintf (dump_file,
++                 "%*sdest of uid=%d (SET) is not a register\n", indent, " ",
++                 uid);
++      return true;
++    }
++
++  dest_target_regno = REGNO (dest);
++
++  /* What this insn defines */
++  p_def = DF_INSN_UID_DEFS (uid);
++
++  /* Ref must be valid and there must be only one definition and it must be the
++     destination */
++  if ((*p_def == NULL) || (*(p_def + 1) != NULL))
++    return true;
++
++  gcc_assert (DF_REF_REGNO (*p_def) == dest_target_regno);
++
++  ext_needed = true;
++  indent_once = true;
++  for (link = DF_REF_CHAIN (*p_def); link; link = link->next)
++    {
++      rtx insn_use, use_exp;
++      df_use = link->ref;
++      if (!df_use)
++        continue;
++      /* Link must be a USE of the DEF */
++      if (!DF_REF_REG_USE_P (df_use))
++        continue;
++      /* Ignore ARTIFICIAL USES */
++      if (DF_REF_IS_ARTIFICIAL (df_use))
++        continue;
++      insn_use = DF_REF_INSN (df_use);
++      /* Don't consider debug_insns */
++      if (!NONDEBUG_INSN_P (insn_use))
++        continue;
++      use_exp = DF_REF_REG (df_use);
++
++      if (exp_needs_update_p (use_exp))
++        {
++          if (dump_file)
++            fprintf (dump_file,
++                     "%*ssaved reg=%d expression for update\n", indent, " ", DF_REF_REGNO (df_use));
++          save_ext_update (current_ext_record, use_exp);
++        }
++
++      if (dump_file)
++        fprintf (dump_file,
++                 "%*suse at uid=%d of reg=%d\n", indent, " ",
++                 INSN_UID (insn_use), DF_REF_REGNO (df_use));
++      /* Set indent for dump formatting */
++      if (indent_once)
++        {
++          ++indent;
++          indent_once = false;
++        }
++      ext_needed = analyze_ext_use (insn_use, DF_REF_REGNO (df_use), indent);
++      if (ext_needed)
++        break;
++    }
++
++  if (dump_file)
++    fprintf (dump_file,
++             "%*sext %s needed\n", indent, " ", ext_needed ? "" : "not");
++
++  return ext_needed;
++}
++
++/* Set a flag on an insn indicating that it is
++   marked for replacement by a copy insn or for
++   deletion. */
++
++static void
++mark_replace_with_copy (rtx ext)
++{
++  extelim_uid_t uid = INSN_UID (ext);
++  insn_flag_set (EXTELIM_REPLACE_COPY, uid);
++}
++
++/* Get the mode that we are sign/zero extending from */
++
++static enum machine_mode
++get_ext_from_mode (rtx src)
++{
++  rtx regexp;
++  gcc_assert (GET_CODE (src) == ZERO_EXTEND || GET_CODE (src) == SIGN_EXTEND);
++
++  /* The SUBREG or REG mode of the extend operand */
++  regexp = XEXP (src, 0);
++  return (GET_MODE (regexp));
++}
++
++/* Perform the action on the expression. Return true
++   if any action performed, false otherwise. */
++
++static bool 
++process_ext_update (rtx exp)
++{
++  /* Reset SUBREG_PROMOTED state to false */
++  if (GET_CODE (exp) == SUBREG
++      && SUBREG_PROMOTED_VAR_P (exp))
++    {
++      SUBREG_PROMOTED_VAR_P (exp) = 0;
++      return true;
++    }
++
++  return false;
++}
++
++/* Process the current extension record, looking at all the
++   the expressions that need to be updated because this
++   extension will be replaced by a copy. */
++
++static void
++process_ext_updates (ext_record_t extrec)
++{
++  unsigned i;
++  rtx exp;
++  bool updated=false;
++
++
++  FOR_EACH_VEC_ELT (rtx, extrec->ext_updates, i, exp)
++    {
++      updated |= process_ext_update (exp);
++    }
++
++  if (dump_file && updated)
++    fprintf (dump_file, " updates processed for extension at uid=%d\n",
++             INSN_UID (extrec->ext));
++}
++
++/* Try to eliminate the sign extension by examining the
++   definitions of the extension source and the uses
++   of the extension destination. */
++
++static void
++eliminate_one_extend (rtx ext)
++{
++  rtx src, dest, regexp;
++  df_ref df_use, df_def, *ext_use, *ext_def;
++  unsigned int ext_dest_regno, ext_src_regno, def_use_count = 1;
++  bool ext_needed = true;
++  extelim_uid_t uid = INSN_UID (ext);
++  struct df_link *link;
++  const char *inserted =
++    insn_flag_p (EXTELIM_INSERTED, uid) ? "inserted" : "";
++
++  /* Reset desired per insn flags for each extension analyzed */
++  reinit_insn_flags (EXTELIM_SEEN);
++
++  gcc_assert (GET_CODE (PATTERN (ext)) == SET);
++  src = SET_SRC (PATTERN (ext));
++  dest = SET_DEST (PATTERN (ext));
++
++  /* Save the basic information about the extension in a file global */
++  ext_to_mode = GET_MODE (dest);
++  ext_from_mode = get_ext_from_mode (src);
++  ext_code = GET_CODE (src);
++
++  /* Also mark this original extension as "SEEN" so we don't recurse into it. */
++  insn_flag_set (EXTELIM_SEEN, INSN_UID (ext));
++
++  /* Find the target of the extension */
++  if (!REG_P (dest))
++    return;
++  ext_dest_regno = REGNO (dest);
++
++  /* Find the source of the extension: set (REG:MODE (sign_extend (REG|SUBREG:MODE ... */
++  if ((regexp = register_exp (XEXP (src, 0))) == NULL)
++    return;
++  ext_src_regno = REGNO (regexp);
++
++  /* Iterate through the reaching definitions of the source of the extension 
++     recursively. If the source if already sign extended, mark the 
++     extension for replacement with a copy or deletion (deletion if it was
++     inserted in the duplication pass). */
++  ext_use = DF_INSN_UID_USES (uid);
++  /* There is only one use in a sign/zero extension insn and it must be the
++     source register */
++  gcc_assert (*(ext_use + 1) == NULL);
++  gcc_assert (DF_REF_REGNO (*ext_use) == ext_src_regno);
++
++  /* Now look at all the reaching definitions of this use */
++  for (link = DF_REF_CHAIN (*ext_use); link; link = link->next)
++    {
++      rtx insn_def;
++      df_def = link->ref;
++      if (!df_def)
++        continue;
++      /* Link must be to a definition of the use */
++      if (!DF_REF_REG_DEF_P (df_def))
++        continue;
++      /* Ignore ARTIFICIAL defs */
++      if (DF_REF_IS_ARTIFICIAL (df_def))
++        continue;
++      insn_def = DF_REF_INSN (df_def);
++      /* Don't consider debug_insns */
++      if (!NONDEBUG_INSN_P (insn_def))
++        continue;
++      if (dump_file)
++        fprintf (dump_file,
++                 " analyze def #%d of reg=%d at uid=%u\n",
++                 def_use_count, DF_REF_REGNO (*ext_use), INSN_UID (insn_def));
++      ext_needed = analyze_ext_def (insn_def, DF_REF_REGNO (*ext_use), 2);
++      if (ext_needed)
++        break;
++      def_use_count++;
++    }
++
++  /* Try the def-use chains if the extension wasn't marked by the
++     previous pass. */
++  if (ext_needed)
++    {
++      /* Defs of the sign extension */
++      ext_def = DF_INSN_UID_DEFS (uid);
++      /* There is only one def in a sign extension insn and it must be the
++         destination */
++      gcc_assert (*(ext_def + 1) == NULL);
++      gcc_assert (DF_REF_REGNO (*ext_def) == ext_dest_regno);
++
++      /* Counter for debug dump */
++      def_use_count = 1;
++      /* Reset desired per insn flags for each extension analyzed */
++      reinit_insn_flags (EXTELIM_SEEN);
++      /* Also mark this original extension as "SEEN" so we don't recurse into it. */
++      insn_flag_set (EXTELIM_SEEN, INSN_UID (ext));
++
++      /* Iterate over the reached uses of extension destination register recursively.
++         If the destination register's upper bits are ultimately not
++         relevant, the extension can be marked for replacement with a
++         copy. */
++      for (link = DF_REF_CHAIN (*ext_def); link; link = link->next)
++        {
++          rtx insn_use, use_exp;
++          df_use = link->ref;
++          if (!df_use)
++            continue;
++          /* Link must be a USE of the DEF */
++          if (!DF_REF_REG_USE_P (df_use))
++            continue;
++          /* Ignore ARTIFICIAL USES */
++          if (DF_REF_IS_ARTIFICIAL (df_use))
++            continue;
++          insn_use = DF_REF_INSN (df_use);
++          /* Don't consider debug_insns */
++          if (!NONDEBUG_INSN_P (insn_use))
++            continue;
++          use_exp = DF_REF_REG (df_use);
++
++          if (exp_needs_update_p (use_exp))
++            {
++              if (dump_file)
++                fprintf (dump_file,
++                         " saved reg=%d expression for update\n", DF_REF_REGNO (df_use));
++              save_ext_update (current_ext_record, use_exp);
++            }
++            
++          if (dump_file)
++            fprintf (dump_file,
++                     " analyze use #%d at uid=%u of reg=%d\n",
++                     def_use_count, INSN_UID (insn_use),
++                     DF_REF_REGNO (*ext_def));
++          ext_needed = analyze_ext_use (insn_use, DF_REF_REGNO (*ext_def), 2);
++          if (ext_needed)
++            break;
++          def_use_count++;
++        }
++    }
++
++  /* The extension is not needed. The rtl for the extension is marked
++     for replace by copy. */
++  if (!ext_needed)
++    {
++      process_ext_updates (current_ext_record);
++
++      if (dump_file)
++        fprintf (dump_file,
++                 ":) mark %s extension insn uid=%d for copy replacement\n",
++                 inserted, INSN_UID (ext));
++      mark_replace_with_copy (ext);
++      num_cand_transformed++;
++    }
++  else
++    {
++      if (dump_file)
++        fprintf (dump_file,
++                 ":( %s extension insn uid=%d is needed\n", inserted,
++                 INSN_UID (ext));
++    }
++}
++
++/* Replace the sign extension with a copy instruction
++
++   example 1:
++   from:
++        dest              src
++   (set (reg:DI destreg) (sign_extend:DI (reg:SI srcreg)))
++   to:
++   (clobber (reg:DI destreg))
++   (set (subreg:SI (reg:DI destreg) 4) (reg:SI srcreg)) 
++
++   or
++
++   example 2:
++   from:
++        dest             src
++   (set (reg:DI destreg) (sign_extend:DI (subreg:SI (reg:DI srcreg) 4)))
++   to:
++   (clobber (reg:DI destreg))
++   (set (subreg:SI (reg:DI destreg) 4) (subreg:SI (reg:DI srcreg) 4)) 
++
++   or
++
++   example 3:
++   from:
++        dest             src
++   (set (reg:SI destreg) (sign_extend:SI (subreg:HI (reg:SI srcreg) 2)))
++   to:
++   (clobber (reg:SI destreg))
++   (set (subreg:HI (reg:SI destreg) 2) (subreg:HI (reg:SI srcreg) 2)) */
++
++static void
++replace_with_copy (rtx ext)
++{
++  rtx extension = PATTERN (ext);
++  rtx ext_op, src, dest, insns, cp_dest, cp_src;
++  enum machine_mode inner_mode;
++  gcc_assert (GET_CODE (extension) == SET);
++
++  dest = SET_DEST (extension);
++  src = SET_SRC (extension);
++
++  /* The sign extension operand */
++  ext_op = XEXP (src, 0);
++  /* Get the inner mode */
++  inner_mode = GET_MODE (ext_op);
++  gcc_assert (inner_mode == SImode || inner_mode == HImode
++              || inner_mode == QImode);
++
++  /* Make dest a SUBREG:mm */
++  cp_dest = gen_lowpart_SUBREG (inner_mode, dest);
++
++  /* Copy src is the sign extension target register */
++  cp_src = ext_op;
++
++  /* ??? clobber is needed for rtl consistency, don't know why */
++  start_sequence ();
++  emit_clobber (dest);
++  emit_move_insn (cp_dest, cp_src);
++  insns = get_insns ();
++  end_sequence ();
++  emit_insn_before (insns, ext);
++
++  delete_insn (ext);
++}
++
++/* Iterate through extensions, replace those extensions
++   that are marked as so with a copy insn. */
++
++static void
++replace_ext_with_copy (void)
++{
++  ext_record_t extrec;
++  unsigned i;
++
++  FOR_EACH_VEC_ELT (ext_record_t, extensions, i, extrec)
++  {
++    const char *inserted = insn_flag_p (EXTELIM_INSERTED,
++                                        INSN_UID (extrec->
++                                                  ext)) ? "inserted" : "";
++    if (insn_flag_p (EXTELIM_REPLACE_COPY, INSN_UID (extrec->ext)))
++      {
++        if (dump_file)
++          fprintf (dump_file,
++                   " replace %s extension uid=%d with a copy\n", inserted,
++                   INSN_UID (extrec->ext));
++        replace_with_copy (extrec->ext);
++      }
++  }
++}
++
++
++/* Copy the RTX flags from old to new */
++
++static void
++copy_flags (rtx oldrtx, rtx newrtx)
++{
++  if (RTX_FLAG (oldrtx, in_struct))
++    RTX_FLAG (newrtx, in_struct) = true;
++
++  if (RTX_FLAG (oldrtx, volatil))
++    RTX_FLAG (newrtx, volatil) = true;
++
++  if (RTX_FLAG (oldrtx, unchanging))
++    RTX_FLAG (newrtx, unchanging) = true;
++
++  if (RTX_FLAG (oldrtx, frame_related))
++    RTX_FLAG (newrtx, frame_related) = true;
++
++  if (RTX_FLAG (oldrtx, jump))
++    RTX_FLAG (newrtx, jump) = true;
++
++  if (RTX_FLAG (oldrtx, call))
++    RTX_FLAG (newrtx, call) = true;
++
++  if (RTX_FLAG (oldrtx, return_val))
++    RTX_FLAG (newrtx, return_val) = true;
++}
++
++/* Iterate through the insn notes looking for 'kind'. If 
++   found replace the register rtx with the new rtx. */
++
++static void
++update_notes (enum reg_note kind, rtx insn, rtx reg, rtx new_reg)
++{
++  rtx link;
++  for (link = REG_NOTES (insn); link; link = XEXP (link, 1))
++    if (REG_NOTE_KIND (link) == kind)
++      {
++        rtx op0 = XEXP (link, 0);
++        if (kind == REG_DEAD)
++          if (REG_P (op0) && op0 == reg)
++            XEXP (link, 0) = new_reg;
++      }
++}
++
++
++
++#if EXTELIM_DUPLICATE_EXTS_AT_USES
++/* Insert a duplicate sign extension at the use point.
++   Add a flag indicating this extension is algorithmically
++   added. Since the "inserted" extensions have the form
++   regX = sign_extend (subreg:mm (reg:MM regX), offset), 
++   they can simply be deleted if they are redundant since we 
++   are at a reaching use of the original definition. We also 
++   mark the use insn where the insert occurs so we don't insert 
++   the same extension from another def at this use. */
++
++static void
++insert_duplicate_ext_at_use (rtx ext_insn, rtx use_insn)
++{
++  int i;
++  rtx ext = PATTERN (ext_insn), ext_src, ext_dest;
++  rtx new_ext_src_inner, new_ext_src_outer, new_ext_part;
++  rtx new_ext_dest, new_ext_insn;
++  extelim_uid_t new_uid;
++  df_ref *p_df_uses;
++  unsigned int ext_dest_regno;
++  enum machine_mode inner_mode;
++  bool sign_extend_p =
++    GET_CODE (SET_SRC (PATTERN (ext_insn))) == SIGN_EXTEND ? true : false;
++
++  /* This new extension must be of the form:
++     set (reg:MM X (sign_extend:MM (subreg:mm (reg:MM X)))) 
++     where mm is smaller than MM. */
++  ext_dest = SET_DEST (ext);
++  ext_src = SET_SRC (ext);
++
++  gcc_assert (REG_P (register_exp (ext_dest)));
++
++  /* A copy of the extend destination register to a new virtual register */
++  new_ext_dest = gen_reg_rtx (GET_MODE (ext_dest));
++  /* A copy of the extend source (same reg as dest), REG_P */
++  new_ext_src_inner = copy_rtx (ext_dest);
++  /* Get inner mode, either mm for SUBREG:mm (REG:MM) or MM for (REG:MM) */
++  if (GET_CODE (XEXP (ext_src, 0)) == SUBREG)
++    inner_mode = GET_MODE (XEXP (ext_src, 0));
++  else if (REG_P (XEXP (ext_src, 0)))
++    inner_mode = GET_MODE (XEXP (ext_src, 0));
++  else
++    /* Can't determine sign_extend operand */
++    gcc_unreachable ();
++
++  /* Make a subreg rtx */
++  new_ext_src_outer = gen_lowpart_SUBREG (inner_mode, new_ext_src_inner);
++  /* Make a sign/zero extend insn */
++  new_ext_part = sign_extend_p
++    ? gen_rtx_SIGN_EXTEND (GET_MODE (ext_dest), new_ext_src_outer)
++    : gen_rtx_ZERO_EXTEND (GET_MODE (ext_dest), new_ext_src_outer);
++  /* (set (new:MM (sign_extend:MM (subreg:mm (reg:MM ext_dest))))) */
++  new_ext_insn = gen_rtx_SET (VOIDmode, new_ext_dest, new_ext_part);
++
++  /* Now update the use */
++  /* Operands used by this the use_insn */
++  ext_dest_regno = REGNO (register_exp (ext_dest));
++  for (p_df_uses = DF_INSN_UID_USES (INSN_UID (use_insn)), i = 0; *p_df_uses;
++       p_df_uses++, i++)
++    {
++      if (DF_REF_REGNO (*p_df_uses) == ext_dest_regno)
++        {
++          rtx use_reg = DF_REF_REG (*p_df_uses);
++
++          /*  Replace the register use in use_insn with the new register. If the use
++             is a subreg pattern, replace the innermost reg. */
++          replace_rtx (PATTERN (use_insn), register_exp (use_reg),
++                       new_ext_dest);
++          /* Update flags on new dest reg */
++          copy_flags (register_exp (use_reg), new_ext_dest);
++          /* Update any notes associated with use reg and use_insn */
++          update_notes (REG_DEAD, use_insn, register_exp (use_reg), new_ext_dest);
++          /* DF info must be updated since existing insn is changed */
++          if (df_insn_rescan (use_insn))
++            {
++              p_df_uses = DF_INSN_UID_USES (INSN_UID (use_insn));
++	      p_df_uses += i;
++            }
++        }
++    }
++
++  new_uid = extelim_emit_before (new_ext_insn, use_insn);
++  insn_flag_set (EXTELIM_INSERTED, new_uid);
++}
++
++/* Allow the duplication of the extension even if the extension
++   and the duplication use are in the same block. */
++
++static bool
++allow_duplication_p (rtx ext_insn, rtx use_insn)
++{
++  rtx ext = PATTERN (ext_insn);
++  rtx use = PATTERN (use_insn);
++  rtx insn;
++  basic_block bb;
++  bool found_zxt=false;
++
++  /* Do not allow duplication if use is already preceded by a ZERO_EXTEND in this 
++     basic block. Start at beginning of block and search down until the use insn. */
++
++  bb = BLOCK_FOR_INSN (use_insn);
++  FOR_BB_INSNS (bb, insn)
++    {
++      if (!NONDEBUG_INSN_P (insn))
++        continue;
++      if (insn == use_insn)
++        break;
++      if ((GET_CODE (PATTERN (insn)) == SET)
++          && (GET_CODE (SET_SRC (PATTERN (insn))) == ZERO_EXTEND))
++        found_zxt=true;
++    }
++
++  /* We must have found the use insn (and therefore insn is not null) */
++  gcc_assert(insn != NULL_RTX);
++
++  if (found_zxt)
++    return false;
++
++  if (GET_CODE (SET_SRC (use)) == ASHIFT && GET_CODE (SET_SRC (ext)) == ZERO_EXTEND)
++    return true;
++
++  return false;
++}
++
++/* Determine if the extension should be duplicated at this use point.
++   Return true if yes, false otherwise. */
++
++static bool
++save_ext_use_p (ext_record_t extrec, rtx use_insn)
++{
++  rtx ext_insn, ext, ext_dest, use = PATTERN (use_insn);
++  df_ref df_use, df_def;
++  struct df_link *link;
++
++  ext_insn = extrec->ext;
++  ext = PATTERN (ext_insn);
++  ext_dest = SET_DEST (ext);
++
++  if (GET_CODE (use) != SET)
++    return false;
++
++  /* 1. Duplicate the extension at certain CODEs that are known to generate 
++     a target insn when paired with the extension duplication. E.g. 
++     128 = ZERO_EXTEND (159)
++     153 = ASHIFT (128)
++     will match a single rldic insn. This limits extension duplication to points where it is
++     possibly beneficial if the original extension is deleted. It doesn't guarantee that
++     the original extension will be deleted, however, because the elimination pass has to
++     make that decision. */
++  if (INSN_P (ext_insn) && INSN_P (use_insn))
++    {
++      if ( ! allow_duplication_p (ext_insn, use_insn))
++          return false;
++    }
++
++  /* 2. Check if all other definitions reaching this use are already extended,
++     and therefore duplicating the extension does not change the value
++     of that reaching definition. (testcase: nof/muldf3.c) */
++  df_use = df_find_use (use_insn, ext_dest);
++
++  /* Iterate through definitions reaching this use */
++  for (link = DF_REF_CHAIN (df_use); link; link = link->next)
++    {
++      rtx insn_def, def;
++      df_def = link->ref;
++      if (!df_def)
++        continue;
++      /* Link must be to a definition of the use */
++      if (!DF_REF_REG_DEF_P (df_def))
++        continue;
++      /* Ignore ARTIFICIAL defs */
++      if (DF_REF_IS_ARTIFICIAL (df_def))
++        continue;
++      insn_def = DF_REF_INSN (df_def);
++      def = PATTERN (insn_def);
++
++      /* If def is a PARALLEL, find the SET */
++      if (GET_CODE (def) == PARALLEL)
++	{
++	  int i;
++	  for (i = 0; i < XVECLEN (def, 0); i++)
++	    {
++	      rtx body = XVECEXP (def, 0, i);
++	      if (GET_CODE (body) == SET)
++		{
++		  def = body;
++		  break;
++		}
++	      return false;
++	    }
++	}
++
++      /* Don't consider debug_insns */
++      if (!NONDEBUG_INSN_P (insn_def))
++        continue;
++
++      /* The original extension, obviously ignore this one. */
++      if (insn_def == ext_insn)
++        continue;
++
++      /* We must know what mode we are extending from in 'operand_is_extended' */
++      ext_from_mode = get_ext_from_mode ( SET_SRC (ext) );
++
++      /* Here we check whether the defined operand is already extended (insn_def) with
++         respect to the potentially duplicated extension (ext). Bail out if any reaching
++         defs are not extended. */ 
++      if ( ! operand_is_extended (ext, SET_SRC (def), 2 /* indent */) ) 
++          return false;
++    }
++  return true;
++}
++
++/* Save the use insn in the extension records list of
++   uses. At the next phase, we will duplicate the extension
++   at these use points. */
++
++static void
++save_ext_use (ext_record_t extrec, rtx use_insn)
++{
++  /* Mark the use insn, it will have a duplicate inserted */
++  insn_flag_set (EXTELIM_INSERTED_FOR, INSN_UID (use_insn));
++  /* Save use to the list of uses to be duplicated for this extension. */
++  VEC_safe_push (rtx, heap, extrec->ext_uses, use_insn);
++}
++
++
++/* Save the qualified use of an extension to a list */
++
++static void
++gather_ext_uses_info (ext_record_t extrec)
++{
++  rtx ext;
++  df_ref *ext_def, df_use;
++  unsigned int def_use_count = 1;
++  extelim_uid_t uid;
++  struct df_link *link;
++
++  gcc_assert (extrec != NULL);
++  ext = extrec->ext;
++  uid = INSN_UID (ext);
++
++  /* Insn level defs of the sign extension */
++  ext_def = DF_INSN_UID_DEFS (uid);
++  /* There is only one def in a sign extension insn */
++  gcc_assert (*(ext_def + 1) == NULL);
++
++  /* Iterate over the reached uses of extension destination register.
++     Duplicate the extension at the use point. */
++  for (link = DF_REF_CHAIN (*ext_def); link; link = link->next)
++    {
++      rtx insn_use;
++      df_use = link->ref;
++      if (!df_use)
++        continue;
++      /* Link must be a USE of the DEF */
++      if (!DF_REF_REG_USE_P (df_use))
++        continue;
++      /* Ignore ARTIFICIAL USES */
++      if (DF_REF_IS_ARTIFICIAL (df_use))
++        continue;
++      insn_use = DF_REF_INSN (df_use);
++
++      /* Don't consider debug_insns */
++      if (!NONDEBUG_INSN_P (insn_use))
++        continue;
++
++      if (dump_file)
++        fprintf (dump_file,
++                 " use #%d: insert duplicate extension of reg=%d at uid=%u? ",
++                 def_use_count, DF_REF_REGNO (*ext_def), INSN_UID (insn_use));
++
++      /* Determine whether its worthwhile duplicating the extension at this use */
++      if (save_ext_use_p (extrec, insn_use))
++        {
++          if (dump_file)
++            fprintf (dump_file, "  yes\n");
++          save_ext_use (extrec, insn_use);
++        }
++      else
++        {
++          if (dump_file)
++            fprintf (dump_file, "  no\n");
++        }
++      def_use_count++;
++    }
++}
++
++/* At each use point of the sign extension, unless the 
++   use is obviously already sign extended, insert a 
++   sign extension insn before the use if criteria for inserting
++   a duplicate extension is met.
++   Do this in 2 passes to avoid confusing the dataflow information. */
++
++static void
++duplicate_exts_at_uses (void)
++{
++  unsigned i, j;
++  ext_record_t extrec;
++  rtx use_insn;
++
++  if (dump_file)
++    fprintf (dump_file, "Duplicate Extension at Uses pass.\n");
++
++  /* Get the uses where the extensions will be duplicated */
++  FOR_EACH_VEC_ELT (ext_record_t, extensions, i, extrec)
++  {
++    if (dump_file)
++      fprintf (dump_file, "gathering extension uid=%u use information\n",
++               INSN_UID (extrec->ext));
++    gather_ext_uses_info (extrec);
++  }
++
++  /* Now duplicate the extensions at the appropriate use points */
++  FOR_EACH_VEC_ELT (ext_record_t, extensions, i, extrec)
++  {
++    FOR_EACH_VEC_ELT (rtx, extrec->ext_uses, j, use_insn)
++    {
++      insert_duplicate_ext_at_use (extrec->ext, use_insn);
++    }
++  }
++}
++#endif /* EXTELIM_DUPLICATE_EXTS_AT_USES */
++
++/* Determine if an instruction is a return insn */
++
++static rtx
++return_p (rtx rtn_insn)
++{
++  rtx rtn = PATTERN (rtn_insn), dest;
++  int i;
++
++  if (GET_CODE (rtn) != SET)
++    return false;
++
++  dest = SET_DEST (rtn);
++
++  /* Is a return value? */
++  if ((REG_P (dest) || GET_CODE (dest) == PARALLEL) &&
++      REG_FUNCTION_VALUE_P (dest))
++    {
++      /* Simple SET, return the insn */
++      if (REG_P (dest))
++        return rtn_insn;
++      /* PARALLEL, find the embedded rtx */
++      if (GET_CODE (dest) == PARALLEL)
++        for (i = XVECLEN (rtn_insn, 0) - 1; i >= 0; i--)
++          {
++            rtx body = XVECEXP (rtn_insn, 0, i);
++            if (GET_CODE (body) == SET)
++              {
++                dest = SET_DEST (body);
++                if (REG_FUNCTION_VALUE_P (dest))
++                  return body;
++              }
++          }
++    }
++  /* Not a return */
++  return NULL;
++}
++
++/* Find all return RTLs in the function and save them in
++   a list. */
++
++static bool
++find_returns (void)
++{
++  basic_block bb;
++  rtx insn, rtn_insn;
++  bool found = false;
++
++  /* For all insns  */
++  FOR_EACH_BB (bb)
++  {
++    FOR_BB_INSNS (bb, insn)
++    {
++      if (!NONDEBUG_INSN_P (insn))
++        continue;
++
++      if ((rtn_insn = return_p (insn)) == NULL)
++        {
++          continue;
++        }
++      if (dump_file)
++        fprintf (dump_file, " found return at uid=%u\n", INSN_UID (rtn_insn));
++
++      VEC_safe_push (rtx, heap, returns, rtn_insn);
++      found = true;
++    }
++  }
++
++  return (found);
++}
++
++/* Get the signedness and machine mode of the function */
++
++static bool
++get_return_info (bool * signed_p, enum machine_mode *return_mode)
++{
++  tree rtninfo;
++
++  if ((rtninfo = DECL_RESULT (current_function_decl)) != NULL)
++    {
++      *signed_p = !TYPE_UNSIGNED (TREE_TYPE (rtninfo));
++      *return_mode = DECL_MODE (rtninfo);
++      return true;
++    }
++  return false;
++}
++
++/* If the dest mode of the return is larger than
++   the function return mode, we can subreg the return
++   insn to the return mode and extend to the destination.
++   E.g. unsigned, return mode: HImode
++   set (reg/i:DI Y) (reg:DI X) 
++   becomes
++   set (reg:DI new) (zero_extend:DI (subreg:HI (reg:DI X)))
++   set (reg/i:DI Y) (reg:DI new) */
++
++static void
++make_ext_at_rtn (rtx rtn_insn, bool fun_signed_p, enum machine_mode fun_mode)
++{
++  rtx rtn = PATTERN (rtn_insn);
++  rtx dest, src, new_ext_dest, new_ext_src, new_ext_outer, new_ext_part,
++    new_ext_insn;
++  extelim_uid_t new_uid;
++  gcc_assert (GET_CODE (rtn) == SET);
++
++  dest = SET_DEST (rtn);
++  src = SET_SRC (rtn);
++
++  /* Deal with scalar rtn values only */
++  if (fun_mode != DImode
++      && fun_mode != SImode && fun_mode != HImode && fun_mode != QImode)
++    {
++      if (dump_file)
++        fprintf (dump_file, "failed-- not scalar return mode\n");
++      return;
++    }
++
++  /* Dest and src have to have the same mode. This should always be
++     true for well formed rtl, but we check anyway. */
++  if (GET_MODE (dest) != GET_MODE (src))
++    {
++      if (dump_file)
++        fprintf (dump_file, "failed-- dest and src modes differ\n");
++      return;
++    }
++
++  /* Also check that we are dealing with simple regs here. */
++  if (!REG_P (dest) || !REG_P (src))
++    {
++      if (dump_file)
++        fprintf (dump_file, "failed-- dest or src is not REG_P\n");
++      return;
++    }
++
++  /* The return reg mode should never be smaller than fun return mode. If the
++     same size, however, we can't subreg either, so return */
++  if (GET_MODE_BITSIZE (GET_MODE (dest)) <= GET_MODE_BITSIZE (fun_mode))
++    {
++      if (dump_file)
++        fprintf (dump_file,
++                 "failed-- dest size mode is smaller or equal to function mode size\n");
++      return;
++    }
++
++  /* From here we should be able to build a subreg since the function return mode
++     size is smaller than the return register mode size */
++  new_ext_dest = gen_reg_rtx (GET_MODE (src));  /*  set (reg:MM new) */
++  new_ext_src = copy_rtx (src); /*  copy of X, copyX */
++  new_ext_outer = gen_lowpart_SUBREG (fun_mode, new_ext_src);   /*  subreg:mm (reg:MM copyX) */
++  new_ext_part = fun_signed_p   /*  extend:MM (subreg:mm (reg:MM copyX)) */
++    ? gen_rtx_SIGN_EXTEND (GET_MODE (src), new_ext_outer)
++    : gen_rtx_ZERO_EXTEND (GET_MODE (src), new_ext_outer);
++  /* Put it together */
++  new_ext_insn = gen_rtx_SET (VOIDmode, new_ext_dest, new_ext_part);
++
++  /* Modify src of return insn to use new pseudo */
++  replace_rtx (PATTERN (rtn_insn), src, new_ext_dest);
++  /* Update flags on new dest reg */
++  copy_flags (src, new_ext_dest);
++  /* Update any notes associated with replaced register */
++  update_notes (REG_DEAD, rtn_insn, src, new_ext_dest);
++  /* Rescan the modified insn */
++  df_insn_rescan (rtn_insn);
++  /* Insert the new insn */
++  new_uid = extelim_emit_before (new_ext_insn, rtn_insn);
++
++  if (dump_file)
++    fprintf (dump_file, "success\n");
++}
++
++/* Insert extensions at return points. Scan the RTL
++   for the return statements. Determine if the RTL 
++   can be modified to insert an extension. Modify the
++   return to insert the extension. */
++
++static void
++insert_ext_at_returns (void)
++{
++  bool signed_p;
++  enum machine_mode return_mode;
++  rtx rtn_insn;
++  int i;
++
++  /* Generate list of return rtls for the function */
++  if (dump_file)
++    {
++      fprintf (dump_file, "Insert Extensions at Returns pass.\n");
++      fprintf (dump_file, "gathering return insns...\n");
++    }
++
++  if (!find_returns ())
++    return;
++
++  if (!get_return_info (&signed_p, &return_mode))
++    return;
++
++  /* For each return instruction, generate a sign/zero extend
++     if the current return size is larger than the function
++     return mode. */
++  FOR_EACH_VEC_ELT (rtx, returns, i, rtn_insn)
++  {
++    if (dump_file)
++      fprintf (dump_file, " making extension at return uid=%u...",
++               INSN_UID (rtn_insn));
++    make_ext_at_rtn (rtn_insn, signed_p, return_mode);
++  }
++}
++
++/* Compare two extension records by loop depth.
++   Used by VEC_qsort to sort the order in which extensions
++   are processed. */
++
++static int
++ext_record_compare (const void *p_er1, const void *p_er2)
++{
++  const ext_record_t er1 = *(const ext_record_t *) p_er1;
++  const ext_record_t er2 = *(const ext_record_t *) p_er2;
++  basic_block bb1, bb2;
++  rtx ext1, ext2;
++
++  if (er1 == er2)
++    return 0;
++
++  ext1 = er1->ext;
++  ext2 = er2->ext;
++
++  bb1 = BLOCK_FOR_INSN (ext1);
++  bb2 = BLOCK_FOR_INSN (ext2);
++
++  /* Sort high to low */
++  return (bb2->loop_depth - bb1->loop_depth);
++}
++
++/* The main interface to this optimization. */
++
++static void
++extension_elimination (void)
++{
++  ext_record_t ext;
++  unsigned i;
++
++  init_pass ();
++
++  /* Find initial sign extension candidates */
++  if (!find_extensions ())
++    {
++      finish_pass ();
++      return;
++    }
++
++  /* Insert sign extension at return points in
++     the function. */
++  insert_ext_at_returns ();
++
++  /* Duplicate the sign extensions at their use
++     points unless the use is already obviously sign
++     extended or extension is already added. */
++#if EXTELIM_DUPLICATE_EXTS_AT_USES
++  duplicate_exts_at_uses ();
++#endif
++
++  /* Update DF information since now have new insns. */
++  df_finish_pass (true);
++  df_chain_add_problem (DF_DU_CHAIN + DF_UD_CHAIN);
++  df_analyze ();
++
++#if EXTELIM_DF_DUMP
++  if (dump_file)
++    df_dump (dump_file);
++#endif
++
++  /* Init statistics */
++  num_cand = 0;
++  num_cand_ignored = 0;
++  num_cand_transformed = 0;
++
++  /* Free old extensions list, generate new one that includes
++     the new extensions. */
++  free_extensions ();
++
++ if (!find_extensions ())
++    {
++      finish_pass ();
++      return;
++    }
++
++  if (dump_file)
++    {
++      fprintf (dump_file, "\nRTL After Extension Duplication\n");
++      print_rtl (dump_file, get_insns ());
++    }
++
++  if (dump_file)
++    fprintf (dump_file, "Begin extension elimination analysis\n");
++
++  /* Sort the extensions by loop depth. We want to try to eliminate
++     those in innermost loops (highest loop depth) first. */
++  VEC_qsort (ext_record_t, extensions, ext_record_compare);
++
++  /* Iterate through extension worklist */
++  FOR_EACH_VEC_ELT (ext_record_t, extensions, i, ext)
++  {
++    rtx ext_insn = ext->ext;
++    rtx ext_src = SET_SRC (PATTERN (ext_insn));
++    const char *ext_name =
++      GET_CODE (ext_src) == SIGN_EXTEND ? "sign" : "zero";
++    const char *inserted =
++      insn_flag_p (EXTELIM_INSERTED, INSN_UID (ext_insn)) ? "inserted" : "";
++    extelim_uid_t uid = INSN_UID (ext_insn);
++
++    if (dump_file)
++      fprintf (dump_file,
++               "<analyzing %s %s extension uid=%u> (loop_depth=%d)\n",
++               inserted, ext_name, uid,
++               BLOCK_FOR_INSN (ext_insn)->loop_depth);
++
++    current_ext_record = ext;
++    eliminate_one_extend (ext->ext);
++  }
++
++  if (dump_file)
++    fprintf (dump_file, "Begin extension elimination transformations\n");
++
++  replace_ext_with_copy ();
++
++  if (dump_file)
++    fprintf (dump_file, "\nRTL After Extension Elimination\n");
++
++  finish_pass ();
++
++  /* Print statistics */
++  if (dump_file)
++    {
++      fprintf (dump_file,
++               "Number of extensions ignored: %d (of %d candidiates)\nDETECTION EFFECTIVENESS: %f%%\n",
++               num_cand_ignored, num_cand,
++               ((float) (num_cand - num_cand_ignored) / (float) num_cand) *
++               100);
++      fprintf (dump_file,
++               "Number of extensions converted to copy: %d (of %d candidiates)\nCONVERSION EFFECTIVENESS: %f%%\n",
++               num_cand_transformed, num_cand,
++               ((float) num_cand_transformed / (float) num_cand) * 100);
++    }
++}
++
++/* Remove redundant extensions.  */
++
++static unsigned int
++rest_of_handle_extelim (void)
++{
++  extension_elimination ();
++  return 0;
++}
++
++/* Run extelim pass when flag_extelim is set at optimization level > 0.  */
++
++static bool
++gate_handle_extelim (void)
++{
++  return (optimize > 0 && flag_extelim);
++}
++
++struct rtl_opt_pass pass_rtl_extelim = {
++  {
++   RTL_PASS,
++   "extelim",                   /* name */
++   gate_handle_extelim,         /* gate */
++   rest_of_handle_extelim,      /* execute */
++   NULL,                        /* sub */
++   NULL,                        /* next */
++   0,                           /* static_pass_number */
++   TV_EXTELIM,                  /* tv_id */
++   0,                           /* properties_required */
++   0,                           /* properties_provided */
++   0,                           /* properties_destroyed */
++   0,                           /* todo_flags_start */
++   TODO_ggc_collect | TODO_dump_func | TODO_df_finish | TODO_verify_rtl_sharing,        /* todo_flags_finish */
++   }
++};
+diff -Naur gcc-4.7.1/gcc/config.gcc gcc-4.7.1-extelim-v4/gcc/config.gcc
+--- gcc-4.7.1/gcc/config.gcc	2012-10-31 07:52:07.285238149 -0500
++++ gcc-4.7.1-extelim-v4/gcc/config.gcc	2012-11-02 03:59:15.803237359 -0500
+@@ -417,6 +417,8 @@
+ 		cpu_is_64bit=yes
+ 		;;
+ 	esac
++	tm_defines="${tm_defines} ENABLE_EXTELIM"
++	extra_objs="extelim.o"
+ 	extra_options="${extra_options} g.opt fused-madd.opt rs6000/rs6000-tables.opt"
+ 	;;
+ rs6000*-*-*)
+diff -Naur gcc-4.7.1/gcc/opts.c gcc-4.7.1-extelim-v4/gcc/opts.c
+--- gcc-4.7.1/gcc/opts.c	2012-01-10 10:27:55.000000000 -0600
++++ gcc-4.7.1-extelim-v4/gcc/opts.c	2012-10-31 06:14:17.344237543 -0500
+@@ -485,6 +485,9 @@
+     { OPT_LEVELS_2_PLUS, OPT_falign_jumps, NULL, 1 },
+     { OPT_LEVELS_2_PLUS, OPT_falign_labels, NULL, 1 },
+     { OPT_LEVELS_2_PLUS, OPT_falign_functions, NULL, 1 },
++#ifdef ENABLE_EXTELIM 
++    { OPT_LEVELS_2_PLUS, OPT_fextelim, NULL, 1 },
++#endif
+     { OPT_LEVELS_2_PLUS, OPT_ftree_tail_merge, NULL, 1 },
+     { OPT_LEVELS_2_PLUS_SPEED_ONLY, OPT_foptimize_strlen, NULL, 1 },
+ 
+diff -Naur gcc-4.7.1/gcc/testsuite/gcc.target/powerpc/rldic-1.c gcc-4.7.1-extelim-v4/gcc/testsuite/gcc.target/powerpc/rldic-1.c
+--- gcc-4.7.1/gcc/testsuite/gcc.target/powerpc/rldic-1.c	1969-12-31 18:00:00.000000000 -0600
++++ gcc-4.7.1-extelim-v4/gcc/testsuite/gcc.target/powerpc/rldic-1.c	2012-11-05 00:43:33.619237992 -0600
+@@ -0,0 +1,33 @@
++/* { dg-do run { target { powerpc*-*-* } } } */
++/* skip test unless -m64 is present */
++/* { dg-skip-if "" { powerpc*-*-* } { "*" } { "-m64" } } */
++/* { dg-options "-O3 -save-temps" } */
++
++int sum;
++
++void sum1 ( unsigned  int N, short *C) __attribute__((__noinline__)); 
++void sum1 ( unsigned  int N, short *C) 
++{
++        unsigned int i;
++
++        for (i=0; i<N; i++)
++        {
++                sum += C[i*N];
++        }
++} __attribute__((__noinline__))
++int main()
++{
++        short C [5*5] = { 1 , 0, 0, 0, 0, 
++        2 , 0, 0, 0, 0, 
++        3 , 0, 0, 0, 0, 
++        4 , 0, 0, 0, 0, 
++        5 , 0, 0, 0, 0,         
++        };
++        sum1 (5, C);
++        return (sum==15 ? 0 : 1);
++}
++
++
++
++/* { dg-final { scan-assembler-times "rldic " 1  { target powerpc*-*-*  } } } */
++/* { dg-final { cleanup-saved-temps } } */
+diff -Naur gcc-4.7.1/gcc/timevar.def gcc-4.7.1-extelim-v4/gcc/timevar.def
+--- gcc-4.7.1/gcc/timevar.def	2011-12-21 05:52:27.000000000 -0600
++++ gcc-4.7.1-extelim-v4/gcc/timevar.def	2012-10-31 03:12:42.109238187 -0500
+@@ -197,6 +197,7 @@
+ DEFTIMEVAR (TV_VARCONST              , "varconst")
+ DEFTIMEVAR (TV_LOWER_SUBREG	     , "lower subreg")
+ DEFTIMEVAR (TV_JUMP                  , "jump")
++DEFTIMEVAR (TV_EXTELIM               , "extension elimination")
+ DEFTIMEVAR (TV_FWPROP                , "forward prop")
+ DEFTIMEVAR (TV_CSE                   , "CSE")
+ DEFTIMEVAR (TV_DCE                   , "dead code elimination")
+diff -Naur gcc-4.6.3-orig/gcc/config/rs6000/extelim.c gcc-4.6.3/gcc/config/rs6000/extelim.c
+--- gcc-4.6.3-orig/gcc/config/rs6000/extelim.c	2012-11-30 16:01:48.701986000 -0600
++++ gcc-4.6.3/gcc/config/rs6000/extelim.c	2012-11-30 15:54:09.636986000 -0600
+@@ -411,6 +411,10 @@
+ Iteration 32:
+  - Fix issue with spec2k6 soplex where zero-extends duplicated
+    even if shift is already zero-extended.
++Iteration 33:
++ - Fix issue with spec2k perlbmk using '-O3 -flto -funroll-loops'
++   where the duplication of an extension was wrong because
++   the register rtx's are shared. See save_ext_use_p() for details.
+ */
+ 
+ #include "config.h"
+@@ -2869,7 +2873,26 @@
+   if (GET_CODE (use) != SET)
+     return false;
+ 
+-  /* 1. Duplicate the extension at certain CODEs that are known to generate 
++  /* 1. If the use defines itself, e.g.
++     128 = ZERO_EXTEND (159) ; the def
++     ...
++     128 = ASHIFT (128) ; the use
++     ...
++     use 128 ; use reached by the self-assign above
++     then disallow the duplication. RTX's are shared within an insn 
++     so you end up with
++     128 = ZERO_EXTEND (159)
++     ...
++     NewVR = ZERO_EXTEND (128) ; the duplicate extension
++     NewVR = ASHIFT(NewVR) ; wrong! should define 128 for next use 
++     ...
++     use 128
++  */
++  if (REGNO(SET_DEST(use)) == REGNO(SET_DEST(ext)))
++    return false;
++  
++
++  /* 2. Duplicate the extension at certain CODEs that are known to generate 
+      a target insn when paired with the extension duplication. E.g. 
+      128 = ZERO_EXTEND (159)
+      153 = ASHIFT (128)
+@@ -2883,7 +2906,7 @@
+           return false;
+     }
+ 
+-  /* 2. Check if all other definitions reaching this use are already extended,
++  /* 3. Check if all other definitions reaching this use are already extended,
+      and therefore duplicating the extension does not change the value
+      of that reaching definition. (testcase: nof/muldf3.c) */
+   df_use = df_find_use (use_insn, ext_dest);
+--- gcc-4.7.2-orig/gcc/config/rs6000/extelim.c	2013-01-15 11:26:54.761989180 -0600
++++ gcc-4.7.2/gcc/config/rs6000/extelim.c	2013-01-15 11:27:57.933986000 -0600
+@@ -415,6 +415,16 @@
+  - Fix issue with spec2k perlbmk using '-O3 -flto -funroll-loops'
+    where the duplication of an extension was wrong because
+    the register rtx's are shared. See save_ext_use_p() for details.
++Iteration 34:
++-  Bug Fix: Clearquest issue ENGR00239811. 
++   We end up with consecutive extensions (one inserted, one previously there) due
++   to extension insertions are return insns.
++   This is not great, but shouldn't be catastrophic as one will be transformed to a copy.
++   The order in which the extensions are processed in windows and linux is different,
++   however. The 'combine' pass fails to treat the windows/linux cases equally and 
++   misses an important extension in the windows program. Combine is complex and 
++   there's no obvious reason why it is failing, so we disallow an extension insertion
++   at the return insn if the previous insn is an extension.
+ */
+ 
+ #include "config.h"
+@@ -3181,6 +3191,29 @@
+   dest = SET_DEST (rtn);
+   src = SET_SRC (rtn);
+ 
++  /* Do not insert extension if the preceeding insn is already an extension. 
++     - Bug: ENGR00239811. 
++     We end up with consecutive extensions (one inserted, one previously there).
++     This is not great, but shouldn't be catastrophic as one will be transformed to a copy.
++     The order in which the extensions are processed in windows and linux is different,
++     however. Combine fails to treat either case equally and misses an important extension
++     in the windows program. Combine is complex and there's no obvious reason why it is
++     failing, so this will have to do. */
++ if (PREV_INSN (rtn_insn) && NONDEBUG_INSN_P (PREV_INSN (rtn_insn))) 
++    {
++      rtx prev_insn = PATTERN (PREV_INSN (rtn_insn));
++      if (GET_CODE (prev_insn) == SET) 
++        {
++          enum rtx_code prev_code = GET_CODE (SET_SRC (prev_insn));
++          if (prev_code == ZERO_EXTEND || prev_code == SIGN_EXTEND) 
++            {
++              if (dump_file)
++                fprintf (dump_file, "failed-- prev insn is an extension\n");
++              return;
++            }
++        }
++    }
++
+   /* Deal with scalar rtn values only */
+   if (fun_mode != DImode
+       && fun_mode != SImode && fun_mode != HImode && fun_mode != QImode)
+--- gcc-4.7.2/gcc/config/rs6000/extelim.c	2013-04-02 13:17:08.644779000 -0500
++++ gcc-4.8.0/gcc/config/rs6000/extelim.c	2013-04-11 13:48:23.864779000 -0500
+@@ -425,6 +425,9 @@
+    misses an important extension in the windows program. Combine is complex and 
+    there's no obvious reason why it is failing, so we disallow an extension insertion
+    at the return insn if the previous insn is an extension.
++Iteration 35:
++- Port to gcc 4.8 ( vec.h and bb_loop_depth )
++
+ */
+ 
+ #include "config.h"
+@@ -456,6 +459,7 @@
+ #include "cgraph.h"
+ #include "df.h"
+ #include "vec.h"
++#include "cfgloop.h"
+ 
+ /* Feature flags */
+ /* Duplicate extensions at each immediate use */
+@@ -465,18 +469,18 @@
+ 
+ 
+ /* Typedefs */
+-typedef unsigned int insn_flag_t;       /* Insn flags type */
+-typedef int extelim_uid_t;      /* UID type */
+-DEF_VEC_I (insn_flag_t);        /* Define vector type and allocation type */
+-DEF_VEC_ALLOC_I (insn_flag_t, heap);
++typedef unsigned int insn_flag_t;/* Insn flags type */
++typedef int extelim_uid_t;       /* UID type */
+ 
+ typedef struct GTY (()) ext_record
+ {
+   rtx ext;                      /* The extension insn */
+-  VEC (rtx, heap) * ext_uses;   /* List of use records for this extension. For some
++  vec<rtx, va_gc> *ext_uses;
++                                /* List of use records for this extension. For some
+                                    some extensions, we will duplicate the extension
+                                    at these use points. */
+-  VEC (rtx, heap) * ext_updates;/* List of rtx that need to be updated if the extension
++  vec<rtx, va_gc> *ext_updates; 
++                               /* List of rtx that need to be updated if the extension
+                                    is to be eliminated. For example, SUBREG_PROMOTED flags
+                                    on SUBREG uses defined by this extension should
+                                    be reset since the extension is eliminated. The PROMOTED
+@@ -490,24 +494,22 @@
+ } regspec_cb_data_t;
+ 
+ /* Static variables */
+-DEF_VEC_P (ext_record_t);
+-DEF_VEC_ALLOC_P (ext_record_t, heap);
+-VEC (ext_record_t, heap) * extensions;  /* Vector holding all extension records */
+-VEC (insn_flag_t, heap) * insn_flags;   /* Vector holding flags for all insns */
+-VEC (rtx, heap) * returns;      /* Vector holding return insns for this function */
++vec<insn_flag_t, va_gc>  *insn_flags; 
++vec<ext_record_t, va_gc> *extensions;
++vec<rtx, va_gc> *returns;
+ 
+      static extelim_uid_t max_uid;      /* Max UID insn value for insn_flags allocation */
+      static ext_record_t current_ext_record; /* Current extension record being processed */
+ 
+ /* Statistics */
+-     static int num_cand;       /* Number of extensions detected */
++     static int num_cand;               /* Number of extensions detected */
+      static int num_cand_ignored;       /* Number of extensions ignored */
+      static int num_cand_transformed;   /* Number of extensions transformed to copy */
+ 
+ /* Basic information about the extension being processed */
+      enum machine_mode ext_to_mode;     /* Mode extended to */
+      enum machine_mode ext_from_mode;   /* Mode extended from */
+-     enum rtx_code ext_code;    /* Sign or zero extend */
++     enum rtx_code ext_code;            /* Sign or zero extend */
+ 
+ /* Insn use analysis possible results */
+      enum insn_use_results
+@@ -535,12 +537,15 @@
+ 
+ /* Query the insn flag */
+ 
+-     static bool insn_flag_p (insn_flag_t set_p, extelim_uid_t uid)
++static bool insn_flag_p (insn_flag_t set_p, extelim_uid_t uid)
+ {
+-  insn_flag_t flags;
+-
+-  if (((flags = VEC_index (insn_flag_t, insn_flags, uid)) & set_p) == set_p)
+-    return true;
++  insn_flag_t * flags;
++  
++  if (vec_safe_iterate (insn_flags, uid, &flags))
++    {
++      if ((*flags & set_p) == set_p)
++        return true;
++    }
+ 
+   return false;
+ }
+@@ -550,10 +555,9 @@
+ static void
+ insn_flag_set (insn_flag_t flags, extelim_uid_t uid)
+ {
+-  insn_flag_t set;
+-  set = VEC_index (insn_flag_t, insn_flags, uid);
+-  set |= flags;
+-  VEC_replace (insn_flag_t, insn_flags, uid, set);
++  insn_flag_t *set;
++  gcc_assert (vec_safe_iterate (insn_flags, uid, &set));
++  *set |= flags;
+ }
+ 
+ /* Clear insn flags */
+@@ -561,10 +565,9 @@
+ static void
+ insn_flag_clear (insn_flag_t flags, extelim_uid_t uid)
+ {
+-  insn_flag_t clear;
+-  clear = VEC_index (insn_flag_t, insn_flags, uid);
+-  clear &= ~flags;
+-  VEC_replace (insn_flag_t, insn_flags, uid, clear);
++  insn_flag_t * clear;
++  gcc_assert (vec_safe_iterate (insn_flags, uid, &clear));
++  *clear &= ~flags;
+ }
+ 
+ /* Set static variable max_uid to the largest
+@@ -613,6 +616,7 @@
+ init_flags_vector (void)
+ {
+   extelim_uid_t i;
++  insn_flag_t * flags;
+   /* Get the maximum uid value. We'll use this
+      information to set up a vector of max_uid
+      length. Each element of the vector will hold
+@@ -620,14 +624,9 @@
+   max_uid = 0;
+   set_max_uid ();
+ 
+-  /* Allocate the vector of insn flags */
+-  insn_flags = VEC_alloc (insn_flag_t, heap, max_uid);
+-
+-  /* Initialize the insn flags vector */
+-  for (i = 0; i < max_uid; i++)
+-    {
+-      VEC_quick_insert (insn_flag_t, insn_flags, i, EXTELIM_NONE);
+-    }
++  /* Allocate and populate vector of insn flags */
++  /* Vector is init'd to 0 (EXTELIM_NONE) */
++  vec_safe_grow_cleared (insn_flags, max_uid);
+ }
+ 
+ /* Initialize this pass */
+@@ -638,6 +637,10 @@
+   /* Init insn flags vector */
+   init_flags_vector ();
+ 
++  /* Init statics */
++  vec_alloc(extensions, 0);
++  vec_alloc(returns, 0);
++
+   /* This pass requires def-use chain information */
+   df_chain_add_problem (DF_DU_CHAIN + DF_UD_CHAIN);
+   df_analyze ();
+@@ -649,15 +652,16 @@
+   ext_record_t ext_record;
+   unsigned i;
+ 
+-  FOR_EACH_VEC_ELT (ext_record_t, extensions, i, ext_record)
+-  {
+-    if (!VEC_empty (rtx, ext_record->ext_uses))
+-      VEC_free (rtx, heap, ext_record->ext_uses);
+-
+-    if (!VEC_empty (rtx, ext_record->ext_updates))
+-      VEC_free (rtx, heap, ext_record->ext_updates);
+-  }
+-  VEC_free (ext_record_t, heap, extensions);
++  FOR_EACH_VEC_SAFE_ELT (extensions, i, ext_record)
++    {
++      if (!vec_safe_is_empty(ext_record->ext_uses))
++        vec_free(ext_record->ext_uses);
++      if (!vec_safe_is_empty(ext_record->ext_updates))
++        vec_free(ext_record->ext_updates);
++    }
++      
++  if (!vec_safe_is_empty(extensions))
++    vec_free(extensions);
+ }
+ 
+ /* Clean up this pass */
+@@ -666,14 +670,16 @@
+ finish_pass (void)
+ {
+   free_extensions ();
+-  VEC_free (insn_flag_t, heap, insn_flags);
+-  VEC_free (rtx, heap, returns);
++  if (!vec_safe_is_empty(insn_flags))
++    vec_free(insn_flags);
++  if (!vec_safe_is_empty(returns))
++    vec_free(returns);
+ }
+ 
+ static void
+ update_uid_vectors (extelim_uid_t uid)
+ {
+-  VEC_safe_grow_cleared (insn_flag_t, heap, insn_flags, uid + 1);
++  vec_safe_grow_cleared(insn_flags, uid + 1);
+ }
+ 
+ /* Emit a insn before a given insn, update vector lengths
+@@ -789,13 +795,21 @@
+ static bool
+ ignore_extension_prev_p (rtx ext_insn, rtx prev_insn)
+ {
+-  rtx prev_dest, prev_src, prev = PATTERN (prev_insn);
++  rtx prev_dest, prev_src, prev;
+   rtx ext_src, ext = PATTERN (ext_insn);
+ 
+-  /* It's OK to allow extension with no accompanying prev real insn */
+-  if (!NONDEBUG_INSN_P (prev_insn) || NOTE_P (prev_insn))
++  /* Find a real previous insn, ignoring debug and notes */
++  while (prev_insn && (!NONDEBUG_INSN_P (prev_insn) || NOTE_P (prev_insn)))
++    {
++      prev_insn = PREV_INSN (prev_insn);
++    }
++
++  /* Beginning of block reached */
++  if (prev_insn == NULL_RTX)
+     return false;
+ 
++  prev = PATTERN (prev_insn);
++
+   if (GET_CODE (prev) != SET)
+     return false;
+ 
+@@ -867,6 +881,7 @@
+   rtx insn, dest, inner;
+   int preserved_size;
+   ext_record_t extrec;
++  bool has_extensions;
+ 
+   /* For all insns, call note_use for each use in insn.  */
+   FOR_EACH_BB (bb)
+@@ -913,22 +928,23 @@
+ 
+       extrec = (ext_record_t) xmalloc (sizeof (struct ext_record));
+       extrec->ext = insn;
+-      extrec->ext_uses = NULL;
+-      extrec->ext_updates = NULL;
+-      VEC_safe_push (ext_record_t, heap, extensions, extrec);
++      vec_alloc(extrec->ext_uses, 0);
++      vec_alloc(extrec->ext_updates, 0);
++      vec_safe_push(extensions, extrec);
+       num_cand++;
+     }
+   }
+ 
+   if (dump_file)
+     {
+-      if (!VEC_empty (ext_record_t, extensions))
++      if (! vec_safe_is_empty(extensions)) 
+         fprintf (dump_file, "\n");
+       else
+         fprintf (dump_file, "no extensions found.\n");
+     }
+ 
+-  return !VEC_empty (ext_record_t, extensions);
++  has_extensions = !vec_safe_is_empty(extensions);
++  return (has_extensions);
+ }
+ 
+ /* Return true if the rtx mode is a supported mode for
+@@ -1648,7 +1664,7 @@
+ save_ext_update (ext_record_t extrec, rtx exp)
+ {
+   /* Save this expression to be updated if the extension is eliminated. */
+-  VEC_safe_push (rtx, heap, extrec->ext_updates, exp);
++  vec_safe_push(extrec->ext_updates, exp);
+ }
+ 
+ /* Check a compare operation to determine whether the operands
+@@ -2435,7 +2451,7 @@
+   bool updated=false;
+ 
+ 
+-  FOR_EACH_VEC_ELT (rtx, extrec->ext_updates, i, exp)
++  FOR_EACH_VEC_SAFE_ELT (extrec->ext_updates, i, exp)
+     {
+       updated |= process_ext_update (exp);
+     }
+@@ -2679,7 +2695,7 @@
+   ext_record_t extrec;
+   unsigned i;
+ 
+-  FOR_EACH_VEC_ELT (ext_record_t, extensions, i, extrec)
++  FOR_EACH_VEC_SAFE_ELT (extensions, i, extrec)
+   {
+     const char *inserted = insn_flag_p (EXTELIM_INSERTED,
+                                         INSN_UID (extrec->
+@@ -2983,7 +2999,7 @@
+   /* Mark the use insn, it will have a duplicate inserted */
+   insn_flag_set (EXTELIM_INSERTED_FOR, INSN_UID (use_insn));
+   /* Save use to the list of uses to be duplicated for this extension. */
+-  VEC_safe_push (rtx, heap, extrec->ext_uses, use_insn);
++  vec_safe_push(extrec->ext_uses, use_insn);
+ }
+ 
+ 
+@@ -3065,7 +3081,7 @@
+     fprintf (dump_file, "Duplicate Extension at Uses pass.\n");
+ 
+   /* Get the uses where the extensions will be duplicated */
+-  FOR_EACH_VEC_ELT (ext_record_t, extensions, i, extrec)
++  FOR_EACH_VEC_SAFE_ELT (extensions, i, extrec)
+   {
+     if (dump_file)
+       fprintf (dump_file, "gathering extension uid=%u use information\n",
+@@ -3074,9 +3090,9 @@
+   }
+ 
+   /* Now duplicate the extensions at the appropriate use points */
+-  FOR_EACH_VEC_ELT (ext_record_t, extensions, i, extrec)
++  FOR_EACH_VEC_SAFE_ELT (extensions, i, extrec)
+   {
+-    FOR_EACH_VEC_ELT (rtx, extrec->ext_uses, j, use_insn)
++    FOR_EACH_VEC_SAFE_ELT (extrec->ext_uses, j, use_insn)
+     {
+       insert_duplicate_ext_at_use (extrec->ext, use_insn);
+     }
+@@ -3146,7 +3162,7 @@
+       if (dump_file)
+         fprintf (dump_file, " found return at uid=%u\n", INSN_UID (rtn_insn));
+ 
+-      VEC_safe_push (rtx, heap, returns, rtn_insn);
++      vec_safe_push(returns, rtn_insn);
+       found = true;
+     }
+   }
+@@ -3305,7 +3321,7 @@
+   /* For each return instruction, generate a sign/zero extend
+      if the current return size is larger than the function
+      return mode. */
+-  FOR_EACH_VEC_ELT (rtx, returns, i, rtn_insn)
++  FOR_EACH_VEC_SAFE_ELT (returns, i, rtn_insn)
+   {
+     if (dump_file)
+       fprintf (dump_file, " making extension at return uid=%u...",
+@@ -3336,7 +3352,7 @@
+   bb2 = BLOCK_FOR_INSN (ext2);
+ 
+   /* Sort high to low */
+-  return (bb2->loop_depth - bb1->loop_depth);
++  return (bb_loop_depth(bb2) - bb_loop_depth(bb1));
+ }
+ 
+ /* The main interface to this optimization. */
+@@ -3403,10 +3419,11 @@
+ 
+   /* Sort the extensions by loop depth. We want to try to eliminate
+      those in innermost loops (highest loop depth) first. */
+-  VEC_qsort (ext_record_t, extensions, ext_record_compare);
++  if (!vec_safe_is_empty(extensions))
++    extensions->qsort(ext_record_compare);
+ 
+   /* Iterate through extension worklist */
+-  FOR_EACH_VEC_ELT (ext_record_t, extensions, i, ext)
++  FOR_EACH_VEC_SAFE_ELT (extensions, i, ext)
+   {
+     rtx ext_insn = ext->ext;
+     rtx ext_src = SET_SRC (PATTERN (ext_insn));
+@@ -3420,7 +3437,7 @@
+       fprintf (dump_file,
+                "<analyzing %s %s extension uid=%u> (loop_depth=%d)\n",
+                inserted, ext_name, uid,
+-               BLOCK_FOR_INSN (ext_insn)->loop_depth);
++               bb_loop_depth(BLOCK_FOR_INSN (ext_insn)));
+ 
+     current_ext_record = ext;
+     eliminate_one_extend (ext->ext);
+@@ -3472,6 +3489,7 @@
+   {
+    RTL_PASS,
+    "extelim",                   /* name */
++   OPTGROUP_NONE,               /* optinfo_flags */
+    gate_handle_extelim,         /* gate */
+    rest_of_handle_extelim,      /* execute */
+    NULL,                        /* sub */
+@@ -3482,6 +3500,6 @@
+    0,                           /* properties_provided */
+    0,                           /* properties_destroyed */
+    0,                           /* todo_flags_start */
+-   TODO_ggc_collect | TODO_dump_func | TODO_df_finish | TODO_verify_rtl_sharing,        /* todo_flags_finish */
++   TODO_ggc_collect | TODO_df_finish | TODO_verify_rtl_sharing,        /* todo_flags_finish */
+    }
+ };
+diff -Naur gcc-4.8.1/gcc/config/rs6000/extelim.c gcc-4.8.1-extelim/gcc/config/rs6000/extelim.c
+--- gcc-4.8.1/gcc/config/rs6000/extelim.c	2013-07-24 03:30:41.516002676 -0500
++++ gcc-4.8.1-extelim/gcc/config/rs6000/extelim.c	2013-07-24 03:36:47.337002744 -0500
+@@ -416,7 +416,7 @@
+    where the duplication of an extension was wrong because
+    the register rtx's are shared. See save_ext_use_p() for details.
+ Iteration 34:
+--  Bug Fix: Clearquest issue ENGR00239811. 
++ -  Bug Fix: Clearquest issue ENGR00239811. 
+    We end up with consecutive extensions (one inserted, one previously there) due
+    to extension insertions are return insns.
+    This is not great, but shouldn't be catastrophic as one will be transformed to a copy.
+@@ -426,8 +426,10 @@
+    there's no obvious reason why it is failing, so we disallow an extension insertion
+    at the return insn if the previous insn is an extension.
+ Iteration 35:
+-- Port to gcc 4.8 ( vec.h and bb_loop_depth )
+-
++ - Port to gcc 4.8 ( vec.h and bb_loop_depth )
++Iteration 36:
++ - We end up with consecutive extensions (one inserted, one previously there) for
++   return instructions. Updated to select active 'prev_insn'.
+ */
+ 
+ #include "config.h"
+@@ -798,12 +800,6 @@
+   rtx prev_dest, prev_src, prev;
+   rtx ext_src, ext = PATTERN (ext_insn);
+ 
+-  /* Find a real previous insn, ignoring debug and notes */
+-  while (prev_insn && (!NONDEBUG_INSN_P (prev_insn) || NOTE_P (prev_insn)))
+-    {
+-      prev_insn = PREV_INSN (prev_insn);
+-    }
+-
+   /* Beginning of block reached */
+   if (prev_insn == NULL_RTX)
+     return false;
+@@ -878,7 +874,7 @@
+ find_extensions (void)
+ {
+   basic_block bb;
+-  rtx insn, dest, inner;
++  rtx insn, dest, inner, real_insn;
+   int preserved_size;
+   ext_record_t extrec;
+   bool has_extensions;
+@@ -899,8 +895,8 @@
+       /* We do not consider extensions that follow a load for
+          this target, as the code selector optimizes the sequence
+          to a load with sign extend or load with zero extend. */
+-      if (PREV_INSN (insn)
+-          && ignore_extension_prev_p (insn, PREV_INSN (insn)))
++      real_insn = prev_active_insn (insn);
++      if (real_insn && ignore_extension_prev_p (insn, real_insn))
+         {
+           if (dump_file)
+             fprintf (dump_file, "extension at uid=%d ignored\n",
+@@ -910,8 +906,8 @@
+         }
+       /* We don't consider certain sequences that are picked up by
+          insn selection. */
+-      if (NEXT_INSN (insn)
+-          && ignore_extension_next_p (insn, NEXT_INSN (insn)))
++      real_insn = next_active_insn (insn);
++      if (real_insn && ignore_extension_next_p (insn, real_insn))
+         {
+           if (dump_file)
+             fprintf (dump_file, "extension at uid=%d ignored\n",
+@@ -3200,7 +3196,7 @@
+ {
+   rtx rtn = PATTERN (rtn_insn);
+   rtx dest, src, new_ext_dest, new_ext_src, new_ext_outer, new_ext_part,
+-    new_ext_insn;
++    new_ext_insn, prev_insn = prev_active_insn (rtn_insn);
+   extelim_uid_t new_uid;
+   gcc_assert (GET_CODE (rtn) == SET);
+ 
+@@ -3215,9 +3211,9 @@
+      however. Combine fails to treat either case equally and misses an important extension
+      in the windows program. Combine is complex and there's no obvious reason why it is
+      failing, so this will have to do. */
+- if (PREV_INSN (rtn_insn) && NONDEBUG_INSN_P (PREV_INSN (rtn_insn))) 
++ if (prev_insn)
+     {
+-      rtx prev_insn = PATTERN (PREV_INSN (rtn_insn));
++      prev_insn = PATTERN(prev_insn);
+       if (GET_CODE (prev_insn) == SET) 
+         {
+           enum rtx_code prev_code = GET_CODE (SET_SRC (prev_insn));
+diff -Naur gcc-4.9.0/gcc/passes.def gcc-4.9.0-extelim-v4-49/gcc/passes.def
+--- gcc-4.9.0/gcc/passes.def    2014-06-23 06:53:56.202371998 -0500
++++ gcc-4.9.0-extelim-v4-49/gcc/passes.def      2014-06-23 06:47:57.177372771 -0500
+@@ -350,6 +353,9 @@
+       NEXT_PASS (pass_web);
+       NEXT_PASS (pass_rtl_cprop);
+       NEXT_PASS (pass_cse2);
++#ifdef ENABLE_EXTELIM
++      NEXT_PASS (pass_rtl_extelim);
++#endif
+       NEXT_PASS (pass_rtl_dse1);
+       NEXT_PASS (pass_rtl_fwprop_addr);
+       NEXT_PASS (pass_inc_dec);
+diff -Naur gcc-4.9.0/gcc/tree-pass.h gcc-4.9.0-extelim-v4-49/gcc/tree-pass.h
+--- gcc-4.9.0/gcc/tree-pass.h   2014-06-23 06:53:55.464372003 -0500
++++ gcc-4.9.0-extelim-v4-49/gcc/tree-pass.h     2014-06-23 06:55:48.850372107 -0500
+@@ -487,6 +490,9 @@
+
+ extern rtl_opt_pass *make_pass_expand (gcc::context *ctxt);
+ extern rtl_opt_pass *make_pass_instantiate_virtual_regs (gcc::context *ctxt);
++#ifdef ENABLE_EXTELIM
++extern rtl_opt_pass *make_pass_rtl_extelim (gcc::context *ctxt);
++#endif
+ extern rtl_opt_pass *make_pass_rtl_fwprop (gcc::context *ctxt);
+ extern rtl_opt_pass *make_pass_rtl_fwprop_addr (gcc::context *ctxt);
+ extern rtl_opt_pass *make_pass_jump (gcc::context *ctxt);
+
+diff -Naur gcc-4.9.0/gcc/config/rs6000/extelim.c gcc-4.9.0-extelim-v5-49/gcc/config/rs6000/extelim.c
+--- gcc-4.9.0/gcc/config/rs6000/extelim.c	2014-06-23 07:28:52.129371041 -0500
++++ gcc-4.9.0-extelim-v5-49/gcc/config/rs6000/extelim.c	2014-06-23 08:01:42.535372591 -0500
+@@ -583,7 +583,7 @@
+   rtx insn;
+   extelim_uid_t lmax_uid = 0;
+ 
+-  FOR_EACH_BB (bb) FOR_BB_INSNS (bb, insn)
++  FOR_EACH_BB_FN (bb, cfun) FOR_BB_INSNS (bb, insn)
+   {
+     if (INSN_P (insn))
+       {
+@@ -880,7 +880,7 @@
+   bool has_extensions;
+ 
+   /* For all insns, call note_use for each use in insn.  */
+-  FOR_EACH_BB (bb)
++  FOR_EACH_BB_FN (bb, cfun)
+   {
+     FOR_BB_INSNS (bb, insn)
+     {
+@@ -3144,7 +3144,7 @@
+   bool found = false;
+ 
+   /* For all insns  */
+-  FOR_EACH_BB (bb)
++  FOR_EACH_BB_FN (bb, cfun)
+   {
+     FOR_BB_INSNS (bb, insn)
+     {
+@@ -3464,38 +3464,54 @@
+     }
+ }
+ 
+-/* Remove redundant extensions.  */
++namespace {
++
++const pass_data pass_data_rtl_extelim =
++{
++  RTL_PASS,							/* type */
++  "extelim", 							/* name */
++  OPTGROUP_NONE,						/* optinfo_flags */
++  true,								/* has_gate */
++  true,								/* has_execute */
++  TV_EXTELIM,							/* tv_id */
++  0,								/* properties_required */
++  0,								/* properties_provided */
++  0,								/* properties_destroyed */
++  0,								/* todo_flags_start */
++  ( TODO_df_finish | TODO_verify_rtl_sharing ),		/* todo_flags_finish */
++};
+ 
+-static unsigned int
+-rest_of_handle_extelim (void)
++class pass_rtl_extelim : public rtl_opt_pass
++{
++public:
++  pass_rtl_extelim (gcc::context *ctxt)
++    : rtl_opt_pass (pass_data_rtl_extelim, ctxt)
++  {}
++
++  /* opt_pass methods: */
++  virtual bool gate (function *)
++    {
++      /* Run extelim pass when flag_extelim is set at optimization level > 0.  */
++      return (optimize > 0 && flag_extelim);
++    }
++
++  virtual unsigned int execute (function *);
++
++}; // class pass_rtl_extelim
++
++/* Remove redundant extensions.  */
++unsigned int
++pass_rtl_extelim::execute (function *fun ATTRIBUTE_UNUSED)
+ {
+   extension_elimination ();
+   return 0;
+ }
+ 
+-/* Run extelim pass when flag_extelim is set at optimization level > 0.  */
++} // anon namespace
+ 
+-static bool
+-gate_handle_extelim (void)
++rtl_opt_pass *
++make_pass_rtl_extelim (gcc::context *ctxt)
+ {
+-  return (optimize > 0 && flag_extelim);
++  return new pass_rtl_extelim (ctxt);
+ }
+ 
+-struct rtl_opt_pass pass_rtl_extelim = {
+-  {
+-   RTL_PASS,
+-   "extelim",                   /* name */
+-   OPTGROUP_NONE,               /* optinfo_flags */
+-   gate_handle_extelim,         /* gate */
+-   rest_of_handle_extelim,      /* execute */
+-   NULL,                        /* sub */
+-   NULL,                        /* next */
+-   0,                           /* static_pass_number */
+-   TV_EXTELIM,                  /* tv_id */
+-   0,                           /* properties_required */
+-   0,                           /* properties_provided */
+-   0,                           /* properties_destroyed */
+-   0,                           /* todo_flags_start */
+-   TODO_ggc_collect | TODO_df_finish | TODO_verify_rtl_sharing,        /* todo_flags_finish */
+-   }
+-};
+diff -Naur gcc-4.9.0/gcc/config/rs6000/t-rs6000 gcc-4.9.0-extelim-v5-49/gcc/config/rs6000/t-rs6000
+--- gcc-4.9.0/gcc/config/rs6000/t-rs6000	2014-06-23 08:05:22.079372002 -0500
++++ gcc-4.9.0-extelim-v5-49/gcc/config/rs6000/t-rs6000	2014-06-23 08:01:31.479372221 -0500
+@@ -24,6 +24,14 @@
+ 	$(COMPILE) $<
+ 	$(POSTCOMPILE)
+ 
++extelim.o: $(srcdir)/config/rs6000/extelim.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
++   $(TREE_H) $(TM_P_H) $(FLAGS_H) $(REGS_H) hard-reg-set.h $(BASIC_BLOCK_H) \
++   insn-config.h $(FUNCTION_H) $(EXPR_H) $(INSN_ATTR_H) $(RECOG_H) \
++   toplev.h $(TARGET_H) $(TIMEVAR_H) $(OPTABS_H) insn-codes.h  \
++   output.h $(PARAMS_H) $(TREE_PASS_H) $(CGRAPH_H)
++	$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
++                $(srcdir)/config/rs6000/extelim.c
++
+ $(srcdir)/config/rs6000/rs6000-tables.opt: $(srcdir)/config/rs6000/genopt.sh \
+   $(srcdir)/config/rs6000/rs6000-cpus.def
+ 	$(SHELL) $(srcdir)/config/rs6000/genopt.sh $(srcdir)/config/rs6000 > \
+diff -Naur gcc-4.8.3/gcc/testsuite/gcc.dg/vect/vect-reduc-pattern-2b-big-array.c gcc-4.8.3-extelim-testcase/gcc/testsuite/gcc.dg/vect/vect-reduc-pattern-2b-big-array.c
+--- gcc-4.8.3/gcc/testsuite/gcc.dg/vect/vect-reduc-pattern-2b-big-array.c	2014-08-13 04:14:08.256015000 -0500
++++ gcc-4.8.3-extelim-testcase/gcc/testsuite/gcc.dg/vect/vect-reduc-pattern-2b-big-array.c	2014-08-13 04:50:51.579014349 -0500
+@@ -3,7 +3,7 @@
+ #include <stdarg.h>
+ #include "tree-vect.h"
+ 
+-#define N 128
++#define N 64
+ signed char data_ch[N];
+ 
+ volatile int y = 0;
+diff -Naur gcc-4.9.1/gcc/config/rs6000/extelim.c gcc-4.9.1-extelim/gcc/config/rs6000/extelim.c
+--- gcc-4.9.1/gcc/config/rs6000/extelim.c	2014-09-13 04:40:43.929455001 -0500
++++ gcc-4.9.1-extelim/gcc/config/rs6000/extelim.c	2014-09-13 06:09:08.426454227 -0500
+@@ -617,8 +617,6 @@
+ static void
+ init_flags_vector (void)
+ {
+-  extelim_uid_t i;
+-  insn_flag_t * flags;
+   /* Get the maximum uid value. We'll use this
+      information to set up a vector of max_uid
+      length. Each element of the vector will hold
+@@ -3351,10 +3349,15 @@
+   return (bb_loop_depth(bb2) - bb_loop_depth(bb1));
+ }
+ 
+-/* The main interface to this optimization. */
++static bool
++gate_handle_extelim (void)
++{
++  return (optimize > 0 && flag_extelim);
++}
+ 
+-static void
+-extension_elimination (void)
++/* The main interface to this optimization. */
++static unsigned int
++rest_of_handle_extelim (void)
+ {
+   ext_record_t ext;
+   unsigned i;
+@@ -3365,7 +3368,7 @@
+   if (!find_extensions ())
+     {
+       finish_pass ();
+-      return;
++      return 0;
+     }
+ 
+   /* Insert sign extension at return points in
+@@ -3401,7 +3404,7 @@
+  if (!find_extensions ())
+     {
+       finish_pass ();
+-      return;
++      return 0;
+     }
+ 
+   if (dump_file)
+@@ -3462,6 +3465,7 @@
+                num_cand_transformed, num_cand,
+                ((float) num_cand_transformed / (float) num_cand) * 100);
+     }
++  return 0;
+ }
+ 
+ namespace {
+@@ -3489,24 +3493,11 @@
+   {}
+ 
+   /* opt_pass methods: */
+-  virtual bool gate (function *)
+-    {
+-      /* Run extelim pass when flag_extelim is set at optimization level > 0.  */
+-      return (optimize > 0 && flag_extelim);
+-    }
+-
+-  virtual unsigned int execute (function *);
++  bool gate () { return gate_handle_extelim (); }
++  unsigned int execute () { return rest_of_handle_extelim (); }
+ 
+ }; // class pass_rtl_extelim
+ 
+-/* Remove redundant extensions.  */
+-unsigned int
+-pass_rtl_extelim::execute (function *fun ATTRIBUTE_UNUSED)
+-{
+-  extension_elimination ();
+-  return 0;
+-}
+-
+ } // anon namespace
+ 
+ rtl_opt_pass *
+diff -Naur gcc-4.9.1/gcc/config/rs6000/extelim.c gcc-4.9.1-signed-overlfow-check/gcc/config/rs6000/extelim.c
+--- gcc-4.9.1/gcc/config/rs6000/extelim.c	2014-09-13 12:52:27.030100930 -0500
++++ gcc-4.9.1-signed-overlfow-check/gcc/config/rs6000/extelim.c	2014-09-14 04:03:07.405101000 -0500
+@@ -203,7 +203,7 @@
+ 
+ PROGRAM STRUCTURE:
+ 
+-extension elimination                            -- main entry point
++rest_of_handle_extelim                           -- main entry point
+  find extensions                                 -- identify extension candidates
+  extension duplication                           -- insert extension at strategic points to
+                                                     enable removal of extensions at more frequently
+@@ -3352,7 +3352,8 @@
+ static bool
+ gate_handle_extelim (void)
+ {
+-  return (optimize > 0 && flag_extelim);
++  return (optimize > 0 && flag_extelim
++          && !flag_wrapv && !flag_trapv && flag_strict_overflow);
+ }
+ 
+ /* The main interface to this optimization. */
+diff -Naur gcc-4.9.1/gcc/config/rs6000/extelim.c gcc-4.9.1-extelim-fix/gcc/config/rs6000/extelim.c
+--- gcc-4.9.1/gcc/config/rs6000/extelim.c	2014-09-25 07:43:12.451678000 -0500
++++ gcc-4.9.1-extelim-fix/gcc/config/rs6000/extelim.c	2014-09-25 07:50:41.455678000 -0500
+@@ -1799,9 +1799,9 @@
+          previous extension and extends to at least the extent of the original. */
+       enum machine_mode cand_from_mode = GET_MODE (XEXP (src, 0));
+       enum machine_mode cand_to_mode = GET_MODE (src);
+-      if (GET_MODE_BITSIZE (cand_from_mode) >=
++      if (GET_MODE_BITSIZE (cand_from_mode) <=
+           GET_MODE_BITSIZE (ext_from_mode)
+-          && (GET_MODE_BITSIZE (cand_to_mode) <=
++          && (GET_MODE_BITSIZE (cand_to_mode) >=
+               GET_MODE_BITSIZE (ext_to_mode)))
+         return true;
+     }
+diff -Naur gcc-4.9.2/gcc/testsuite/gcc.dg/sms-1.c gcc-4.9.2_extelim_tests_update/gcc/testsuite/gcc.dg/sms-1.c
+--- gcc-4.9.2/gcc/testsuite/gcc.dg/sms-1.c	2009-04-27 07:17:09.000000000 -0500
++++ gcc-4.9.2_extelim_tests_update/gcc/testsuite/gcc.dg/sms-1.c	2014-11-12 23:31:23.056244230 -0600
+@@ -2,6 +2,7 @@
+    due to not handling of subreg in the lhs that is fixed.  */
+ /* { dg-do run } */
+ /* { dg-options "-O2 -fmodulo-sched -fmodulo-sched-allow-regmoves -fdump-rtl-sms" } */
++/* { dg-additional-options "-fno-extelim" { target { powerpc*-*-* && lp64 } } } */
+ 
+ 
+ #include <limits.h>
+diff -Naur gcc-4.9.2/gcc/testsuite/gcc.dg/sms-6.c gcc-4.9.2_extelim_tests_update/gcc/testsuite/gcc.dg/sms-6.c
+--- gcc-4.9.2/gcc/testsuite/gcc.dg/sms-6.c	2014-02-19 09:44:11.000000000 -0600
++++ gcc-4.9.2_extelim_tests_update/gcc/testsuite/gcc.dg/sms-6.c	2014-11-13 01:03:01.877797261 -0600
+@@ -2,6 +2,7 @@
+ /* { dg-require-effective-target size32plus } */
+ /* { dg-options "-O2 -fmodulo-sched -fdump-rtl-sms --param sms-min-sc=1" } */
+ /* { dg-options "-O2 -fmodulo-sched -fdump-rtl-sms --param sms-min-sc=1 -fmodulo-sched-allow-regmoves" { target powerpc*-*-* } } */
++/* { dg-additional-options "-fno-extelim" { target { powerpc*-*-* && lp64 } } } */
+ 
+ extern void abort (void);
+ 
+diff -Naur gcc-4.9.2/gcc/config/rs6000/t-rs6000 gcc-4.9.2-patch/gcc/config/rs6000/t-rs6000
+--- gcc-4.9.2/gcc/config/rs6000/t-rs6000	2015-01-14 08:01:13.552172999 -0600
++++ gcc-4.9.2-patch/gcc/config/rs6000/t-rs6000	2015-01-14 08:03:02.656172977 -0600
+@@ -24,13 +24,9 @@
+ 	$(COMPILE) $<
+ 	$(POSTCOMPILE)
+ 
+-extelim.o: $(srcdir)/config/rs6000/extelim.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
+-   $(TREE_H) $(TM_P_H) $(FLAGS_H) $(REGS_H) hard-reg-set.h $(BASIC_BLOCK_H) \
+-   insn-config.h $(FUNCTION_H) $(EXPR_H) $(INSN_ATTR_H) $(RECOG_H) \
+-   toplev.h $(TARGET_H) $(TIMEVAR_H) $(OPTABS_H) insn-codes.h  \
+-   output.h $(PARAMS_H) $(TREE_PASS_H) $(CGRAPH_H)
+-	$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
+-                $(srcdir)/config/rs6000/extelim.c
++extelim.o: $(srcdir)/config/rs6000/extelim.c 
++	$(COMPILE) $<
++	$(POSTCOMPILE)
+ 
+ $(srcdir)/config/rs6000/rs6000-tables.opt: $(srcdir)/config/rs6000/genopt.sh \
+   $(srcdir)/config/rs6000/rs6000-cpus.def
+diff -Naur gcc-4.9.2/gcc/context.c gcc-4.9.2-patch/gcc/context.c
+--- gcc-4.9.2/gcc/context.c	2014-01-02 16:23:26.000000000 -0600
++++ gcc-4.9.2-patch/gcc/context.c	2015-01-14 08:02:20.276171660 -0600
+@@ -20,6 +20,7 @@
+ #include "config.h"
+ #include "system.h"
+ #include "coretypes.h"
++#include "tm.h"
+ #include "ggc.h"
+ #include "context.h"
+ #include "pass_manager.h"
+diff -Naur gcc-4.9.2/gcc/testsuite/gcc.target/powerpc/ppc-fsl-extelim-2.c gcc-4.9.2-patch/gcc/testsuite/gcc.target/powerpc/ppc-fsl-extelim-2.c
+--- gcc-4.9.2/gcc/testsuite/gcc.target/powerpc/ppc-fsl-extelim-2.c	1969-12-31 18:00:00.000000000 -0600
++++ gcc-4.9.2-patch/gcc/testsuite/gcc.target/powerpc/ppc-fsl-extelim-2.c	2015-01-15 06:49:00.041172999 -0600
+@@ -0,0 +1,24 @@
++/* { dg-do compile { target { powerpc*-*-* } } } */
++/* { dg-options "-O2 -std=c99" } */
++/* { dg-final { scan-assembler "rlwinm \[0-9\]+,\[0-9\]+,\[0-9\]+,0xff"  { target { ilp32 } } } } */
++
++#define GET_MODULE(_id)         ((_id & 0x00003F00) >> 8)
++#define GET_IF(_id)             ((_id & 0x000000FF))
++#define GET_IF_ID(_module, _if) (((_module) << 8) | (_if))
++
++unsigned int dev;
++
++void testthebug(unsigned short i);
++
++void testbug(void)
++{
++  unsigned char  module;
++  unsigned char  interface;
++  unsigned short ifid;
++
++  module = GET_MODULE(dev);
++  interface = GET_IF(dev);
++  ifid = GET_IF_ID(module + 1, interface + 1);
++
++  testthebug(ifid);
++}
diff --git a/recipes-devtools/gcc/gcc-4.9/0005-uclibc-locale-no__x.patch b/recipes-devtools/gcc/gcc-4.9/0005-uclibc-locale-no__x.patch
new file mode 100644
index 0000000..dcbbfe4
--- /dev/null
+++ b/recipes-devtools/gcc/gcc-4.9/0005-uclibc-locale-no__x.patch
@@ -0,0 +1,257 @@
+From 6a3e8506a12c12728d8b29901defd738be43757f Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem at gmail.com>
+Date: Fri, 29 Mar 2013 08:42:36 +0400
+Subject: [PATCH 05/35] uclibc-locale-no__x
+
+Signed-off-by: Khem Raj <raj.khem at gmail.com>
+
+Upstream-Status: Pending
+---
+ .../config/locale/uclibc/c++locale_internal.h      |   45 ++++++++++++++++++++
+ libstdc++-v3/config/locale/uclibc/c_locale.cc      |   14 ------
+ libstdc++-v3/config/locale/uclibc/c_locale.h       |    1 +
+ .../config/locale/uclibc/collate_members.cc        |    7 ---
+ libstdc++-v3/config/locale/uclibc/ctype_members.cc |    7 ---
+ .../config/locale/uclibc/messages_members.cc       |    7 +--
+ .../config/locale/uclibc/messages_members.h        |   18 +++-----
+ .../config/locale/uclibc/monetary_members.cc       |    4 --
+ .../config/locale/uclibc/numeric_members.cc        |    3 --
+ libstdc++-v3/config/locale/uclibc/time_members.cc  |    3 --
+ 10 files changed, 55 insertions(+), 54 deletions(-)
+
+diff --git a/libstdc++-v3/config/locale/uclibc/c++locale_internal.h b/libstdc++-v3/config/locale/uclibc/c++locale_internal.h
+index 2ae3e4a..e74fddf 100644
+--- a/libstdc++-v3/config/locale/uclibc/c++locale_internal.h
++++ b/libstdc++-v3/config/locale/uclibc/c++locale_internal.h
+@@ -60,4 +60,49 @@ extern "C" __typeof(wcsxfrm_l) __wcsxfrm_l;
+ extern "C" __typeof(wctype_l) __wctype_l;
+ #endif
+ 
++# define __nl_langinfo_l nl_langinfo_l
++# define __strcoll_l strcoll_l
++# define __strftime_l strftime_l
++# define __strtod_l strtod_l
++# define __strtof_l strtof_l
++# define __strtold_l strtold_l
++# define __strxfrm_l strxfrm_l
++# define __newlocale newlocale
++# define __freelocale freelocale
++# define __duplocale duplocale
++# define __uselocale uselocale
++
++# ifdef _GLIBCXX_USE_WCHAR_T
++#  define __iswctype_l iswctype_l
++#  define __towlower_l towlower_l
++#  define __towupper_l towupper_l
++#  define __wcscoll_l wcscoll_l
++#  define __wcsftime_l wcsftime_l
++#  define __wcsxfrm_l wcsxfrm_l
++#  define __wctype_l wctype_l
++# endif
++
++#else
++# define __nl_langinfo_l(N, L)       nl_langinfo((N))
++# define __strcoll_l(S1, S2, L)      strcoll((S1), (S2))
++# define __strtod_l(S, E, L)         strtod((S), (E))
++# define __strtof_l(S, E, L)         strtof((S), (E))
++# define __strtold_l(S, E, L)        strtold((S), (E))
++# define __strxfrm_l(S1, S2, N, L)   strxfrm((S1), (S2), (N))
++# warning should dummy __newlocale check for C|POSIX ?
++# define __newlocale(a, b, c)        NULL
++# define __freelocale(a)             ((void)0)
++# define __duplocale(a)              __c_locale()
++//# define __uselocale ?
++//
++# ifdef _GLIBCXX_USE_WCHAR_T
++#  define __iswctype_l(C, M, L)       iswctype((C), (M))
++#  define __towlower_l(C, L)          towlower((C))
++#  define __towupper_l(C, L)          towupper((C))
++#  define __wcscoll_l(S1, S2, L)      wcscoll((S1), (S2))
++//#  define __wcsftime_l(S, M, F, T, L)  wcsftime((S), (M), (F), (T))
++#  define __wcsxfrm_l(S1, S2, N, L)   wcsxfrm((S1), (S2), (N))
++#  define __wctype_l(S, L)            wctype((S))
++# endif
++
+ #endif // GLIBC 2.3 and later
+diff --git a/libstdc++-v3/config/locale/uclibc/c_locale.cc b/libstdc++-v3/config/locale/uclibc/c_locale.cc
+index 5081dc1..21430d0 100644
+--- a/libstdc++-v3/config/locale/uclibc/c_locale.cc
++++ b/libstdc++-v3/config/locale/uclibc/c_locale.cc
+@@ -39,20 +39,6 @@
+ #include <langinfo.h>
+ #include <bits/c++locale_internal.h>
+ 
+-#ifndef __UCLIBC_HAS_XLOCALE__
+-#define __strtol_l(S, E, B, L)      strtol((S), (E), (B))
+-#define __strtoul_l(S, E, B, L)     strtoul((S), (E), (B))
+-#define __strtoll_l(S, E, B, L)     strtoll((S), (E), (B))
+-#define __strtoull_l(S, E, B, L)    strtoull((S), (E), (B))
+-#define __strtof_l(S, E, L)         strtof((S), (E))
+-#define __strtod_l(S, E, L)         strtod((S), (E))
+-#define __strtold_l(S, E, L)        strtold((S), (E))
+-#warning should dummy __newlocale check for C|POSIX ?
+-#define __newlocale(a, b, c)        NULL
+-#define __freelocale(a)             ((void)0)
+-#define __duplocale(a)              __c_locale()
+-#endif
+-
+ namespace std
+ {
+   template<>
+diff --git a/libstdc++-v3/config/locale/uclibc/c_locale.h b/libstdc++-v3/config/locale/uclibc/c_locale.h
+index da07c1f..4bca5f1 100644
+--- a/libstdc++-v3/config/locale/uclibc/c_locale.h
++++ b/libstdc++-v3/config/locale/uclibc/c_locale.h
+@@ -68,6 +68,7 @@ namespace __gnu_cxx
+ {
+   extern "C" __typeof(uselocale) __uselocale;
+ }
++#define __uselocale uselocale
+ #endif
+ 
+ namespace std
+diff --git a/libstdc++-v3/config/locale/uclibc/collate_members.cc b/libstdc++-v3/config/locale/uclibc/collate_members.cc
+index c2664a7..ec5c329 100644
+--- a/libstdc++-v3/config/locale/uclibc/collate_members.cc
++++ b/libstdc++-v3/config/locale/uclibc/collate_members.cc
+@@ -36,13 +36,6 @@
+ #include <locale>
+ #include <bits/c++locale_internal.h>
+ 
+-#ifndef __UCLIBC_HAS_XLOCALE__
+-#define __strcoll_l(S1, S2, L)      strcoll((S1), (S2))
+-#define __strxfrm_l(S1, S2, N, L)   strxfrm((S1), (S2), (N))
+-#define __wcscoll_l(S1, S2, L)      wcscoll((S1), (S2))
+-#define __wcsxfrm_l(S1, S2, N, L)   wcsxfrm((S1), (S2), (N))
+-#endif
+-
+ namespace std
+ {
+   // These are basically extensions to char_traits, and perhaps should
+diff --git a/libstdc++-v3/config/locale/uclibc/ctype_members.cc b/libstdc++-v3/config/locale/uclibc/ctype_members.cc
+index 7294e3a..7b12861 100644
+--- a/libstdc++-v3/config/locale/uclibc/ctype_members.cc
++++ b/libstdc++-v3/config/locale/uclibc/ctype_members.cc
+@@ -38,13 +38,6 @@
+ #undef _LIBC
+ #include <bits/c++locale_internal.h>
+ 
+-#ifndef __UCLIBC_HAS_XLOCALE__
+-#define __wctype_l(S, L)           wctype((S))
+-#define __towupper_l(C, L)         towupper((C))
+-#define __towlower_l(C, L)         towlower((C))
+-#define __iswctype_l(C, M, L)      iswctype((C), (M))
+-#endif
+-
+ namespace std
+ {
+   // NB: The other ctype<char> specializations are in src/locale.cc and
+diff --git a/libstdc++-v3/config/locale/uclibc/messages_members.cc b/libstdc++-v3/config/locale/uclibc/messages_members.cc
+index 13594d9..d7693b4 100644
+--- a/libstdc++-v3/config/locale/uclibc/messages_members.cc
++++ b/libstdc++-v3/config/locale/uclibc/messages_members.cc
+@@ -39,13 +39,10 @@
+ #ifdef __UCLIBC_MJN3_ONLY__
+ #warning fix gettext stuff
+ #endif
+-#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
+-extern "C" char *__dcgettext(const char *domainname,
+-			     const char *msgid, int category);
+ #undef gettext
+-#define gettext(msgid) __dcgettext(NULL, msgid, LC_MESSAGES)
++#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
++#define gettext(msgid) dcgettext(NULL, msgid, LC_MESSAGES)
+ #else
+-#undef gettext
+ #define gettext(msgid) (msgid)
+ #endif
+ 
+diff --git a/libstdc++-v3/config/locale/uclibc/messages_members.h b/libstdc++-v3/config/locale/uclibc/messages_members.h
+index 1424078..d89da33 100644
+--- a/libstdc++-v3/config/locale/uclibc/messages_members.h
++++ b/libstdc++-v3/config/locale/uclibc/messages_members.h
+@@ -36,15 +36,11 @@
+ #ifdef __UCLIBC_MJN3_ONLY__
+ #warning fix prototypes for *textdomain funcs
+ #endif
+-#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
+-extern "C" char *__textdomain(const char *domainname);
+-extern "C" char *__bindtextdomain(const char *domainname,
+-				  const char *dirname);
+-#else
+-#undef __textdomain
+-#undef __bindtextdomain
+-#define __textdomain(D)           ((void)0)
+-#define __bindtextdomain(D,P)     ((void)0)
++#ifndef __UCLIBC_HAS_GETTEXT_AWARENESS__
++#undef textdomain
++#undef bindtextdomain
++#define textdomain(D)           ((void)0)
++#define bindtextdomain(D,P)     ((void)0)
+ #endif
+ 
+   // Non-virtual member functions.
+@@ -70,7 +66,7 @@ extern "C" char *__bindtextdomain(const char *domainname,
+     messages<_CharT>::open(const basic_string<char>& __s, const locale& __loc,
+ 			   const char* __dir) const
+     {
+-      __bindtextdomain(__s.c_str(), __dir);
++      bindtextdomain(__s.c_str(), __dir);
+       return this->do_open(__s, __loc);
+     }
+ 
+@@ -90,7 +86,7 @@ extern "C" char *__bindtextdomain(const char *domainname,
+     {
+       // No error checking is done, assume the catalog exists and can
+       // be used.
+-      __textdomain(__s.c_str());
++      textdomain(__s.c_str());
+       return 0;
+     }
+ 
+diff --git a/libstdc++-v3/config/locale/uclibc/monetary_members.cc b/libstdc++-v3/config/locale/uclibc/monetary_members.cc
+index aa52731..2e6f80a 100644
+--- a/libstdc++-v3/config/locale/uclibc/monetary_members.cc
++++ b/libstdc++-v3/config/locale/uclibc/monetary_members.cc
+@@ -43,10 +43,6 @@
+ #warning tailor for stub locale support
+ #endif
+ 
+-#ifndef __UCLIBC_HAS_XLOCALE__
+-#define __nl_langinfo_l(N, L)         nl_langinfo((N))
+-#endif
+-
+ namespace std
+ {
+   // Construct and return valid pattern consisting of some combination of:
+diff --git a/libstdc++-v3/config/locale/uclibc/numeric_members.cc b/libstdc++-v3/config/locale/uclibc/numeric_members.cc
+index 883ec1a..2c70642 100644
+--- a/libstdc++-v3/config/locale/uclibc/numeric_members.cc
++++ b/libstdc++-v3/config/locale/uclibc/numeric_members.cc
+@@ -41,9 +41,6 @@
+ #ifdef __UCLIBC_MJN3_ONLY__
+ #warning tailor for stub locale support
+ #endif
+-#ifndef __UCLIBC_HAS_XLOCALE__
+-#define __nl_langinfo_l(N, L)         nl_langinfo((N))
+-#endif
+ 
+ namespace std
+ {
+diff --git a/libstdc++-v3/config/locale/uclibc/time_members.cc b/libstdc++-v3/config/locale/uclibc/time_members.cc
+index e0707d7..d848ed5 100644
+--- a/libstdc++-v3/config/locale/uclibc/time_members.cc
++++ b/libstdc++-v3/config/locale/uclibc/time_members.cc
+@@ -40,9 +40,6 @@
+ #ifdef __UCLIBC_MJN3_ONLY__
+ #warning tailor for stub locale support
+ #endif
+-#ifndef __UCLIBC_HAS_XLOCALE__
+-#define __nl_langinfo_l(N, L)         nl_langinfo((N))
+-#endif
+ 
+ namespace std
+ {
+-- 
+1.7.10.4
+
diff --git a/recipes-devtools/gcc/gcc-4.9/0005.gcc.extelim_vrp_kugan-v1-49x.patch b/recipes-devtools/gcc/gcc-4.9/0005.gcc.extelim_vrp_kugan-v1-49x.patch
new file mode 100644
index 0000000..8d06b1c
--- /dev/null
+++ b/recipes-devtools/gcc/gcc-4.9/0005.gcc.extelim_vrp_kugan-v1-49x.patch
@@ -0,0 +1,709 @@
+# Problem Statement:
+  Eliminate sign and zero extensions in PPC generated code based on
+  Value Range Information.
+
+# Owned by:
+  Rohit
+
+# Referred from patch by:
+  Kugan Vivekanandarajah
+
+# Action:
+  * Backport r213749 and r213750 from trunk to remove
+    redundant sign/zero extensions during RTL expansion.
+  * Fix ENGR00340415 and add test case.
+  * Add code to eliminate sign/zero extension for ternary operation.
+
+diff -Naur gcc-4.9.2/gcc/calls.c gcc-4.9.2-kugan-extelim-patch/gcc/calls.c
+--- gcc-4.9.2/gcc/calls.c	2014-03-20 06:35:22.000000000 -0500
++++ gcc-4.9.2-kugan-extelim-patch/gcc/calls.c	2014-11-12 06:58:40.207947839 -0600
+@@ -1499,8 +1499,10 @@
+ 	      args[i].initial_value
+ 		= gen_lowpart_SUBREG (mode, args[i].value);
+ 	      SUBREG_PROMOTED_VAR_P (args[i].initial_value) = 1;
+-	      SUBREG_PROMOTED_UNSIGNED_SET (args[i].initial_value,
+-					    args[i].unsignedp);
++	      if (promoted_for_signed_and_unsigned_p (args[i].tree_value, mode))
++		SUBREG_PROMOTED_SET (args[i].initial_value, SRP_SIGNED_AND_UNSIGNED);
++	      else
++		SUBREG_PROMOTED_SET (args[i].initial_value, args[i].unsignedp);
+ 	    }
+ 	}
+     }
+@@ -3375,7 +3377,7 @@
+ 
+ 	  target = gen_rtx_SUBREG (TYPE_MODE (type), target, offset);
+ 	  SUBREG_PROMOTED_VAR_P (target) = 1;
+-	  SUBREG_PROMOTED_UNSIGNED_SET (target, unsignedp);
++	  SUBREG_PROMOTED_SET (target, unsignedp);
+ 	}
+ 
+       /* If size of args is variable or this was a constructor call for a stack
+diff -Naur gcc-4.9.2/gcc/cfgexpand.c gcc-4.9.2-kugan-extelim-patch/gcc/cfgexpand.c
+--- gcc-4.9.2/gcc/cfgexpand.c	2014-04-22 08:15:24.000000000 -0500
++++ gcc-4.9.2-kugan-extelim-patch/gcc/cfgexpand.c	2014-11-12 06:58:40.208947888 -0600
+@@ -3265,7 +3265,7 @@
+ 	      ;
+ 	    else if (promoted)
+ 	      {
+-		int unsignedp = SUBREG_PROMOTED_UNSIGNED_P (target);
++		int unsignedp = SUBREG_PROMOTED_SIGN (target);
+ 		/* If TEMP is a VOIDmode constant, use convert_modes to make
+ 		   sure that we properly convert it.  */
+ 		if (CONSTANT_P (temp) && GET_MODE (temp) == VOIDmode)
+@@ -3277,7 +3277,13 @@
+ 					  GET_MODE (target), temp, unsignedp);
+ 		  }
+ 
+-		convert_move (SUBREG_REG (target), temp, unsignedp);
++		if ((SUBREG_PROMOTED_GET (target) == SRP_SIGNED_AND_UNSIGNED)
++		    && (GET_CODE (temp) == SUBREG)
++		    && (GET_MODE (target) == GET_MODE (temp))
++		    && (GET_MODE (SUBREG_REG (target)) == GET_MODE (SUBREG_REG (temp))))
++		  emit_move_insn (SUBREG_REG (target), SUBREG_REG (temp));
++		else
++		  convert_move (SUBREG_REG (target), temp, unsignedp);
+ 	      }
+ 	    else if (nontemporal && emit_storent_insn (target, temp))
+ 	      ;
+diff -Naur gcc-4.9.2/gcc/combine.c gcc-4.9.2-kugan-extelim-patch/gcc/combine.c
+--- gcc-4.9.2/gcc/combine.c	2014-07-08 10:43:39.000000000 -0500
++++ gcc-4.9.2-kugan-extelim-patch/gcc/combine.c	2014-11-12 06:58:40.211948210 -0600
+@@ -12433,7 +12433,7 @@
+       rsp = &reg_stat[regno];
+       if (rsp->last_set == insn)
+ 	{
+-	  if (SUBREG_PROMOTED_UNSIGNED_P (subreg) > 0)
++	  if (SUBREG_PROMOTED_UNSIGNED_P (subreg))
+ 	    rsp->last_set_nonzero_bits &= GET_MODE_MASK (mode);
+ 	}
+ 
+diff -Naur gcc-4.9.2/gcc/expr.c gcc-4.9.2-kugan-extelim-patch/gcc/expr.c
+--- gcc-4.9.2/gcc/expr.c	2014-09-01 05:14:22.000000000 -0500
++++ gcc-4.9.2-kugan-extelim-patch/gcc/expr.c	2014-11-12 06:59:50.555951666 -0600
+@@ -67,6 +67,7 @@
+ #include "params.h"
+ #include "tree-ssa-address.h"
+ #include "cfgexpand.h"
++#include "tree-ssa.h"
+ 
+ /* Decide whether a function's arguments should be processed
+    from first to last or from last to first.
+@@ -344,7 +345,7 @@
+   if (GET_CODE (from) == SUBREG && SUBREG_PROMOTED_VAR_P (from)
+       && (GET_MODE_PRECISION (GET_MODE (SUBREG_REG (from)))
+ 	  >= GET_MODE_PRECISION (to_mode))
+-      && SUBREG_PROMOTED_UNSIGNED_P (from) == unsignedp)
++      && SUBREG_CHECK_PROMOTED_SIGN (from, unsignedp))
+     from = gen_lowpart (to_mode, from), from_mode = to_mode;
+ 
+   gcc_assert (GET_CODE (to) != SUBREG || !SUBREG_PROMOTED_VAR_P (to));
+@@ -718,7 +719,7 @@
+ 
+   if (GET_CODE (x) == SUBREG && SUBREG_PROMOTED_VAR_P (x)
+       && GET_MODE_SIZE (GET_MODE (SUBREG_REG (x))) >= GET_MODE_SIZE (mode)
+-      && SUBREG_PROMOTED_UNSIGNED_P (x) == unsignedp)
++      && SUBREG_CHECK_PROMOTED_SIGN (x, unsignedp))
+     x = gen_lowpart (mode, SUBREG_REG (x));
+ 
+   if (GET_MODE (x) != VOIDmode)
+@@ -5226,25 +5227,25 @@
+ 	  && GET_MODE_PRECISION (GET_MODE (target))
+ 	     == TYPE_PRECISION (TREE_TYPE (exp)))
+ 	{
+-	  if (TYPE_UNSIGNED (TREE_TYPE (exp))
+-	      != SUBREG_PROMOTED_UNSIGNED_P (target))
++	  if (!SUBREG_CHECK_PROMOTED_SIGN (target,
++					  TYPE_UNSIGNED (TREE_TYPE (exp))))
+ 	    {
+ 	      /* Some types, e.g. Fortran's logical*4, won't have a signed
+ 		 version, so use the mode instead.  */
+ 	      tree ntype
+ 		= (signed_or_unsigned_type_for
+-		   (SUBREG_PROMOTED_UNSIGNED_P (target), TREE_TYPE (exp)));
++		   (SUBREG_PROMOTED_SIGN (target), TREE_TYPE (exp)));
+ 	      if (ntype == NULL)
+ 		ntype = lang_hooks.types.type_for_mode
+ 		  (TYPE_MODE (TREE_TYPE (exp)),
+-		   SUBREG_PROMOTED_UNSIGNED_P (target));
++		   SUBREG_PROMOTED_SIGN (target));
+ 
+ 	      exp = fold_convert_loc (loc, ntype, exp);
+ 	    }
+ 
+ 	  exp = fold_convert_loc (loc, lang_hooks.types.type_for_mode
+ 				  (GET_MODE (SUBREG_REG (target)),
+-				   SUBREG_PROMOTED_UNSIGNED_P (target)),
++				   SUBREG_PROMOTED_SIGN (target)),
+ 				  exp);
+ 
+ 	  inner_target = SUBREG_REG (target);
+@@ -5258,14 +5259,14 @@
+       if (CONSTANT_P (temp) && GET_MODE (temp) == VOIDmode)
+ 	{
+ 	  temp = convert_modes (GET_MODE (target), TYPE_MODE (TREE_TYPE (exp)),
+-				temp, SUBREG_PROMOTED_UNSIGNED_P (target));
++				temp, SUBREG_PROMOTED_SIGN (target));
+ 	  temp = convert_modes (GET_MODE (SUBREG_REG (target)),
+ 			        GET_MODE (target), temp,
+-			        SUBREG_PROMOTED_UNSIGNED_P (target));
++				SUBREG_PROMOTED_SIGN (target));
+ 	}
+ 
+       convert_move (SUBREG_REG (target), temp,
+-		    SUBREG_PROMOTED_UNSIGNED_P (target));
++		    SUBREG_PROMOTED_SIGN (target));
+ 
+       return NULL_RTX;
+     }
+@@ -9232,6 +9233,35 @@
+ }
+ #undef REDUCE_BIT_FIELD
+ 
++/* Return TRUE if value in SSA is zero and sign extended for wider mode MODE
++   using value range information stored.  Return FALSE otherwise.
++
++   This is used to check if SUBREG is zero and sign extended and to set
++   promoted mode SRP_SIGNED_AND_UNSIGNED to SUBREG.  */
++
++bool
++promoted_for_signed_and_unsigned_p (tree ssa, enum machine_mode mode)
++{
++  wide_int min, max;
++
++  if (ssa == NULL_TREE
++      || TREE_CODE (ssa) != SSA_NAME
++      || !INTEGRAL_TYPE_P (TREE_TYPE (ssa))
++      || (TYPE_PRECISION (TREE_TYPE (ssa)) != GET_MODE_PRECISION (mode)))
++    return false;
++
++  /* Return FALSE if value_range is not recorded for SSA.  */
++  if (get_range_info (ssa, &min, &max) != VR_RANGE)
++    return false;
++
++  /* Return true (to set SRP_SIGNED_AND_UNSIGNED to SUBREG) if MSB of the
++     smaller mode is not set (i.e.  MSB of ssa is not set).  */
++  if (!wi::neg_p (min, SIGNED) && !wi::neg_p(max, SIGNED))
++    return true;
++  else
++    return false;
++
++}
+ 
+ /* Return TRUE if expression STMT is suitable for replacement.  
+    Never consider memory loads as replaceable, because those don't ever lead 
+@@ -9514,7 +9544,10 @@
+ 
+ 	  temp = gen_lowpart_SUBREG (mode, decl_rtl);
+ 	  SUBREG_PROMOTED_VAR_P (temp) = 1;
+-	  SUBREG_PROMOTED_UNSIGNED_SET (temp, unsignedp);
++	  if (promoted_for_signed_and_unsigned_p (ssa_name, mode))
++	    SUBREG_PROMOTED_SET (temp, SRP_SIGNED_AND_UNSIGNED);
++	  else
++	    SUBREG_PROMOTED_SET (temp, unsignedp);
+ 	  return temp;
+ 	}
+ 
+diff -Naur gcc-4.9.2/gcc/expr.h gcc-4.9.2-kugan-extelim-patch/gcc/expr.h
+--- gcc-4.9.2/gcc/expr.h	2014-03-24 12:38:09.000000000 -0500
++++ gcc-4.9.2-kugan-extelim-patch/gcc/expr.h	2014-11-12 06:58:40.205947702 -0600
+@@ -446,6 +446,7 @@
+ 			       enum expand_modifier, rtx *, bool);
+ extern rtx expand_expr_real_2 (sepops, rtx, enum machine_mode,
+ 			       enum expand_modifier);
++extern bool promoted_for_signed_and_unsigned_p (tree, enum machine_mode);
+ 
+ /* Generate code for computing expression EXP.
+    An rtx for the computed value is returned.  The value is never null.
+diff -Naur gcc-4.9.2/gcc/function.c gcc-4.9.2-kugan-extelim-patch/gcc/function.c
+--- gcc-4.9.2/gcc/function.c	2014-07-10 05:41:15.000000000 -0500
++++ gcc-4.9.2-kugan-extelim-patch/gcc/function.c	2014-11-12 06:58:40.206947771 -0600
+@@ -3085,7 +3085,7 @@
+ 	  /* The argument is already sign/zero extended, so note it
+ 	     into the subreg.  */
+ 	  SUBREG_PROMOTED_VAR_P (tempreg) = 1;
+-	  SUBREG_PROMOTED_UNSIGNED_SET (tempreg, unsignedp);
++	  SUBREG_PROMOTED_SET (tempreg, unsignedp);
+ 	}
+ 
+       /* TREE_USED gets set erroneously during expand_assignment.  */
+diff -Naur gcc-4.9.2/gcc/ifcvt.c gcc-4.9.2-kugan-extelim-patch/gcc/ifcvt.c
+--- gcc-4.9.2/gcc/ifcvt.c	2014-09-30 05:33:25.000000000 -0500
++++ gcc-4.9.2-kugan-extelim-patch/gcc/ifcvt.c	2014-11-12 06:58:40.202947490 -0600
+@@ -1473,8 +1473,8 @@
+ 	  || byte_vtrue != byte_vfalse
+ 	  || (SUBREG_PROMOTED_VAR_P (vtrue)
+ 	      != SUBREG_PROMOTED_VAR_P (vfalse))
+-	  || (SUBREG_PROMOTED_UNSIGNED_P (vtrue)
+-	      != SUBREG_PROMOTED_UNSIGNED_P (vfalse)))
++	  || (SUBREG_PROMOTED_GET (vtrue)
++	      != SUBREG_PROMOTED_GET (vfalse)))
+ 	return NULL_RTX;
+ 
+       promoted_target = gen_reg_rtx (GET_MODE (reg_vtrue));
+@@ -1488,7 +1488,7 @@
+ 
+       target = gen_rtx_SUBREG (GET_MODE (vtrue), promoted_target, byte_vtrue);
+       SUBREG_PROMOTED_VAR_P (target) = SUBREG_PROMOTED_VAR_P (vtrue);
+-      SUBREG_PROMOTED_UNSIGNED_SET (target, SUBREG_PROMOTED_UNSIGNED_P (vtrue));
++      SUBREG_PROMOTED_SET (target, SUBREG_PROMOTED_GET (vtrue));
+       emit_move_insn (x, target);
+       return x;
+     }
+diff -Naur gcc-4.9.2/gcc/internal-fn.c gcc-4.9.2-kugan-extelim-patch/gcc/internal-fn.c
+--- gcc-4.9.2/gcc/internal-fn.c	2014-10-16 08:51:45.000000000 -0500
++++ gcc-4.9.2-kugan-extelim-patch/gcc/internal-fn.c	2014-11-12 06:58:40.196947034 -0600
+@@ -600,12 +600,12 @@
+ 	  if (GET_CODE (lopart0) == SUBREG)
+ 	    {
+ 	      SUBREG_PROMOTED_VAR_P (lopart0) = 1;
+-	      SUBREG_PROMOTED_UNSIGNED_SET (lopart0, 0);
++	      SUBREG_PROMOTED_SET (lopart0, 0);
+ 	    }
+ 	  if (GET_CODE (lopart1) == SUBREG)
+ 	    {
+ 	      SUBREG_PROMOTED_VAR_P (lopart1) = 1;
+-	      SUBREG_PROMOTED_UNSIGNED_SET (lopart1, 0);
++	      SUBREG_PROMOTED_SET (lopart1, 0);
+ 	    }
+ 	  tree halfstype = build_nonstandard_integer_type (hprec, 0);
+ 	  ops.op0 = make_tree (halfstype, lopart0);
+diff -Naur gcc-4.9.2/gcc/optabs.c gcc-4.9.2-kugan-extelim-patch/gcc/optabs.c
+--- gcc-4.9.2/gcc/optabs.c	2014-08-14 04:32:17.000000000 -0500
++++ gcc-4.9.2-kugan-extelim-patch/gcc/optabs.c	2014-11-12 06:58:40.193946790 -0600
+@@ -349,7 +349,7 @@
+      a promoted object differs from our extension.  */
+   if (! no_extend
+       || (GET_CODE (op) == SUBREG && SUBREG_PROMOTED_VAR_P (op)
+-	  && SUBREG_PROMOTED_UNSIGNED_P (op) == unsignedp))
++	  && SUBREG_CHECK_PROMOTED_SIGN (op, unsignedp)))
+     return convert_modes (mode, oldmode, op, unsignedp);
+ 
+   /* If MODE is no wider than a single word, we return a lowpart or paradoxical
+diff -Naur gcc-4.9.2/gcc/rtlanal.c gcc-4.9.2-kugan-extelim-patch/gcc/rtlanal.c
+--- gcc-4.9.2/gcc/rtlanal.c	2014-03-26 02:38:30.000000000 -0500
++++ gcc-4.9.2-kugan-extelim-patch/gcc/rtlanal.c	2014-11-12 06:58:40.195946953 -0600
+@@ -670,7 +670,7 @@
+     return true;
+ 
+   if (GET_CODE (op) == SUBREG
+-      && SUBREG_PROMOTED_UNSIGNED_P (op))
++      && SUBREG_PROMOTED_SIGN (op))
+     return true;
+ 
+   return false;
+@@ -4299,7 +4299,7 @@
+ 	 been zero-extended, we know that at least the high-order bits
+ 	 are zero, though others might be too.  */
+ 
+-      if (SUBREG_PROMOTED_VAR_P (x) && SUBREG_PROMOTED_UNSIGNED_P (x) > 0)
++      if (SUBREG_PROMOTED_VAR_P (x) && SUBREG_PROMOTED_UNSIGNED_P (x))
+ 	nonzero = GET_MODE_MASK (GET_MODE (x))
+ 		  & cached_nonzero_bits (SUBREG_REG (x), GET_MODE (x),
+ 					 known_x, known_mode, known_ret);
+@@ -4609,7 +4609,7 @@
+ 	 and we are looking at it in a wider mode, we know that at least the
+ 	 high-order bits are known to be sign bit copies.  */
+ 
+-      if (SUBREG_PROMOTED_VAR_P (x) && ! SUBREG_PROMOTED_UNSIGNED_P (x))
++      if (SUBREG_PROMOTED_VAR_P (x) && SUBREG_PROMOTED_SIGNED_P (x))
+ 	{
+ 	  num0 = cached_num_sign_bit_copies (SUBREG_REG (x), mode,
+ 					     known_x, known_mode, known_ret);
+diff -Naur gcc-4.9.2/gcc/rtl.h gcc-4.9.2-kugan-extelim-patch/gcc/rtl.h
+--- gcc-4.9.2/gcc/rtl.h	2014-01-23 02:24:38.000000000 -0600
++++ gcc-4.9.2-kugan-extelim-patch/gcc/rtl.h	2014-11-12 06:58:40.209947977 -0600
+@@ -1390,29 +1390,75 @@
+ #define SUBREG_PROMOTED_VAR_P(RTX)					\
+   (RTL_FLAG_CHECK1 ("SUBREG_PROMOTED", (RTX), SUBREG)->in_struct)
+ 
+-#define SUBREG_PROMOTED_UNSIGNED_SET(RTX, VAL)				\
+-do {									\
+-  rtx const _rtx = RTL_FLAG_CHECK1 ("SUBREG_PROMOTED_UNSIGNED_SET",	\
+-				    (RTX), SUBREG);			\
+-  if ((VAL) < 0)							\
+-    _rtx->volatil = 1;							\
+-  else {								\
+-    _rtx->volatil = 0;							\
+-    _rtx->unchanging = (VAL);						\
+-  }									\
+-} while (0)
+-
+ /* Valid for subregs which are SUBREG_PROMOTED_VAR_P().  In that case
+    this gives the necessary extensions:
+-   0  - signed
+-   1  - normal unsigned
++   0  - signed (SPR_SIGNED)
++   1  - normal unsigned (SPR_UNSIGNED)
++   2  - value is both sign and unsign extended for mode
++	(SPR_SIGNED_AND_UNSIGNED).
+    -1 - pointer unsigned, which most often can be handled like unsigned
+         extension, except for generating instructions where we need to
+-	emit special code (ptr_extend insns) on some architectures.  */
++	emit special code (ptr_extend insns) on some architectures
++	(SPR_POINTER). */
++
++const int SRP_POINTER = -1;
++const int SRP_SIGNED = 0;
++const int SRP_UNSIGNED = 1;
++const int SRP_SIGNED_AND_UNSIGNED = 2;
++
++/* Sets promoted mode for SUBREG_PROMOTED_VAR_P().  */
++#define SUBREG_PROMOTED_SET(RTX, VAL)		                        \
++do {								        \
++  rtx const _rtx = RTL_FLAG_CHECK1 ("SUBREG_PROMOTED_SET",		\
++                                    (RTX), SUBREG);			\
++  switch (VAL)								\
++  {									\
++    case SRP_POINTER:							\
++      _rtx->volatil = 0;						\
++      _rtx->unchanging = 0;						\
++      break;								\
++    case SRP_SIGNED:							\
++      _rtx->volatil = 0;						\
++      _rtx->unchanging = 1;						\
++      break;								\
++    case SRP_UNSIGNED:							\
++      _rtx->volatil = 1;						\
++      _rtx->unchanging = 0;						\
++      break;								\
++    case SRP_SIGNED_AND_UNSIGNED:					\
++      _rtx->volatil = 1;						\
++      _rtx->unchanging = 1;						\
++      break;								\
++  }									\
++} while (0)
+ 
++/* Gets the value stored in promoted mode for SUBREG_PROMOTED_VAR_P(),
++   including SRP_SIGNED_AND_UNSIGNED if promoted for
++   both signed and unsigned.  */
++#define SUBREG_PROMOTED_GET(RTX)	\
++  (2 * (RTL_FLAG_CHECK1 ("SUBREG_PROMOTED_GET", (RTX), SUBREG)->volatil)\
++   + (RTX)->unchanging - 1)
++
++/* Returns sign of promoted mode for SUBREG_PROMOTED_VAR_P().  */
++#define SUBREG_PROMOTED_SIGN(RTX)	\
++  ((RTL_FLAG_CHECK1 ("SUBREG_PROMOTED_SIGN", (RTX), SUBREG)->volatil) ? 1\
++   : (RTX)->unchanging - 1)
++
++/* Predicate to check if RTX of SUBREG_PROMOTED_VAR_P() is promoted
++   for SIGNED type.  */
++#define SUBREG_PROMOTED_SIGNED_P(RTX)	\
++  (RTL_FLAG_CHECK1 ("SUBREG_PROMOTED_SIGNED_P", (RTX), SUBREG)->unchanging)
++
++/* Predicate to check if RTX of SUBREG_PROMOTED_VAR_P() is promoted
++   for UNSIGNED type.  */
+ #define SUBREG_PROMOTED_UNSIGNED_P(RTX)	\
+-  ((RTL_FLAG_CHECK1 ("SUBREG_PROMOTED_UNSIGNED_P", (RTX), SUBREG)->volatil) \
+-   ? -1 : (int) (RTX)->unchanging)
++  (RTL_FLAG_CHECK1 ("SUBREG_PROMOTED_UNSIGNED_P", (RTX), SUBREG)->volatil)
++
++/* Checks if RTX of SUBREG_PROMOTED_VAR_P() is promoted for given SIGN.  */
++#define SUBREG_CHECK_PROMOTED_SIGN(RTX, SIGN)	\
++((SIGN) == SRP_POINTER ? SUBREG_PROMOTED_GET (RTX) == SRP_POINTER	\
++ : (SIGN) == SRP_SIGNED ? SUBREG_PROMOTED_SIGNED_P (RTX)		\
++ : SUBREG_PROMOTED_UNSIGNED_P (RTX))
+ 
+ /* True if the subreg was generated by LRA for reload insns.  Such
+    subregs are valid only during LRA.  */
+diff -Naur gcc-4.9.2/gcc/simplify-rtx.c gcc-4.9.2-kugan-extelim-patch/gcc/simplify-rtx.c
+--- gcc-4.9.2/gcc/simplify-rtx.c	2014-11-11 05:07:43.178952003 -0600
++++ gcc-4.9.2-kugan-extelim-patch/gcc/simplify-rtx.c	2014-11-12 06:58:40.209947977 -0600
+@@ -1335,7 +1335,7 @@
+ 	 target mode is the same as the variable's promotion.  */
+       if (GET_CODE (op) == SUBREG
+ 	  && SUBREG_PROMOTED_VAR_P (op)
+-	  && ! SUBREG_PROMOTED_UNSIGNED_P (op)
++	  && SUBREG_PROMOTED_SIGNED_P (op)
+ 	  && GET_MODE_SIZE (mode) <= GET_MODE_SIZE (GET_MODE (XEXP (op, 0))))
+ 	{
+ 	  temp = rtl_hooks.gen_lowpart_no_emit (mode, op);
+@@ -1402,7 +1402,7 @@
+ 	 target mode is the same as the variable's promotion.  */
+       if (GET_CODE (op) == SUBREG
+ 	  && SUBREG_PROMOTED_VAR_P (op)
+-	  && SUBREG_PROMOTED_UNSIGNED_P (op) > 0
++	  && SUBREG_PROMOTED_UNSIGNED_P (op)
+ 	  && GET_MODE_SIZE (mode) <= GET_MODE_SIZE (GET_MODE (XEXP (op, 0))))
+ 	{
+ 	  temp = rtl_hooks.gen_lowpart_no_emit (mode, op);
+@@ -5990,7 +5990,7 @@
+ 	{
+ 	  newx = gen_rtx_SUBREG (outermode, SUBREG_REG (op), final_offset);
+ 	  if (SUBREG_PROMOTED_VAR_P (op)
+-	      && SUBREG_PROMOTED_UNSIGNED_P (op) >= 0
++	      && SUBREG_PROMOTED_SIGN (op) >= 0
+ 	      && GET_MODE_CLASS (outermode) == MODE_INT
+ 	      && IN_RANGE (GET_MODE_SIZE (outermode),
+ 			   GET_MODE_SIZE (innermode),
+@@ -5998,8 +5998,7 @@
+ 	      && subreg_lowpart_p (newx))
+ 	    {
+ 	      SUBREG_PROMOTED_VAR_P (newx) = 1;
+-	      SUBREG_PROMOTED_UNSIGNED_SET
+-		(newx, SUBREG_PROMOTED_UNSIGNED_P (op));
++	      SUBREG_PROMOTED_SET (newx, SUBREG_PROMOTED_GET (op));
+ 	    }
+ 	  return newx;
+ 	}
+diff -Naur gcc-4.9.2/gcc/testsuite/gcc.dg/zero_sign_ext_test.c gcc-4.9.2-kugan-extelim-patch/gcc/testsuite/gcc.dg/zero_sign_ext_test.c
+--- gcc-4.9.2/gcc/testsuite/gcc.dg/zero_sign_ext_test.c	1969-12-31 18:00:00.000000000 -0600
++++ gcc-4.9.2-kugan-extelim-patch/gcc/testsuite/gcc.dg/zero_sign_ext_test.c	2014-11-12 06:58:40.200947342 -0600
+@@ -0,0 +1,136 @@
++extern void abort (void);
++
++/* { dg-options "-O2" } */
++/* { dg-do run } */
++
++#define TYPE_MAX(type, sign)	\
++  ((!sign) ? ((1 << (sizeof (type) * 8 - 1)) - 1) :	\
++   ((1 << (sizeof (type) * 8)) - 1))
++#define TYPE_MIN(type, sign)	\
++  ((!sign) ? -(1 << (sizeof (type) * 8 - 1)) : 0)
++
++#define TEST_FN(NAME, ARG_TYPE, RET_TYPE, CAST_TYPE, VAL, VR_MIN, VR_MAX)\
++  __attribute__((noinline, noclone)) RET_TYPE				\
++      NAME (ARG_TYPE arg){						\
++      RET_TYPE ret = VAL;						\
++      if (arg + 1 < VR_MIN || arg + 1 > VR_MAX) return ret;		\
++      /* Value Range of arg at this point will be  [VR_min, VR_max].  */\
++      arg = arg + VAL;							\
++      ret = (CAST_TYPE)arg;						\
++      return arg;							\
++  }
++
++/* Signed to signed conversion with value in-range.  */
++TEST_FN (foo1, short, short, char, 1, TYPE_MIN (char, 0), TYPE_MAX (char, 0));
++TEST_FN (foo2, short, short, char, 1, TYPE_MIN (char, 0) + 1,\
++	TYPE_MAX (char, 0) - 1);
++
++/* Signed to signed conversion with value not in-range.  */
++TEST_FN (foo3, short, short, char, -1, TYPE_MIN (short, 0) + 1,  100);
++TEST_FN (foo4, short, short, char, 1, 12, TYPE_MAX (short, 0) + 1);
++
++/* Unsigned to unsigned conversion with value in-range.  */
++TEST_FN (foo5, unsigned short, unsigned short, unsigned char, 1,\
++	TYPE_MIN (char, 1) + 1, TYPE_MAX (char, 1) - 1);
++TEST_FN (foo6, unsigned short, unsigned short, unsigned char, 1,\
++	TYPE_MIN (char, 1), TYPE_MAX (char, 1));
++
++/* Unsigned to unsigned conversion with value not in-range.  */
++TEST_FN (foo7, unsigned short, unsigned short, unsigned char, 1,\
++	TYPE_MIN (short, 1) + 1, TYPE_MAX (short, 1) - 1);
++TEST_FN (foo8, unsigned short, unsigned short, unsigned char, 1,\
++	TYPE_MIN (short, 1), TYPE_MAX (short, 1));
++
++/* Signed to unsigned conversion with value range positive.  */
++TEST_FN (foo9, short, short, unsigned char, -1, 1,\
++	TYPE_MAX (char, 1) - 1);
++TEST_FN (foo10, short, short, unsigned char, 1, 0,\
++	TYPE_MAX (char, 1));
++
++/* Signed to unsigned conversion with value range negative.  */
++TEST_FN (foo11, short, short, unsigned char, 1,\
++	TYPE_MIN (char, 0) + 1, TYPE_MAX (char, 0) - 1);
++TEST_FN (foo12, short, short, unsigned char, 1,\
++	TYPE_MIN (char, 0), TYPE_MAX (char, 0));
++
++/* Unsigned to Signed conversion with value range in signed equiv range.  */
++TEST_FN (foo13, unsigned short, unsigned short, char, 1,\
++	TYPE_MIN (char, 1) + 1, TYPE_MAX (char, 0) - 1);
++TEST_FN (foo14, unsigned short, unsigned short, char, 1,\
++	TYPE_MIN (char, 1), TYPE_MAX (char, 0));
++
++/* Unsigned to Signed conversion with value range not-in signed range.  */
++TEST_FN (foo15, unsigned short, unsigned short, char, 1,\
++	TYPE_MIN (char, 1) + 1, TYPE_MAX (char, 1) - 1);
++TEST_FN (foo16, unsigned short, unsigned short, char, 1,\
++	TYPE_MIN (char, 1), TYPE_MAX (char, 1));
++
++int main ()
++{
++  /* Signed to signed conversion with value in-range.  */
++  /* arg + 1.  */
++  if (foo1 (-32) != -31)
++    abort ();
++  /* arg + 1.  */
++  if (foo2 (32) != 33)
++    abort ();
++
++  /* Signed to signed conversion with value not in-range.  */
++  /* arg - 1.  */
++  if (foo3 (-512) != -513)
++    abort ();
++  /* arg + 1.  */
++  if (foo4 (512) != 513)
++    abort ();
++
++  /* Unsigned to unsigned conversion with value in-range.  */
++  /* arg + 1.  */
++  if (foo5 (64) != 65)
++    abort ();
++  /* arg + 1.  */
++  if (foo6 (64) != 65)
++    abort ();
++
++  /* Unsigned to unsigned conversion with value not in-range.  */
++  /* arg + 1.  */
++  if (foo7 (512) != 513)
++    abort ();
++  /* arg + 1.  */
++  if (foo8 (512) != 513)
++    abort ();
++
++  /* Signed to unsigned conversion with value range positive.  */
++  /* arg - 1.  */
++  if (foo9 (2) != 1)
++    abort ();
++  /* arg + 1.  */
++  if (foo10 (2) != 3)
++    abort ();
++
++  /* Signed to unsigned conversion with value range negative.  */
++  /* arg + 1.  */
++  if (foo11 (-125) != -124)
++    abort ();
++  /* arg + 1.  */
++  if (foo12 (-125) != -124)
++    abort ();
++
++  /* Unsigned to Signed conversion with value range in signed equiv range.  */
++  /* arg + 1.  */
++  if (foo13 (125) != 126)
++    abort ();
++  /* arg + 1.  */
++  if (foo14 (125) != 126)
++    abort ();
++
++  /* Unsigned to Signed conversion with value range not-in signed range.  */
++  /* arg + 1.  */
++  if (foo15 (250) != 251)
++    abort ();
++  /* arg + 1.  */
++  if (foo16 (250) != 251)
++    abort ();
++
++  return 0;
++}
++
+diff -Naur gcc-4.9.2-kugan-extelim-patch/gcc/expr.c gcc-4.9.2-kugan-extelim-patch-wideint/gcc/expr.c
+--- gcc-4.9.2-kugan-extelim-patch/gcc/expr.c	2014-11-12 06:59:50.555951666 -0600
++++ gcc-4.9.2-kugan-extelim-patch-wideint/gcc/expr.c	2014-11-12 09:15:55.581951625 -0600
+@@ -9242,7 +9242,7 @@
+ bool
+ promoted_for_signed_and_unsigned_p (tree ssa, enum machine_mode mode)
+ {
+-  wide_int min, max;
++  double_int min, max;
+ 
+   if (ssa == NULL_TREE
+       || TREE_CODE (ssa) != SSA_NAME
+@@ -9256,7 +9256,7 @@
+ 
+   /* Return true (to set SRP_SIGNED_AND_UNSIGNED to SUBREG) if MSB of the
+      smaller mode is not set (i.e.  MSB of ssa is not set).  */
+-  if (!wi::neg_p (min, SIGNED) && !wi::neg_p(max, SIGNED))
++  if (!min.is_negative () && !max.is_negative ())
+     return true;
+   else
+     return false;
+diff -Naur gcc-4.9.2/gcc/cfgexpand.c gcc-4.9.2-patch/gcc/cfgexpand.c
+--- gcc-4.9.2/gcc/cfgexpand.c	2014-11-19 11:04:17.743217000 -0600
++++ gcc-4.9.2-patch/gcc/cfgexpand.c	2014-11-19 12:58:35.510217000 -0600
+@@ -3279,6 +3279,7 @@
+ 
+ 		if ((SUBREG_PROMOTED_GET (target) == SRP_SIGNED_AND_UNSIGNED)
+ 		    && (GET_CODE (temp) == SUBREG)
++		    && SUBREG_PROMOTED_VAR_P (temp)
+ 		    && (GET_MODE (target) == GET_MODE (temp))
+ 		    && (GET_MODE (SUBREG_REG (target)) == GET_MODE (SUBREG_REG (temp))))
+ 		  emit_move_insn (SUBREG_REG (target), SUBREG_REG (temp));
+--- gcc-4.9.2/gcc/expr.c	2014-11-19 15:06:13.333217000 -0600
++++ gcc-4.9.2-patch/gcc/expr.c	2014-11-22 04:38:45.998447007 -0600
+@@ -7973,6 +7973,7 @@
+   int unsignedp = TYPE_UNSIGNED (type);
+   enum machine_mode mode = TYPE_MODE (type);
+   enum machine_mode orig_mode = mode;
++  bool promoted = false;
+ 
+   /* If we cannot do a conditional move on the mode, try doing it
+      with the promoted mode. */
+@@ -8019,6 +8020,12 @@
+       comparison_mode = TYPE_MODE (TREE_TYPE (treeop0));
+     }
+ 
++  if (GET_MODE (op1) == GET_MODE (op2)
++      && (GET_MODE_SIZE (mode) > GET_MODE_SIZE (orig_mode))
++      && SUBREG_PROMOTED_VAR_P (op1)
++      && SUBREG_PROMOTED_VAR_P (op2))
++    promoted = true;
++  
+   if (GET_MODE (op1) != mode)
+     op1 = gen_lowpart (mode, op1);
+ 
+@@ -8035,10 +8042,14 @@
+      and return.  */
+   if (insn)
+     {
++      rtx target;
+       rtx seq = get_insns ();
+       end_sequence ();
+       emit_insn (seq);
+-      return convert_modes (orig_mode, mode, temp, 0);
++      target = convert_modes (orig_mode, mode, temp, 0);
++      if (promoted)
++        SUBREG_PROMOTED_VAR_P (target) = 1;
++      return target;
+     }
+ 
+   /* Otherwise discard the sequence and fall back to code with
+diff -Naur gcc-4.8.3/gcc/testsuite/gcc.target/powerpc/ppc-fsl-extelim.c gcc-4.8.3-patch/gcc/testsuite/gcc.target/powerpc/ppc-fsl-extelim.c
+--- gcc-4.8.3/gcc/testsuite/gcc.target/powerpc/ppc-fsl-extelim.c	1969-12-31 18:00:00.000000000 -0600
++++ gcc-4.8.3-patch/gcc/testsuite/gcc.target/powerpc/ppc-fsl-extelim.c	2014-12-05 02:51:47.985670000 -0600
+@@ -0,0 +1,46 @@
++/* { dg-do compile { target { powerpc*-*-* } } } */
++/* { dg-options "-O2 -std=c99" } */
++/* { dg-final { scan-assembler-times "rlwinm" 2 { target { ilp32 } } } } */
++/* { dg-final { scan-assembler-times "rldicl" 2 { target { lp64 } } } } */
++
++int hipBugTest_c1 ();
++
++int hipBugTest_c1 ()
++{
++  const int iN = 16;
++
++  signed char pcIn[iN];
++  unsigned char pucOut[iN];
++
++  for (int i = 0; i < iN; i++)
++  {
++    pcIn[i] = (signed char) (i - 11);
++    pucOut[i] = 0;
++  }
++
++  for (int i = 0; i < iN; i++)
++  {
++    const unsigned char ucGain = 3;
++    const unsigned char ucLimit = 100;
++
++    unsigned char ucIn;
++    unsigned char ucErr;
++    unsigned int uiVal;
++
++    if (pcIn[i] < 0)
++      ucIn = (unsigned char) ( pcIn[i] * -1);
++    else
++      ucIn = (unsigned char) pcIn[i];
++
++    uiVal = ucIn - 3;
++    uiVal = uiVal * (unsigned int) ucGain;
++
++    if (uiVal > ucLimit)
++      ucErr = ucLimit;
++    else
++      ucErr = (unsigned char)uiVal;
++
++    pucOut[i] = ucErr;
++  }
++  return pucOut[0];
++}
diff --git a/recipes-devtools/gcc/gcc-4.9/0006-uclibc-locale-wchar_fix.patch b/recipes-devtools/gcc/gcc-4.9/0006-uclibc-locale-wchar_fix.patch
new file mode 100644
index 0000000..3406859
--- /dev/null
+++ b/recipes-devtools/gcc/gcc-4.9/0006-uclibc-locale-wchar_fix.patch
@@ -0,0 +1,68 @@
+From 225511a3aeb193a916b3999f0b640a392caa67cd Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem at gmail.com>
+Date: Fri, 29 Mar 2013 08:45:57 +0400
+Subject: [PATCH 06/35] uclibc-locale-wchar_fix
+
+Signed-off-by: Khem Raj <raj.khem at gmail.com>
+
+Upstream-Status: Pending
+---
+ libstdc++-v3/config/locale/uclibc/monetary_members.cc |    4 ++--
+ libstdc++-v3/config/locale/uclibc/numeric_members.cc  |   13 +++++++++++++
+ 2 files changed, 15 insertions(+), 2 deletions(-)
+
+diff --git a/libstdc++-v3/config/locale/uclibc/monetary_members.cc b/libstdc++-v3/config/locale/uclibc/monetary_members.cc
+index 2e6f80a..31ebb9f 100644
+--- a/libstdc++-v3/config/locale/uclibc/monetary_members.cc
++++ b/libstdc++-v3/config/locale/uclibc/monetary_members.cc
+@@ -401,7 +401,7 @@ namespace std
+ # ifdef __UCLIBC_HAS_XLOCALE__
+ 	  _M_data->_M_decimal_point = __cloc->decimal_point_wc;
+ 	  _M_data->_M_thousands_sep = __cloc->thousands_sep_wc;
+-# else
++# elif defined __UCLIBC_HAS_LOCALE__
+ 	  _M_data->_M_decimal_point = __global_locale->decimal_point_wc;
+ 	  _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc;
+ # endif
+@@ -556,7 +556,7 @@ namespace std
+ # ifdef __UCLIBC_HAS_XLOCALE__
+ 	  _M_data->_M_decimal_point = __cloc->decimal_point_wc;
+ 	  _M_data->_M_thousands_sep = __cloc->thousands_sep_wc;
+-# else
++# elif defined __UCLIBC_HAS_LOCALE__
+ 	  _M_data->_M_decimal_point = __global_locale->decimal_point_wc;
+ 	  _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc;
+ # endif
+diff --git a/libstdc++-v3/config/locale/uclibc/numeric_members.cc b/libstdc++-v3/config/locale/uclibc/numeric_members.cc
+index 2c70642..d5c8961 100644
+--- a/libstdc++-v3/config/locale/uclibc/numeric_members.cc
++++ b/libstdc++-v3/config/locale/uclibc/numeric_members.cc
+@@ -127,12 +127,25 @@ namespace std
+ 	{
+ 	  // Named locale.
+ 	  // NB: In the GNU model wchar_t is always 32 bit wide.
++#ifdef __UCLIBC_MJN3_ONLY__
++#warning fix this... should be numeric
++#endif
++#ifdef __UCLIBC__
++# ifdef __UCLIBC_HAS_XLOCALE__
++	  _M_data->_M_decimal_point = __cloc->decimal_point_wc;
++	  _M_data->_M_thousands_sep = __cloc->thousands_sep_wc;
++# elif defined __UCLIBC_HAS_LOCALE__
++	  _M_data->_M_decimal_point = __global_locale->decimal_point_wc;
++	  _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc;
++# endif
++#else
+ 	  union { char *__s; wchar_t __w; } __u;
+ 	  __u.__s = __nl_langinfo_l(_NL_NUMERIC_DECIMAL_POINT_WC, __cloc);
+ 	  _M_data->_M_decimal_point = __u.__w;
+ 
+ 	  __u.__s = __nl_langinfo_l(_NL_NUMERIC_THOUSANDS_SEP_WC, __cloc);
+ 	  _M_data->_M_thousands_sep = __u.__w;
++#endif
+ 
+ 	  if (_M_data->_M_thousands_sep == L'\0')
+ 	    _M_data->_M_grouping = "";
+-- 
+1.7.10.4
+
diff --git a/recipes-devtools/gcc/gcc-4.9/0006.gcc.opt-array-offset-49x.patch b/recipes-devtools/gcc/gcc-4.9/0006.gcc.opt-array-offset-49x.patch
new file mode 100644
index 0000000..5b55faa
--- /dev/null
+++ b/recipes-devtools/gcc/gcc-4.9/0006.gcc.opt-array-offset-49x.patch
@@ -0,0 +1,366 @@
+# Problem Statement:
+  Implements a GIMPLE pass to optimize array access by factoring
+  out expressions that calculate address offset from
+  multiple array access.
+
+  Optimization enabled with flag '-fopt-array-offset'.
+
+# Owned by:
+  Edmar Wienskoski
+
+diff -Naur gcc-4.9.1/gcc/common.opt gcc-4.9.1-opt-array-offset/gcc/common.opt
+--- gcc-4.9.1/gcc/common.opt	2014-04-07 08:27:39.000000000 -0500
++++ gcc-4.9.1-opt-array-offset/gcc/common.opt	2014-09-13 07:22:56.153455179 -0500
+@@ -1591,6 +1591,10 @@
+ Common Report Var(flag_omit_frame_pointer) Optimization
+ When possible do not generate stack frames
+ 
++fopt-array-offset
++Common Report Var(flag_opt_array_offset)
++Expand array offset address calculations
++
+ fopt-info
+ Common Report Var(flag_opt_info) Optimization
+ Enable all optimization info dumps on stderr
+diff -Naur gcc-4.9.1/gcc/Makefile.in gcc-4.9.1-opt-array-offset/gcc/Makefile.in
+--- gcc-4.9.1/gcc/Makefile.in	2014-04-15 03:04:17.000000000 -0500
++++ gcc-4.9.1-opt-array-offset/gcc/Makefile.in	2014-09-13 07:22:56.155455135 -0500
+@@ -1316,6 +1316,7 @@
+ 	modulo-sched.o \
+ 	omega.o \
+ 	omp-low.o \
++	opt-array-offset.o \
+ 	optabs.o \
+ 	options-save.o \
+ 	opts-global.o \
+diff -Naur gcc-4.9.1/gcc/opt-array-offset.c gcc-4.9.1-opt-array-offset/gcc/opt-array-offset.c
+--- gcc-4.9.1/gcc/opt-array-offset.c	1969-12-31 18:00:00.000000000 -0600
++++ gcc-4.9.1-opt-array-offset/gcc/opt-array-offset.c	2014-09-13 08:07:07.031454886 -0500
+@@ -0,0 +1,305 @@
++/* Optimizing array element access
++   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/>.  */
++
++
++/* This is a GIMPLE pass over basic block which coverts the stmts:
++        
++        a = b +/- c1;
++	c = a * c2;
++        
++   to:
++   
++        a = b * c2;
++        c = a +/- c1 * c2;
++
++   in effect expanding the multiplication across addition/substraction.
++
++   Motivating example:
++   Consider the following simple integer array access:
++   
++        a[i] = c;
++        a[i + 1] = c;
++
++   The following GIMPLE equivalent will be generated:
++
++        off_1 = i * 4;
++        a_i = a + off_1;
++	*a_i = c;
++
++	off_1 = i + 1;
++	off_2 = off_1 * 4;
++	a_i1 = a + off_2;
++	*a_i1 = c;
++
++   Notice that a_i1 could simply be a_i + 4. But the calcuation of i+1
++   is preventing CSE to perform. This pass will essentially convert the
++   second expr into:
++
++        off_1 = i * 4;
++        off_2 = off_1 + 4;
++        a_i1 = a + off_2;
++        ....
++
++   Thus allowing the previous index i calculation to be reuse. off_1 + 4
++   would also be combined into a_i if offset addressing mode is available.
++   This also have side effect of avoiding redundant sign extension on
++   i+1 for LP64 model where native integer size is different from pointer size.
++
++   The algorithm iterates through all the basic blocks looking for
++   the above pattern. Care is taken to make sure off_1 only
++   has the single use otherwise the transformation cannot be perform.
++*/
++
++#include "config.h"
++#include "system.h"
++#include "coretypes.h"
++#include "tm.h"
++
++#include "tree.h"
++#include "gimple-pretty-print.h"
++#include "basic-block.h"
++#include "tree-ssa-alias.h"
++#include "internal-fn.h"
++#include "gimple-expr.h"
++#include "is-a.h"
++#include "gimple.h"
++#include "gimple-iterator.h"
++#include "gimple-ssa.h"
++#include "tree-phinodes.h"
++#include "ssa-iterators.h"
++#include "tree-pass.h"
++#include "flags.h"
++
++#include "alloc-pool.h"
++#include "target.h"
++#include "tree-pretty-print.h"
++
++/*
++  We are looking for:
++  a = b +/- c1
++  c = a * c2 (stmt incoming)
++  d = &arr + c
++*/
++static bool
++is_candidate (gimple stmt)
++{
++  tree mul_result = gimple_get_lhs (stmt);
++  tree rhs1, rhs2;
++  gimple rhs1_stmt, use_stmt;
++  use_operand_p use_p;
++  imm_use_iterator imm_iter;
++
++  /* check for a * c2 */
++  if (gimple_assign_rhs_code (stmt) != MULT_EXPR)
++    return false;
++
++  rhs1 = gimple_assign_rhs1 (stmt);
++  rhs2 = gimple_assign_rhs2 (stmt);
++
++  if (TREE_CODE (rhs2) != INTEGER_CST)
++    return false;
++  
++  /* check for b + c1 */
++  if (TREE_CODE (rhs1) == SSA_NAME)
++    {
++      rhs1_stmt = SSA_NAME_DEF_STMT (rhs1);
++      if (is_gimple_assign (rhs1_stmt))
++	{
++	  tree rhs1_2;
++	  tree plusminus_result;
++
++	  if (gimple_assign_rhs_code (rhs1_stmt) != PLUS_EXPR
++	      && gimple_assign_rhs_code (rhs1_stmt) != MINUS_EXPR)
++	    return false;
++
++	  rhs1_2 = gimple_assign_rhs2 (rhs1_stmt);
++	  if (TREE_CODE (rhs1_2) != INTEGER_CST)
++	    return false;
++
++	  /* make sure there are no other uses of a 
++	     e.g. if a is used as an indcution variable 
++	     we cannot modified it
++	  */
++	  plusminus_result = gimple_get_lhs (rhs1_stmt);
++	  FOR_EACH_IMM_USE_FAST (use_p, imm_iter, plusminus_result)
++	    {
++	      use_stmt = USE_STMT (use_p);
++	      
++	      /* ignore PHI node */
++	      if (is_gimple_assign (use_stmt) &&
++		  (gimple_code (use_stmt) == GIMPLE_PHI))
++		continue;
++	      if (use_stmt != stmt)
++		return false;
++	    }
++
++#if 0
++	  if (gimple_bb(rhs1_stmt) != gimple_bb(stmt))
++	    return false;
++#endif
++        }
++      else
++	return false;
++    }
++  else
++    return false;
++
++  /* now look for uses of c that is a pointer use */
++  FOR_EACH_IMM_USE_FAST (use_p, imm_iter, mul_result)
++    {
++      enum tree_code use_code;
++
++      use_stmt = USE_STMT (use_p);
++      
++      if (is_gimple_debug (use_stmt))
++	continue;
++      
++      if (gimple_bb (use_stmt) != gimple_bb (stmt))
++	return false;
++
++      if (!is_gimple_assign (use_stmt))
++	return false;
++
++      use_code = gimple_assign_rhs_code (use_stmt);
++      if (use_code != POINTER_PLUS_EXPR)
++	return false;
++    }
++
++  if (dump_file)
++    {
++      fprintf (dump_file, "Found candidate:\n");
++      print_gimple_stmt (dump_file, rhs1_stmt, 0, TDF_SLIM);
++      print_gimple_stmt (dump_file, stmt, 0, TDF_SLIM);
++      print_gimple_stmt (dump_file, use_stmt, 0, TDF_SLIM);
++    }
++
++  return true;
++}
++
++/* Do the actual transformation:
++  a = b + c1 ==> a = b * c2
++  c = a * c2 ==> c = a + c1*c2
++*/
++static bool
++expand_plusminus_mult (gimple stmt)
++{
++  tree c1, c2, mul_result;
++  gimple rhs1_stmt;
++
++  /* get c2 */
++  c2 = gimple_assign_rhs2 (stmt);
++
++  /* get c1 */
++  rhs1_stmt = SSA_NAME_DEF_STMT (gimple_assign_rhs1 (stmt));
++  c1 = gimple_assign_rhs2 (rhs1_stmt);
++
++  /* form c1 * c2 */
++  mul_result = double_int_to_tree (TREE_TYPE(c2), 
++		      (tree_to_double_int (c1) * tree_to_double_int (c2)));
++
++  /* a = b + c1 ==> a = b * c2 */
++  gimple_assign_set_rhs2 (rhs1_stmt, c2);
++  gimple_assign_set_rhs_code (rhs1_stmt, MULT_EXPR);
++  update_stmt (rhs1_stmt);
++
++  /* c = a * c2 ==> c = a + c1*c2 */
++  gimple_assign_set_rhs2 (stmt, mul_result);
++  /* MINUS_EXPR has already been embedded into c1*c2 */
++  gimple_assign_set_rhs_code (stmt, PLUS_EXPR);
++  update_stmt (stmt);
++
++  return true;
++}
++
++static bool
++gate_opt_array_offset (void)
++{
++  return flag_opt_array_offset && optimize;
++}
++
++static unsigned int
++execute_opt_array_offset ()
++{
++  basic_block bb;
++
++  FOR_EACH_BB_FN (bb, cfun)
++    {
++      gimple_stmt_iterator gsi;
++
++      for (gsi = gsi_after_labels (bb); !gsi_end_p (gsi); gsi_next(&gsi))
++      {
++        gimple stmt = gsi_stmt (gsi);
++	//tree lhs,rhs1,rhs2,rhs3;
++        //enum tree_code code;
++	  
++        /* only interested in assign statement */
++        if (is_gimple_assign (stmt))
++        {
++	   /* find stmts calculating array offset */
++	  if (is_candidate (stmt))
++	    /* convert stmt */
++	    expand_plusminus_mult(stmt);
++	    
++        }
++      }
++    }
++
++  return 0;
++}
++
++namespace {
++
++const pass_data pass_data_opt_array_offset =
++{
++  GIMPLE_PASS,				/* type */
++  "opt_array_offset",			/* name */
++  OPTGROUP_NONE,			/* optinfo_flags */
++  true,					/* has_gate */
++  true,					/* has_execute */
++  TV_NONE,				/* tv_id */
++  PROP_ssa,				/* properties_required */
++  0,					/* properties_provided */
++  0,					/* properties_destroyed */
++  0,					/* todo_flags_start */
++  ( TODO_verify_ssa
++  | TODO_verify_stmts
++  | TODO_update_ssa ),                 /* todo_flags_finish */
++};
++
++class pass_opt_array_offset : public gimple_opt_pass
++{
++public:
++  pass_opt_array_offset (gcc::context *ctxt)
++    : gimple_opt_pass (pass_data_opt_array_offset, ctxt)
++  {}
++
++  /* opt_pass methods: */
++  bool gate () { return gate_opt_array_offset (); }
++  unsigned int execute () { return execute_opt_array_offset (); }
++
++}; // class pass_tracer
++
++} // anon namespace
++
++gimple_opt_pass *
++make_pass_opt_array_offset (gcc::context *ctxt)
++{
++  return new pass_opt_array_offset (ctxt);
++}
+diff -Naur gcc-4.9.1/gcc/passes.def gcc-4.9.1-opt-array-offset/gcc/passes.def
+--- gcc-4.9.1/gcc/passes.def	2014-01-17 11:50:10.000000000 -0600
++++ gcc-4.9.1-opt-array-offset/gcc/passes.def	2014-09-13 07:22:56.155455135 -0500
+@@ -250,6 +250,7 @@
+       NEXT_PASS (pass_phiopt);
+       NEXT_PASS (pass_fold_builtins);
+       NEXT_PASS (pass_optimize_widening_mul);
++      NEXT_PASS (pass_opt_array_offset);
+       NEXT_PASS (pass_tail_calls);
+       NEXT_PASS (pass_rename_ssa_copies);
+       /* FIXME: If DCE is not run before checking for uninitialized uses,
+diff -Naur gcc-4.9.1/gcc/tree-pass.h gcc-4.9.1-opt-array-offset/gcc/tree-pass.h
+--- gcc-4.9.1/gcc/tree-pass.h	2014-01-02 16:23:26.000000000 -0600
++++ gcc-4.9.1-opt-array-offset/gcc/tree-pass.h	2014-09-13 07:22:56.156455113 -0500
+@@ -415,6 +415,7 @@
+ extern gimple_opt_pass *make_pass_cse_sincos (gcc::context *ctxt);
+ extern gimple_opt_pass *make_pass_optimize_bswap (gcc::context *ctxt);
+ extern gimple_opt_pass *make_pass_optimize_widening_mul (gcc::context *ctxt);
++extern gimple_opt_pass *make_pass_opt_array_offset (gcc::context *ctxt);
+ extern gimple_opt_pass *make_pass_warn_function_return (gcc::context *ctxt);
+ extern gimple_opt_pass *make_pass_warn_function_noreturn (gcc::context *ctxt);
+ extern gimple_opt_pass *make_pass_cselim (gcc::context *ctxt);
diff --git a/recipes-devtools/gcc/gcc-4.9/0007-uclibc-locale-update.patch b/recipes-devtools/gcc/gcc-4.9/0007-uclibc-locale-update.patch
new file mode 100644
index 0000000..5851123
--- /dev/null
+++ b/recipes-devtools/gcc/gcc-4.9/0007-uclibc-locale-update.patch
@@ -0,0 +1,542 @@
+From 6ffe7c46f52d27864c3df3663e16ec9ddee71e8f Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem at gmail.com>
+Date: Fri, 29 Mar 2013 08:46:58 +0400
+Subject: [PATCH 07/35] uclibc-locale-update
+
+Signed-off-by: Khem Raj <raj.khem at gmail.com>
+
+Upstream-Status: Pending
+---
+ .../config/locale/uclibc/c++locale_internal.h      |    3 +
+ libstdc++-v3/config/locale/uclibc/c_locale.cc      |   74 +++++++++-----------
+ libstdc++-v3/config/locale/uclibc/c_locale.h       |   42 ++++++-----
+ libstdc++-v3/config/locale/uclibc/ctype_members.cc |   51 ++++++++++----
+ .../config/locale/uclibc/messages_members.h        |   12 ++--
+ .../config/locale/uclibc/monetary_members.cc       |   34 +++++----
+ .../config/locale/uclibc/numeric_members.cc        |    5 ++
+ libstdc++-v3/config/locale/uclibc/time_members.cc  |   18 +++--
+ libstdc++-v3/config/locale/uclibc/time_members.h   |   17 +++--
+ 9 files changed, 158 insertions(+), 98 deletions(-)
+
+diff --git a/libstdc++-v3/config/locale/uclibc/c++locale_internal.h b/libstdc++-v3/config/locale/uclibc/c++locale_internal.h
+index e74fddf..971a6b4 100644
+--- a/libstdc++-v3/config/locale/uclibc/c++locale_internal.h
++++ b/libstdc++-v3/config/locale/uclibc/c++locale_internal.h
+@@ -31,6 +31,9 @@
+ 
+ #include <bits/c++config.h>
+ #include <clocale>
++#include <cstdlib>
++#include <cstring>
++#include <cstddef>
+ 
+ #ifdef __UCLIBC_MJN3_ONLY__
+ #warning clean this up
+diff --git a/libstdc++-v3/config/locale/uclibc/c_locale.cc b/libstdc++-v3/config/locale/uclibc/c_locale.cc
+index 21430d0..1b9d8e1 100644
+--- a/libstdc++-v3/config/locale/uclibc/c_locale.cc
++++ b/libstdc++-v3/config/locale/uclibc/c_locale.cc
+@@ -39,23 +39,20 @@
+ #include <langinfo.h>
+ #include <bits/c++locale_internal.h>
+ 
+-namespace std
+-{
++_GLIBCXX_BEGIN_NAMESPACE(std)
++
+   template<>
+     void
+     __convert_to_v(const char* __s, float& __v, ios_base::iostate& __err,
+ 		   const __c_locale& __cloc)
+     {
+-      if (!(__err & ios_base::failbit))
+-	{
+-	  char* __sanity;
+-	  errno = 0;
+-	  float __f = __strtof_l(__s, &__sanity, __cloc);
+-          if (__sanity != __s && errno != ERANGE)
+-	    __v = __f;
+-	  else
+-	    __err |= ios_base::failbit;
+-	}
++      char* __sanity;
++      errno = 0;
++      float __f = __strtof_l(__s, &__sanity, __cloc);
++      if (__sanity != __s && errno != ERANGE)
++	__v = __f;
++      else
++	__err |= ios_base::failbit;
+     }
+ 
+   template<>
+@@ -63,16 +60,13 @@ namespace std
+     __convert_to_v(const char* __s, double& __v, ios_base::iostate& __err,
+ 		   const __c_locale& __cloc)
+     {
+-      if (!(__err & ios_base::failbit))
+-	{
+-	  char* __sanity;
+-	  errno = 0;
+-	  double __d = __strtod_l(__s, &__sanity, __cloc);
+-          if (__sanity != __s && errno != ERANGE)
+-	    __v = __d;
+-	  else
+-	    __err |= ios_base::failbit;
+-	}
++      char* __sanity;
++      errno = 0;
++      double __d = __strtod_l(__s, &__sanity, __cloc);
++      if (__sanity != __s && errno != ERANGE)
++	__v = __d;
++      else
++	__err |= ios_base::failbit;
+     }
+ 
+   template<>
+@@ -80,16 +74,13 @@ namespace std
+     __convert_to_v(const char* __s, long double& __v, ios_base::iostate& __err,
+ 		   const __c_locale& __cloc)
+     {
+-      if (!(__err & ios_base::failbit))
+-	{
+-	  char* __sanity;
+-	  errno = 0;
+-	  long double __ld = __strtold_l(__s, &__sanity, __cloc);
+-          if (__sanity != __s && errno != ERANGE)
+-	    __v = __ld;
+-	  else
+-	    __err |= ios_base::failbit;
+-	}
++      char* __sanity;
++      errno = 0;
++      long double __ld = __strtold_l(__s, &__sanity, __cloc);
++      if (__sanity != __s && errno != ERANGE)
++	__v = __ld;
++      else
++	__err |= ios_base::failbit;
+     }
+ 
+   void
+@@ -110,17 +101,18 @@ namespace std
+   void
+   locale::facet::_S_destroy_c_locale(__c_locale& __cloc)
+   {
+-    if (_S_get_c_locale() != __cloc)
++    if (__cloc && _S_get_c_locale() != __cloc)
+       __freelocale(__cloc);
+   }
+ 
+   __c_locale
+   locale::facet::_S_clone_c_locale(__c_locale& __cloc)
+   { return __duplocale(__cloc); }
+-} // namespace std
+ 
+-namespace __gnu_cxx
+-{
++_GLIBCXX_END_NAMESPACE
++
++_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
++
+   const char* const category_names[6 + _GLIBCXX_NUM_CATEGORIES] =
+     {
+       "LC_CTYPE",
+@@ -138,9 +130,11 @@ namespace __gnu_cxx
+       "LC_IDENTIFICATION"
+ #endif
+     };
+-}
+ 
+-namespace std
+-{
++_GLIBCXX_END_NAMESPACE
++
++_GLIBCXX_BEGIN_NAMESPACE(std)
++
+   const char* const* const locale::_S_categories = __gnu_cxx::category_names;
+-}  // namespace std
++
++_GLIBCXX_END_NAMESPACE
+diff --git a/libstdc++-v3/config/locale/uclibc/c_locale.h b/libstdc++-v3/config/locale/uclibc/c_locale.h
+index 4bca5f1..64a6d46 100644
+--- a/libstdc++-v3/config/locale/uclibc/c_locale.h
++++ b/libstdc++-v3/config/locale/uclibc/c_locale.h
+@@ -39,21 +39,23 @@
+ #pragma GCC system_header
+ 
+ #include <cstring>              // get std::strlen
+-#include <cstdio>               // get std::snprintf or std::sprintf
++#include <cstdio>               // get std::vsnprintf or std::vsprintf
+ #include <clocale>
+ #include <langinfo.h>		// For codecvt
+ #ifdef __UCLIBC_MJN3_ONLY__
+ #warning fix this
+ #endif
+-#ifdef __UCLIBC_HAS_LOCALE__
++#ifdef _GLIBCXX_USE_ICONV
+ #include <iconv.h>		// For codecvt using iconv, iconv_t
+ #endif
+-#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
+-#include <libintl.h> 		// For messages
++#ifdef HAVE_LIBINTL_H
++#include <libintl.h>		// For messages
+ #endif
++#include <cstdarg>
+ 
+ #ifdef __UCLIBC_MJN3_ONLY__
+ #warning what is _GLIBCXX_C_LOCALE_GNU for
++// psm: used in os/gnu-linux/ctype_noninline.h
+ #endif
+ #define _GLIBCXX_C_LOCALE_GNU 1
+ 
+@@ -78,23 +80,25 @@ namespace std
+ #else
+   typedef int*			__c_locale;
+ #endif
+-
+-  // Convert numeric value of type _Tv to string and return length of
+-  // string.  If snprintf is available use it, otherwise fall back to
+-  // the unsafe sprintf which, in general, can be dangerous and should
++  // Convert numeric value of type double to string and return length of
++  // string.  If vsnprintf is available use it, otherwise fall back to
++  // the unsafe vsprintf which, in general, can be dangerous and should
+   // be avoided.
+-  template<typename _Tv>
+-    int
+-    __convert_from_v(char* __out,
+-		     const int __size __attribute__ ((__unused__)),
+-		     const char* __fmt,
+-#ifdef __UCLIBC_HAS_XCLOCALE__
+-		     _Tv __v, const __c_locale& __cloc, int __prec)
++    inline int
++    __convert_from_v(const __c_locale&
++#ifndef __UCLIBC_HAS_XCLOCALE__
++	__cloc __attribute__ ((__unused__))
++#endif
++		     ,
++		     char* __out,
++		     const int __size,
++		     const char* __fmt, ...)
+     {
++      va_list __args;
++#ifdef __UCLIBC_HAS_XCLOCALE__
++
+       __c_locale __old = __gnu_cxx::__uselocale(__cloc);
+ #else
+-		     _Tv __v, const __c_locale&, int __prec)
+-    {
+ # ifdef __UCLIBC_HAS_LOCALE__
+       char* __old = std::setlocale(LC_ALL, NULL);
+       char* __sav = new char[std::strlen(__old) + 1];
+@@ -103,7 +107,9 @@ namespace std
+ # endif
+ #endif
+ 
+-      const int __ret = std::snprintf(__out, __size, __fmt, __prec, __v);
++      va_start(__args, __fmt);
++      const int __ret = std::vsnprintf(__out, __size, __fmt, __args);
++      va_end(__args);
+ 
+ #ifdef __UCLIBC_HAS_XCLOCALE__
+       __gnu_cxx::__uselocale(__old);
+diff --git a/libstdc++-v3/config/locale/uclibc/ctype_members.cc b/libstdc++-v3/config/locale/uclibc/ctype_members.cc
+index 7b12861..13e011d 100644
+--- a/libstdc++-v3/config/locale/uclibc/ctype_members.cc
++++ b/libstdc++-v3/config/locale/uclibc/ctype_members.cc
+@@ -33,16 +33,20 @@
+ 
+ // Written by Benjamin Kosnik <bkoz at redhat.com>
+ 
++#include <features.h>
++#ifdef __UCLIBC_HAS_LOCALE__
+ #define _LIBC
+ #include <locale>
+ #undef _LIBC
++#else
++#include <locale>
++#endif
+ #include <bits/c++locale_internal.h>
+ 
+-namespace std
+-{
++_GLIBCXX_BEGIN_NAMESPACE(std)
++
+   // NB: The other ctype<char> specializations are in src/locale.cc and
+   // various /config/os/* files.
+-  template<>
+     ctype_byname<char>::ctype_byname(const char* __s, size_t __refs)
+     : ctype<char>(0, false, __refs)
+     {
+@@ -57,6 +61,8 @@ namespace std
+ #endif
+ 	}
+     }
++    ctype_byname<char>::~ctype_byname()
++    { }
+ 
+ #ifdef _GLIBCXX_USE_WCHAR_T
+   ctype<wchar_t>::__wmask_type
+@@ -138,17 +144,33 @@ namespace std
+   ctype<wchar_t>::
+   do_is(mask __m, wchar_t __c) const
+   {
+-    // Highest bitmask in ctype_base == 10, but extra in "C"
+-    // library for blank.
++    // The case of __m == ctype_base::space is particularly important,
++    // due to its use in many istream functions.  Therefore we deal with
++    // it first, exploiting the knowledge that on GNU systems _M_bit[5]
++    // is the mask corresponding to ctype_base::space.  NB: an encoding
++    // change would not affect correctness!
++
+     bool __ret = false;
+-    const size_t __bitmasksize = 11;
+-    for (size_t __bitcur = 0; __bitcur <= __bitmasksize; ++__bitcur)
+-      if (__m & _M_bit[__bitcur]
+-	  && __iswctype_l(__c, _M_wmask[__bitcur], _M_c_locale_ctype))
+-	{
+-	  __ret = true;
+-	  break;
+-	}
++    if (__m == _M_bit[5])
++      __ret = __iswctype_l(__c, _M_wmask[5], _M_c_locale_ctype);
++    else
++      {
++	// Highest bitmask in ctype_base == 10, but extra in "C"
++	// library for blank.
++	const size_t __bitmasksize = 11;
++	for (size_t __bitcur = 0; __bitcur <= __bitmasksize; ++__bitcur)
++	  if (__m & _M_bit[__bitcur])
++	    {
++	      if (__iswctype_l(__c, _M_wmask[__bitcur], _M_c_locale_ctype))
++		{
++		  __ret = true;
++		  break;
++		}
++	      else if (__m == _M_bit[__bitcur])
++		break;
++	    }
++      }
++
+     return __ret;
+   }
+ 
+@@ -290,4 +312,5 @@ namespace std
+ #endif
+   }
+ #endif //  _GLIBCXX_USE_WCHAR_T
+-}
++
++_GLIBCXX_END_NAMESPACE
+diff --git a/libstdc++-v3/config/locale/uclibc/messages_members.h b/libstdc++-v3/config/locale/uclibc/messages_members.h
+index d89da33..067657a 100644
+--- a/libstdc++-v3/config/locale/uclibc/messages_members.h
++++ b/libstdc++-v3/config/locale/uclibc/messages_members.h
+@@ -53,12 +53,16 @@
+   template<typename _CharT>
+      messages<_CharT>::messages(__c_locale __cloc, const char* __s,
+ 				size_t __refs)
+-     : facet(__refs), _M_c_locale_messages(_S_clone_c_locale(__cloc)),
+-     _M_name_messages(__s)
++     : facet(__refs), _M_c_locale_messages(NULL),
++     _M_name_messages(NULL)
+      {
+-       char* __tmp = new char[std::strlen(__s) + 1];
+-       std::strcpy(__tmp, __s);
++       const size_t __len = std::strlen(__s) + 1;
++       char* __tmp = new char[__len];
++       std::memcpy(__tmp, __s, __len);
+        _M_name_messages = __tmp;
++
++       // Last to avoid leaking memory if new throws.
++       _M_c_locale_messages = _S_clone_c_locale(__cloc);
+      }
+ 
+   template<typename _CharT>
+diff --git a/libstdc++-v3/config/locale/uclibc/monetary_members.cc b/libstdc++-v3/config/locale/uclibc/monetary_members.cc
+index 31ebb9f..7679b9c 100644
+--- a/libstdc++-v3/config/locale/uclibc/monetary_members.cc
++++ b/libstdc++-v3/config/locale/uclibc/monetary_members.cc
+@@ -33,9 +33,14 @@
+ 
+ // Written by Benjamin Kosnik <bkoz at redhat.com>
+ 
++#include <features.h>
++#ifdef __UCLIBC_HAS_LOCALE__
+ #define _LIBC
+ #include <locale>
+ #undef _LIBC
++#else
++#include <locale>
++#endif
+ #include <bits/c++locale_internal.h>
+ 
+ #ifdef __UCLIBC_MJN3_ONLY__
+@@ -206,7 +211,7 @@ namespace std
+ 	  }
+ 	break;
+       default:
+-	;
++	__ret = pattern();
+       }
+     return __ret;
+   }
+@@ -390,7 +395,9 @@ namespace std
+ 	  __c_locale __old = __uselocale(__cloc);
+ #else
+ 	  // Switch to named locale so that mbsrtowcs will work.
+-	  char* __old = strdup(setlocale(LC_ALL, NULL));
++  	  char* __old = setlocale(LC_ALL, NULL);
++          const size_t __llen = strlen(__old) + 1;
++          char* __sav = new char[__llen];
+ 	  setlocale(LC_ALL, __name);
+ #endif
+ 
+@@ -477,8 +484,8 @@ namespace std
+ #ifdef __UCLIBC_HAS_XLOCALE__
+ 	      __uselocale(__old);
+ #else
+-	      setlocale(LC_ALL, __old);
+-	      free(__old);
++	      setlocale(LC_ALL, __sav);
++	      delete [] __sav;
+ #endif
+ 	      __throw_exception_again;
+ 	    }
+@@ -498,8 +505,8 @@ namespace std
+ #ifdef __UCLIBC_HAS_XLOCALE__
+ 	  __uselocale(__old);
+ #else
+-	  setlocale(LC_ALL, __old);
+-	  free(__old);
++	  setlocale(LC_ALL, __sav);
++	  delete [] __sav;
+ #endif
+ 	}
+     }
+@@ -545,8 +552,11 @@ namespace std
+ 	  __c_locale __old = __uselocale(__cloc);
+ #else
+ 	  // Switch to named locale so that mbsrtowcs will work.
+-	  char* __old = strdup(setlocale(LC_ALL, NULL));
+-	  setlocale(LC_ALL, __name);
++          char* __old = setlocale(LC_ALL, NULL);
++          const size_t __llen = strlen(__old) + 1;
++          char* __sav = new char[__llen];
++          memcpy(__sav, __old, __llen);
++          setlocale(LC_ALL, __name);
+ #endif
+ 
+ #ifdef __UCLIBC_MJN3_ONLY__
+@@ -633,8 +643,8 @@ namespace std
+ #ifdef __UCLIBC_HAS_XLOCALE__
+ 	      __uselocale(__old);
+ #else
+-	      setlocale(LC_ALL, __old);
+-	      free(__old);
++	      setlocale(LC_ALL, __sav);
++	      delete [] __sav;
+ #endif
+               __throw_exception_again;
+ 	    }
+@@ -653,8 +663,8 @@ namespace std
+ #ifdef __UCLIBC_HAS_XLOCALE__
+ 	  __uselocale(__old);
+ #else
+-	  setlocale(LC_ALL, __old);
+-	  free(__old);
++	  setlocale(LC_ALL, __sav);
++	  delete [] __sav;
+ #endif
+ 	}
+     }
+diff --git a/libstdc++-v3/config/locale/uclibc/numeric_members.cc b/libstdc++-v3/config/locale/uclibc/numeric_members.cc
+index d5c8961..8ae8969 100644
+--- a/libstdc++-v3/config/locale/uclibc/numeric_members.cc
++++ b/libstdc++-v3/config/locale/uclibc/numeric_members.cc
+@@ -33,9 +33,14 @@
+ 
+ // Written by Benjamin Kosnik <bkoz at redhat.com>
+ 
++#include <features.h>
++#ifdef __UCLIBC_HAS_LOCALE__
+ #define _LIBC
+ #include <locale>
+ #undef _LIBC
++#else
++#include <locale>
++#endif
+ #include <bits/c++locale_internal.h>
+ 
+ #ifdef __UCLIBC_MJN3_ONLY__
+diff --git a/libstdc++-v3/config/locale/uclibc/time_members.cc b/libstdc++-v3/config/locale/uclibc/time_members.cc
+index d848ed5..f24d53e 100644
+--- a/libstdc++-v3/config/locale/uclibc/time_members.cc
++++ b/libstdc++-v3/config/locale/uclibc/time_members.cc
+@@ -53,11 +53,14 @@ namespace std
+       const size_t __len = __strftime_l(__s, __maxlen, __format, __tm,
+ 					_M_c_locale_timepunct);
+ #else
+-      char* __old = strdup(setlocale(LC_ALL, NULL));
++      char* __old = setlocale(LC_ALL, NULL);
++      const size_t __llen = strlen(__old) + 1;
++      char* __sav = new char[__llen];
++      memcpy(__sav, __old, __llen);
+       setlocale(LC_ALL, _M_name_timepunct);
+       const size_t __len = strftime(__s, __maxlen, __format, __tm);
+-      setlocale(LC_ALL, __old);
+-      free(__old);
++      setlocale(LC_ALL, __sav);
++      delete [] __sav;
+ #endif
+       // Make sure __s is null terminated.
+       if (__len == 0)
+@@ -207,11 +210,14 @@ namespace std
+       const size_t __len = __wcsftime_l(__s, __maxlen, __format, __tm,
+ 					_M_c_locale_timepunct);
+ #else
+-      char* __old = strdup(setlocale(LC_ALL, NULL));
++      char* __old = setlocale(LC_ALL, NULL);
++      const size_t __llen = strlen(__old) + 1;
++      char* __sav = new char[__llen];
++      memcpy(__sav, __old, __llen);
+       setlocale(LC_ALL, _M_name_timepunct);
+       const size_t __len = wcsftime(__s, __maxlen, __format, __tm);
+-      setlocale(LC_ALL, __old);
+-      free(__old);
++      setlocale(LC_ALL, __sav);
++      delete [] __sav;
+ #endif
+       // Make sure __s is null terminated.
+       if (__len == 0)
+diff --git a/libstdc++-v3/config/locale/uclibc/time_members.h b/libstdc++-v3/config/locale/uclibc/time_members.h
+index ba8e858..1665dde 100644
+--- a/libstdc++-v3/config/locale/uclibc/time_members.h
++++ b/libstdc++-v3/config/locale/uclibc/time_members.h
+@@ -50,12 +50,21 @@
+     __timepunct<_CharT>::__timepunct(__c_locale __cloc, const char* __s,
+ 				     size_t __refs)
+     : facet(__refs), _M_data(NULL), _M_c_locale_timepunct(NULL),
+-    _M_name_timepunct(__s)
++    _M_name_timepunct(NULL)
+     {
+-      char* __tmp = new char[std::strlen(__s) + 1];
+-      std::strcpy(__tmp, __s);
++      const size_t __len = std::strlen(__s) + 1;
++      char* __tmp = new char[__len];
++      std::memcpy(__tmp, __s, __len);
+       _M_name_timepunct = __tmp;
+-      _M_initialize_timepunct(__cloc);
++
++      try
++	{ _M_initialize_timepunct(__cloc); }
++      catch(...)
++	{
++	  delete [] _M_name_timepunct;
++	  __throw_exception_again;
++	}
++
+     }
+ 
+   template<typename _CharT>
+-- 
+1.7.10.4
+
diff --git a/recipes-devtools/gcc/gcc-4.9/0007.gcc.aeabi-49x.patch b/recipes-devtools/gcc/gcc-4.9/0007.gcc.aeabi-49x.patch
new file mode 100644
index 0000000..c146493
--- /dev/null
+++ b/recipes-devtools/gcc/gcc-4.9/0007.gcc.aeabi-49x.patch
@@ -0,0 +1,440 @@
+diff -Naur gcc-4.9.0/config.sub gcc-4.9.0-aeabi/config.sub
+--- gcc-4.9.0/config.sub	2013-10-01 11:50:56.000000000 -0500
++++ gcc-4.9.0-aeabi/config.sub	2014-06-13 01:58:12.718371980 -0500
+@@ -1364,7 +1364,7 @@
+ 	      | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
+ 	      | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
+ 	      | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
+-	      | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
++	      | -udi* | -eabi* | -aeabi* | -lites* | -ieee* | -go32* | -aux* \
+ 	      | -chorusos* | -chorusrdb* | -cegcc* \
+ 	      | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
+ 	      | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \
+diff -Naur gcc-4.9.0/gcc/config/rs6000/e500mc.h gcc-4.9.0-aeabi/gcc/config/rs6000/e500mc.h
+--- gcc-4.9.0/gcc/config/rs6000/e500mc.h	1969-12-31 18:00:00.000000000 -0600
++++ gcc-4.9.0-aeabi/gcc/config/rs6000/e500mc.h	2014-06-13 01:58:12.696372480 -0500
+@@ -0,0 +1,342 @@
++/* Core target definitions for GNU compiler
++   for IBM RS/6000 PowerPC targeted to embedded ELF systems.
++   Copyright (C) 1995, 1996, 2000, 2003, 2004, 2007 Free Software Foundation, Inc.
++   Contributed by Cygnus Support.
++
++   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 -meabi to target flags.  */
++#undef TARGET_DEFAULT
++#define TARGET_DEFAULT 0
++
++#ifdef RS6000_BI_ARCH
++#define DEFAULT_ARCH64_P (TARGET_DEFAULT & OPTION_MASK_64BIT)
++#define RS6000BI_ARCH_P 1
++#endif
++
++#ifdef IN_LIBGCC2
++#undef TARGET_64BIT
++#ifdef __powerpc64__
++#define TARGET_64BIT 1
++#else
++#define TARGET_64BIT 0
++#endif
++#endif
++
++
++
++
++#undef	ASM_DEFAULT_SPEC
++#undef	ASM_SPEC
++#undef	LINK_OS_LINUX_SPEC
++
++#ifndef	RS6000_BI_ARCH
++#define	ASM_DEFAULT_SPEC "-mppc%{m64:64}"
++#define	ASM_SPEC	 "%{!m64:%(asm_spec32)}%{m64:%(asm_spec64)} %(asm_spec_common)"
++#define	LINK_OS_LINUX_SPEC "%{!m64:%(link_os_linux_spec32)}%{m64:%(link_os_linux_spec64)}"
++#else
++#if DEFAULT_ARCH64_P
++#define	ASM_DEFAULT_SPEC "-mppc%{!m32:64}"
++#define	ASM_SPEC	 "%{m32:%(asm_spec32)}%{!m32:%(asm_spec64)} %(asm_spec_common)"
++#define	LINK_OS_LINUX_SPEC "%{m32:%(link_os_linux_spec32)}%{!m32:%(link_os_linux_spec64)}"
++#else
++#define	ASM_DEFAULT_SPEC "-mppc%{m64:64}"
++#define	ASM_SPEC	 "%{!m64:%(asm_spec32)}%{m64:%(asm_spec64)} %(asm_spec_common)"
++#define	LINK_OS_LINUX_SPEC "%{!m64:%(link_os_linux_spec32)}%{m64:%(link_os_linux_spec64)}"
++#endif
++#endif
++
++#define ASM_SPEC32 "-a32 %{n} %{T} %{Ym,*} %{Yd,*} \
++%{mrelocatable} %{mrelocatable-lib} %{fpic:-K PIC} %{fPIC:-K PIC} \
++%{memb} %{!memb: %{msdata: -memb} %{msdata=eabi: -memb}} \
++%{!mlittle: %{!mlittle-endian: %{!mbig: %{!mbig-endian: \
++    %{mcall-freebsd: -mbig} \
++    %{mcall-i960-old: -mlittle} \
++    %{mcall-linux: -mbig} \
++    %{mcall-gnu: -mbig} \
++    %{mcall-netbsd: -mbig} \
++}}}}"
++
++#define ASM_SPEC64 "-a64"
++
++#define ASM_SPEC_COMMON "%(asm_cpu) \
++%{,assembler|,assembler-with-cpp: %{mregnames} %{mno-regnames}} \
++%{v:-V} %{Qy:} %{!Qn:-Qy} %{Wa,*:%*} \
++%{mlittle} %{mlittle-endian} %{mbig} %{mbig-endian}"
++
++#undef	SUBSUBTARGET_EXTRA_SPECS
++#define SUBSUBTARGET_EXTRA_SPECS \
++  { "asm_spec_common",		ASM_SPEC_COMMON },			\
++  { "asm_spec32",		ASM_SPEC32 },				\
++  { "asm_spec64",		ASM_SPEC64 },				\
++
++#undef	MULTILIB_DEFAULTS
++#if DEFAULT_ARCH64_P
++#define MULTILIB_DEFAULTS { "m64" }
++#else
++#define MULTILIB_DEFAULTS { "m32" }
++#endif
++
++#define POWERPC_LINUX
++
++/* PowerPC64 Linux word-aligns FP doubles when -malign-power is given.  */
++#undef  ADJUST_FIELD_ALIGN
++#define ADJUST_FIELD_ALIGN(FIELD, COMPUTED) \
++  ((TARGET_ALTIVEC && TREE_CODE (TREE_TYPE (FIELD)) == VECTOR_TYPE)	\
++   ? 128								\
++   : (TARGET_64BIT							\
++      && TARGET_ALIGN_NATURAL == 0					\
++      && TYPE_MODE (strip_array_types (TREE_TYPE (FIELD))) == DFmode)	\
++   ? MIN ((COMPUTED), 32)						\
++   : (COMPUTED))
++
++/* PowerPC64 Linux increases natural record alignment to doubleword if
++   the first field is an FP double, only if in power alignment mode.  */
++#undef  ROUND_TYPE_ALIGN
++#define ROUND_TYPE_ALIGN(STRUCT, COMPUTED, SPECIFIED)			\
++  ((TARGET_64BIT							\
++    && (TREE_CODE (STRUCT) == RECORD_TYPE				\
++	|| TREE_CODE (STRUCT) == UNION_TYPE				\
++	|| TREE_CODE (STRUCT) == QUAL_UNION_TYPE)			\
++    && TARGET_ALIGN_NATURAL == 0)					\
++   ? rs6000_special_round_type_align (STRUCT, COMPUTED, SPECIFIED)	\
++   : MAX ((COMPUTED), (SPECIFIED)))
++
++/* Use the default for compiling target libs.  */
++#ifdef IN_TARGET_LIBS
++#undef TARGET_ALIGN_NATURAL
++#define TARGET_ALIGN_NATURAL 1
++#endif
++
++/* Indicate that jump tables go in the text section.  */
++#undef  JUMP_TABLES_IN_TEXT_SECTION
++#define JUMP_TABLES_IN_TEXT_SECTION TARGET_64BIT
++
++/* The linux ppc64 ABI isn't explicit on whether aggregates smaller
++   than a doubleword should be padded upward or downward.  You could
++   reasonably assume that they follow the normal rules for structure
++   layout treating the parameter area as any other block of memory,
++   then map the reg param area to registers.  i.e. pad upward.
++   Setting both of the following defines results in this behavior.
++   Setting just the first one will result in aggregates that fit in a
++   doubleword being padded downward, and others being padded upward.
++   Not a bad idea as this results in struct { int x; } being passed
++   the same way as an int.  */
++#define AGGREGATE_PADDING_FIXED TARGET_64BIT
++#define AGGREGATES_PAD_UPWARD_ALWAYS 0
++
++/* Specify padding for the last element of a block move between
++   registers and memory.  FIRST is nonzero if this is the only
++   element.  */
++#define BLOCK_REG_PADDING(MODE, TYPE, FIRST) \
++  (!(FIRST) ? upward : FUNCTION_ARG_PADDING (MODE, TYPE))
++
++#undef  TARGET_OS_CPP_BUILTINS
++#define TARGET_OS_CPP_BUILTINS()			\
++  do							\
++    {							\
++      if (TARGET_64BIT)					\
++	{						\
++	  builtin_define ("__PPC__");			\
++	  builtin_define ("__PPC64__");			\
++	  builtin_define ("__powerpc__");		\
++	  builtin_define ("__powerpc64__");		\
++	  builtin_assert ("cpu=powerpc64");		\
++	  builtin_assert ("machine=powerpc64");		\
++	}						\
++      else						\
++	{						\
++	  builtin_define_std ("PPC");			\
++	  builtin_define ("__embedded__");		\
++	  builtin_assert ("system=embedded");		\
++	  builtin_assert ("cpu=powerpc");		\
++	  builtin_assert ("machine=powerpc");		\
++	  TARGET_OS_SYSV_CPP_BUILTINS ();		\
++	}						\
++    }							\
++  while (0)
++
++/* Must be at least as big as our pointer type.  */
++#undef	SIZE_TYPE
++#define	SIZE_TYPE (TARGET_64BIT ? "long unsigned int" : "unsigned int")
++
++#undef	PTRDIFF_TYPE
++#define	PTRDIFF_TYPE (TARGET_64BIT ? "long int" : "int")
++
++#undef	WCHAR_TYPE
++#define	WCHAR_TYPE (TARGET_64BIT ? "int" : "long int")
++#undef  WCHAR_TYPE_SIZE
++#define WCHAR_TYPE_SIZE 32
++
++#ifdef __powerpc64__
++/* _init and _fini functions are built from bits spread across many
++   object files, each potentially with a different TOC pointer.  For
++   that reason, place a nop after the call so that the linker can
++   restore the TOC pointer if a TOC adjusting call stub is needed.  */
++#if DOT_SYMBOLS
++#define CRT_CALL_STATIC_FUNCTION(SECTION_OP, FUNC)	\
++  asm (SECTION_OP "\n"					\
++"	bl ." #FUNC "\n"				\
++"	nop\n"						\
++"	.previous");
++#else
++#define CRT_CALL_STATIC_FUNCTION(SECTION_OP, FUNC)	\
++  asm (SECTION_OP "\n"					\
++"	bl " #FUNC "\n"					\
++"	nop\n"						\
++"	.previous");
++#endif
++#endif
++
++/* FP save and restore routines.  */
++#undef  SAVE_FP_PREFIX
++#define SAVE_FP_PREFIX (TARGET_64BIT ? "._savef" : "_savefpr_")
++#undef  SAVE_FP_SUFFIX
++#define SAVE_FP_SUFFIX (TARGET_64BIT ? "" : "_l")
++#undef  RESTORE_FP_PREFIX
++#define RESTORE_FP_PREFIX (TARGET_64BIT ? "._restf" : "_restfpr_")
++#undef  RESTORE_FP_SUFFIX
++#define RESTORE_FP_SUFFIX (TARGET_64BIT ? "" : "_l")
++
++/* Dwarf2 debugging.  */
++#undef  PREFERRED_DEBUGGING_TYPE
++#define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
++
++/* This is how to declare the size of a function.  */
++#undef	ASM_DECLARE_FUNCTION_SIZE
++#define	ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL)			\
++  do									\
++    {									\
++      if (!flag_inhibit_size_directive)					\
++	{								\
++	  fputs ("\t.size\t", (FILE));					\
++	  if (TARGET_64BIT && DOT_SYMBOLS)				\
++	    putc ('.', (FILE));						\
++	  assemble_name ((FILE), (FNAME));				\
++	  fputs (",.-", (FILE));					\
++	  rs6000_output_function_entry (FILE, FNAME);			\
++	  putc ('\n', (FILE));						\
++	}								\
++    }									\
++  while (0)
++
++/* Return nonzero if this entry is to be written into the constant
++   pool in a special way.  We do so if this is a SYMBOL_REF, LABEL_REF
++   or a CONST containing one of them.  If -mfp-in-toc (the default),
++   we also do this for floating-point constants.  We actually can only
++   do this if the FP formats of the target and host machines are the
++   same, but we can't check that since not every file that uses
++   GO_IF_LEGITIMATE_ADDRESS_P includes real.h.  We also do this when
++   we can write the entry into the TOC and the entry is not larger
++   than a TOC entry.  */
++
++#undef  ASM_OUTPUT_SPECIAL_POOL_ENTRY_P
++#define ASM_OUTPUT_SPECIAL_POOL_ENTRY_P(X, MODE)			\
++  (TARGET_TOC								\
++   && (GET_CODE (X) == SYMBOL_REF					\
++       || (GET_CODE (X) == CONST && GET_CODE (XEXP (X, 0)) == PLUS	\
++	   && GET_CODE (XEXP (XEXP (X, 0), 0)) == SYMBOL_REF)		\
++       || GET_CODE (X) == LABEL_REF					\
++       || (GET_CODE (X) == CONST_INT 					\
++	   && GET_MODE_BITSIZE (MODE) <= GET_MODE_BITSIZE (Pmode))	\
++       || (GET_CODE (X) == CONST_DOUBLE					\
++	   && ((TARGET_64BIT						\
++		&& (TARGET_MINIMAL_TOC					\
++		    || (SCALAR_FLOAT_MODE_P (GET_MODE (X))		\
++			&& ! TARGET_NO_FP_IN_TOC)))			\
++	       || (!TARGET_64BIT					\
++		   && !TARGET_NO_FP_IN_TOC				\
++		   && !TARGET_RELOCATABLE				\
++		   && SCALAR_FLOAT_MODE_P (GET_MODE (X))		\
++		   && BITS_PER_WORD == HOST_BITS_PER_INT)))))
++
++/* Select a format to encode pointers in exception handling data.  CODE
++   is 0 for data, 1 for code labels, 2 for function pointers.  GLOBAL is
++   true if the symbol may be affected by dynamic relocations.  */
++#undef	ASM_PREFERRED_EH_DATA_FORMAT
++#define	ASM_PREFERRED_EH_DATA_FORMAT(CODE, GLOBAL) \
++  ((TARGET_64BIT || flag_pic || TARGET_RELOCATABLE)			\
++   ? (((GLOBAL) ? DW_EH_PE_indirect : 0) | DW_EH_PE_pcrel		\
++      | (TARGET_64BIT ? DW_EH_PE_udata8 : DW_EH_PE_sdata4))		\
++   : DW_EH_PE_absptr)
++
++/* For backward compatibility, we must continue to use the AIX
++   structure return convention.  */
++#undef DRAFT_V4_STRUCT_RET
++#define DRAFT_V4_STRUCT_RET 0
++
++#define TARGET_ASM_FILE_END rs6000_elf_file_end
++
++#define LINK_GCC_C_SEQUENCE_SPEC \
++  "%{static:--start-group} %G %L %{static:--end-group}%{!static:%G}"
++
++/* Use --as-needed -lgcc_s for eh support.  */
++#ifdef HAVE_LD_AS_NEEDED
++#define USE_LD_AS_NEEDED 1
++#endif
++
++#undef	TARGET_AIX
++#define	TARGET_AIX TARGET_64BIT
++
++#undef CC1_EXTRA_SPEC
++#define CC1_EXTRA_SPEC "-maix-struct-return"
++
++#undef RS6000_ABI_NAME
++#define RS6000_ABI_NAME "linux"
++
++#define INVALID_64BIT "-m%s not supported in this configuration"
++#define INVALID_32BIT INVALID_64BIT
++
++#undef SUBSUBTARGET_OVERRIDE_OPTIONS
++#define SUBSUBTARGET_OVERRIDE_OPTIONS		\
++  do						\
++    {						\
++      if (!global_options_set.x_rs6000_alignment_flags)	\
++	rs6000_alignment_flags = MASK_ALIGN_NATURAL;		\
++      if (TARGET_64BIT)					\
++	{							\
++	  if (DEFAULT_ABI != ABI_AIX)				\
++	    {							\
++	      rs6000_current_abi = ABI_AIX;			\
++	      error (INVALID_64BIT, "call");			\
++	    }							\
++	  dot_symbols = !strcmp (rs6000_abi_name, "aixdesc");	\
++	  if (rs6000_isa_flags & OPTION_MASK_RELOCATABLE)	\
++	    {							\
++	      rs6000_isa_flags &= ~OPTION_MASK_RELOCATABLE;	\
++	      error (INVALID_64BIT, "relocatable");		\
++	    }							\
++	  if (rs6000_isa_flags & OPTION_MASK_EABI)		\
++	    {							\
++	      rs6000_isa_flags &= ~OPTION_MASK_EABI;		\
++	    }							\
++	  if (TARGET_PROTOTYPE)					\
++	    {							\
++	      TARGET_PROTOTYPE = 0;				\
++	      error (INVALID_64BIT, "prototype");		\
++	    }							\
++	  if ((rs6000_isa_flags & OPTION_MASK_POWERPC64) == 0)	\
++	    {							\
++	      rs6000_isa_flags |= OPTION_MASK_POWERPC64;	\
++	      error ("-m64 requires a PowerPC64 cpu");		\
++	    }							\
++	}							\
++    }						\
++  while (0)
++/* Linux doesn't support saving and restoring 64-bit regs in a 32-bit
++   process.  */
++#define OS_MISSING_POWERPC64 !TARGET_64BIT
+diff -Naur gcc-4.9.0/gcc/config/rs6000/sysv4.h gcc-4.9.0-aeabi/gcc/config/rs6000/sysv4.h
+--- gcc-4.9.0/gcc/config/rs6000/sysv4.h	2014-02-10 08:46:24.000000000 -0600
++++ gcc-4.9.0-aeabi/gcc/config/rs6000/sysv4.h	2014-06-13 02:00:07.797371712 -0500
+@@ -538,6 +538,9 @@
+ #define CC1_SECURE_PLT_DEFAULT_SPEC ""
+ #endif
+ 
++#undef CC1_EXTRA_SPEC
++#define CC1_EXTRA_SPEC ""
++
+ /* Pass -G xxx to the compiler.  */
+ #define	CC1_SPEC "%{G*} %(cc1_cpu)" \
+ "%{meabi: %{!mcall-*: -mcall-sysv }} \
+@@ -551,7 +554,7 @@
+ %{msdata: -msdata=default} \
+ %{mno-sdata: -msdata=none} \
+ %{!mbss-plt: %{!msecure-plt: %(cc1_secure_plt_default)}} \
+-%{profile: -p}"
++%{profile: -p}" CC1_EXTRA_SPEC
+ 
+ /* Default starting address if specified.  */
+ #define LINK_START_SPEC "\
+diff -Naur gcc-4.9.0/gcc/config/rs6000/t-ppc-e500mc gcc-4.9.0-aeabi/gcc/config/rs6000/t-ppc-e500mc
+--- gcc-4.9.0/gcc/config/rs6000/t-ppc-e500mc	1969-12-31 18:00:00.000000000 -0600
++++ gcc-4.9.0-aeabi/gcc/config/rs6000/t-ppc-e500mc	2014-06-13 01:58:12.696372480 -0500
+@@ -0,0 +1,15 @@
++# Multilibs for powerpc embedded ELF targets.
++
++MULTILIB_OPTIONS	= m32/m64
++
++MULTILIB_DIRNAMES	= 32 64
++
++MULTILIB_EXCEPTIONS	= 
++
++MULTILIB_EXTRA_OPTS	= mno-eabi mstrict-align
++
++MULTILIB_MATCHES	= ${MULTILIB_MATCHES_FLOAT} \
++			  ${MULTILIB_MATCHES_ENDIAN}
++
++softfp_wrap_start := '\#ifndef __powerpc64__'
++softfp_wrap_end := '\#endif'
+diff -Naur gcc-4.9.0/gcc/config.gcc gcc-4.9.0-aeabi/gcc/config.gcc
+--- gcc-4.9.0/gcc/config.gcc	2014-03-12 05:13:07.000000000 -0500
++++ gcc-4.9.0-aeabi/gcc/config.gcc	2014-06-13 01:58:12.697372447 -0500
+@@ -2239,6 +2239,23 @@
+ 	extra_options="${extra_options} rs6000/sysv4.opt"
+ 	tmake_file="rs6000/t-fprules rs6000/t-ppcgas rs6000/t-ppccomm"
+ 	;;
++powerpc-*-aeabi)
++	tm_file="${tm_file} dbxelf.h elfos.h usegas.h freebsd-spec.h newlib-stdint.h rs6000/sysv4.h"
++	extra_options="${extra_options} rs6000/sysv4.opt"
++	tmake_file="rs6000/t-fprules rs6000/t-fprules-fpbit rs6000/t-ppcgas rs6000/t-ppccomm"
++	case ${enable_targets}:${cpu_is_64bit} in
++	  *powerpc64* | all:* | *:yes)
++	  if test x$cpu_is_64bit = xyes; then
++	    tm_file="${tm_file} rs6000/default64.h"
++	  fi
++	  tm_file="rs6000/biarch64.h ${tm_file}"
++	  ;;
++	esac
++	if test x$enable_powerpc_e500mc_aeabi = xyes; then
++	  tm_file="${tm_file} rs6000/e500mc.h"
++	  tmake_file="${tmake_file} rs6000/t-ppc-e500mc"
++	fi
++	;;
+ powerpc-*-eabialtivec*)
+ 	tm_file="${tm_file} dbxelf.h elfos.h freebsd-spec.h newlib-stdint.h rs6000/sysv4.h rs6000/eabi.h rs6000/e500.h rs6000/eabialtivec.h"
+ 	extra_options="${extra_options} rs6000/sysv4.opt"
+diff -Naur gcc-4.9.0/libgcc/config.host gcc-4.9.0-aeabi/libgcc/config.host
+--- gcc-4.9.0/libgcc/config.host	2014-03-27 10:40:31.000000000 -0500
++++ gcc-4.9.0-aeabi/libgcc/config.host	2014-06-13 01:58:12.718371981 -0500
+@@ -975,6 +975,10 @@
+ 	tmake_file="${tmake_file} rs6000/t-ppccomm rs6000/t-savresfgpr rs6000/t-crtstuff t-crtstuff-pic t-fdpbit"
+ 	extra_parts="$extra_parts crtbegin.o crtend.o crtbeginS.o crtendS.o crtbeginT.o ecrti.o ecrtn.o ncrti.o ncrtn.o"
+ 	;;
++powerpc-*-aeabi*)
++ 	tmake_file="${tmake_file} rs6000/t-ppccomm rs6000/t-savresfgpr rs6000/t-crtstuff t-crtstuff-pic t-fdpbit rs6000/t-ldbl128 t-softfp"
++	extra_parts="$extra_parts crtbegin.o crtend.o crtbeginS.o crtendS.o crtbeginT.o ecrti.o ecrtn.o ncrti.o ncrtn.o"
++	;;
+ powerpc-*-rtems*)
+ 	tmake_file="${tmake_file} rs6000/t-ppccomm rs6000/t-savresfgpr rs6000/t-crtstuff t-crtstuff-pic t-fdpbit"
+ 	extra_parts="$extra_parts crtbeginS.o crtendS.o crtbeginT.o ecrti.o ecrtn.o ncrti.o ncrtn.o"
diff --git a/recipes-devtools/gcc/gcc-4.9/0008-missing-execinfo_h.patch b/recipes-devtools/gcc/gcc-4.9/0008-missing-execinfo_h.patch
new file mode 100644
index 0000000..2823809
--- /dev/null
+++ b/recipes-devtools/gcc/gcc-4.9/0008-missing-execinfo_h.patch
@@ -0,0 +1,28 @@
+From 9f2158451981cf0a80cfabdc79ae31bb6976a801 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem at gmail.com>
+Date: Fri, 29 Mar 2013 08:48:10 +0400
+Subject: [PATCH 08/35] missing-execinfo_h
+
+Signed-off-by: Khem Raj <raj.khem at gmail.com>
+
+Upstream-Status: Pending
+---
+ boehm-gc/include/gc.h |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/boehm-gc/include/gc.h b/boehm-gc/include/gc.h
+index c51e017..a7ba8dc 100644
+--- a/boehm-gc/include/gc.h
++++ b/boehm-gc/include/gc.h
+@@ -503,7 +503,7 @@ GC_API GC_PTR GC_malloc_atomic_ignore_off_page GC_PROTO((size_t lb));
+ #if defined(__linux__) || defined(__GLIBC__)
+ # include <features.h>
+ # if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1 || __GLIBC__ > 2) \
+-     && !defined(__ia64__)
++     && !defined(__ia64__) && !defined(__UCLIBC__)
+ #   ifndef GC_HAVE_BUILTIN_BACKTRACE
+ #     define GC_HAVE_BUILTIN_BACKTRACE
+ #   endif
+-- 
+1.7.10.4
+
diff --git a/recipes-devtools/gcc/gcc-4.9/0008.gcc.fix_regalloc_for_482.patch b/recipes-devtools/gcc/gcc-4.9/0008.gcc.fix_regalloc_for_482.patch
new file mode 100644
index 0000000..e806d0b
--- /dev/null
+++ b/recipes-devtools/gcc/gcc-4.9/0008.gcc.fix_regalloc_for_482.patch
@@ -0,0 +1,23 @@
+Index: lra-assigns.c
+===================================================================
+--- src_gcc/gcc/lra-assigns.c	(revision 200944)
++++ src_gcc/gcc/lra-assigns.c	(working copy)
+@@ -194,15 +194,15 @@ reload_pseudo_compare_func (const void *
+   if ((diff = (ira_class_hard_regs_num[cl1]
+ 	       - ira_class_hard_regs_num[cl2])) != 0)
+     return diff;
+-  if ((diff = (regno_assign_info[regno_assign_info[r2].first].freq
+-	       - regno_assign_info[regno_assign_info[r1].first].freq)) != 0)
+-    return diff;
+   /* Allocate bigger pseudos first to avoid register file
+      fragmentation.  */
+   if ((diff
+        = (ira_reg_class_max_nregs[cl2][lra_reg_info[r2].biggest_mode]
+ 	  - ira_reg_class_max_nregs[cl1][lra_reg_info[r1].biggest_mode])) != 0)
+     return diff;
++  if ((diff = (regno_assign_info[regno_assign_info[r2].first].freq
++	       - regno_assign_info[regno_assign_info[r1].first].freq)) != 0)
++    return diff;
+   /* Put pseudos from the thread nearby.  */
+   if ((diff = regno_assign_info[r1].first - regno_assign_info[r2].first) != 0)
+     return diff;
diff --git a/recipes-devtools/gcc/gcc-4.9/0009-c99-snprintf.patch b/recipes-devtools/gcc/gcc-4.9/0009-c99-snprintf.patch
new file mode 100644
index 0000000..7168778
--- /dev/null
+++ b/recipes-devtools/gcc/gcc-4.9/0009-c99-snprintf.patch
@@ -0,0 +1,28 @@
+From e393e076f1ab82d25e1aa04d6edea27b41d3eb06 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem at gmail.com>
+Date: Fri, 29 Mar 2013 08:49:03 +0400
+Subject: [PATCH 09/35] c99-snprintf
+
+Signed-off-by: Khem Raj <raj.khem at gmail.com>
+
+Upstream-Status: Pending
+---
+ libstdc++-v3/include/c_std/cstdio |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/libstdc++-v3/include/c_std/cstdio b/libstdc++-v3/include/c_std/cstdio
+index e85bd83..6af839a 100644
+--- a/libstdc++-v3/include/c_std/cstdio
++++ b/libstdc++-v3/include/c_std/cstdio
+@@ -139,7 +139,7 @@ namespace std
+   using ::vsprintf;
+ } // namespace std
+ 
+-#if _GLIBCXX_USE_C99
++#if _GLIBCXX_USE_C99 || defined(__UCLIBC__)
+ 
+ #undef snprintf
+ #undef vfscanf
+-- 
+1.7.10.4
+
diff --git a/recipes-devtools/gcc/gcc-4.9/0009.gcc.rm_slow_tests-47.patch b/recipes-devtools/gcc/gcc-4.9/0009.gcc.rm_slow_tests-47.patch
new file mode 100644
index 0000000..fa02d2d
--- /dev/null
+++ b/recipes-devtools/gcc/gcc-4.9/0009.gcc.rm_slow_tests-47.patch
@@ -0,0 +1,67 @@
+diff -ruN gcc-20110708/gcc/testsuite/gfortran.dg/cray_pointers_8.f90 gcc-20110708-fixed/gcc/testsuite/gfortran.dg/cray_pointers_8.f90
+--- gcc-20110708/gcc/testsuite/gfortran.dg/cray_pointers_8.f90	2011-07-08 11:13:40.530334001 -0500
++++ gcc-20110708-fixed/gcc/testsuite/gfortran.dg/cray_pointers_8.f90	1969-12-31 18:00:00.000000000 -0600
+@@ -1,63 +0,0 @@
+-! { dg-do run }
+-! { dg-options "-fcray-pointer -ffloat-store" }
+-!
+-! Test the fix for PR36528 in which the Cray pointer was not passed
+-! correctly to 'euler' so that an undefined reference to fcn was
+-! generated by the linker.
+-!
+-! Reported by Tobias Burnus  <burnus at gcc.gnu.org>
+-! from http://groups.google.com/group/comp.lang.fortran/msg/86b65bad78e6af78
+-!
+-real function p1(x)
+-  real, intent(in) :: x
+-  p1 = x
+-end
+-
+-real function euler(xp,xk,dx,f)
+-  real, intent(in) :: xp, xk, dx
+-  interface
+-    real function f(x)
+-      real, intent(in) :: x
+-    end function
+-  end interface
+-  real x, y
+-  y = 0.0
+-  x = xp
+-  do while (x .le. xk)
+-    y = y + f(x)*dx
+-    x = x + dx
+-  end do
+-  euler = y
+-end
+-program main
+-  interface
+-    real function p1 (x)
+-      real, intent(in) :: x
+-    end function
+-    real function fcn (x)
+-      real, intent(in) :: x
+-    end function
+-    real function euler (xp,xk,dx,f)
+-      real, intent(in) :: xp, xk ,dx
+-      interface
+-        real function f(x)
+-          real, intent(in) :: x
+-        end function
+-      end interface
+-    end function
+-  end interface
+-  real x, xp, xk, dx, y, z
+-  pointer (pfcn, fcn)
+-  pfcn = loc(p1)
+-  xp = 0.0
+-  xk = 1.0
+-  dx = 0.0005
+-  y = 0.0
+-  x = xp
+-  do while (x .le. xk)
+-    y = y + fcn(x)*dx
+-    x = x + dx
+-  end do
+-  z = euler(0.0,1.0,0.0005,fcn)
+-  if (abs (y - z) .gt. 1e-6) call abort
+-end
diff --git a/recipes-devtools/gcc/gcc-4.9/0010-c99-complex-ugly-hack.patch b/recipes-devtools/gcc/gcc-4.9/0010-c99-complex-ugly-hack.patch
new file mode 100644
index 0000000..b628571
--- /dev/null
+++ b/recipes-devtools/gcc/gcc-4.9/0010-c99-complex-ugly-hack.patch
@@ -0,0 +1,29 @@
+From 73f69d806e2c9561a54995223431a1076cfd6164 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem at gmail.com>
+Date: Fri, 29 Mar 2013 08:49:57 +0400
+Subject: [PATCH 10/35] c99-complex-ugly-hack
+
+Signed-off-by: Khem Raj <raj.khem at gmail.com>
+
+Upstream-Status: Inappropriate [embedded specific]
+---
+ libstdc++-v3/configure |    3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure
+index c57a751..a1333e2 100755
+--- a/libstdc++-v3/configure
++++ b/libstdc++-v3/configure
+@@ -18734,6 +18734,9 @@ $as_echo_n "checking for ISO C99 support to TR1 in <complex.h>... " >&6; }
+     cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h.  */
+ #include <complex.h>
++#ifdef __UCLIBC__
++#error ugly hack to make sure configure test fails here for cross until uClibc supports the complex funcs
++#endif
+ int
+ main ()
+ {
+-- 
+1.7.10.4
+
diff --git a/recipes-devtools/gcc/gcc-4.9/0010.gcc.fix_mingw32.patch b/recipes-devtools/gcc/gcc-4.9/0010.gcc.fix_mingw32.patch
new file mode 100644
index 0000000..5354723
--- /dev/null
+++ b/recipes-devtools/gcc/gcc-4.9/0010.gcc.fix_mingw32.patch
@@ -0,0 +1,12 @@
+diff -Naur gcc-4.8.3/gcc/configure gcc-4.8.3-fix-mingw32/gcc/configure
+--- gcc-4.8.3/gcc/configure	2014-04-28 05:05:29.000000000 -0500
++++ gcc-4.8.3-fix-mingw32/gcc/configure	2014-07-21 01:17:32.114371914 -0500
+@@ -11209,7 +11209,7 @@
+ 	CXX="${CXX_FOR_BUILD}" CXXFLAGS="${CXXFLAGS_FOR_BUILD}" \
+ 	LD="${LD_FOR_BUILD}" LDFLAGS="${LDFLAGS_FOR_BUILD}" \
+ 	GMPINC="" CPPFLAGS="${CPPFLAGS} -DGENERATOR_FILE" \
+-	${realsrcdir}/configure \
++	${realsrcdir}/configure --with-gnu-ld --with-gnu-as --enable-targets=all \
+ 		--enable-languages=${enable_languages-all} \
+ 		--target=$target_alias --host=$build_alias --build=$build_alias
+ 
diff --git a/recipes-devtools/gcc/gcc-4.9/0011-index_macro.patch b/recipes-devtools/gcc/gcc-4.9/0011-index_macro.patch
new file mode 100644
index 0000000..8ee79b0
--- /dev/null
+++ b/recipes-devtools/gcc/gcc-4.9/0011-index_macro.patch
@@ -0,0 +1,44 @@
+From b037953e40312b45ab84ed0a3ad882bb5e413101 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem at gmail.com>
+Date: Fri, 29 Mar 2013 08:51:02 +0400
+Subject: [PATCH 11/35] index_macro
+
+Signed-off-by: Khem Raj <raj.khem at gmail.com>
+
+Upstream-Status: Pending
+---
+ libstdc++-v3/include/ext/rope       |    3 +++
+ libstdc++-v3/include/ext/ropeimpl.h |    3 +++
+ 2 files changed, 6 insertions(+)
+
+diff --git a/libstdc++-v3/include/ext/rope b/libstdc++-v3/include/ext/rope
+index 38eb1e8..158d21a 100644
+--- a/libstdc++-v3/include/ext/rope
++++ b/libstdc++-v3/include/ext/rope
+@@ -55,6 +55,9 @@
+ #include <bits/gthr.h>
+ #include <tr1/functional>
+ 
++/* cope w/ index defined as macro, SuSv3 proposal */
++#undef index
++
+ # ifdef __GC
+ #   define __GC_CONST const
+ # else
+diff --git a/libstdc++-v3/include/ext/ropeimpl.h b/libstdc++-v3/include/ext/ropeimpl.h
+index d7b5cbd..b9b3acb 100644
+--- a/libstdc++-v3/include/ext/ropeimpl.h
++++ b/libstdc++-v3/include/ext/ropeimpl.h
+@@ -48,6 +48,9 @@
+ #include <ext/memory> // For uninitialized_copy_n
+ #include <ext/numeric> // For power
+ 
++/* cope w/ index defined as macro, SuSv3 proposal */
++#undef index
++
+ namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
+ {
+ _GLIBCXX_BEGIN_NAMESPACE_VERSION
+-- 
+1.7.10.4
+
diff --git a/recipes-devtools/gcc/gcc-4.9/0011.gcc.no_power_builtins-48.patch b/recipes-devtools/gcc/gcc-4.9/0011.gcc.no_power_builtins-48.patch
new file mode 100644
index 0000000..20e929f
--- /dev/null
+++ b/recipes-devtools/gcc/gcc-4.9/0011.gcc.no_power_builtins-48.patch
@@ -0,0 +1,24 @@
+--- gcc-4.7.1/gcc/config/rs6000/rs6000-c.c-orig	2012-07-12 15:10:29.165238074 -0500
++++ gcc-4.7.1/gcc/config/rs6000/rs6000-c.c	2012-07-12 15:12:18.928238388 -0500
+@@ -306,17 +306,17 @@
+     rs6000_define_or_undefine_macro (define_p, "_ARCH_PPCGR");
+   if ((flags & OPTION_MASK_POWERPC64) != 0)
+     rs6000_define_or_undefine_macro (define_p, "_ARCH_PPC64");
+-  if ((flags & OPTION_MASK_MFCRF) != 0)
++  if ((flags & OPTION_MASK_MFCRF) != 0 && rs6000_cpu != PROCESSOR_PPCE6500)
+     rs6000_define_or_undefine_macro (define_p, "_ARCH_PWR4");
+-  if ((flags & OPTION_MASK_POPCNTB) != 0)
++  if ((flags & OPTION_MASK_POPCNTB) != 0 && rs6000_cpu != PROCESSOR_PPCE5500 && rs6000_cpu != PROCESSOR_PPCE6500)
+     rs6000_define_or_undefine_macro (define_p, "_ARCH_PWR5");
+   if ((flags & OPTION_MASK_FPRND) != 0)
+     rs6000_define_or_undefine_macro (define_p, "_ARCH_PWR5X");
+-  if ((flags & OPTION_MASK_CMPB) != 0)
++  if ((flags & OPTION_MASK_CMPB) != 0 && rs6000_cpu != PROCESSOR_PPCE5500 && rs6000_cpu != PROCESSOR_PPCE6500)
+     rs6000_define_or_undefine_macro (define_p, "_ARCH_PWR6");
+   if ((flags & OPTION_MASK_MFPGPR) != 0)
+     rs6000_define_or_undefine_macro (define_p, "_ARCH_PWR6X");
+-  if ((flags & OPTION_MASK_POPCNTD) != 0)
++  if ((flags & OPTION_MASK_POPCNTD) != 0 && rs6000_cpu != PROCESSOR_PPCE5500 && rs6000_cpu != PROCESSOR_PPCE6500)
+     rs6000_define_or_undefine_macro (define_p, "_ARCH_PWR7");
+   if ((flags & OPTION_MASK_SOFT_FLOAT) != 0)
+     rs6000_define_or_undefine_macro (define_p, "_SOFT_FLOAT");
diff --git a/recipes-devtools/gcc/gcc-4.9/0012.gcc.ld_unaligned-460.patch b/recipes-devtools/gcc/gcc-4.9/0012.gcc.ld_unaligned-460.patch
new file mode 100644
index 0000000..c5aff93
--- /dev/null
+++ b/recipes-devtools/gcc/gcc-4.9/0012.gcc.ld_unaligned-460.patch
@@ -0,0 +1,32 @@
+gcc.ld_unaligned-460
+
+Optimization:
+Allows a "ld" of an address that is world aligned. There is a penalty
+performance, but it still beats a pair of "lwz".
+
+Index: gcc-4.4-e500mc64-20090322/gcc/config/rs6000/rs6000.c
+===================================================================
+--- gcc-4.4-e500mc64-20090322/gcc/config/rs6000/rs6000.c	(revision 137727)
++++ gcc-4.4-e500mc64-20090322/gcc/config/rs6000/rs6000.c	(working copy)
+@@ -10640,7 +10667,9 @@
+       else if (bytes >= 8 && TARGET_POWERPC64
+ 	       /* 64-bit loads and stores require word-aligned
+ 		  displacements.  */
+-	       && (align >= 64 || (!STRICT_ALIGNMENT && align >= 32)))
++	       && (align >= 64 || (!STRICT_ALIGNMENT && align >= 32)
++		   || rs6000_cpu == PROCESSOR_PPCE5500
++		   || rs6000_cpu == PROCESSOR_PPCE6500))
+ 	{
+ 	  clear_bytes = 8;
+ 	  mode = DImode;
+@@ -10775,7 +10808,9 @@
+       else if (bytes >= 8 && TARGET_POWERPC64
+ 	       /* 64-bit loads and stores require word-aligned
+ 		  displacements.  */
+-	       && (align >= 64 || (!STRICT_ALIGNMENT && align >= 32)))
++	       && (align >= 64 || (!STRICT_ALIGNMENT && align >= 32)
++		   || rs6000_cpu == PROCESSOR_PPCE5500
++		   || rs6000_cpu == PROCESSOR_PPCE6500))
+ 	{
+ 	  move_bytes = 8;
+ 	  mode = DImode;
diff --git a/recipes-devtools/gcc/gcc-4.9/0013-libstdc-namespace.patch b/recipes-devtools/gcc/gcc-4.9/0013-libstdc-namespace.patch
new file mode 100644
index 0000000..4a3efde
--- /dev/null
+++ b/recipes-devtools/gcc/gcc-4.9/0013-libstdc-namespace.patch
@@ -0,0 +1,54 @@
+From 104e4d66208f2726b14d2f5eebce90700cbc83c8 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem at gmail.com>
+Date: Fri, 29 Mar 2013 08:54:02 +0400
+Subject: [PATCH 13/35] libstdc++-namespace
+
+Signed-off-by: Khem Raj <raj.khem at gmail.com>
+
+Upstream-Status: Pending
+---
+ libstdc++-v3/config/locale/uclibc/messages_members.h |    4 +++-
+ libstdc++-v3/config/locale/uclibc/time_members.h     |    4 +++-
+ 2 files changed, 6 insertions(+), 2 deletions(-)
+
+diff --git a/libstdc++-v3/config/locale/uclibc/messages_members.h b/libstdc++-v3/config/locale/uclibc/messages_members.h
+index 067657a..dd76a6c 100644
+--- a/libstdc++-v3/config/locale/uclibc/messages_members.h
++++ b/libstdc++-v3/config/locale/uclibc/messages_members.h
+@@ -32,7 +32,8 @@
+ //
+ 
+ // Written by Benjamin Kosnik <bkoz at redhat.com>
+-
++namespace std
++{
+ #ifdef __UCLIBC_MJN3_ONLY__
+ #warning fix prototypes for *textdomain funcs
+ #endif
+@@ -116,3 +117,4 @@
+ 	   this->_S_create_c_locale(this->_M_c_locale_messages, __s);
+ 	 }
+      }
++}
+diff --git a/libstdc++-v3/config/locale/uclibc/time_members.h b/libstdc++-v3/config/locale/uclibc/time_members.h
+index 1665dde..905c433 100644
+--- a/libstdc++-v3/config/locale/uclibc/time_members.h
++++ b/libstdc++-v3/config/locale/uclibc/time_members.h
+@@ -33,7 +33,8 @@
+ //
+ 
+ // Written by Benjamin Kosnik <bkoz at redhat.com>
+-
++namespace std
++{
+   template<typename _CharT>
+     __timepunct<_CharT>::__timepunct(size_t __refs)
+     : facet(__refs), _M_data(NULL), _M_c_locale_timepunct(NULL),
+@@ -75,3 +76,4 @@
+       delete _M_data;
+       _S_destroy_c_locale(_M_c_locale_timepunct);
+     }
++}
+-- 
+1.7.10.4
+
diff --git a/recipes-devtools/gcc/gcc-4.9/0013.gcc.local_unaligned_altivec.patch b/recipes-devtools/gcc/gcc-4.9/0013.gcc.local_unaligned_altivec.patch
new file mode 100644
index 0000000..92ca909
--- /dev/null
+++ b/recipes-devtools/gcc/gcc-4.9/0013.gcc.local_unaligned_altivec.patch
@@ -0,0 +1,32 @@
+gcc.local_unaligned_altivec
+
+Optimization:
+On Altivec targets, make all char arrays 128 bits aligned (instead of 
+32 bits aligned)
+
+diff -Naur gcc-4.8.3/gcc/config/rs6000/rs6000.c gcc-4.8.3-local_unaligned_altivec/gcc/config/rs6000/rs6000.c
+--- gcc-4.8.3/gcc/config/rs6000/rs6000.c	2014-09-12 07:30:11.089024245 -0500
++++ gcc-4.8.3-local_unaligned_altivec/gcc/config/rs6000/rs6000.c	2014-09-12 07:32:21.384037349 -0500
+@@ -5853,8 +5853,8 @@
+       if (TREE_CODE (type) == ARRAY_TYPE
+ 	  && TYPE_MODE (TREE_TYPE (type)) == QImode)
+ 	{
+-	  if (align < BITS_PER_WORD)
+-	    align = BITS_PER_WORD;
++	  if (align < (TARGET_ALTIVEC ? 128 : BITS_PER_WORD))
++	    align = (TARGET_ALTIVEC ? 128 : BITS_PER_WORD);
+ 	}
+     }
+ 
+diff -Naur gcc-4.8.3/gcc/testsuite/gcc.dg/stack-usage-1.c gcc-4.8.3-local_unaligned_altivec/gcc/testsuite/gcc.dg/stack-usage-1.c
+--- gcc-4.8.3/gcc/testsuite/gcc.dg/stack-usage-1.c	2014-04-04 09:17:55.000000000 -0500
++++ gcc-4.8.3-local_unaligned_altivec/gcc/testsuite/gcc.dg/stack-usage-1.c	2014-09-12 07:35:23.139055629 -0500
+@@ -46,7 +46,7 @@
+ #elif defined (__powerpc__) || defined (__PPC__) || defined (__ppc__) \
+       || defined (__POWERPC__) || defined (PPC) || defined (_IBMR2)
+ #  if defined (__ALTIVEC__)
+-#    if defined (__APPLE__)
++#    if defined (__APPLE__) || defined (__APPLE_ALTIVEC__)
+ #      define SIZE 204
+ #    else
+ #      define SIZE 220
diff --git a/recipes-devtools/gcc/gcc-4.9/0014-sh-pr24836.patch b/recipes-devtools/gcc/gcc-4.9/0014-sh-pr24836.patch
new file mode 100644
index 0000000..cb8fd52
--- /dev/null
+++ b/recipes-devtools/gcc/gcc-4.9/0014-sh-pr24836.patch
@@ -0,0 +1,45 @@
+From edc9acb181810f234b6b9f7d2820b0e4f6a1eeaf Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem at gmail.com>
+Date: Fri, 29 Mar 2013 08:54:48 +0400
+Subject: [PATCH 14/35] sh-pr24836
+
+Signed-off-by: Khem Raj <raj.khem at gmail.com>
+
+Upstream-Status: Pending
+
+http://sourceforge.net/mailarchive/forum.php?thread_id=8959304&forum_id=5348
+http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24836
+---
+ gcc/configure    |    2 +-
+ gcc/configure.ac |    2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/gcc/configure b/gcc/configure
+index e12a180..135bbf5 100755
+--- a/gcc/configure
++++ b/gcc/configure
+@@ -23378,7 +23378,7 @@ foo:	.long	25
+ 	tls_first_minor=14
+ 	tls_as_opt="-m64 -Aesame --fatal-warnings"
+ 	;;
+-  sh-*-* | sh[34]-*-*)
++  sh-*-* | sh[34]*-*-*)
+     conftest_s='
+ 	.section ".tdata","awT", at progbits
+ foo:	.long	25
+diff --git a/gcc/configure.ac b/gcc/configure.ac
+index eba3577..6363a21 100644
+--- a/gcc/configure.ac
++++ b/gcc/configure.ac
+@@ -3141,7 +3141,7 @@ foo:	.long	25
+ 	tls_first_minor=14
+ 	tls_as_opt="-m64 -Aesame --fatal-warnings"
+ 	;;
+-  sh-*-* | sh[34]-*-*)
++  sh-*-* | sh[34]*-*-*)
+     conftest_s='
+ 	.section ".tdata","awT", at progbits
+ foo:	.long	25
+-- 
+1.7.10.4
+
diff --git a/recipes-devtools/gcc/gcc-4.9/0014.gcc.soft_float-470.patch b/recipes-devtools/gcc/gcc-4.9/0014.gcc.soft_float-470.patch
new file mode 100644
index 0000000..b71c094
--- /dev/null
+++ b/recipes-devtools/gcc/gcc-4.9/0014.gcc.soft_float-470.patch
@@ -0,0 +1,16 @@
+diff -u gcc-4.6.0-orig/libstdc++-v3/testsuite/ext/pb_ds/regression/priority_queue_rand.cc gcc-4.6.0/libstdc++-v3/testsuite/ext/pb_ds/regression/priority_queue_rand.cc
+--- gcc-4.6.0-orig/libstdc++-v3/testsuite/ext/pb_ds/regression/priority_queue_rand.cc	2011-05-11 20:01:58.000000000 -0500
++++ gcc-4.6.0/libstdc++-v3/testsuite/ext/pb_ds/regression/priority_queue_rand.cc	2011-05-11 20:02:23.000000000 -0500
+@@ -45,10 +45,10 @@
+ #include <regression/common_type.hpp>
+ 
+ #ifndef ITERATIONS
+-#define ITERATIONS 5000
++#define ITERATIONS 2
+ #endif
+ #ifndef KEYS
+-#define KEYS 10000
++#define KEYS 5
+ #endif
+ int
+ main(int argc, char* a_p_argv[])
diff --git a/recipes-devtools/gcc/gcc-4.9/0015-arm-Use-TARGET_ENDIAN_OPTION-for-determining-MULTILI.patch b/recipes-devtools/gcc/gcc-4.9/0015-arm-Use-TARGET_ENDIAN_OPTION-for-determining-MULTILI.patch
new file mode 100644
index 0000000..37c46fc
--- /dev/null
+++ b/recipes-devtools/gcc/gcc-4.9/0015-arm-Use-TARGET_ENDIAN_OPTION-for-determining-MULTILI.patch
@@ -0,0 +1,47 @@
+From 50e5366005b0f6af27378e2a5c3cb9f9936a7e62 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem at gmail.com>
+Date: Fri, 29 Mar 2013 08:58:36 +0400
+Subject: [PATCH 15/35] arm: Use TARGET_ENDIAN_OPTION for determining
+ MULTILIB_DEFAULTS
+
+Signed-off-by: Khem Raj <raj.khem at gmail.com>
+
+Upstream-Status: Pending
+---
+ gcc/config/arm/linux-elf.h |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+Index: gcc-4.9.2/gcc/config/arm/coff.h
+===================================================================
+--- gcc-4.9.2.orig/gcc/config/arm/coff.h
++++ gcc-4.9.2/gcc/config/arm/coff.h
+@@ -32,8 +32,11 @@
+ #define TARGET_DEFAULT (MASK_APCS_FRAME)
+ 
+ #ifndef MULTILIB_DEFAULTS
++#ifndef TARGET_ENDIAN_OPTION
++#define TARGET_ENDIAN_OPTION "mlittle-endian"
++#endif
+ #define MULTILIB_DEFAULTS \
+-  { "marm", "mlittle-endian", "mfloat-abi=soft", "mno-thumb-interwork" }
++  { "marm", TARGET_ENDIAN_OPTION, "mfloat-abi=soft", "mno-thumb-interwork" }
+ #endif
+ 
+ /* This is COFF, but prefer stabs.  */
+Index: gcc-4.9.2/gcc/config/arm/elf.h
+===================================================================
+--- gcc-4.9.2.orig/gcc/config/arm/elf.h
++++ gcc-4.9.2/gcc/config/arm/elf.h
+@@ -116,8 +116,11 @@
+ #endif
+ 
+ #ifndef MULTILIB_DEFAULTS
++#ifndef TARGET_ENDIAN_OPTION
++#define TARGET_ENDIAN_OPTION "mlittle-endian"
++#endif
+ #define MULTILIB_DEFAULTS \
+-  { "marm", "mlittle-endian", "mfloat-abi=soft", "mno-thumb-interwork", "fno-leading-underscore" }
++  { "marm", TARGET_ENDIAN_OPTION, "mfloat-abi=soft", "mno-thumb-interwork", "fno-leading-underscore" }
+ #endif
+ 
+ #define TARGET_ASM_FILE_START_APP_OFF true
diff --git a/recipes-devtools/gcc/gcc-4.9/0015.gcc.case_values-48.patch b/recipes-devtools/gcc/gcc-4.9/0015.gcc.case_values-48.patch
new file mode 100644
index 0000000..94e2922
--- /dev/null
+++ b/recipes-devtools/gcc/gcc-4.9/0015.gcc.case_values-48.patch
@@ -0,0 +1,43 @@
+# Problem Statement:
+  Option 'case-values-threshold' has been integrated in to GCC v4.8.1 mainline
+  Set PowerPC target specific threshold value to generate jump tables for 
+  switch statement.
+
+# Owned by:
+  Rohit
+
+diff -Naur gcc-4.8.1/gcc/config/rs6000/rs6000.c gcc-4.8.1-case-value/gcc/config/rs6000/rs6000.c
+--- gcc-4.8.1/gcc/config/rs6000/rs6000.c	2013-07-30 06:31:20.052002899 -0500
++++ gcc-4.8.1-case-value/gcc/config/rs6000/rs6000.c	2013-07-30 06:56:15.329004807 -0500
+@@ -1458,6 +1458,9 @@
+ #undef TARGET_SET_CURRENT_FUNCTION
+ #define TARGET_SET_CURRENT_FUNCTION rs6000_set_current_function
+ 
++#undef TARGET_CASE_VALUES_THRESHOLD
++#define TARGET_CASE_VALUES_THRESHOLD rs6000_case_values_threshold
++
+ #undef TARGET_LEGITIMATE_CONSTANT_P
+ #define TARGET_LEGITIMATE_CONSTANT_P rs6000_legitimate_constant_p
+ 
+@@ -28639,6 +28642,21 @@
+     }
+ }
+ 
++/* Implement `CASE_VALUES_THRESHOLD'.  */
++/* Supply the default for --param case-values-threshold=0  */
++
++static unsigned int
++rs6000_case_values_threshold (void)
++{
++  if (rs6000_cpu == PROCESSOR_PPC8540
++      || rs6000_cpu == PROCESSOR_PPCE500MC
++      || rs6000_cpu == PROCESSOR_PPCE5500
++      || rs6000_cpu == PROCESSOR_PPCE6500)
++    return 8;
++
++  return 4;
++}
++
+ 
+ /* Save the current options */
+ 
diff --git a/recipes-devtools/gcc/gcc-4.9/0016-gcc-poison-system-directories.patch b/recipes-devtools/gcc/gcc-4.9/0016-gcc-poison-system-directories.patch
new file mode 100644
index 0000000..475ef96
--- /dev/null
+++ b/recipes-devtools/gcc/gcc-4.9/0016-gcc-poison-system-directories.patch
@@ -0,0 +1,190 @@
+From 160397ef3c3331099af028f1b8d3e085b07d88ad Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem at gmail.com>
+Date: Fri, 29 Mar 2013 08:59:00 +0400
+Subject: [PATCH 16/35] gcc: poison-system-directories
+
+Signed-off-by: Khem Raj <raj.khem at gmail.com>
+
+Upstream-Status: Inappropriate [distribution: codesourcery]
+---
+ gcc/Makefile.in     |    2 +-
+ gcc/common.opt      |    4 ++++
+ gcc/config.in       |    6 ++++++
+ gcc/configure       |   20 ++++++++++++++++++--
+ gcc/configure.ac    |   10 ++++++++++
+ gcc/doc/invoke.texi |    9 +++++++++
+ gcc/gcc.c           |    2 ++
+ gcc/incpath.c       |   19 +++++++++++++++++++
+ 8 files changed, 69 insertions(+), 3 deletions(-)
+
+Index: gcc-4.9-20140316/gcc/common.opt
+===================================================================
+--- gcc-4.9-20140316.orig/gcc/common.opt
++++ gcc-4.9-20140316/gcc/common.opt
+@@ -603,6 +603,10 @@ Wpedantic
+ Common Var(pedantic) Warning
+ Issue warnings needed for strict compliance to the standard
+ 
++Wpoison-system-directories
++Common Var(flag_poison_system_directories) Init(1) Warning
++Warn for -I and -L options using system directories if cross compiling
++
+ Wshadow
+ Common Var(warn_shadow) Warning
+ Warn when one local variable shadows another
+Index: gcc-4.9-20140316/gcc/config.in
+===================================================================
+--- gcc-4.9-20140316.orig/gcc/config.in
++++ gcc-4.9-20140316/gcc/config.in
+@@ -138,6 +138,12 @@
+ #endif
+ 
+ 
++/* Define to warn for use of native system header directories */
++#ifndef USED_FOR_TARGET
++#undef ENABLE_POISON_SYSTEM_DIRECTORIES
++#endif
++
++
+ /* Define if you want all operations on RTL (the basic data structure of the
+    optimizer and back end) to be checked for dynamic type safety at runtime.
+    This is quite expensive. */
+Index: gcc-4.9-20140316/gcc/configure
+===================================================================
+--- gcc-4.9-20140316.orig/gcc/configure
++++ gcc-4.9-20140316/gcc/configure
+@@ -928,6 +928,7 @@ with_system_zlib
+ enable_maintainer_mode
+ enable_link_mutex
+ enable_version_specific_runtime_libs
++enable_poison_system_directories
+ enable_plugin
+ enable_host_shared
+ enable_libquadmath_support
+@@ -1648,6 +1649,8 @@ Optional Features:
+   --enable-version-specific-runtime-libs
+                           specify that runtime libraries should be installed
+                           in a compiler-specific directory
++  --enable-poison-system-directories
++                          warn for use of native system header directories
+   --enable-plugin         enable plugin support
+   --enable-host-shared    build host code as shared libraries
+   --disable-libquadmath-support
+@@ -27702,6 +27705,19 @@ if test "${enable_version_specific_runti
+ fi
+ 
+ 
++# Check whether --enable-poison-system-directories was given.
++if test "${enable_poison_system_directories+set}" = set; then :
++  enableval=$enable_poison_system_directories;
++else
++  enable_poison_system_directories=no
++fi
++
++if test "x${enable_poison_system_directories}" = "xyes"; then
++
++$as_echo "#define ENABLE_POISON_SYSTEM_DIRECTORIES 1" >>confdefs.h
++
++fi
++
+ # Substitute configuration variables
+ 
+ 
+Index: gcc-4.9-20140316/gcc/configure.ac
+===================================================================
+--- gcc-4.9-20140316.orig/gcc/configure.ac
++++ gcc-4.9-20140316/gcc/configure.ac
+@@ -5366,6 +5366,16 @@ AC_ARG_ENABLE(version-specific-runtime-l
+                 [specify that runtime libraries should be
+                  installed in a compiler-specific directory])])
+ 
++AC_ARG_ENABLE([poison-system-directories],
++             AS_HELP_STRING([--enable-poison-system-directories],
++                            [warn for use of native system header directories]),,
++             [enable_poison_system_directories=no])
++if test "x${enable_poison_system_directories}" = "xyes"; then
++  AC_DEFINE([ENABLE_POISON_SYSTEM_DIRECTORIES],
++           [1],
++           [Define to warn for use of native system header directories])
++fi
++
+ # Substitute configuration variables
+ AC_SUBST(subdirs)
+ AC_SUBST(srcdir)
+Index: gcc-4.9-20140316/gcc/doc/invoke.texi
+===================================================================
+--- gcc-4.9-20140316.orig/gcc/doc/invoke.texi
++++ gcc-4.9-20140316/gcc/doc/invoke.texi
+@@ -260,6 +260,7 @@ Objective-C and Objective-C++ Dialects}.
+ -Woverlength-strings  -Wpacked  -Wpacked-bitfield-compat  -Wpadded @gol
+ -Wparentheses  -Wpedantic-ms-format -Wno-pedantic-ms-format @gol
+ -Wpointer-arith  -Wno-pointer-to-int-cast @gol
++-Wno-poison-system-directories @gol
+ -Wredundant-decls  -Wno-return-local-addr @gol
+ -Wreturn-type  -Wsequence-point  -Wshadow @gol
+ -Wsign-compare  -Wsign-conversion -Wfloat-conversion @gol
+@@ -4230,6 +4231,14 @@ headers---for that, @option{-Wunknown-pr
+  for most targets, it is made up of code and thus requires the stack
+  to be made executable in order for the program to work properly.
+ 
++ at item -Wno-poison-system-directories
++ at opindex Wno-poison-system-directories
++Do not warn for @option{-I} or @option{-L} options using system
++directories such as @file{/usr/include} when cross compiling.  This
++option is intended for use in chroot environments when such
++directories contain the correct headers and libraries for the target
++system rather than the host.
++
+ @item -Wfloat-equal
+ @opindex Wfloat-equal
+ @opindex Wno-float-equal
+Index: gcc-4.9-20140316/gcc/gcc.c
+===================================================================
+--- gcc-4.9-20140316.orig/gcc/gcc.c
++++ gcc-4.9-20140316/gcc/gcc.c
+@@ -764,6 +764,8 @@ proper position among the other output f
+    "%{fuse-ld=*:-fuse-ld=%*}\
+     %X %{o*} %{e*} %{N} %{n} %{r}\
+     %{s} %{t} %{u*} %{z} %{Z} %{!nostdlib:%{!nostartfiles:%S}} " VTABLE_VERIFICATION_SPEC " \
++    %{Wno-poison-system-directories:--no-poison-system-directories}\
++    %{Werror=poison-system-directories:--error-poison-system-directories}\
+     %{static:} %{L*} %(mfwrap) %(link_libgcc) " SANITIZER_EARLY_SPEC " %o\
+     %{fopenmp|ftree-parallelize-loops=*:%:include(libgomp.spec)%(link_gomp)}\
+     %{fgnu-tm:%:include(libitm.spec)%(link_itm)}\
+Index: gcc-4.9-20140316/gcc/incpath.c
+===================================================================
+--- gcc-4.9-20140316.orig/gcc/incpath.c
++++ gcc-4.9-20140316/gcc/incpath.c
+@@ -28,6 +28,7 @@
+ #include "intl.h"
+ #include "incpath.h"
+ #include "cppdefault.h"
++#include "diagnostic-core.h"
+ 
+ /* Microsoft Windows does not natively support inodes.
+    VMS has non-numeric inodes.  */
+@@ -382,6 +383,24 @@ merge_include_chains (const char *sysroo
+ 	}
+       fprintf (stderr, _("End of search list.\n"));
+     }
++
++#ifdef ENABLE_POISON_SYSTEM_DIRECTORIES
++  if (flag_poison_system_directories)
++    {
++       struct cpp_dir *p;
++
++       for (p = heads[QUOTE]; p; p = p->next)
++         {
++          if ((!strncmp (p->name, "/usr/include", 12))
++              || (!strncmp (p->name, "/usr/local/include", 18))
++              || (!strncmp (p->name, "/usr/X11R6/include", 18)))
++            warning (OPT_Wpoison_system_directories,
++                     "include location \"%s\" is unsafe for "
++                     "cross-compilation",
++                     p->name);
++         }
++    }
++#endif
+ }
+ 
+ /* Use given -I paths for #include "..." but not #include <...>, and
diff --git a/recipes-devtools/gcc/gcc-4.9/0016.gcc.fix_pr63854_pass_manager.patch b/recipes-devtools/gcc/gcc-4.9/0016.gcc.fix_pr63854_pass_manager.patch
new file mode 100644
index 0000000..3595b8f
--- /dev/null
+++ b/recipes-devtools/gcc/gcc-4.9/0016.gcc.fix_pr63854_pass_manager.patch
@@ -0,0 +1,22 @@
+# Problem Statement:
+  Windows toolchain gave an ICE in pass manager.
+
+# Owned by:
+  Rohit
+
+# Referred from patch by:
+  David Malcolm
+
+# Action:
+  * Backport r217807 trunk to add all_late_ipa_passes to GCC_PASS_LISTS
+
+--- trunk/gcc/pass_manager.h	2014/11/19 20:21:19	217806
++++ trunk/gcc/pass_manager.h	2014/11/19 20:26:57	217807
+@@ -29,6 +29,7 @@
+   DEF_PASS_LIST (all_lowering_passes) \
+   DEF_PASS_LIST (all_small_ipa_passes) \
+   DEF_PASS_LIST (all_regular_ipa_passes) \
++  DEF_PASS_LIST (all_late_ipa_passes) \
+   DEF_PASS_LIST (all_passes)
+ 
+ #define DEF_PASS_LIST(LIST) PASS_LIST_NO_##LIST,
diff --git a/recipes-devtools/gcc/gcc-4.9/0017-gcc-poison-dir-extend.patch b/recipes-devtools/gcc/gcc-4.9/0017-gcc-poison-dir-extend.patch
new file mode 100644
index 0000000..9e81efd
--- /dev/null
+++ b/recipes-devtools/gcc/gcc-4.9/0017-gcc-poison-dir-extend.patch
@@ -0,0 +1,39 @@
+From e99c9c97266d6d3e8cac798aa91408250c4d60cf Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem at gmail.com>
+Date: Fri, 29 Mar 2013 09:00:34 +0400
+Subject: [PATCH 17/35] gcc-poison-dir-extend
+
+Add /sw/include and /opt/include based on the original
+zecke-no-host-includes.patch patch.  The original patch checked for
+/usr/include, /sw/include and /opt/include and then triggered a failure and
+aborted.
+
+Instead, we add the two missing items to the current scan.  If the user
+wants this to be a failure, they can add "-Werror=poison-system-directories".
+
+Signed-off-by: Mark Hatle <mark.hatle at windriver.com>
+Signed-off-by: Khem Raj <raj.khem at gmail.com>
+
+Upstream-Status: Pending
+---
+ gcc/incpath.c |    4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/gcc/incpath.c b/gcc/incpath.c
+index cd41c78..eac4a92 100644
+--- a/gcc/incpath.c
++++ b/gcc/incpath.c
+@@ -393,7 +393,9 @@ merge_include_chains (const char *sysroot, cpp_reader *pfile, int verbose)
+          {
+           if ((!strncmp (p->name, "/usr/include", 12))
+               || (!strncmp (p->name, "/usr/local/include", 18))
+-              || (!strncmp (p->name, "/usr/X11R6/include", 18)))
++              || (!strncmp (p->name, "/usr/X11R6/include", 18))
++              || (!strncmp (p->name, "/sw/include", 11))
++              || (!strncmp (p->name, "/opt/include", 12)))
+             warning (OPT_Wpoison_system_directories,
+                      "include location \"%s\" is unsafe for "
+                      "cross-compilation",
+-- 
+1.7.10.4
+
diff --git a/recipes-devtools/gcc/gcc-4.9/0017.gcc.builtin_isel_doc.patch b/recipes-devtools/gcc/gcc-4.9/0017.gcc.builtin_isel_doc.patch
new file mode 100644
index 0000000..cf71d4d
--- /dev/null
+++ b/recipes-devtools/gcc/gcc-4.9/0017.gcc.builtin_isel_doc.patch
@@ -0,0 +1,109 @@
+--- gcc-4.5-2011.03/gcc/doc/extend.texi	2013-08-07 14:06:33.409961113 -0500
++++ gcc-4.5-2011.03/gcc/doc/extend.texi-new	2013-08-07 14:04:49.121960015 -0500
+@@ -11957,6 +11957,106 @@
+ int __builtin_bswap16 (int);
+ @end smallexample
+ 
++GCC also provides a family of builtins on PowerPC to explicitly use
++the @code{isel} instruction.  While GCC can and does generate
++ at code{isel} instructions normally, the builtins enable you to
++explicitly force generation of these instructions.  The builtins are
++only available when compiling for processors that support the
++ at code{isel} instruction; they compile to a code sequence of
++ at code{cmpw} followed by @code{isel}.
++
++ at table @code
++ at item int __builtin_iseleq (int @var{x}, int @var{y}, int @var{a}, int @var{b})
++ at itemx int __builtin_iseleq (unsigned int @var{x}, unsigned int @var{y}, int @var{a}, int @var{b})
++ at itemx int __builtin_iseleq (void *@var{x}, void *@var{y}, int @var{a}, int @var{b})
++ at itemx unsigned int __builtin_iseleq (int @var{x}, int @var{y}, unsigned int @var{a}, unsigned int @var{b})
++ at itemx unsigned int __builtin_iseleq (unsigned int @var{x}, unsigned int @var{y}, unsigned int @var{a}, unsigned int @var{b})
++ at itemx unsigned int __builtin_iseleq (void *@var{x}, void *@var{y}, unsigned int @var{a}, unsigned int @var{b})
++ at itemx void *__builtin_iseleq (int @var{x}, int @var{y}, void *@var{a}, void *@var{b})
++ at itemx void *__builtin_iseleq (unsigned int @var{x}, unsigned int @var{y}, void *@var{a}, void *@var{b})
++ at itemx void *__builtin_iseleq (void *@var{x}, void *@var{y}, void *@var{a}, void *@var{b})
++Return @var{a} if @var{x} and @var{y} are equal, otherwise return @var{b}.
++
++ at item int __builtin_isellt (int @var{x}, int @var{y}, int @var{a}, int @var{b})
++ at itemx unsigned int __builtin_isellt (int @var{x}, int @var{y}, unsigned int @var{a}, unsigned int @var{b})
++ at itemx void *__builtin_isellt (int @var{x}, int @var{y}, void *@var{a}, void *@var{b})
++Return @var{a} if @var{x} is less than @var{y}, otherwise return @var{b}.
++Note that this uses signed comparison.
++
++ at item int __builtin_iselgt (int @var{x}, int @var{y}, int @var{a}, int @var{b})
++ at itemx unsigned int __builtin_iselgt (int @var{x}, int @var{y}, unsigned int @var{a}, unsigned int @var{b})
++ at itemx void *__builtin_iselgt (int @var{x}, int @var{y}, void *@var{a}, void *@var{b})
++Return @var{a} if @var{x} is greater than @var{y}, otherwise return @var{b}.
++Note that this uses signed comparison.
++
++ at item int __builtin_iselltu (unsigned int @var{x}, unsigned int @var{y}, int @var{a}, int @var{b})
++ at itemx int __builtin_iselltu (void *@var{x}, void *@var{y}, int @var{a}, int @var{b})
++ at itemx unsigned int __builtin_iselltu (unsigned int @var{x}, unsigned int @var{y}, unsigned int @var{a}, unsigned int @var{b})
++ at itemx unsigned int __builtin_iselltu (void *@var{x}, void *@var{y}, unsigned int @var{a}, unsigned int @var{b})
++ at itemx void *__builtin_iselltu (unsigned int @var{x}, unsigned int @var{y}, void *@var{a}, void *@var{b})
++ at itemx void *__builtin_iselltu (void *@var{x}, void *@var{y}, void *@var{a}, void *@var{b})
++Return @var{a} if @var{x} is less than @var{y}, otherwise return @var{b}
++In contrast to @code{__builtin_isellt}, this uses unsigned comparison.
++
++ at item int __builtin_iselgtu (unsigned int @var{x}, unsigned int @var{y}, int @var{a}, int @var{b})
++ at itemx int __builtin_iselgtu (void *@var{x}, void *@var{y}, int @var{a}, int @var{b})
++ at itemx unsigned int __builtin_iselgtu (unsigned int @var{x}, unsigned int @var{y}, unsigned int @var{a}, unsigned int @var{b})
++ at itemx unsigned int __builtin_iselgtu (void *@var{x}, void *@var{y}, unsigned int @var{a}, unsigned int @var{b})
++ at itemx void *__builtin_iselgtu (unsigned int @var{x}, unsigned int @var{y}, void *@var{a}, void *@var{b})
++ at itemx void *__builtin_iselgtu (void *@var{x}, void *@var{y}, void *@var{a}, void *@var{b})
++Return @var{a} if @var{x} is greater than @var{y}, otherwise return @var{b}
++In contrast to @code{__builtin_iselgt}, this uses unsigned comparison.
++
++ at end table
++
++Builtins that do 64-bit comparisons (i.e. using @code{cmpd} instead of
++ at code{cmpw}) are also available on 64-bit processors supporting
++ at code{isel}.
++
++ at table @code
++ at item long __builtin_isel64eq (long @var{x}, long @var{y}, long @var{a}, long @var{b})
++ at itemx long __builtin_isel64eq (unsigned long @var{x}, unsigned long @var{y}, long @var{a}, long @var{b})
++ at itemx long __builtin_isel64eq (void *@var{x}, void *@var{y}, long @var{a}, long @var{b})
++ at itemx unsigned long __builtin_isel64eq (long @var{x}, long @var{y}, unsigned long @var{a}, unsigned long @var{b})
++ at itemx unsigned long __builtin_isel64eq (unsigned long @var{x}, unsigned long @var{y}, unsigned long @var{a}, unsigned long @var{b})
++ at itemx unsigned long __builtin_isel64eq (void *@var{x}, void *@var{y}, unsigned long @var{a}, unsigned long @var{b})
++ at itemx void *__builtin_isel64eq (long @var{x}, long @var{y}, void *@var{a}, void *@var{b})
++ at itemx void *__builtin_isel64eq (unsigned long @var{x}, unsigned long @var{y}, void *@var{a}, void *@var{b})
++ at itemx void *__builtin_isel64eq (void *@var{x}, void *@var{y}, void *@var{a}, void *@var{b})
++Return @var{a} if @var{x} and @var{y} are equal, otherwise return @var{b}.
++
++ at item long __builtin_isel64lt (long @var{x}, long @var{y}, long @var{a}, long @var{b})
++ at itemx unsigned long __builtin_isel64lt (long @var{x}, long @var{y}, unsigned long @var{a}, unsigned long @var{b})
++ at itemx void *__builtin_isel64lt (long @var{x}, long @var{y}, void *@var{a}, void *@var{b})
++Return @var{a} if @var{x} is less than @var{y}, otherwise return @var{b}.
++Note that this uses signed comparison.
++
++ at item long __builtin_isel64gt (long @var{x}, long @var{y}, long @var{a}, long @var{b})
++ at itemx unsigned long __builtin_isel64gt (long @var{x}, long @var{y}, unsigned long @var{a}, unsigned long @var{b})
++ at itemx void *__builtin_isel64gt (long @var{x}, long @var{y}, void *@var{a}, void *@var{b})
++Return @var{a} if @var{x} is greater than @var{y}, otherwise return @var{b}.
++Note that this uses signed comparison.
++
++ at item long __builtin_isel64ltu (unsigned long @var{x}, unsigned long @var{y}, long @var{a}, long @var{b})
++ at itemx long __builtin_isel64ltu (void *@var{x}, void *@var{y}, long @var{a}, long @var{b})
++ at itemx unsigned long __builtin_isel64ltu (unsigned long @var{x}, unsigned long @var{y}, unsigned long @var{a}, unsigned long @var{b})
++ at itemx unsigned long __builtin_isel64ltu (void *@var{x}, void *@var{y}, unsigned long @var{a}, unsigned long @var{b})
++ at itemx void *__builtin_isel64ltu (unsigned long @var{x}, unsigned long @var{y}, void *@var{a}, void *@var{b})
++ at itemx void *__builtin_isel64ltu (void *@var{x}, void *@var{y}, void *@var{a}, void *@var{b})
++Return @var{a} if @var{x} is less than @var{y}, otherwise return @var{b}
++In contrast to @code{__builtin_isel64lt}, this uses unsigned comparison.
++
++ at item long __builtin_isel64gtu (unsigned long @var{x}, unsigned long @var{y}, long @var{a}, long @var{b})
++ at itemx long __builtin_isel64gtu (void *@var{x}, void *@var{y}, long @var{a}, long @var{b})
++ at itemx unsigned long __builtin_isel64gtu (unsigned long @var{x}, unsigned long @var{y}, unsigned long @var{a}, unsigned long @var{b})
++ at itemx unsigned long __builtin_isel64gtu (void *@var{x}, void *@var{y}, unsigned long @var{a}, unsigned long @var{b})
++ at itemx void *__builtin_isel64gtu (unsigned long @var{x}, unsigned long @var{y}, void *@var{a}, void *@var{b})
++ at itemx void *__builtin_isel64gtu (void *@var{x}, void *@var{y}, void *@var{a}, void *@var{b})
++Return @var{a} if @var{x} is greater than @var{y}, otherwise return @var{b}
++In contrast to @code{__builtin_isel64gt}, this uses unsigned comparison.
++
++ at end table
++
+ @node RX Built-in Functions
+ @subsection RX Built-in Functions
+ GCC supports some of the RX instructions which cannot be expressed in
diff --git a/recipes-devtools/gcc/gcc-4.9/0018-gcc-4.3.3-SYSROOT_CFLAGS_FOR_TARGET.patch b/recipes-devtools/gcc/gcc-4.9/0018-gcc-4.3.3-SYSROOT_CFLAGS_FOR_TARGET.patch
new file mode 100644
index 0000000..a28cafd
--- /dev/null
+++ b/recipes-devtools/gcc/gcc-4.9/0018-gcc-4.3.3-SYSROOT_CFLAGS_FOR_TARGET.patch
@@ -0,0 +1,73 @@
+From 56207fa2923e8edf774e98ffac82666091076be3 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem at gmail.com>
+Date: Fri, 29 Mar 2013 09:08:31 +0400
+Subject: [PATCH 18/35] gcc-4.3.3: SYSROOT_CFLAGS_FOR_TARGET
+
+Before committing, I noticed that PR/32161 was marked as a dup of PR/32009, but my previous patch did not fix it.
+
+This alternative patch is better because it lets you just use CFLAGS_FOR_TARGET to set the compilation flags for libgcc. Since bootstrapped target libraries are never compiled with the native compiler, it makes little sense to use different flags for stage1 and later stages. And it also makes little sense to use a different variable than CFLAGS_FOR_TARGET.
+
+Other changes I had to do include:
+
+- moving the creation of default CFLAGS_FOR_TARGET from Makefile.am to configure.ac, because otherwise the BOOT_CFLAGS are substituted into CFLAGS_FOR_TARGET (which is "-O2 -g $(CFLAGS)") via $(CFLAGS). It is also cleaner this way though.
+
+- passing the right CFLAGS to configure scripts as exported environment variables
+
+I also stopped passing LIBCFLAGS to configure scripts since they are unused in the whole src tree. And I updated the documentation as H-P reminded me to do.
+
+Bootstrapped/regtested i686-pc-linux-gnu, will commit to 4.4 shortly. Ok for 4.3?
+
+Signed-off-by: Paolo Bonzini  <bonzini at gnu.org>
+Signed-off-by: Khem Raj <raj.khem at gmail.com>
+
+Upstream-Status: Pending
+---
+ configure |   32 ++++++++++++++++++++++++++++++++
+ 1 file changed, 32 insertions(+)
+
+diff --git a/configure b/configure
+index 1b76c90..e4dce7c 100755
+--- a/configure
++++ b/configure
+@@ -6772,6 +6772,38 @@ fi
+ 
+ 
+ 
++# During gcc bootstrap, if we use some random cc for stage1 then CFLAGS
++# might be empty or "-g".  We don't require a C++ compiler, so CXXFLAGS
++# might also be empty (or "-g", if a non-GCC C++ compiler is in the path).
++# We want to ensure that TARGET libraries (which we know are built with
++# gcc) are built with "-O2 -g", so include those options when setting
++# CFLAGS_FOR_TARGET and CXXFLAGS_FOR_TARGET.
++if test "x$CFLAGS_FOR_TARGET" = x; then
++  CFLAGS_FOR_TARGET=$CFLAGS
++  case " $CFLAGS " in
++    *" -O2 "*) ;;
++    *) CFLAGS_FOR_TARGET="-O2 $CFLAGS" ;;
++  esac
++  case " $CFLAGS " in
++    *" -g "* | *" -g3 "*) ;;
++    *) CFLAGS_FOR_TARGET="-g $CFLAGS" ;;
++  esac
++fi
++
++
++if test "x$CXXFLAGS_FOR_TARGET" = x; then
++  CXXFLAGS_FOR_TARGET=$CXXFLAGS
++  case " $CXXFLAGS " in
++    *" -O2 "*) ;;
++    *) CXXFLAGS_FOR_TARGET="-O2 $CXXFLAGS" ;;
++  esac
++  case " $CXXFLAGS " in
++    *" -g "* | *" -g3 "*) ;;
++    *) CXXFLAGS_FOR_TARGET="-g $CXXFLAGS" ;;
++  esac
++fi
++
++
+ # Handle --with-headers=XXX.  If the value is not "yes", the contents of
+ # the named directory are copied to $(tooldir)/sys-include.
+ if test x"${with_headers}" != x && test x"${with_headers}" != xno ; then
+-- 
+1.7.10.4
+
diff --git a/recipes-devtools/gcc/gcc-4.9/0018.gcc.experimental_move.patch b/recipes-devtools/gcc/gcc-4.9/0018.gcc.experimental_move.patch
new file mode 100644
index 0000000..3cb2aa6
--- /dev/null
+++ b/recipes-devtools/gcc/gcc-4.9/0018.gcc.experimental_move.patch
@@ -0,0 +1,32 @@
+diff -ruN gcc-4.4.0/gcc/config/rs6000/rs6000.c gcc-4.4.0-e500mc64/gcc/config/rs6000/rs6000.c
+--- gcc-4.4.0/gcc/config/rs6000/rs6000.c	2009-03-17 15:18:21.000000000 -0500
++++ gcc-4.4.0-e500mc64/gcc/config/rs6000/rs6000.c	2009-12-04 10:36:44.000000000 -0600
+@@ -11032,6 +11059,14 @@
+ 	  mode = SImode;
+ 	  gen_func.mov = gen_movsi;
+ 	}
++      else if (TARGET_COPY_UNALIGNED && bytes == 3 && offset > 0)
++	{
++	  /* We generate a single unaligned SI move instead of 2 (HI, QI) */
++	  move_bytes = 3;
++	  mode = SImode;
++	  gen_func.mov = gen_movsi;
++	  offset--;
++	}
+       else if (bytes >= 2 && (align >= 16 || !STRICT_ALIGNMENT))
+ 	{			/* move 2 bytes */
+ 	  move_bytes = 2;
+diff -ruN gcc-4.4.0/gcc/config/rs6000/rs6000.opt gcc-4.4.0-e500mc64/gcc/config/rs6000/rs6000.opt
+--- gcc-4.4.0/gcc/config/rs6000/rs6000.opt	2009-02-20 09:20:38.000000000 -0600
++++ gcc-4.4.0-e500mc64/gcc/config/rs6000/rs6000.opt	2009-09-30 13:51:17.000000000 -0500
+@@ -201,6 +201,10 @@
+ Target RejectNegative Joined
+ -misel=yes/no	Deprecated option.  Use -misel/-mno-isel instead
+ 
++mcopy-unaligned
++Target Report Var(TARGET_COPY_UNALIGNED)
++Generate unaligned word load and stores to move 3 bytes
++
+ mspe
+ Target
+ Generate SPE SIMD instructions on E500
diff --git a/recipes-devtools/gcc/gcc-4.9/0019-64-bit-multilib-hack.patch b/recipes-devtools/gcc/gcc-4.9/0019-64-bit-multilib-hack.patch
new file mode 100644
index 0000000..058be0c
--- /dev/null
+++ b/recipes-devtools/gcc/gcc-4.9/0019-64-bit-multilib-hack.patch
@@ -0,0 +1,82 @@
+From 18fde5740b09324dfb9cf41e9849672573ff5fa0 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem at gmail.com>
+Date: Fri, 29 Mar 2013 09:10:06 +0400
+Subject: [PATCH 19/35] 64-bit multilib hack.
+
+GCC has internal multilib handling code but it assumes a very specific rigid directory
+layout. The build system implementation of multilib layout is very generic and allows
+complete customisation of the library directories.
+
+This patch is a partial solution to allow any custom directories to be passed into gcc
+and handled correctly. It forces gcc to use the base_libdir (which is the current
+directory, "."). We need to do this for each multilib that is configured as we don't
+know which compiler options may be being passed into the compiler. Since we have a compiler
+per mulitlib at this point that isn't an issue.
+
+The one problem is the target compiler is only going to work for the default multlilib at
+this point. Ideally we'd figure out which multilibs were being enabled with which paths
+and be able to patch these entries with a complete set of correct paths but this we
+don't have such code at this point. This is something the target gcc recipe should do
+and override these platform defaults in its build config.
+
+RP 15/8/11
+
+Signed-off-by: Khem Raj <raj.khem at gmail.com>
+Signed-off-by: Elvis Dowson <elvis.dowson at gmail.com>
+
+Upstream-Status: Pending
+---
+ gcc/config/i386/t-linux64   |    6 ++----
+ gcc/config/mips/t-linux64   |   10 +++-------
+ gcc/config/rs6000/t-linux64 |    5 ++---
+ 3 files changed, 7 insertions(+), 14 deletions(-)
+
+Index: gcc-4.9-20140316/gcc/config/i386/t-linux64
+===================================================================
+--- gcc-4.9-20140316.orig/gcc/config/i386/t-linux64
++++ gcc-4.9-20140316/gcc/config/i386/t-linux64
+@@ -32,7 +32,5 @@
+ #
+ comma=,
+ MULTILIB_OPTIONS    = $(subst $(comma),/,$(TM_MULTILIB_CONFIG))
+-MULTILIB_DIRNAMES   = $(patsubst m%, %, $(subst /, ,$(MULTILIB_OPTIONS)))
+-MULTILIB_OSDIRNAMES = m64=../lib64$(call if_multiarch,:x86_64-linux-gnu)
+-MULTILIB_OSDIRNAMES+= m32=$(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib)$(call if_multiarch,:i386-linux-gnu)
+-MULTILIB_OSDIRNAMES+= mx32=../libx32$(call if_multiarch,:x86_64-linux-gnux32)
++MULTILIB_DIRNAMES = . .
++MULTILIB_OSDIRNAMES = ../$(shell basename $(base_libdir)) ../$(shell basename $(base_libdir))
+Index: gcc-4.9-20140316/gcc/config/mips/t-linux64
+===================================================================
+--- gcc-4.9-20140316.orig/gcc/config/mips/t-linux64
++++ gcc-4.9-20140316/gcc/config/mips/t-linux64
+@@ -17,10 +17,6 @@
+ # <http://www.gnu.org/licenses/>.
+ 
+ MULTILIB_OPTIONS = mabi=n32/mabi=32/mabi=64
+-MULTILIB_DIRNAMES = n32 32 64
+-MIPS_EL = $(if $(filter %el, $(firstword $(subst -, ,$(target)))),el)
+-MIPS_SOFT = $(if $(strip $(filter MASK_SOFT_FLOAT_ABI, $(target_cpu_default)) $(filter soft, $(with_float))),soft)
+-MULTILIB_OSDIRNAMES = \
+-	../lib32$(call if_multiarch,:mips64$(MIPS_EL)-linux-gnuabin32$(MIPS_SOFT)) \
+-	../lib$(call if_multiarch,:mips$(MIPS_EL)-linux-gnu$(MIPS_SOFT)) \
+-	../lib64$(call if_multiarch,:mips64$(MIPS_EL)-linux-gnuabi64$(MIPS_SOFT))
++MULTILIB_DIRNAMES = . . .
++MULTILIB_OSDIRNAMES = ../$(shell basename $(base_libdir)) ../$(shell basename $(base_libdir)) ../$(shell basename $(base_libdir))
++
+Index: gcc-4.9-20140316/gcc/config/rs6000/t-linux64
+===================================================================
+--- gcc-4.9-20140316.orig/gcc/config/rs6000/t-linux64
++++ gcc-4.9-20140316/gcc/config/rs6000/t-linux64
+@@ -26,10 +26,9 @@
+ # MULTILIB_OSDIRNAMES according to what is found on the target.
+ 
+ MULTILIB_OPTIONS    := m64/m32
+-MULTILIB_DIRNAMES   := 64 32
++MULTILIB_DIRNAMES   := . .
+ MULTILIB_EXTRA_OPTS := 
+-MULTILIB_OSDIRNAMES := m64=../lib64$(call if_multiarch,:powerpc64-linux-gnu)
+-MULTILIB_OSDIRNAMES += m32=$(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib)$(call if_multiarch,:powerpc-linux-gnu)
++MULTILIB_OSDIRNAMES := ../$(shell basename $(base_libdir)) ../$(shell basename $(base_libdir))
+ 
+ rs6000-linux.o: $(srcdir)/config/rs6000/rs6000-linux.c
+ 	$(COMPILE) $<
diff --git a/recipes-devtools/gcc/gcc-4.9/0019.gcc.e5500_mfocr.patch b/recipes-devtools/gcc/gcc-4.9/0019.gcc.e5500_mfocr.patch
new file mode 100644
index 0000000..63ee3cf
--- /dev/null
+++ b/recipes-devtools/gcc/gcc-4.9/0019.gcc.e5500_mfocr.patch
@@ -0,0 +1,181 @@
+# Problem: Although gcc is prepared to avoid "mfocr" instructions
+  (which takes 5 cycles in our parts and 2 cycles on IBM parts). This
+  instruction is used on the mentioned program. What is suspicious
+  about it, is that the code compiled for 32 bits does not use the
+  instruction. So, it could be a omission in the previous
+  implementation, or a bug, or a new opportunity.
+# Reported by: Performance team (PARC)
+# Owned by: Ping Hu
+# Action:
+    * 'mfocr' flag problem: that 'mfocr' flag was uncorrectly set for E5500,
+      which caused the 'mfocr' instructions generated even on E5500.
+    * avoid generating 'mfcr' and 'mfocr' instructions: due to the fact
+      that both instructions are expensive on Freescale processors.
+    * A target specific flag, -mslow-mfocr, can be used to avoid generating
+      'mfcr' and 'mfocr' instructions in 64-bit mode, thus restoring legacy
+      operations if desired.
+
+diff -ruN gcc-4.6.2-clean/gcc/config/rs6000/rs6000.c gcc-4.6.2/gcc/config/rs6000/rs6000.c
+--- gcc-4.6.2-clean/gcc/config/rs6000/rs6000.c	2011-11-22 11:11:47.479144000 -0600
++++ gcc-4.6.2/gcc/config/rs6000/rs6000.c	2011-11-29 16:23:45.074279998 -0600
+@@ -1885,6 +1885,7 @@
+    POWERPC_BASE_MASK | MASK_PPC_GFXOPT | MASK_POWERPC64}
+ };
+ 
++
+ /* Look up a processor name for -mcpu=xxx and -mtune=xxx.  Return -1 if the
+    name is invalid.  */
+ 
+@@ -2902,6 +2903,10 @@
+       || rs6000_cpu == PROCESSOR_PPCE6500)
+     target_flags &= ~MASK_PPC_GPOPT;
+ 
++  if (rs6000_cpu == PROCESSOR_PPCE5500)
++      target_flags &= ~MASK_MFCRF;
++
++
+   /* store_one_arg depends on expand_block_move to handle at least the
+      size of reg_parm_stack_space.  */
+   if (rs6000_block_move_inline_limit < (TARGET_POWERPC64 ? 64 : 32))
+diff -ruN gcc-4.6.2-clean/gcc/config/rs6000/rs6000.md gcc-4.6.2/gcc/config/rs6000/rs6000.md
+--- gcc-4.6.2-clean/gcc/config/rs6000/rs6000.md	2011-11-22 11:11:47.036144001 -0600
++++ gcc-4.6.2/gcc/config/rs6000/rs6000.md	2011-11-29 16:24:04.705280001 -0600
+@@ -215,6 +215,8 @@
+ ; (one with a '.') will compare; and the size used for arithmetic carries.
+ (define_mode_iterator P [(SI "TARGET_32BIT") (DI "TARGET_64BIT")])
+ 
++(define_mode_iterator P2 [(SI "TARGET_32BIT || TARGET_SLOW_MFOCR") (DI "TARGET_64BIT")])
++
+ ; Any hardware-supported floating-point mode
+ (define_mode_iterator FP [
+   (SF "TARGET_HARD_FLOAT 
+@@ -2208,9 +2210,9 @@
+ 
+ (define_insn ""
+   [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
+-	(compare:CC (neg:P (match_operand:P 1 "gpc_reg_operand" "r,r"))
++	(compare:CC (neg:P2 (match_operand:P2 1 "gpc_reg_operand" "r,r"))
+ 		    (const_int 0)))
+-   (clobber (match_scratch:P 2 "=r,r"))]
++   (clobber (match_scratch:P2 2 "=r,r"))]
+   ""
+   "@
+    neg. %2,%1
+@@ -2220,12 +2222,12 @@
+ 
+ (define_split
+   [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
+-	(compare:CC (neg:P (match_operand:P 1 "gpc_reg_operand" ""))
++	(compare:CC (neg:P2 (match_operand:P2 1 "gpc_reg_operand" ""))
+ 		    (const_int 0)))
+-   (clobber (match_scratch:P 2 ""))]
++   (clobber (match_scratch:P2 2 ""))]
+   "reload_completed"
+   [(set (match_dup 2)
+-	(neg:P (match_dup 1)))
++	(neg:P2 (match_dup 1)))
+    (set (match_dup 0)
+ 	(compare:CC (match_dup 2)
+ 		    (const_int 0)))]
+@@ -2233,10 +2235,10 @@
+ 
+ (define_insn ""
+   [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
+-	(compare:CC (neg:P (match_operand:P 1 "gpc_reg_operand" "r,r"))
++	(compare:CC (neg:P2 (match_operand:P2 1 "gpc_reg_operand" "r,r"))
+ 		    (const_int 0)))
+-   (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
+-	(neg:P (match_dup 1)))]
++   (set (match_operand:P2 0 "gpc_reg_operand" "=r,r")
++	(neg:P2 (match_dup 1)))]
+   ""
+   "@
+    neg. %0,%1
+@@ -2246,13 +2248,13 @@
+ 
+ (define_split
+   [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
+-	(compare:CC (neg:P (match_operand:P 1 "gpc_reg_operand" ""))
++	(compare:CC (neg:P2 (match_operand:P2 1 "gpc_reg_operand" ""))
+ 		    (const_int 0)))
+-   (set (match_operand:P 0 "gpc_reg_operand" "")
+-	(neg:P (match_dup 1)))]
++   (set (match_operand:P2 0 "gpc_reg_operand" "")
++	(neg:P2 (match_dup 1)))]
+   "reload_completed"
+   [(set (match_dup 0)
+-	(neg:P (match_dup 1)))
++	(neg:P2 (match_dup 1)))
+    (set (match_dup 2)
+ 	(compare:CC (match_dup 0)
+ 		    (const_int 0)))]
+@@ -15286,31 +15288,31 @@
+   [(set_attr "length" "12")])
+ 
+ (define_insn_and_split "*gtu<mode>"
+-  [(set (match_operand:P 0 "gpc_reg_operand" "=r")
+-	(gtu:P (match_operand:P 1 "gpc_reg_operand" "r")
+-	       (match_operand:P 2 "reg_or_short_operand" "rI")))]
++  [(set (match_operand:P2 0 "gpc_reg_operand" "=r")
++	(gtu:P2 (match_operand:P2 1 "gpc_reg_operand" "r")
++	        (match_operand:P2 2 "reg_or_short_operand" "rI")))]
+   ""
+   "#"
+   ""
+-  [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
+-   (set (match_dup 0) (neg:P (match_dup 0)))]
++  [(set (match_dup 0) (neg:P2 (gtu:P2 (match_dup 1) (match_dup 2))))
++   (set (match_dup 0) (neg:P2 (match_dup 0)))]
+   "")
+ 
+ (define_insn_and_split "*gtu<mode>_compare"
+   [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
+ 	(compare:CC
+-	 (gtu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
+-		 (match_operand:P 2 "reg_or_short_operand" "rI,rI"))
++	 (gtu:P2 (match_operand:P2 1 "gpc_reg_operand" "r,r")
++		 (match_operand:P2 2 "reg_or_short_operand" "rI,rI"))
+ 	 (const_int 0)))
+-   (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
+-	(gtu:P (match_dup 1) (match_dup 2)))]
++   (set (match_operand:P2 0 "gpc_reg_operand" "=r,r")
++	(gtu:P2 (match_dup 1) (match_dup 2)))]
+   ""
+   "#"
+   ""
+-  [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
++  [(set (match_dup 0) (neg:P2 (gtu:P2 (match_dup 1) (match_dup 2))))
+    (parallel [(set (match_dup 3)
+-		   (compare:CC (neg:P (match_dup 0)) (const_int 0)))
+-	      (set (match_dup 0) (neg:P (match_dup 0)))])]
++		   (compare:CC (neg:P2 (match_dup 0)) (const_int 0)))
++	      (set (match_dup 0) (neg:P2 (match_dup 0)))])]
+   "")
+ 
+ (define_insn_and_split "*plus_gtu<mode>"
+@@ -15345,9 +15347,9 @@
+   "")
+ 
+ (define_insn "*neg_gtu<mode>"
+-  [(set (match_operand:P 0 "gpc_reg_operand" "=r")
+-	(neg:P (gtu:P (match_operand:P 1 "gpc_reg_operand" "r")
+-		      (match_operand:P 2 "reg_or_short_operand" "rI"))))]
++  [(set (match_operand:P2 0 "gpc_reg_operand" "=r")
++	(neg:P2 (gtu:P2 (match_operand:P2 1 "gpc_reg_operand" "r")
++		      	(match_operand:P2 2 "reg_or_short_operand" "rI"))))]
+   ""
+   "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0"
+   [(set_attr "type" "two")
+--- gcc-4.6.2-clean/gcc/config/rs6000/rs6000.opt	2011-11-22 11:11:47.480143999 -0600
++++ gcc-4.6.2/gcc/config/rs6000/rs6000.opt	2011-11-29 16:24:16.322280634 -0600
+@@ -381,6 +381,10 @@
+ Target
+ Generate SPE SIMD instructions on E500
+ 
++mslow-mfocr
++Target Report Var(TARGET_SLOW_MFOCR)
++Generate slow mfocr instructions
++
+ mpaired
+ Target Var(rs6000_paired_float) Save
+ Generate PPC750CL paired-single instructions
diff --git a/recipes-devtools/gcc/gcc-4.9/0020-optional-libstdc.patch b/recipes-devtools/gcc/gcc-4.9/0020-optional-libstdc.patch
new file mode 100644
index 0000000..5b46614
--- /dev/null
+++ b/recipes-devtools/gcc/gcc-4.9/0020-optional-libstdc.patch
@@ -0,0 +1,98 @@
+From 307c8ff3ef666b7bd5ac733863f2fbb27a9d521e Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem at gmail.com>
+Date: Fri, 29 Mar 2013 09:12:56 +0400
+Subject: [PATCH 20/35] optional libstdc
+
+gcc-runtime builds libstdc++ separately from gcc-cross-*. Its configure tests using g++
+will not run correctly since by default the linker will try to link against libstdc++
+which shouldn't exist yet. We need an option to disable -lstdc++
+option whilst leaving -lc, -lgcc and other automatic library dependencies added by gcc
+driver. This patch adds such an option which only disables the -lstdc++.
+
+A "standard" gcc build uses xgcc and hence avoids this. We should ask upstream how to
+do this officially, the likely answer is don't build libstdc++ separately.
+
+RP 29/6/10
+
+Signed-off-by: Khem Raj <raj.khem at gmail.com>
+
+Upstream-Status: Inappropriate [embedded specific]
+---
+ gcc/c-family/c.opt  |    4 ++++
+ gcc/cp/g++spec.c    |    1 +
+ gcc/doc/invoke.texi |    9 +++++++--
+ gcc/gcc.c           |    1 +
+ 4 files changed, 13 insertions(+), 2 deletions(-)
+
+Index: gcc-4.9-20140316/gcc/c-family/c.opt
+===================================================================
+--- gcc-4.9-20140316.orig/gcc/c-family/c.opt
++++ gcc-4.9-20140316/gcc/c-family/c.opt
+@@ -1323,6 +1323,10 @@ nostdinc++
+ C++ ObjC++
+ Do not search standard system include directories for C++
+ 
++nostdlib++
++Driver
++Do not link standard C++ runtime library
++
+ o
+ C ObjC C++ ObjC++ Joined Separate
+ ; Documented in common.opt
+Index: gcc-4.9-20140316/gcc/cp/g++spec.c
+===================================================================
+--- gcc-4.9-20140316.orig/gcc/cp/g++spec.c
++++ gcc-4.9-20140316/gcc/cp/g++spec.c
+@@ -138,6 +138,7 @@ lang_specific_driver (struct cl_decoded_
+       switch (decoded_options[i].opt_index)
+ 	{
+ 	case OPT_nostdlib:
++	case OPT_nostdlib__:
+ 	case OPT_nodefaultlibs:
+ 	  library = -1;
+ 	  break;
+Index: gcc-4.9-20140316/gcc/doc/invoke.texi
+===================================================================
+--- gcc-4.9-20140316.orig/gcc/doc/invoke.texi
++++ gcc-4.9-20140316/gcc/doc/invoke.texi
+@@ -193,6 +193,7 @@ in the following sections.
+ -fvisibility-inlines-hidden @gol
+ -fvtable-verify=@var{std|preinit|none} @gol
+ -fvtv-counts -fvtv-debug @gol
++-nostdlib++ @gol
+ -fvisibility-ms-compat @gol
+ -fext-numeric-literals @gol
+ -Wabi  -Wconversion-null  -Wctor-dtor-privacy @gol
+@@ -457,7 +458,7 @@ Objective-C and Objective-C++ Dialects}.
+ -nostartfiles  -nodefaultlibs  -nostdlib -pie -rdynamic @gol
+ -s  -static -static-libgcc -static-libstdc++ @gol
+ -static-libasan -static-libtsan -static-liblsan -static-libubsan @gol
+--shared -shared-libgcc  -symbolic @gol
++-shared -shared-libgcc  -symbolic -nostdlib++ @gol
+ -T @var{script}  -Wl, at var{option}  -Xlinker @var{option} @gol
+ -u @var{symbol}}
+ 
+@@ -10285,6 +10286,11 @@ These entries are usually resolved by en
+ libc.  These entry points should be supplied through some other
+ mechanism when this option is specified.
+ 
++ at item -nostdlib++
++ at opindex nostdlib++
++Do not use the standard system C++ runtime libraries when linking.
++Only the libraries you specify will be passed to the linker.
++
+ @cindex @option{-lgcc}, use with @option{-nostdlib}
+ @cindex @option{-nostdlib} and unresolved references
+ @cindex unresolved references and @option{-nostdlib}
+Index: gcc-4.9-20140316/gcc/gcc.c
+===================================================================
+--- gcc-4.9-20140316.orig/gcc/gcc.c
++++ gcc-4.9-20140316/gcc/gcc.c
+@@ -772,6 +772,7 @@ proper position among the other output f
+     %(mflib) " STACK_SPLIT_SPEC "\
+     %{fprofile-arcs|fprofile-generate*|coverage:-lgcov} " SANITIZER_SPEC " \
+     %{!nostdlib:%{!nodefaultlibs:%(link_ssp) %(link_gcc_c_sequence)}}\
++    %{!nostdlib++:}\
+     %{!nostdlib:%{!nostartfiles:%E}} %{T*} }}}}}}"
+ #endif
+ 
diff --git a/recipes-devtools/gcc/gcc-4.9/0020.gcc.load_on_store_bypass-48x.patch b/recipes-devtools/gcc/gcc-4.9/0020.gcc.load_on_store_bypass-48x.patch
new file mode 100644
index 0000000..dbdc5b7
--- /dev/null
+++ b/recipes-devtools/gcc/gcc-4.9/0020.gcc.load_on_store_bypass-48x.patch
@@ -0,0 +1,137 @@
+# Problem Statement
+ This patch implements option -fbypass-load-on-store
+
+ A load on store collision causes the load to to be replayed if the store has not completed.
+ Under -fbypass-load-on-store, GCC will attempt to avoid a load on store collision by trying
+ to space the load away from the store by scheduling upto 14 instructions in between, to
+ prevent the load from executing too early.
+
+# Owned by:
+  Russo John
+
+# Action:
+
+ * -fbypass-load-on-store is enabled under -fschedule-insns
+ * Cores supported: e5500, e6500, e500mc
+ * Ref: Load-on-Store Collision Avoidance by Software Stall of Load. James Yang. May 18, 2010
+
+ Rev2:
+ * Scheduler is switched off at -O0. Re-work the test case.
+
+diff -Naur gcc-4.8.3/gcc/common.opt gcc-4.8.3-load-on-store-bypass/gcc/common.opt
+--- gcc-4.8.3/gcc/common.opt	2013-03-14 04:13:36.000000000 -0500
++++ gcc-4.8.3-load-on-store-bypass/gcc/common.opt	2014-09-12 05:06:22.086156403 -0500
+@@ -889,6 +889,10 @@
+ Common Report Var(flag_btr_bb_exclusive) Optimization
+ Restrict target load migration not to re-use registers in any basic block
+ 
++fbypass-load-on-store
++Common Report Var(flag_bypass_load_on_store) Optimization
++Bypass load on store collision
++
+ fcall-saved-
+ Common Joined RejectNegative Var(common_deferred_options) Defer
+ -fcall-saved-<register>	Mark <register> as being preserved across functions
+diff -Naur gcc-4.8.3/gcc/config/rs6000/e500mc64.md gcc-4.8.3-load-on-store-bypass/gcc/config/rs6000/e500mc64.md
+--- gcc-4.8.3/gcc/config/rs6000/e500mc64.md	2013-01-10 14:38:27.000000000 -0600
++++ gcc-4.8.3-load-on-store-bypass/gcc/config/rs6000/e500mc64.md	2014-09-12 05:06:22.087156402 -0500
+@@ -189,3 +189,5 @@
+   (and (eq_attr "type" "ddiv")
+        (eq_attr "cpu" "ppce500mc64"))
+   "e500mc64_decode,e500mc64_issue+e500mc64_fpu,e500mc64_fpu*34")
++
++(define_bypass 15 "e500mc64_store" "e500mc64_load" "rs6000_bypass_load_on_store_collision_p")
+diff -Naur gcc-4.8.3/gcc/config/rs6000/e500mc.md gcc-4.8.3-load-on-store-bypass/gcc/config/rs6000/e500mc.md
+--- gcc-4.8.3/gcc/config/rs6000/e500mc.md	2013-01-10 14:38:27.000000000 -0600
++++ gcc-4.8.3-load-on-store-bypass/gcc/config/rs6000/e500mc.md	2014-09-12 05:06:22.088156403 -0500
+@@ -198,3 +198,5 @@
+   (and (eq_attr "type" "ddiv")
+        (eq_attr "cpu" "ppce500mc"))
+   "e500mc_decode,e500mc_issue+e500mc_fpu,e500mc_fpu*65")
++
++(define_bypass 15 "e500mc_store" "e500mc_load" "rs6000_bypass_load_on_store_collision_p")
+diff -Naur gcc-4.8.3/gcc/config/rs6000/e5500.md gcc-4.8.3-load-on-store-bypass/gcc/config/rs6000/e5500.md
+--- gcc-4.8.3/gcc/config/rs6000/e5500.md	2013-01-10 14:38:27.000000000 -0600
++++ gcc-4.8.3-load-on-store-bypass/gcc/config/rs6000/e5500.md	2014-09-12 05:06:22.088156403 -0500
+@@ -174,3 +174,5 @@
+   (and (eq_attr "type" "cr_logical,delayed_cr")
+        (eq_attr "cpu" "ppce5500"))
+   "e5500_decode,e5500_bu")
++
++(define_bypass 15 "e5500_store" "e5500_load" "rs6000_bypass_load_on_store_collision_p")
+diff -Naur gcc-4.8.3/gcc/config/rs6000/e6500.md gcc-4.8.3-load-on-store-bypass/gcc/config/rs6000/e6500.md
+--- gcc-4.8.3/gcc/config/rs6000/e6500.md	2013-01-10 14:38:27.000000000 -0600
++++ gcc-4.8.3-load-on-store-bypass/gcc/config/rs6000/e6500.md	2014-09-12 05:06:22.089156405 -0500
+@@ -211,3 +211,5 @@
+   (and (eq_attr "type" "vecperm")
+        (eq_attr "cpu" "ppce6500"))
+   "e6500_decode,e6500_vecperm")
++
++(define_bypass 15 "e6500_store" "e6500_load" "rs6000_bypass_load_on_store_collision_p")
+diff -Naur gcc-4.8.3/gcc/config/rs6000/rs6000.c gcc-4.8.3-load-on-store-bypass/gcc/config/rs6000/rs6000.c
+--- gcc-4.8.3/gcc/config/rs6000/rs6000.c	2014-05-04 21:18:35.000000000 -0500
++++ gcc-4.8.3-load-on-store-bypass/gcc/config/rs6000/rs6000.c	2014-09-12 05:06:22.092156403 -0500
+@@ -33045,3 +33045,20 @@
+ struct gcc_target targetm = TARGET_INITIALIZER;
+ 
+ #include "gt-rs6000.h"
++
++bool
++rs6000_bypass_load_on_store_collision_p (rtx out_insn, rtx in_insn)
++{
++  /* The out_insn is a store and the in_insn is a load */
++  if (flag_bypass_load_on_store &&
++      (GET_CODE (PATTERN (out_insn)) == SET &&
++       GET_CODE (SET_DEST (PATTERN (out_insn))) == MEM &&
++       GET_CODE (SET_SRC (PATTERN (out_insn))) == REG) &&
++      (GET_CODE (PATTERN (in_insn)) == SET &&
++       GET_CODE (SET_DEST (PATTERN (in_insn))) == REG &&
++       GET_CODE (SET_SRC (PATTERN (in_insn))) == MEM))
++    return rtx_equal_p (SET_DEST (PATTERN (out_insn)),
++                        SET_SRC  (PATTERN (in_insn)));
++  else
++    return false;
++}
+diff -Naur gcc-4.8.3/gcc/config/rs6000/rs6000-protos.h gcc-4.8.3-load-on-store-bypass/gcc/config/rs6000/rs6000-protos.h
+--- gcc-4.8.3/gcc/config/rs6000/rs6000-protos.h	2014-04-04 10:10:24.000000000 -0500
++++ gcc-4.8.3-load-on-store-bypass/gcc/config/rs6000/rs6000-protos.h	2014-09-12 05:06:22.092156403 -0500
+@@ -193,6 +193,8 @@
+ extern bool rs6000_overloaded_builtin_p (enum rs6000_builtins);
+ extern HOST_WIDE_INT rs6000_builtin_mask_calculate (void);
+ 
++extern bool rs6000_bypass_load_on_store_collision_p (rtx out_insn, rtx in_insn);
++
+ /* Declare functions in rs6000-c.c */
+ 
+ extern void rs6000_pragma_longcall (struct cpp_reader *);
+diff -Naur gcc-4.8.3/gcc/testsuite/gcc.target/powerpc/bypass-load-on-store.c gcc-4.8.3-load-on-store-bypass/gcc/testsuite/gcc.target/powerpc/bypass-load-on-store.c
+--- gcc-4.8.3/gcc/testsuite/gcc.target/powerpc/bypass-load-on-store.c	1969-12-31 18:00:00.000000000 -0600
++++ gcc-4.8.3-load-on-store-bypass/gcc/testsuite/gcc.target/powerpc/bypass-load-on-store.c	2014-09-13 08:41:43.089145373 -0500
+@@ -0,0 +1,27 @@
++/* { dg-do compile { target { powerpc*-*-* } } } */
++/* { dg-skip-if "" { powerpc*-*-*spe* } { "*" } { "" } } */
++/* { dg-options "-O3 -fbypass-load-on-store -fdump-rtl-sched1 -fdump-rtl-sched2 -fsched-verbose=2" } */
++
++void nescaf(void)
++{
++
++	extern long a, b, c, d, e, f;
++	volatile long z, w;
++
++	a = 41; b = 79; c = 20; d = 11; e = 12; f = 100;
++
++	/* Now, we have a store followed by a load. The assignments to a-t are
++	 * all independent of the store-load computation below. The question is:
++	 * Under -fschedule-insns -fbypass-load-on-store, are 14 of the above
++	 * instructions moved between the store-load?
++	 */
++	z = 121;
++	w = z;
++}
++
++/* Note: There is going to be exactly one insn that will be assigned cost 15.
++ *       Since its insn-number will likely change, we do not include the insn
++ *       number in the scan - just the part of the dump that'll be invariant.
++ */
++/* { dg-final { scan-rtl-dump "into queue with cost=15" "sched1" { target powerpc*-*-* } } } */
++/* { dg-final { cleanup-rtl-dump "sched*" } } */
diff --git a/recipes-devtools/gcc/gcc-4.9/0021-gcc-disable-MASK_RELAX_PIC_CALLS-bit.patch b/recipes-devtools/gcc/gcc-4.9/0021-gcc-disable-MASK_RELAX_PIC_CALLS-bit.patch
new file mode 100644
index 0000000..eb3c61f
--- /dev/null
+++ b/recipes-devtools/gcc/gcc-4.9/0021-gcc-disable-MASK_RELAX_PIC_CALLS-bit.patch
@@ -0,0 +1,59 @@
+From 004696e054ae9dc71d512cc755ccc4074fc62b2d Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem at gmail.com>
+Date: Fri, 29 Mar 2013 09:14:20 +0400
+Subject: [PATCH 21/35] gcc: disable MASK_RELAX_PIC_CALLS bit
+
+The new feature added after 4.3.3
+"http://www.pubbs.net/200909/gcc/94048-patch-add-support-for-rmipsjalr.html"
+will cause cc1plus eat up all the system memory when build webkit-gtk.
+The function mips_get_pic_call_symbol keeps on recursively calling itself.
+Disable this feature to walk aside the bug.
+
+Signed-off-by: Dongxiao Xu <dongxiao.xu at intel.com>
+Signed-off-by: Khem Raj <raj.khem at gmail.com>
+
+Upstream-Status: Inappropriate [configuration]
+---
+ gcc/configure    |    7 -------
+ gcc/configure.ac |    7 -------
+ 2 files changed, 14 deletions(-)
+
+diff --git a/gcc/configure b/gcc/configure
+index b65d21d..bdab45a 100755
+--- a/gcc/configure
++++ b/gcc/configure
+@@ -25829,13 +25829,6 @@ $as_echo_n "checking assembler and linker for explicit JALR relocation... " >&6;
+         rm -f conftest.*
+       fi
+     fi
+-    if test $gcc_cv_as_ld_jalr_reloc = yes; then
+-      if test x$target_cpu_default = x; then
+-        target_cpu_default=MASK_RELAX_PIC_CALLS
+-      else
+-        target_cpu_default="($target_cpu_default)|MASK_RELAX_PIC_CALLS"
+-      fi
+-    fi
+     { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_as_ld_jalr_reloc" >&5
+ $as_echo "$gcc_cv_as_ld_jalr_reloc" >&6; }
+ 
+diff --git a/gcc/configure.ac b/gcc/configure.ac
+index e226b85..5f5c909 100644
+--- a/gcc/configure.ac
++++ b/gcc/configure.ac
+@@ -4099,13 +4099,6 @@ x:
+         rm -f conftest.*
+       fi
+     fi
+-    if test $gcc_cv_as_ld_jalr_reloc = yes; then
+-      if test x$target_cpu_default = x; then
+-        target_cpu_default=MASK_RELAX_PIC_CALLS
+-      else
+-        target_cpu_default="($target_cpu_default)|MASK_RELAX_PIC_CALLS"
+-      fi
+-    fi
+     AC_MSG_RESULT($gcc_cv_as_ld_jalr_reloc)
+ 
+     AC_CACHE_CHECK([linker for .eh_frame personality relaxation],
+-- 
+1.7.10.4
+
diff --git a/recipes-devtools/gcc/gcc-4.9/0021.gcc.fix_constvector.patch b/recipes-devtools/gcc/gcc-4.9/0021.gcc.fix_constvector.patch
new file mode 100644
index 0000000..297aee6
--- /dev/null
+++ b/recipes-devtools/gcc/gcc-4.9/0021.gcc.fix_constvector.patch
@@ -0,0 +1,43 @@
+For altivec targets, 32 bits, the spec2k-gap bmk does not build.  The
+reason is that at some point the vectorizer creates an CONST_VECTOR
+rtl, where the elements are SYMBOL_REFs.
+
+Gcc ICE on simplify_immed_subreg, where it checks that CONST_VECTORS
+can be only made of CONST_INT, CONST_DOUBLE, or CONST_FIXED.
+
+I really don't understand what that function does, but since the
+vectorizer will bailout later anyway, I think it is safe to treat
+SYMBOL_REFs as CONST_INT. (NOT for FSF submission, as I really don't
+have a clue)
+
+This problem does not exists on gcc-4.5
+
+This problem does not exists on 64 bits, since there is no altivec
+type that can support 64bit elements.
+
+Here is a simplified test case:
+
+typedef void f_t (void);
+extern f_t f;
+extern f_t *A[12];
+extern f_t *B[12];
+void bad_vector ()
+{                                                                                                                                                    
+  int i;                                                                                                                                             
+                                                                                                                                                     
+  for (i = 0; i < 12; i++ ) {                                                                                                                        
+    A[i] = f;                                                                                                                                        
+    B[i] = f;                                                                                                                                        
+  }                                                                                                                                                  
+}                                                                                                                                                    
+
+--- gcc-4.6.2/gcc/simplify-rtx.c~	2011-12-28 12:28:01.700039002 -0600
++++ gcc-4.6.2/gcc/simplify-rtx.c	2011-12-28 12:38:22.287039002 -0600
+@@ -5001,6 +5001,7 @@
+       switch (GET_CODE (el))
+ 	{
+ 	case CONST_INT:
++        case SYMBOL_REF:
+ 	  for (i = 0;
+ 	       i < HOST_BITS_PER_WIDE_INT && i < elem_bitsize;
+ 	       i += value_bit)
diff --git a/recipes-devtools/gcc/gcc-4.9/0022-COLLECT_GCC_OPTIONS.patch b/recipes-devtools/gcc/gcc-4.9/0022-COLLECT_GCC_OPTIONS.patch
new file mode 100644
index 0000000..40c8abf
--- /dev/null
+++ b/recipes-devtools/gcc/gcc-4.9/0022-COLLECT_GCC_OPTIONS.patch
@@ -0,0 +1,38 @@
+From 7f5c9dcc71c8b83a0b5596266cc4bdf0936e8e00 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem at gmail.com>
+Date: Fri, 29 Mar 2013 09:16:28 +0400
+Subject: [PATCH 22/35] COLLECT_GCC_OPTIONS
+
+This patch adds --sysroot into COLLECT_GCC_OPTIONS which is used to
+invoke collect2.
+
+Signed-off-by: Khem Raj <raj.khem at gmail.com>
+
+Upstream-Status: Pending
+---
+ gcc/gcc.c |    9 +++++++++
+ 1 file changed, 9 insertions(+)
+
+diff --git a/gcc/gcc.c b/gcc/gcc.c
+index 477752f..51062aa 100644
+--- a/gcc/gcc.c
++++ b/gcc/gcc.c
+@@ -4098,6 +4098,15 @@ set_collect_gcc_options (void)
+ 		sizeof ("COLLECT_GCC_OPTIONS=") - 1);
+ 
+   first_time = TRUE;
++#ifdef HAVE_LD_SYSROOT
++  if (target_system_root_changed && target_system_root)
++    {
++      obstack_grow (&collect_obstack, "'--sysroot=", sizeof("'--sysroot=")-1);
++      obstack_grow (&collect_obstack, target_system_root,strlen(target_system_root));
++      obstack_grow (&collect_obstack, "'", 1);
++      first_time = FALSE;
++    }
++#endif
+   for (i = 0; (int) i < n_switches; i++)
+     {
+       const char *const *args;
+-- 
+1.7.10.4
+
diff --git a/recipes-devtools/gcc/gcc-4.9/0022.gcc.fix_pr63908_unwind_info.patch b/recipes-devtools/gcc/gcc-4.9/0022.gcc.fix_pr63908_unwind_info.patch
new file mode 100644
index 0000000..4fe4f2e
--- /dev/null
+++ b/recipes-devtools/gcc/gcc-4.9/0022.gcc.fix_pr63908_unwind_info.patch
@@ -0,0 +1,170 @@
+# Problem Statement:
+  [e500v2] "float_bessel"case failed on e500v2 platforms.
+  https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63908
+  https://bugzilla.yoctoproject.org/show_bug.cgi?id=6824
+
+# Owned By:
+  Patch referred from Lei Maohui
+  https://bugzilla.yoctoproject.org/attachment.cgi?id=2314
+
+diff --git a/gcc/defaults.h b/gcc/defaults.h
+index f94ae17..80a798f 100644
+--- a/gcc/defaults.h
++++ b/gcc/defaults.h
+@@ -438,6 +438,11 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+ #define DWARF_FRAME_REGNUM(REG) DBX_REGISTER_NUMBER (REG)
+ #endif
+ 
++/* The mapping from dwarf CFA reg number to internal dwarf reg numbers.  */
++#ifndef DWARF_REG_TO_UNWIND_COLUMN
++#define DWARF_REG_TO_UNWIND_COLUMN(REGNO) (REGNO)
++#endif
++
+ /* Map register numbers held in the call frame info that gcc has
+    collected using DWARF_FRAME_REGNUM to those that should be output in
+    .debug_frame and .eh_frame.  */
+diff --git a/gcc/dwarf2cfi.c b/gcc/dwarf2cfi.c
+index abcdeb3..4e59dfe 100644
+--- a/gcc/dwarf2cfi.c
++++ b/gcc/dwarf2cfi.c
+@@ -252,7 +252,60 @@ init_return_column_size (enum machine_mode mode, rtx mem, unsigned int c)
+ 		  gen_int_mode (size, mode));
+ }
+ 
+-/* Generate code to initialize the register size table.  */
++/* Datastructure used by expand_builtin_init_dwarf_reg_sizes and
++   init_one_dwarf_reg_size to communicate on what has been done by the
++   latter.  */
++
++typedef struct
++{
++  /* Whether the dwarf return column was initialized.  */
++  bool wrote_return_column;
++
++  /* For each hard register REGNO, whether init_one_dwarf_reg_size
++     was given REGNO to process already.  */
++  bool processed_regno [FIRST_PSEUDO_REGISTER];
++
++} init_one_dwarf_reg_state;
++
++/* Helper for expand_builtin_init_dwarf_reg_sizes.  Generate code to
++   initialize the dwarf register size table entry corresponding to register
++   REGNO in REGMODE.  TABLE is the table base address, SLOTMODE is the mode to
++   use for the size entry to initialize, and INIT_STATE is the communication
++   datastructure conveying what we're doing to our caller.  */
++
++static
++void init_one_dwarf_reg_size (int regno, machine_mode regmode,
++                             rtx table, machine_mode slotmode,
++                             init_one_dwarf_reg_state *init_state)
++{
++  const unsigned int dnum = DWARF_FRAME_REGNUM (regno);
++  const unsigned int rnum = DWARF2_FRAME_REG_OUT (dnum, 1);
++  const unsigned int dcol = DWARF_REG_TO_UNWIND_COLUMN (rnum);
++
++  const HOST_WIDE_INT slotoffset = dcol * GET_MODE_SIZE (slotmode);
++  const HOST_WIDE_INT regsize = GET_MODE_SIZE (regmode);
++
++  init_state->processed_regno[regno] = true;
++
++  if (rnum >= DWARF_FRAME_REGISTERS)
++    return;
++
++  if (dnum == DWARF_FRAME_RETURN_COLUMN)
++    {
++      if (regmode == VOIDmode)
++       return;
++      init_state->wrote_return_column = true;
++    }
++
++  if (slotoffset < 0)
++    return;
++
++  emit_move_insn (adjust_address (table, slotmode, slotoffset),
++                 gen_int_mode (regsize, slotmode));
++}
++
++/* Generate code to initialize the dwarf register size table located
++   at the provided ADDRESS.  */
+ 
+ void
+ expand_builtin_init_dwarf_reg_sizes (tree address)
+@@ -261,37 +314,41 @@ expand_builtin_init_dwarf_reg_sizes (tree address)
+   enum machine_mode mode = TYPE_MODE (char_type_node);
+   rtx addr = expand_normal (address);
+   rtx mem = gen_rtx_MEM (BLKmode, addr);
+-  bool wrote_return_column = false;
++
++  init_one_dwarf_reg_state init_state;
++  memset ((char *)&init_state, 0, sizeof (init_state));
+ 
+   for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
+     {
+-      unsigned int dnum = DWARF_FRAME_REGNUM (i);
+-      unsigned int rnum = DWARF2_FRAME_REG_OUT (dnum, 1);
++      machine_mode save_mode;
++      rtx span;
+ 
+-      if (rnum < DWARF_FRAME_REGISTERS)
+-	{
+-	  HOST_WIDE_INT offset = rnum * GET_MODE_SIZE (mode);
+-	  enum machine_mode save_mode = reg_raw_mode[i];
+-	  HOST_WIDE_INT size;
++      /* No point in processing a register multiple times.  This could happen
++         with register spans, e.g. when a reg is first processed as a piece of
++         a span, then as a register on its own later on.  */
+ 
+-	  if (HARD_REGNO_CALL_PART_CLOBBERED (i, save_mode))
+-	    save_mode = choose_hard_reg_mode (i, 1, true);
+-	  if (dnum == DWARF_FRAME_RETURN_COLUMN)
+-	    {
+-	      if (save_mode == VOIDmode)
+-		continue;
+-	      wrote_return_column = true;
+-	    }
+-	  size = GET_MODE_SIZE (save_mode);
+-	  if (offset < 0)
+-	    continue;
++      if (init_state.processed_regno[i])
++        continue;
+ 
+-	  emit_move_insn (adjust_address (mem, mode, offset),
+-			  gen_int_mode (size, mode));
++      save_mode = reg_raw_mode[i];
++      if (HARD_REGNO_CALL_PART_CLOBBERED (i, save_mode))
++        save_mode = choose_hard_reg_mode (i, 1, true);
++
++      span = targetm.dwarf_register_span (gen_rtx_REG (save_mode, i));
++      if (!span)
++        init_one_dwarf_reg_size (i, save_mode, mem, mode, &init_state);
++      else
++        {
++           for (int si = 0; si < XVECLEN (span, 0); si++)
++	    {
++               rtx reg = XVECEXP (span, 0, si);
++               init_one_dwarf_reg_size
++                 (REGNO (reg), GET_MODE (reg), mem, mode, &init_state);
++            }
+ 	}
+     }
+ 
+-  if (!wrote_return_column)
++  if (!init_state.wrote_return_column)
+     init_return_column_size (mode, mem, DWARF_FRAME_RETURN_COLUMN);
+ 
+ #ifdef DWARF_ALT_FRAME_RETURN_COLUMN
+diff --git a/libgcc/unwind-dw2.c b/libgcc/unwind-dw2.c
+index 55fc4bc..37f0ae2 100644
+--- a/libgcc/unwind-dw2.c
++++ b/libgcc/unwind-dw2.c
+@@ -55,10 +55,6 @@
+ #define PRE_GCC3_DWARF_FRAME_REGISTERS DWARF_FRAME_REGISTERS
+ #endif
+ 
+-#ifndef DWARF_REG_TO_UNWIND_COLUMN
+-#define DWARF_REG_TO_UNWIND_COLUMN(REGNO) (REGNO)
+-#endif
+-
+ /* ??? For the public function interfaces, we tend to gcc_assert that the
+    column numbers are in range.  For the dwarf2 unwind info this does happen,
+    although so far in a case that doesn't actually matter.
diff --git a/recipes-devtools/gcc/gcc-4.9/0023-Use-the-defaults.h-in-B-instead-of-S-and-t-oe-in-B.patch b/recipes-devtools/gcc/gcc-4.9/0023-Use-the-defaults.h-in-B-instead-of-S-and-t-oe-in-B.patch
new file mode 100644
index 0000000..fddfe9e
--- /dev/null
+++ b/recipes-devtools/gcc/gcc-4.9/0023-Use-the-defaults.h-in-B-instead-of-S-and-t-oe-in-B.patch
@@ -0,0 +1,96 @@
+From f7d49ca445e60faa1b5256c6b4f96c1ee5c0e353 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem at gmail.com>
+Date: Fri, 29 Mar 2013 09:17:25 +0400
+Subject: [PATCH 23/35] Use the defaults.h in ${B} instead of ${S}, and t-oe
+ in ${B}
+
+Use the defaults.h in ${B} instead of ${S}, and t-oe in ${B}, so that
+the source can be shared between gcc-cross-initial,
+gcc-cross-intermediate, gcc-cross, gcc-runtime, and also the sdk build.
+
+Signed-off-by: Khem Raj <raj.khem at gmail.com>
+
+Upstream-Status: Pending
+
+While compiling gcc-crosssdk-initial-x86_64 on some host, there is
+occasionally failure that test the existance of default.h doesn't
+work, the reason is tm_include_list='** defaults.h' rather than
+tm_include_list='** ./defaults.h'
+
+So we add the test condition for this situation.
+Signed-off-by: Hongxu Jia <hongxu.jia at windriver.com>
+---
+ gcc/Makefile.in  |    2 +-
+ gcc/configure    |    4 ++--
+ gcc/configure.ac |    4 ++--
+ gcc/mkconfig.sh  |    4 ++--
+ 4 files changed, 7 insertions(+), 7 deletions(-)
+
+diff --git a/gcc/Makefile.in b/gcc/Makefile.in
+index d1ab22f..15fe4b6 100644
+--- a/gcc/Makefile.in
++++ b/gcc/Makefile.in
+@@ -483,7 +483,7 @@ TARGET_SYSTEM_ROOT = @TARGET_SYSTEM_ROOT@
+ TARGET_SYSTEM_ROOT_DEFINE = @TARGET_SYSTEM_ROOT_DEFINE@
+ 
+ xmake_file=@xmake_file@
+-tmake_file=@tmake_file@
++tmake_file=@tmake_file@ ./t-oe
+ TM_ENDIAN_CONFIG=@TM_ENDIAN_CONFIG@
+ TM_MULTILIB_CONFIG=@TM_MULTILIB_CONFIG@
+ TM_MULTILIB_EXCEPTIONS_CONFIG=@TM_MULTILIB_EXCEPTIONS_CONFIG@
+diff --git a/gcc/configure b/gcc/configure
+index 5399b2b..60a04bd 100755
+--- a/gcc/configure
++++ b/gcc/configure
+@@ -11631,8 +11631,8 @@ for f in $tm_file; do
+        tm_include_list="${tm_include_list} $f"
+        ;;
+     defaults.h )
+-       tm_file_list="${tm_file_list} \$(srcdir)/$f"
+-       tm_include_list="${tm_include_list} $f"
++       tm_file_list="${tm_file_list} ./$f"
++       tm_include_list="${tm_include_list} ./$f"
+        ;;
+     * )
+        tm_file_list="${tm_file_list} \$(srcdir)/config/$f"
+diff --git a/gcc/configure.ac b/gcc/configure.ac
+index f87c3b6..460e0d9 100644
+--- a/gcc/configure.ac
++++ b/gcc/configure.ac
+@@ -1740,8 +1740,8 @@ for f in $tm_file; do
+        tm_include_list="${tm_include_list} $f"
+        ;;
+     defaults.h )
+-       tm_file_list="${tm_file_list} \$(srcdir)/$f"
+-       tm_include_list="${tm_include_list} $f"
++       tm_file_list="${tm_file_list} ./$f"
++       tm_include_list="${tm_include_list} ./$f"
+        ;;
+     * )
+        tm_file_list="${tm_file_list} \$(srcdir)/config/$f"
+diff --git a/gcc/mkconfig.sh b/gcc/mkconfig.sh
+index c7146ed..b153f45 100644
+--- a/gcc/mkconfig.sh
++++ b/gcc/mkconfig.sh
+@@ -77,7 +77,7 @@ if [ -n "$HEADERS" ]; then
+     if [ $# -ge 1 ]; then
+ 	echo '#ifdef IN_GCC' >> ${output}T
+ 	for file in "$@"; do
+-	    if test x"$file" = x"defaults.h"; then
++	    if test x"$file" = x"./defaults.h" -o x"$file" = x"defaults.h"; then
+ 		postpone_defaults_h="yes"
+ 	    else
+ 		echo "# include \"$file\"" >> ${output}T
+@@ -106,7 +106,7 @@ esac
+ 
+ # If we postponed including defaults.h, add the #include now.
+ if test x"$postpone_defaults_h" = x"yes"; then
+-    echo "# include \"defaults.h\"" >> ${output}T
++    echo "# include \"./defaults.h\"" >> ${output}T
+ fi
+ 
+ # Add multiple inclusion protection guard, part two.
+-- 
+1.9.1
+
diff --git a/recipes-devtools/gcc/gcc-4.9/0023.gcc.fix_pr60158_fixup_table.patch b/recipes-devtools/gcc/gcc-4.9/0023.gcc.fix_pr60158_fixup_table.patch
new file mode 100644
index 0000000..e882f94
--- /dev/null
+++ b/recipes-devtools/gcc/gcc-4.9/0023.gcc.fix_pr60158_fixup_table.patch
@@ -0,0 +1,121 @@
+[gcc]
+2014-04-22  Rohit  <rohitarulraj at freescale.com>
+
+    PR target/60158
+    * varasm.c (output_constant_pool_1): Pass actual alignment value to output_constant_pool_2
+    to emit ".fixup" section.
+
+[gcc/testsuite]
+2014-04-22  Rohit  <rohitarulraj at freescale.com>
+
+    PR target/60158
+    * gcc.target/powerpc/pr60158.c: New test.  Check if ".fixup" section gets emitted for
+    ".data.rel.ro.local" section.
+
+diff -Naur gcc-4.8.2/gcc/testsuite/gcc.target/powerpc/pr60158.c gcc-4.8.2-pr60158/gcc/testsuite/gcc.target/powerpc/pr60158.c
+--- gcc-4.8.2/gcc/testsuite/gcc.target/powerpc/pr60158.c	1969-12-31 18:00:00.000000000 -0600
++++ gcc-4.8.2-pr60158/gcc/testsuite/gcc.target/powerpc/pr60158.c	2014-04-28 13:24:53.659403486 -0500
+@@ -0,0 +1,91 @@
++/* { dg-do compile } */
++/* { dg-skip-if "not an SPE target" { ! powerpc_spe_nocache } { "*" } { "" } } */
++/* { dg-options "-mcpu=8548 -mno-spe -mfloat-gprs=double -Os -fdata-sections -fpic -mrelocatable" } */
++
++#define NULL 0
++int func (int val);
++void *func2 (void *ptr);
++
++static const char *ifs;
++static char map[256];
++
++typedef struct {
++/*
++ * None of these fields are used, but removing any
++ * of them makes the problem go away.
++ */
++  char *data;
++  int length;
++  int maxlen;
++  int quote;
++} o_string;
++
++#define NULL_O_STRING {NULL,0,0,0}
++
++static int parse_stream (void *dest, void *ctx)
++{
++  int ch = func (0), m;
++
++  while (ch != -1) {
++    m = map[ch];
++    if (ch != '\n')
++    func2(dest);
++
++    ctx = func2 (ctx);
++    if (!func (0))
++      return 0;
++    if (m != ch) {
++      func2 ("htns");
++      break;
++    }
++  }
++  return -1;
++}
++
++static void mapset (const char *set, int code)
++{
++  const char *s;
++  for (s=set; *s; s++)  map[(int)*s] = code;
++}
++
++static void update_ifs_map(void)
++{
++  /* char *ifs and char map[256] are both globals. */
++  ifs = func2 ("abc");
++  if (ifs == NULL) ifs="def";
++
++  func2 (map);
++  {
++    char subst[2] = {4, 0};
++    mapset (subst, 3);
++  }
++  mapset (";&|#", 1);
++}
++
++int parse_stream_outer (int flag)
++{
++  int blah;
++  o_string temp=NULL_O_STRING;
++  int rcode;
++
++  do {
++    update_ifs_map ();
++    func2 (&blah); /* a memory clobber works as well */
++    rcode = parse_stream (&temp, NULL);
++    func2 ("aoeu");
++    if (func (0) != 0) {
++      func2 (NULL);
++    }
++  } while (rcode != -1);
++  return 0;
++}
++
++/* { dg-final { if ![file exists pr60158.s] { fail "pr60158.c (compile)"; return; } } } */
++
++/* { dg-final { set c_rel [llength [grep pr60158.s \\.data\\.rel\\.ro\\.local]] } } */
++/* { dg-final { set c_fix [llength [grep pr60158.s \\.fixup]] } } */
++/* { dg-final { if [string match $c_rel $c_fix] \{                     } } */
++/* { dg-final {     pass "pr60158.c (passed)"  } } */
++/* { dg-final { \} else \{                                     } } */
++/* { dg-final {     fail "pr60158.c (.fixup table entries not generated for .data.rel.ro.local section)"       } } */
++/* { dg-final { \}                                              } } */
+diff -Naur gcc-4.8.2/gcc/varasm.c gcc-4.8.2-pr60158/gcc/varasm.c
+--- gcc-4.8.2/gcc/varasm.c	2013-05-09 20:54:06.000000000 -0500
++++ gcc-4.8.2-pr60158/gcc/varasm.c	2014-04-28 12:37:38.606372451 -0500
+@@ -3771,7 +3771,7 @@
+   targetm.asm_out.internal_label (asm_out_file, "LC", desc->labelno);
+ 
+   /* Output the data.  */
+-  output_constant_pool_2 (desc->mode, x, align);
++  output_constant_pool_2 (desc->mode, x, desc->align);
+ 
+   /* Make sure all constants in SECTION_MERGE and not SECTION_STRINGS
+      sections have proper size.  */
diff --git a/recipes-devtools/gcc/gcc-4.9/0024-PR-target-32219.patch b/recipes-devtools/gcc/gcc-4.9/0024-PR-target-32219.patch
new file mode 100644
index 0000000..45acf7f
--- /dev/null
+++ b/recipes-devtools/gcc/gcc-4.9/0024-PR-target-32219.patch
@@ -0,0 +1,62 @@
+From e0d15f4f8bf28c351b9215ca37f1caa24df0e1fd Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem at gmail.com>
+Date: Fri, 29 Mar 2013 09:18:54 +0400
+Subject: [PATCH 24/35] PR target/32219
+
+* varasm.c (default_binds_local_p_1): Weak data is not local.
+
+Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop at gmail.com>
+Signed-off-by: Khem Raj <raj.khem at gmail.com>
+
+Upstream-Status: Backport
+---
+ gcc/testsuite/gcc.dg/visibility-21.c |   14 ++++++++++++++
+ gcc/varasm.c                         |    9 ++++-----
+ 2 files changed, 18 insertions(+), 5 deletions(-)
+ create mode 100644 gcc/testsuite/gcc.dg/visibility-21.c
+
+Index: gcc-4.9-20140316/gcc/varasm.c
+===================================================================
+--- gcc-4.9-20140316.orig/gcc/varasm.c
++++ gcc-4.9-20140316/gcc/varasm.c
+@@ -6771,6 +6771,10 @@ default_binds_local_p_1 (const_tree exp,
+   /* Static variables are always local.  */
+   else if (! TREE_PUBLIC (exp))
+     local_p = true;
++  /* hidden weak can't be overridden by something non-local, all
++     that is possible is that it is not defined at all. */
++  else if (DECL_WEAK (exp))
++    local_p = false;
+   /* A variable is local if the user has said explicitly that it will
+      be.  */
+   else if ((DECL_VISIBILITY_SPECIFIED (exp)
+@@ -6784,11 +6788,6 @@ default_binds_local_p_1 (const_tree exp,
+      local.  */
+   else if (DECL_VISIBILITY (exp) != VISIBILITY_DEFAULT)
+     local_p = true;
+-  /* Default visibility weak data can be overridden by a strong symbol
+-     in another module and so are not local.  */
+-  else if (DECL_WEAK (exp)
+-	   && !resolved_locally)
+-    local_p = false;
+   /* If PIC, then assume that any global name can be overridden by
+      symbols resolved from other modules.  */
+   else if (shlib)
+Index: gcc-4.9-20140316/gcc/testsuite/gcc.dg/visibility-22.c
+===================================================================
+--- /dev/null
++++ gcc-4.9-20140316/gcc/testsuite/gcc.dg/visibility-22.c
+@@ -0,0 +1,13 @@
++/* PR target/32219 */
++/* { dg-do run } */
++/* { dg-require-visibility "" } */
++/* { dg-options "-fPIC" { target fpic } } */
++
++extern void f() __attribute__((weak,visibility("hidden")));
++extern int puts( char const* );
++int main()
++{
++  if (f)
++    f();
++  return 0;
++}
diff --git a/recipes-devtools/gcc/gcc-4.9/0024.gcc.have-pre-modify-disp-support-49x.patch b/recipes-devtools/gcc/gcc-4.9/0024.gcc.have-pre-modify-disp-support-49x.patch
new file mode 100644
index 0000000..6362f62
--- /dev/null
+++ b/recipes-devtools/gcc/gcc-4.9/0024.gcc.have-pre-modify-disp-support-49x.patch
@@ -0,0 +1,1078 @@
+
+ This patch implements -fuse-load-updates
+
+ Prior to this patch, GCC will only combine a load/store and unit-increment into a
+ load/store with update instruction. This patch adds support for the generation of
+ {load, store}-with-update instructions past non-unit increments.
+
+ -fuse-load-updates is ON by default for 64-bit and OFF by default for 32-bit
+
+ Cores supported: e5500, e6500, e500mc
+
+diff -Naur gcc-4.9.1/gcc/common.opt gcc-4.9.1-pre-modify-disp-support/gcc/common.opt
+--- gcc-4.9.1/gcc/common.opt	2014-08-13 01:25:45.156015000 -0500
++++ gcc-4.9.1-pre-modify-disp-support/gcc/common.opt	2014-08-13 01:30:08.579014919 -0500
+@@ -2288,6 +2288,14 @@
+ fuse-linker-plugin
+ Common Undocumented Var(flag_use_linker_plugin)
+ 
++; Initialize flag_use_load_updates to -1
++; That way, it gets set to 1 on -fuse-load-updates and to 0 on -fno-use-load-updates
++; when these options are explicitly used by the user. This helps us default it to ON
++; on 64-bit and OFF in 32-bit
++fuse-load-updates
++Common Report Var(flag_use_load_updates) Init(-1) Optimization
++Support generation of {load, store}-with-update instructions past non-unit increments
++
+ ; Positive if we should track variables, negative if we should run
+ ; the var-tracking pass only to discard debug annotations, zero if
+ ; we're not to run it.  When flag_var_tracking == 2 (AUTODETECT_VALUE) it
+diff -Naur gcc-4.9.1/gcc/config/rs6000/rs6000.c gcc-4.9.1-pre-modify-disp-support/gcc/config/rs6000/rs6000.c
+--- gcc-4.9.1/gcc/config/rs6000/rs6000.c	2014-08-13 01:25:45.210015000 -0500
++++ gcc-4.9.1-pre-modify-disp-support/gcc/config/rs6000/rs6000.c	2014-08-13 01:30:08.587015007 -0500
+@@ -4071,6 +4071,12 @@
+   if (TARGET_LINK_STACK == -1)
+     SET_TARGET_LINK_STACK (rs6000_cpu == PROCESSOR_PPC476 && flag_pic);
+ 
++  /* If the user has not specified -fuse-load-updates nor -fno-use-load-updates
++   * in 64-bit, default to -fuse-load-updates
++   */
++  if (flag_use_load_updates == -1 && TARGET_64BIT)
++    flag_use_load_updates = 1;
++
+   return ret;
+ }
+ 
+diff -Naur gcc-4.9.1/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-10.c gcc-4.9.1-pre-modify-disp-support/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-10.c
+--- gcc-4.9.1/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-10.c	1969-12-31 18:00:00.000000000 -0600
++++ gcc-4.9.1-pre-modify-disp-support/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-10.c	2014-08-13 01:32:01.827015000 -0500
+@@ -0,0 +1,19 @@
++/* { dg-do compile { target { powerpc*-*-* && lp64 } } } */
++/* { dg-options "-O3 -fuse-load-updates" } */
++
++extern void baz(char *s, char *m, char *end);
++
++void foo(char *s, char *m, char *end)
++{
++        while (*s == *m) {
++
++		s += 2;
++		m += 2;
++	}
++
++	baz(s, 0, end);
++}
++
++/* { dg-final { scan-assembler-times "addi" 1 { target powerpc*-*-* } } } */
++/* { dg-final { scan-assembler-times "lbzu" 2 { target powerpc*-*-* } } } */
++/* { dg-final { scan-assembler-times "stdu" 1 { target powerpc*-*-* } } } */
+diff -Naur gcc-4.9.1/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-11.c gcc-4.9.1-pre-modify-disp-support/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-11.c
+--- gcc-4.9.1/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-11.c	1969-12-31 18:00:00.000000000 -0600
++++ gcc-4.9.1-pre-modify-disp-support/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-11.c	2014-08-13 01:32:01.827015000 -0500
+@@ -0,0 +1,16 @@
++/* { dg-do compile { target { powerpc*-*-* && ilp32 } } } */
++/* { dg-options "-O3 -fuse-load-updates" } */
++
++extern void baz(char *s, char *m, char *end);
++
++void foo(char *s, char *m, char *end)
++{
++        while (*s == *m && s < end) {
++
++		s += 2;
++	}
++
++	baz(s, 0, end);
++}
++
++/* { dg-final { scan-assembler-times "lbzu" 1 { target powerpc*-*-* } } } */
+diff -Naur gcc-4.9.1/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-12.c gcc-4.9.1-pre-modify-disp-support/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-12.c
+--- gcc-4.9.1/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-12.c	1969-12-31 18:00:00.000000000 -0600
++++ gcc-4.9.1-pre-modify-disp-support/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-12.c	2014-08-13 01:32:01.827015000 -0500
+@@ -0,0 +1,18 @@
++/* { dg-do compile { target { powerpc*-*-* && lp64 } } } */
++/* { dg-options "-O3 -fuse-load-updates" } */
++
++extern void baz(char *s, char *m, char *end);
++
++void foo(char *s, char *m, char *end)
++{
++        while (*s == *m && s < end) {
++
++		s += 2;
++	}
++
++	baz(s, 0, end);
++}
++
++/* { dg-final { scan-assembler-times "addi" 1 { target powerpc*-*-* } } } */
++/* { dg-final { scan-assembler-times "lbzu" 1 { target powerpc*-*-* } } } */
++/* { dg-final { scan-assembler-times "stdu" 1 { target powerpc*-*-* } } } */
+diff -Naur gcc-4.9.1/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-13.c gcc-4.9.1-pre-modify-disp-support/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-13.c
+--- gcc-4.9.1/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-13.c	1969-12-31 18:00:00.000000000 -0600
++++ gcc-4.9.1-pre-modify-disp-support/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-13.c	2014-08-13 01:32:01.827015000 -0500
+@@ -0,0 +1,17 @@
++/* { dg-do compile { target { powerpc*-*-* && ilp32 } } } */
++/* { dg-options "-O3 -fuse-load-updates" } */
++
++extern void baz(char *s, char *m, char *end);
++
++void foo(char *s, char *m, char *end)
++{
++        while (*s == *m && s < end) {
++
++		s += 2;
++		m += 2;
++	}
++
++	baz(s, m, end);
++}
++
++/* { dg-final { scan-assembler-times "lbzu" 2 { target powerpc*-*-* } } } */
+diff -Naur gcc-4.9.1/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-14.c gcc-4.9.1-pre-modify-disp-support/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-14.c
+--- gcc-4.9.1/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-14.c	1969-12-31 18:00:00.000000000 -0600
++++ gcc-4.9.1-pre-modify-disp-support/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-14.c	2014-08-13 01:32:01.827015000 -0500
+@@ -0,0 +1,19 @@
++/* { dg-do compile { target { powerpc*-*-* && lp64 } } } */
++/* { dg-options "-O3 -fuse-load-updates" } */
++
++extern void baz(char *s, char *m, char *end);
++
++void foo(char *s, char *m, char *end)
++{
++        while (*s == *m && s < end) {
++
++		s += 2;
++		m += 2;
++	}
++
++	baz(s, m, end);
++}
++
++/* { dg-final { scan-assembler-times "addi" 1 { target powerpc*-*-* } } } */
++/* { dg-final { scan-assembler-times "lbzu" 2 { target powerpc*-*-* } } } */
++/* { dg-final { scan-assembler-times "stdu" 1 { target powerpc*-*-* } } } */
+diff -Naur gcc-4.9.1/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-15.c gcc-4.9.1-pre-modify-disp-support/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-15.c
+--- gcc-4.9.1/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-15.c	1969-12-31 18:00:00.000000000 -0600
++++ gcc-4.9.1-pre-modify-disp-support/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-15.c	2014-08-13 01:32:01.828015000 -0500
+@@ -0,0 +1,19 @@
++/* { dg-do compile { target { powerpc*-*-* && ilp32 } } } */
++/* { dg-options "-O3 -fuse-load-updates" } */
++
++extern void baz(char *p, char *s);
++
++void foo(char *p, char *q, char *r, char *s)
++{
++        while (*p == *q && *p == *r && p < s) {
++
++		p += 2;
++		q += 2;
++		r += 2;
++	}
++
++	baz(p, s);
++}
++
++/* { dg-final { scan-assembler-times "addi" 0 { target powerpc*-*-* } } } */
++/* { dg-final { scan-assembler-times "lbzu" 3 { target powerpc*-*-* } } } */
+diff -Naur gcc-4.9.1/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-16.c gcc-4.9.1-pre-modify-disp-support/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-16.c
+--- gcc-4.9.1/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-16.c	1969-12-31 18:00:00.000000000 -0600
++++ gcc-4.9.1-pre-modify-disp-support/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-16.c	2014-08-13 01:32:01.828015000 -0500
+@@ -0,0 +1,20 @@
++/* { dg-do compile { target { powerpc*-*-* && lp64 } } } */
++/* { dg-options "-O3 -fuse-load-updates" } */
++
++extern void baz(char *p, char *s);
++
++void foo(char *p, char *q, char *r, char *s)
++{
++        while (*p == *q && *p == *r && p < s) {
++
++		p += 2;
++		q += 2;
++		r += 2;
++	}
++
++	baz(p, s);
++}
++
++/* { dg-final { scan-assembler-times "addi" 1 { target powerpc*-*-* } } } */
++/* { dg-final { scan-assembler-times "lbzu" 3 { target powerpc*-*-* } } } */
++/* { dg-final { scan-assembler-times "stdu" 1 { target powerpc*-*-* } } } */
+diff -Naur gcc-4.9.1/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-17.c gcc-4.9.1-pre-modify-disp-support/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-17.c
+--- gcc-4.9.1/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-17.c	1969-12-31 18:00:00.000000000 -0600
++++ gcc-4.9.1-pre-modify-disp-support/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-17.c	2014-08-13 01:32:01.828015000 -0500
+@@ -0,0 +1,19 @@
++/* { dg-do compile { target { powerpc*-*-* && ilp32 } } } */
++/* { dg-options "-O3 -fuse-load-updates" } */
++
++extern void baz(char *p, char *s);
++
++void foo(char *p, char *q, char *r, char *s)
++{
++        while (*p == *q && *p == *r && p < s) {
++
++		p += 2;
++		q += 3;
++		r += 7;
++	}
++
++	baz(p, s);
++}
++
++/* { dg-final { scan-assembler-times "addi" 0 { target powerpc*-*-* } } } */
++/* { dg-final { scan-assembler-times "lbzu" 3 { target powerpc*-*-* } } } */
+diff -Naur gcc-4.9.1/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-18.c gcc-4.9.1-pre-modify-disp-support/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-18.c
+--- gcc-4.9.1/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-18.c	1969-12-31 18:00:00.000000000 -0600
++++ gcc-4.9.1-pre-modify-disp-support/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-18.c	2014-08-13 01:32:01.828015000 -0500
+@@ -0,0 +1,20 @@
++/* { dg-do compile { target { powerpc*-*-* && lp64 } } } */
++/* { dg-options "-O3 -fuse-load-updates" } */
++
++extern void baz(char *p, char *s);
++
++void foo(char *p, char *q, char *r, char *s)
++{
++        while (*p == *q && *p == *r && p < s) {
++
++		p += 2;
++		q += 3;
++		r += 7;
++	}
++
++	baz(p, s);
++}
++
++/* { dg-final { scan-assembler-times "addi" 1 { target powerpc*-*-* } } } */
++/* { dg-final { scan-assembler-times "lbzu" 3 { target powerpc*-*-* } } } */
++/* { dg-final { scan-assembler-times "stdu" 1 { target powerpc*-*-* } } } */
+diff -Naur gcc-4.9.1/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-19.c gcc-4.9.1-pre-modify-disp-support/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-19.c
+--- gcc-4.9.1/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-19.c	1969-12-31 18:00:00.000000000 -0600
++++ gcc-4.9.1-pre-modify-disp-support/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-19.c	2014-08-13 01:32:01.828015000 -0500
+@@ -0,0 +1,21 @@
++/* { dg-do compile { target { powerpc*-*-* && ilp32 } } } */
++/* { dg-options "-O3 -fuse-load-updates" } */
++
++extern void baz(char *p, char *s);
++
++void foo(char *p, char *q, char *r, char *s)
++{
++        while (*p && *q && *r && *s &&
++               *p == *q && *p == *r && *p == *s &&
++               *q == *r && *q == *s &&
++               *r == *s) {
++
++		p += 1;
++		q += 1;
++		r += 1;
++		s += 1;
++	}
++}
++
++/* { dg-final { scan-assembler-times "addi" 0 { target powerpc*-*-* } } } */
++/* { dg-final { scan-assembler-times "lbzu" 4 { target powerpc*-*-* } } } */
+diff -Naur gcc-4.9.1/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-1.c gcc-4.9.1-pre-modify-disp-support/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-1.c
+--- gcc-4.9.1/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-1.c	1969-12-31 18:00:00.000000000 -0600
++++ gcc-4.9.1-pre-modify-disp-support/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-1.c	2014-08-13 01:32:01.828015000 -0500
+@@ -0,0 +1,17 @@
++/* { dg-do compile { target { powerpc*-*-* && ilp32 } } } */
++/* { dg-options "-O3 -fuse-load-updates" } */
++
++extern void baz(char *s, char *m, char *end);
++
++void foo(char *s, char *m, char *end)
++{
++        while (*s == *m && s < end) {
++
++		s += 2;
++		m += 2;
++	}
++
++	baz(s, 0, end);
++}
++
++/* { dg-final { scan-assembler-times "lbzu" 2 { target powerpc*-*-* } } } */
+diff -Naur gcc-4.9.1/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-20.c gcc-4.9.1-pre-modify-disp-support/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-20.c
+--- gcc-4.9.1/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-20.c	1969-12-31 18:00:00.000000000 -0600
++++ gcc-4.9.1-pre-modify-disp-support/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-20.c	2014-08-13 01:32:01.828015000 -0500
+@@ -0,0 +1,21 @@
++/* { dg-do compile { target { powerpc*-*-* && lp64 } } } */
++/* { dg-options "-O3 -fuse-load-updates" } */
++
++extern void baz(char *p, char *s);
++
++void foo(char *p, char *q, char *r, char *s)
++{
++        while (*p && *q && *r && *s &&
++               *p == *q && *p == *r && *p == *s &&
++               *q == *r && *q == *s &&
++               *r == *s) {
++
++		p += 1;
++		q += 1;
++		r += 1;
++		s += 1;
++	}
++}
++
++/* { dg-final { scan-assembler-times "addi" 0 { target powerpc*-*-* } } } */
++/* { dg-final { scan-assembler-times "lbzu" 4 { target powerpc*-*-* } } } */
+diff -Naur gcc-4.9.1/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-21.c gcc-4.9.1-pre-modify-disp-support/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-21.c
+--- gcc-4.9.1/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-21.c	1969-12-31 18:00:00.000000000 -0600
++++ gcc-4.9.1-pre-modify-disp-support/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-21.c	2014-08-13 01:32:01.828015000 -0500
+@@ -0,0 +1,17 @@
++/* { dg-do compile { target { powerpc*-*-* && ilp32 } } } */
++/* { dg-options "-O3 -fuse-load-updates" } */
++
++extern void baz(int *s, int *m, int *end);
++
++void foo(int *s, int *m, int *end)
++{
++        while (*s == *m && s < end) {
++
++		s += 1;
++		m += 1;
++	}
++
++	baz(s, 0, end);
++}
++
++/* { dg-final { scan-assembler-times "lwzu" 2 { target powerpc*-*-* } } } */
+diff -Naur gcc-4.9.1/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-22.c gcc-4.9.1-pre-modify-disp-support/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-22.c
+--- gcc-4.9.1/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-22.c	1969-12-31 18:00:00.000000000 -0600
++++ gcc-4.9.1-pre-modify-disp-support/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-22.c	2014-08-13 01:32:01.828015000 -0500
+@@ -0,0 +1,19 @@
++/* { dg-do compile { target { powerpc*-*-* && lp64 } } } */
++/* { dg-options "-O3 -fuse-load-updates" } */
++
++extern void baz(int *s, int *m, int *end);
++
++void foo(int *s, int *m, int *end)
++{
++        while (*s == *m && s < end) {
++
++		s += 1;
++		m += 1;
++	}
++
++	baz(s, 0, end);
++}
++
++/* { dg-final { scan-assembler-times "addi" 1 { target powerpc*-*-* } } } */
++/* { dg-final { scan-assembler-times "lwzu" 2 { target powerpc*-*-* } } } */
++/* { dg-final { scan-assembler-times "stdu" 1 { target powerpc*-*-* } } } */
+diff -Naur gcc-4.9.1/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-23.c gcc-4.9.1-pre-modify-disp-support/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-23.c
+--- gcc-4.9.1/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-23.c	1969-12-31 18:00:00.000000000 -0600
++++ gcc-4.9.1-pre-modify-disp-support/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-23.c	2014-08-13 01:32:01.828015000 -0500
+@@ -0,0 +1,17 @@
++/* { dg-do compile { target { powerpc*-*-* && ilp32 } } } */
++/* { dg-options "-O3 -fuse-load-updates" } */
++
++extern void baz(int *s, int *m, int *end);
++
++void foo(int *s, int *m, int *end)
++{
++        while (*s == *m && s < end) {
++
++		s += 3;
++		m += 3;
++	}
++
++	baz(s, 0, end);
++}
++
++/* { dg-final { scan-assembler-times "lwzu" 2 { target powerpc*-*-* } } } */
+diff -Naur gcc-4.9.1/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-24.c gcc-4.9.1-pre-modify-disp-support/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-24.c
+--- gcc-4.9.1/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-24.c	1969-12-31 18:00:00.000000000 -0600
++++ gcc-4.9.1-pre-modify-disp-support/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-24.c	2014-08-13 01:32:01.828015000 -0500
+@@ -0,0 +1,19 @@
++/* { dg-do compile { target { powerpc*-*-* && lp64 } } } */
++/* { dg-options "-O3 -fuse-load-updates" } */
++
++extern void baz(int *s, int *m, int *end);
++
++void foo(int *s, int *m, int *end)
++{
++        while (*s == *m && s < end) {
++
++		s += 3;
++		m += 3;
++	}
++
++	baz(s, 0, end);
++}
++
++/* { dg-final { scan-assembler-times "addi" 1 { target powerpc*-*-* } } } */
++/* { dg-final { scan-assembler-times "lwzu" 2 { target powerpc*-*-* } } } */
++/* { dg-final { scan-assembler-times "stdu" 1 { target powerpc*-*-* } } } */
+diff -Naur gcc-4.9.1/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-25.c gcc-4.9.1-pre-modify-disp-support/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-25.c
+--- gcc-4.9.1/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-25.c	1969-12-31 18:00:00.000000000 -0600
++++ gcc-4.9.1-pre-modify-disp-support/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-25.c	2014-08-13 01:32:01.829015000 -0500
+@@ -0,0 +1,20 @@
++/* { dg-do compile { target { powerpc*-*-* && ilp32 } } } */
++/* { dg-options "-O3 -fuse-load-updates" } */
++
++extern void baz(char *s, char *m, char *end);
++
++void foo(char *s, char *m, char *end)
++{
++        while (*s == *m && s < end) {
++
++		s += 2;
++		m += 2;
++
++		*s = 0;
++		*m = 0;
++	}
++
++	baz(s, 0, end);
++}
++
++/* { dg-final { scan-assembler-times "stbu" 2 { target powerpc*-*-* } } } */
+diff -Naur gcc-4.9.1/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-26.c gcc-4.9.1-pre-modify-disp-support/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-26.c
+--- gcc-4.9.1/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-26.c	1969-12-31 18:00:00.000000000 -0600
++++ gcc-4.9.1-pre-modify-disp-support/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-26.c	2014-08-13 01:32:01.829015000 -0500
+@@ -0,0 +1,22 @@
++/* { dg-do compile { target { powerpc*-*-* && lp64 } } } */
++/* { dg-options "-O3 -fuse-load-updates" } */
++
++extern void baz(char *s, char *m, char *end);
++
++void foo(char *s, char *m, char *end)
++{
++        while (*s == *m && s < end) {
++
++		s += 2;
++		m += 2;
++
++		*s = 0;
++		*m = 0;
++	}
++
++	baz(s, 0, end);
++}
++
++/* { dg-final { scan-assembler-times "addi" 1 { target powerpc*-*-* } } } */
++/* { dg-final { scan-assembler-times "stbu" 2 { target powerpc*-*-* } } } */
++/* { dg-final { scan-assembler-times "stdu" 1 { target powerpc*-*-* } } } */
+diff -Naur gcc-4.9.1/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-27.c gcc-4.9.1-pre-modify-disp-support/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-27.c
+--- gcc-4.9.1/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-27.c	1969-12-31 18:00:00.000000000 -0600
++++ gcc-4.9.1-pre-modify-disp-support/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-27.c	2014-08-13 01:32:01.829015000 -0500
+@@ -0,0 +1,20 @@
++/* { dg-do compile { target { powerpc*-*-* && ilp32 } } } */
++/* { dg-options "-O3 -fuse-load-updates" } */
++
++extern void baz(char *scan, char *match, char *strend);
++
++void foo(char *scan, char *match, char *strend)
++{
++        while (*scan == *match && scan > strend) {
++
++		scan  += -2;
++		match += -2;
++
++		*scan = 0;
++		*match = 0;
++	}
++
++	baz(scan, 0, strend);
++}
++
++/* { dg-final { scan-assembler-times "stbu" 2 { target powerpc*-*-* } } } */
+diff -Naur gcc-4.9.1/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-28.c gcc-4.9.1-pre-modify-disp-support/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-28.c
+--- gcc-4.9.1/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-28.c	1969-12-31 18:00:00.000000000 -0600
++++ gcc-4.9.1-pre-modify-disp-support/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-28.c	2014-08-13 01:32:01.829015000 -0500
+@@ -0,0 +1,22 @@
++/* { dg-do compile { target { powerpc*-*-* && lp64 } } } */
++/* { dg-options "-O3 -fuse-load-updates" } */
++
++extern void baz(char *scan, char *match, char *strend);
++
++void foo(char *scan, char *match, char *strend)
++{
++        while (*scan == *match && scan > strend) {
++
++		scan  += -2;
++		match += -2;
++
++		*scan = 0;
++		*match = 0;
++	}
++
++	baz(scan, 0, strend);
++}
++
++/* { dg-final { scan-assembler-times "addi" 1 { target powerpc*-*-* } } } */
++/* { dg-final { scan-assembler-times "stbu" 2 { target powerpc*-*-* } } } */
++/* { dg-final { scan-assembler-times "stdu" 1 { target powerpc*-*-* } } } */
+diff -Naur gcc-4.9.1/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-29.c gcc-4.9.1-pre-modify-disp-support/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-29.c
+--- gcc-4.9.1/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-29.c	1969-12-31 18:00:00.000000000 -0600
++++ gcc-4.9.1-pre-modify-disp-support/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-29.c	2014-08-13 01:32:01.829015000 -0500
+@@ -0,0 +1,17 @@
++/* { dg-do compile { target { powerpc*-*-* && ilp32 } } } */
++/* { dg-options "-O3 -fuse-load-updates" } */
++
++extern void baz(char *s, char *m, char *strend);
++
++void foo(char *s, char *m, char *strend)
++{
++        while (*s == *m && s < strend) {
++
++		s += 2;
++		m -= 2;
++	}
++
++	baz(s, 0, strend);
++}
++
++/* { dg-final { scan-assembler-times "lbzu" 2 { target powerpc*-*-* } } } */
+diff -Naur gcc-4.9.1/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-2.c gcc-4.9.1-pre-modify-disp-support/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-2.c
+--- gcc-4.9.1/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-2.c	1969-12-31 18:00:00.000000000 -0600
++++ gcc-4.9.1-pre-modify-disp-support/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-2.c	2014-08-13 01:32:01.829015000 -0500
+@@ -0,0 +1,19 @@
++/* { dg-do compile { target { powerpc*-*-* && lp64 } } } */
++/* { dg-options "-O3 -fuse-load-updates" } */
++
++extern void baz(char *s, char *m, char *end);
++
++void foo(char *s, char *m, char *end)
++{
++        while (*s == *m && s < end) {
++
++		s += 2;
++		m += 2;
++	}
++
++	baz(s, 0, end);
++}
++
++/* { dg-final { scan-assembler-times "addi" 1 { target powerpc*-*-* } } } */
++/* { dg-final { scan-assembler-times "lbzu" 2 { target powerpc*-*-* } } } */
++/* { dg-final { scan-assembler-times "stdu" 1 { target powerpc*-*-* } } } */
+diff -Naur gcc-4.9.1/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-30.c gcc-4.9.1-pre-modify-disp-support/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-30.c
+--- gcc-4.9.1/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-30.c	1969-12-31 18:00:00.000000000 -0600
++++ gcc-4.9.1-pre-modify-disp-support/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-30.c	2014-08-13 01:32:01.829015000 -0500
+@@ -0,0 +1,19 @@
++/* { dg-do compile { target { powerpc*-*-* && lp64 } } } */
++/* { dg-options "-O3 -fuse-load-updates" } */
++
++extern void baz(char *s, char *m, char *strend);
++
++void foo(char *s, char *m, char *strend)
++{
++        while (*s == *m && s < strend) {
++
++		s += 2;
++		m -= 2;
++	}
++
++	baz(s, 0, strend);
++}
++
++/* { dg-final { scan-assembler-times "addi" 1 { target powerpc*-*-* } } } */
++/* { dg-final { scan-assembler-times "lbzu" 2 { target powerpc*-*-* } } } */
++/* { dg-final { scan-assembler-times "stdu" 1 { target powerpc*-*-* } } } */
+diff -Naur gcc-4.9.1/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-31.c gcc-4.9.1-pre-modify-disp-support/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-31.c
+--- gcc-4.9.1/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-31.c	1969-12-31 18:00:00.000000000 -0600
++++ gcc-4.9.1-pre-modify-disp-support/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-31.c	2014-08-13 01:32:01.829015000 -0500
+@@ -0,0 +1,20 @@
++/* { dg-do compile { target { powerpc*-*-* && ilp32 } } } */
++/* { dg-options "-O3 -fuse-load-updates" } */
++
++extern void baz(char *scan, char *match, char *strend);
++
++void foo(char *scan, char *match, char *strend)
++{
++        while (*scan == *match && scan < strend) {
++
++		scan  += 1;
++		match += 1;
++
++		*scan = 0;
++		*match = 0;
++	}
++
++	baz(scan, 0, strend);
++}
++
++/* { dg-final { scan-assembler-times "stbu" 2 { target powerpc*-*-* } } } */
+diff -Naur gcc-4.9.1/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-32.c gcc-4.9.1-pre-modify-disp-support/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-32.c
+--- gcc-4.9.1/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-32.c	1969-12-31 18:00:00.000000000 -0600
++++ gcc-4.9.1-pre-modify-disp-support/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-32.c	2014-08-13 01:32:01.829015000 -0500
+@@ -0,0 +1,22 @@
++/* { dg-do compile { target { powerpc*-*-* && lp64 } } } */
++/* { dg-options "-O3 -fuse-load-updates" } */
++
++extern void baz(char *scan, char *match, char *strend);
++
++void foo(char *scan, char *match, char *strend)
++{
++        while (*scan == *match && scan < strend) {
++
++		scan  += 1;
++		match += 1;
++
++		*scan = 0;
++		*match = 0;
++	}
++
++	baz(scan, 0, strend);
++}
++
++/* { dg-final { scan-assembler-times "addi" 1 { target powerpc*-*-* } } } */
++/* { dg-final { scan-assembler-times "stbu" 2 { target powerpc*-*-* } } } */
++/* { dg-final { scan-assembler-times "stdu" 1 { target powerpc*-*-* } } } */
+diff -Naur gcc-4.9.1/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-33.c gcc-4.9.1-pre-modify-disp-support/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-33.c
+--- gcc-4.9.1/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-33.c	1969-12-31 18:00:00.000000000 -0600
++++ gcc-4.9.1-pre-modify-disp-support/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-33.c	2014-08-13 01:32:01.829015000 -0500
+@@ -0,0 +1,20 @@
++/* { dg-do compile { target { powerpc*-*-* && ilp32 } } } */
++/* { dg-options "-O3 -fuse-load-updates" } */
++
++extern void baz(char *scan, char *match, char *strend);
++
++void foo(char *scan, char *match, char *strend)
++{
++        while (*scan == *match && scan > strend) {
++
++		scan  += -1;
++		match += -1;
++
++		*scan = 0;
++		*match = 0;
++	}
++
++	baz(scan, 0, strend);
++}
++
++/* { dg-final { scan-assembler-times "stbu" 2 { target powerpc*-*-* } } } */
+diff -Naur gcc-4.9.1/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-34.c gcc-4.9.1-pre-modify-disp-support/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-34.c
+--- gcc-4.9.1/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-34.c	1969-12-31 18:00:00.000000000 -0600
++++ gcc-4.9.1-pre-modify-disp-support/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-34.c	2014-08-13 01:32:01.829015000 -0500
+@@ -0,0 +1,22 @@
++/* { dg-do compile { target { powerpc*-*-* && lp64 } } } */
++/* { dg-options "-O3 -fuse-load-updates" } */
++
++extern void baz(char *scan, char *match, char *strend);
++
++void foo(char *scan, char *match, char *strend)
++{
++        while (*scan == *match && scan > strend) {
++
++		scan  += -1;
++		match += -1;
++
++		*scan = 0;
++		*match = 0;
++	}
++
++	baz(scan, 0, strend);
++}
++
++/* { dg-final { scan-assembler-times "addi" 1 { target powerpc*-*-* } } } */
++/* { dg-final { scan-assembler-times "stbu" 2 { target powerpc*-*-* } } } */
++/* { dg-final { scan-assembler-times "stdu" 1 { target powerpc*-*-* } } } */
+diff -Naur gcc-4.9.1/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-35.c gcc-4.9.1-pre-modify-disp-support/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-35.c
+--- gcc-4.9.1/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-35.c	1969-12-31 18:00:00.000000000 -0600
++++ gcc-4.9.1-pre-modify-disp-support/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-35.c	2014-08-13 01:32:01.830015000 -0500
+@@ -0,0 +1,22 @@
++/* { dg-do compile { target { powerpc*-*-* && ilp32 } } } */
++/* { dg-options "-O3 -fuse-load-updates" } */
++
++extern void foo (char *p, char *q, const char *bound);
++
++void incrBytes(char *p, char *q, const char *bound)
++{
++	while (*p == *q && p < bound) {
++
++		p += 1;
++		*p = *p + 1;
++
++		q += 1;
++		*q = *q+ 1;
++
++	}
++
++	foo (p, 0, bound);
++}
++
++/* { dg-final { scan-assembler-times "addi" 2 { target powerpc*-*-* } } } */
++/* { dg-final { scan-assembler-times "lbzu" 2 { target powerpc*-*-* } } } */
+diff -Naur gcc-4.9.1/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-36.c gcc-4.9.1-pre-modify-disp-support/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-36.c
+--- gcc-4.9.1/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-36.c	1969-12-31 18:00:00.000000000 -0600
++++ gcc-4.9.1-pre-modify-disp-support/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-36.c	2014-08-13 01:32:01.830015000 -0500
+@@ -0,0 +1,23 @@
++/* { dg-do compile { target { powerpc*-*-* && lp64 } } } */
++/* { dg-options "-O3 -fuse-load-updates" } */
++
++extern void foo (char *p, char *q, const char *bound);
++
++void incrBytes(char *p, char *q, const char *bound)
++{
++	while (*p == *q && p < bound) {
++
++		p += 1;
++		*p = *p + 1;
++
++		q += 1;
++		*q = *q+ 1;
++
++	}
++
++	foo (p, 0, bound);
++}
++
++/* { dg-final { scan-assembler-times "addi" 3 { target powerpc*-*-* } } } */
++/* { dg-final { scan-assembler-times "lbzu" 2 { target powerpc*-*-* } } } */
++/* { dg-final { scan-assembler-times "stdu" 1 { target powerpc*-*-* } } } */
+diff -Naur gcc-4.9.1/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-37.c gcc-4.9.1-pre-modify-disp-support/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-37.c
+--- gcc-4.9.1/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-37.c	1969-12-31 18:00:00.000000000 -0600
++++ gcc-4.9.1-pre-modify-disp-support/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-37.c	2014-08-13 01:32:01.830015000 -0500
+@@ -0,0 +1,29 @@
++/* { dg-do compile { target { powerpc*-*-* && ilp32 } } } */
++/* { dg-options "-O3 -fuse-load-updates" } */
++
++struct rx {
++ char **startp;
++};
++
++extern int *foo();
++
++int **bar(void)
++{
++ int **sp;
++ int iterations, i;
++ struct rx *rx;
++
++ for (i = i; i <= iterations; i++) {
++
++   ++sp;
++   *sp = foo();
++
++   if (rx->startp[i])
++     gorp();
++ }
++
++ return sp;
++}
++
++/* { dg-final { scan-assembler-times "addi" 3 { target powerpc*-*-* } } } */
++/* { dg-final { scan-assembler-times "stwu" 2 { target powerpc*-*-* } } } */
+diff -Naur gcc-4.9.1/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-38.c gcc-4.9.1-pre-modify-disp-support/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-38.c
+--- gcc-4.9.1/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-38.c	1969-12-31 18:00:00.000000000 -0600
++++ gcc-4.9.1-pre-modify-disp-support/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-38.c	2014-08-13 01:32:01.830015000 -0500
+@@ -0,0 +1,29 @@
++/* { dg-do compile { target { powerpc*-*-* && lp64 } } } */
++/* { dg-options "-O3 -fuse-load-updates" } */
++
++struct rx {
++ char **startp;
++};
++
++extern int *foo();
++
++int **bar(void)
++{
++ int **sp;
++ int iterations, i;
++ struct rx *rx;
++
++ for (i = i; i <= iterations; i++) {
++
++   ++sp;
++   *sp = foo();
++
++   if (rx->startp[i])
++     gorp();
++ }
++
++ return sp;
++}
++
++/* { dg-final { scan-assembler-times "addi" 3 { target powerpc*-*-* } } } */
++/* { dg-final { scan-assembler-times "stdu" 2 { target powerpc*-*-* } } } */
+diff -Naur gcc-4.9.1/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-39.c gcc-4.9.1-pre-modify-disp-support/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-39.c
+--- gcc-4.9.1/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-39.c	1969-12-31 18:00:00.000000000 -0600
++++ gcc-4.9.1-pre-modify-disp-support/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-39.c	2014-08-13 01:32:01.830015000 -0500
+@@ -0,0 +1,19 @@
++/* { dg-do compile { target { powerpc*-*-* && ilp32 } } } */
++/* { dg-options "-O3 -fuse-load-updates -fno-builtin -fno-tree-loop-optimize" } */
++
++void *memset(void *b, int c, unsigned long len)
++{
++        unsigned long i;
++
++        for (i = 0; i < len; i++)
++                ((unsigned char *)b)[i] = c;
++
++        return b;
++}
++
++/* NOTE: We ought to get at-least one stwu - there is some vector related stuff that
++ *       we need to take into consideration under -fuse-load-updates. With plain
++ *       vanilla GCC, we do get one stwu, so we are actually degrading performance
++ *       by not taking the "vector stuff" into account. */
++
++/* { dg-final { scan-assembler-times "addi" 1 { target powerpc*-*-* } } } */
+diff -Naur gcc-4.9.1/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-3.c gcc-4.9.1-pre-modify-disp-support/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-3.c
+--- gcc-4.9.1/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-3.c	1969-12-31 18:00:00.000000000 -0600
++++ gcc-4.9.1-pre-modify-disp-support/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-3.c	2014-08-13 01:32:01.830015000 -0500
+@@ -0,0 +1,17 @@
++/* { dg-do compile { target { powerpc*-*-* && ilp32 } } } */
++/* { dg-options "-O3 -fuse-load-updates" } */
++
++extern void baz(char *s, char *m, char *end);
++
++void foo(char *s, char *m, char *end)
++{
++        while (*s == *m && s < end) {
++
++		s += 1;
++		m += 1;
++	}
++
++	baz(s, 0, end);
++}
++
++/* { dg-final { scan-assembler-times "lbzu" 2 { target powerpc*-*-* } } } */
+diff -Naur gcc-4.9.1/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-40.c gcc-4.9.1-pre-modify-disp-support/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-40.c
+--- gcc-4.9.1/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-40.c	1969-12-31 18:00:00.000000000 -0600
++++ gcc-4.9.1-pre-modify-disp-support/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-40.c	2014-08-13 01:32:01.830015000 -0500
+@@ -0,0 +1,19 @@
++/* { dg-do compile { target { powerpc*-*-* && lp64 } } } */
++/* { dg-options "-O3 -fuse-load-updates -fno-builtin -fno-tree-loop-optimize" } */
++
++void *memset(void *b, int c, unsigned long len)
++{
++        unsigned long i;
++
++        for (i = 0; i < len; i++)
++                ((unsigned char *)b)[i] = c;
++
++        return b;
++}
++
++/* NOTE: We ought to get at-least one stwu - there is some vector related stuff that
++ *       we need to take into consideration under -fuse-load-updates. With plain
++ *       vanilla GCC, we do get one stwu, so we are actually degrading performance
++ *       by not taking the "vector stuff" into account. */
++
++/* { dg-final { scan-assembler-times "addi" 1 { target powerpc*-*-* } } } */
+diff -Naur gcc-4.9.1/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-4.c gcc-4.9.1-pre-modify-disp-support/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-4.c
+--- gcc-4.9.1/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-4.c	1969-12-31 18:00:00.000000000 -0600
++++ gcc-4.9.1-pre-modify-disp-support/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-4.c	2014-08-13 01:32:01.830015000 -0500
+@@ -0,0 +1,19 @@
++/* { dg-do compile { target { powerpc*-*-* && lp64 } } } */
++/* { dg-options "-O3 -fuse-load-updates" } */
++
++extern void baz(char *s, char *m, char *end);
++
++void foo(char *s, char *m, char *end)
++{
++        while (*s == *m && s < end) {
++
++		s += 1;
++		m += 1;
++	}
++
++	baz(s, 0, end);
++}
++
++/* { dg-final { scan-assembler-times "addi" 1 { target powerpc*-*-* } } } */
++/* { dg-final { scan-assembler-times "lbzu" 2 { target powerpc*-*-* } } } */
++/* { dg-final { scan-assembler-times "stdu" 1 { target powerpc*-*-* } } } */
+diff -Naur gcc-4.9.1/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-5.c gcc-4.9.1-pre-modify-disp-support/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-5.c
+--- gcc-4.9.1/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-5.c	1969-12-31 18:00:00.000000000 -0600
++++ gcc-4.9.1-pre-modify-disp-support/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-5.c	2014-08-13 01:32:01.830015000 -0500
+@@ -0,0 +1,17 @@
++/* { dg-do compile { target { powerpc*-*-* && ilp32 } } } */
++/* { dg-options "-O3 -fuse-load-updates" } */
++
++extern void baz(char *s, char *m, char *end);
++
++void foo(char *s, char *m, char *end)
++{
++        while (*s == *m && s < end) {
++
++		s += -1;
++		m += -1;
++	}
++
++	baz(s, 0, end);
++}
++
++/* { dg-final { scan-assembler-times "lbzu" 2 { target powerpc*-*-* } } } */
+diff -Naur gcc-4.9.1/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-6.c gcc-4.9.1-pre-modify-disp-support/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-6.c
+--- gcc-4.9.1/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-6.c	1969-12-31 18:00:00.000000000 -0600
++++ gcc-4.9.1-pre-modify-disp-support/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-6.c	2014-08-13 01:32:01.830015000 -0500
+@@ -0,0 +1,19 @@
++/* { dg-do compile { target { powerpc*-*-* && lp64 } } } */
++/* { dg-options "-O3 -fuse-load-updates" } */
++
++extern void baz(char *s, char *m, char *end);
++
++void foo(char *s, char *m, char *end)
++{
++        while (*s == *m && s < end) {
++
++		s += -1;
++		m += -1;
++	}
++
++	baz(s, 0, end);
++}
++
++/* { dg-final { scan-assembler-times "addi" 1 { target powerpc*-*-* } } } */
++/* { dg-final { scan-assembler-times "lbzu" 2 { target powerpc*-*-* } } } */
++/* { dg-final { scan-assembler-times "stdu" 1 { target powerpc*-*-* } } } */
+diff -Naur gcc-4.9.1/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-7.c gcc-4.9.1-pre-modify-disp-support/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-7.c
+--- gcc-4.9.1/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-7.c	1969-12-31 18:00:00.000000000 -0600
++++ gcc-4.9.1-pre-modify-disp-support/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-7.c	2014-08-13 01:32:01.830015000 -0500
+@@ -0,0 +1,17 @@
++/* { dg-do compile { target { powerpc*-*-* && ilp32 } } } */
++/* { dg-options "-O3 -fuse-load-updates" } */
++
++extern void baz(char *s, char *m, char *end);
++
++void foo(char *s, char *m, char *end)
++{
++        while (*s == *m && s < end) {
++
++		s += -2;
++		m += -2;
++	}
++
++	baz(s, 0, end);
++}
++
++/* { dg-final { scan-assembler-times "lbzu" 2 { target powerpc*-*-* } } } */
+diff -Naur gcc-4.9.1/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-8.c gcc-4.9.1-pre-modify-disp-support/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-8.c
+--- gcc-4.9.1/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-8.c	1969-12-31 18:00:00.000000000 -0600
++++ gcc-4.9.1-pre-modify-disp-support/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-8.c	2014-08-13 01:32:01.831015000 -0500
+@@ -0,0 +1,19 @@
++/* { dg-do compile { target { powerpc*-*-* && lp64 } } } */
++/* { dg-options "-O3 -fuse-load-updates" } */
++
++extern void baz(char *s, char *m, char *end);
++
++void foo(char *s, char *m, char *end)
++{
++        while (*s == *m && s < end) {
++
++		s += -2;
++		m += -2;
++	}
++
++	baz(s, 0, end);
++}
++
++/* { dg-final { scan-assembler-times "addi" 1 { target powerpc*-*-* } } } */
++/* { dg-final { scan-assembler-times "lbzu" 2 { target powerpc*-*-* } } } */
++/* { dg-final { scan-assembler-times "stdu" 1 { target powerpc*-*-* } } } */
+diff -Naur gcc-4.9.1/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-9.c gcc-4.9.1-pre-modify-disp-support/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-9.c
+--- gcc-4.9.1/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-9.c	1969-12-31 18:00:00.000000000 -0600
++++ gcc-4.9.1-pre-modify-disp-support/gcc/testsuite/gcc.dg/tree-ssa/fsl-use-load-updates-9.c	2014-08-13 01:32:01.831015000 -0500
+@@ -0,0 +1,17 @@
++/* { dg-do compile { target { powerpc*-*-* && ilp32 } } } */
++/* { dg-options "-O3 -fuse-load-updates" } */
++
++extern void baz(char *s, char *m, char *end);
++
++void foo(char *s, char *m, char *end)
++{
++        while (*s == *m) {
++
++		s += 2;
++		m += 2;
++	}
++
++	baz(s, 0, end);
++}
++
++/* { dg-final { scan-assembler-times "lbzu" 2 { target powerpc*-*-* } } } */
+diff -Naur gcc-4.9.1/gcc/tree-ssa-loop-ivopts.c gcc-4.9.1-pre-modify-disp-support/gcc/tree-ssa-loop-ivopts.c
+--- gcc-4.9.1/gcc/tree-ssa-loop-ivopts.c	2014-08-13 01:25:45.343015000 -0500
++++ gcc-4.9.1-pre-modify-disp-support/gcc/tree-ssa-loop-ivopts.c	2014-08-13 01:30:08.599015000 -0500
+@@ -2390,6 +2390,8 @@
+   return false;
+ }
+ 
++#define WANT_LOAD_UPDATES (flag_use_load_updates == 1)
++
+ /* If possible, adds autoincrement candidates BASE + STEP * i based on use USE.
+    Important field is set to IMPORTANT.  */
+ 
+@@ -2419,7 +2421,10 @@
+        && GET_MODE_SIZE (mem_mode) == cstepi)
+       || ((USE_LOAD_PRE_DECREMENT (mem_mode)
+ 	   || USE_STORE_PRE_DECREMENT (mem_mode))
+-	  && GET_MODE_SIZE (mem_mode) == -cstepi))
++	  && GET_MODE_SIZE (mem_mode) == -cstepi)
++      || (WANT_LOAD_UPDATES && HAVE_PRE_MODIFY_DISP
++	  && (GET_MODE_SIZE (mem_mode) != 0
++	      && cstepi % GET_MODE_SIZE (mem_mode) == 0)))
+     {
+       enum tree_code code = MINUS_EXPR;
+       tree new_base;
+@@ -3213,6 +3218,7 @@
+ {
+   AINC_PRE_INC,		/* Pre increment.  */
+   AINC_PRE_DEC,		/* Pre decrement.  */
++  AINC_PRE_MOD,		/* Pre Modify */
+   AINC_POST_INC,	/* Post increment.  */
+   AINC_POST_DEC,	/* Post decrement.  */
+   AINC_NONE		/* Also the number of auto increment types.  */
+@@ -3239,6 +3245,7 @@
+   address_cost_data data;
+   static bool has_preinc[MAX_MACHINE_MODE], has_postinc[MAX_MACHINE_MODE];
+   static bool has_predec[MAX_MACHINE_MODE], has_postdec[MAX_MACHINE_MODE];
++  static bool has_premod_d[MAX_MACHINE_MODE];
+   unsigned cost, acost, complexity;
+   enum ainc_type autoinc_type;
+   bool offset_p, ratio_p, autoinc;
+@@ -3356,6 +3363,14 @@
+ 	    data->ainc_costs[AINC_POST_INC]
+ 	      = address_cost (addr, mem_mode, as, speed);
+ 	}
++      if (WANT_LOAD_UPDATES && HAVE_PRE_MODIFY_DISP)
++	{
++	  addr = gen_rtx_PRE_MODIFY (address_mode, reg0,
++	                             gen_rtx_PLUS (address_mode, reg0,
++	                                           GEN_INT (cstep)));
++	  has_premod_d[mem_mode]
++	    = memory_address_addr_space_p (mem_mode, addr, as);
++	}
+       for (i = 0; i < 16; i++)
+ 	{
+ 	  sym_p = i & 1;
+@@ -3464,7 +3479,8 @@
+ 	      fprintf (dump_file, "index costs %d\n", acost);
+ 	    }
+ 	  if (has_predec[mem_mode] || has_postdec[mem_mode]
+-	      || has_preinc[mem_mode] || has_postinc[mem_mode])
++	      || has_preinc[mem_mode] || has_postinc[mem_mode]
++	      || (WANT_LOAD_UPDATES && has_premod_d[mem_mode]))
+ 	    fprintf (dump_file, "  May include autoinc/dec\n");
+ 	  fprintf (dump_file, "\n");
+ 	}
+@@ -3501,6 +3517,11 @@
+       else if (has_predec[mem_mode] && autoinc_offset == -msize
+ 	       && msize == -cstep)
+ 	autoinc_type = AINC_PRE_DEC;
++      else if (WANT_LOAD_UPDATES && has_premod_d[mem_mode]
++               && msize != 0
++               && autoinc_offset % msize == 0
++               && cstep % msize == 0)
++	autoinc_type = AINC_PRE_MOD;
+ 
+       if (autoinc_type != AINC_NONE)
+ 	autoinc = true;
+@@ -3521,7 +3542,7 @@
+ 
+   if (may_autoinc)
+     *may_autoinc = autoinc;
+-  if (autoinc)
++  if (autoinc && (autoinc_type != AINC_PRE_MOD))
+     acost = data->ainc_costs[autoinc_type];
+   else
+     acost = data->costs[symbol_present][var_present][offset_p][ratio_p];
diff --git a/recipes-devtools/gcc/gcc-4.9/0025-fortran-cross-compile-hack.patch b/recipes-devtools/gcc/gcc-4.9/0025-fortran-cross-compile-hack.patch
new file mode 100644
index 0000000..0e7914d
--- /dev/null
+++ b/recipes-devtools/gcc/gcc-4.9/0025-fortran-cross-compile-hack.patch
@@ -0,0 +1,46 @@
+From af8a56ea4e17b2909eff2c57704ab43ef24f28d3 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem at gmail.com>
+Date: Fri, 29 Mar 2013 09:20:01 +0400
+Subject: [PATCH 25/35] fortran cross-compile hack.
+
+* Fortran would have searched for arm-angstrom-gnueabi-gfortran but would have used
+used gfortan. For gcc_4.2.2.bb we want to use the gfortran compiler from our cross
+directory.
+
+Signed-off-by: Khem Raj <raj.khem at gmail.com>
+
+Upstream-Status: Inappropriate [embedded specific]
+---
+ libgfortran/configure    |    2 +-
+ libgfortran/configure.ac |    2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/libgfortran/configure b/libgfortran/configure
+index 8385e96..b8f7a92 100755
+--- a/libgfortran/configure
++++ b/libgfortran/configure
+@@ -12704,7 +12704,7 @@ esac
+ 
+ # We need gfortran to compile parts of the library
+ #AC_PROG_FC(gfortran)
+-FC="$GFORTRAN"
++#FC="$GFORTRAN"
+ ac_ext=${ac_fc_srcext-f}
+ ac_compile='$FC -c $FCFLAGS $ac_fcflags_srcext conftest.$ac_ext >&5'
+ ac_link='$FC -o conftest$ac_exeext $FCFLAGS $LDFLAGS $ac_fcflags_srcext conftest.$ac_ext $LIBS >&5'
+diff --git a/libgfortran/configure.ac b/libgfortran/configure.ac
+index 7d97fed..3f9f484 100644
+--- a/libgfortran/configure.ac
++++ b/libgfortran/configure.ac
+@@ -227,7 +227,7 @@ AC_SUBST(enable_static)
+ 
+ # We need gfortran to compile parts of the library
+ #AC_PROG_FC(gfortran)
+-FC="$GFORTRAN"
++#FC="$GFORTRAN"
+ AC_PROG_FC(gfortran)
+ 
+ # extra LD Flags which are required for targets
+-- 
+1.7.10.4
+
diff --git a/recipes-devtools/gcc/gcc-4.9/0025.gcc.fix_ENGR00298583_dwarf-vector-reg_49x.patch b/recipes-devtools/gcc/gcc-4.9/0025.gcc.fix_ENGR00298583_dwarf-vector-reg_49x.patch
new file mode 100644
index 0000000..88fb24c
--- /dev/null
+++ b/recipes-devtools/gcc/gcc-4.9/0025.gcc.fix_ENGR00298583_dwarf-vector-reg_49x.patch
@@ -0,0 +1,113 @@
+# Problem Statement:
+  In Altivec targets (e.g. e6500), DWARF vector register indices for DW_OP_regx
+  locations are not in range. According to "64-bit PowerPC ELF Application
+  Binary Interface Supplement 1.9", DWARF Register Number Mapping section, the
+  expected range for vector registers is:
+                 Vector Registers 0-31 1124-1155 vr0-vr31.
+
+  However, the compiler generates indices in the 77-108 range that overlap with
+  other defined mappings.
+
+# Reported by:
+  Doan Vu Van
+
+# Owned by:
+  Rohit
+
+# Action:
+  While mapping gcc register numbers to DWARF2 register numbers,
+  we digress a bit from the standard ABI.
+  http://gcc.gnu.org/ml/gcc-patches/2012-11/msg02136.html
+
+  The above change is handled by GDB, but CodeWarrior PowerPC debugger
+  stricity follows the ABI especially while mapping the vector registers.
+
+  We have provided an compiler option, '-mmap_dwarf_vecreg' so that the user can
+  generate the dwarf register indexes for vector registers as per standard.
+
+diff -Naur gcc-4.9.2/gcc/config/rs6000/rs6000.c gcc-4.9.2-dbx-vector-reg/gcc/config/rs6000/rs6000.c
+--- gcc-4.9.2/gcc/config/rs6000/rs6000.c	2014-10-12 21:33:20.000000000 -0500
++++ gcc-4.9.2-dbx-vector-reg/gcc/config/rs6000/rs6000.c	2014-11-06 09:32:31.609217000 -0600
+@@ -31304,6 +31304,22 @@
+   return regno;
+ }
+ 
++/* While mapping gcc register numbers to DWARF2 register numbers, 
++ * we digress a bit from the standard ABI.
++ * http://gcc.gnu.org/ml/gcc-patches/2012-11/msg02136.html
++ *
++ * The above change is handled by GDB, but CodeWarrior PowerPC debugger
++ * stricity follows the ABI especially while mapping the vector registers */
++
++unsigned int
++rs6000_fsl_dbx_register_number (unsigned int regno)
++{
++  if (global_options_set.x_rs6000_map_dwarf_vec_reg)
++    return rs6000_dbx_register_number (regno);
++
++  return regno;
++}
++
+ /* target hook eh_return_filter_mode */
+ static enum machine_mode
+ rs6000_eh_return_filter_mode (void)
+diff -Naur gcc-4.9.2/gcc/config/rs6000/rs6000.opt gcc-4.9.2-dbx-vector-reg/gcc/config/rs6000/rs6000.opt
+--- gcc-4.9.2/gcc/config/rs6000/rs6000.opt	2014-01-23 19:56:48.000000000 -0600
++++ gcc-4.9.2-dbx-vector-reg/gcc/config/rs6000/rs6000.opt	2014-11-06 09:32:31.610217000 -0600
+@@ -361,6 +361,10 @@
+ Target RejectNegative Joined
+ -mdebug=	Enable debug output
+ 
++mmap_dwarf_vecreg
++Target RejectNegative Var(rs6000_map_dwarf_vec_reg, 0) Save
++Generate expected DWARF Register Number Mapping for Vector Registers 
++
+ mabi=altivec
+ Target RejectNegative Var(rs6000_altivec_abi) Save
+ Use the AltiVec ABI extensions
+diff -Naur gcc-4.9.2/gcc/config/rs6000/rs6000-protos.h gcc-4.9.2-dbx-vector-reg/gcc/config/rs6000/rs6000-protos.h
+--- gcc-4.9.2/gcc/config/rs6000/rs6000-protos.h	2014-09-19 15:59:51.000000000 -0500
++++ gcc-4.9.2-dbx-vector-reg/gcc/config/rs6000/rs6000-protos.h	2014-11-06 09:32:31.610217000 -0600
+@@ -186,6 +186,7 @@
+ extern void rs6000_emit_prologue (void);
+ extern void rs6000_emit_load_toc_table (int);
+ extern unsigned int rs6000_dbx_register_number (unsigned int);
++extern unsigned int rs6000_fsl_dbx_register_number (unsigned int);
+ extern void rs6000_emit_epilogue (int);
+ extern void rs6000_emit_eh_reg_restore (rtx, rtx);
+ extern const char * output_isel (rtx *);
+diff -Naur gcc-4.9.2/gcc/config/rs6000/sysv4.h gcc-4.9.2-dbx-vector-reg/gcc/config/rs6000/sysv4.h
+--- gcc-4.9.2/gcc/config/rs6000/sysv4.h	2014-07-24 12:25:19.000000000 -0500
++++ gcc-4.9.2-dbx-vector-reg/gcc/config/rs6000/sysv4.h	2014-11-06 09:33:45.296217000 -0600
+@@ -948,7 +948,8 @@
+ /* This target uses the sysv4.opt file.  */
+ #define TARGET_USES_SYSV4_OPT 1
+ 
+-#undef DBX_REGISTER_NUMBER
++/* Use standard DWARF numbering for DWARF debugging information.  */
++#define DBX_REGISTER_NUMBER(REGNO) rs6000_fsl_dbx_register_number (REGNO)
+ 
+ /* Link -lasan early on the command line.  For -static-libasan, don't link
+    it for -shared link, the executable should be compiled with -static-libasan
+diff -Naur gcc-4.8.3/gcc/testsuite/gcc.target/powerpc/ppc-fsl-altivec-dwreg.c gcc-4.8.3-patch/gcc/testsuite/gcc.target/powerpc/ppc-fsl-altivec-dwreg.c
+--- gcc-4.8.3/gcc/testsuite/gcc.target/powerpc/ppc-fsl-altivec-dwreg.c	1969-12-31 18:00:00.000000000 -0600
++++ gcc-4.8.3-patch/gcc/testsuite/gcc.target/powerpc/ppc-fsl-altivec-dwreg.c	2014-12-05 04:11:26.299670000 -0600
+@@ -0,0 +1,18 @@
++/* { dg-do compile { target { powerpc*-*-* } } } */
++/* { dg-require-effective-target powerpc_altivec_ok } */
++/* { dg-options "-O0 -g -mmap_dwarf_vecreg" } */
++/* { dg-final { scan-assembler-times ".uleb128 0x481" 1 } } */
++/* { dg-final { scan-assembler-times ".uleb128 0x482" 1 } } */
++/* { dg-final { scan-assembler-times ".uleb128 0x483" 1 } } */
++
++#include <altivec.h>
++
++vector unsigned int fun()
++{
++  register vector unsigned int vi1 = {0,1,2,3}; 
++  register vector unsigned int vi2 = {1,2,3,4};
++  register vector unsigned int ri = {0,0,0,0};
++  ri = vec_add(vi1, vi2); /* ri = vi1 + vi2 */
++
++  return ri;
++}
diff --git a/recipes-devtools/gcc/gcc-4.9/0026-libgcc-sjlj-check.patch b/recipes-devtools/gcc/gcc-4.9/0026-libgcc-sjlj-check.patch
new file mode 100644
index 0000000..d4efab9
--- /dev/null
+++ b/recipes-devtools/gcc/gcc-4.9/0026-libgcc-sjlj-check.patch
@@ -0,0 +1,74 @@
+From 08c2398445e6cac282488f64ae6bf29cbcd8db23 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem at gmail.com>
+Date: Fri, 29 Mar 2013 09:20:50 +0400
+Subject: [PATCH 26/35] libgcc-sjlj-check
+
+ac_fn_c_try_compile doesnt seem to keep the intermediate files
+which are needed for sjlj test to pass since it greps into the
+generated file. So we run the compiler command using AC_TRY_COMMAND
+which then generates the needed .s file
+
+Signed-off-by: Khem Raj <raj.khem at gmail.com>
+
+Upstream-Status: Pending
+---
+ libgcc/configure    |   10 ++++++----
+ libgcc/configure.ac |   10 ++++------
+ 2 files changed, 10 insertions(+), 10 deletions(-)
+
+diff --git a/libgcc/configure b/libgcc/configure
+index 1425df6..d18e3cb 100644
+--- a/libgcc/configure
++++ b/libgcc/configure
+@@ -4208,17 +4208,19 @@ void foo ()
+ }
+ 
+ _ACEOF
+-CFLAGS_hold=$CFLAGS
+-CFLAGS="--save-temps -fexceptions"
+ libgcc_cv_lib_sjlj_exceptions=unknown
+-if ac_fn_c_try_compile; then :
++if { ac_try='${CC-cc} -fexceptions -S conftest.c -o conftest.s 1>&5'
++  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
++  (eval $ac_try) 2>&5
++  ac_status=$?
++  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
++  test $ac_status = 0; }; }; then
+   if grep _Unwind_SjLj_Resume conftest.s >/dev/null 2>&1; then
+     libgcc_cv_lib_sjlj_exceptions=yes
+   elif grep _Unwind_Resume conftest.s >/dev/null 2>&1; then
+     libgcc_cv_lib_sjlj_exceptions=no
+   fi
+ fi
+-CFLAGS=$CFLAGS_hold
+ rm -f conftest*
+ 
+ fi
+diff --git a/libgcc/configure.ac b/libgcc/configure.ac
+index 8b7aba5..c7c9644 100644
+--- a/libgcc/configure.ac
++++ b/libgcc/configure.ac
+@@ -216,16 +216,14 @@ void foo ()
+   bar();
+ }
+ ])])
+-CFLAGS_hold=$CFLAGS
+-CFLAGS="--save-temps -fexceptions"
+ libgcc_cv_lib_sjlj_exceptions=unknown
+-AS_IF([ac_fn_c_try_compile],
+-  [if grep _Unwind_SjLj_Resume conftest.s >/dev/null 2>&1; then
++if AC_TRY_COMMAND(${CC-cc} -fexceptions -S conftest.c -o conftest.s 1>&AS_MESSAGE_LOG_FD); then
++  if grep _Unwind_SjLj_Resume conftest.s >/dev/null 2>&1; then
+     libgcc_cv_lib_sjlj_exceptions=yes
+   elif grep _Unwind_Resume conftest.s >/dev/null 2>&1; then
+     libgcc_cv_lib_sjlj_exceptions=no
+-  fi])
+-CFLAGS=$CFLAGS_hold
++  fi
++fi
+ rm -f conftest*
+ ])
+ 
+-- 
+1.7.10.4
+
diff --git a/recipes-devtools/gcc/gcc-4.9/0026.gcc.fix_MTWX51605-memset-array-init_48.patch b/recipes-devtools/gcc/gcc-4.9/0026.gcc.fix_MTWX51605-memset-array-init_48.patch
new file mode 100644
index 0000000..5ff1bd2
--- /dev/null
+++ b/recipes-devtools/gcc/gcc-4.9/0026.gcc.fix_MTWX51605-memset-array-init_48.patch
@@ -0,0 +1,129 @@
+# Problem Statement:
+  Identify memory block setting and insert call to memset() or a loop-unrolled
+  code sequence
+
+# Reported by:
+  James Yang
+
+# Owned by:
+  Rohit
+
+# Action:
+  1. From v4.8 onwards, gcc generates 'memset' call for initialization loop
+     by default.
+  2. If the loop count of the initialization loop is known at compile time, 
+     generate sequence of store instructions for 'memset' calls based on the
+     target specific data given below.
+  3. For e500mc generate call to 'memset' if no. of bytes to
+     be cleared is > 136 else generate sequence of store instructions.
+  4. For e500v1/e500v2 generate call to 'memset' if no. of bytes to
+     be cleared is > 172 else generate sequence of store instructions (vector).
+  5. For e5500/e6500 (32-bit) generate  call to 'memset' if no. of bytes to be
+     cleared is > 120 else generate sequence of store instructions.
+  6. For e5500/e6500 (64-bit) generate  call to 'memset' if no. of bytes to be
+     cleared is > 248 else generate sequence of store instructions.
+  7. Set upper bound limit (256/512) for generation of sequence of store
+     instructions to prevent stack overflow due to code bloat.
+  8. To override the default no. of bytes to be cleared values, use the
+     target flag '-mmax_block_clear='.
+  9. To disable this change and get default GCC behavior use the flag
+     '-mno-opt-memset'.
+
+diff -Naur gcc-4.8.1/gcc/config/rs6000/rs6000.c gcc-4.8.1-MTWX51605-memset-array-init/gcc/config/rs6000/rs6000.c
+--- gcc-4.8.1/gcc/config/rs6000/rs6000.c	2013-06-07 08:09:43.578001466 -0500
++++ gcc-4.8.1-MTWX51605-memset-array-init/gcc/config/rs6000/rs6000.c	2013-06-07 09:28:04.641003044 -0500
+@@ -2423,6 +2423,10 @@
+   if (optimize >= 3 && global_init_p && !global_options_set.x_flag_ira_loop_pressure)
+     flag_ira_loop_pressure = 1;
+ 
++  if (!global_options_set.x_TARGET_OPT_MEMSET_STORE &&
++      (flag_tree_loop_distribution || flag_tree_loop_distribute_patterns))
++    TARGET_OPT_MEMSET_STORE = 1;
++
+   /* Set the pointer size.  */
+   if (TARGET_64BIT)
+     {
+@@ -13414,7 +13418,64 @@
+ 
+   if (optimize_size && bytes > 3 * clear_step)
+     return 0;
+-  if (! optimize_size && bytes > 8 * clear_step)
++
++  if (TARGET_OPT_MEMSET_STORE && !optimize_size)
++    {
++      if (rs6000_cpu == PROCESSOR_PPCE500MC)
++        {
++          /* Based on comparison of performance data between generating sequence
++             of store instructions and 'memset' call,'memset' executes faster if
++             the no of bytes is > 136.
++             An Upper bound limit has been set for the generation of store
++             instructions to prevent stack overflow due to code bloat.  */
++          if (bytes > (rs6000_max_block_clear ?
++             ((rs6000_max_block_clear > 256) ? 256 : rs6000_max_block_clear)  : 136))
++            return 0;
++        }
++      else if ((rs6000_cpu == PROCESSOR_PPC8540) && align >= 64)
++        {
++          /* Based on comparison of performance data between generating sequence
++             of store instructions (vector) and 'memset' call,'memset' executes faster if
++             the no of bytes is > 172.
++             An Upper bound limit has been set for the generation of store
++             instructions to prevent stack overflow due to code bloat.  */
++          if (bytes > (rs6000_max_block_clear ?
++             ((rs6000_max_block_clear > 256) ? 256 : rs6000_max_block_clear)  : 172))
++            return 0;
++        }
++      else if ((rs6000_cpu == PROCESSOR_PPCE5500 ||
++                rs6000_cpu == PROCESSOR_PPCE6500 ||
++                rs6000_cpu == PROCESSOR_PPCE500MC64) &&  TARGET_32BIT)
++        {
++          /* Based on comparison of performance data between generating sequence
++             of store instructions and 'memset' call,'memset' executes faster if
++             the no of bytes is > 120.
++             An Upper bound limit has been set for the generation of store
++             instructions to prevent stack overflow due to code bloat.  */
++          if (bytes > (rs6000_max_block_clear ?
++             ((rs6000_max_block_clear > 256) ? 256 : rs6000_max_block_clear)  : 120))
++            return 0;
++        }
++      else if ((rs6000_cpu == PROCESSOR_PPCE5500 ||
++                rs6000_cpu == PROCESSOR_PPCE6500 ||
++                rs6000_cpu == PROCESSOR_PPCE500MC64) &&  TARGET_64BIT)
++        {
++          /* Based on comparison of performance data between generating sequence
++             of store instructions and 'memset' call,'memset' executes faster if
++             the no of bytes is > 248.
++             An Upper bound limit has been set for the generation of store
++             instructions to prevent stack overflow due to code bloat.  */
++          if (bytes > (rs6000_max_block_clear ?
++             ((rs6000_max_block_clear > 512) ? 512 : rs6000_max_block_clear)  : 248))
++            return 0;
++        }
++          /* An Upper bound limit has been set for the generation of store
++             instructions to prevent stack overflow due to code bloat.  */
++      else if (bytes > (rs6000_max_block_clear ?
++              ((rs6000_max_block_clear > 256) ? 256 : rs6000_max_block_clear) : 8 * clear_step))
++        return 0;
++    }
++  else if (! optimize_size && bytes > 8 * clear_step)
+     return 0;
+ 
+   for (offset = 0; bytes > 0; offset += clear_bytes, bytes -= clear_bytes)
+diff -Naur gcc-4.8.1/gcc/config/rs6000/rs6000.opt gcc-4.8.1-MTWX51605-memset-array-init/gcc/config/rs6000/rs6000.opt
+--- gcc-4.8.1/gcc/config/rs6000/rs6000.opt	2013-06-07 08:09:43.660001466 -0500
++++ gcc-4.8.1-MTWX51605-memset-array-init/gcc/config/rs6000/rs6000.opt	2013-06-07 09:26:09.607001012 -0500
+@@ -157,6 +157,14 @@
+ Target Report Mask(MULTIPLE) Var(rs6000_isa_flags)
+ Generate load/store multiple instructions
+ 
++mmax_block_clear=
++Target RejectNegative Joined UInteger Var(rs6000_max_block_clear) Init(0)
++Maximum size in bytes above which generate string instructions for block clear
++
++mopt-memset
++Target Report Var(TARGET_OPT_MEMSET_STORE) Save
++If optimal emit sequence of stores for memset
++
+ mstring
+ Target Report Mask(STRING) Var(rs6000_isa_flags)
+ Generate string instructions for block moves
diff --git a/recipes-devtools/gcc/gcc-4.9/0027-cpp-honor-sysroot.patch b/recipes-devtools/gcc/gcc-4.9/0027-cpp-honor-sysroot.patch
new file mode 100644
index 0000000..05e9521
--- /dev/null
+++ b/recipes-devtools/gcc/gcc-4.9/0027-cpp-honor-sysroot.patch
@@ -0,0 +1,54 @@
+From a0f9bd09c816ad29ecf7c29d6c27f7df97710364 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem at gmail.com>
+Date: Fri, 29 Mar 2013 09:22:00 +0400
+Subject: [PATCH 27/35] cpp: honor sysroot.
+
+Currently, if the gcc toolchain is relocated and installed from sstate, then you try and compile
+preprocessed source (.i or .ii files), the compiler will try and access the builtin sysroot location
+rather than the --sysroot option specified on the commandline. If access to that directory is
+permission denied (unreadable), gcc will error.
+
+This happens when ccache is in use due to the fact it uses preprocessed source files.
+
+The fix below adds %I to the cpp-output spec macro so the default substitutions for -iprefix,
+-isystem, -isysroot happen and the correct sysroot is used.
+
+[YOCTO #2074]
+
+RP 2012/04/13
+
+Signed-off-by: Khem Raj <raj.khem at gmail.com>
+
+Upstream-Status: Pending
+---
+ gcc/cp/lang-specs.h |    2 +-
+ gcc/gcc.c           |    2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/gcc/cp/lang-specs.h b/gcc/cp/lang-specs.h
+index a001c3e..1aae1e4 100644
+--- a/gcc/cp/lang-specs.h
++++ b/gcc/cp/lang-specs.h
+@@ -63,5 +63,5 @@ along with GCC; see the file COPYING3.  If not see
+   {".ii", "@c++-cpp-output", 0, 0, 0},
+   {"@c++-cpp-output",
+    "%{!M:%{!MM:%{!E:\
+-    cc1plus -fpreprocessed %i %(cc1_options) %2\
++    cc1plus -fpreprocessed %i %I %(cc1_options) %2\
+     %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0},
+diff --git a/gcc/gcc.c b/gcc/gcc.c
+index 51062aa..cf6b99e 100644
+--- a/gcc/gcc.c
++++ b/gcc/gcc.c
+@@ -1042,7 +1042,7 @@ static const struct compiler default_compilers[] =
+                     %W{o*:--output-pch=%*}}%V}}}}}}", 0, 0, 0},
+   {".i", "@cpp-output", 0, 0, 0},
+   {"@cpp-output",
+-   "%{!M:%{!MM:%{!E:cc1 -fpreprocessed %i %(cc1_options) %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0},
++   "%{!M:%{!MM:%{!E:cc1 -fpreprocessed %i %I %(cc1_options) %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0},
+   {".s", "@assembler", 0, 0, 0},
+   {"@assembler",
+    "%{!M:%{!MM:%{!E:%{!S:as %(asm_debug) %(asm_options) %i %A }}}}", 0, 0, 0},
+-- 
+1.7.10.4
+
diff --git a/recipes-devtools/gcc/gcc-4.9/0027.gcc.fix_altivec_constant_alignment-v2.patch b/recipes-devtools/gcc/gcc-4.9/0027.gcc.fix_altivec_constant_alignment-v2.patch
new file mode 100644
index 0000000..36fb64d
--- /dev/null
+++ b/recipes-devtools/gcc/gcc-4.9/0027.gcc.fix_altivec_constant_alignment-v2.patch
@@ -0,0 +1,33 @@
+# Problem Statement:
+  Altivec vector load instruction accepts non-aligned offsets, but it
+  will silently ignore the last 4 bits, resulting in accessing the
+  wrong memory.
+
+  Increase alignment for vector constants to take care of 
+  unaligned access.
+
+  This patch resolves the run-time segmentation fault on e6500 board.
+
+# Reported by:
+  Edmar [29.May.2013]
+
+# Owned by:
+  Edmar & Rohit
+
+# Action:
+  * Update GCC target macro to align vector constants on 16-byte
+    boundary. 
+  
+diff -Naur gcc-4.7.2/gcc/config/rs6000/rs6000.h gcc-4.7.2-altivec_const_align/gcc/config/rs6000/rs6000.h
+--- gcc-4.7.2/gcc/config/rs6000/rs6000.h        2013-05-30 06:20:45.631000574 -0500
++++ gcc-4.7.2-altivec_const_align/gcc/config/rs6000/rs6000.h    2013-05-30 06:24:30.663001475 -0500
+@@ -748,7 +748,8 @@
+    && (STRICT_ALIGNMENT || !optimize_size)                       \
+    && (ALIGN) < BITS_PER_WORD                                    \
+    ? BITS_PER_WORD                                               \
+-   : (ALIGN))
++   : ((TARGET_ALTIVEC && (TREE_CODE (EXP) == VECTOR_CST)       \
++     && ((ALIGN) < 128)) ? 128 : (ALIGN)))
+
+ /* Make arrays of chars word-aligned for the same reasons.
+    Align vectors to 128 bits.  Align SPE vectors and E500 v2 doubles to
diff --git a/recipes-devtools/gcc/gcc-4.9/0028-MIPS64-Default-to-N64-ABI.patch b/recipes-devtools/gcc/gcc-4.9/0028-MIPS64-Default-to-N64-ABI.patch
new file mode 100644
index 0000000..2638720
--- /dev/null
+++ b/recipes-devtools/gcc/gcc-4.9/0028-MIPS64-Default-to-N64-ABI.patch
@@ -0,0 +1,31 @@
+From 301e18d4711db5925e767fad08dffa9cfe0a2f1f Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem at gmail.com>
+Date: Fri, 29 Mar 2013 09:23:08 +0400
+Subject: [PATCH 28/35] MIPS64: Default to N64 ABI
+
+MIPS64 defaults to n32 ABI, this patch makes it
+so that it defaults to N64 ABI
+
+Signed-off-by: Khem Raj <raj.khem at gmail.com>
+
+Upstream-Status: Inappropriate [OE config specific]
+---
+ gcc/config.gcc |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/gcc/config.gcc b/gcc/config.gcc
+index 1a0be50..989c2fb 100644
+--- a/gcc/config.gcc
++++ b/gcc/config.gcc
+@@ -1797,7 +1797,7 @@ mips*-mti-linux*)
+ 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 mips/linux-common.h"
+ 	tmake_file="${tmake_file} mips/t-linux64"
+-	tm_defines="${tm_defines} MIPS_ABI_DEFAULT=ABI_N32"
++	tm_defines="${tm_defines} MIPS_ABI_DEFAULT=ABI_64"
+ 	case ${target} in
+ 		mips64el-st-linux-gnu)
+ 			tm_file="${tm_file} mips/st.h"
+-- 
+1.7.10.4
+
diff --git a/recipes-devtools/gcc/gcc-4.9/0028.gcc.fix_altivec_reload_gs8.patch b/recipes-devtools/gcc/gcc-4.9/0028.gcc.fix_altivec_reload_gs8.patch
new file mode 100644
index 0000000..5fe0b25
--- /dev/null
+++ b/recipes-devtools/gcc/gcc-4.9/0028.gcc.fix_altivec_reload_gs8.patch
@@ -0,0 +1,29 @@
+# Problem Statement:
+  Office-2.gs8 ICE for alitvec targets e600/e6500.
+  Fix secondary reload addresses for Altivec targets.
+  
+# Reported by:
+  Rohit
+
+# Action:
+  This issue was first reported with one of the IBM's LE patch.
+  Reverted the change.
+
+diff -Naur gcc-4.8.3/gcc/config/rs6000/rs6000.c gcc-4.8.3-gs8-ice/gcc/config/rs6000/rs6000.c
+--- gcc-4.8.3/gcc/config/rs6000/rs6000.c	2014-08-31 01:54:57.844015000 -0500
++++ gcc-4.8.3-gs8-ice/gcc/config/rs6000/rs6000.c	2014-08-31 03:36:31.520015000 -0500
+@@ -17329,12 +17329,11 @@
+ 
+       if (legitimate_indirect_address_p (addr, false)	/* reg */
+ 	  || legitimate_indexed_address_p (addr, false)	/* reg+reg */
++	  || GET_CODE (addr) == PRE_MODIFY		/* VSX pre-modify */
+ 	  || (GET_CODE (addr) == AND			/* Altivec memory */
+-	      && rclass == ALTIVEC_REGS
+ 	      && GET_CODE (XEXP (addr, 1)) == CONST_INT
+ 	      && INTVAL (XEXP (addr, 1)) == -16
+-	      && (legitimate_indirect_address_p (XEXP (addr, 0), false)
+-		  || legitimate_indexed_address_p (XEXP (addr, 0), false))))
++	      && VECTOR_MEM_ALTIVEC_P (mode)))
+ 	;
+ 
+       else if (GET_CODE (addr) == PLUS)
diff --git a/recipes-devtools/gcc/gcc-4.9/0029-Define-GLIBC_DYNAMIC_LINKER-and-UCLIBC_DYNAMIC_LINKE.patch b/recipes-devtools/gcc/gcc-4.9/0029-Define-GLIBC_DYNAMIC_LINKER-and-UCLIBC_DYNAMIC_LINKE.patch
new file mode 100644
index 0000000..969d290
--- /dev/null
+++ b/recipes-devtools/gcc/gcc-4.9/0029-Define-GLIBC_DYNAMIC_LINKER-and-UCLIBC_DYNAMIC_LINKE.patch
@@ -0,0 +1,228 @@
+From 29d12344fb682a053de53eb08b95704cf3b67af2 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem at gmail.com>
+Date: Fri, 29 Mar 2013 09:24:50 +0400
+Subject: [PATCH 29/35] Define GLIBC_DYNAMIC_LINKER and UCLIBC_DYNAMIC_LINKER
+ relative to SYSTEMLIBS_DIR
+
+This patch defines GLIBC_DYNAMIC_LINKER and UCLIBC_DYNAMIC_LINKER
+relative to SYSTEMLIBS_DIR which can be set in generated headers
+This breaks the assumption of hardcoded multilib in gcc
+Change is only for the supported architectures in OE including
+SH, sparc, alpha for possible future support (if any)
+
+Removes the do_headerfix task in metadata
+
+Signed-off-by: Khem Raj <raj.khem at gmail.com>
+
+Upstream-Status: Inappropriate [OE configuration]
+---
+ gcc/config/alpha/linux-elf.h |    4 ++--
+ gcc/config/arm/linux-eabi.h  |    4 ++--
+ gcc/config/arm/linux-elf.h   |    2 +-
+ gcc/config/i386/linux.h      |    2 +-
+ gcc/config/i386/linux64.h    |    6 +++---
+ gcc/config/mips/linux.h      |    2 +-
+ gcc/config/mips/linux64.h    |    8 ++++----
+ gcc/config/rs6000/linux64.h  |    8 ++++----
+ gcc/config/sh/linux.h        |    2 +-
+ gcc/config/sparc/linux.h     |    2 +-
+ gcc/config/sparc/linux64.h   |    4 ++--
+ 11 files changed, 22 insertions(+), 22 deletions(-)
+
+Index: gcc-4.9.0/gcc/config/alpha/linux-elf.h
+===================================================================
+--- gcc-4.9.0.orig/gcc/config/alpha/linux-elf.h	2014-05-07 16:43:50.609106535 +0000
++++ gcc-4.9.0/gcc/config/alpha/linux-elf.h	2014-05-07 16:43:50.605106535 +0000
+@@ -23,8 +23,8 @@
+ #define EXTRA_SPECS \
+ { "elf_dynamic_linker", ELF_DYNAMIC_LINKER },
+ 
+-#define GLIBC_DYNAMIC_LINKER	"/lib/ld-linux.so.2"
+-#define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
++#define GLIBC_DYNAMIC_LINKER	SYSTEMLIBS_DIR "ld-linux.so.2"
++#define UCLIBC_DYNAMIC_LINKER  SYSTEMLIBS_DIR "ld-uClibc.so.0"
+ #if DEFAULT_LIBC == LIBC_UCLIBC
+ #define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}"
+ #elif DEFAULT_LIBC == LIBC_GLIBC
+Index: gcc-4.9.0/gcc/config/arm/linux-eabi.h
+===================================================================
+--- gcc-4.9.0.orig/gcc/config/arm/linux-eabi.h	2014-05-07 16:43:50.609106535 +0000
++++ gcc-4.9.0/gcc/config/arm/linux-eabi.h	2014-05-07 16:43:50.605106535 +0000
+@@ -68,8 +68,8 @@
+    GLIBC_DYNAMIC_LINKER_DEFAULT and TARGET_DEFAULT_FLOAT_ABI.  */
+ 
+ #undef  GLIBC_DYNAMIC_LINKER
+-#define GLIBC_DYNAMIC_LINKER_SOFT_FLOAT "/lib/ld-linux.so.3"
+-#define GLIBC_DYNAMIC_LINKER_HARD_FLOAT "/lib/ld-linux-armhf.so.3"
++#define GLIBC_DYNAMIC_LINKER_SOFT_FLOAT SYSTEMLIBS_DIR "ld-linux.so.3"
++#define GLIBC_DYNAMIC_LINKER_HARD_FLOAT SYSTEMLIBS_DIR "ld-linux-armhf.so.3"
+ #define GLIBC_DYNAMIC_LINKER_DEFAULT GLIBC_DYNAMIC_LINKER_SOFT_FLOAT
+ 
+ #define GLIBC_DYNAMIC_LINKER \
+Index: gcc-4.9.0/gcc/config/arm/linux-elf.h
+===================================================================
+--- gcc-4.9.0.orig/gcc/config/arm/linux-elf.h	2014-05-07 16:43:50.609106535 +0000
++++ gcc-4.9.0/gcc/config/arm/linux-elf.h	2014-05-07 16:43:50.605106535 +0000
+@@ -57,7 +57,7 @@
+ 
+ #define LIBGCC_SPEC "%{mfloat-abi=soft*:-lfloat} -lgcc"
+ 
+-#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
++#define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-linux.so.2"
+ 
+ #define LINUX_TARGET_LINK_SPEC  "%{h*} \
+    %{static:-Bstatic} \
+Index: gcc-4.9.0/gcc/config/i386/linux.h
+===================================================================
+--- gcc-4.9.0.orig/gcc/config/i386/linux.h	2014-05-07 16:43:50.609106535 +0000
++++ gcc-4.9.0/gcc/config/i386/linux.h	2014-05-07 16:43:50.605106535 +0000
+@@ -20,4 +20,4 @@
+ <http://www.gnu.org/licenses/>.  */
+ 
+ #define GNU_USER_LINK_EMULATION "elf_i386"
+-#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
++#define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-linux.so.2"
+Index: gcc-4.9.0/gcc/config/i386/linux64.h
+===================================================================
+--- gcc-4.9.0.orig/gcc/config/i386/linux64.h	2014-05-07 16:43:50.609106535 +0000
++++ gcc-4.9.0/gcc/config/i386/linux64.h	2014-05-07 16:43:50.605106535 +0000
+@@ -27,6 +27,6 @@
+ #define GNU_USER_LINK_EMULATION64 "elf_x86_64"
+ #define GNU_USER_LINK_EMULATIONX32 "elf32_x86_64"
+ 
+-#define GLIBC_DYNAMIC_LINKER32 "/lib/ld-linux.so.2"
+-#define GLIBC_DYNAMIC_LINKER64 "/lib64/ld-linux-x86-64.so.2"
+-#define GLIBC_DYNAMIC_LINKERX32 "/libx32/ld-linux-x32.so.2"
++#define GLIBC_DYNAMIC_LINKER32 SYSTEMLIBS_DIR "ld-linux.so.2"
++#define GLIBC_DYNAMIC_LINKER64 SYSTEMLIBS_DIR "ld-linux-x86-64.so.2"
++#define GLIBC_DYNAMIC_LINKERX32 SYSTEMLIBS_DIR "ld-linux-x32.so.2"
+Index: gcc-4.9.0/gcc/config/mips/linux.h
+===================================================================
+--- gcc-4.9.0.orig/gcc/config/mips/linux.h	2014-05-07 16:43:50.609106535 +0000
++++ gcc-4.9.0/gcc/config/mips/linux.h	2014-05-07 16:43:50.605106535 +0000
+@@ -18,8 +18,8 @@
+ <http://www.gnu.org/licenses/>.  */
+ 
+ #define GLIBC_DYNAMIC_LINKER \
+-  "%{mnan=2008:/lib/ld-linux-mipsn8.so.1;:/lib/ld.so.1}"
++  "%{mnan=2008:" SYSTEMLIBS_DIR "ld-linux-mipsn8.so.1;:" SYSTEMLIBS_DIR "ld.so.1}"
+ 
+ #undef UCLIBC_DYNAMIC_LINKER
+ #define UCLIBC_DYNAMIC_LINKER \
+-  "%{mnan=2008:/lib/ld-uClibc-mipsn8.so.0;:/lib/ld-uClibc.so.0}"
++  "%{mnan=2008:" SYSTEMLIBS_DIR "ld-uClibc-mipsn8.so.0;:" SYSTEMLIBS_DIR "ld-uClibc.so.0}"
+Index: gcc-4.9.0/gcc/config/mips/linux64.h
+===================================================================
+--- gcc-4.9.0.orig/gcc/config/mips/linux64.h	2014-05-07 16:43:50.609106535 +0000
++++ gcc-4.9.0/gcc/config/mips/linux64.h	2014-05-07 16:43:50.605106535 +0000
+@@ -23,20 +23,20 @@
+ #define GNU_USER_LINK_EMULATIONN32 "elf32%{EB:b}%{EL:l}tsmipn32"
+ 
+ #define GLIBC_DYNAMIC_LINKER32 \
+-  "%{mnan=2008:/lib/ld-linux-mipsn8.so.1;:/lib/ld.so.1}"
++  "%{mnan=2008:" SYSTEMLIBS_DIR "ld-linux-mipsn8.so.1;:" SYSTEMLIBS_DIR "ld.so.1}"
+ #define GLIBC_DYNAMIC_LINKER64 \
+-  "%{mnan=2008:/lib64/ld-linux-mipsn8.so.1;:/lib64/ld.so.1}"
++  "%{mnan=2008:" SYSTEMLIBS_DIR "ld-linux-mipsn8.so.1;:" SYSTEMLIBS_DIR "ld.so.1}"
+ #define GLIBC_DYNAMIC_LINKERN32 \
+-  "%{mnan=2008:/lib32/ld-linux-mipsn8.so.1;:/lib32/ld.so.1}"
++  "%{mnan=2008:" SYSTEMLIBS_DIR "ld-linux-mipsn8.so.1;:" SYSTEMLIBS_DIR "ld.so.1}"
+ 
+ #undef UCLIBC_DYNAMIC_LINKER32
+ #define UCLIBC_DYNAMIC_LINKER32 \
+-  "%{mnan=2008:/lib/ld-uClibc-mipsn8.so.0;:/lib/ld-uClibc.so.0}"
++  "%{mnan=2008:" SYSTEMLIBS_DIR "ld-uClibc-mipsn8.so.0;:" SYSTEMLIBS_DIR "ld-uClibc.so.0}"
+ #undef UCLIBC_DYNAMIC_LINKER64
+ #define UCLIBC_DYNAMIC_LINKER64 \
+-  "%{mnan=2008:/lib/ld64-uClibc-mipsn8.so.0;:/lib/ld64-uClibc.so.0}"
++  "%{mnan=2008:" SYSTEMLIBS_DIR "ld64-uClibc-mipsn8.so.0;:" SYSTEMLIBS_DIR "ld64-uClibc.so.0}"
+ #define UCLIBC_DYNAMIC_LINKERN32 \
+-  "%{mnan=2008:/lib32/ld-uClibc-mipsn8.so.0;:/lib32/ld-uClibc.so.0}"
++  "%{mnan=2008:" SYSTEMLIBS_DIR "ld-uClibc-mipsn8.so.0;:" SYSTEMLIBS_DIR "ld-uClibc.so.0}"
+ 
+ #define BIONIC_DYNAMIC_LINKERN32 "/system/bin/linker32"
+ #define GNU_USER_DYNAMIC_LINKERN32 \
+Index: gcc-4.9.0/gcc/config/rs6000/linux64.h
+===================================================================
+--- gcc-4.9.0.orig/gcc/config/rs6000/linux64.h	2014-05-07 16:43:50.609106535 +0000
++++ gcc-4.9.0/gcc/config/rs6000/linux64.h	2014-05-07 16:43:50.605106535 +0000
+@@ -367,14 +367,14 @@
+ #undef	LINK_OS_DEFAULT_SPEC
+ #define LINK_OS_DEFAULT_SPEC "%(link_os_linux)"
+ 
+-#define GLIBC_DYNAMIC_LINKER32 "/lib/ld.so.1"
++#define GLIBC_DYNAMIC_LINKER32 SYSTEMLIBS_DIR "ld.so.1"
+ #ifdef LINUX64_DEFAULT_ABI_ELFv2
+-#define GLIBC_DYNAMIC_LINKER64 "%{mabi=elfv1:/lib64/ld64.so.1;:/lib64/ld64.so.2}"
++#define GLIBC_DYNAMIC_LINKER64 "%{mabi=elfv1:" SYSTEMLIBS_DIR "ld64.so.1;:" SYSTEMLIBS_DIR "ld64.so.2}"
+ #else
+-#define GLIBC_DYNAMIC_LINKER64 "%{mabi=elfv2:/lib64/ld64.so.2;:/lib64/ld64.so.1}"
++#define GLIBC_DYNAMIC_LINKER64 "%{mabi=elfv2:" SYSTEMLIBS_DIR "ld64.so.2;:" SYSTEMLIBS_DIR "ld64.so.1}"
+ #endif
+-#define UCLIBC_DYNAMIC_LINKER32 "/lib/ld-uClibc.so.0"
+-#define UCLIBC_DYNAMIC_LINKER64 "/lib/ld64-uClibc.so.0"
++#define UCLIBC_DYNAMIC_LINKER32 SYSTEMLIBS_DIR "ld-uClibc.so.0"
++#define UCLIBC_DYNAMIC_LINKER64 SYSTEMLIBS_DIR "ld64-uClibc.so.0"
+ #if DEFAULT_LIBC == LIBC_UCLIBC
+ #define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}"
+ #elif DEFAULT_LIBC == LIBC_GLIBC
+Index: gcc-4.9.0/gcc/config/sh/linux.h
+===================================================================
+--- gcc-4.9.0.orig/gcc/config/sh/linux.h	2014-05-07 16:43:50.609106535 +0000
++++ gcc-4.9.0/gcc/config/sh/linux.h	2014-05-07 16:43:50.605106535 +0000
+@@ -43,7 +43,7 @@
+ 
+ #define TARGET_ASM_FILE_END file_end_indicate_exec_stack
+ 
+-#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
++#define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-linux.so.2"
+ 
+ #undef SUBTARGET_LINK_EMUL_SUFFIX
+ #define SUBTARGET_LINK_EMUL_SUFFIX "_linux"
+Index: gcc-4.9.0/gcc/config/sparc/linux.h
+===================================================================
+--- gcc-4.9.0.orig/gcc/config/sparc/linux.h	2014-05-07 16:43:50.609106535 +0000
++++ gcc-4.9.0/gcc/config/sparc/linux.h	2014-05-07 16:43:50.605106535 +0000
+@@ -83,7 +83,7 @@
+    When the -shared link option is used a final link is not being
+    done.  */
+ 
+-#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
++#define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-linux.so.2"
+ 
+ #undef  LINK_SPEC
+ #define LINK_SPEC "-m elf32_sparc %{shared:-shared} \
+Index: gcc-4.9.0/gcc/config/sparc/linux64.h
+===================================================================
+--- gcc-4.9.0.orig/gcc/config/sparc/linux64.h	2014-05-07 16:43:50.609106535 +0000
++++ gcc-4.9.0/gcc/config/sparc/linux64.h	2014-05-07 16:43:50.605106535 +0000
+@@ -92,8 +92,8 @@
+    When the -shared link option is used a final link is not being
+    done.  */
+ 
+-#define GLIBC_DYNAMIC_LINKER32 "/lib/ld-linux.so.2"
+-#define GLIBC_DYNAMIC_LINKER64 "/lib64/ld-linux.so.2"
++#define GLIBC_DYNAMIC_LINKER32 SYSTEMLIBS_DIR "ld-linux.so.2"
++#define GLIBC_DYNAMIC_LINKER64 SYSTEMLIBS_DIR "ld-linux.so.2"
+ 
+ #ifdef SPARC_BI_ARCH
+ 
+Index: gcc-4.9.0/gcc/config/linux.h
+===================================================================
+--- gcc-4.9.0.orig/gcc/config/linux.h	2014-05-07 16:43:50.609106535 +0000
++++ gcc-4.9.0/gcc/config/linux.h	2014-05-07 16:43:50.605106535 +0000
+@@ -73,10 +73,10 @@
+    GLIBC_DYNAMIC_LINKER must be defined for each target using them, or
+    GLIBC_DYNAMIC_LINKER32 and GLIBC_DYNAMIC_LINKER64 for targets
+    supporting both 32-bit and 64-bit compilation.  */
+-#define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
+-#define UCLIBC_DYNAMIC_LINKER32 "/lib/ld-uClibc.so.0"
+-#define UCLIBC_DYNAMIC_LINKER64 "/lib/ld64-uClibc.so.0"
+-#define UCLIBC_DYNAMIC_LINKERX32 "/lib/ldx32-uClibc.so.0"
++#define UCLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-uClibc.so.0"
++#define UCLIBC_DYNAMIC_LINKER32 SYSTEMLIBS_DIR "ld-uClibc.so.0"
++#define UCLIBC_DYNAMIC_LINKER64 SYSTEMLIBS_DIR "ld64-uClibc.so.0"
++#define UCLIBC_DYNAMIC_LINKERX32 SYSTEMLIBS_DIR "ldx32-uClibc.so.0"
+ #define BIONIC_DYNAMIC_LINKER "/system/bin/linker"
+ #define BIONIC_DYNAMIC_LINKER32 "/system/bin/linker"
+ #define BIONIC_DYNAMIC_LINKER64 "/system/bin/linker64"
diff --git a/recipes-devtools/gcc/gcc-4.9/0029.gcc.fix_postfix_gimplifier.patch b/recipes-devtools/gcc/gcc-4.9/0029.gcc.fix_postfix_gimplifier.patch
new file mode 100644
index 0000000..d2526ed
--- /dev/null
+++ b/recipes-devtools/gcc/gcc-4.9/0029.gcc.fix_postfix_gimplifier.patch
@@ -0,0 +1,92 @@
+# Problem Statement:
+  With Flag mining options, EEMBC benchmarks [consumer-1.cjpeg,consumer-1.djpej]
+  showed performance degradation when built with GCC v4.8.1.
+
+# Reported by:
+  Edmar Wienskoski
+
+# Owned by:
+  Rohit
+
+# Action:
+  The issue was the way gimplifier was handing postfix operations
+  (self modifying expression) in GCC v4.8.1 compared to v4.7.3.
+ 
+  GCC v4.8.1 source was changed to confirm with C11 standard.
+  This is not a BUG.
+  http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48814
+
+  Added flag '-fdisable-c11-self-mod-expr' to recover performance loss. 
+
+
+diff -Naur gcc-4.8.2/gcc/common.opt gcc-4.8.2-gimplify-selfmod-expr/gcc/common.opt
+--- gcc-4.8.2/gcc/common.opt	2014-02-24 03:29:58.689893016 -0600
++++ gcc-4.8.2-gimplify-selfmod-expr/gcc/common.opt	2014-02-24 07:30:28.930815001 -0600
+@@ -1035,6 +1035,10 @@
+ Common Joined RejectNegative Var(common_deferred_options) Defer
+ -fdisable-[tree|rtl|ipa]-<pass>=range1+range2 disables an optimization pass
+ 
++fdisable-c11-self-mod-expr
++Common RejectNegative Report Var(flag_disable_c11_self_mod_expr) Init(0) Optimization
++Disable c11 restriction on self modifying expression of gimplifier
++
+ fenable-
+ Common Joined RejectNegative Var(common_deferred_options) Defer
+ -fenable-[tree|rtl|ipa]-<pass>=range1+range2 enables an optimization pass
+diff -Naur gcc-4.8.2/gcc/gimplify.c gcc-4.8.2-gimplify-selfmod-expr/gcc/gimplify.c
+--- gcc-4.8.2/gcc/gimplify.c	2014-02-24 03:29:08.229893001 -0600
++++ gcc-4.8.2-gimplify-selfmod-expr/gcc/gimplify.c	2014-02-24 07:36:24.403815001 -0600
+@@ -2393,11 +2393,20 @@
+      that as the result value and in the postqueue operation.  */
+   if (postfix)
+     {
++      if (flag_disable_c11_self_mod_expr && !is_gimple_min_lval (lvalue))
++        {
++	   mark_addressable (lvalue);
++	   lvalue = build_fold_addr_expr_loc (input_location, lvalue);
++	   gimplify_expr (&lvalue, pre_p, post_p, is_gimple_val, fb_rvalue);
++	   lvalue = build_fold_indirect_ref_loc (input_location, lvalue);
++        }
++
+       ret = gimplify_expr (&lhs, pre_p, post_p, is_gimple_val, fb_rvalue);
+       if (ret == GS_ERROR)
+-	return ret;
+-
+-      lhs = get_initialized_tmp_var (lhs, pre_p, NULL);
++        return ret;
++	  
++      if (!flag_disable_c11_self_mod_expr)
++        lhs = get_initialized_tmp_var (lhs, pre_p, NULL);
+     }
+ 
+   /* For POINTERs increment, use POINTER_PLUS_EXPR.  */
+@@ -2405,18 +2414,25 @@
+     {
+       rhs = convert_to_ptrofftype_loc (loc, rhs);
+       if (arith_code == MINUS_EXPR)
+-	rhs = fold_build1_loc (loc, NEGATE_EXPR, TREE_TYPE (rhs), rhs);
+-      t1 = fold_build2 (POINTER_PLUS_EXPR, TREE_TYPE (*expr_p), lhs, rhs);
++        rhs = fold_build1_loc (loc, NEGATE_EXPR, TREE_TYPE (rhs), rhs);
++		
++      if (flag_disable_c11_self_mod_expr)
++        arith_code = POINTER_PLUS_EXPR;
++      else
++        t1 = fold_build2 (POINTER_PLUS_EXPR, TREE_TYPE (*expr_p), lhs, rhs);
+     }
+-  else
++  else if (!flag_disable_c11_self_mod_expr)
+     t1 = fold_convert (TREE_TYPE (*expr_p),
+ 		       fold_build2 (arith_code, arith_type,
+ 				    fold_convert (arith_type, lhs),
+ 				    fold_convert (arith_type, rhs)));
+ 
++  if (flag_disable_c11_self_mod_expr)
++    t1 = build2 (arith_code, TREE_TYPE (*expr_p), lhs, rhs);
++
+   if (postfix)
+     {
+-      gimplify_assign (lvalue, t1, pre_p);
++      gimplify_assign (lvalue, t1, ((flag_disable_c11_self_mod_expr) ? orig_post_p : pre_p));
+       gimplify_seq_add_seq (orig_post_p, post);
+       *expr_p = lhs;
+       return GS_ALL_DONE;
diff --git a/recipes-devtools/gcc/gcc-4.9/0030-gcc-Fix-argument-list-too-long-error.patch b/recipes-devtools/gcc/gcc-4.9/0030-gcc-Fix-argument-list-too-long-error.patch
new file mode 100644
index 0000000..2ceaff6
--- /dev/null
+++ b/recipes-devtools/gcc/gcc-4.9/0030-gcc-Fix-argument-list-too-long-error.patch
@@ -0,0 +1,40 @@
+From c1816c160156f99c34e6a0a0311bb0219326804e Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem at gmail.com>
+Date: Fri, 29 Mar 2013 09:26:37 +0400
+Subject: [PATCH 30/35] gcc: Fix argument list too long error.
+
+There would be an "Argument list too long" error when the
+build directory is longer than 200, this is caused by:
+
+headers=`echo $(PLUGIN_HEADERS) | tr ' ' '\012' | sort -u`
+
+The PLUGIN_HEADERS is too long before sort, so the "echo" can't handle
+it, use the $(sort list) of GNU make which can handle the too long list
+would fix the problem, the header would be short enough after sorted.
+The "tr ' ' '\012'" was used for translating the space to "\n", the
+$(sort list) doesn't need this.
+
+Signed-off-by: Robert Yang <liezhi.yang at windriver.com>
+Signed-off-by: Khem Raj <raj.khem at gmail.com>
+
+Upstream-Status: Pending
+---
+ gcc/Makefile.in |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/gcc/Makefile.in b/gcc/Makefile.in
+index 2320497..8562a62 100644
+--- a/gcc/Makefile.in
++++ b/gcc/Makefile.in
+@@ -4627,7 +4627,7 @@ install-plugin: installdirs lang.install-plugin s-header-vars install-gengtype
+ # We keep the directory structure for files in config or c-family and .def
+ # files. All other files are flattened to a single directory.
+ 	$(mkinstalldirs) $(DESTDIR)$(plugin_includedir)
+-	headers=`echo $(PLUGIN_HEADERS) | tr ' ' '\012' | sort -u`; \
++	headers="$(sort $(PLUGIN_HEADERS))"; \
+ 	srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`; \
+ 	for file in $$headers; do \
+ 	  if [ -f $$file ] ; then \
+-- 
+1.7.10.4
+
diff --git a/recipes-devtools/gcc/gcc-4.9/0030.gcc.fix_adjust_address_cost.patch b/recipes-devtools/gcc/gcc-4.9/0030.gcc.fix_adjust_address_cost.patch
new file mode 100644
index 0000000..9607b15
--- /dev/null
+++ b/recipes-devtools/gcc/gcc-4.9/0030.gcc.fix_adjust_address_cost.patch
@@ -0,0 +1,346 @@
+# Problem Statement:
+  Fix Dhrystone degradation with GCC v492.
+  Target: e5500 64-bit.
+
+# Owned by:
+  Rohit
+
+# Action:
+  * Adjust the address cost while accessing constant addresses
+    so that it is profitable for loop invariant code.
+
+  * Referenced test case part of dhrystone benchmark code.
+
+diff -Naur gcc-4.9.2/gcc/config/rs6000/rs6000.c gcc-4.9.2-patch/gcc/config/rs6000/rs6000.c
+--- gcc-4.9.2/gcc/config/rs6000/rs6000.c	2014-10-12 21:33:20.000000000 -0500
++++ gcc-4.9.2-patch/gcc/config/rs6000/rs6000.c	2014-11-22 13:38:52.939563569 -0600
+@@ -1460,7 +1460,7 @@
+ #undef TARGET_RTX_COSTS
+ #define TARGET_RTX_COSTS rs6000_rtx_costs
+ #undef TARGET_ADDRESS_COST
+-#define TARGET_ADDRESS_COST hook_int_rtx_mode_as_bool_0
++#define TARGET_ADDRESS_COST rs6000_address_costs
+ 
+ #undef TARGET_DWARF_REGISTER_SPAN
+ #define TARGET_DWARF_REGISTER_SPAN rs6000_dwarf_register_span
+@@ -29899,6 +29899,24 @@
+   return ret;
+ }
+ 
++/* Address cost calculation.
++ * FIXME: Handle all addressing types */
++
++static int
++rs6000_address_costs (rtx x, enum machine_mode mode ATTRIBUTE_UNUSED,
++		   addr_space_t as ATTRIBUTE_UNUSED,
++		   bool speed ATTRIBUTE_UNUSED)
++{
++  if (toc_relative_expr_p (x, false))
++    {
++      rtx temp = XVECEXP (tocrel_base, 0, 0);
++      if (GET_CODE (temp) != SYMBOL_REF)
++        return 0;
++      return 5;
++    }
++  return 0; 
++}
++
+ /* Debug form of ADDRESS_COST that is selected if -mdebug=cost.  */
+ 
+ static int
+diff -Naur gcc-4.9.2/gcc/testsuite/gcc.target/powerpc/ppc-fsl-loop-inv-2.c gcc-4.9.2-patch/gcc/testsuite/gcc.target/powerpc/ppc-fsl-loop-inv-2.c
+--- gcc-4.9.2/gcc/testsuite/gcc.target/powerpc/ppc-fsl-loop-inv-2.c	1969-12-31 18:00:00.000000000 -0600
++++ gcc-4.9.2-patch/gcc/testsuite/gcc.target/powerpc/ppc-fsl-loop-inv-2.c	2015-01-22 16:07:13.614626997 -0600
+@@ -0,0 +1,292 @@
++/* { dg-do compile { target { powerpc*-*-* && lp64 } } } */
++/* { dg-options "-O3 -m64 -fdump-rtl-loop2_invariant" } */
++/* { dg-final { scan-rtl-dump-times "Decided to move" 16 "loop2_invariant"} } */
++/* { dg-final { cleanup-rtl-dump "loop2_invariant" } } */
++
++#include <stdio.h>
++#include <string.h>
++
++typedef enum {Ident_1, Ident_2, Ident_3, Ident_4, Ident_5}
++                Enumeration;
++typedef int One_Thirty;
++typedef int One_Fifty;
++typedef char Capital_Letter;
++typedef int Boolean;
++typedef char Str_30 [31];
++typedef int Arr_1_Dim [50];
++typedef int Arr_2_Dim [50] [50];
++
++typedef struct record
++{
++  struct record *Ptr_Comp;
++  Enumeration Discr;
++  union {
++    struct {
++      Enumeration Enum_Comp;
++      int Int_Comp;
++      char Str_Comp [31];
++    } var_1;
++    struct {
++      Enumeration E_Comp_2;
++      char Str_2_Comp [31];
++    } var_2;
++    struct {
++      char Ch_1_Comp;
++      char Ch_2_Comp;
++    } var_3;
++  } variant;
++} Rec_Type, *Rec_Pointer;
++
++Rec_Pointer Ptr_Glob, Next_Ptr_Glob;
++int Int_Glob;
++Boolean Bool_Glob;
++char Ch_1_Glob, Ch_2_Glob;
++int Arr_1_Glob [50];
++int Arr_2_Glob [50] [50];
++char Reg_Define[] = "Register option selected.";
++double Begin_Time, End_Time, User_Time;
++double Microseconds, Dhrystones_Per_Second, Vax_Mips;
++
++Enumeration Func_1 ();
++void exit (int);
++
++void main ()
++{
++  double dtime();
++  One_Fifty Int_1_Loc;
++  One_Fifty Int_2_Loc;
++  One_Fifty Int_3_Loc;
++  char Ch_Index;
++  Enumeration Enum_Loc;
++  Str_30 Str_1_Loc;
++  Str_30 Str_2_Loc;
++  int Run_Index;
++  int Number_Of_Runs;
++
++  FILE *Ap;
++
++
++
++  if ((Ap = fopen("dhry.res","a+")) == ((void *)0))
++    {
++       printf("Can not open dhry.res\n\n");
++       exit(1);
++    }
++
++  Next_Ptr_Glob = (Rec_Pointer) malloc (sizeof (Rec_Type));
++  Ptr_Glob = (Rec_Pointer) malloc (sizeof (Rec_Type));
++
++  Ptr_Glob->Ptr_Comp = Next_Ptr_Glob;
++  Ptr_Glob->Discr = Ident_1;
++  Ptr_Glob->variant.var_1.Enum_Comp = Ident_3;
++  Ptr_Glob->variant.var_1.Int_Comp = 40;
++  strcpy (Ptr_Glob->variant.var_1.Str_Comp,
++          "DHRYSTONE PROGRAM, SOME STRING");
++  strcpy (Str_1_Loc, "DHRYSTONE PROGRAM, 1'ST STRING");
++
++  Arr_2_Glob [8][7] = 10;
++
++  printf ("\n");
++  printf ("Dhrystone Benchmark, Version 2.1 (Language: C)\n");
++  printf ("\n");
++  printf ("Please give the number of runs through the benchmark: ");
++  {
++    int n;
++    scanf ("%d", &n);
++    Number_Of_Runs = n;
++  }
++  printf ("\n");
++  printf ("Execution starts, %d runs through Dhrystone\n",Number_Of_Runs);
++
++  Begin_Time = dtime();
++  for (Run_Index = 1; Run_Index <= Number_Of_Runs; ++Run_Index)
++  {
++
++    Proc_5();
++    Proc_4();
++
++    Int_1_Loc = 2;
++    Int_2_Loc = 3;
++    strcpy (Str_2_Loc, "DHRYSTONE PROGRAM, 2'ND STRING");
++    Enum_Loc = Ident_2;
++    Bool_Glob = ! Func_2 (Str_1_Loc, Str_2_Loc);
++
++    while (Int_1_Loc < Int_2_Loc)
++    {
++      Int_3_Loc = 5 * Int_1_Loc - Int_2_Loc;
++      Proc_7 (Int_1_Loc, Int_2_Loc, &Int_3_Loc);
++      Int_1_Loc += 1;
++    }
++
++    Proc_8 (Arr_1_Glob, Arr_2_Glob, Int_1_Loc, Int_3_Loc);
++
++    Proc_1 (Ptr_Glob);
++    for (Ch_Index = 'A'; Ch_Index <= Ch_2_Glob; ++Ch_Index)
++    {
++      if (Enum_Loc == Func_1 (Ch_Index, 'C'))
++
++        {
++          Proc_6 (Ident_1, &Enum_Loc);
++          strcpy (Str_2_Loc, "DHRYSTONE PROGRAM, 3'RD STRING");
++          Int_2_Loc = Run_Index;
++          Int_Glob = Run_Index;
++        }
++    }
++    Int_2_Loc = Int_2_Loc * Int_1_Loc;
++    Int_1_Loc = Int_2_Loc / Int_3_Loc;
++    Int_2_Loc = 7 * (Int_2_Loc - Int_3_Loc) - Int_1_Loc;
++    Proc_2 (&Int_1_Loc);
++  }
++  End_Time = dtime();
++
++  printf ("Execution ends\n");
++  printf ("\n");
++  printf ("Final values of the variables used in the benchmark:\n");
++  printf ("\n");
++  printf ("Int_Glob:            %d\n", Int_Glob);
++  printf ("        should be:   %d\n", 5);
++  printf ("Bool_Glob:           %d\n", Bool_Glob);
++  printf ("        should be:   %d\n", 1);
++  printf ("Ch_1_Glob:           %c\n", Ch_1_Glob);
++  printf ("        should be:   %c\n", 'A');
++  printf ("Ch_2_Glob:           %c\n", Ch_2_Glob);
++  printf ("        should be:   %c\n", 'B');
++  printf ("Arr_1_Glob[8]:       %d\n", Arr_1_Glob[8]);
++  printf ("        should be:   %d\n", 7);
++  printf ("Arr_2_Glob[8][7]:    %d\n", Arr_2_Glob[8][7]);
++  printf ("        should be:   Number_Of_Runs + 10\n");
++  printf ("Ptr_Glob->\n");
++  printf ("  Ptr_Comp:          %d\n", Ptr_Glob->Ptr_Comp);
++  printf ("        should be:   (implementation-dependent)\n");
++  printf ("  Discr:             %d\n", Ptr_Glob->Discr);
++  printf ("        should be:   %d\n", 0);
++  printf ("  Enum_Comp:         %d\n", Ptr_Glob->variant.var_1.Enum_Comp);
++  printf ("        should be:   %d\n", 2);
++  printf ("  Int_Comp:          %d\n", Ptr_Glob->variant.var_1.Int_Comp);
++  printf ("        should be:   %d\n", 17);
++  printf ("  Str_Comp:          %s\n", Ptr_Glob->variant.var_1.Str_Comp);
++  printf ("        should be:   DHRYSTONE PROGRAM, SOME STRING\n");
++  printf ("Next_Ptr_Glob->\n");
++  printf ("  Ptr_Comp:          %d\n", Next_Ptr_Glob->Ptr_Comp);
++  printf ("        should be:   (implementation-dependent), same as above\n");
++  printf ("  Discr:             %d\n", Next_Ptr_Glob->Discr);
++  printf ("        should be:   %d\n", 0);
++  printf ("  Enum_Comp:         %d\n", Next_Ptr_Glob->variant.var_1.Enum_Comp);
++  printf ("        should be:   %d\n", 1);
++  printf ("  Int_Comp:          %d\n", Next_Ptr_Glob->variant.var_1.Int_Comp);
++  printf ("        should be:   %d\n", 18);
++  printf ("  Str_Comp:          %s\n", Next_Ptr_Glob->variant.var_1.Str_Comp);
++  printf ("        should be:   DHRYSTONE PROGRAM, SOME STRING\n");
++  printf ("Int_1_Loc:           %d\n", Int_1_Loc);
++  printf ("        should be:   %d\n", 5);
++  printf ("Int_2_Loc:           %d\n", Int_2_Loc);
++  printf ("        should be:   %d\n", 13);
++  printf ("Int_3_Loc:           %d\n", Int_3_Loc);
++  printf ("        should be:   %d\n", 7);
++  printf ("Enum_Loc:            %d\n", Enum_Loc);
++  printf ("        should be:   %d\n", 1);
++  printf ("Str_1_Loc:           %s\n", Str_1_Loc);
++  printf ("        should be:   DHRYSTONE PROGRAM, 1'ST STRING\n");
++  printf ("Str_2_Loc:           %s\n", Str_2_Loc);
++  printf ("        should be:   DHRYSTONE PROGRAM, 2'ND STRING\n");
++  printf ("\n");
++
++  User_Time = End_Time - Begin_Time;
++
++  if (User_Time < 2)
++  {
++    printf ("Measured time too small to obtain meaningful results\n");
++    printf ("Please increase number of runs\n");
++    printf ("\n");
++  }
++  else
++  {
++    Microseconds = User_Time * 1000000.0
++                        / (double) Number_Of_Runs;
++    Dhrystones_Per_Second = (double) Number_Of_Runs / User_Time;
++    Vax_Mips = Dhrystones_Per_Second / 1757.0;
++
++    printf ("Register option selected?  NO\n");
++    strcpy(Reg_Define, "Register option not selected.");
++
++    printf ("Microseconds for one run through Dhrystone: ");
++    printf ("%7.1lf \n", Microseconds);
++    printf ("Dhrystones per Second:                      ");
++    printf ("%10.1lf \n", Dhrystones_Per_Second);
++    printf ("VAX MIPS rating = %10.3lf \n",Vax_Mips);
++    printf ("\n");
++
++    fprintf(Ap,"\n");
++    fprintf(Ap,"Dhrystone Benchmark, Version 2.1 (Language: C)\n");
++    fprintf(Ap,"%s\n",Reg_Define);
++    fprintf(Ap,"Microseconds for one loop: %7.1lf\n",Microseconds);
++    fprintf(Ap,"Dhrystones per second: %10.1lf\n",Dhrystones_Per_Second);
++    fprintf(Ap,"VAX MIPS rating: %10.3lf\n",Vax_Mips);
++    fclose(Ap);
++  }
++}
++
++Proc_1 (Ptr_Val_Par)
++Rec_Pointer Ptr_Val_Par;
++{
++  Rec_Pointer Next_Record = Ptr_Val_Par->Ptr_Comp;
++  *Ptr_Val_Par->Ptr_Comp = *Ptr_Glob;
++  Ptr_Val_Par->variant.var_1.Int_Comp = 5;
++  Next_Record->variant.var_1.Int_Comp
++        = Ptr_Val_Par->variant.var_1.Int_Comp;
++  Next_Record->Ptr_Comp = Ptr_Val_Par->Ptr_Comp;
++  Proc_3 (&Next_Record->Ptr_Comp);
++
++  if (Next_Record->Discr == Ident_1)
++  {
++    Next_Record->variant.var_1.Int_Comp = 6;
++    Proc_6 (Ptr_Val_Par->variant.var_1.Enum_Comp,
++           &Next_Record->variant.var_1.Enum_Comp);
++    Next_Record->Ptr_Comp = Ptr_Glob->Ptr_Comp;
++    Proc_7 (Next_Record->variant.var_1.Int_Comp, 10,
++           &Next_Record->variant.var_1.Int_Comp);
++  }
++  else
++    *Ptr_Val_Par = *Ptr_Val_Par->Ptr_Comp;
++}
++
++
++Proc_2 (Int_Par_Ref)
++One_Fifty *Int_Par_Ref;
++{
++  One_Fifty Int_Loc;
++  Enumeration Enum_Loc;
++  Int_Loc = *Int_Par_Ref + 10;
++  do
++    if (Ch_1_Glob == 'A')
++    {
++      Int_Loc -= 1;
++      *Int_Par_Ref = Int_Loc - Int_Glob;
++      Enum_Loc = Ident_1;
++    }
++  while (Enum_Loc != Ident_1);
++}
++
++
++Proc_3 (Ptr_Ref_Par)
++Rec_Pointer *Ptr_Ref_Par;
++
++{
++  if (Ptr_Glob != 0)
++    *Ptr_Ref_Par = Ptr_Glob->Ptr_Comp;
++  Proc_7 (10, Int_Glob, &Ptr_Glob->variant.var_1.Int_Comp);
++}
++
++Proc_4 ()
++{
++  Boolean Bool_Loc;
++  Bool_Loc = Ch_1_Glob == 'A';
++  Bool_Glob = Bool_Loc | Bool_Glob;
++  Ch_2_Glob = 'B';
++}
++
++Proc_5 ()
++{
++  Ch_1_Glob = 'A';
++  Bool_Glob = 0;
++}
diff --git a/recipes-devtools/gcc/gcc-4.9/0031-Disable-sdt.patch b/recipes-devtools/gcc/gcc-4.9/0031-Disable-sdt.patch
new file mode 100644
index 0000000..2c1d5e0
--- /dev/null
+++ b/recipes-devtools/gcc/gcc-4.9/0031-Disable-sdt.patch
@@ -0,0 +1,113 @@
+From b85265bc94ec1beaf1d3b697c03db62991553467 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem at gmail.com>
+Date: Fri, 29 Mar 2013 09:28:10 +0400
+Subject: [PATCH 31/35] Disable sdt.
+
+We don't list dtrace in DEPENDS so we shouldn't be depending on this header.
+It may or may not exist from preivous builds though. To be determinstic, disable
+sdt.h usage always. This avoids build failures if the header is removed after configure
+but before libgcc is compiled for example.
+
+RP 2012/8/7
+
+Signed-off-by: Khem Raj <raj.khem at gmail.com>
+
+Disable sdt for libstdc++-v3.
+
+Signed-off-by: Robert Yang <liezhi.yang at windriver.com>
+
+Upstream-Status: Inappropriate [hack]
+---
+ gcc/configure             | 12 ++++++------
+ gcc/configure.ac          | 18 +++++++++---------
+ libstdc++-v3/configure    |  6 +++---
+ libstdc++-v3/configure.ac |  2 +-
+ 4 files changed, 19 insertions(+), 19 deletions(-)
+
+diff --git a/gcc/configure b/gcc/configure
+index 3c550a6..01c7626 100755
+--- a/gcc/configure
++++ b/gcc/configure
+@@ -26812,12 +26812,12 @@ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking sys/sdt.h in the target C library" >&5
+ $as_echo_n "checking sys/sdt.h in the target C library... " >&6; }
+ have_sys_sdt_h=no
+-if test -f $target_header_dir/sys/sdt.h; then
+-  have_sys_sdt_h=yes
+-
+-$as_echo "#define HAVE_SYS_SDT_H 1" >>confdefs.h
+-
+-fi
++#if test -f $target_header_dir/sys/sdt.h; then
++#  have_sys_sdt_h=yes
++#
++#$as_echo "#define HAVE_SYS_SDT_H 1" >>confdefs.h
++#
++#fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_sys_sdt_h" >&5
+ $as_echo "$have_sys_sdt_h" >&6; }
+ 
+diff --git a/gcc/configure.ac b/gcc/configure.ac
+index 3601ab6..06e501f 100644
+--- a/gcc/configure.ac
++++ b/gcc/configure.ac
+@@ -4779,15 +4779,15 @@ if test x$gcc_cv_libc_provides_ssp = xyes; then
+ fi
+ 
+ # Test for <sys/sdt.h> on the target.
+-GCC_TARGET_TEMPLATE([HAVE_SYS_SDT_H])
+-AC_MSG_CHECKING(sys/sdt.h in the target C library)
+-have_sys_sdt_h=no
+-if test -f $target_header_dir/sys/sdt.h; then
+-  have_sys_sdt_h=yes
+-  AC_DEFINE(HAVE_SYS_SDT_H, 1,
+-            [Define if your target C library provides sys/sdt.h])
+-fi
+-AC_MSG_RESULT($have_sys_sdt_h)
++#GCC_TARGET_TEMPLATE([HAVE_SYS_SDT_H])
++#AC_MSG_CHECKING(sys/sdt.h in the target C library)
++#have_sys_sdt_h=no
++#if test -f $target_header_dir/sys/sdt.h; then
++#  have_sys_sdt_h=yes
++#  AC_DEFINE(HAVE_SYS_SDT_H, 1,
++#            [Define if your target C library provides sys/sdt.h])
++#fi
++#AC_MSG_RESULT($have_sys_sdt_h)
+ 
+ # Check if TFmode long double should be used by default or not.
+ # Some glibc targets used DFmode long double, but with glibc 2.4
+diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure
+index 4953c9f..53a1145 100755
+--- a/libstdc++-v3/configure
++++ b/libstdc++-v3/configure
+@@ -20578,11 +20578,11 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ ac_compiler_gnu=$ac_cv_c_compiler_gnu
+ 
+-  if test $glibcxx_cv_sys_sdt_h = yes; then
++#  if test $glibcxx_cv_sys_sdt_h = yes; then
+ 
+-$as_echo "#define HAVE_SYS_SDT_H 1" >>confdefs.h
++#$as_echo "#define HAVE_SYS_SDT_H 1" >>confdefs.h
+ 
+-  fi
++#  fi
+   { $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_cv_sys_sdt_h" >&5
+ $as_echo "$glibcxx_cv_sys_sdt_h" >&6; }
+ 
+diff --git a/libstdc++-v3/configure.ac b/libstdc++-v3/configure.ac
+index 73d430a..f2135e2 100644
+--- a/libstdc++-v3/configure.ac
++++ b/libstdc++-v3/configure.ac
+@@ -211,7 +211,7 @@ GLIBCXX_CHECK_SC_NPROCESSORS_ONLN
+ GLIBCXX_CHECK_SC_NPROC_ONLN
+ GLIBCXX_CHECK_PTHREADS_NUM_PROCESSORS_NP
+ GLIBCXX_CHECK_SYSCTL_HW_NCPU
+-GLIBCXX_CHECK_SDT_H
++#GLIBCXX_CHECK_SDT_H
+ 
+ # Check for available headers.
+ AC_CHECK_HEADERS([endian.h execinfo.h float.h fp.h ieeefp.h inttypes.h \
+-- 
+1.8.3.1
+
diff --git a/recipes-devtools/gcc/gcc-4.9/0031.gcc.fix_adjust_sched_loopinv_cost.patch b/recipes-devtools/gcc/gcc-4.9/0031.gcc.fix_adjust_sched_loopinv_cost.patch
new file mode 100644
index 0000000..4ca0cc7
--- /dev/null
+++ b/recipes-devtools/gcc/gcc-4.9/0031.gcc.fix_adjust_sched_loopinv_cost.patch
@@ -0,0 +1,154 @@
+# Problem Statement:
+  Fix office-1.dither01 degradation with GCC v492.
+
+  Targets: e500mc & e5500 (32-bit).
+
+  There were 2 issues:
+  
+  a) lwzx and dependent cmp instruction were scheduled too close.
+  b) Loop invariant code being not moved out.
+
+# Owned by:
+  Rohit
+
+# Action:
+  a) Adjust the scheduler cost between lwzx and dependent cmp instruction
+     so that the lwzx instruction gets scheduled earlier.
+
+  b) Adjust the address cost so that the loop invariant code gets moved out.
+     Since the same cost calculation affects forward propagation, it causes
+     degradation in other benchmarks. So make this change specific to loop 
+     invariant code optimization.
+
+  c) Referenced test case is part of 'dither' benchmark code.
+
+diff -Naur gcc-4.9.2/gcc/config/rs6000/rs6000.c gcc-4.9.2-patch/gcc/config/rs6000/rs6000.c
+--- gcc-4.9.2/gcc/config/rs6000/rs6000.c	2014-12-05 08:22:21.436670465 -0600
++++ gcc-4.9.2-patch/gcc/config/rs6000/rs6000.c	2014-12-05 08:24:04.223669496 -0600
+@@ -27009,6 +27009,19 @@
+             break;
+           }
+ 
++      if ((rs6000_cpu == CPU_PPCE500MC
++          || rs6000_cpu_attr == CPU_PPCE500MC64
++          || rs6000_cpu_attr == CPU_PPCE5500
++          || rs6000_cpu_attr == CPU_PPCE6500)
++          && recog_memoized (dep_insn)
++          && (INSN_CODE (dep_insn) >= 0)
++          && (GET_CODE (PATTERN (insn)) == SET)
++          && (GET_CODE (PATTERN (dep_insn)) == SET) 
++          && (get_attr_type (insn) == TYPE_CMP)
++          && (get_attr_type (dep_insn) == TYPE_LOAD)
++          && (GET_CODE (XEXP (PATTERN (dep_insn), 1)) == MEM)
++          && legitimate_indexed_address_p (XEXP((XEXP (PATTERN (dep_insn), 1)),0), false))
++        return cost + 3;
+ 	/* Fall out to return default cost.  */
+       }
+       break;
+diff -Naur gcc-4.9.2/gcc/config/rs6000/rs6000.c gcc-4.9.2-loop-invariant/gcc/config/rs6000/rs6000.c
+--- gcc-4.9.2/gcc/config/rs6000/rs6000.c	2014-12-29 08:34:13.858952006 -0600
++++ gcc-4.9.2-loop-invariant/gcc/config/rs6000/rs6000.c	2014-12-30 08:19:22.263951826 -0600
+@@ -85,6 +85,7 @@
+ #if TARGET_MACHO
+ #include "gstab.h"  /* for N_SLINE */
+ #endif
++#include "tree-pass.h"	/* for current_pass */
+ 
+ #ifndef TARGET_NO_PROTOTYPE
+ #define TARGET_NO_PROTOTYPE 0
+@@ -30547,6 +30548,11 @@
+         return 0;
+       return 5;
+     }
++  if (!strcmp (current_pass->name, "loop2_invariant")
++      && (GET_CODE (x) == LO_SUM)
++      && GET_CODE (XEXP (x, 1)) == SYMBOL_REF)
++    return 5;
++
+   return 0; 
+ }
+ 
+diff -Naur gcc-4.9.2/gcc/testsuite/gcc.target/powerpc/ppc-fsl-loop-inv.c gcc-4.9.2-deja/gcc/testsuite/gcc.target/powerpc/ppc-fsl-loop-inv.c
+--- gcc-4.9.2/gcc/testsuite/gcc.target/powerpc/ppc-fsl-loop-inv.c	1969-12-31 18:00:00.000000000 -0600
++++ gcc-4.9.2-deja/gcc/testsuite/gcc.target/powerpc/ppc-fsl-loop-inv.c	2014-12-31 02:25:10.562952006 -0600
+@@ -0,0 +1,80 @@
++/* { dg-do compile { target { powerpc*-*-* && ilp32 } } } */
++/* { dg-options "-O3 -fdump-rtl-loop2_invariant" } */
++/* { dg-final { scan-rtl-dump-times "Decided to move" 10 "loop2_invariant"} } */
++/* { dg-final { cleanup-rtl-dump "loop2_invariant" } } */
++
++#include <string.h>
++unsigned char setmask[] =
++{
++    0x01, 0x02, 0x04, 0x08,
++    0x10, 0x20, 0x40, 0x80,
++};
++
++
++int threashold[] = { 139,138,122,120,131,135,109,130 };
++void ditherImage (unsigned char *input_buffer, int input_height,
++                         int input_width, unsigned char *output_buffer)
++{
++  int * c0;
++  int * c1;
++  int column;
++  int pixel;
++  unsigned char byte = 0;
++  int error;
++  int row;
++  int bit = 0;
++  int * temp;
++  int * err0;
++  int storage_err0[(2) * (256 +2*(1))];
++
++  memset((void*)output_buffer, 0,
++              (input_height * ((input_width-1)/(8)+1)));
++
++  err0 = storage_err0;
++  memset((void*)err0, 0,
++              (2) * (input_width+2*(1)) * sizeof(int));
++
++  c0 = err0 + (1);
++  c1 = c0 + input_width + 2*(1);
++
++  for (row = 0; row < input_height; ++row)
++  {
++    error = 0;
++    for (column = 0; column < input_width; ++column)
++    {
++      if ((pixel = *(input_buffer++)) == (255))
++        c0[column] = error = 0;
++      else
++      {
++        pixel += ((error * 8 + c1[column+1] * 3 + c1[column] * 5
++                  + c1[column-1] * 1)/16);
++        if (pixel < threashold[bit])
++        {
++          byte |= setmask[bit];
++          c0[column] = error = pixel;
++        }
++        else
++        {
++          c0[column] = error = pixel - (255);
++        }
++      }
++
++      if (++bit >= (8))
++      {
++        *(output_buffer++) = byte;
++        byte = bit = 0;
++      }
++    }
++
++    if (bit != 0)
++    {
++      *(output_buffer++) = byte;
++      byte = bit = 0;
++    }
++
++    temp = c0;
++    c0 = c1;
++    c1 = temp;
++  }
++  return;
++}
diff --git a/recipes-devtools/gcc/gcc-4.9/0032-libtool.patch b/recipes-devtools/gcc/gcc-4.9/0032-libtool.patch
new file mode 100644
index 0000000..3b3d1b6
--- /dev/null
+++ b/recipes-devtools/gcc/gcc-4.9/0032-libtool.patch
@@ -0,0 +1,42 @@
+From 6c715fcfa262adadca81c68a1f3f69aa3187a501 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem at gmail.com>
+Date: Fri, 29 Mar 2013 09:29:11 +0400
+Subject: [PATCH 32/35] libtool
+
+libstdc++ from gcc-runtime gets created with -rpath=/usr/lib/../lib for qemux86-64
+when running on am x86_64 build host.
+
+This patch stops this speading to libdir in the libstdc++.la file within libtool.
+Arguably, it shouldn't be passing this into libtool in the first place but
+for now this resolves the nastiest problems this causes.
+
+func_normal_abspath would resolve an empty path to `pwd` so we need
+to filter the zero case.
+
+RP 2012/8/24
+
+Signed-off-by: Khem Raj <raj.khem at gmail.com>
+
+Upstream-Status: Pending
+---
+ ltmain.sh |    4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/ltmain.sh b/ltmain.sh
+index a03433f..46f47c2 100644
+--- a/ltmain.sh
++++ b/ltmain.sh
+@@ -6359,6 +6359,10 @@ func_mode_link ()
+ 	func_warning "ignoring multiple \`-rpath's for a libtool library"
+ 
+       install_libdir="$1"
++      if test -n "$install_libdir"; then
++	func_normal_abspath "$install_libdir"
++	install_libdir=$func_normal_abspath_result
++      fi
+ 
+       oldlibs=
+       if test -z "$rpath"; then
+-- 
+1.7.10.4
+
diff --git a/recipes-devtools/gcc/gcc-4.9/0032.gcc.fix_e5500_mulli_pipeline.patch b/recipes-devtools/gcc/gcc-4.9/0032.gcc.fix_e5500_mulli_pipeline.patch
new file mode 100644
index 0000000..05e3bab
--- /dev/null
+++ b/recipes-devtools/gcc/gcc-4.9/0032.gcc.fix_e5500_mulli_pipeline.patch
@@ -0,0 +1,36 @@
+# Problem Statement:
+  Fix consumer-1.rgbyiq01 degradation with GCC v492.
+  Target: e5500 64-bit.
+
+# Owned by:
+  Rohit
+
+# Action:
+  Add mulli pipeline to make sure that new multiply instruction cannot start
+  execution if another multiply is executing and is 3 cycles or less from
+  finishing execution.
+
+diff -Naur gcc-4.9.2/gcc/config/rs6000/e5500.md gcc-4.9.2-patch/gcc/config/rs6000/e5500.md
+--- gcc-4.9.2/gcc/config/rs6000/e5500.md	2014-01-02 16:23:26.000000000 -0600
++++ gcc-4.9.2-patch/gcc/config/rs6000/e5500.md	2014-12-06 10:19:45.328762009 -0600
+@@ -33,6 +33,9 @@
+ ;; Non-pipelined division.
+ (define_cpu_unit "e5500_cfx_div" "e5500_long")
+ 
++;; Mulli pipeline
++(define_cpu_unit "e5500_cfx_mulli" "e5500_long")
++
+ ;; LSU.
+ (define_cpu_unit "e5500_lsu" "e5500_most")
+ 
+@@ -108,8 +111,8 @@
+ (define_insn_reservation "e5500_multiply_i" 5
+   (and (eq_attr "type" "imul2,imul3,imul_compare")
+        (eq_attr "cpu" "ppce5500"))
+-  "e5500_decode,e5500_cfx_stage0,\
+-   e5500_cfx_stage0+e5500_cfx_stage1,e5500_cfx_stage1")
++  "e5500_decode,e5500_cfx_stage0+e5500_cfx_mulli,\
++   e5500_cfx_mulli*2")
+ 
+ ;; CFX - Divide.
+ (define_insn_reservation "e5500_divide" 16
diff --git a/recipes-devtools/gcc/gcc-4.9/0033-gcc-armv4-pass-fix-v4bx-to-linker-to-support-EABI.patch b/recipes-devtools/gcc/gcc-4.9/0033-gcc-armv4-pass-fix-v4bx-to-linker-to-support-EABI.patch
new file mode 100644
index 0000000..b236c37
--- /dev/null
+++ b/recipes-devtools/gcc/gcc-4.9/0033-gcc-armv4-pass-fix-v4bx-to-linker-to-support-EABI.patch
@@ -0,0 +1,40 @@
+From 97e4591c20310425e7aca0e6712a8d9480e7744c Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem at gmail.com>
+Date: Fri, 29 Mar 2013 09:30:32 +0400
+Subject: [PATCH 33/35] gcc: armv4: pass fix-v4bx to linker to support EABI.
+
+The LINK_SPEC for linux gets overwritten by linux-eabi.h which
+means the value of TARGET_FIX_V4BX_SPEC gets lost and as a result
+the option is not passed to linker when chosing march=armv4
+This patch redefines this in linux-eabi.h and reinserts it
+for eabi defaulting toolchains.
+
+We might want to send it upstream.
+
+Signed-off-by: Khem Raj <raj.khem at gmail.com>
+
+Upstream-Status: Pending
+---
+ gcc/config/arm/linux-eabi.h |    6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+Index: gcc-4.9-20140316/gcc/config/arm/linux-eabi.h
+===================================================================
+--- gcc-4.9-20140316.orig/gcc/config/arm/linux-eabi.h
++++ gcc-4.9-20140316/gcc/config/arm/linux-eabi.h
+@@ -77,10 +77,14 @@
+     %{mfloat-abi=soft*:" GLIBC_DYNAMIC_LINKER_SOFT_FLOAT "} \
+     %{!mfloat-abi=*:" GLIBC_DYNAMIC_LINKER_DEFAULT "}"
+ 
++/* For armv4 we pass --fix-v4bx to linker to support EABI */
++#undef TARGET_FIX_V4BX_SPEC
++#define TARGET_FIX_V4BX_SPEC "%{mcpu=arm8|mcpu=arm810|mcpu=strongarm*|march=armv4: --fix-v4bx}"
++
+ /* At this point, bpabi.h will have clobbered LINK_SPEC.  We want to
+    use the GNU/Linux version, not the generic BPABI version.  */
+ #undef  LINK_SPEC
+-#define LINK_SPEC EABI_LINK_SPEC					\
++#define LINK_SPEC TARGET_FIX_V4BX_SPEC EABI_LINK_SPEC			\
+   LINUX_OR_ANDROID_LD (LINUX_TARGET_LINK_SPEC,				\
+ 		       LINUX_TARGET_LINK_SPEC " " ANDROID_LINK_SPEC)
+ 
diff --git a/recipes-devtools/gcc/gcc-4.9/0033.gcc.fix_e500mc_addi_pipeline.patch b/recipes-devtools/gcc/gcc-4.9/0033.gcc.fix_e500mc_addi_pipeline.patch
new file mode 100644
index 0000000..f987f35
--- /dev/null
+++ b/recipes-devtools/gcc/gcc-4.9/0033.gcc.fix_e500mc_addi_pipeline.patch
@@ -0,0 +1,44 @@
+# Problem Statement:
+  Fix consumer-1.rgbyiq01 benchmark degradation with GCC v492.
+
+  Target: e500mc.
+
+  There were 2 issues:
+  * add/addi/addis instrutions were scheduled too close.
+  * Fixing the above issue lead to degradation in rgbcmy01 benchmark.
+    Reason being 'nor' instructions were scheduled too close.
+
+# Owned by:
+  Rohit
+
+# Action:
+  * Allocate SU resource such that "add/addi/addis" and "nor" instructions are
+    not scheduled closer.
+
+diff -Naur gcc-4.9.2/gcc/config/rs6000/rs6000.md gcc-4.9.2-rgbyiq/gcc/config/rs6000/rs6000.md
+--- gcc-4.9.2/gcc/config/rs6000/rs6000.md	2014-12-22 06:46:25.860952006 -0600
++++ gcc-4.9.2-rgbyiq/gcc/config/rs6000/rs6000.md	2014-12-31 06:25:34.421951939 -0600
+@@ -1863,7 +1863,10 @@
+    addi %0,%1,%2
+    addic %0,%1,%2
+    addis %0,%1,%v2"
+-  [(set_attr "length" "4,4,4,4")])
++  [(set_attr "length" "4,4,4,4")
++   (set (attr "type")
++        (if_then_else (match_test "rs6000_cpu_attr == CPU_PPCE500MC")
++                      (const_string "two") (const_string "*")))])
+ 
+ (define_insn "addsi3_high"
+   [(set (match_operand:SI 0 "gpc_reg_operand" "=b")
+@@ -1982,7 +1985,10 @@
+   [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
+ 	(not:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))]
+   ""
+-  "nor %0,%1,%1")
++  "nor %0,%1,%1"
++  [(set (attr "type")
++        (if_then_else (match_test "rs6000_cpu_attr == CPU_PPCE500MC")
++                      (const_string "two") (const_string "*")))])
+ 
+ (define_insn ""
+   [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
diff --git a/recipes-devtools/gcc/gcc-4.9/0034-Use-the-multilib-config-files-from-B-instead-of-usin.patch b/recipes-devtools/gcc/gcc-4.9/0034-Use-the-multilib-config-files-from-B-instead-of-usin.patch
new file mode 100644
index 0000000..66b9f89
--- /dev/null
+++ b/recipes-devtools/gcc/gcc-4.9/0034-Use-the-multilib-config-files-from-B-instead-of-usin.patch
@@ -0,0 +1,102 @@
+From fc5e4beaea856a2b486c770ad3addc0f5bb3100e Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem at gmail.com>
+Date: Fri, 29 Mar 2013 09:33:04 +0400
+Subject: [PATCH 34/35] Use the multilib config files from ${B} instead of
+ using the ones from ${S}
+
+Use the multilib config files from ${B} instead of using the ones from ${S}
+so that the source can be shared between gcc-cross-initial,
+gcc-cross-intermediate, gcc-cross, gcc-runtime, and also the sdk build.
+
+Signed-off-by: Khem Raj <raj.khem at gmail.com>
+Signed-off-by: Constantin Musca <constantinx.musca at intel.com>
+
+Upstream-Status: Inappropriate [configuration]
+---
+ gcc/configure    |   22 ++++++++++++++++++----
+ gcc/configure.ac |   22 ++++++++++++++++++----
+ 2 files changed, 36 insertions(+), 8 deletions(-)
+
+diff --git a/gcc/configure b/gcc/configure
+index 8bc0c98..3cd0817 100755
+--- a/gcc/configure
++++ b/gcc/configure
+@@ -11519,10 +11519,20 @@ done
+ tmake_file_=
+ for f in ${tmake_file}
+ do
+-	if test -f ${srcdir}/config/$f
+-	then
+-		tmake_file_="${tmake_file_} \$(srcdir)/config/$f"
+-	fi
++  case $f in
++    */t-linux64 )
++       if test -f ./config/$f
++       then
++         tmake_file_="${tmake_file_} ./config/$f"
++       fi
++       ;;
++    * )
++       if test -f ${srcdir}/config/$f
++       then
++         tmake_file_="${tmake_file_} \$(srcdir)/config/$f"
++       fi
++       ;;
++  esac
+ done
+ tmake_file="${tmake_file_}"
+ 
+@@ -11533,6 +11543,10 @@ tm_file_list="options.h"
+ tm_include_list="options.h insn-constants.h"
+ for f in $tm_file; do
+   case $f in
++    */linux64.h )
++       tm_file_list="${tm_file_list} ./config/$f"
++       tm_include_list="${tm_include_list} ./config/$f"
++       ;;
+     ./* )
+        f=`echo $f | sed 's/^..//'`
+        tm_file_list="${tm_file_list} $f"
+diff --git a/gcc/configure.ac b/gcc/configure.ac
+index 5e5e84f..415a6df 100644
+--- a/gcc/configure.ac
++++ b/gcc/configure.ac
+@@ -1700,10 +1700,20 @@ done
+ tmake_file_=
+ for f in ${tmake_file}
+ do
+-	if test -f ${srcdir}/config/$f
+-	then
+-		tmake_file_="${tmake_file_} \$(srcdir)/config/$f"
+-	fi
++  case $f in
++    */t-linux64 )
++       if test -f ./config/$f
++       then
++         tmake_file_="${tmake_file_} ./config/$f"
++       fi
++       ;;
++    * )
++       if test -f ${srcdir}/config/$f
++       then
++         tmake_file_="${tmake_file_} \$(srcdir)/config/$f"
++       fi
++       ;;
++  esac
+ done
+ tmake_file="${tmake_file_}"
+ 
+@@ -1714,6 +1724,10 @@ tm_file_list="options.h"
+ tm_include_list="options.h insn-constants.h"
+ for f in $tm_file; do
+   case $f in
++    */linux64.h )
++       tm_file_list="${tm_file_list} ./config/$f"
++       tm_include_list="${tm_include_list} ./config/$f"
++       ;;
+     ./* )
+        f=`echo $f | sed 's/^..//'`
+        tm_file_list="${tm_file_list} $f"
+-- 
+1.7.10.4
+
diff --git a/recipes-devtools/gcc/gcc-4.9/0034.gcc.fix_ENGR00292364_debug_frame.patch b/recipes-devtools/gcc/gcc-4.9/0034.gcc.fix_ENGR00292364_debug_frame.patch
new file mode 100644
index 0000000..0355bba
--- /dev/null
+++ b/recipes-devtools/gcc/gcc-4.9/0034.gcc.fix_ENGR00292364_debug_frame.patch
@@ -0,0 +1,63 @@
+# Problem Statement:
+  For C++ applications, built with GCC v4.8.1, the CodeWarrior debugger
+  is not able to properly display the local variables because the frame
+  information is not generated in .debug_frame section as required by
+  the DWARF standard.
+
+  However, the compiler does emit the frame information but to avoid
+  duplication of information, by default, the GCC v4.8.1 generates the
+  frame information only in .eh_frame section, which is the more compact
+  form compared to .debug_frame section, with few additional details.
+
+# Reported by:
+  Hoang Tu
+
+# Owned by:
+  Ram
+
+# Action:
+  * Along with the .eh_frame section, changes are made in compiler DWARF
+    emission to generate the frame information in .debug_frame section also
+  * Added a new compiler flag '-fdebug-unwind-tables', which is disabled
+    by default in the compiler, to enable/disable the above changes
+
+
+diff -ruN gcc-4.8.1/gcc/common.opt gcc-4.8.1_ENGR00292364_Fix/gcc/common.opt
+--- gcc-4.8.1/gcc/common.opt	2014-02-17 09:24:10.067382984 -0600
++++ gcc-4.8.1_ENGR00292364_Fix/gcc/common.opt	2014-02-19 01:15:49.656381305 -0600
+@@ -984,6 +984,10 @@
+ Common Report Var(flag_debug_types_section) Init(0)
+ Output .debug_types section when using DWARF v4 debuginfo.
+ 
++fdebug-unwind-tables
++Common Report Var(flag_debug_unwind_tables) Init(0)
++Generate unwind tables in .debug_frame also, when exception unwind tables enabled
++
+ ; Nonzero for -fdefer-pop: don't pop args after each function call
+ ; instead save them up to pop many calls' args with one insns.
+ fdefer-pop
+diff -ruN gcc-4.8.1/gcc/dwarf2out.c gcc-4.8.1_ENGR00292364_Fix/gcc/dwarf2out.c
+--- gcc-4.8.1/gcc/dwarf2out.c	2014-02-17 09:24:31.621383000 -0600
++++ gcc-4.8.1_ENGR00292364_Fix/gcc/dwarf2out.c	2014-02-19 01:27:19.453383000 -0600
+@@ -21750,10 +21750,17 @@
+ dwarf2out_assembly_start (void)
+ {
+   if (HAVE_GAS_CFI_SECTIONS_DIRECTIVE
+-      && dwarf2out_do_cfi_asm ()
+-      && (!(flag_unwind_tables || flag_exceptions)
+-	  || targetm_common.except_unwind_info (&global_options) != UI_DWARF2))
+-    fprintf (asm_out_file, "\t.cfi_sections\t.debug_frame\n");
++      && dwarf2out_do_cfi_asm ())
++    {
++      if (!(flag_unwind_tables || flag_exceptions)
++	  || targetm_common.except_unwind_info (&global_options) != UI_DWARF2)
++        fprintf (asm_out_file, "\t.cfi_sections\t.debug_frame\n");
++
++      if (flag_debug_unwind_tables
++          && (flag_unwind_tables || flag_exceptions)
++          && targetm_common.except_unwind_info (&global_options) == UI_DWARF2)
++        fprintf (asm_out_file, "\t.cfi_sections\t.eh_frame, .debug_frame\n");
++    }
+ }
+ 
+ /* A helper function for dwarf2out_finish called through
diff --git a/recipes-devtools/gcc/gcc-4.9/0035.gcc.fix_ENGR00215936_49x.patch b/recipes-devtools/gcc/gcc-4.9/0035.gcc.fix_ENGR00215936_49x.patch
new file mode 100644
index 0000000..f472a67
--- /dev/null
+++ b/recipes-devtools/gcc/gcc-4.9/0035.gcc.fix_ENGR00215936_49x.patch
@@ -0,0 +1,159 @@
+Remove redundant mov instructions.
+Issue: remove redundant move instructions.
+
+ addi 5,5,-1        addi 3,5,-1
+ mr 3,5          => blr
+ blr
+
+Here  these patters will not get gnerated by the time we call
+peephole2. Moreover we need cover lot of combination of instrctions
+like add/sub/div/mult/neg etc..and their varients and after changing the
+pattern register 3 should satisfy the constraints of previous add isntruction.
+otherwise compiler will crash at later stages.
+
+so preferred writting and generic check for these paterns in target specific
+reorg pass instead of adding using define_peephole.
+
+
+--- gcc-4.8.0-orig/gcc/config/rs6000/rs6000.c	2013-02-08 13:36:04.000000000 -0600
++++ gcc-4.8.0/gcc/config/rs6000/rs6000.c	2013-04-22 05:47:56.303264636 -0500
+@@ -940,6 +940,7 @@
+ static bool is_load_insn (rtx, rtx *);
+ static bool is_store_insn (rtx, rtx *);
+ static bool set_to_load_agen (rtx,rtx);
++static void rs6000_reorg (void);
+ static bool insn_terminates_group_p (rtx , enum group_termination);
+ static bool insn_must_be_first_in_group (rtx);
+ static bool insn_must_be_last_in_group (rtx);
+@@ -1221,6 +1222,8 @@
+ #define TARGET_SCHED_REORDER rs6000_sched_reorder
+ #undef TARGET_SCHED_REORDER2
+ #define TARGET_SCHED_REORDER2 rs6000_sched_reorder2
++#undef TARGET_MACHINE_DEPENDENT_REORG
++#define TARGET_MACHINE_DEPENDENT_REORG rs6000_reorg
+ 
+ #undef TARGET_SCHED_FIRST_CYCLE_MULTIPASS_DFA_LOOKAHEAD
+ #define TARGET_SCHED_FIRST_CYCLE_MULTIPASS_DFA_LOOKAHEAD rs6000_use_sched_lookahead
+@@ -23888,6 +23891,122 @@
+   return cached_can_issue_more;
+ }
+ 
++/* Implement TARGET_MACHINE_DEPENDENT_REORG.  */
++
++void
++remove_redundant_mov (void)
++{
++ basic_block bb;
++ rtx insn0,insn1,insn2,insn3;
++ rtx x,pat,pat0;
++ rtx operands[15];
++ 
++ FOR_EACH_BB_FN (bb, cfun)
++ {
++   FOR_BB_INSNS (bb,insn0)
++   {
++    insn1 = insn0;
++    if(insn1 == 0 )continue;
++    if (LABEL_P (insn1)
++       || BARRIER_P (insn1))insn1 = NEXT_INSN(insn1);
++    if(insn1 == 0)continue;
++
++    if (NEXT_INSN (insn1)
++       && BARRIER_P (NEXT_INSN (insn1)))continue;
++
++    while (NOTE_P (insn1)
++          || (NONJUMP_INSN_P (insn1)
++              && (GET_CODE (PATTERN (insn1)) == USE
++                 || GET_CODE (PATTERN (insn1)) == CLOBBER)))
++    {
++    	insn1 = NEXT_INSN (insn1);
++        if(insn1 == 0)break;
++    }
++    if(insn1 == 0)continue;
++
++    if (LABEL_P (insn1)
++      || BARRIER_P (insn1))continue;
++
++    pat = PATTERN (insn1);
++    x = pat0 = pat;
++    if (GET_CODE (x) != SET)continue;
++    x = XEXP (pat,0);
++    operands[0] = x;
++    if (! TARGET_POWERPC64)
++    {
++     if (! gpc_reg_operand (x, SImode))continue;
++    }
++    else
++    {
++     if (! gpc_reg_operand (x, DImode))continue;
++    } 
++    x = XEXP (XEXP (pat, 1), 0);
++    operands[1] = x;
++    insn2 = insn1;
++    do { insn2 = NEXT_INSN (insn2);
++       if (insn2 == 0) break; }
++    while (NOTE_P (insn2)
++         || (NONJUMP_INSN_P (insn2)
++             && (GET_CODE (PATTERN (insn2)) == USE
++                 || GET_CODE (PATTERN (insn2)) == CLOBBER)));
++    if(insn2 == 0)continue;
++    if (LABEL_P (insn2)
++        || BARRIER_P (insn2))continue;
++    pat = PATTERN (insn2);
++    x = pat;
++    if (GET_CODE (x) != SET)continue;
++    x = XEXP (pat, 0);
++    operands[3] = x;
++    if (! TARGET_POWERPC64)
++    {
++       if (! gpc_reg_operand (x, SImode))continue;
++    }
++    else
++    {
++       if (! gpc_reg_operand (x, DImode))continue;
++    }
++    x = XEXP (pat, 1);
++    if (!rtx_equal_p (operands[0], x))continue;
++    insn3 = insn2;
++    do { insn3 = NEXT_INSN (insn3);
++       if (insn3 == 0) break; }
++    while (NOTE_P (insn3)
++         || (NONJUMP_INSN_P (insn3)
++             && (GET_CODE (PATTERN (insn3)) == USE
++                 || GET_CODE (PATTERN (insn3)) == CLOBBER)));
++    if(insn3 == 0)continue;
++    if (LABEL_P (insn3)
++        || BARRIER_P (insn3))continue;
++    pat = PATTERN (insn3);
++    x = pat;
++    if (GET_CODE (x) != RETURN)continue;
++    if ((REGNO(operands[3]) == 3))
++    {
++      rtx ret_reg;
++      int insn_code_number;
++      
++      ret_reg = copy_rtx (operands[3]);
++      XEXP(pat0,0) = ret_reg;
++      insn_code_number = recog_memoized (insn1);
++      cleanup_subreg_operands (insn1);
++      if (! constrain_operands_cached (1))
++      {
++       /*operands does ot match to their constraints.so revert changes to insn*/
++        XEXP(pat0,0) = operands[0];
++      }
++      else
++        delete_insn (insn2);
++    }
++   }
++  }
++}
++
++static void
++rs6000_reorg (void)
++{
++  remove_redundant_mov ();
++}
++
+ /* Return whether the presence of INSN causes a dispatch group termination
+    of group WHICH_GROUP.
+ 
diff --git a/recipes-devtools/gcc/gcc-4.9/0036.gcc.enable_soft_multilib-49x.patch b/recipes-devtools/gcc/gcc-4.9/0036.gcc.enable_soft_multilib-49x.patch
new file mode 100644
index 0000000..69872cf
--- /dev/null
+++ b/recipes-devtools/gcc/gcc-4.9/0036.gcc.enable_soft_multilib-49x.patch
@@ -0,0 +1,23 @@
+diff -Naur gcc-4.9.0/gcc/config/rs6000/t-linux64 gcc-4.9.0-soft-multilib/gcc/config/rs6000/t-linux64
+--- gcc-4.9.0/gcc/config/rs6000/t-linux64	2014-06-20 04:41:27.682372001 -0500
++++ gcc-4.9.0-soft-multilib/gcc/config/rs6000/t-linux64	2014-06-20 06:53:02.935374190 -0500
+@@ -25,11 +25,14 @@
+ # it doesn't tell anything about the 32bit libraries on those systems.  Set
+ # MULTILIB_OSDIRNAMES according to what is found on the target.
+ 
+-MULTILIB_OPTIONS    := m64/m32
+-MULTILIB_DIRNAMES   := 64 32
+-MULTILIB_EXTRA_OPTS := 
+-MULTILIB_OSDIRNAMES := m64=../lib64$(call if_multiarch,:powerpc64-linux-gnu)
+-MULTILIB_OSDIRNAMES += m32=$(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib)$(call if_multiarch,:powerpc-linux-gnu)
++MULTILIB_OPTIONS        = m64/m32 msoft-float
++MULTILIB_DIRNAMES       = 64 32 nof
++MULTILIB_EXTRA_OPTS     = fPIC mstrict-align
++MULTILIB_EXCEPTIONS     = m64/msoft-float
++MULTILIB_EXCLUSIONS     = m64/!m32/msoft-float
++MULTILIB_OSDIRNAMES     = ../lib64$(call if_multiarch,:powerpc64-linux-gnu)
++MULTILIB_OSDIRNAMES    += $(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib)$(call if_multiarch,:powerpc-linux-gnu) nof$(call if_multiarch,:powerpc-linux-gnu)
++MULTILIB_MATCHES        = $(MULTILIB_MATCHES_FLOAT)
+ 
+ rs6000-linux.o: $(srcdir)/config/rs6000/rs6000-linux.c
+ 	$(COMPILE) $<
diff --git a/recipes-devtools/gcc/gcc-4.9/0037.gcc.fix_49x-doc.patch b/recipes-devtools/gcc/gcc-4.9/0037.gcc.fix_49x-doc.patch
new file mode 100644
index 0000000..276d8d9
--- /dev/null
+++ b/recipes-devtools/gcc/gcc-4.9/0037.gcc.fix_49x-doc.patch
@@ -0,0 +1,30 @@
+diff -Naur gcc-4.9.0/libffi/doc/libffi.texi gcc-4.9.0-fix-doc/libffi/doc/libffi.texi
+--- gcc-4.9.0/libffi/doc/libffi.texi	2014-06-20 04:41:36.089371999 -0500
++++ gcc-4.9.0-fix-doc/libffi/doc/libffi.texi	2014-06-20 08:57:23.159371124 -0500
+@@ -378,26 +378,6 @@
+ You must first describe the structure to @samp{libffi} by creating a
+ new @code{ffi_type} object for it.
+ 
+- at tindex ffi_type
+- at deftp {Data type} ffi_type
+-The @code{ffi_type} has the following members:
+- at table @code
+- at item size_t size
+-This is set by @code{libffi}; you should initialize it to zero.
+-
+- at item unsigned short alignment
+-This is set by @code{libffi}; you should initialize it to zero.
+-
+- at item unsigned short type
+-For a structure, this should be set to @code{FFI_TYPE_STRUCT}.
+-
+- at item ffi_type **elements
+-This is a @samp{NULL}-terminated array of pointers to @code{ffi_type}
+-objects.  There is one element per field of the struct.
+- at end table
+- at end deftp
+-
+-
+ @node Type Example
+ @subsection Type Example
+ 
diff --git a/recipes-devtools/gcc/gcc-4.9/0038.gcc.fix_emulation_spec_48.patch b/recipes-devtools/gcc/gcc-4.9/0038.gcc.fix_emulation_spec_48.patch
new file mode 100644
index 0000000..deb5a64
--- /dev/null
+++ b/recipes-devtools/gcc/gcc-4.9/0038.gcc.fix_emulation_spec_48.patch
@@ -0,0 +1,56 @@
+# Problem Statement:
+  For e5500/e6500 bare-board tool chain, when '-m64' option is used,
+  the corresponding emulation option '-melf64ppc' is not being passed
+  to the linker by default.
+
+# Reported by:
+  Rohit [23.April.2013]
+
+# Owned by:
+  Rohit
+
+# Action:
+  * Update the header file e500mc.h to set appropriate target macros.
+  * AEABI is a proxy for Linux ABI, so these changes should not affect
+    e500mc (EABI) tool chain.
+  * Fix typo in config.gcc file
+
+diff -Naur gcc-4.7.2/gcc/config/rs6000/e500mc.h gcc-4.7.2-emulation-spec/gcc/config/rs6000/e500mc.h
+--- gcc-4.7.2/gcc/config/rs6000/e500mc.h	2013-05-31 07:40:08.638001570 -0500
++++ gcc-4.7.2-emulation-spec/gcc/config/rs6000/e500mc.h	2013-05-31 07:39:34.794001566 -0500
+@@ -83,6 +83,8 @@
+   { "asm_spec_common",		ASM_SPEC_COMMON },			\
+   { "asm_spec32",		ASM_SPEC32 },				\
+   { "asm_spec64",		ASM_SPEC64 },				\
++  { "link_os_linux_spec32",	LINK_OS_LINUX_SPEC32 },			\
++  { "link_os_linux_spec64",	LINK_OS_LINUX_SPEC64 },
+ 
+ #undef	MULTILIB_DEFAULTS
+ #if DEFAULT_ARCH64_P
+@@ -170,6 +172,14 @@
+     }							\
+   while (0)
+ 
++#ifdef RS6000BI_ARCH_P
++#undef	LINK_OS_DEFAULT_SPEC
++#define LINK_OS_DEFAULT_SPEC "%(link_os_linux)"
++#endif
++
++#define LINK_OS_LINUX_SPEC32 "-m elf32ppclinux"
++#define LINK_OS_LINUX_SPEC64 "-m elf64ppc"
++
+ /* Must be at least as big as our pointer type.  */
+ #undef	SIZE_TYPE
+ #define	SIZE_TYPE (TARGET_64BIT ? "long unsigned int" : "unsigned int")
+diff -Naur gcc-4.7.2/gcc/config.gcc gcc-4.7.2-emulation-spec/gcc/config.gcc
+--- gcc-4.7.2/gcc/config.gcc	2013-05-31 07:40:01.544000724 -0500
++++ gcc-4.7.2-emulation-spec/gcc/config.gcc	2013-05-31 07:39:32.758001571 -0500
+@@ -421,7 +421,7 @@
+ 	extra_headers="ppc-asm.h altivec.h spe.h ppu_intrinsics.h paired.h spu2vmx.h vec_types.h si2vmx.h"
+ 	need_64bit_hwint=yes
+ 	case x$with_cpu in
+-	    xpowerpc64|xdefault64|x6[23]0|x970|xG5|xpower[345678]|xpower6x|xrs64a|xcell|xa2|xe500mc64|xe5500|Xe6500)
++	    xpowerpc64|xdefault64|x6[23]0|x970|xG5|xpower[345678]|xpower6x|xrs64a|xcell|xa2|xe500mc64|xe5500|xe6500)
+ 		cpu_is_64bit=yes
+ 		;;
+ 	esac
diff --git a/recipes-devtools/gcc/gcc-4.9/0039.gcc.create_maeabi.patch b/recipes-devtools/gcc/gcc-4.9/0039.gcc.create_maeabi.patch
new file mode 100644
index 0000000..f247d42
--- /dev/null
+++ b/recipes-devtools/gcc/gcc-4.9/0039.gcc.create_maeabi.patch
@@ -0,0 +1,746 @@
+--- gcc-4.7.2/gcc/config/rs6000/sysv4.opt-orig  2013-03-29 13:13:27.001603071 -0500
++++ gcc-4.7.2/gcc/config/rs6000/sysv4.opt       2013-03-29 13:15:05.637602550 -0500
+@@ -117,6 +117,10 @@
+ Target RejectNegative
+ Link with libsim.a, libc.a and sim-crt0.o
+ 
++maeabi
++Target RejectNegative
++Link with libaeabi.a, crtaeabi0.o and crtaeabi9.o
++
+ mads
+ Target RejectNegative
+ Link with libads.a, libc.a and crt0.o
+diff -ruN gcc-4.7.3-orig/gcc/config/rs6000/e500mc.h gcc-4.7.3-new/gcc/config/rs6000/e500mc.h
+--- gcc-4.7.3-orig/gcc/config/rs6000/e500mc.h	2013-04-29 16:40:59.759000075 -0500
++++ gcc-4.7.3-new/gcc/config/rs6000/e500mc.h	2013-04-29 18:32:49.436000171 -0500
+@@ -84,7 +84,22 @@
+   { "asm_spec32",		ASM_SPEC32 },				\
+   { "asm_spec64",		ASM_SPEC64 },				\
+   { "link_os_linux_spec32",	LINK_OS_LINUX_SPEC32 },			\
+-  { "link_os_linux_spec64",	LINK_OS_LINUX_SPEC64 },
++  { "link_os_linux_spec64",	LINK_OS_LINUX_SPEC64 },                 \
++  { "startfile_aeabi",          STARTFILE_AEABI_SPEC },                 \
++  { "lib_aeabi",                LIB_AEABI_SPEC },                       \
++  { "endfile_aeabi",            ENDFILE_AEABI_SPEC },
++
++#define STARTFILE_AEABI_SPEC ""
++#define LIB_AEABI_SPEC ""
++#define ENDFILE_AEABI_SPEC ""
++
++/* This is the case of e5500 and e6500 targets */
++#undef STARTFILE_AEABI_SPEC
++#undef LIB_AEABI_SPEC
++#undef ENDFILE_AEABI_SPEC
++#define STARTFILE_AEABI_SPEC "%{m32:-m elf32ppc} %{m64:-m elf64ppc} %{!m32:%{!m64:-m elf32ppc}} ecrti.o%s crtaeabi0.o%s crtbegin.o%s"
++#define LIB_AEABI_SPEC "--start-group -laeabi -lc --end-group"
++#define ENDFILE_AEABI_SPEC "crtend.o%s crtaeabi9.o%s ecrtn.o%s"
+ 
+ #undef	MULTILIB_DEFAULTS
+ #if DEFAULT_ARCH64_P
+diff -ruN gcc-4.7.3-orig/gcc/config/rs6000/libaeabi/crtaeabi0.S gcc-4.7.3-new/gcc/config/rs6000/libaeabi/crtaeabi0.S
+--- gcc-4.7.3-orig/gcc/config/rs6000/libaeabi/crtaeabi0.S	1969-12-31 18:00:00.000000000 -0600
++++ gcc-4.7.3-new/gcc/config/rs6000/libaeabi/crtaeabi0.S	2013-04-29 18:34:39.483000083 -0500
+@@ -0,0 +1,57 @@
++/*
++ * crt0.S -- startup file for PowerPC systems.
++ *
++ * Copyright (c) 1995 Cygnus Support
++ *
++ * The authors hereby grant permission to use, copy, modify, distribute,
++ * and license this software and its documentation for any purpose, provided
++ * that existing copyright notices are retained in all copies and that this
++ * notice is included verbatim in any distributions. No written agreement,
++ * license, or royalty fee is required for any of the authorized uses.
++ * Modifications to this software may be copyrighted by their authors
++ * and need not follow the licensing terms described here, provided that
++ * the new terms are clearly indicated on the first page of each file where
++ * they apply.
++ */
++
++#include "ppc-asm.h"
++
++	.file	"sim-crt0.S"
++	.text
++FUNC_START(_start)
++	lis	r0,0
++	stw	r0,0(sp)	/* clear back chain */
++	stwu	sp,-64(sp)	/* push another stack frame */
++
++	/* Let her rip */
++#if defined (__powerpc64__)
++	.section ".init"
++._init:
++	.text
++	bl	FUNC_NAME(_init)
++	nop
++	/* return value from main is argument to exit */
++	bl	FUNC_NAME(exit)
++	nop
++#else
++	bl	FUNC_NAME(__init)
++	bl	FUNC_NAME(main)#
++	/* return value from main is argument to exit */
++	bl	FUNC_NAME(exit)
++#endif
++FUNC_END(_start)
++
++	.extern	FUNC_NAME(atexit)
++	.globl	FUNC_NAME(__atexit)
++	.section ".sdata","aw"
++	.align	2
++FUNC_NAME(__atexit):			/* tell C's eabi-ctor's we have an atexit function */
++#if defined (__powerpc64__)
++	.long	FUNC_NAME(atexit)	/* and that it is to register __do_global_dtors */
++#else
++	.long	FUNC_NAME(atexit)@fixup	/* and that it is to register __do_global_dtors */
++
++	.section ".fixup","aw"
++	.align	2
++	.long	FUNC_NAME(__atexit)
++#endif
+diff -ruN gcc-4.7.3-orig/gcc/config/rs6000/libaeabi/crtaeabi9.S gcc-4.7.3-new/gcc/config/rs6000/libaeabi/crtaeabi9.S
+--- gcc-4.7.3-orig/gcc/config/rs6000/libaeabi/crtaeabi9.S	1969-12-31 18:00:00.000000000 -0600
++++ gcc-4.7.3-new/gcc/config/rs6000/libaeabi/crtaeabi9.S	2013-04-29 18:34:39.498000079 -0500
+@@ -0,0 +1,12 @@
++#include "ppc-asm.h"
++
++	.file	"sim-crt9.S"
++
++#if defined (__powerpc64__)
++	.section ".init","ax"
++	bl	FUNC_NAME(main)
++	nop
++	/* return value from main is argument to exit */
++	bl	FUNC_NAME(exit)
++	nop
++#endif
+diff -ruN gcc-4.7.3-orig/gcc/config/rs6000/libaeabi/fstat.c gcc-4.7.3-new/gcc/config/rs6000/libaeabi/fstat.c
+--- gcc-4.7.3-orig/gcc/config/rs6000/libaeabi/fstat.c	1969-12-31 18:00:00.000000000 -0600
++++ gcc-4.7.3-new/gcc/config/rs6000/libaeabi/fstat.c	2013-04-29 18:34:39.518000116 -0500
+@@ -0,0 +1,30 @@
++/* fstat.c -- get status of a file.
++ *
++ * Copyright (c) 1995 Cygnus Support
++ *
++ * The authors hereby grant permission to use, copy, modify, distribute,
++ * and license this software and its documentation for any purpose, provided
++ * that existing copyright notices are retained in all copies and that this
++ * notice is included verbatim in any distributions. No written agreement,
++ * license, or royalty fee is required for any of the authorized uses.
++ * Modifications to this software may be copyrighted by their authors
++ * and need not follow the licensing terms described here, provided that
++ * the new terms are clearly indicated on the first page of each file where
++ * they apply.
++ */
++#include <sys/stat.h>
++#include "glue.h"
++
++/*
++ * fstat -- Since we have no file system, we just return an error.
++ */
++int
++_DEFUN (fstat, (fd, buf),
++       int fd _AND
++       struct stat *buf)
++{
++  buf->st_mode = S_IFCHR;	/* Always pretend to be a tty */
++  buf->st_blksize = 0;
++
++  return (0);
++}
+diff -ruN gcc-4.7.3-orig/gcc/config/rs6000/libaeabi/getpid.c gcc-4.7.3-new/gcc/config/rs6000/libaeabi/getpid.c
+--- gcc-4.7.3-orig/gcc/config/rs6000/libaeabi/getpid.c	1969-12-31 18:00:00.000000000 -0600
++++ gcc-4.7.3-new/gcc/config/rs6000/libaeabi/getpid.c	2013-04-29 18:34:39.562000126 -0500
+@@ -0,0 +1,25 @@
++/* getpid.c -- get the current process id.
++ *
++ * Copyright (c) 1995 Cygnus Support
++ *
++ * The authors hereby grant permission to use, copy, modify, distribute,
++ * and license this software and its documentation for any purpose, provided
++ * that existing copyright notices are retained in all copies and that this
++ * notice is included verbatim in any distributions. No written agreement,
++ * license, or royalty fee is required for any of the authorized uses.
++ * Modifications to this software may be copyrighted by their authors
++ * and need not follow the licensing terms described here, provided that
++ * the new terms are clearly indicated on the first page of each file where
++ * they apply.
++ */
++#include "glue.h"
++
++/*
++ * getpid -- only one process, so just return 1.
++ */
++int
++_DEFUN (getpid, (),
++        )
++{
++  return __MYPID;
++}
+diff -ruN gcc-4.7.3-orig/gcc/config/rs6000/libaeabi/glue.h gcc-4.7.3-new/gcc/config/rs6000/libaeabi/glue.h
+--- gcc-4.7.3-orig/gcc/config/rs6000/libaeabi/glue.h	1969-12-31 18:00:00.000000000 -0600
++++ gcc-4.7.3-new/gcc/config/rs6000/libaeabi/glue.h	2013-04-29 18:34:39.581999971 -0500
+@@ -0,0 +1,31 @@
++/* glue.h -- common definitions for "glue" fucntions.
++ *
++ * Copyright (c) 1995 Cygnus Support
++ *
++ * The authors hereby grant permission to use, copy, modify, distribute,
++ * and license this software and its documentation for any purpose, provided
++ * that existing copyright notices are retained in all copies and that this
++ * notice is included verbatim in any distributions. No written agreement,
++ * license, or royalty fee is required for any of the authorized uses.
++ * Modifications to this software may be copyrighted by their authors
++ * and need not follow the licensing terms described here, provided that
++ * the new terms are clearly indicated on the first page of each file where
++ * they apply.
++ */
++#include <_ansi.h>
++
++#ifndef NULL
++#  define NULL 0
++#endif
++
++#ifdef __NO_UNDERSCORE__
++#  define _end    end
++#  define _exit	  exit
++#endif
++
++extern char _end[];                /* _end is set in the linker command file */
++
++/* only one prcess support, as this is OS dependant */
++#define __MYPID 1
++
++
+diff -ruN gcc-4.7.3-orig/gcc/config/rs6000/libaeabi/isatty.c gcc-4.7.3-new/gcc/config/rs6000/libaeabi/isatty.c
+--- gcc-4.7.3-orig/gcc/config/rs6000/libaeabi/isatty.c	1969-12-31 18:00:00.000000000 -0600
++++ gcc-4.7.3-new/gcc/config/rs6000/libaeabi/isatty.c	2013-04-29 18:34:39.603000235 -0500
+@@ -0,0 +1,27 @@
++/* isatty.c -- chek the terminal device.
++ * 
++ * Copyright (c) 1995 Cygnus Support
++ *
++ * The authors hereby grant permission to use, copy, modify, distribute,
++ * and license this software and its documentation for any purpose, provided
++ * that existing copyright notices are retained in all copies and that this
++ * notice is included verbatim in any distributions. No written agreement,
++ * license, or royalty fee is required for any of the authorized uses.
++ * Modifications to this software may be copyrighted by their authors
++ * and need not follow the licensing terms described here, provided that
++ * the new terms are clearly indicated on the first page of each file where
++ * they apply.
++ */
++#include "glue.h"
++
++/*
++ * isatty -- returns 1 if connected to a terminal device,
++ *           returns 0 if not. Since we're hooked up to a
++ *           serial port, we'll say yes _AND return a 1.
++ */
++int
++_DEFUN (isatty, (fd),
++       int fd)
++{
++  return (1);
++}
+diff -ruN gcc-4.7.3-orig/gcc/config/rs6000/libaeabi/kill.c gcc-4.7.3-new/gcc/config/rs6000/libaeabi/kill.c
+--- gcc-4.7.3-orig/gcc/config/rs6000/libaeabi/kill.c	1969-12-31 18:00:00.000000000 -0600
++++ gcc-4.7.3-new/gcc/config/rs6000/libaeabi/kill.c	2013-04-29 18:34:39.627000022 -0500
+@@ -0,0 +1,29 @@
++/* kill.c -- remove a process.
++ *
++ * Copyright (c) 1995 Cygnus Support
++ *
++ * The authors hereby grant permission to use, copy, modify, distribute,
++ * and license this software and its documentation for any purpose, provided
++ * that existing copyright notices are retained in all copies and that this
++ * notice is included verbatim in any distributions. No written agreement,
++ * license, or royalty fee is required for any of the authorized uses.
++ * Modifications to this software may be copyrighted by their authors
++ * and need not follow the licensing terms described here, provided that
++ * the new terms are clearly indicated on the first page of each file where
++ * they apply.
++ */
++#include <unistd.h>
++#include "glue.h"
++
++/*
++ * kill -- go out via exit...
++ */
++int
++_DEFUN (kill, (pid, sig),
++        int pid _AND 
++        int sig)
++{
++  if(pid == __MYPID)
++    _exit(sig);
++  return 0;
++}
+diff -ruN gcc-4.7.3-orig/gcc/config/rs6000/libaeabi/mcount.S gcc-4.7.3-new/gcc/config/rs6000/libaeabi/mcount.S
+--- gcc-4.7.3-orig/gcc/config/rs6000/libaeabi/mcount.S	1969-12-31 18:00:00.000000000 -0600
++++ gcc-4.7.3-new/gcc/config/rs6000/libaeabi/mcount.S	2013-04-29 18:34:39.669000101 -0500
+@@ -0,0 +1,27 @@
++/*
++ * mcount.S -- dummy module for profiling.
++ *
++ * Copyright (c) 1997 Cygnus Support
++ *
++ * The authors hereby grant permission to use, copy, modify, distribute,
++ * and license this software and its documentation for any purpose, provided
++ * that existing copyright notices are retained in all copies and that this
++ * notice is included verbatim in any distributions. No written agreement,
++ * license, or royalty fee is required for any of the authorized uses.
++ * Modifications to this software may be copyrighted by their authors
++ * and need not follow the licensing terms described here, provided that
++ * the new terms are clearly indicated on the first page of each file where
++ * they apply.
++ */
++
++#include "ppc-asm.h"
++
++	.file	"mcount-dummy.S"
++	.text
++FUNC_START(_mcount)
++	mflr	r11
++	lwz	r0,4(sp)
++	mtctr	r11
++	mtlr	r0
++	bctr
++FUNC_END(_mcount)
+diff -ruN gcc-4.7.3-orig/gcc/config/rs6000/libaeabi/putnum.c gcc-4.7.3-new/gcc/config/rs6000/libaeabi/putnum.c
+--- gcc-4.7.3-orig/gcc/config/rs6000/libaeabi/putnum.c	1969-12-31 18:00:00.000000000 -0600
++++ gcc-4.7.3-new/gcc/config/rs6000/libaeabi/putnum.c	2013-04-29 18:34:39.678000079 -0500
+@@ -0,0 +1,41 @@
++/* putnum.c -- put a hex number on the output device.
++ * 
++ * Copyright (c) 1995 Cygnus Support
++ *
++ * The authors hereby grant permission to use, copy, modify, distribute,
++ * and license this software and its documentation for any purpose, provided
++ * that existing copyright notices are retained in all copies and that this
++ * notice is included verbatim in any distributions. No written agreement,
++ * license, or royalty fee is required for any of the authorized uses.
++ * Modifications to this software may be copyrighted by their authors
++ * and need not follow the licensing terms described here, provided that
++ * the new terms are clearly indicated on the first page of each file where
++ * they apply.
++ */
++#include "glue.h"
++
++/*
++ * putnum -- print a 32 bit number in hex
++ */
++void
++_DEFUN (putnum, (num),
++	unsigned int num)
++{
++  char  buf[9];
++  int   cnt;
++  char  *ptr;
++  int   digit;
++  
++  ptr = buf;
++  for (cnt = 7 ; cnt >= 0 ; cnt--) {
++    digit = (num >> (cnt * 4)) & 0xf;
++    
++    if (digit <= 9)
++      *ptr++ = (char) ('0' + digit);
++    else
++      *ptr++ = (char) ('a' - 10 + digit);
++  }
++
++  *ptr = (char) 0;
++  print (buf);
++}
+diff -ruN gcc-4.7.3-orig/gcc/config/rs6000/libaeabi/sim-abort.c gcc-4.7.3-new/gcc/config/rs6000/libaeabi/sim-abort.c
+--- gcc-4.7.3-orig/gcc/config/rs6000/libaeabi/sim-abort.c	1969-12-31 18:00:00.000000000 -0600
++++ gcc-4.7.3-new/gcc/config/rs6000/libaeabi/sim-abort.c	2013-04-29 18:34:39.700000034 -0500
+@@ -0,0 +1,22 @@
++/*
++ * sim-abort.c -- PowerPC abort support when running under the simulator.
++ *
++ * Copyright (c) 1995 Cygnus Support
++ *
++ * The authors hereby grant permission to use, copy, modify, distribute,
++ * and license this software and its documentation for any purpose, provided
++ * that existing copyright notices are retained in all copies and that this
++ * notice is included verbatim in any distributions. No written agreement,
++ * license, or royalty fee is required for any of the authorized uses.
++ * Modifications to this software may be copyrighted by their authors
++ * and need not follow the licensing terms described here, provided that
++ * the new terms are clearly indicated on the first page of each file where
++ * they apply.
++ */
++
++#include <stdlib.h>
++void abort(void)
++{
++  write (2, "Abort called.\n", sizeof("Abort called.\n")-1);
++  exit (1);
++}
+diff -ruN gcc-4.7.3-orig/gcc/config/rs6000/libaeabi/sim-errno.c gcc-4.7.3-new/gcc/config/rs6000/libaeabi/sim-errno.c
+--- gcc-4.7.3-orig/gcc/config/rs6000/libaeabi/sim-errno.c	1969-12-31 18:00:00.000000000 -0600
++++ gcc-4.7.3-new/gcc/config/rs6000/libaeabi/sim-errno.c	2013-04-29 18:34:39.707000107 -0500
+@@ -0,0 +1,28 @@
++/*
++ * sim-errno.c -- return address of errno for current thread.
++ *
++ * Copyright (c) 1995 Cygnus Support
++ *
++ * The authors hereby grant permission to use, copy, modify, distribute,
++ * and license this software and its documentation for any purpose, provided
++ * that existing copyright notices are retained in all copies and that this
++ * notice is included verbatim in any distributions. No written agreement,
++ * license, or royalty fee is required for any of the authorized uses.
++ * Modifications to this software may be copyrighted by their authors
++ * and need not follow the licensing terms described here, provided that
++ * the new terms are clearly indicated on the first page of each file where
++ * they apply.
++ */
++
++#include <errno.h>
++#include <reent.h>
++
++/* syscall handler branches here in case of error. */
++
++int
++_cerror (e)
++     int e;
++{
++  _REENT->_errno = e;
++  return -1;
++}
+diff -ruN gcc-4.7.3-orig/gcc/config/rs6000/libaeabi/sim-getrusage.S gcc-4.7.3-new/gcc/config/rs6000/libaeabi/sim-getrusage.S
+--- gcc-4.7.3-orig/gcc/config/rs6000/libaeabi/sim-getrusage.S	1969-12-31 18:00:00.000000000 -0600
++++ gcc-4.7.3-new/gcc/config/rs6000/libaeabi/sim-getrusage.S	2013-04-29 18:34:39.727999978 -0500
+@@ -0,0 +1,25 @@
++/*
++ * sim-getrusage.S -- PowerPC simulator getrusage call.
++ *
++ * Copyright (c) 1995, 2000, 2001 Cygnus Support
++ *
++ * The authors hereby grant permission to use, copy, modify, distribute,
++ * and license this software and its documentation for any purpose, provided
++ * that existing copyright notices are retained in all copies and that this
++ * notice is included verbatim in any distributions. No written agreement,
++ * license, or royalty fee is required for any of the authorized uses.
++ * Modifications to this software may be copyrighted by their authors
++ * and need not follow the licensing terms described here, provided that
++ * the new terms are clearly indicated on the first page of each file where
++ * they apply.
++ */
++
++#include "ppc-asm.h"
++
++FUNC_START(getrusage)
++	li	r0,117
++	sc
++	bns+	0f
++	b	FUNC_NAME(_cerror)
++0:	blr
++FUNC_END(getrusage)
+diff -ruN gcc-4.7.3-orig/gcc/config/rs6000/libaeabi/sim-inbyte.c gcc-4.7.3-new/gcc/config/rs6000/libaeabi/sim-inbyte.c
+--- gcc-4.7.3-orig/gcc/config/rs6000/libaeabi/sim-inbyte.c	1969-12-31 18:00:00.000000000 -0600
++++ gcc-4.7.3-new/gcc/config/rs6000/libaeabi/sim-inbyte.c	2013-04-29 18:34:39.751000179 -0500
+@@ -0,0 +1,26 @@
++/*
++ * sim-inbyte.c -- read a character from standard input.
++ *
++ * Copyright (c) 1995 Cygnus Support
++ *
++ * The authors hereby grant permission to use, copy, modify, distribute,
++ * and license this software and its documentation for any purpose, provided
++ * that existing copyright notices are retained in all copies and that this
++ * notice is included verbatim in any distributions. No written agreement,
++ * license, or royalty fee is required for any of the authorized uses.
++ * Modifications to this software may be copyrighted by their authors
++ * and need not follow the licensing terms described here, provided that
++ * the new terms are clearly indicated on the first page of each file where
++ * they apply.
++ */
++
++int
++inbyte ()
++{
++  char c;
++
++  if (read (0, &c, 1) <= 0)
++    return -1;
++
++  return c;
++}
+diff -ruN gcc-4.7.3-orig/gcc/config/rs6000/libaeabi/sim-print.c gcc-4.7.3-new/gcc/config/rs6000/libaeabi/sim-print.c
+--- gcc-4.7.3-orig/gcc/config/rs6000/libaeabi/sim-print.c	1969-12-31 18:00:00.000000000 -0600
++++ gcc-4.7.3-new/gcc/config/rs6000/libaeabi/sim-print.c	2013-04-29 18:34:39.768999944 -0500
+@@ -0,0 +1,43 @@
++/* sim-print.c -- print a string on the output device.
++ *
++ * Copyright (c) 1995 Cygnus Support
++ *
++ * The authors hereby grant permission to use, copy, modify, distribute,
++ * and license this software and its documentation for any purpose, provided
++ * that existing copyright notices are retained in all copies and that this
++ * notice is included verbatim in any distributions. No written agreement,
++ * license, or royalty fee is required for any of the authorized uses.
++ * Modifications to this software may be copyrighted by their authors
++ * and need not follow the licensing terms described here, provided that
++ * the new terms are clearly indicated on the first page of each file where
++ * they apply.
++ */
++
++/*
++ * print -- do a raw print of a string
++ */ 
++void
++print (ptr)
++     char *ptr;
++{
++  int len = 0;
++  char *p = ptr;
++
++  while (*p != '\0')
++    p++;
++
++  write (1, ptr, p-ptr);
++}
++
++/*
++ * outbyte -- write a single character.
++ */
++
++void
++outbyte (c_int)
++     int c_int;
++{
++  char c = c_int;
++
++  write (1, &c, 1);
++}
+diff -ruN gcc-4.7.3-orig/gcc/config/rs6000/libaeabi/sim-sbrk.c gcc-4.7.3-new/gcc/config/rs6000/libaeabi/sim-sbrk.c
+--- gcc-4.7.3-orig/gcc/config/rs6000/libaeabi/sim-sbrk.c	1969-12-31 18:00:00.000000000 -0600
++++ gcc-4.7.3-new/gcc/config/rs6000/libaeabi/sim-sbrk.c	2013-04-29 18:34:39.789000253 -0500
+@@ -0,0 +1,31 @@
++/*
++ * sim-sbrk.c -- PowerPC sbrk support when running under the simulator.
++ *
++ * Copyright (c) 1995 Cygnus Support
++ *
++ * The authors hereby grant permission to use, copy, modify, distribute,
++ * and license this software and its documentation for any purpose, provided
++ * that existing copyright notices are retained in all copies and that this
++ * notice is included verbatim in any distributions. No written agreement,
++ * license, or royalty fee is required for any of the authorized uses.
++ * Modifications to this software may be copyrighted by their authors
++ * and need not follow the licensing terms described here, provided that
++ * the new terms are clearly indicated on the first page of each file where
++ * they apply.
++ */
++
++extern char _end[];
++static char *curbrk = _end;
++extern char *brk(char *);
++
++char *
++sbrk (incr)
++     int incr;
++{
++  char *oldbrk = curbrk;
++  curbrk = brk (oldbrk + incr);
++  if (curbrk == oldbrk)
++    return (char *) -1;
++
++  return oldbrk;
++}
+diff -ruN gcc-4.7.3-orig/gcc/config/rs6000/libaeabi/simulator.S gcc-4.7.3-new/gcc/config/rs6000/libaeabi/simulator.S
+--- gcc-4.7.3-orig/gcc/config/rs6000/libaeabi/simulator.S	1969-12-31 18:00:00.000000000 -0600
++++ gcc-4.7.3-new/gcc/config/rs6000/libaeabi/simulator.S	2013-04-29 18:34:39.810999897 -0500
+@@ -0,0 +1,95 @@
++/*
++ * simulator.S -- PowerPC simulator system calls.
++ *
++ * Copyright (c) 1995, 2000, 2001 Cygnus Support
++ *
++ * The authors hereby grant permission to use, copy, modify, distribute,
++ * and license this software and its documentation for any purpose, provided
++ * that existing copyright notices are retained in all copies and that this
++ * notice is included verbatim in any distributions. No written agreement,
++ * license, or royalty fee is required for any of the authorized uses.
++ * Modifications to this software may be copyrighted by their authors
++ * and need not follow the licensing terms described here, provided that
++ * the new terms are clearly indicated on the first page of each file where
++ * they apply.
++ */
++
++#include "ppc-asm.h"
++
++FUNC_START(_exit)
++	li	r0, 1
++	sc
++
++/*
++ * Insure that the debugger tells the client that the PC is in _exit,
++ * not whatever function happens to follow this function.
++ */
++
++0:	trap
++	b	0b			/* we never should return, but... */
++
++FUNC_END(_exit)
++
++FUNC_START(read)
++	li	r0,3
++	sc
++	bnslr+
++	b	FUNC_NAME(_cerror)
++FUNC_END(read)
++
++FUNC_START(write)
++	li	r0,4
++	sc
++	bnslr+
++	b	FUNC_NAME(_cerror)
++FUNC_END(write)
++
++FUNC_START(open)
++	li	r0,5
++	sc
++	bnslr+
++	b	FUNC_NAME(_cerror)
++FUNC_END(open)
++
++FUNC_START(close)
++	li	r0,6
++	sc
++	bnslr+
++	b	FUNC_NAME(_cerror)
++FUNC_END(close)
++
++FUNC_START(brk)
++	li	r0,45
++	sc
++	bnslr+
++	b	FUNC_NAME(_cerror)
++FUNC_END(brk)
++
++FUNC_START(access)
++	li	r0,33
++	sc
++	bnslr+
++	b	FUNC_NAME(_cerror)
++FUNC_END(access)
++
++FUNC_START(dup)
++	li	r0,41
++	sc
++	bnslr+
++	b	FUNC_NAME(_cerror)
++FUNC_END(dup)
++
++FUNC_START(gettimeofday)
++	li	r0,116
++	sc
++	bns+	0f
++	b	FUNC_NAME(_cerror)
++0:	blr
++FUNC_END(gettimeofday)
++
++FUNC_START(lseek)
++	li	r0,199
++	sc
++	bnslr+
++	b	FUNC_NAME(_cerror)
++FUNC_END(lseek)
+diff -ruN gcc-4.7.3-orig/gcc/config/rs6000/libaeabi/stat.c gcc-4.7.3-new/gcc/config/rs6000/libaeabi/stat.c
+--- gcc-4.7.3-orig/gcc/config/rs6000/libaeabi/stat.c	1969-12-31 18:00:00.000000000 -0600
++++ gcc-4.7.3-new/gcc/config/rs6000/libaeabi/stat.c	2013-04-29 18:34:39.826000177 -0500
+@@ -0,0 +1,30 @@
++/* stat.c -- Get the status of a file.
++ *
++ * Copyright (c) 1995 Cygnus Support
++ *
++ * The authors hereby grant permission to use, copy, modify, distribute,
++ * and license this software and its documentation for any purpose, provided
++ * that existing copyright notices are retained in all copies and that this
++ * notice is included verbatim in any distributions. No written agreement,
++ * license, or royalty fee is required for any of the authorized uses.
++ * Modifications to this software may be copyrighted by their authors
++ * and need not follow the licensing terms described here, provided that
++ * the new terms are clearly indicated on the first page of each file where
++ * they apply.
++ */
++#include <sys/stat.h>
++#include <errno.h>
++#include "glue.h"
++
++/*
++ * stat -- Since we have no file system, we just return an error.
++ */
++int
++_DEFUN (stat, (path, buf),
++       const char *path _AND
++       struct stat *buf)
++{
++  errno = EIO;
++  return (-1);
++}
++
+diff -ruN gcc-4.7.3-orig/gcc/config/rs6000/libaeabi/unlink.c gcc-4.7.3-new/gcc/config/rs6000/libaeabi/unlink.c
+--- gcc-4.7.3-orig/gcc/config/rs6000/libaeabi/unlink.c	1969-12-31 18:00:00.000000000 -0600
++++ gcc-4.7.3-new/gcc/config/rs6000/libaeabi/unlink.c	2013-04-29 18:34:39.846999914 -0500
+@@ -0,0 +1,28 @@
++/* unlink.c -- remove a file.
++ * 
++ * Copyright (c) 1995 Cygnus Support
++ *
++ * The authors hereby grant permission to use, copy, modify, distribute,
++ * and license this software and its documentation for any purpose, provided
++ * that existing copyright notices are retained in all copies and that this
++ * notice is included verbatim in any distributions. No written agreement,
++ * license, or royalty fee is required for any of the authorized uses.
++ * Modifications to this software may be copyrighted by their authors
++ * and need not follow the licensing terms described here, provided that
++ * the new terms are clearly indicated on the first page of each file where
++ * they apply.
++ */
++#include <errno.h>
++#include "glue.h"
++
++/*
++ * unlink -- since we have no file system, 
++ *           we just return an error.
++ */
++int
++_DEFUN (unlink, (path),
++        char * path)
++{
++  errno = EIO;
++  return (-1);
++}
+diff -ruN gcc-4.7.3-orig/gcc/config/rs6000/sysv4.h gcc-4.7.3-new/gcc/config/rs6000/sysv4.h
+--- gcc-4.7.3-orig/gcc/config/rs6000/sysv4.h	2013-04-29 16:40:59.757000074 -0500
++++ gcc-4.7.3-new/gcc/config/rs6000/sysv4.h	2013-04-29 18:10:58.189000389 -0500
+@@ -673,6 +673,7 @@
+   mcall-linux  : %(startfile_linux)       ; \
+   mcall-netbsd : %(startfile_netbsd)      ; \
+   mcall-openbsd: %(startfile_openbsd)     ; \
++  maeabi       : %(startfile_aeabi)       ; \
+                : %(startfile_default)     }"
+ 
+ #define	STARTFILE_DEFAULT_SPEC "ecrti.o%s crtbegin.o%s"
+@@ -687,6 +688,7 @@
+   mcall-linux  : %(lib_linux)       ; \
+   mcall-netbsd : %(lib_netbsd)      ; \
+   mcall-openbsd: %(lib_openbsd)     ; \
++  maeabi       : %(lib_aeabi)       ; \
+                : %(lib_default)     }"
+ 
+ #define LIB_DEFAULT_SPEC "-lc"
+@@ -701,6 +703,7 @@
+   mcall-linux  : %(endfile_linux)       ; \
+   mcall-netbsd : %(endfile_netbsd)      ; \
+   mcall-openbsd: %(endfile_openbsd)     ; \
++  maeabi       : %(endfile_aeabi)       ; \
+                : %(crtsavres_default) %(endfile_default)     }"
+ 
+ #define CRTSAVRES_DEFAULT_SPEC ""
diff --git a/recipes-devtools/gcc/gcc-4.9/0040-fix-g++-sysroot.patch b/recipes-devtools/gcc/gcc-4.9/0040-fix-g++-sysroot.patch
new file mode 100644
index 0000000..d50aa5c
--- /dev/null
+++ b/recipes-devtools/gcc/gcc-4.9/0040-fix-g++-sysroot.patch
@@ -0,0 +1,40 @@
+Portions of
+
+http://www.mail-archive.com/gcc-patches@gcc.gnu.org/msg26013.html
+
+are not upstreamed yet. So lets keep missing pieces.
+
+Upstream-Status: Pending
+
+Signed-off-by: Khem Raj <raj.khem at gmail.com>
+
+Index: gcc-4.8.1/gcc/configure.ac
+===================================================================
+--- gcc-4.8.1.orig/gcc/configure.ac	2013-07-15 15:55:49.488399132 -0700
++++ gcc-4.8.1/gcc/configure.ac	2013-07-15 16:02:31.772406679 -0700
+@@ -148,7 +148,9 @@
+ if test "${with_sysroot+set}" = set; then
+   gcc_gxx_without_sysroot=`expr "${gcc_gxx_include_dir}" : "${with_sysroot}"'\(.*\)'`
+   if test "${gcc_gxx_without_sysroot}"; then
+-    gcc_gxx_include_dir="${gcc_gxx_without_sysroot}"
++    if test x${with_sysroot} != x/; then
++      gcc_gxx_include_dir="${gcc_gxx_without_sysroot}"
++    fi
+     gcc_gxx_include_dir_add_sysroot=1
+   fi
+ fi
+Index: gcc-4.8.1/gcc/configure
+===================================================================
+--- gcc-4.8.1.orig/gcc/configure	2013-07-15 15:55:49.472399132 -0700
++++ gcc-4.8.1/gcc/configure	2013-07-15 16:02:31.780406680 -0700
+@@ -3325,7 +3325,9 @@
+ if test "${with_sysroot+set}" = set; then
+   gcc_gxx_without_sysroot=`expr "${gcc_gxx_include_dir}" : "${with_sysroot}"'\(.*\)'`
+   if test "${gcc_gxx_without_sysroot}"; then
+-    gcc_gxx_include_dir="${gcc_gxx_without_sysroot}"
++    if test x${with_sysroot} != x/; then
++      gcc_gxx_include_dir="${gcc_gxx_without_sysroot}"
++    fi
+     gcc_gxx_include_dir_add_sysroot=1
+   fi
+ fi
diff --git a/recipes-devtools/gcc/gcc-4.9/0040.gcc.rm_e500v2_loops_48.patch b/recipes-devtools/gcc/gcc-4.9/0040.gcc.rm_e500v2_loops_48.patch
new file mode 100644
index 0000000..821ff3e
--- /dev/null
+++ b/recipes-devtools/gcc/gcc-4.9/0040.gcc.rm_e500v2_loops_48.patch
@@ -0,0 +1,795 @@
+diff --git a/gcc/testsuite/gfortran.dg/alloc_comp_default_init_1.f90 b/gcc/testsuite/gfortran.dg/alloc_comp_default_init_1.f90
+deleted file mode 100644
+index 48947cd..0000000
+--- a/gcc/testsuite/gfortran.dg/alloc_comp_default_init_1.f90
++++ /dev/null
+@@ -1,84 +0,0 @@
+-! { dg-do run }
+-! Checks the fixes for PR34681 and PR34704, in which various mixtures
+-! of default initializer and allocatable array were not being handled
+-! correctly for derived types with allocatable components.
+-!
+-! Contributed by Paolo Giannozzi <p.giannozzi at fisica.uniud.it>
+-!
+-program boh
+-  integer :: c1, c2, c3, c4, c5
+-  !
+-  call mah (0, c1) ! These calls deal with PR34681
+-  call mah (1, c2)
+-  call mah (2, c3)
+-  !
+-  if (c1 /= c2) call abort
+-  if (c1 /= c3) call abort
+-  !
+-  call mah0 (c4) ! These calls deal with PR34704
+-  call mah1 (c5)
+-  !
+-  if (c4 /= c5) call abort
+-  !
+-end program boh
+-!
+-subroutine mah (i, c)
+-  !
+-  integer, intent(in) :: i
+-  integer, intent(OUT) :: c
+-  !
+-  type mix_type
+-     real(8), allocatable :: a(:)
+-     complex(8), allocatable :: b(:)
+-  end type mix_type
+-  type(mix_type), allocatable, save :: t(:)
+-  integer :: j, n=1024
+-  !
+-  if (i==0) then
+-     allocate (t(1))
+-     allocate (t(1)%a(n))
+-     allocate (t(1)%b(n))
+-     do j=1,n
+-        t(1)%a(j) = j
+-        t(1)%b(j) = n-j
+-     end do
+-  end if
+-  c = sum( t(1)%a(:) ) + sum( t(1)%b(:) )
+-  if ( i==2) then
+-     deallocate (t(1)%b)
+-     deallocate (t(1)%a)
+-     deallocate (t)
+-  end if
+-end subroutine mah
+-
+-subroutine mah0 (c)
+-  !
+-  integer, intent(OUT) :: c
+-  type mix_type
+-     real(8), allocatable :: a(:)
+-     integer :: n=1023
+-  end type mix_type
+-  type(mix_type) :: t
+-  !
+-  allocate(t%a(1))
+-  t%a=3.1415926
+-  c = t%n
+-  deallocate(t%a)
+-  !
+-end subroutine mah0
+-!
+-subroutine mah1 (c)
+-  !
+-  integer, intent(OUT) :: c
+-  type mix_type
+-     real(8), allocatable :: a(:)
+-     integer :: n=1023
+-  end type mix_type
+-  type(mix_type), save :: t
+-  !
+-  allocate(t%a(1))
+-  t%a=3.1415926
+-  c = t%n
+-  deallocate(t%a)
+-  !
+-end subroutine mah1
+diff -ruN gcc-4.8.0-orig/gcc/testsuite/gfortran.dg/specifics_1.f90 gcc-4.8.0/gcc/testsuite/gfortran.dg/specifics_1.f90
+--- gcc-4.8.0-orig/gcc/testsuite/gfortran.dg/specifics_1.f90	2013-05-06 13:02:17.560000510 -0500
++++ gcc-4.8.0/gcc/testsuite/gfortran.dg/specifics_1.f90	1969-12-31 18:00:00.000000000 -0600
+@@ -1,318 +0,0 @@
+-! Program to test intrinsic functions as actual arguments
+-!
+-! Copied from gfortran.fortran-torture/execute/specifics.f90
+-! Please keep them in sync
+-!
+-! It is run here with -ff2c option
+-!
+-! { dg-do run }
+-! { dg-options "-ff2c" }
+-! Program to test intrinsic functions as actual arguments
+-subroutine test_c(fn, val, res)
+-  complex fn
+-  complex val, res
+-
+-  if (diff(fn(val),res)) call abort
+-contains
+-function diff(a,b)
+-  complex a,b
+-  logical diff
+-  diff = (abs(a - b) .gt. 0.00001)
+-end function
+-end subroutine 
+-
+-subroutine test_z(fn, val, res)
+-  double complex fn
+-  double complex val, res
+-
+-  if (diff(fn(val),res)) call abort
+-contains
+-function diff(a,b)
+-  double complex a,b
+-  logical diff
+-  diff = (abs(a - b) .gt. 0.00001)
+-end function
+-end subroutine 
+-
+-subroutine test_cabs(fn, val, res)
+-  real fn, res
+-  complex val
+-
+-  if (diff(fn(val),res)) call abort
+-contains
+-function diff(a,b)
+-  real a,b
+-  logical diff
+-  diff = (abs(a - b) .gt. 0.00001)
+-end function
+-end subroutine 
+-
+-subroutine test_cdabs(fn, val, res)
+-  double precision fn, res
+-  double complex val
+-
+-  if (diff(fn(val),res)) call abort
+-contains
+-function diff(a,b)
+-  double precision a,b
+-  logical diff
+-  diff = (abs(a - b) .gt. 0.00001)
+-end function
+-end subroutine 
+-
+-subroutine test_r(fn, val, res)
+-  real fn
+-  real val, res
+-
+-  if (diff(fn(val), res)) call abort
+-contains
+-function diff(a, b)
+-  real a, b
+-  logical diff
+-  diff = (abs(a - b) .gt. 0.00001)
+-end function
+-end subroutine
+-
+-subroutine test_d(fn, val, res)
+-  double precision fn
+-  double precision val, res
+-
+-  if (diff(fn(val), res)) call abort
+-contains
+-function diff(a, b)
+-  double precision a, b
+-  logical diff
+-  diff = (abs(a - b) .gt. 0.00001d0)
+-end function
+-end subroutine
+-
+-subroutine test_r2(fn, val1, val2, res)
+-  real fn
+-  real val1, val2, res
+-
+-  if (diff(fn(val1, val2), res)) call abort
+-contains
+-function diff(a, b)
+-  real a, b
+-  logical diff
+-  diff = (abs(a - b) .gt. 0.00001)
+-end function
+-end subroutine
+-
+-subroutine test_d2(fn, val1, val2, res)
+-  double precision fn
+-  double precision val1, val2, res
+-
+-  if (diff(fn(val1, val2), res)) call abort
+-contains
+-function diff(a, b)
+-  double precision a, b
+-  logical diff
+-  diff = (abs(a - b) .gt. 0.00001d0)
+-end function
+-end subroutine
+-
+-subroutine test_dprod(fn)
+-  double precision fn
+-  if (abs (fn (2.0, 3.0) - 6d0) .gt. 0.00001) call abort
+-end subroutine
+-
+-subroutine test_nint(fn,val,res)
+-  integer fn, res
+-  real val
+-  if (res .ne. fn(val)) call abort
+-end subroutine
+-
+-subroutine test_idnint(fn,val,res)
+-  integer fn, res
+-  double precision val
+-  if (res .ne. fn(val)) call abort
+-end subroutine
+-
+-subroutine test_idim(fn,val1,val2,res)
+-  integer fn, res, val1, val2
+-  if (res .ne. fn(val1,val2)) call abort
+-end subroutine
+-
+-subroutine test_iabs(fn,val,res)
+-  integer fn, res, val
+-  if (res .ne. fn(val)) call abort
+-end subroutine
+-
+-subroutine test_len(fn,val,res)
+-  integer fn, res
+-  character(len=*) val
+-  if (res .ne. fn(val)) call abort
+-end subroutine
+-
+-subroutine test_index(fn,val1,val2,res)
+-  integer fn, res
+-  character(len=*) val1, val2
+-  if (fn(val1,val2) .ne. res) call abort
+-end subroutine
+-
+-program specifics
+-  intrinsic abs
+-  intrinsic aint
+-  intrinsic anint
+-  intrinsic acos
+-  intrinsic acosh
+-  intrinsic asin
+-  intrinsic asinh
+-  intrinsic atan
+-  intrinsic atanh
+-  intrinsic cos
+-  intrinsic sin
+-  intrinsic tan
+-  intrinsic cosh
+-  intrinsic sinh
+-  intrinsic tanh
+-  intrinsic alog
+-  intrinsic alog10
+-  intrinsic exp
+-  intrinsic sign
+-  intrinsic isign
+-  intrinsic amod
+-
+-  intrinsic dabs
+-  intrinsic dint
+-  intrinsic dnint
+-  intrinsic dacos
+-  intrinsic dacosh
+-  intrinsic dasin
+-  intrinsic dasinh
+-  intrinsic datan
+-  intrinsic datanh
+-  intrinsic dcos
+-  intrinsic dsin
+-  intrinsic dtan
+-  intrinsic dcosh
+-  intrinsic dsinh
+-  intrinsic dtanh
+-  intrinsic dlog
+-  intrinsic dlog10
+-  intrinsic dexp
+-  intrinsic dsign
+-  intrinsic dmod
+-
+-  intrinsic conjg
+-  intrinsic ccos
+-  intrinsic cexp
+-  intrinsic clog
+-  intrinsic csin
+-  intrinsic csqrt
+-
+-  intrinsic dconjg
+-  intrinsic cdcos
+-  intrinsic cdexp
+-  intrinsic cdlog
+-  intrinsic cdsin
+-  intrinsic cdsqrt
+-  intrinsic zcos
+-  intrinsic zexp
+-  intrinsic zlog
+-  intrinsic zsin
+-  intrinsic zsqrt
+-
+-  intrinsic cabs
+-  intrinsic cdabs
+-  intrinsic zabs
+-
+-  intrinsic dprod
+-
+-  intrinsic nint
+-  intrinsic idnint
+-  intrinsic dim
+-  intrinsic ddim
+-  intrinsic idim
+-  intrinsic iabs
+-  intrinsic mod
+-  intrinsic len
+-  intrinsic index
+-
+-  intrinsic aimag
+-  intrinsic dimag
+-
+-  call test_r (abs, -1.0, abs(-1.0))
+-  call test_r (aint, 1.7, aint(1.7))
+-  call test_r (anint, 1.7, anint(1.7))
+-  call test_r (acos, 0.5, acos(0.5))
+-  call test_r (acosh, 1.5, acosh(1.5))
+-  call test_r (asin, 0.5, asin(0.5))
+-  call test_r (asinh, 0.5, asinh(0.5))
+-  call test_r (atan, 0.5, atan(0.5))
+-  call test_r (atanh, 0.5, atanh(0.5))
+-  call test_r (cos, 1.0, cos(1.0))
+-  call test_r (sin, 1.0, sin(1.0))
+-  call test_r (tan, 1.0, tan(1.0))
+-  call test_r (cosh, 1.0, cosh(1.0))
+-  call test_r (sinh, 1.0, sinh(1.0))
+-  call test_r (tanh, 1.0, tanh(1.0))
+-  call test_r (alog, 2.0, alog(2.0))
+-  call test_r (alog10, 2.0, alog10(2.0))
+-  call test_r (exp, 1.0, exp(1.0))
+-  call test_r2 (sign, 1.0, -2.0, sign(1.0, -2.0))
+-  call test_r2 (amod, 3.5, 2.0, amod(3.5, 2.0))
+-  
+-  call test_d (dabs, -1d0, abs(-1d0))
+-  call test_d (dint, 1.7d0, 1d0)
+-  call test_d (dnint, 1.7d0, 2d0)
+-  call test_d (dacos, 0.5d0, dacos(0.5d0))
+-  call test_d (dacosh, 1.5d0, dacosh(1.5d0))
+-  call test_d (dasin, 0.5d0, dasin(0.5d0))
+-  call test_d (dasinh, 0.5d0, dasinh(0.5d0))
+-  call test_d (datan, 0.5d0, datan(0.5d0))
+-  call test_d (datanh, 0.5d0, datanh(0.5d0))
+-  call test_d (dcos, 1d0, dcos(1d0))
+-  call test_d (dsin, 1d0, dsin(1d0))
+-  call test_d (dtan, 1d0, dtan(1d0))
+-  call test_d (dcosh, 1d0, dcosh(1d0))
+-  call test_d (dsinh, 1d0, dsinh(1d0))
+-  call test_d (dtanh, 1d0, dtanh(1d0))
+-  call test_d (dlog, 2d0, dlog(2d0))
+-  call test_d (dlog10, 2d0, dlog10(2d0))
+-  call test_d (dexp, 1d0, dexp(1d0))
+-  call test_d2 (dsign, 1d0, -2d0, sign(1d0, -2d0))
+-  call test_d2 (dmod, 3.5d0, 2d0, dmod(3.5d0, 2d0))
+-
+-  call test_dprod (dprod)
+-
+-  call test_c (conjg, (1.2,-4.), conjg((1.2,-4.)))
+-  call test_c (ccos, (1.2,-4.), ccos((1.2,-4.)))
+-  call test_c (cexp, (1.2,-4.), cexp((1.2,-4.)))
+-  call test_c (clog, (1.2,-4.), clog((1.2,-4.)))
+-  call test_c (csin, (1.2,-4.), csin((1.2,-4.)))
+-  call test_c (csqrt, (1.2,-4.), csqrt((1.2,-4.)))
+-
+-  call test_z (dconjg, (1.2d0,-4.d0), dconjg((1.2d0,-4.d0)))
+-  call test_z (cdcos, (1.2d0,-4.d0), cdcos((1.2d0,-4.d0)))
+-  call test_z (zcos, (1.2d0,-4.d0), zcos((1.2d0,-4.d0)))
+-  call test_z (cdexp, (1.2d0,-4.d0), cdexp((1.2d0,-4.d0)))
+-  call test_z (zexp, (1.2d0,-4.d0), zexp((1.2d0,-4.d0)))
+-  call test_z (cdlog, (1.2d0,-4.d0), cdlog((1.2d0,-4.d0)))
+-  call test_z (zlog, (1.2d0,-4.d0), zlog((1.2d0,-4.d0)))
+-  call test_z (cdsin, (1.2d0,-4.d0), cdsin((1.2d0,-4.d0)))
+-  call test_z (zsin, (1.2d0,-4.d0), zsin((1.2d0,-4.d0)))
+-  call test_z (cdsqrt, (1.2d0,-4.d0), cdsqrt((1.2d0,-4.d0)))
+-  call test_z (zsqrt, (1.2d0,-4.d0), zsqrt((1.2d0,-4.d0)))
+-
+-  call test_cabs (cabs, (1.2,-4.), cabs((1.2,-4.)))
+-  call test_cdabs (cdabs, (1.2d0,-4.d0), cdabs((1.2d0,-4.d0)))
+-  call test_cdabs (zabs, (1.2d0,-4.d0), zabs((1.2d0,-4.d0)))
+-  call test_cabs (aimag, (1.2,-4.), aimag((1.2,-4.)))
+-  call test_cdabs (dimag, (1.2d0,-4.d0), dimag((1.2d0,-4.d0)))
+-
+-  call test_nint (nint, -1.2, nint(-1.2))
+-  call test_idnint (idnint, -1.2d0, idnint(-1.2d0))
+-  call test_idim (isign, -42, 17, isign(-42, 17))
+-  call test_idim (idim, -42, 17, idim(-42,17))
+-  call test_idim (idim, 42, 17, idim(42,17))
+-  call test_r2 (dim, 1.2, -4., dim(1.2, -4.))
+-  call test_d2 (ddim, 1.2d0, -4.d0, ddim(1.2d0, -4.d0))
+-  call test_iabs (iabs, -7, iabs(-7))
+-  call test_idim (mod, 5, 2, mod(5,2))
+-  call test_len (len, "foobar", len("foobar"))
+-  call test_index (index, "foobarfoobar", "bar", index("foobarfoobar","bar"))
+-
+-end program
+-
+diff -ruN gcc-4.8.0-orig/gcc/testsuite/gfortran.fortran-torture/execute/intrinsic_nearest.x gcc-4.8.0/gcc/testsuite/gfortran.fortran-torture/execute/intrinsic_nearest.x
+--- gcc-4.8.0-orig/gcc/testsuite/gfortran.fortran-torture/execute/intrinsic_nearest.x	2013-05-06 13:02:11.078000510 -0500
++++ gcc-4.8.0/gcc/testsuite/gfortran.fortran-torture/execute/intrinsic_nearest.x	2013-05-06 13:06:55.129000422 -0500
+@@ -2,5 +2,9 @@
+     # No Inf/NaN support on SPU.
+     return 1
+ }
++if [istarget "powerpc-*-*gnuspe"] {
++    # No Inf/NaN support on SPE.
++    return 1
++}
+ add-ieee-options
+ return 0
+diff -ruN gcc-4.8.0-orig/gcc/testsuite/gfortran.fortran-torture/execute/specifics.f90 gcc-4.8.0/gcc/testsuite/gfortran.fortran-torture/execute/specifics.f90
+--- gcc-4.8.0-orig/gcc/testsuite/gfortran.fortran-torture/execute/specifics.f90	2013-05-06 13:02:11.093000510 -0500
++++ gcc-4.8.0/gcc/testsuite/gfortran.fortran-torture/execute/specifics.f90	1969-12-31 18:00:00.000000000 -0600
+@@ -1,311 +0,0 @@
+-! Program to test intrinsic functions as actual arguments
+-!
+-! Please keep the content of this file in sync with gfortran.dg/specifics_1.f90
+-subroutine test_c(fn, val, res)
+-  complex fn
+-  complex val, res
+-
+-  if (diff(fn(val),res)) call abort
+-contains
+-function diff(a,b)
+-  complex a,b
+-  logical diff
+-  diff = (abs(a - b) .gt. 0.00001)
+-end function
+-end subroutine 
+-
+-subroutine test_z(fn, val, res)
+-  double complex fn
+-  double complex val, res
+-
+-  if (diff(fn(val),res)) call abort
+-contains
+-function diff(a,b)
+-  double complex a,b
+-  logical diff
+-  diff = (abs(a - b) .gt. 0.00001)
+-end function
+-end subroutine 
+-
+-subroutine test_cabs(fn, val, res)
+-  real fn, res
+-  complex val
+-
+-  if (diff(fn(val),res)) call abort
+-contains
+-function diff(a,b)
+-  real a,b
+-  logical diff
+-  diff = (abs(a - b) .gt. 0.00001)
+-end function
+-end subroutine 
+-
+-subroutine test_cdabs(fn, val, res)
+-  double precision fn, res
+-  double complex val
+-
+-  if (diff(fn(val),res)) call abort
+-contains
+-function diff(a,b)
+-  double precision a,b
+-  logical diff
+-  diff = (abs(a - b) .gt. 0.00001)
+-end function
+-end subroutine 
+-
+-subroutine test_r(fn, val, res)
+-  real fn
+-  real val, res
+-
+-  if (diff(fn(val), res)) call abort
+-contains
+-function diff(a, b)
+-  real a, b
+-  logical diff
+-  diff = (abs(a - b) .gt. 0.00001)
+-end function
+-end subroutine
+-
+-subroutine test_d(fn, val, res)
+-  double precision fn
+-  double precision val, res
+-
+-  if (diff(fn(val), res)) call abort
+-contains
+-function diff(a, b)
+-  double precision a, b
+-  logical diff
+-  diff = (abs(a - b) .gt. 0.00001d0)
+-end function
+-end subroutine
+-
+-subroutine test_r2(fn, val1, val2, res)
+-  real fn
+-  real val1, val2, res
+-
+-  if (diff(fn(val1, val2), res)) call abort
+-contains
+-function diff(a, b)
+-  real a, b
+-  logical diff
+-  diff = (abs(a - b) .gt. 0.00001)
+-end function
+-end subroutine
+-
+-subroutine test_d2(fn, val1, val2, res)
+-  double precision fn
+-  double precision val1, val2, res
+-
+-  if (diff(fn(val1, val2), res)) call abort
+-contains
+-function diff(a, b)
+-  double precision a, b
+-  logical diff
+-  diff = (abs(a - b) .gt. 0.00001d0)
+-end function
+-end subroutine
+-
+-subroutine test_dprod(fn)
+-  double precision fn
+-  if (abs (fn (2.0, 3.0) - 6d0) .gt. 0.00001) call abort
+-end subroutine
+-
+-subroutine test_nint(fn,val,res)
+-  integer fn, res
+-  real val
+-  if (res .ne. fn(val)) call abort
+-end subroutine
+-
+-subroutine test_idnint(fn,val,res)
+-  integer fn, res
+-  double precision val
+-  if (res .ne. fn(val)) call abort
+-end subroutine
+-
+-subroutine test_idim(fn,val1,val2,res)
+-  integer fn, res, val1, val2
+-  if (res .ne. fn(val1,val2)) call abort
+-end subroutine
+-
+-subroutine test_iabs(fn,val,res)
+-  integer fn, res, val
+-  if (res .ne. fn(val)) call abort
+-end subroutine
+-
+-subroutine test_len(fn,val,res)
+-  integer fn, res
+-  character(len=*) val
+-  if (res .ne. fn(val)) call abort
+-end subroutine
+-
+-subroutine test_index(fn,val1,val2,res)
+-  integer fn, res
+-  character(len=*) val1, val2
+-  if (fn(val1,val2) .ne. res) call abort
+-end subroutine
+-
+-program specifics
+-  intrinsic abs
+-  intrinsic aint
+-  intrinsic anint
+-  intrinsic acos
+-  intrinsic acosh
+-  intrinsic asin
+-  intrinsic asinh
+-  intrinsic atan
+-  intrinsic atanh
+-  intrinsic cos
+-  intrinsic sin
+-  intrinsic tan
+-  intrinsic cosh
+-  intrinsic sinh
+-  intrinsic tanh
+-  intrinsic alog
+-  intrinsic alog10
+-  intrinsic exp
+-  intrinsic sign
+-  intrinsic isign
+-  intrinsic amod
+-
+-  intrinsic dabs
+-  intrinsic dint
+-  intrinsic dnint
+-  intrinsic dacos
+-  intrinsic dacosh
+-  intrinsic dasin
+-  intrinsic dasinh
+-  intrinsic datan
+-  intrinsic datanh
+-  intrinsic dcos
+-  intrinsic dsin
+-  intrinsic dtan
+-  intrinsic dcosh
+-  intrinsic dsinh
+-  intrinsic dtanh
+-  intrinsic dlog
+-  intrinsic dlog10
+-  intrinsic dexp
+-  intrinsic dsign
+-  intrinsic dmod
+-
+-  intrinsic conjg
+-  intrinsic ccos
+-  intrinsic cexp
+-  intrinsic clog
+-  intrinsic csin
+-  intrinsic csqrt
+-
+-  intrinsic dconjg
+-  intrinsic cdcos
+-  intrinsic cdexp
+-  intrinsic cdlog
+-  intrinsic cdsin
+-  intrinsic cdsqrt
+-  intrinsic zcos
+-  intrinsic zexp
+-  intrinsic zlog
+-  intrinsic zsin
+-  intrinsic zsqrt
+-
+-  intrinsic cabs
+-  intrinsic cdabs
+-  intrinsic zabs
+-
+-  intrinsic dprod
+-
+-  intrinsic nint
+-  intrinsic idnint
+-  intrinsic dim
+-  intrinsic ddim
+-  intrinsic idim
+-  intrinsic iabs
+-  intrinsic mod
+-  intrinsic len
+-  intrinsic index
+-
+-  intrinsic aimag
+-  intrinsic dimag
+-
+-  call test_r (abs, -1.0, abs(-1.0))
+-  call test_r (aint, 1.7, aint(1.7))
+-  call test_r (anint, 1.7, anint(1.7))
+-  call test_r (acos, 0.5, acos(0.5))
+-  call test_r (acosh, 1.5, acosh(1.5))
+-  call test_r (asin, 0.5, asin(0.5))
+-  call test_r (asinh, 0.5, asinh(0.5))
+-  call test_r (atan, 0.5, atan(0.5))
+-  call test_r (atanh, 0.5, atanh(0.5))
+-  call test_r (cos, 1.0, cos(1.0))
+-  call test_r (sin, 1.0, sin(1.0))
+-  call test_r (tan, 1.0, tan(1.0))
+-  call test_r (cosh, 1.0, cosh(1.0))
+-  call test_r (sinh, 1.0, sinh(1.0))
+-  call test_r (tanh, 1.0, tanh(1.0))
+-  call test_r (alog, 2.0, alog(2.0))
+-  call test_r (alog10, 2.0, alog10(2.0))
+-  call test_r (exp, 1.0, exp(1.0))
+-  call test_r2 (sign, 1.0, -2.0, sign(1.0, -2.0))
+-  call test_r2 (amod, 3.5, 2.0, amod(3.5, 2.0))
+-  
+-  call test_d (dabs, -1d0, abs(-1d0))
+-  call test_d (dint, 1.7d0, 1d0)
+-  call test_d (dnint, 1.7d0, 2d0)
+-  call test_d (dacos, 0.5d0, dacos(0.5d0))
+-  call test_d (dacosh, 1.5d0, dacosh(1.5d0))
+-  call test_d (dasin, 0.5d0, dasin(0.5d0))
+-  call test_d (dasinh, 0.5d0, dasinh(0.5d0))
+-  call test_d (datan, 0.5d0, datan(0.5d0))
+-  call test_d (datanh, 0.5d0, datanh(0.5d0))
+-  call test_d (dcos, 1d0, dcos(1d0))
+-  call test_d (dsin, 1d0, dsin(1d0))
+-  call test_d (dtan, 1d0, dtan(1d0))
+-  call test_d (dcosh, 1d0, dcosh(1d0))
+-  call test_d (dsinh, 1d0, dsinh(1d0))
+-  call test_d (dtanh, 1d0, dtanh(1d0))
+-  call test_d (dlog, 2d0, dlog(2d0))
+-  call test_d (dlog10, 2d0, dlog10(2d0))
+-  call test_d (dexp, 1d0, dexp(1d0))
+-  call test_d2 (dsign, 1d0, -2d0, sign(1d0, -2d0))
+-  call test_d2 (dmod, 3.5d0, 2d0, dmod(3.5d0, 2d0))
+-
+-  call test_dprod (dprod)
+-
+-  call test_c (conjg, (1.2,-4.), conjg((1.2,-4.)))
+-  call test_c (ccos, (1.2,-4.), ccos((1.2,-4.)))
+-  call test_c (cexp, (1.2,-4.), cexp((1.2,-4.)))
+-  call test_c (clog, (1.2,-4.), clog((1.2,-4.)))
+-  call test_c (csin, (1.2,-4.), csin((1.2,-4.)))
+-  call test_c (csqrt, (1.2,-4.), csqrt((1.2,-4.)))
+-
+-  call test_z (dconjg, (1.2d0,-4.d0), dconjg((1.2d0,-4.d0)))
+-  call test_z (cdcos, (1.2d0,-4.d0), cdcos((1.2d0,-4.d0)))
+-  call test_z (zcos, (1.2d0,-4.d0), zcos((1.2d0,-4.d0)))
+-  call test_z (cdexp, (1.2d0,-4.d0), cdexp((1.2d0,-4.d0)))
+-  call test_z (zexp, (1.2d0,-4.d0), zexp((1.2d0,-4.d0)))
+-  call test_z (cdlog, (1.2d0,-4.d0), cdlog((1.2d0,-4.d0)))
+-  call test_z (zlog, (1.2d0,-4.d0), zlog((1.2d0,-4.d0)))
+-  call test_z (cdsin, (1.2d0,-4.d0), cdsin((1.2d0,-4.d0)))
+-  call test_z (zsin, (1.2d0,-4.d0), zsin((1.2d0,-4.d0)))
+-  call test_z (cdsqrt, (1.2d0,-4.d0), cdsqrt((1.2d0,-4.d0)))
+-  call test_z (zsqrt, (1.2d0,-4.d0), zsqrt((1.2d0,-4.d0)))
+-
+-  call test_cabs (cabs, (1.2,-4.), cabs((1.2,-4.)))
+-  call test_cdabs (cdabs, (1.2d0,-4.d0), cdabs((1.2d0,-4.d0)))
+-  call test_cdabs (zabs, (1.2d0,-4.d0), zabs((1.2d0,-4.d0)))
+-  call test_cabs (aimag, (1.2,-4.), aimag((1.2,-4.)))
+-  call test_cdabs (dimag, (1.2d0,-4.d0), dimag((1.2d0,-4.d0)))
+-
+-  call test_nint (nint, -1.2, nint(-1.2))
+-  call test_idnint (idnint, -1.2d0, idnint(-1.2d0))
+-  call test_idim (isign, -42, 17, isign(-42, 17))
+-  call test_idim (idim, -42, 17, idim(-42,17))
+-  call test_idim (idim, 42, 17, idim(42,17))
+-  call test_r2 (dim, 1.2, -4., dim(1.2, -4.))
+-  call test_d2 (ddim, 1.2d0, -4.d0, ddim(1.2d0, -4.d0))
+-  call test_iabs (iabs, -7, iabs(-7))
+-  call test_idim (mod, 5, 2, mod(5,2))
+-  call test_len (len, "foobar", len("foobar"))
+-  call test_index (index, "foobarfoobar", "bar", index("foobarfoobar","bar"))
+-
+-end program
+-
+diff -ruN gcc-4.8.0-orig/gcc/testsuite/gfortran.dg/PR49268.f90 gcc-4.8.0/gcc/testsuite/gfortran.dg/PR49268.f90
+--- gcc-4.8.0-orig/gcc/testsuite/gfortran.dg/PR49268.f90	2013-05-06 15:04:59.318000510 -0500
++++ gcc-4.8.0/gcc/testsuite/gfortran.dg/PR49268.f90	1969-12-31 18:00:00.000000000 -0600
+@@ -1,51 +0,0 @@
+-! { dg-do run }
+-! { dg-options "-fcray-pointer" }
+-
+-! Test the fix for a runtime error 
+-! Contributed by Mike Kumbera <kumbera1 at llnl.gov>
+-
+-        program bob
+-        implicit none
+-        integer*8 ipfoo
+-        integer n,m,i,j
+-        real*8 foo
+-        
+-        common /ipdata/ ipfoo
+-        common /ipsize/ n,m
+-        POINTER ( ipfoo, foo(3,7) )
+-
+-        n=3
+-        m=7
+-
+-        ipfoo=malloc(8*n*m)
+-        do i=1,n
+-            do j=1,m
+-                foo(i,j)=1.d0
+-            end do
+-        end do
+-        call use_foo()
+-        end  program bob
+-
+-
+-        subroutine use_foo()
+-        implicit none
+-        integer n,m,i,j
+-        integer*8 ipfoo
+-        common /ipdata/ ipfoo
+-        common /ipsize/ n,m
+-        real*8 foo,boo
+-
+-        !fails if * is the last dimension
+-        POINTER ( ipfoo, foo(n,*) )
+-
+-        !works if the last dimension is specified
+-        !POINTER ( ipfoo, foo(n,m) )
+-        boo=0.d0
+-        do i=1,n
+-            do j=1,m
+-               boo=foo(i,j)+1.0
+-               if (abs (boo - 2.0) .gt. 1e-6) call abort
+-            end do
+-        end do
+-
+-        end subroutine use_foo
diff --git a/recipes-devtools/gcc/gcc-4.9/0041-libtool-avoid-libdir.patch b/recipes-devtools/gcc/gcc-4.9/0041-libtool-avoid-libdir.patch
new file mode 100644
index 0000000..2dd9610
--- /dev/null
+++ b/recipes-devtools/gcc/gcc-4.9/0041-libtool-avoid-libdir.patch
@@ -0,0 +1,19 @@
+Avoid using libdir from .la which usually points to a host path
+
+Upstream-Status: Inappropriate [embedded specific]
+Signed-off-by: Jonathan Liu <net147 at gmail.com>
+
+diff --git a/ltmain.sh b/ltmain.sh
+index a03433f..1902a90 100644
+--- a/ltmain.sh
++++ b/ltmain.sh
+@@ -5628,6 +5628,9 @@ func_mode_link ()
+ 	    absdir="$abs_ladir"
+ 	    libdir="$abs_ladir"
+ 	  else
++	    # Instead of using libdir from .la which usually points to a host path,
++	    # use the path the .la is contained in.
++	    libdir="$abs_ladir"
+ 	    dir="$libdir"
+ 	    absdir="$libdir"
+ 	  fi
diff --git a/recipes-devtools/gcc/gcc-4.9/0041.gcc.fix_e5500-e6500-aeabi-multi-lib.patch b/recipes-devtools/gcc/gcc-4.9/0041.gcc.fix_e5500-e6500-aeabi-multi-lib.patch
new file mode 100644
index 0000000..807a063
--- /dev/null
+++ b/recipes-devtools/gcc/gcc-4.9/0041.gcc.fix_e5500-e6500-aeabi-multi-lib.patch
@@ -0,0 +1,46 @@
+# Problem Statement:
+  For e5500/e6500 bare-board tool chain, 
+  we do not build the 32-bit soft-float library.
+
+# Reported by:
+  Rohit [28.May.2013]
+
+# Owned by:
+  Rohit
+
+# Action:
+  * Generate the following multi-libs [same as e500mc eabi target].
+	.;@mno-eabi at mstrict-align
+	nof;@msoft-float at mno-eabi@mstrict-align
+	le;@mlittle at mno-eabi@mstrict-align
+	und;@fleading-underscore at mno-eabi@mstrict-align
+	64;@m64 at mno-eabi@mstrict-align
+	le/und;@mlittle at fleading-underscore@mno-eabi at mstrict-align
+	nof/le;@msoft-float at mlittle@mno-eabi at mstrict-align
+	nof/und;@msoft-float at fleading-underscore@mno-eabi at mstrict-align
+	nof/le/und;@msoft-float at mlittle@fleading-underscore at mno-eabi@mstrict-align
+
+diff -Naur gcc-4.8.1/gcc/config/rs6000/t-ppc-e500mc gcc-4.8.1-e5500-e6500-multi-lib-patch/gcc/config/rs6000/t-ppc-e500mc
+--- gcc-4.8.1/gcc/config/rs6000/t-ppc-e500mc	2013-06-17 07:35:05.349002658 -0500
++++ gcc-4.8.1-e5500-e6500-multi-lib-patch/gcc/config/rs6000/t-ppc-e500mc	2013-06-18 02:43:10.331002656 -0500
+@@ -1,10 +1,15 @@
+ # Multilibs for powerpc embedded ELF targets.
++MULTILIB_OPTIONS	= msoft-float \
++			  mlittle \
++			  fleading-underscore \
++			  m64
++
++MULTILIB_DIRNAMES	= nof \
++			  le \
++			  und \
++			  64
+ 
+-MULTILIB_OPTIONS	= m32/m64
+-
+-MULTILIB_DIRNAMES	= 32 64
+-
+-MULTILIB_EXCEPTIONS	= 
++MULTILIB_EXCLUSIONS     = m64/msoft-float m64/mlittle m64/fleading-underscore
+ 
+ MULTILIB_EXTRA_OPTS	= mno-eabi mstrict-align
+ 
diff --git a/recipes-devtools/gcc/gcc-4.9/0042.gcc.fix_ivopts.patch b/recipes-devtools/gcc/gcc-4.9/0042.gcc.fix_ivopts.patch
new file mode 100644
index 0000000..5326aa4
--- /dev/null
+++ b/recipes-devtools/gcc/gcc-4.9/0042.gcc.fix_ivopts.patch
@@ -0,0 +1,157 @@
+# Problem Statement:
+  Fix telecom degradation around 30% to 40% without any degradations
+  in other benchmarks or keep them as minimum as possible.
+  below pattern causing pipeline stall resulting in huge degradations.
+  lhau 4,2(10)
+  lhax 9,10,12
+  the above pattern needs to converted to something like this
+  lhax 4,3,10
+  lhax 9,12,10
+  addi 10,10,2
+
+# Owned by:
+  Srinivas
+
+# Action:
+  Root cause of the problem lies in selecting optimal iv set selected
+  for loop.making cost adjustments resulting in huge degradations in
+  other benchmarks and this approach makes every load updates to be
+  replacedload indexed at least in telecom case.
+  Approach: skip replacing original iv candidate which will result in
+  load index with the address candidate which results in load update.
+  use pattern is identified with some hueristics as given in fix.
+  this bebehaviour is guarded with -fuse-seq-load-indexes switch.
+  this switch is on by default at -O1 and above.
+  use -fno-use-seq-load-indexes to supress this behaviour.
+
+diff -Naur gcc-4.9.2/gcc/common.opt gcc-4.9.2-ivopts-fix/gcc/common.opt
+--- gcc-4.9.2/gcc/common.opt	2014-04-07 08:27:39.000000000 -0500
++++ gcc-4.9.2-ivopts-fix/gcc/common.opt	2015-01-15 13:37:12.895409095 -0600
+@@ -1467,6 +1467,10 @@
+ Common Report Var(flag_ivopts) Init(1) Optimization
+ Optimize induction variables on trees
+ 
++fuse-seq-load-indexes
++Common Report Var(flag_use_seq_load_indexes) Init(1) Optimization
++Supress sequential load update and indexed loads with two indexed loads which exploits pipeline
++
+ fjump-tables
+ Common Var(flag_jump_tables) Init(1) Optimization
+ Use jump tables for sufficiently large switch statements
+diff -Naur gcc-4.9.2/gcc/testsuite/gcc.target/powerpc/ppc-fsl-fuse-seq-load-indexes.c gcc-4.9.2-ivopts-fix/gcc/testsuite/gcc.target/powerpc/ppc-fsl-fuse-seq-load-indexes.c
+--- gcc-4.9.2/gcc/testsuite/gcc.target/powerpc/ppc-fsl-fuse-seq-load-indexes.c	1969-12-31 18:00:00.000000000 -0600
++++ gcc-4.9.2-ivopts-fix/gcc/testsuite/gcc.target/powerpc/ppc-fsl-fuse-seq-load-indexes.c	2015-01-16 20:08:49.786531453 -0600
+@@ -0,0 +1,29 @@
++/* { dg-do compile { target powerpc*-*-* } } */
++/* { dg-options "-O2 -fuse-seq-load-indexes" } */
++
++void
++testloadindex (
++    short   *Data,     
++    short   *AccData,  
++    short   DataSize,       
++    short   NumberOfLags,   
++    short   Scale           
++)
++{
++    int   i;
++    int   lag;
++    int   LastIndex;
++    int   Accumulator;
++
++    for (lag = 0; lag < NumberOfLags; lag++) {
++        Accumulator = 0;
++        LastIndex = DataSize - lag;
++        for (i = 0; i < LastIndex; i++) {
++            Accumulator += ((int) Data[i] * (int) Data[i+lag]) >> Scale;
++        }
++        AccData[lag] = (short) (Accumulator >> 16) ;
++    }
++}
++/* { dg-final { scan-assembler-not "lhau" } }*/
++/* { dg-final { scan-assembler-times "lhax" 2 } }*/
++
+diff -Naur gcc-4.9.2/gcc/tree-ssa-loop-ivopts.c gcc-4.9.2-ivopts-fix/gcc/tree-ssa-loop-ivopts.c
+--- gcc-4.9.2/gcc/tree-ssa-loop-ivopts.c	2014-08-06 06:42:22.000000000 -0500
++++ gcc-4.9.2-ivopts-fix/gcc/tree-ssa-loop-ivopts.c	2015-01-16 00:32:23.754306622 -0600
+@@ -5671,6 +5671,69 @@
+       }
+   fprintf (file, "\n\n");
+ }
++/* Find out if the given iv use pattern for a given candidate which would
++ * generate two sequential load indexes so that they can be pipelined and
++ * result in performance improvement over one load update and load index.
++ * Below are the heuristics.
++ * 1)IV candidate base object should be same as that of IV uses for which
++ *   two loads would be generated.
++ * 2)base values of two uses should be different and the first base should
++ *   be just an object name.
++ * 3)both the uses should be consecutive.
++ *   returns true if above hueristics are matched otherwise return false.
++ */
++static bool
++iv_use_pipeline_possibility (struct ivopts_data *data,struct iv_ca *ivs,
++                             struct iv_cand *cand)
++{
++  unsigned i,count = 0;
++  struct iv_use *use;
++  int base_check = true;
++  tree cand_base_obj,base_obj;
++  tree cur_base = NULL,prev_base = NULL;
++  cand_base_obj = cand->iv->base_object;
++
++  if (cand_base_obj)
++   STRIP_NOPS (cand_base_obj);
++  for (i = 0; i < ivs->upto; i++)
++    {
++      use = iv_use (data, i);
++      base_obj = use->iv->base_object;
++      cur_base = use->iv->base;
++      if (cur_base)
++        {
++          STRIP_NOPS (cur_base);
++        }
++      if (base_obj)
++        {
++          STRIP_NOPS (base_obj);
++        }
++      if (count == 2)
++       break;
++      if (prev_base && count == 1)
++	{
++         if (TREE_CODE (prev_base) == SSA_NAME &&
++             TREE_CODE (cur_base) != SSA_NAME)
++          base_check=true;
++         else
++          base_check = false;
++        }
++      else
++       base_check = true;
++	
++      if ((cand_base_obj == base_obj) &&
++           (use->type == USE_ADDRESS) && base_check)
++       count++;
++      else
++       count = 0;
++ 
++       prev_base = cur_base;
++    }
++     if (count == 2)
++      return true;
++     else
++      return false;
++}
+ 
+ /* Try changing candidate in IVS to CAND for each use.  Return cost of the
+    new set, and store differences in DELTA.  Number of induction variables
+@@ -5707,6 +5770,10 @@
+       if (!min_ncand && !cheaper_cost_pair (new_cp, old_cp))
+         continue;
+ 
++      if (flag_use_seq_load_indexes &&
++          iv_use_pipeline_possibility (data,ivs,cand))
++        continue;
++
+       *delta = iv_ca_delta_add (use, old_cp, new_cp, *delta);
+     }
+ 
diff --git a/recipes-devtools/gcc/gcc-4.9/0043-cpp.patch b/recipes-devtools/gcc/gcc-4.9/0043-cpp.patch
new file mode 100644
index 0000000..eaf8646
--- /dev/null
+++ b/recipes-devtools/gcc/gcc-4.9/0043-cpp.patch
@@ -0,0 +1,40 @@
+The OE environment sets and exports CPP as being the target gcc. When building 
+gcc-cross-canadian for a mingw targetted sdk, the following can be found in
+build.x86_64-pokysdk-mingw32.i586-poky-linux/build-x86_64-linux/libiberty/config.log:
+
+configure:3641: checking for _FILE_OFFSET_BITS value needed for large files
+configure:3666: gcc  -c -isystem/media/build1/poky/build/tmp/sysroots/x86_64-linux/usr/include -O2 -pipe  conftest.c >&5
+configure:3666: $? = 0
+configure:3698: result: no
+configure:3786: checking how to run the C preprocessor
+configure:3856: result: x86_64-pokysdk-mingw32-gcc -E --sysroot=/media/build1/poky/build/tmp/sysroots/x86_64-nativesdk-mingw32-pokysdk-mingw32
+configure:3876: x86_64-pokysdk-mingw32-gcc -E --sysroot=/media/build1/poky/build/tmp/sysroots/x86_64-nativesdk-mingw32-pokysdk-mingw32  conftest.c
+configure:3876: $? = 0
+
+Note this is a *build* target (in build-x86_64-linux) so it should be using 
+the host "gcc", not x86_64-pokysdk-mingw32-gcc. Since the mingw32 headers are 
+very different, using the wrong cpp is a real problem. It is leaking into 
+configure through the CPP variable. Ultimately this leads to build failures 
+related to not being able to include a process.h file for pem-unix.c.
+
+The fix is to ensure we export a sane CPP value into the build environment when
+using build targets. We could define a CPP_FOR_BUILD value which may be the version
+which needs to be upstreamed but for now, this fix is good enough to avoid the 
+problem.
+
+RP 22/08/2013
+
+Upstream-Status: Pending
+
+Index: gcc-4.8.1/Makefile.in
+===================================================================
+--- gcc-4.8.1.orig/Makefile.in	2013-03-30 11:25:03.000000000 +0000
++++ gcc-4.8.1/Makefile.in	2013-08-13 12:03:17.151988882 +0000
+@@ -149,6 +149,7 @@
+ 	AR="$(AR_FOR_BUILD)"; export AR; \
+ 	AS="$(AS_FOR_BUILD)"; export AS; \
+ 	CC="$(CC_FOR_BUILD)"; export CC; \
++	CPP="$(CC_FOR_BUILD) -E"; export CPP; \
+ 	CFLAGS="$(CFLAGS_FOR_BUILD)"; export CFLAGS; \
+ 	CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
+ 	CXX="$(CXX_FOR_BUILD)"; export CXX; \
diff --git a/recipes-devtools/gcc/gcc-4.9/0043.gcc.sysroot_spec_only_linux.patch b/recipes-devtools/gcc/gcc-4.9/0043.gcc.sysroot_spec_only_linux.patch
new file mode 100644
index 0000000..01eaa8b
--- /dev/null
+++ b/recipes-devtools/gcc/gcc-4.9/0043.gcc.sysroot_spec_only_linux.patch
@@ -0,0 +1,30 @@
+# Problem Statement:
+  The compiler driver doesn't pick the right libraries and other initialization
+  routines when '-msoft-float' option is passed.
+
+# Owned by:
+  Andrei (b14391)
+
+# Action
+  Add sysroot suffix 'nof' if '-msoft-float' options is passed for linux targets.
+
+diff -ruN gcc-4.9.2.old/gcc/config/rs6000/fsl-linux.h gcc-4.9.2.new/gcc/config/rs6000/fsl-linux.h
+--- gcc-4.9.2.old/gcc/config/rs6000/fsl-linux.h	1970-01-01 02:00:00.000000000 +0200
++++ gcc-4.9.2.new/gcc/config/rs6000/fsl-linux.h	2015-06-18 12:46:06.264520800 +0300
+@@ -0,0 +1,4 @@
++
++/* The C soft-float libraries have their own subdirectory.  */
++#undef SYSROOT_SUFFIX_SPEC
++#define SYSROOT_SUFFIX_SPEC  "%{msoft-float:/nof}"
+diff -ruN gcc-4.9.2.old/gcc/config.gcc gcc-4.9.2.new/gcc/config.gcc
+--- gcc-4.9.2.old/gcc/config.gcc	2015-06-15 19:05:43.000000000 +0300
++++ gcc-4.9.2.new/gcc/config.gcc	2015-06-18 12:42:10.951991900 +0300
+@@ -2290,7 +2290,7 @@
+ 	tmake_file="${tmake_file} rs6000/t-fprules rs6000/t-rtems rs6000/t-ppccomm"
+ 	;;
+ powerpc*-*-linux*)
+-	tm_file="${tm_file} dbxelf.h elfos.h freebsd-spec.h rs6000/sysv4.h"
++	tm_file="${tm_file} dbxelf.h elfos.h freebsd-spec.h rs6000/sysv4.h rs6000/fsl-linux.h"
+ 	extra_options="${extra_options} rs6000/sysv4.opt"
+ 	tmake_file="rs6000/t-fprules rs6000/t-ppcos ${tmake_file} rs6000/t-ppccomm"
+ 	extra_objs="$extra_objs rs6000-linux.o"
diff --git a/recipes-devtools/gcc/gcc-4.9/0044-gengtypes.patch b/recipes-devtools/gcc/gcc-4.9/0044-gengtypes.patch
new file mode 100644
index 0000000..e38761d
--- /dev/null
+++ b/recipes-devtools/gcc/gcc-4.9/0044-gengtypes.patch
@@ -0,0 +1,97 @@
+gengtype is generated for both the build system and the target. -DGENERATOR_FILE
+was added in the patch http://gcc.gnu.org/ml/gcc-patches/2012-07/msg00273.html
+and was applied to both versions of gengtype.
+
+Unfortunately the presence of this flag triggers the build configuration (bconfig.h) 
+to be included for the target build of gengtype. Compiling gengtype with the target 
+compiler and bconfig.h can result in errors if the build and target systems are 
+dissimilar. An example case this fails is cross compiling gcc on linux for a darwin 
+target system:
+
+In file included from /media/build1/poky/build/tmp/work-shared/gcc-4.8.1-r0/gcc-4.8.1/gcc/gengtype-parse.c:25:0:
+| /media/build1/poky/build/tmp/work-shared/gcc-4.8.1-r0/gcc-4.8.1/gcc/gengtype-parse.c: In function 'void parse_error(const char*, ...)':
+| /media/build1/poky/build/tmp/work-shared/gcc-4.8.1-r0/gcc-4.8.1/gcc/system.h:93:53: error: 'fputc_unlocked' was not declared in this scope
+|  #  define fputc(C, Stream) fputc_unlocked (C, Stream)
+
+which occurs since auto-build.h and auto-host.h have differnet values of
+HAVE_FPUTC_UNLOCKED:
+
+#define HAVE_FPUTC_UNLOCKED 1
+/* #undef HAVE_FPUTS_UNLOCKED */
+
+The obvious fix is to only include the flag on build/ targets which this patch does, however 
+this also leads to compile errors due to const_tree being undefined but used in double_int.h
+
+I added a GENERATOR_FILE2 flag to workaround those in the 
+target case and allow the build to succeed.
+
+Only the build/gengtypes should have the -DGENERATOR_FILE 
+
+RP 22/8/2013
+
+Upstream-Status: Pending
+
+Index: gcc-4.8.1/gcc/Makefile.in
+===================================================================
+--- gcc-4.8.1.orig/gcc/Makefile.in	2013-08-19 11:40:36.844014424 +0000
++++ gcc-4.8.1/gcc/Makefile.in	2013-08-19 11:40:37.784014402 +0000
+@@ -3903,27 +3903,29 @@
+ 
+ gengtype-lex.o build/gengtype-lex.o : gengtype-lex.c gengtype.h $(SYSTEM_H)
+ gengtype-lex.o: $(CONFIG_H) $(BCONFIG_H)
+-CFLAGS-gengtype-lex.o += -DGENERATOR_FILE
++CFLAGS-build/gengtype-lex.o += -DGENERATOR_FILE
+ build/gengtype-lex.o: $(BCONFIG_H)
+ 
+ gengtype-parse.o build/gengtype-parse.o : gengtype-parse.c gengtype.h \
+   $(SYSTEM_H)
+ gengtype-parse.o: $(CONFIG_H)
+-CFLAGS-gengtype-parse.o += -DGENERATOR_FILE
++CFLAGS-build/gengtype-parse.o += -DGENERATOR_FILE
+ build/gengtype-parse.o: $(BCONFIG_H)
+ 
+ gengtype-state.o build/gengtype-state.o: gengtype-state.c $(SYSTEM_H) \
+   gengtype.h errors.h double-int.h version.h $(HASHTAB_H) $(OBSTACK_H) \
+   $(XREGEX_H)
+ gengtype-state.o: $(CONFIG_H)
+-CFLAGS-gengtype-state.o += -DGENERATOR_FILE
++CFLAGS-gengtype-state.o += -DGENERATOR_FILE2
++CFLAGS-build/gengtype-state.o += -DGENERATOR_FILE
+ build/gengtype-state.o: $(BCONFIG_H)
+ 
+ gengtype.o build/gengtype.o : gengtype.c $(SYSTEM_H) gengtype.h 	\
+   rtl.def insn-notes.def errors.h double-int.h version.h $(HASHTAB_H) \
+   $(OBSTACK_H) $(XREGEX_H)
+ gengtype.o: $(CONFIG_H)
+-CFLAGS-gengtype.o += -DGENERATOR_FILE
++CFLAGS-gengtype.o += -DGENERATOR_FILE2
++CFLAGS-build/gengtype.o += -DGENERATOR_FILE
+ build/gengtype.o: $(BCONFIG_H)
+ 
+ build/genmddeps.o: genmddeps.c $(BCONFIG_H) $(SYSTEM_H) coretypes.h	\
+@@ -3988,7 +3990,7 @@
+ # any system header is included.
+ gengtype-lex.c : gengtype-lex.l
+ 	-$(FLEX) $(FLEXFLAGS) -o$@ $< && { \
+-	  echo '#include "bconfig.h"' > $@.tmp; \
++	  echo '' > $@.tmp; \
+ 	  cat $@ >> $@.tmp; \
+ 	  mv $@.tmp $@; \
+ 	}
+Index: gcc-4.8.1/gcc/double-int.h
+===================================================================
+--- gcc-4.8.1.orig/gcc/double-int.h	2013-01-30 11:04:30.000000000 +0000
++++ gcc-4.8.1/gcc/double-int.h	2013-08-19 11:41:51.564012719 +0000
+@@ -448,10 +448,12 @@
+ 
+ 
+ #ifndef GENERATOR_FILE
++#ifndef GENERATOR_FILE2
+ /* Conversion to and from GMP integer representations.  */
+ 
+ void mpz_set_double_int (mpz_t, double_int, bool);
+ double_int mpz_get_double_int (const_tree, mpz_t, bool);
+ #endif
++#endif
+ 
+ #endif /* DOUBLE_INT_H */
diff --git a/recipes-devtools/gcc/gcc-4.9/0046-libatomic-deptracking.patch b/recipes-devtools/gcc/gcc-4.9/0046-libatomic-deptracking.patch
new file mode 100644
index 0000000..6ea4f42
--- /dev/null
+++ b/recipes-devtools/gcc/gcc-4.9/0046-libatomic-deptracking.patch
@@ -0,0 +1,41 @@
+gcc 4.8 won't build with --disable-dependency-tracking since the *.Ppo files
+don't get created unless --enable-dependency-tracking is true.
+
+This patch ensures we only use those compiler options when its enabled.
+
+Upstream-Status: Submitted
+
+(Problem was already reported upstream, attached this patch there
+http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55930)
+
+RP 
+2012/09/22
+
+Index: gcc-4.8.1/libatomic/Makefile.am
+===================================================================
+--- gcc-4.8.1.orig/libatomic/Makefile.am	2013-01-14 18:16:23.000000000 +0000
++++ gcc-4.8.1/libatomic/Makefile.am	2013-09-22 10:38:18.904064750 +0000
+@@ -100,7 +100,8 @@
+ IFUNC_DEF	= -DIFUNC_ALT=$(PAT_S)
+ IFUNC_OPT	= $(word $(PAT_S),$(IFUNC_OPTIONS))
+ 
+-M_DEPS		= -MT $@ -MD -MP -MF $(DEPDIR)/$(@F).Ppo
++ at AMDEP_TRUE@M_DEPS		= -MT $@ -MD -MP -MF $(DEPDIR)/$(@F).Ppo
++ at AMDEP_FALSE@M_DEPS		= 
+ M_SIZE		= -DN=$(PAT_N)
+ M_IFUNC		= $(if $(PAT_S),$(IFUNC_DEF) $(IFUNC_OPT))
+ M_FILE		= $(PAT_BASE)_n.c
+Index: gcc-4.8.1/libatomic/Makefile.in
+===================================================================
+--- gcc-4.8.1.orig/libatomic/Makefile.in	2013-05-31 09:09:26.000000000 +0000
++++ gcc-4.8.1/libatomic/Makefile.in	2013-09-22 10:40:42.520059917 +0000
+@@ -298,7 +298,8 @@
+ PAT_S = $(word 3,$(PAT_SPLIT))
+ IFUNC_DEF = -DIFUNC_ALT=$(PAT_S)
+ IFUNC_OPT = $(word $(PAT_S),$(IFUNC_OPTIONS))
+-M_DEPS = -MT $@ -MD -MP -MF $(DEPDIR)/$(@F).Ppo
++ at AMDEP_TRUE@M_DEPS = -MT $@ -MD -MP -MF $(DEPDIR)/$(@F).Ppo
++ at AMDEP_FALSE@M_DEPS = 
+ M_SIZE = -DN=$(PAT_N)
+ M_IFUNC = $(if $(PAT_S),$(IFUNC_DEF) $(IFUNC_OPT))
+ M_FILE = $(PAT_BASE)_n.c
diff --git a/recipes-devtools/gcc/gcc-4.9/0047-repomembug.patch b/recipes-devtools/gcc/gcc-4.9/0047-repomembug.patch
new file mode 100644
index 0000000..9afd55c
--- /dev/null
+++ b/recipes-devtools/gcc/gcc-4.9/0047-repomembug.patch
@@ -0,0 +1,53 @@
+When compiling a project using -frepo, .rpo files are written alongside
+the .o file, the symbols either have O or C against them. During final linking,
+the objects can be recompiled with some of the entries tweaked/chosen by the 
+tlink.c code (visible with TLINK_VERBOSE=3), it does this by changing O -> C
+in the .rpo files.
+
+My tests showed that init_repo (cp/repo.c) was correctly calling 
+IDENTIFIER_REPO_CHOSEN against the right identifers and setting the
+chosen bit.
+
+By the time finish_repo() or emit_repo_p() were called, the pointer returned
+by get_identifier() for the symbol marked during init_repo had changed and
+the chosen bit was no longer set. This lead to linking bugs like:
+
+collect: relinking
+collect2: error: '_ZNK6sudoku5ClearINS_8SequenceEEclERS1_' was assigned to 'board.rpo', but was not defined during recompilation, or vice versa
+
+The problem is that the garbage collection is getting called before
+finish_repo() is called and ggc_protect_identifiers is set to false 
+so the identifiers are not preserved. They are recreated but the 
+chosen bits get wiped out which is why the pointer changes and the 
+chosen bit is not set.
+
+The fix is to change ggc_protect_identifiers *after* the finish_repo 
+calls are made.
+
+Reproduction is tricky since you need to trigger the garbage collector at
+just the right moment.
+
+RP 2013/10/9
+
+[YOCTO #5133]
+
+Upstream-Status: Pending
+
+Index: gcc-4.8.1/gcc/toplev.c
+===================================================================
+--- gcc-4.8.1.orig/gcc/toplev.c	2013-03-28 08:29:51.000000000 +0000
++++ gcc-4.8.1/gcc/toplev.c	2013-10-09 20:27:17.089228023 +0000
+@@ -551,11 +551,11 @@
+   if (flag_syntax_only || flag_wpa)
+     return;
+ 
+-  ggc_protect_identifiers = false;
+-
+   /* This must also call finalize_compilation_unit.  */
+   lang_hooks.decls.final_write_globals ();
+ 
++  ggc_protect_identifiers = false;
++
+   if (seen_error ())
+     return;
+ 
diff --git a/recipes-devtools/gcc/gcc-4.9/0049-Enable-SPE-AltiVec-generation-on-powepc-linux-target.patch b/recipes-devtools/gcc/gcc-4.9/0049-Enable-SPE-AltiVec-generation-on-powepc-linux-target.patch
new file mode 100644
index 0000000..b98f8ff
--- /dev/null
+++ b/recipes-devtools/gcc/gcc-4.9/0049-Enable-SPE-AltiVec-generation-on-powepc-linux-target.patch
@@ -0,0 +1,42 @@
+From 9e0e19eac2562f73858602fe26e2044eb8b20c47 Mon Sep 17 00:00:00 2001
+From: Alexandru-Cezar Sardan <alexandru.sardan at freescale.com>
+Date: Wed, 5 Feb 2014 16:52:31 +0200
+Subject: [PATCH] Enable SPE & AltiVec generation on powepc*linux target
+
+When is configured with --target=powerpc-linux, the resulting GCC will 
+not be able to generate code for SPE targets (e500v1/v2).
+GCC configured with --target=powerpc-linuxspe will not be able to
+generate AltiVec instructions (for e6500).
+This patch modifies the configured file such that SPE or AltiVec code
+can be generated when gcc is configured with --target=powerpc-linux.
+The ABI and speciffic instructions can be selected through the
+"-mabi=spe or -mabi=altivec" and the "-mspe or -maltivec" parameters.
+
+Upstream-Status: Inappropriate [configuration]
+
+Signed-off-by: Alexandru-Cezar Sardan <alexandru.sardan at freescale.com>
+---
+ gcc/config.gcc |    7 ++++++-
+ 1 file changed, 6 insertions(+), 1 deletion(-)
+
+diff --git a/gcc/config.gcc b/gcc/config.gcc
+index cb7a94e..d392c2b 100644
+--- a/gcc/config.gcc
++++ b/gcc/config.gcc
+@@ -2068,7 +2068,12 @@ powerpc-*-rtems*)
+ 	tmake_file="rs6000/t-fprules rs6000/t-rtems t-rtems rs6000/t-ppccomm"
+ 	;;
+ powerpc*-*-linux*)
+-	tm_file="${tm_file} dbxelf.h elfos.h freebsd-spec.h rs6000/sysv4.h"
++	case ${target} in
++	    powerpc*-*-linux*spe* | powerpc*-*-linux*altivec*)
++		tm_file="${tm_file} dbxelf.h elfos.h freebsd-spec.h rs6000/sysv4.h" ;;
++	    *)
++		tm_file="${tm_file} dbxelf.h elfos.h freebsd-spec.h rs6000/sysv4.h rs6000/linuxaltivec.h rs6000/linuxspe.h rs6000/e500.h" ;;
++	esac
+ 	extra_options="${extra_options} rs6000/sysv4.opt"
+ 	tmake_file="rs6000/t-fprules rs6000/t-ppcos ${tmake_file} rs6000/t-ppccomm"
+ 	case ${target} in
+-- 
+1.7.9.5
+
diff --git a/recipes-devtools/gcc/gcc-4.9/0050-Revert-Use-dbx_reg_number-for-spanning-registers.patch b/recipes-devtools/gcc/gcc-4.9/0050-Revert-Use-dbx_reg_number-for-spanning-registers.patch
new file mode 100644
index 0000000..aead6f6
--- /dev/null
+++ b/recipes-devtools/gcc/gcc-4.9/0050-Revert-Use-dbx_reg_number-for-spanning-registers.patch
@@ -0,0 +1,80 @@
+Upstream-Status: Pending
+
+From cb9b1c041b634a4c128896e3d3eed4082608c797 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem at gmail.com>
+Date: Sat, 3 May 2014 19:25:17 -0700
+Subject: [PATCH] Revert "2013-05-21  Christian Bruel 
+ <christian.bruel at st.com>"
+
+This reverts commit 3983036a8b6b2710c57777194f21507819a73553.
+
+Signed-off-by: Khem Raj <raj.khem at gmail.com>
+
+Conflicts:
+	gcc/ChangeLog
+---
+ gcc/ChangeLog   | 219 +++++++++++++++++++++++++++++++++++++++++++++++++++++++-
+ gcc/dwarf2out.c |  33 +++++----
+ 2 files changed, 234 insertions(+), 18 deletions(-)
+
+diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
+index 1272326..6ac2b28 100644
+--- a/gcc/dwarf2out.c
++++ b/gcc/dwarf2out.c
+@@ -10870,27 +10870,25 @@ static dw_loc_descr_ref
+ multiple_reg_loc_descriptor (rtx rtl, rtx regs,
+ 			     enum var_init_status initialized)
+ {
+-  int size, i;
++  int nregs, size, i;
++  unsigned reg;
+   dw_loc_descr_ref loc_result = NULL;
+ 
+-  /* Simple, contiguous registers.  */
+-  if (regs == NULL_RTX)
+-    {
+-      unsigned reg = REGNO (rtl);
+-      int nregs;
+-
++  reg = REGNO (rtl);
+ #ifdef LEAF_REG_REMAP
+-      if (crtl->uses_only_leaf_regs)
+-	{
+-	  int leaf_reg = LEAF_REG_REMAP (reg);
+-	  if (leaf_reg != -1)
+-	    reg = (unsigned) leaf_reg;
+-	}
++  if (crtl->uses_only_leaf_regs)
++    {
++      int leaf_reg = LEAF_REG_REMAP (reg);
++      if (leaf_reg != -1)
++	reg = (unsigned) leaf_reg;
++    }
+ #endif
++  gcc_assert ((unsigned) DBX_REGISTER_NUMBER (reg) == dbx_reg_number (rtl));
++  nregs = hard_regno_nregs[REGNO (rtl)][GET_MODE (rtl)];
+ 
+-      gcc_assert ((unsigned) DBX_REGISTER_NUMBER (reg) == dbx_reg_number (rtl));
+-      nregs = hard_regno_nregs[REGNO (rtl)][GET_MODE (rtl)];
+-
++  /* Simple, contiguous registers.  */
++  if (regs == NULL_RTX)
++    {
+       size = GET_MODE_SIZE (GET_MODE (rtl)) / nregs;
+ 
+       loc_result = NULL;
+@@ -10918,9 +10916,10 @@ multiple_reg_loc_descriptor (rtx rtl, rtx regs,
+     {
+       dw_loc_descr_ref t;
+ 
+-      t = one_reg_loc_descriptor (dbx_reg_number (XVECEXP (regs, 0, i)),
++      t = one_reg_loc_descriptor (REGNO (XVECEXP (regs, 0, i)),
+ 				  VAR_INIT_STATUS_INITIALIZED);
+       add_loc_descr (&loc_result, t);
++      size = GET_MODE_SIZE (GET_MODE (XVECEXP (regs, 0, 0)));
+       add_loc_descr_op_piece (&loc_result, size);
+     }
+ 
+-- 
+1.9.2
+
diff --git a/recipes-devtools/gcc/gcc-4.9/0051-eabispe.patch b/recipes-devtools/gcc/gcc-4.9/0051-eabispe.patch
new file mode 100644
index 0000000..55e3890
--- /dev/null
+++ b/recipes-devtools/gcc/gcc-4.9/0051-eabispe.patch
@@ -0,0 +1,23 @@
+Upstream-Status: Pending
+
+Taken from http://gcc.gnu.org/ml/gcc-patches/2014-04/msg02064.html
+
+2014-04-30  Cesar Philippidis  <cesar at codesourcery.com>
+
+	gcc/
+	* dwarf2cfi.c (dwf_regno): Don't assert reg is a pseudo
+	register.
+	
+
+diff --git a/gcc/dwarf2cfi.c b/gcc/dwarf2cfi.c
+index 4180890..40ef0e2 100644
+--- a/gcc/dwarf2cfi.c
++++ b/gcc/dwarf2cfi.c
+@@ -906,7 +906,6 @@ notice_eh_throw (rtx insn)
+ static inline unsigned
+ dwf_regno (const_rtx reg)
+ {
+-  gcc_assert (REGNO (reg) < FIRST_PSEUDO_REGISTER);
+   return DWARF_FRAME_REGNUM (REGNO (reg));
+ }
+ 
diff --git a/recipes-devtools/gcc/gcc-4.9/0052-Add-target-hook-to-override-DWARF2-frame-register-si.patch b/recipes-devtools/gcc/gcc-4.9/0052-Add-target-hook-to-override-DWARF2-frame-register-si.patch
new file mode 100644
index 0000000..f6958b3
--- /dev/null
+++ b/recipes-devtools/gcc/gcc-4.9/0052-Add-target-hook-to-override-DWARF2-frame-register-si.patch
@@ -0,0 +1,138 @@
+From d626297e87e19251a284ea1e9360e831b48999ca Mon Sep 17 00:00:00 2001
+From: mpf <mpf at 138bc75d-0d04-0410-961f-82ee72b054a4>
+Date: Thu, 4 Sep 2014 08:32:05 +0000
+Subject: [PATCH] Add target hook to override DWARF2 frame register size
+
+gcc/
+
+	* target.def (TARGET_DWARF_FRAME_REG_MODE): New target hook.
+	* targhooks.c (default_dwarf_frame_reg_mode): New function.
+	* targhooks.h (default_dwarf_frame_reg_mode): New prototype.
+	* doc/tm.texi.in (TARGET_DWARF_FRAME_REG_MODE): Document.
+	* doc/tm.texi: Regenerate.
+	* dwarf2cfi.c (expand_builtin_init_dwarf_reg_sizes): Abstract mode
+	selection logic to default_dwarf_frame_reg_mode.
+
+
+
+git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@214898 138bc75d-0d04-0410-961f-82ee72b054a4
+
+Signed-off-by: Khem Raj <raj.khem at gmail.com>
+Upstream-Status: Backport [gcc 5.0]
+
+---
+ gcc/ChangeLog      | 10 ++++++++++
+ gcc/doc/tm.texi    |  7 +++++++
+ gcc/doc/tm.texi.in |  2 ++
+ gcc/dwarf2cfi.c    |  4 +---
+ gcc/target.def     | 11 +++++++++++
+ gcc/targhooks.c    | 13 +++++++++++++
+ gcc/targhooks.h    |  1 +
+ 7 files changed, 45 insertions(+), 3 deletions(-)
+
+Index: gcc-4.9.2/gcc/doc/tm.texi
+===================================================================
+--- gcc-4.9.2.orig/gcc/doc/tm.texi
++++ gcc-4.9.2/gcc/doc/tm.texi
+@@ -9017,6 +9017,13 @@ register in Dwarf.  Otherwise, this hook
+ If not defined, the default is to return @code{NULL_RTX}.
+ @end deftypefn
+ 
++ at deftypefn {Target Hook} {enum machine_mode} TARGET_DWARF_FRAME_REG_MODE (int @var{regno})
++Given a register, this hook should return the mode which the
++corresponding Dwarf frame register should have.  This is normally
++used to return a smaller mode than the raw mode to prevent call
++clobbered parts of a register altering the frame register size
++ at end deftypefn
++
+ @deftypefn {Target Hook} void TARGET_INIT_DWARF_REG_SIZES_EXTRA (tree @var{address})
+ If some registers are represented in Dwarf-2 unwind information in
+ multiple pieces, define this hook to fill in information about the
+Index: gcc-4.9.2/gcc/doc/tm.texi.in
+===================================================================
+--- gcc-4.9.2.orig/gcc/doc/tm.texi.in
++++ gcc-4.9.2/gcc/doc/tm.texi.in
+@@ -6745,6 +6745,8 @@ the target supports DWARF 2 frame unwind
+ 
+ @hook TARGET_DWARF_REGISTER_SPAN
+ 
++ at hook TARGET_DWARF_FRAME_REG_MODE
++
+ @hook TARGET_INIT_DWARF_REG_SIZES_EXTRA
+ 
+ @hook TARGET_ASM_TTYPE
+Index: gcc-4.9.2/gcc/dwarf2cfi.c
+===================================================================
+--- gcc-4.9.2.orig/gcc/dwarf2cfi.c
++++ gcc-4.9.2/gcc/dwarf2cfi.c
+@@ -271,11 +271,9 @@ expand_builtin_init_dwarf_reg_sizes (tre
+       if (rnum < DWARF_FRAME_REGISTERS)
+ 	{
+ 	  HOST_WIDE_INT offset = rnum * GET_MODE_SIZE (mode);
+-	  enum machine_mode save_mode = reg_raw_mode[i];
+ 	  HOST_WIDE_INT size;
++	  enum machine_mode save_mode = targetm.dwarf_frame_reg_mode (i);
+ 
+-	  if (HARD_REGNO_CALL_PART_CLOBBERED (i, save_mode))
+-	    save_mode = choose_hard_reg_mode (i, 1, true);
+ 	  if (dnum == DWARF_FRAME_RETURN_COLUMN)
+ 	    {
+ 	      if (save_mode == VOIDmode)
+Index: gcc-4.9.2/gcc/target.def
+===================================================================
+--- gcc-4.9.2.orig/gcc/target.def
++++ gcc-4.9.2/gcc/target.def
+@@ -3218,6 +3218,17 @@ If not defined, the default is to return
+  rtx, (rtx reg),
+  hook_rtx_rtx_null)
+ 
++/* Given a register return the mode of the corresponding DWARF frame
++   register.  */
++DEFHOOK
++(dwarf_frame_reg_mode,
++ "Given a register, this hook should return the mode which the\n\
++corresponding Dwarf frame register should have.  This is normally\n\
++used to return a smaller mode than the raw mode to prevent call\n\
++clobbered parts of a register altering the frame register size",
++ enum machine_mode, (int regno),
++ default_dwarf_frame_reg_mode)
++
+ /* If expand_builtin_init_dwarf_reg_sizes needs to fill in table
+    entries not corresponding directly to registers below
+    FIRST_PSEUDO_REGISTER, this hook should generate the necessary
+Index: gcc-4.9.2/gcc/targhooks.c
+===================================================================
+--- gcc-4.9.2.orig/gcc/targhooks.c
++++ gcc-4.9.2/gcc/targhooks.c
+@@ -1438,6 +1438,19 @@ default_debug_unwind_info (void)
+   return UI_NONE;
+ }
+ 
++/* Determine the correct mode for a Dwarf frame register that represents
++   register REGNO.  */
++
++enum machine_mode
++default_dwarf_frame_reg_mode (int regno)
++{
++  enum machine_mode save_mode = reg_raw_mode[regno];
++
++  if (HARD_REGNO_CALL_PART_CLOBBERED (regno, save_mode))
++    save_mode = choose_hard_reg_mode (regno, 1, true);
++  return save_mode;
++}
++
+ /* To be used by targets where reg_raw_mode doesn't return the right
+    mode for registers used in apply_builtin_return and apply_builtin_arg.  */
+ 
+Index: gcc-4.9.2/gcc/targhooks.h
+===================================================================
+--- gcc-4.9.2.orig/gcc/targhooks.h
++++ gcc-4.9.2/gcc/targhooks.h
+@@ -194,6 +194,7 @@ extern int default_label_align_max_skip
+ extern int default_jump_align_max_skip (rtx);
+ extern section * default_function_section(tree decl, enum node_frequency freq,
+ 					  bool startup, bool exit);
++extern enum machine_mode default_dwarf_frame_reg_mode (int);
+ extern enum machine_mode default_get_reg_raw_mode (int);
+ 
+ extern void *default_get_pch_validity (size_t *);
diff --git a/recipes-devtools/gcc/gcc-4.9/0053-gcc-fix-segfault-from-calling-free-on-non-malloc-d-a.patch b/recipes-devtools/gcc/gcc-4.9/0053-gcc-fix-segfault-from-calling-free-on-non-malloc-d-a.patch
new file mode 100644
index 0000000..23b445c
--- /dev/null
+++ b/recipes-devtools/gcc/gcc-4.9/0053-gcc-fix-segfault-from-calling-free-on-non-malloc-d-a.patch
@@ -0,0 +1,66 @@
+From a22a222c8f9299f6c07a0274388ade7d4ab8c28d Mon Sep 17 00:00:00 2001
+From: Paul Gortmaker <paul.gortmaker at windriver.com>
+Date: Fri, 20 Jun 2014 16:41:08 -0400
+Subject: [PATCH] gcc: fix segfault from calling free on non-malloc'd area
+
+We see the following on a 32bit gcc installed on 64 bit host:
+
+  Reading symbols from ./i586-pokymllib32-linux-gcc...done.
+  (gdb) run
+  Starting program: x86-pokymllib32-linux/lib32-gcc/4.9.0-r0/image/usr/bin/i586-pokymllib32-linux-gcc
+
+  Program received signal SIGSEGV, Segmentation fault.
+  0xf7e957e0 in free () from /lib/i386-linux-gnu/libc.so.6
+  (gdb) bt
+  #0  0xf7e957e0 in free () from /lib/i386-linux-gnu/libc.so.6
+  #1  0x0804b73c in set_multilib_dir () at gcc-4.9.0/gcc/gcc.c:7827
+  #2  main (argc=1, argv=0xffffd504) at gcc-4.9.0/gcc/gcc.c:6688
+  (gdb)
+
+The problem arises because we conditionally assign the pointer we
+eventually free, and the conditional may assign the pointer to the
+non-malloc'd internal string "." which fails when we free it here:
+
+   if (multilib_dir == NULL && multilib_os_dir != NULL
+       && strcmp (multilib_os_dir, ".") == 0)
+     {
+       free (CONST_CAST (char *, multilib_os_dir));
+       ...
+
+As suggested by Jakub, ensure the "." case is also malloc'd via
+xstrdup() and hence the pointer for the "." case can be freed.
+
+Cc: Jakub Jelinek <jakub at redhat.com>
+Cc: Jeff Law <law at redhat.com>
+Cc: Matthias Klose <doko at ubuntu.com>
+CC: Tobias Burnus <burnus at net-b.de>
+Upstream-Status: Accepted [ https://gcc.gnu.org/ml/gcc-patches/2014-06/msg02069.html ]
+Signed-off-by: Paul Gortmaker <paul.gortmaker at windriver.com>
+
+diff --git a/gcc/gcc.c b/gcc/gcc.c
+index 9ac18e60d801..168acf7eb0c9 100644
+--- a/gcc/gcc.c
++++ b/gcc/gcc.c
+@@ -7790,10 +7790,15 @@ set_multilib_dir (void)
+ 		q2++;
+ 	      if (*q2 == ':')
+ 		ml_end = q2;
+-	      new_multilib_os_dir = XNEWVEC (char, ml_end - q);
+-	      memcpy (new_multilib_os_dir, q + 1, ml_end - q - 1);
+-	      new_multilib_os_dir[ml_end - q - 1] = '\0';
+-	      multilib_os_dir = *new_multilib_os_dir ? new_multilib_os_dir : ".";
++	      if (ml_end - q == 1)
++		multilib_os_dir = xstrdup (".");
++	      else
++		{
++		  new_multilib_os_dir = XNEWVEC (char, ml_end - q);
++		  memcpy (new_multilib_os_dir, q + 1, ml_end - q - 1);
++		  new_multilib_os_dir[ml_end - q - 1] = '\0';
++		  multilib_os_dir = new_multilib_os_dir;
++		}
+ 
+ 	      if (q2 < end && *q2 == ':')
+ 		{
+-- 
+1.9.2
+
diff --git a/recipes-devtools/gcc/gcc-4.9/0054-gcc-Makefile.in-fix-parallel-building-failure.patch b/recipes-devtools/gcc/gcc-4.9/0054-gcc-Makefile.in-fix-parallel-building-failure.patch
new file mode 100644
index 0000000..7e8efa1
--- /dev/null
+++ b/recipes-devtools/gcc/gcc-4.9/0054-gcc-Makefile.in-fix-parallel-building-failure.patch
@@ -0,0 +1,61 @@
+gcc/Makefile.in: fix parallel building failure
+
+The gcc-ar.o, gcc-nm.o, gcc-ranlib.o and errors.o included
+config.h which was a generated file. But no explicity rule
+to clarify the dependency. There was potential building
+failure while parallel make.
+
+For gcc-ar.o, gcc-nm.o and gcc-ranlib.o, they were compiled from one C
+source file gcc-ar.c, we add them to ALL_HOST_BACKEND_OBJS, so the
+'$(ALL_HOST_OBJS) : | $(generated_files)' rule could work for these
+objects.
+
+For errors.o, it is part of gengtype, and the gengtype generator program
+is special: Two versions are built. One is for the build machine, and one
+is for the host. We refered what gengtype-parse.o did (which also is part
+of gengtype).
+
+[GCC #61899]
+https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61899
+
+Upstream-Status: Submitted [gcc-patches at gcc.gnu.org]
+
+Signed-off-by: Hongxu Jia <hongxu.jia at windriver.com>
+---
+ gcc/Makefile.in | 7 ++++++-
+ 1 file changed, 6 insertions(+), 1 deletion(-)
+
+diff --git a/gcc/Makefile.in b/gcc/Makefile.in
+index 6475cba..56e50bb 100644
+--- a/gcc/Makefile.in
++++ b/gcc/Makefile.in
+@@ -1481,13 +1481,16 @@ OBJS-libcommon-target = $(common_out_object_file) prefix.o params.o \
+ 	opts.o opts-common.o options.o vec.o hooks.o common/common-targhooks.o \
+ 	hash-table.o file-find.o
+ 
++# Objects compiled from one C source file gcc-ar.c
++OBJS-gcc-ar = gcc-ar.o gcc-nm.o gcc-ranlib.o
++
+ # This lists all host objects for the front ends.
+ ALL_HOST_FRONTEND_OBJS = $(foreach v,$(CONFIG_LANGUAGES),$($(v)_OBJS))
+ 
+ ALL_HOST_BACKEND_OBJS = $(GCC_OBJS) $(OBJS) $(OBJS-libcommon) \
+   $(OBJS-libcommon-target) @TREEBROWSER@ main.o c-family/cppspec.o \
+   $(COLLECT2_OBJS) $(EXTRA_GCC_OBJS) $(GCOV_OBJS) $(GCOV_DUMP_OBJS) \
+-  lto-wrapper.o
++  lto-wrapper.o $(OBJS-gcc-ar)
+ 
+ # This lists all host object files, whether they are included in this
+ # compilation or not.
+@@ -2437,6 +2440,8 @@ gengtype-parse.o: $(CONFIG_H)
+ CFLAGS-build/gengtype-parse.o += -DGENERATOR_FILE
+ build/gengtype-parse.o: $(BCONFIG_H)
+ 
++errors.o : $(CONFIG_H)
++
+ gengtype-state.o build/gengtype-state.o: gengtype-state.c $(SYSTEM_H) \
+   gengtype.h errors.h double-int.h version.h $(HASHTAB_H) $(OBSTACK_H) \
+   $(XREGEX_H)
+-- 
+1.8.1.2
+
diff --git a/recipes-devtools/gcc/gcc-4.9/0055-dwarf-reg-processing-helper.patch b/recipes-devtools/gcc/gcc-4.9/0055-dwarf-reg-processing-helper.patch
new file mode 100644
index 0000000..557dab0
--- /dev/null
+++ b/recipes-devtools/gcc/gcc-4.9/0055-dwarf-reg-processing-helper.patch
@@ -0,0 +1,148 @@
+From 4fd39f1329379e00f958394adde6be96f0caf21f Mon Sep 17 00:00:00 2001
+From: hainque <hainque at 138bc75d-0d04-0410-961f-82ee72b054a4>
+Date: Fri, 5 Dec 2014 16:53:22 +0000
+Subject: [PATCH] 2014-12-05  Olivier Hainque  <hainque at adacore.com>
+
+        * dwarf2cfi.c (init_one_dwarf_reg_size): New helper, processing
+        one particular reg for expand_builtin_init_dwarf_reg_sizes.
+        (expand_builtin_init_dwarf_reg_sizes): Rework to use helper and
+        account for dwarf register spans.
+
+
+
+git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@218428 138bc75d-0d04-0410-961f-82ee72b054a4
+
+Signed-off-by: Khem Raj <raj.khem at gmail.com>
+Upstream-Status: Backport [gcc 5.0]
+
+---
+ gcc/ChangeLog   |  7 +++++
+ gcc/dwarf2cfi.c | 98 +++++++++++++++++++++++++++++++++++++++++++++------------
+ 2 files changed, 85 insertions(+), 20 deletions(-)
+
+Index: gcc-4.9.2/gcc/dwarf2cfi.c
+===================================================================
+--- gcc-4.9.2.orig/gcc/dwarf2cfi.c
++++ gcc-4.9.2/gcc/dwarf2cfi.c
+@@ -252,7 +252,59 @@ init_return_column_size (enum machine_mo
+ 		  gen_int_mode (size, mode));
+ }
+ 
+-/* Generate code to initialize the register size table.  */
++/* Datastructure used by expand_builtin_init_dwarf_reg_sizes and
++   init_one_dwarf_reg_size to communicate on what has been done by the
++   latter.  */
++
++typedef struct
++{
++  /* Whether the dwarf return column was initialized.  */
++  bool wrote_return_column;
++
++  /* For each hard register REGNO, whether init_one_dwarf_reg_size
++     was given REGNO to process already.  */
++  bool processed_regno [FIRST_PSEUDO_REGISTER];
++
++} init_one_dwarf_reg_state;
++
++/* Helper for expand_builtin_init_dwarf_reg_sizes.  Generate code to
++   initialize the dwarf register size table entry corresponding to register
++   REGNO in REGMODE.  TABLE is the table base address, SLOTMODE is the mode to
++   use for the size entry to initialize, and INIT_STATE is the communication
++   datastructure conveying what we're doing to our caller.  */
++
++static
++void init_one_dwarf_reg_size (int regno, machine_mode regmode,
++			      rtx table, machine_mode slotmode,
++			      init_one_dwarf_reg_state *init_state)
++{
++  const unsigned int dnum = DWARF_FRAME_REGNUM (regno);
++  const unsigned int rnum = DWARF2_FRAME_REG_OUT (dnum, 1);
++
++  const HOST_WIDE_INT slotoffset = rnum * GET_MODE_SIZE (slotmode);
++  const HOST_WIDE_INT regsize = GET_MODE_SIZE (regmode);
++
++  init_state->processed_regno[regno] = true;
++
++  if (rnum >= DWARF_FRAME_REGISTERS)
++    return;
++
++  if (dnum == DWARF_FRAME_RETURN_COLUMN)
++    {
++      if (regmode == VOIDmode)
++	return;
++      init_state->wrote_return_column = true;
++    }
++
++  if (slotoffset < 0)
++    return;
++
++  emit_move_insn (adjust_address (table, slotmode, slotoffset),
++		  gen_int_mode (regsize, slotmode));
++}
++
++/* Generate code to initialize the dwarf register size table located
++   at the provided ADDRESS.  */
+ 
+ void
+ expand_builtin_init_dwarf_reg_sizes (tree address)
+@@ -261,35 +313,40 @@ expand_builtin_init_dwarf_reg_sizes (tre
+   enum machine_mode mode = TYPE_MODE (char_type_node);
+   rtx addr = expand_normal (address);
+   rtx mem = gen_rtx_MEM (BLKmode, addr);
+-  bool wrote_return_column = false;
++
++  init_one_dwarf_reg_state init_state;
++
++  memset ((char *)&init_state, 0, sizeof (init_state));
+ 
+   for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
+     {
+-      unsigned int dnum = DWARF_FRAME_REGNUM (i);
+-      unsigned int rnum = DWARF2_FRAME_REG_OUT (dnum, 1);
+-
+-      if (rnum < DWARF_FRAME_REGISTERS)
+-	{
+-	  HOST_WIDE_INT offset = rnum * GET_MODE_SIZE (mode);
+-	  HOST_WIDE_INT size;
+-	  enum machine_mode save_mode = targetm.dwarf_frame_reg_mode (i);
++      machine_mode save_mode;
++      rtx span;
+ 
+-	  if (dnum == DWARF_FRAME_RETURN_COLUMN)
++      /* No point in processing a register multiple times.  This could happen
++        with register spans, e.g. when a reg is first processed as a piece of
++        a span, then as a register on its own later on.  */
++
++      if (init_state.processed_regno[i])
++       continue;
++
++      save_mode = targetm.dwarf_frame_reg_mode (i);
++      span = targetm.dwarf_register_span (gen_rtx_REG (save_mode, i));
++      if (!span)
++       init_one_dwarf_reg_size (i, save_mode, mem, mode, &init_state);
++      else
++       {
++         for (int si = 0; si < XVECLEN (span, 0); si++)
+ 	    {
+-	      if (save_mode == VOIDmode)
+-		continue;
+-	      wrote_return_column = true;
+-	    }
+-	  size = GET_MODE_SIZE (save_mode);
+-	  if (offset < 0)
+-	    continue;
++             rtx reg = XVECEXP (span, 0, si);
++             init_one_dwarf_reg_size
++               (REGNO (reg), GET_MODE (reg), mem, mode, &init_state);
++           }
+ 
+-	  emit_move_insn (adjust_address (mem, mode, offset),
+-			  gen_int_mode (size, mode));
+ 	}
+     }
+ 
+-  if (!wrote_return_column)
++  if (!init_state.wrote_return_column)
+     init_return_column_size (mode, mem, DWARF_FRAME_RETURN_COLUMN);
+ 
+ #ifdef DWARF_ALT_FRAME_RETURN_COLUMN
diff --git a/recipes-devtools/gcc/gcc-4.9/0056-define-default-cfa-register-mapping.patch b/recipes-devtools/gcc/gcc-4.9/0056-define-default-cfa-register-mapping.patch
new file mode 100644
index 0000000..3b6c94c
--- /dev/null
+++ b/recipes-devtools/gcc/gcc-4.9/0056-define-default-cfa-register-mapping.patch
@@ -0,0 +1,75 @@
+From c0235a33de8c4f78cce35b2a8c2035c83fe1bd14 Mon Sep 17 00:00:00 2001
+From: hainque <hainque at 138bc75d-0d04-0410-961f-82ee72b054a4>
+Date: Fri, 5 Dec 2014 17:01:42 +0000
+Subject: [PATCH] 2014-12-05  Olivier Hainque  <hainque at adacore.com>
+
+        gcc/
+        * defaults.h: (DWARF_REG_TO_UNWIND_COLUMN): Define default.
+        * dwarf2cfi.c (init_one_dwarf_reg_size): Honor
+        DWARF_REG_TO_UNWIND_COLUMN.
+
+        libgcc/
+        * unwind-dw2.c (DWARF_REG_TO_UNWIND_COLUMN): Remove default def,
+        now provided by defaults.h.
+
+
+
+git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@218429 138bc75d-0d04-0410-961f-82ee72b054a4
+
+Signed-off-by: Khem Raj <raj.khem at gmail.com>
+Upstream-Status: Backport [gcc 5.0]
+
+---
+ gcc/ChangeLog       | 6 ++++++
+ gcc/defaults.h      | 5 +++++
+ gcc/dwarf2cfi.c     | 3 ++-
+ libgcc/ChangeLog    | 5 +++++
+ libgcc/unwind-dw2.c | 4 ----
+ 5 files changed, 18 insertions(+), 5 deletions(-)
+
+Index: gcc-4.9.2/gcc/defaults.h
+===================================================================
+--- gcc-4.9.2.orig/gcc/defaults.h
++++ gcc-4.9.2/gcc/defaults.h
+@@ -438,6 +438,11 @@ see the files COPYING3 and COPYING.RUNTI
+ #define DWARF_FRAME_REGNUM(REG) DBX_REGISTER_NUMBER (REG)
+ #endif
+ 
++/* The mapping from dwarf CFA reg number to internal dwarf reg numbers.  */
++#ifndef DWARF_REG_TO_UNWIND_COLUMN
++#define DWARF_REG_TO_UNWIND_COLUMN(REGNO) (REGNO)
++#endif
++
+ /* Map register numbers held in the call frame info that gcc has
+    collected using DWARF_FRAME_REGNUM to those that should be output in
+    .debug_frame and .eh_frame.  */
+Index: gcc-4.9.2/gcc/dwarf2cfi.c
+===================================================================
+--- gcc-4.9.2.orig/gcc/dwarf2cfi.c
++++ gcc-4.9.2/gcc/dwarf2cfi.c
+@@ -280,8 +280,9 @@ void init_one_dwarf_reg_size (int regno,
+ {
+   const unsigned int dnum = DWARF_FRAME_REGNUM (regno);
+   const unsigned int rnum = DWARF2_FRAME_REG_OUT (dnum, 1);
++  const unsigned int dcol = DWARF_REG_TO_UNWIND_COLUMN (rnum);
+ 
+-  const HOST_WIDE_INT slotoffset = rnum * GET_MODE_SIZE (slotmode);
++  const HOST_WIDE_INT slotoffset = dcol * GET_MODE_SIZE (slotmode);
+   const HOST_WIDE_INT regsize = GET_MODE_SIZE (regmode);
+ 
+   init_state->processed_regno[regno] = true;
+Index: gcc-4.9.2/libgcc/unwind-dw2.c
+===================================================================
+--- gcc-4.9.2.orig/libgcc/unwind-dw2.c
++++ gcc-4.9.2/libgcc/unwind-dw2.c
+@@ -55,10 +55,6 @@
+ #define PRE_GCC3_DWARF_FRAME_REGISTERS DWARF_FRAME_REGISTERS
+ #endif
+ 
+-#ifndef DWARF_REG_TO_UNWIND_COLUMN
+-#define DWARF_REG_TO_UNWIND_COLUMN(REGNO) (REGNO)
+-#endif
+-
+ /* ??? For the public function interfaces, we tend to gcc_assert that the
+    column numbers are in range.  For the dwarf2 unwind info this does happen,
+    although so far in a case that doesn't actually matter.
diff --git a/recipes-devtools/gcc/gcc-4.9/0057-aarch64-config.patch b/recipes-devtools/gcc/gcc-4.9/0057-aarch64-config.patch
new file mode 100644
index 0000000..f295596
--- /dev/null
+++ b/recipes-devtools/gcc/gcc-4.9/0057-aarch64-config.patch
@@ -0,0 +1,32 @@
+Disable the MULTILIB_OSDIRNAMES and other multilib options.
+
+Hard coding the MULTILIB_OSDIRNAMES with ../lib64 is causing problems on
+systems where the libdir is NOT set to /lib64.  This is allowed by the ABI, as
+long as the dynamic loader is present in /lib.
+
+We simply want to use the default rules in gcc to find and configure the 
+normal libdir.
+
+Signed-off-by: Mark Hatle <mark.hatle at windriver.com>
+
+Index: gcc-4.9.1/gcc/config/aarch64/t-aarch64-linux
+===================================================================
+--- gcc-4.9.1.orig/gcc/config/aarch64/t-aarch64-linux
++++ gcc-4.9.1/gcc/config/aarch64/t-aarch64-linux
+@@ -21,11 +21,11 @@
+ LIB1ASMSRC   = aarch64/lib1funcs.asm
+ LIB1ASMFUNCS = _aarch64_sync_cache_range
+ 
+-AARCH_BE = $(if $(findstring TARGET_BIG_ENDIAN_DEFAULT=1, $(tm_defines)),_be)
+-MULTILIB_OSDIRNAMES = .=../lib64$(call if_multiarch,:aarch64$(AARCH_BE)-linux-gnu)
+-MULTIARCH_DIRNAME = $(call if_multiarch,aarch64$(AARCH_BE)-linux-gnu)
++#AARCH_BE = $(if $(findstring TARGET_BIG_ENDIAN_DEFAULT=1, $(tm_defines)),_be)
++#MULTILIB_OSDIRNAMES = .=../lib64$(call if_multiarch,:aarch64$(AARCH_BE)-linux-gnu)
++#MULTIARCH_DIRNAME = $(call if_multiarch,aarch64$(AARCH_BE)-linux-gnu)
+ 
+ # Disable the multilib for linux-gnu targets for the time being; focus
+ # on the baremetal targets.
+-MULTILIB_OPTIONS    =
+-MULTILIB_DIRNAMES   =
++#MULTILIB_OPTIONS    =
++#MULTILIB_DIRNAMES   =
diff --git a/recipes-devtools/gcc/gcc-4.9/0058-gcc-r212171.patch b/recipes-devtools/gcc/gcc-4.9/0058-gcc-r212171.patch
new file mode 100644
index 0000000..d442ba8
--- /dev/null
+++ b/recipes-devtools/gcc/gcc-4.9/0058-gcc-r212171.patch
@@ -0,0 +1,113 @@
+From ca03cf1b133d66eb978c68f6dbc345e9aabcba88 Mon Sep 17 00:00:00 2001
+From: uros <uros at 138bc75d-0d04-0410-961f-82ee72b054a4>
+Date: Mon, 30 Jun 2014 19:30:52 +0000
+Subject: [PATCH] r212171
+
+* except.c (emit_note_eh_region_end): New helper
+ function. 	(convert_to_eh_region_ranges): Use
+ emit_note_eh_region_end to 	emit EH_REGION_END note. 
+ * jump.c (cleanup_barriers): Do not split a call and its 
+ corresponding CALL_ARG_LOCATION note.
+
+git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@212171 138bc75d-0d04-0410-961f-82ee72b054a4
+
+Upstream-Status: Backport [https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=212171]
+Signed-off-by: Baoshan Pang <baoshan.pang at windriver.com>
+---
+ gcc/except.c |   23 ++++++++++++++++++-----
+ gcc/jump.c   |   19 +++++++++++++++----
+ 2 files changed, 33 insertions(+), 9 deletions(-)
+
+diff --git a/gcc/except.c b/gcc/except.c
+index dc5c1d2..7ac114f 100644
+--- a/gcc/except.c
++++ b/gcc/except.c
+@@ -2466,6 +2466,20 @@ add_call_site (rtx landing_pad, int action, int section)
+   return call_site_base + crtl->eh.call_site_record_v[section]->length () - 1;
+ }
+ 
++static rtx
++emit_note_eh_region_end (rtx insn)
++{
++  rtx next = NEXT_INSN (insn);
++
++  /* Make sure we do not split a call and its corresponding
++     CALL_ARG_LOCATION note.  */
++  if (next && NOTE_P (next)
++      && NOTE_KIND (next) == NOTE_INSN_CALL_ARG_LOCATION)
++    insn = next;
++
++  return emit_note_after (NOTE_INSN_EH_REGION_END, insn);
++}
++
+ /* Turn REG_EH_REGION notes back into NOTE_INSN_EH_REGION notes.
+    The new note numbers will not refer to region numbers, but
+    instead to call site entries.  */
+@@ -2544,8 +2558,8 @@ convert_to_eh_region_ranges (void)
+ 		note = emit_note_before (NOTE_INSN_EH_REGION_BEG,
+ 					 first_no_action_insn_before_switch);
+ 		NOTE_EH_HANDLER (note) = call_site;
+-		note = emit_note_after (NOTE_INSN_EH_REGION_END,
+-					last_no_action_insn_before_switch);
++		note
++		  = emit_note_eh_region_end (last_no_action_insn_before_switch);
+ 		NOTE_EH_HANDLER (note) = call_site;
+ 		gcc_assert (last_action != -3
+ 			    || (last_action_insn
+@@ -2569,8 +2583,7 @@ convert_to_eh_region_ranges (void)
+ 		    first_no_action_insn = NULL_RTX;
+ 		  }
+ 
+-		note = emit_note_after (NOTE_INSN_EH_REGION_END,
+-					last_action_insn);
++		note = emit_note_eh_region_end (last_action_insn);
+ 		NOTE_EH_HANDLER (note) = call_site;
+ 	      }
+ 
+@@ -2617,7 +2630,7 @@ convert_to_eh_region_ranges (void)
+ 
+   if (last_action >= -1 && ! first_no_action_insn)
+     {
+-      note = emit_note_after (NOTE_INSN_EH_REGION_END, last_action_insn);
++      note = emit_note_eh_region_end (last_action_insn);
+       NOTE_EH_HANDLER (note) = call_site;
+     }
+ 
+diff --git a/gcc/jump.c b/gcc/jump.c
+index 9418f65..a5e5f52 100644
+--- a/gcc/jump.c
++++ b/gcc/jump.c
+@@ -121,15 +121,26 @@ rebuild_jump_labels_chain (rtx chain)
+ static unsigned int
+ cleanup_barriers (void)
+ {
+-  rtx insn, next, prev;
+-  for (insn = get_insns (); insn; insn = next)
++  rtx insn;
++  for (insn = get_insns (); insn; insn = NEXT_INSN (insn))
+     {
+-      next = NEXT_INSN (insn);
+       if (BARRIER_P (insn))
+ 	{
+-	  prev = prev_nonnote_insn (insn);
++	  rtx prev = prev_nonnote_insn (insn);
+ 	  if (!prev)
+ 	    continue;
++
++	  if (CALL_P (prev))
++	    {
++	      /* Make sure we do not split a call and its corresponding
++		 CALL_ARG_LOCATION note.  */
++	      rtx next = NEXT_INSN (prev);
++
++	      if (NOTE_P (next)
++		  && NOTE_KIND (next) == NOTE_INSN_CALL_ARG_LOCATION)
++		prev = next;
++	    }
++
+ 	  if (BARRIER_P (prev))
+ 	    delete_insn (insn);
+ 	  else if (prev != PREV_INSN (insn))
+-- 
+1.7.9.5
+
diff --git a/recipes-devtools/gcc/gcc-4.9/0059-gcc-PR-rtl-optimization-63348.patch b/recipes-devtools/gcc/gcc-4.9/0059-gcc-PR-rtl-optimization-63348.patch
new file mode 100644
index 0000000..de827cb
--- /dev/null
+++ b/recipes-devtools/gcc/gcc-4.9/0059-gcc-PR-rtl-optimization-63348.patch
@@ -0,0 +1,59 @@
+From 6eae3e637fcc22d21b51d44d61e3a9cb4825e776 Mon Sep 17 00:00:00 2001
+From: Jackie Huang <jackie.huang at windriver.com>
+Date: Thu, 30 Oct 2014 20:37:14 -0700
+Subject: [PATCH]PR rtl-optimization/63348
+ 
+PR rtl-optimization/63348
+* emit-rtl.c (try_split): Do not emit extra barrier.
+
+Note: this patch is to fix the side effect introduced by r212171 which was reported at:
+https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63348
+
+git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@215613 138bc75d-0d04-0410-961f-82ee72b054a4
+
+Upstream-Status: Backport [https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=215613]
+Signed-off-by: Baoshan Pang <baoshan.pang at windriver.com>
+Signed-off-by: Jackie Huang <jackie.huang at windriver.com>
+---
+ gcc/emit-rtl.c |   11 -----------
+ 1 files changed, 0 insertions(+), 11 deletions(-)
+
+diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c
+index 4736f8d..ae69dbd 100644
+--- a/gcc/emit-rtl.c
++++ b/gcc/emit-rtl.c
+@@ -3422,7 +3422,6 @@ try_split (rtx pat, rtx trial, int last)
+ {
+   rtx before = PREV_INSN (trial);
+   rtx after = NEXT_INSN (trial);
+-  int has_barrier = 0;
+   rtx note, seq, tem;
+   int probability;
+   rtx insn_last, insn;
+@@ -3441,14 +3440,6 @@ try_split (rtx pat, rtx trial, int last)
+ 
+   split_branch_probability = -1;
+ 
+-  /* If we are splitting a JUMP_INSN, it might be followed by a BARRIER.
+-     We may need to handle this specially.  */
+-  if (after && BARRIER_P (after))
+-    {
+-      has_barrier = 1;
+-      after = NEXT_INSN (after);
+-    }
+-
+   if (!seq)
+     return trial;
+ 
+@@ -3594,8 +3585,6 @@ try_split (rtx pat, rtx trial, int last)
+   tem = emit_insn_after_setloc (seq, trial, INSN_LOCATION (trial));
+ 
+   delete_insn (trial);
+-  if (has_barrier)
+-    emit_barrier_after (tem);
+ 
+   /* Recursively call try_split for each new insn created; by the
+      time control returns here that insn will be fully split, so
+-- 
+1.7.1
+
diff --git a/recipes-devtools/gcc/gcc-4.9/0060-Only-allow-e500-double-in-SPE_SIMD_REGNO_P-registers.patch b/recipes-devtools/gcc/gcc-4.9/0060-Only-allow-e500-double-in-SPE_SIMD_REGNO_P-registers.patch
new file mode 100644
index 0000000..75a9fdd
--- /dev/null
+++ b/recipes-devtools/gcc/gcc-4.9/0060-Only-allow-e500-double-in-SPE_SIMD_REGNO_P-registers.patch
@@ -0,0 +1,55 @@
+From 5c0092070253113cf0d9c45eacc884b3ecc34d81 Mon Sep 17 00:00:00 2001
+From: jsm28 <jsm28 at 138bc75d-0d04-0410-961f-82ee72b054a4>
+Date: Sat, 25 Oct 2014 00:23:17 +0000
+Subject: [PATCH] Only allow e500 double in SPE_SIMD_REGNO_P registers.
+
+rs6000_hard_regno_nregs_internal allows SPE vectors in single
+registers satisfying SPE_SIMD_REGNO_P (i.e. register numbers 0 to
+31).  However, the corresponding test for e500 double treats all
+registers as being able to store a 64-bit value, rather than just
+those GPRs.
+
+Logically this inconsistency is wrong; in addition, it causes problems
+unwinding from signal handlers.  linux-unwind.h uses
+ARG_POINTER_REGNUM as a place to store the return address from a
+signal handler, but this logic in rs6000_hard_regno_nregs_internal
+results in that being considered an 8-byte register, resulting in
+assertion failures.
+(<https://gcc.gnu.org/ml/gcc-patches/2014-09/msg02625.html> first
+needs to be applied for unwinding to work in general on e500.)  This
+patch makes rs6000_hard_regno_nregs_internal handle the e500 double
+case consistently with SPE vectors.
+
+Tested with no regressions with cross to powerpc-linux-gnuspe (given
+the aforementioned patch applied).  Failures of signal handling
+unwinding tests such as gcc.dg/cleanup-{8,9,10,11}.c are fixed by this
+patch.
+
+	* config/rs6000/rs6000.c (rs6000_hard_regno_nregs_internal): Do
+	not allow e500 double in registers not satisyfing
+	SPE_SIMD_REGNO_P.
+
+
+git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@216688 138bc75d-0d04-0410-961f-82ee72b054a4
+
+Signed-off-by: Khem Raj <raj.khem at gmail.com>
+Upstream-Status: Backport [gcc 5.0]
+
+---
+ gcc/ChangeLog              | 6 ++++++
+ gcc/config/rs6000/rs6000.c | 2 +-
+ 2 files changed, 7 insertions(+), 1 deletion(-)
+
+Index: gcc-4.9.2/gcc/config/rs6000/rs6000.c
+===================================================================
+--- gcc-4.9.2.orig/gcc/config/rs6000/rs6000.c
++++ gcc-4.9.2/gcc/config/rs6000/rs6000.c
+@@ -1703,7 +1703,7 @@ rs6000_hard_regno_nregs_internal (int re
+      SCmode so as to pass the value correctly in a pair of
+      registers.  */
+   else if (TARGET_E500_DOUBLE && FLOAT_MODE_P (mode) && mode != SCmode
+-	   && !DECIMAL_FLOAT_MODE_P (mode))
++	   && !DECIMAL_FLOAT_MODE_P (mode) && SPE_SIMD_REGNO_P (regno))
+     reg_size = UNITS_PER_FP_WORD;
+ 
+   else
diff --git a/recipes-devtools/gcc/gcc-4.9/0061-target-gcc-includedir.patch b/recipes-devtools/gcc/gcc-4.9/0061-target-gcc-includedir.patch
new file mode 100644
index 0000000..f48c66d
--- /dev/null
+++ b/recipes-devtools/gcc/gcc-4.9/0061-target-gcc-includedir.patch
@@ -0,0 +1,81 @@
+Ensure target gcc headers can be included
+
+There are a few headers installed as part of the OpenEmbedded
+gcc-runtime target (omp.h, ssp/*.h). Being installed from a recipe
+built for the target architecture, these are within the target
+sysroot and not cross/nativesdk; thus they weren't able to be
+found by gcc with the existing search paths. Add support for
+picking up these headers under the sysroot supplied on the gcc
+command line in order to resolve this.
+
+Signed-off-by: Paul Eggleton <paul.eggleton at linux.intel.com>
+
+Upstream-Status: Pending
+
+--- a/gcc/Makefile.in	2014-12-23 11:57:33.327873331 +0000
++++ b/gcc/Makefile.in	2015-01-21 11:32:35.447305394 +0000
+@@ -587,6 +587,7 @@
+ 
+ # Directory in which the compiler finds libraries etc.
+ libsubdir = $(libdir)/gcc/$(target_noncanonical)/$(version)
++libsubdir_target = gcc/$(target_noncanonical)/$(version)
+ # Directory in which the compiler finds executables
+ libexecsubdir = $(libexecdir)/gcc/$(target_noncanonical)/$(version)
+ # Directory in which all plugin resources are installed
+@@ -2534,6 +2535,7 @@
+ 
+ PREPROCESSOR_DEFINES = \
+   -DGCC_INCLUDE_DIR=\"$(libsubdir)/include\" \
++  -DGCC_INCLUDE_SUBDIR_TARGET=\"$(libsubdir_target)/include\" \
+   -DFIXED_INCLUDE_DIR=\"$(libsubdir)/include-fixed\" \
+   -DGPLUSPLUS_INCLUDE_DIR=\"$(gcc_gxx_include_dir)\" \
+   -DGPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT=$(gcc_gxx_include_dir_add_sysroot) \
+--- a/gcc/cppdefault.c	2015-01-13 17:40:26.131012725 +0000
++++ b/gcc/cppdefault.c	2015-01-21 11:30:08.928426492 +0000
+@@ -59,6 +59,10 @@
+     /* This is the dir for gcc's private headers.  */
+     { GCC_INCLUDE_DIR, "GCC", 0, 0, 0, 0 },
+ #endif
++#ifdef GCC_INCLUDE_SUBDIR_TARGET
++    /* This is the dir for gcc's private headers under the specified sysroot.  */
++    { STANDARD_STARTFILE_PREFIX_2 GCC_INCLUDE_SUBDIR_TARGET, "GCC", 0, 0, 1, 0 },
++#endif
+ #ifdef LOCAL_INCLUDE_DIR
+     /* /usr/local/include comes before the fixincluded header files.  */
+     { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 2 },
+diff --git a/gcc/defaults.h b/gcc/defaults.h
+index f94ae17..d98b40b 100644
+--- a/gcc/defaults.h
++++ b/gcc/defaults.h
+@@ -1390,4 +1390,13 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+ 
+ #endif /* GCC_INSN_FLAGS_H  */
+ 
++/* Default prefixes to attach to command names.  */
++
++#ifndef STANDARD_STARTFILE_PREFIX_1
++#define STANDARD_STARTFILE_PREFIX_1 "/lib/"
++#endif
++#ifndef STANDARD_STARTFILE_PREFIX_2
++#define STANDARD_STARTFILE_PREFIX_2 "/usr/lib/"
++#endif
++
+ #endif  /* ! GCC_DEFAULTS_H */
+diff --git a/gcc/gcc.c b/gcc/gcc.c
+index 9f0b781..174fca8 100644
+--- a/gcc/gcc.c
++++ b/gcc/gcc.c
+@@ -1189,13 +1189,6 @@ static const char *gcc_libexec_prefix;
+ 
+ /* Default prefixes to attach to command names.  */
+ 
+-#ifndef STANDARD_STARTFILE_PREFIX_1
+-#define STANDARD_STARTFILE_PREFIX_1 "/lib/"
+-#endif
+-#ifndef STANDARD_STARTFILE_PREFIX_2
+-#define STANDARD_STARTFILE_PREFIX_2 "/usr/lib/"
+-#endif
+-
+ #ifdef CROSS_DIRECTORY_STRUCTURE  /* Don't use these prefixes for a cross compiler.  */
+ #undef MD_EXEC_PREFIX
+ #undef MD_STARTFILE_PREFIX
diff --git a/recipes-devtools/gcc/gcc-4.9/0062-Use-SYSTEMLIBS_DIR-replacement-instead-of-hardcoding.patch b/recipes-devtools/gcc/gcc-4.9/0062-Use-SYSTEMLIBS_DIR-replacement-instead-of-hardcoding.patch
new file mode 100644
index 0000000..c48bd48
--- /dev/null
+++ b/recipes-devtools/gcc/gcc-4.9/0062-Use-SYSTEMLIBS_DIR-replacement-instead-of-hardcoding.patch
@@ -0,0 +1,24 @@
+From 861bcfd4ae814f351e0c668ee26d01d1331e0422 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem at gmail.com>
+Date: Tue, 28 Apr 2015 23:15:27 -0700
+Subject: [PATCH 36/37] Use SYSTEMLIBS_DIR replacement instead of hardcoding
+ base_libdir
+
+Signed-off-by: Khem Raj <raj.khem at gmail.com>
+---
+ gcc/config/aarch64/aarch64-linux.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+Index: gcc-4.9.2/gcc/config/aarch64/aarch64-linux.h
+===================================================================
+--- gcc-4.9.2.orig/gcc/config/aarch64/aarch64-linux.h
++++ gcc-4.9.2/gcc/config/aarch64/aarch64-linux.h
+@@ -21,7 +21,7 @@
+ #ifndef GCC_AARCH64_LINUX_H
+ #define GCC_AARCH64_LINUX_H
+ 
+-#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux-aarch64%{mbig-endian:_be}.so.1"
++#define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-linux-aarch64%{mbig-endian:_be}.so.1"
+ 
+ #define CPP_SPEC "%{pthread:-D_REENTRANT}"
+ 
diff --git a/recipes-devtools/gcc/gcc-4.9/0063-nativesdk-gcc-support.patch b/recipes-devtools/gcc/gcc-4.9/0063-nativesdk-gcc-support.patch
new file mode 100644
index 0000000..f9efa45
--- /dev/null
+++ b/recipes-devtools/gcc/gcc-4.9/0063-nativesdk-gcc-support.patch
@@ -0,0 +1,198 @@
+Being able to build a nativesdk gcc is useful, particularly in cases
+where the host compiler may be of an incompatible version (or a 32
+bit compiler is needed).
+
+Sadly, building nativesdk-gcc is not straight forward. We install
+nativesdk-gcc into a relocatable location and this means that its
+library locations can change. "Normal" sysroot support doesn't help
+in this case since the values of paths like "libdir" change, not just
+base root directory of the system.
+
+In order to handle this we do two things:
+
+a) Add %r into spec file markup which can be used for injected paths
+   such as SYSTEMLIBS_DIR (see gcc_multilib_setup()).
+b) Add other paths which need relocation into a .gccrelocprefix section
+   which the relocation code will notice and adjust automatically.
+
+Upstream-Status: Inappropriate
+RP 2015/7/28
+diff --git a/gcc/gcc.c b/gcc/gcc.c
+index 5fd3d0a..2de29aa 100644
+--- a/gcc/gcc.c
++++ b/gcc/gcc.c
+@@ -120,6 +120,8 @@ static const char *target_system_root = TARGET_SYSTEM_ROOT;
+ #else
+ static const char *target_system_root = 0;
+ #endif
++ 
++static char target_relocatable_prefix[4096] __attribute__ ((section (".gccrelocprefix"))) = SYSTEMLIBS_DIR;
+ 
+ /* Nonzero means pass the updated target_system_root to the compiler.  */
+ 
+@@ -384,6 +386,7 @@ or with constant text in a single argument.
+  %G     process LIBGCC_SPEC as a spec.
+  %R     Output the concatenation of target_system_root and
+         target_sysroot_suffix.
++ %r     Output the base path target_relocatable_prefix
+  %S     process STARTFILE_SPEC as a spec.  A capital S is actually used here.
+  %E     process ENDFILE_SPEC as a spec.  A capital E is actually used here.
+  %C     process CPP_SPEC as a spec.
+@@ -1218,10 +1221,10 @@ static const char *gcc_libexec_prefix;
+    gcc_exec_prefix is set because, in that case, we know where the
+    compiler has been installed, and use paths relative to that
+    location instead.  */
+-static const char *const standard_exec_prefix = STANDARD_EXEC_PREFIX;
+-static const char *const standard_libexec_prefix = STANDARD_LIBEXEC_PREFIX;
+-static const char *const standard_bindir_prefix = STANDARD_BINDIR_PREFIX;
+-static const char *const standard_startfile_prefix = STANDARD_STARTFILE_PREFIX;
++static char standard_exec_prefix[4096] __attribute__ ((section (".gccrelocprefix"))) = STANDARD_EXEC_PREFIX;
++static char standard_libexec_prefix[4096] __attribute__ ((section (".gccrelocprefix"))) = STANDARD_LIBEXEC_PREFIX;
++static char standard_bindir_prefix[4096] __attribute__ ((section (".gccrelocprefix"))) = STANDARD_BINDIR_PREFIX;
++static char *const standard_startfile_prefix = STANDARD_STARTFILE_PREFIX;
+ 
+ /* For native compilers, these are well-known paths containing
+    components that may be provided by the system.  For cross
+@@ -1229,9 +1232,9 @@ static const char *const standard_startfile_prefix = STANDARD_STARTFILE_PREFIX;
+ static const char *md_exec_prefix = MD_EXEC_PREFIX;
+ static const char *md_startfile_prefix = MD_STARTFILE_PREFIX;
+ static const char *md_startfile_prefix_1 = MD_STARTFILE_PREFIX_1;
+-static const char *const standard_startfile_prefix_1
++static char standard_startfile_prefix_1[4096] __attribute__ ((section (".gccrelocprefix")))
+   = STANDARD_STARTFILE_PREFIX_1;
+-static const char *const standard_startfile_prefix_2
++static char standard_startfile_prefix_2[4096] __attribute__ ((section (".gccrelocprefix")))
+   = STANDARD_STARTFILE_PREFIX_2;
+ 
+ /* A relative path to be used in finding the location of tools
+@@ -5305,6 +5308,11 @@ do_spec_1 (const char *spec, int inswitch, const char *soft_matched_part)
+ 	      }
+ 	    break;
+ 
++          case 'r':
++              obstack_grow (&obstack, target_relocatable_prefix,
++		      strlen (target_relocatable_prefix));
++            break;
++
+ 	  case 'S':
+ 	    value = do_spec_1 (startfile_spec, 0, NULL);
+ 	    if (value != 0)
+
+diff --git a/gcc/cppdefault.c b/gcc/cppdefault.c
+index dad69e6..cf43f28 100644
+--- a/gcc/cppdefault.c
++++ b/gcc/cppdefault.c
+@@ -35,6 +35,30 @@
+ # undef CROSS_INCLUDE_DIR
+ #endif
+ 
++static char GPLUSPLUS_INCLUDE_DIRVAR[4096] __attribute__ ((section (".gccrelocprefix"))) = GPLUSPLUS_INCLUDE_DIR;
++static char GCC_INCLUDE_DIRVAR[4096] __attribute__ ((section (".gccrelocprefix"))) = GCC_INCLUDE_DIR;
++static char GPLUSPLUS_TOOL_INCLUDE_DIRVAR[4096] __attribute__ ((section (".gccrelocprefix"))) = GPLUSPLUS_TOOL_INCLUDE_DIR;
++static char GPLUSPLUS_BACKWARD_INCLUDE_DIRVAR[4096] __attribute__ ((section (".gccrelocprefix"))) = GPLUSPLUS_BACKWARD_INCLUDE_DIR;
++static char STANDARD_STARTFILE_PREFIX_2VAR[4096] __attribute__ ((section (".gccrelocprefix"))) = STANDARD_STARTFILE_PREFIX_2 GCC_INCLUDE_SUBDIR_TARGET;
++#ifdef LOCAL_INCLUDE_DIR
++static char LOCAL_INCLUDE_DIRVAR[4096] __attribute__ ((section (".gccrelocprefix"))) = LOCAL_INCLUDE_DIR;
++#endif
++#ifdef PREFIX_INCLUDE_DIR
++static char PREFIX_INCLUDE_DIRVAR[4096] __attribute__ ((section (".gccrelocprefix"))) = PREFIX_INCLUDE_DIR;
++#endif
++#ifdef FIXED_INCLUDE_DIR
++static char FIXED_INCLUDE_DIRVAR[4096] __attribute__ ((section (".gccrelocprefix"))) = FIXED_INCLUDE_DIR;
++#endif
++#ifdef CROSS_INCLUDE_DIR
++static char CROSS_INCLUDE_DIRVAR[4096] __attribute__ ((section (".gccrelocprefix"))) = CROSS_INCLUDE_DIR;
++#endif
++#ifdef TOOL_INCLUDE_DIR
++static char TOOL_INCLUDE_DIRVAR[4096] __attribute__ ((section (".gccrelocprefix"))) = TOOL_INCLUDE_DIR;
++#endif
++#ifdef NATIVE_SYSTEM_HEADER_DIR
++static char NATIVE_SYSTEM_HEADER_DIRVAR[4096] __attribute__ ((section (".gccrelocprefix"))) = NATIVE_SYSTEM_HEADER_DIR;
++#endif
++
+ const struct default_include cpp_include_defaults[]
+ #ifdef INCLUDE_DEFAULTS
+ = INCLUDE_DEFAULTS;
+@@ -42,38 +66,38 @@ const struct default_include cpp_include_defaults[]
+ = {
+ #ifdef GPLUSPLUS_INCLUDE_DIR
+     /* Pick up GNU C++ generic include files.  */
+-    { GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1,
++    { GPLUSPLUS_INCLUDE_DIRVAR, "G++", 1, 1,
+       GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 0 },
+ #endif
+ #ifdef GPLUSPLUS_TOOL_INCLUDE_DIR
+     /* Pick up GNU C++ target-dependent include files.  */
+-    { GPLUSPLUS_TOOL_INCLUDE_DIR, "G++", 1, 1,
++    { GPLUSPLUS_TOOL_INCLUDE_DIRVAR, "G++", 1, 1,
+       GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 1 },
+ #endif
+ #ifdef GPLUSPLUS_BACKWARD_INCLUDE_DIR
+     /* Pick up GNU C++ backward and deprecated include files.  */
+-    { GPLUSPLUS_BACKWARD_INCLUDE_DIR, "G++", 1, 1,
++    { GPLUSPLUS_BACKWARD_INCLUDE_DIRVAR, "G++", 1, 1,
+       GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 0 },
+ #endif
+ #ifdef GCC_INCLUDE_DIR
+     /* This is the dir for gcc's private headers.  */
+-    { GCC_INCLUDE_DIR, "GCC", 0, 0, 0, 0 },
++    { GCC_INCLUDE_DIRVAR, "GCC", 0, 0, 0, 0 },
+ #endif
+ #ifdef GCC_INCLUDE_SUBDIR_TARGET
+     /* This is the dir for gcc's private headers under the specified sysroot.  */
+-    { STANDARD_STARTFILE_PREFIX_2 GCC_INCLUDE_SUBDIR_TARGET, "GCC", 0, 0, 1, 0 },
++    { STANDARD_STARTFILE_PREFIX_2VAR, "GCC", 0, 0, 1, 0 },
+ #endif
+ #ifdef LOCAL_INCLUDE_DIR
+     /* /usr/local/include comes before the fixincluded header files.  */
+-    { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 2 },
+-    { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 0 },
++    { LOCAL_INCLUDE_DIRVAR, 0, 0, 1, 1, 2 },
++    { LOCAL_INCLUDE_DIRVAR, 0, 0, 1, 1, 0 },
+ #endif
+ #ifdef PREFIX_INCLUDE_DIR
+-    { PREFIX_INCLUDE_DIR, 0, 0, 1, 0, 0 },
++    { PREFIX_INCLUDE_DIRVAR, 0, 0, 1, 0, 0 },
+ #endif
+ #ifdef FIXED_INCLUDE_DIR
+     /* This is the dir for fixincludes.  */
+-    { FIXED_INCLUDE_DIR, "GCC", 0, 0, 0,
++    { FIXED_INCLUDE_DIRVAR, "GCC", 0, 0, 0,
+       /* A multilib suffix needs adding if different multilibs use
+ 	 different headers.  */
+ #ifdef SYSROOT_HEADERS_SUFFIX_SPEC
+@@ -85,16 +109,16 @@ const struct default_include cpp_include_defaults[]
+ #endif
+ #ifdef CROSS_INCLUDE_DIR
+     /* One place the target system's headers might be.  */
+-    { CROSS_INCLUDE_DIR, "GCC", 0, 0, 0, 0 },
++    { CROSS_INCLUDE_DIRVAR, "GCC", 0, 0, 0, 0 },
+ #endif
+ #ifdef TOOL_INCLUDE_DIR
+     /* Another place the target system's headers might be.  */
+-    { TOOL_INCLUDE_DIR, "BINUTILS", 0, 1, 0, 0 },
++    { TOOL_INCLUDE_DIRVAR, "BINUTILS", 0, 1, 0, 0 },
+ #endif
+ #ifdef NATIVE_SYSTEM_HEADER_DIR
+     /* /usr/include comes dead last.  */
+-    { NATIVE_SYSTEM_HEADER_DIR, NATIVE_SYSTEM_HEADER_COMPONENT, 0, 0, 1, 2 },
+-    { NATIVE_SYSTEM_HEADER_DIR, NATIVE_SYSTEM_HEADER_COMPONENT, 0, 0, 1, 0 },
++    { NATIVE_SYSTEM_HEADER_DIRVAR, NATIVE_SYSTEM_HEADER_COMPONENT, 0, 0, 1, 2 },
++    { NATIVE_SYSTEM_HEADER_DIRVAR, NATIVE_SYSTEM_HEADER_COMPONENT, 0, 0, 1, 0 },
+ #endif
+     { 0, 0, 0, 0, 0, 0 }
+   };
+diff --git a/gcc/cppdefault.h b/gcc/cppdefault.h
+index 30b6fed..2ef96b7 100644
+--- a/gcc/cppdefault.h
++++ b/gcc/cppdefault.h
+@@ -33,7 +33,8 @@
+ 
+ struct default_include
+ {
+-  const char *const fname;	/* The name of the directory.  */
++  const char *fname;     /* The name of the directory.  */
++
+   const char *const component;	/* The component containing the directory
+ 				   (see update_path in prefix.c) */
+   const char cplusplus;		/* Only look here if we're compiling C++.  */
diff --git a/recipes-devtools/gcc/gcc-4.9/0064-handle-target-sysroot-multilib.patch b/recipes-devtools/gcc/gcc-4.9/0064-handle-target-sysroot-multilib.patch
new file mode 100644
index 0000000..5356984
--- /dev/null
+++ b/recipes-devtools/gcc/gcc-4.9/0064-handle-target-sysroot-multilib.patch
@@ -0,0 +1,88 @@
+Search target sysroot gcc version specific dirs with multilib.
+
+We install the gcc libraries (such as crtbegin.p) into
+<sysroot><libdir>/<target-sys>/5.2.0/
+which is a default search path for GCC (aka multi_suffix in the 
+code below). <target-sys> is 'machine' in gcc's terminology. We use
+these directories so that multiple gcc versions could in theory 
+co-exist on target.
+
+We only want to build one gcc-cross-canadian per arch and have this work 
+for all multilibs. <target-sys> can be handled by mapping the multilib
+<target-sys> to the one used by gcc-cross-canadian, e.g. mips64-polkmllib32-linux 
+is symlinked to by mips64-poky-linux.
+
+The default gcc search path in the target sysroot for a "lib64" mutlilib is:
+
+<sysroot>/lib32/mips64-poky-linux/5.2.0/
+<sysroot>/lib32/../lib64/
+<sysroot>/usr/lib32/mips64-poky-linux/5.2.0/
+<sysroot>/usr/lib32/../lib64/
+<sysroot>/lib32/
+<sysroot>/usr/lib32/
+
+which means that the lib32 crtbegin.o will be found and the lib64 ones
+will not which leads to compiler failures.
+
+This patch injects a multilib version of that path first so the lib64
+binaries can be found first. With this change the search path becomes:
+
+<sysroot>/lib32/../lib64/mips64-poky-linux/5.2.0/
+<sysroot>/lib32/mips64-poky-linux/5.2.0/
+<sysroot>/lib32/../lib64/
+<sysroot>/usr/lib32/../lib64/mips64-poky-linux/5.2.0/
+<sysroot>/usr/lib32/mips64-poky-linux/5.2.0/
+<sysroot>/usr/lib32/../lib64/
+<sysroot>/lib32/
+<sysroot>/usr/lib32/
+
+Upstream-Status: Pending
+RP 2015/7/31
+
+Index: gcc-5.2.0/gcc/gcc.c
+===================================================================
+--- gcc-5.2.0.orig/gcc/gcc.c
++++ gcc-5.2.0/gcc/gcc.c
+@@ -2305,7 +2305,7 @@ for_each_path (const struct path_prefix
+       if (path == NULL)
+ 	{
+ 	  len = paths->max_len + extra_space + 1;
+-	  len += MAX (MAX (suffix_len, multi_os_dir_len), multiarch_len);
++	  len += MAX ((suffix_len + multi_os_dir_len), multiarch_len);
+ 	  path = XNEWVEC (char, len);
+ 	}
+ 
+@@ -2317,6 +2317,33 @@ for_each_path (const struct path_prefix
+ 	  /* Look first in MACHINE/VERSION subdirectory.  */
+ 	  if (!skip_multi_dir)
+ 	    {
++	      if (!(pl->os_multilib ? skip_multi_os_dir : skip_multi_dir))
++	        {
++	          const char *this_multi;
++	          size_t this_multi_len;
++
++	          if (pl->os_multilib)
++		    {
++		      this_multi = multi_os_dir;
++		      this_multi_len = multi_os_dir_len;
++		    }
++	          else
++		    {
++		      this_multi = multi_dir;
++		      this_multi_len = multi_dir_len;
++		    }
++
++	          /* Look in multilib MACHINE/VERSION subdirectory first */
++	          if (this_multi_len)
++	            {
++		      memcpy (path + len, this_multi, this_multi_len + 1);
++	              memcpy (path + len + this_multi_len, multi_suffix, suffix_len + 1);
++	              ret = callback (path, callback_info);
++	                if (ret)
++		          break;
++	            }
++	        }
++
+ 	      memcpy (path + len, multi_suffix, suffix_len + 1);
+ 	      ret = callback (path, callback_info);
+ 	      if (ret)
diff --git a/recipes-devtools/gcc/gcc-4.9/0065-gcc-483-universal-initializer-no-warning.patch b/recipes-devtools/gcc/gcc-4.9/0065-gcc-483-universal-initializer-no-warning.patch
new file mode 100644
index 0000000..fde227b
--- /dev/null
+++ b/recipes-devtools/gcc/gcc-4.9/0065-gcc-483-universal-initializer-no-warning.patch
@@ -0,0 +1,107 @@
+Upstream-Status: Backport
+
+Signed-off-by: Kai Kang <kai.kang at windriver.com>
+---
+Fix for https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53119
+wrong warning when using the universal zero initializer {0}
+
+Backported to GCC 4.8.3
+
+Subject: 2014-06-05  S. Gilles  <sgilles at terpmail.umd.edu>
+X-Git-Url: http://repo.or.cz/w/official-gcc.git/commitdiff_plain/95cdf3fdf2d440eb7775def8e35ab970651c33d9?hp=14a3093e9943937cbc63dfbf4d51ca60f8325b29
+git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@211289 138bc75d-0d04-0410-961f-82ee72b054a4
+
+--- gcc-4.8.3.org/gcc/c/c-typeck.c	2014-08-03 20:52:09.257042137 +0200
++++ gcc-4.8.3/gcc/c/c-typeck.c	2014-08-03 20:57:10.645042614 +0200
+@@ -62,9 +62,9 @@
+    if expr.original_code == SIZEOF_EXPR.  */
+ tree c_last_sizeof_arg;
+ 
+-/* Nonzero if we've already printed a "missing braces around initializer"
+-   message within this initializer.  */
+-static int missing_braces_mentioned;
++/* Nonzero if we might need to print a "missing braces around
++   initializer" message within this initializer.  */
++static int found_missing_braces;
+ 
+ static int require_constant_value;
+ static int require_constant_elements;
+@@ -6379,6 +6379,9 @@
+ /* 1 if this constructor is erroneous so far.  */
+ static int constructor_erroneous;
+ 
++/* 1 if this constructor is the universal zero initializer { 0 }.  */
++static int constructor_zeroinit;
++
+ /* Structure for managing pending initializer elements, organized as an
+    AVL tree.  */
+ 
+@@ -6540,7 +6543,7 @@
+   constructor_stack = 0;
+   constructor_range_stack = 0;
+ 
+-  missing_braces_mentioned = 0;
++  found_missing_braces = 0;
+ 
+   spelling_base = 0;
+   spelling_size = 0;
+@@ -6635,6 +6638,7 @@
+   constructor_type = type;
+   constructor_incremental = 1;
+   constructor_designated = 0;
++  constructor_zeroinit = 1;
+   designator_depth = 0;
+   designator_erroneous = 0;
+ 
+@@ -6832,11 +6836,8 @@
+ 	set_nonincremental_init (braced_init_obstack);
+     }
+ 
+-  if (implicit == 1 && warn_missing_braces && !missing_braces_mentioned)
+-    {
+-      missing_braces_mentioned = 1;
+-      warning_init (OPT_Wmissing_braces, "missing braces around initializer");
+-    }
++  if (implicit == 1)
++    found_missing_braces = 1;
+ 
+   if (TREE_CODE (constructor_type) == RECORD_TYPE
+ 	   || TREE_CODE (constructor_type) == UNION_TYPE)
+@@ -6969,16 +6970,23 @@
+ 	}
+     }
+ 
++  if (vec_safe_length (constructor_elements) != 1)
++    constructor_zeroinit = 0;
++
++  /* Warn when some structs are initialized with direct aggregation.  */
++  if (!implicit && found_missing_braces && warn_missing_braces
++      && !constructor_zeroinit)
++    {
++      warning_init (OPT_Wmissing_braces,
++		    "missing braces around initializer");
++    }
++
+   /* Warn when some struct elements are implicitly initialized to zero.  */
+   if (warn_missing_field_initializers
+       && constructor_type
+       && TREE_CODE (constructor_type) == RECORD_TYPE
+       && constructor_unfilled_fields)
+     {
+-	bool constructor_zeroinit =
+-	 (vec_safe_length (constructor_elements) == 1
+-	  && integer_zerop ((*constructor_elements)[0].value));
+-
+ 	/* Do not warn for flexible array members or zero-length arrays.  */
+ 	while (constructor_unfilled_fields
+ 	       && (!DECL_SIZE (constructor_unfilled_fields)
+@@ -8093,6 +8101,9 @@
+   designator_depth = 0;
+   designator_erroneous = 0;
+ 
++  if (!implicit && value.value && !integer_zerop (value.value))
++    constructor_zeroinit = 0;
++
+   /* Handle superfluous braces around string cst as in
+      char x[] = {"foo"}; */
+   if (string_flag
diff --git a/recipes-devtools/gcc/gcc-4.9/qoriq-ppc/0019-64-bit-multilib-hack.patch b/recipes-devtools/gcc/gcc-4.9/qoriq-ppc/0019-64-bit-multilib-hack.patch
new file mode 100644
index 0000000..2a0f718
--- /dev/null
+++ b/recipes-devtools/gcc/gcc-4.9/qoriq-ppc/0019-64-bit-multilib-hack.patch
@@ -0,0 +1,65 @@
+From 18fde5740b09324dfb9cf41e9849672573ff5fa0 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem at gmail.com>
+Date: Fri, 29 Mar 2013 09:10:06 +0400
+Subject: [PATCH 19/35] 64-bit multilib hack.
+
+GCC has internal multilib handling code but it assumes a very specific rigid directory
+layout. The build system implementation of multilib layout is very generic and allows
+complete customisation of the library directories.
+
+This patch is a partial solution to allow any custom directories to be passed into gcc
+and handled correctly. It forces gcc to use the base_libdir (which is the current
+directory, "."). We need to do this for each multilib that is configured as we don't
+know which compiler options may be being passed into the compiler. Since we have a compiler
+per mulitlib at this point that isn't an issue.
+
+The one problem is the target compiler is only going to work for the default multlilib at
+this point. Ideally we'd figure out which multilibs were being enabled with which paths
+and be able to patch these entries with a complete set of correct paths but this we
+don't have such code at this point. This is something the target gcc recipe should do
+and override these platform defaults in its build config.
+
+RP 15/8/11
+
+Signed-off-by: Khem Raj <raj.khem at gmail.com>
+Signed-off-by: Elvis Dowson <elvis.dowson at gmail.com>
+
+Upstream-Status: Pending
+---
+ gcc/config/i386/t-linux64   |    6 ++----
+ gcc/config/mips/t-linux64   |   10 +++-------
+ gcc/config/rs6000/t-linux64 |    5 ++---
+ 3 files changed, 7 insertions(+), 14 deletions(-)
+
+Index: gcc-4.9-20140316/gcc/config/i386/t-linux64
+===================================================================
+--- gcc-4.9-20140316.orig/gcc/config/i386/t-linux64
++++ gcc-4.9-20140316/gcc/config/i386/t-linux64
+@@ -32,7 +32,5 @@
+ #
+ comma=,
+ MULTILIB_OPTIONS    = $(subst $(comma),/,$(TM_MULTILIB_CONFIG))
+-MULTILIB_DIRNAMES   = $(patsubst m%, %, $(subst /, ,$(MULTILIB_OPTIONS)))
+-MULTILIB_OSDIRNAMES = m64=../lib64$(call if_multiarch,:x86_64-linux-gnu)
+-MULTILIB_OSDIRNAMES+= m32=$(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib)$(call if_multiarch,:i386-linux-gnu)
+-MULTILIB_OSDIRNAMES+= mx32=../libx32$(call if_multiarch,:x86_64-linux-gnux32)
++MULTILIB_DIRNAMES = . .
++MULTILIB_OSDIRNAMES = ../$(shell basename $(base_libdir)) ../$(shell basename $(base_libdir))
+Index: gcc-4.9-20140316/gcc/config/mips/t-linux64
+===================================================================
+--- gcc-4.9-20140316.orig/gcc/config/mips/t-linux64
++++ gcc-4.9-20140316/gcc/config/mips/t-linux64
+@@ -17,10 +17,6 @@
+ # <http://www.gnu.org/licenses/>.
+ 
+ MULTILIB_OPTIONS = mabi=n32/mabi=32/mabi=64
+-MULTILIB_DIRNAMES = n32 32 64
+-MIPS_EL = $(if $(filter %el, $(firstword $(subst -, ,$(target)))),el)
+-MIPS_SOFT = $(if $(strip $(filter MASK_SOFT_FLOAT_ABI, $(target_cpu_default)) $(filter soft, $(with_float))),soft)
+-MULTILIB_OSDIRNAMES = \
+-	../lib32$(call if_multiarch,:mips64$(MIPS_EL)-linux-gnuabin32$(MIPS_SOFT)) \
+-	../lib$(call if_multiarch,:mips$(MIPS_EL)-linux-gnu$(MIPS_SOFT)) \
+-	../lib64$(call if_multiarch,:mips64$(MIPS_EL)-linux-gnuabi64$(MIPS_SOFT))
++MULTILIB_DIRNAMES = . . .
++MULTILIB_OSDIRNAMES = ../$(shell basename $(base_libdir)) ../$(shell basename $(base_libdir)) ../$(shell basename $(base_libdir))
++
diff --git a/recipes-devtools/gcc/gcc-4.9/qoriq-ppc/0049-Enable-SPE-AltiVec-generation-on-powepc-linux-target.patch b/recipes-devtools/gcc/gcc-4.9/qoriq-ppc/0049-Enable-SPE-AltiVec-generation-on-powepc-linux-target.patch
new file mode 100644
index 0000000..c48a106
--- /dev/null
+++ b/recipes-devtools/gcc/gcc-4.9/qoriq-ppc/0049-Enable-SPE-AltiVec-generation-on-powepc-linux-target.patch
@@ -0,0 +1,43 @@
+From 9e0e19eac2562f73858602fe26e2044eb8b20c47 Mon Sep 17 00:00:00 2001
+From: Alexandru-Cezar Sardan <alexandru.sardan at freescale.com>
+Date: Wed, 5 Feb 2014 16:52:31 +0200
+Subject: [PATCH] Enable SPE & AltiVec generation on powepc*linux target
+
+When is configured with --target=powerpc-linux, the resulting GCC will 
+not be able to generate code for SPE targets (e500v1/v2).
+GCC configured with --target=powerpc-linuxspe will not be able to
+generate AltiVec instructions (for e6500).
+This patch modifies the configured file such that SPE or AltiVec code
+can be generated when gcc is configured with --target=powerpc-linux.
+The ABI and speciffic instructions can be selected through the
+"-mabi=spe or -mabi=altivec" and the "-mspe or -maltivec" parameters.
+
+Upstream-Status: Inappropriate [configuration]
+
+Signed-off-by: Alexandru-Cezar Sardan <alexandru.sardan at freescale.com>
+---
+ gcc/config.gcc |    7 ++++++-
+ 1 file changed, 6 insertions(+), 1 deletion(-)
+
+diff --git a/gcc/config.gcc b/gcc/config.gcc
+index 945b5a3..4322874 100644
+--- a/gcc/config.gcc
++++ b/gcc/config.gcc
+@@ -2290,7 +2290,12 @@ powerpc-*-rtems*)
+ 	tmake_file="${tmake_file} rs6000/t-fprules rs6000/t-rtems rs6000/t-ppccomm"
+ 	;;
+ powerpc*-*-linux*)
+-	tm_file="${tm_file} dbxelf.h elfos.h freebsd-spec.h rs6000/sysv4.h rs6000/fsl-linux.h"
++	case ${target} in
++           powerpc*-*-linux*spe* | powerpc*-*-linux*altivec*)
++               tm_file="${tm_file} dbxelf.h elfos.h freebsd-spec.h rs6000/sysv4.h" ;;
++           *)
++               tm_file="${tm_file} dbxelf.h elfos.h freebsd-spec.h rs6000/sysv4.h rs6000/linuxaltivec.h rs6000/linuxspe.h rs6000/e500.h" ;;
++        esac
+ 	extra_options="${extra_options} rs6000/sysv4.opt"
+ 	tmake_file="rs6000/t-fprules rs6000/t-ppcos ${tmake_file} rs6000/t-ppccomm"
+ 	extra_objs="$extra_objs rs6000-linux.o"
+        tmake_file="${tmake_file} rs6000/t-fprules rs6000/t-rtems rs6000/t-ppccomm"
+-- 
+1.7.9.5
+
diff --git a/recipes-devtools/gcc/gcc-4.9/qoriq-ppc/0066-cxxflags-for-build.patch b/recipes-devtools/gcc/gcc-4.9/qoriq-ppc/0066-cxxflags-for-build.patch
new file mode 100644
index 0000000..212c13f
--- /dev/null
+++ b/recipes-devtools/gcc/gcc-4.9/qoriq-ppc/0066-cxxflags-for-build.patch
@@ -0,0 +1,126 @@
+Fix various _FOR_BUILD and related variables
+
+When doing a FOR_BUILD thing, you have to override CFLAGS with
+CFLAGS_FOR_BUILD. And if you use C++, you also have to override
+CXXFLAGS with CXXFLAGS_FOR_BUILD.
+Without this, when building for mingw, you end up trying to use
+the mingw headers for a host build.
+
+The same goes for other variables as well, such as CPPFLAGS,
+CPP, and GMPINC.
+
+Upstream-Status: Pending
+
+Signed-off-by: Peter Seebach <peter.seebach at windriver.com>
+Signed-off-by: Mark Hatle <mark.hatle at windriver.com>
+
+diff --git a/Makefile.in b/Makefile.in
+index bf06dce..bf2ab41 100644
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -149,8 +149,10 @@ BUILD_EXPORTS = \
+ 	AR="$(AR_FOR_BUILD)"; export AR; \
+ 	AS="$(AS_FOR_BUILD)"; export AS; \
+ 	CC="$(CC_FOR_BUILD)"; export CC; \
++	CPP="$(CC_FOR_BUILD) -E"; export CPP; \
+ 	CFLAGS="$(CFLAGS_FOR_BUILD)"; export CFLAGS; \
+ 	CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
++	CPPFLAGS="$(CPPFLAGS_FOR_BUILD)"; export CPPFLAGS; \
+ 	CXX="$(CXX_FOR_BUILD)"; export CXX; \
+ 	CXXFLAGS="$(CXXFLAGS_FOR_BUILD)"; export CXXFLAGS; \
+ 	GCJ="$(GCJ_FOR_BUILD)"; export GCJ; \
+@@ -169,6 +171,9 @@ BUILD_EXPORTS = \
+ # built for the build system to override those in BASE_FLAGS_TO_PASS.
+ EXTRA_BUILD_FLAGS = \
+ 	CFLAGS="$(CFLAGS_FOR_BUILD)" \
++	CXXFLAGS="$(CXXFLAGS_FOR_BUILD)" \
++	CPP="$(CC_FOR_BUILD) -E" \
++	CPPFLAGS="$(CPPFLAGS_FOR_BUILD)" \
+ 	LDFLAGS="$(LDFLAGS_FOR_BUILD)"
+ 
+ # This is the list of directories to built for the host system.
+@@ -186,6 +191,7 @@ HOST_SUBDIR = @host_subdir@
+ HOST_EXPORTS = \
+ 	$(BASE_EXPORTS) \
+ 	CC="$(CC)"; export CC; \
++	CPP="$(CC) -E"; export CPP; \
+ 	ADA_CFLAGS="$(ADA_CFLAGS)"; export ADA_CFLAGS; \
+ 	CFLAGS="$(CFLAGS)"; export CFLAGS; \
+ 	CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
+@@ -706,6 +712,7 @@ BASE_FLAGS_TO_PASS = \
+ 	"CC_FOR_BUILD=$(CC_FOR_BUILD)" \
+ 	"CFLAGS_FOR_BUILD=$(CFLAGS_FOR_BUILD)" \
+ 	"CXX_FOR_BUILD=$(CXX_FOR_BUILD)" \
++	"CXXFLAGS_FOR_BUILD=$(CXXFLAGS_FOR_BUILD)" \
+ 	"EXPECT=$(EXPECT)" \
+ 	"FLEX=$(FLEX)" \
+ 	"INSTALL=$(INSTALL)" \
+diff --git a/Makefile.tpl b/Makefile.tpl
+index 54a8dc3..b0214fa 100644
+--- a/Makefile.tpl
++++ b/Makefile.tpl
+@@ -154,6 +154,7 @@ BUILD_EXPORTS = \
+ 	CC="$(CC_FOR_BUILD)"; export CC; \
+ 	CFLAGS="$(CFLAGS_FOR_BUILD)"; export CFLAGS; \
+ 	CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
++	CPPFLAGS="$(CPPFLAGS_FOR_BUILD)"; export CPPFLAGS; \
+ 	CXX="$(CXX_FOR_BUILD)"; export CXX; \
+ 	CXXFLAGS="$(CXXFLAGS_FOR_BUILD)"; export CXXFLAGS; \
+ 	GCJ="$(GCJ_FOR_BUILD)"; export GCJ; \
+@@ -172,6 +173,9 @@ BUILD_EXPORTS = \
+ # built for the build system to override those in BASE_FLAGS_TO_PASS.
+ EXTRA_BUILD_FLAGS = \
+ 	CFLAGS="$(CFLAGS_FOR_BUILD)" \
++	CXXFLAGS="$(CXXFLAGS_FOR_BUILD)" \
++	CPP="$(CC_FOR_BUILD) -E" \
++	CPPFLAGS="$(CPPFLAGS_FOR_BUILD)" \
+ 	LDFLAGS="$(LDFLAGS_FOR_BUILD)"
+ 
+ # This is the list of directories to built for the host system.
+@@ -189,6 +193,7 @@ HOST_SUBDIR = @host_subdir@
+ HOST_EXPORTS = \
+ 	$(BASE_EXPORTS) \
+ 	CC="$(CC)"; export CC; \
++	CPP="$(CC) -E"; export CPP; \
+ 	ADA_CFLAGS="$(ADA_CFLAGS)"; export ADA_CFLAGS; \
+ 	CFLAGS="$(CFLAGS)"; export CFLAGS; \
+ 	CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
+diff --git a/gcc/Makefile.in b/gcc/Makefile.in
+index 5bb4d74..0ed7d13 100644
+--- a/gcc/Makefile.in
++++ b/gcc/Makefile.in
+@@ -762,7 +762,7 @@ BUILD_LINKERFLAGS = $(BUILD_CXXFLAGS)
+ # Native linker and preprocessor flags.  For x-fragment overrides.
+ BUILD_LDFLAGS=@BUILD_LDFLAGS@
+ BUILD_CPPFLAGS= -I. -I$(@D) -I$(srcdir) -I$(srcdir)/$(@D) \
+-		-I$(srcdir)/../include @INCINTL@ $(CPPINC) $(CPPFLAGS)
++		-I$(srcdir)/../include @INCINTL@ $(CPPINC) $(CPPFLAGS_FOR_BUILD)
+ 
+ # Actual name to use when installing a native compiler.
+ GCC_INSTALL_NAME := $(shell echo gcc|sed '$(program_transform_name)')
+diff --git a/gcc/configure b/gcc/configure
+index 9f5431f..80be44f 100755
+--- a/gcc/configure
++++ b/gcc/configure
+@@ -11306,7 +11306,7 @@ else
+ 	CC="${CC_FOR_BUILD}" CFLAGS="${CFLAGS_FOR_BUILD}" \
+ 	CXX="${CXX_FOR_BUILD}" CXXFLAGS="${CXXFLAGS_FOR_BUILD}" \
+ 	LD="${LD_FOR_BUILD}" LDFLAGS="${LDFLAGS_FOR_BUILD}" \
+-	GMPINC="" CPPFLAGS="${CPPFLAGS} -DGENERATOR_FILE" \
++	GMPINC="" CPPFLAGS="${CPPFLAGS_FOR_BUILD} -DGENERATOR_FILE" \
+ 	${realsrcdir}/configure --with-gnu-ld --with-gnu-as --enable-targets=all \
+ 		--enable-languages=${enable_languages-all} \
+ 		--target=$target_alias --host=$build_alias --build=$build_alias
+diff --git a/gcc/configure.ac b/gcc/configure.ac
+index e3a824c..c88e1af 100644
+--- a/gcc/configure.ac
++++ b/gcc/configure.ac
+@@ -1539,7 +1539,7 @@ else
+ 	CC="${CC_FOR_BUILD}" CFLAGS="${CFLAGS_FOR_BUILD}" \
+ 	CXX="${CXX_FOR_BUILD}" CXXFLAGS="${CXXFLAGS_FOR_BUILD}" \
+ 	LD="${LD_FOR_BUILD}" LDFLAGS="${LDFLAGS_FOR_BUILD}" \
+-	GMPINC="" CPPFLAGS="${CPPFLAGS} -DGENERATOR_FILE" \
++	GMPINC="" CPPFLAGS="${CPPFLAGS_FOR_BUILD} -DGENERATOR_FILE" \
+ 	${realsrcdir}/configure \
+ 		--enable-languages=${enable_languages-all} \
+ 		--target=$target_alias --host=$build_alias --build=$build_alias
diff --git a/recipes-devtools/gcc/gcc-configure-common.inc b/recipes-devtools/gcc/gcc-configure-common.inc
new file mode 100644
index 0000000..cee6f4a
--- /dev/null
+++ b/recipes-devtools/gcc/gcc-configure-common.inc
@@ -0,0 +1,129 @@
+require gcc-multilib-config.inc
+require gcc-shared-source.inc
+#
+# Build the list of lanaguages to build.
+#
+# These can be overridden by the version specific .inc file.
+
+# Java (gcj doesn't work on all architectures)
+JAVA ?= ",java"
+JAVA_arm ?= ""
+JAVA_armeb ?= ""
+JAVA_mipsel ?= ""
+JAVA_sh3 ?= ""
+# gcc 3.x expects 'f77', 4.0 expects 'f95', 4.1 and 4.2 expect 'fortran'
+FORTRAN ?= ",f77"
+LANGUAGES ?= "c,c++${FORTRAN}${JAVA}"
+# disable --enable-target-optspace for powerpc SPE
+# at -Os libgcc.so.1 creates references into
+# hidden symbols in libgcc.a which linker complains
+# when linking shared libraries further in the build like (gnutls)
+
+SPECIAL_ARCH_LIST = "powerpc"
+OPTSPACE = '${@bb.utils.contains("SPECIAL_ARCH_LIST", "${TARGET_ARCH}", "", "--enable-target-optspace",d)}'
+
+EXTRA_OECONF_BASE ?= ""
+EXTRA_OECONF_PATHS ?= ""
+EXTRA_OECONF_INITIAL ?= ""
+
+GCCMULTILIB ?= "--disable-multilib"
+GCCTHREADS ?= "posix"
+
+EXTRA_OECONF = "\
+    ${@['--enable-clocale=generic', ''][d.getVar('USE_NLS', True) != 'no']} \
+    --with-gnu-ld \
+    --enable-shared \
+    --enable-languages=${LANGUAGES} \
+    --enable-threads=${GCCTHREADS} \
+    ${GCCMULTILIB} \
+    --enable-c99 \
+    --enable-long-long \
+    --enable-symvers=gnu \
+    --enable-libstdcxx-pch \
+    --program-prefix=${TARGET_PREFIX} \
+    --without-local-prefix \
+    ${OPTSPACE} \
+    ${EXTRA_OECONF_BASE} \
+    ${EXTRA_OECONF_GCC_FLOAT} \
+    ${EXTRA_OECONF_PATHS} \
+    ${@get_gcc_mips_plt_setting(bb, d)} \
+    ${@get_gcc_ppc_plt_settings(bb, d)} \
+    ${@get_long_double_setting(bb, d)} \
+    ${@get_gcc_multiarch_setting(bb, d)} \
+"
+
+export gcc_cv_collect2_libs = 'none required'
+# We need to set gcc_cv_collect2_libs else there is cross-compilation badness
+# in the config.log files (which might not get generated until do_compile
+# hence being missed by the insane do_configure check).
+
+# Build uclibc compilers without cxa_atexit support
+EXTRA_OECONF_append_linux = " --enable-__cxa_atexit"
+EXTRA_OECONF_append_libc-uclibc = " --enable-__cxa_atexit"
+
+EXTRA_OECONF_append_mips64 = " --with-abi=64 --with-arch-64=mips64 --with-tune-64=mips64"
+EXTRA_OECONF_append_mips64el = " --with-abi=64 --with-arch-64=mips64 --with-tune-64=mips64"
+EXTRA_OECONF_append_mips64n32 = " --with-abi=64 --with-arch-64=mips64 --with-tune-64=mips64"
+EXTRA_OECONF_append_mips64eln32 = " --with-abi=64 --with-arch-64=mips64 --with-tune-64=mips64"
+
+# ARMv6+ adds atomic instructions that affect the ABI in libraries built
+# with TUNE_CCARGS in gcc-runtime.  Make the compiler default to a
+# compatible architecture.  armv6 and armv7a cover the minimum tune
+# features used in OE.
+EXTRA_OECONF_append_armv6 = " --with-arch=armv6"
+EXTRA_OECONF_append_armv7a = " --with-arch=armv7-a"
+
+EXTRA_OECONF_GCC_FLOAT ??= ""
+CPPFLAGS = ""
+
+SYSTEMHEADERS = "${target_includedir}"
+SYSTEMLIBS = "${target_base_libdir}/"
+SYSTEMLIBS1 = "${target_libdir}/"
+
+do_configure_prepend () {
+	# teach gcc to find correct target includedir when checking libc ssp support
+	mkdir -p ${B}/gcc
+	echo "NATIVE_SYSTEM_HEADER_DIR = ${SYSTEMHEADERS}" > ${B}/gcc/t-oe
+	cat ${S}/gcc/defaults.h | grep -v "\#endif.*GCC_DEFAULTS_H" > ${B}/gcc/defaults.h.new
+	cat >>${B}/gcc/defaults.h.new <<_EOF
+#define NATIVE_SYSTEM_HEADER_DIR "${SYSTEMHEADERS}"
+#define STANDARD_STARTFILE_PREFIX_1 "${SYSTEMLIBS}"
+#define STANDARD_STARTFILE_PREFIX_2 "${SYSTEMLIBS1}"
+#define SYSTEMLIBS_DIR "${SYSTEMLIBS}"
+#endif /* ! GCC_DEFAULTS_H */
+_EOF
+	mv ${B}/gcc/defaults.h.new ${B}/gcc/defaults.h
+}
+
+do_configure () {
+	# Setup these vars for cross building only
+	# ... because foo_FOR_TARGET apparently gets misinterpreted inside the
+	# gcc build stuff when the build is producing a cross compiler - i.e.
+	# when the 'current' target is the 'host' system, and the host is not
+	# the target (because the build is actually making a cross compiler!)
+	if [ "${BUILD_SYS}" != "${HOST_SYS}" ]; then
+		export CC_FOR_TARGET="${CC}"
+		export GCC_FOR_TARGET="${CC}"
+		export CXX_FOR_TARGET="${CXX}"
+		export AS_FOR_TARGET="${HOST_PREFIX}as"
+		export LD_FOR_TARGET="${HOST_PREFIX}ld"
+		export NM_FOR_TARGET="${HOST_PREFIX}nm"
+		export AR_FOR_TARGET="${HOST_PREFIX}ar"
+		export GFORTRAN_FOR_TARGET="gfortran"
+		export RANLIB_FOR_TARGET="${HOST_PREFIX}ranlib"
+	fi
+	export CC_FOR_BUILD="${BUILD_CC}"
+	export CXX_FOR_BUILD="${BUILD_CXX}"
+	export CFLAGS_FOR_BUILD="${BUILD_CFLAGS}"
+	export CPPFLAGS_FOR_BUILD="${BUILD_CPPFLAGS}"
+	export CXXFLAGS_FOR_BUILD="${BUILD_CXXFLAGS}"
+	export LDFLAGS_FOR_BUILD="${BUILD_LDFLAGS}"
+	export CFLAGS_FOR_TARGET="${TARGET_CFLAGS}"
+	export CPPFLAGS_FOR_TARGET="${TARGET_CPPFLAGS}"
+	export CXXFLAGS_FOR_TARGET="${TARGET_CXXFLAGS}"
+	export LDFLAGS_FOR_TARGET="${TARGET_LDFLAGS}"
+
+
+	oe_runconf
+}
+
diff --git a/recipes-devtools/gcc/gcc-cross-canadian.inc b/recipes-devtools/gcc/gcc-cross-canadian.inc
new file mode 100644
index 0000000..54e4881
--- /dev/null
+++ b/recipes-devtools/gcc/gcc-cross-canadian.inc
@@ -0,0 +1,177 @@
+inherit cross-canadian
+
+SUMMARY = "GNU cc and gcc C compilers (cross-canadian for ${TARGET_ARCH} target)"
+PN = "gcc-cross-canadian-${TRANSLATED_TARGET_ARCH}"
+
+DEPENDS = "virtual/${TARGET_PREFIX}gcc virtual/${HOST_PREFIX}binutils-crosssdk virtual/nativesdk-${HOST_PREFIX}libc-for-gcc nativesdk-gettext"
+
+GCCMULTILIB = "--enable-multilib"
+
+require gcc-configure-common.inc
+
+EXTRA_OECONF_PATHS = "\
+    --with-gxx-include-dir=/not/exist${target_includedir}/c++/${BINV} \
+    --with-build-time-tools=${STAGING_DIR_NATIVE}${prefix_native}/${TARGET_SYS}/bin \
+    --with-sysroot=/not/exist \
+    --with-build-sysroot=${STAGING_DIR_TARGET} \
+"
+# We have to point gcc at a sysroot but we don't need to rebuild if this changes
+# e.g. we switch between different machines with different tunes.
+EXTRA_OECONF_PATHS[vardepsexclude] = "TUNE_PKGARCH"
+TARGET_ARCH[vardepsexclude] = "TUNE_ARCH"
+get_gcc_float_setting[vardepvalue] = ""
+
+#
+# gcc-cross looks and finds these in ${exec_prefix} but we're not so lucky
+# for the sdk. Hardcoding the paths ensures the build doesn't go canadian or worse.
+#
+export AR_FOR_TARGET = "${TARGET_PREFIX}ar"
+export AS_FOR_TARGET = "${TARGET_PREFIX}as"
+export DLLTOOL_FOR_TARGET = "${TARGET_PREFIX}dlltool"
+export CC_FOR_TARGET = "${TARGET_PREFIX}gcc"
+export CXX_FOR_TARGET = "${TARGET_PREFIX}g++"
+export GCC_FOR_TARGET = "${TARGET_PREFIX}gcc"
+export LD_FOR_TARGET = "${TARGET_PREFIX}ld"
+export LIPO_FOR_TARGET = "${TARGET_PREFIX}lipo"
+export NM_FOR_TARGET = "${TARGET_PREFIX}nm"
+export OBJDUMP_FOR_TARGET = "${TARGET_PREFIX}objdump"
+export RANLIB_FOR_TARGET = "${TARGET_PREFIX}ranlib"
+export STRIP_FOR_TARGET = "${TARGET_PREFIX}strip"
+export WINDRES_FOR_TARGET = "${TARGET_PREFIX}windres"
+
+#
+# We need to override this and make sure the compiler can find staging
+#
+export ARCH_FLAGS_FOR_TARGET = "--sysroot=${STAGING_DIR_TARGET}"
+
+do_configure () {
+	export CC_FOR_BUILD="${BUILD_CC}"
+	export CXX_FOR_BUILD="${BUILD_CXX}"
+	export CFLAGS_FOR_BUILD="${BUILD_CFLAGS}"
+	export CPPFLAGS_FOR_BUILD="${BUILD_CPPFLAGS}"
+	export CXXFLAGS_FOR_BUILD="${BUILD_CXXFLAGS}"
+	export LDFLAGS_FOR_BUILD="${BUILD_LDFLAGS}"
+	export CFLAGS_FOR_TARGET="${TARGET_CFLAGS}"
+	export CPPFLAGS_FOR_TARGET="${TARGET_CPPFLAGS}"
+	export CXXFLAGS_FOR_TARGET="${TARGET_CXXFLAGS}"
+	export LDFLAGS_FOR_TARGET="${TARGET_LDFLAGS}"
+	oe_runconf
+}
+
+do_compile () {
+	oe_runmake all-host configure-target-libgcc
+}
+
+# Having anything auto depending on gcc-cross-sdk is a really bad idea...
+EXCLUDE_FROM_SHLIBS = "1"
+
+PACKAGES = "${PN}-dbg ${PN} ${PN}-doc"
+
+FILES_${PN} = "\
+    ${exec_prefix}/bin/* \
+    ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/* \
+    ${gcclibdir}/${TARGET_SYS}/${BINV}/*.o \
+    ${gcclibdir}/${TARGET_SYS}/${BINV}/specs \
+    ${gcclibdir}/${TARGET_SYS}/${BINV}/lib* \
+    ${gcclibdir}/${TARGET_SYS}/${BINV}/include \
+    ${gcclibdir}/${TARGET_SYS}/${BINV}/include-fixed \
+    ${gcclibdir}/${TARGET_SYS}/${BINV}/plugin/include/ \
+    ${gcclibdir}/${TARGET_SYS}/${BINV}/plugin/gtype.* \
+    ${includedir}/c++/${BINV} \
+    ${prefix}/${TARGET_SYS}/bin/* \
+    ${prefix}/${TARGET_SYS}/lib/* \
+    ${prefix}/${TARGET_SYS}/usr/include/* \
+"
+INSANE_SKIP_${PN} += "dev-so"
+
+FILES_${PN}-dbg += " \
+    ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/.debug \
+    ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/plugin/.debug \
+"
+
+FILES_${PN}-doc = "\
+    ${infodir} \
+    ${mandir} \
+    ${gcclibdir}/${TARGET_SYS}/${BINV}/include/README \
+"
+
+EXEEXT = ""
+
+# Compute how to get from libexecdir to bindir in python (easier than shell)
+BINRELPATH = "${@os.path.relpath(d.expand("${bindir}"), d.expand("${libexecdir}/gcc/${TARGET_SYS}/${BINV}"))}"
+
+do_install () {
+	( cd ${B}/${TARGET_SYS}/libgcc; oe_runmake 'DESTDIR=${D}' install-unwind_h )
+	oe_runmake 'DESTDIR=${D}' install-host
+
+	# Cleanup some of the ${libdir}{,exec}/gcc stuff ...
+	rm -r ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/install-tools
+	rm -r ${D}${libexecdir}/gcc/${TARGET_SYS}/${BINV}/install-tools
+	rm -rf ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/finclude
+
+	# We care about g++ not c++
+	rm -f ${D}${bindir}/*c++
+
+	# We don't care about the gcc-<version> copies
+	rm -f ${D}${bindir}/*gcc-?.?*
+
+	# We use libiberty from binutils
+	rm -f ${D}${prefix}/${TARGET_SYS}/lib/libiberty.a
+	# Not sure where the strange paths come from
+	rm -f ${D}${libdir}/../lib/libiberty.a
+	rm -f ${D}${libdir}/libiberty.a
+
+	# Cleanup empty directories which are not shipped
+	# we use rmdir instead of 'rm -f' to ensure the non empty directories are not deleted
+	# ${D}${libdir}/../lib only seems to appear with SDKMACHINE=i686
+	local empty_dirs="${D}${libdir}/../lib ${D}${prefix}/${TARGET_SYS}/lib ${D}${prefix}/${TARGET_SYS} ${D}${includedir}"
+	for i in $empty_dirs; do
+		[ -d $i ] && rmdir --ignore-fail-on-non-empty $i
+	done
+
+	# Insert symlinks into libexec so when tools without a prefix are searched for, the correct ones are
+	# found.
+	dest=${D}${libexecdir}/gcc/${TARGET_SYS}/${BINV}/
+	install -d $dest
+	suffix=${EXEEXT}
+	for t in ar as ld nm objcopy objdump ranlib strip g77 gcc cpp gfortran; do
+		if [ "$t" = "g77" -o "$t" = "gfortran" ] && [ ! -e ${D}${bindir}/${TARGET_PREFIX}$t$suffix ]; then
+			continue
+		fi
+
+		ln -sf ${BINRELPATH}/${TARGET_PREFIX}$t$suffix $dest$t$suffix
+	done
+	t=real-ld
+	ln -sf ${BINRELPATH}/${TARGET_PREFIX}ld$suffix $dest$t$suffix
+
+	# libquadmath headers need to  be available in the gcc libexec dir
+	install -d ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include/
+	cp ${S}/libquadmath/quadmath.h ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include/
+	cp ${S}/libquadmath/quadmath_weak.h ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include/
+
+	chown -R root:root ${D}
+	
+	cross_canadian_bindirlinks
+}
+
+ELFUTILS = "nativesdk-elfutils"
+DEPENDS += "nativesdk-gmp nativesdk-mpfr nativesdk-libmpc ${ELFUTILS} nativesdk-zlib"
+RDEPENDS_${PN} += "nativesdk-mpfr nativesdk-libmpc ${ELFUTILS}"
+
+SYSTEMHEADERS = "/usr/include"
+SYSTEMLIBS = "${target_base_libdir}/"
+SYSTEMLIBS1 = "${target_libdir}/"
+
+EXTRA_OECONF += "--enable-poison-system-directories"
+
+EXTRA_OECONF += "\
+    --with-mpfr=${STAGING_DIR_HOST}${layout_exec_prefix} \
+    --with-mpc=${STAGING_DIR_HOST}${layout_exec_prefix} \
+"
+
+EXTRA_OECONF_append_libc-baremetal = " --without-headers"
+EXTRA_OECONF_remove_libc-baremetal = "--with-sysroot=/not/exist"
+EXTRA_OECONF_remove_libc-baremetal = "--with-build-sysroot=${STAGING_DIR_TARGET}"
+
+# gcc 4.7 needs -isystem
+export ARCH_FLAGS_FOR_TARGET = "--sysroot=${STAGING_DIR_TARGET} -isystem=${target_includedir}"
diff --git a/recipes-devtools/gcc/gcc-cross-canadian_4.9.bb b/recipes-devtools/gcc/gcc-cross-canadian_4.9.bb
new file mode 100644
index 0000000..1bd198a
--- /dev/null
+++ b/recipes-devtools/gcc/gcc-cross-canadian_4.9.bb
@@ -0,0 +1,5 @@
+require gcc-${PV}.inc
+require gcc-cross-canadian.inc
+
+
+
diff --git a/recipes-devtools/gcc/gcc-cross-canadian_4.9.bbappend b/recipes-devtools/gcc/gcc-cross-canadian_4.9.bbappend
new file mode 100644
index 0000000..c2e52f7
--- /dev/null
+++ b/recipes-devtools/gcc/gcc-cross-canadian_4.9.bbappend
@@ -0,0 +1,11 @@
+require gcc-fsl.inc
+
+DEPENDS_append_qoriq-ppc = " nativesdk-isl nativesdk-cloog"
+RDEPENDS_${PN}_append_qoriq-ppc = " nativesdk-isl nativesdk-cloog"
+
+EXTRA_OECONF_append_qoriq-ppc = " --with-isl=${STAGING_DIR_HOST}${SDKPATHNATIVE}${prefix_nativesdk} \
+                 --with-cloog=${STAGING_DIR_HOST}${SDKPATHNATIVE}${prefix_nativesdk} \
+"
+
+INSANE_SKIP_${PN} += "libdir file-rdeps build-deps"
+INSANE_SKIP_${PN}-dbg += "libdir"
diff --git a/recipes-devtools/gcc/gcc-cross-initial.inc b/recipes-devtools/gcc/gcc-cross-initial.inc
new file mode 100644
index 0000000..892b1db
--- /dev/null
+++ b/recipes-devtools/gcc/gcc-cross-initial.inc
@@ -0,0 +1,89 @@
+DEPENDS = "virtual/${TARGET_PREFIX}binutils ${NATIVEDEPS}"
+PROVIDES = "virtual/${TARGET_PREFIX}gcc-initial"
+PACKAGES = ""
+
+INHIBIT_AUTOTOOLS_DEPS = "1"
+INHIBIT_DEFAULT_DEPS = "1"
+
+# We still need gnu-config-native
+DEPENDS_prepend = "gnu-config-native autoconf-native "
+
+PN = "gcc-cross-initial-${TARGET_ARCH}"
+
+CROSS_TARGET_SYS_DIR_append = ".${PN}"
+
+# This is intended to be a -very- basic config
+# sysroot is needed in case we use libc-initial
+EXTRA_OECONF = "\
+    --with-newlib \
+    --without-headers \
+    --disable-shared \
+    --disable-threads \
+    --disable-multilib \
+    --disable-__cxa_atexit \
+    --enable-languages=c \
+    --program-prefix=${TARGET_PREFIX} \
+    --with-sysroot=/not/exist \
+    --with-build-sysroot=${STAGING_DIR_TARGET} \
+    ${EXTRA_OECONF_INITIAL} \
+    ${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-gold', '--with-ld=${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}ld.bfd', '', d)} \
+    ${EXTRA_OECONF_GCC_FLOAT} \
+    ${@get_gcc_ppc_plt_settings(bb, d)} \
+"
+
+EXTRA_OECONF += "--with-native-system-header-dir=${SYSTEMHEADERS}"
+
+do_compile () {
+    oe_runmake all-gcc configure-target-libgcc
+    (cd ${B}/${TARGET_SYS}/libgcc; oe_runmake enable-execute-stack.c unwind.h md-unwind-support.h sfp-machine.h gthr-default.h)
+}
+
+do_install () {
+	( cd ${B}/${TARGET_SYS}/libgcc; oe_runmake 'DESTDIR=${D}' install-unwind_h-forbuild install-unwind_h)
+	oe_runmake 'DESTDIR=${D}' install-gcc
+
+	# We don't really need this (here shares/ contains man/, info/, locale/).
+	rm -rf ${D}${datadir}/
+
+	# We use libiberty from binutils
+	find ${D}${exec_prefix}/lib -name libiberty.a | xargs rm -f
+	find ${D}${exec_prefix}/lib -name libiberty.h | xargs rm -f
+
+	# Insert symlinks into libexec so when tools without a prefix are searched for, the correct ones are
+	# found. These need to be relative paths so they work in different locations.
+	dest=${D}${libexecdir}/gcc/${TARGET_SYS}/${BINV}/
+	install -d $dest
+	useld=${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-gold', '.bfd', '', d)}
+	ln -sf ${BINRELPATH}/${TARGET_PREFIX}ld${useld} ${dest}ld
+	for t in ar as nm objcopy objdump ranlib strip g77 gcc cpp gfortran; do
+		ln -sf ${BINRELPATH}/${TARGET_PREFIX}$t $dest$t
+	done
+	# fixed limits.h infact includes the so called real limits.h
+	# which should come from libc but when we build libc-initial
+	# then bunch of configure tests include fixed limits.h which in turn
+	# includes real limits.h but this real limits.h is not staged yet
+	# so we overwirte the generated include-fixed/limits.h for gcc-cross-initial
+	# to get rid references to real limits.h
+	cp gcc/include-fixed/limits.h ${D}${gcclibdir}/${TARGET_SYS}/${BINV}/include/limits.h
+}
+#
+# Override the default sysroot staging copy since this won't look like a target system
+#
+sysroot_stage_all() {
+	sysroot_stage_dir ${D} ${SYSROOT_DESTDIR}
+	install -d ${SYSROOT_DESTDIR}${STAGING_DIR_TARGET}${target_base_libdir}/
+	install -d ${SYSROOT_DESTDIR}${STAGING_DIR_TARGET}${target_libdir}/
+	mv ${SYSROOT_DESTDIR}${target_base_libdir}/* ${SYSROOT_DESTDIR}${STAGING_DIR_TARGET}${target_base_libdir}/ || true
+	mv ${SYSROOT_DESTDIR}${target_libdir}/* ${SYSROOT_DESTDIR}${STAGING_DIR_TARGET}${target_libdir}/ || true
+}
+
+do_populate_sysroot[sstate-inputdirs] = "${SYSROOT_DESTDIR}/${STAGING_DIR_HOST}/"
+do_populate_sysroot[sstate-outputdirs] = "${COMPONENTS_DIR}/${PACKAGE_ARCH}/${PN}"
+
+inherit nopackages
+
+COMPILERINITIAL = "-initial"
+
+
+# We really only want this built by things that need it, not any recrdeptask
+deltask do_build
diff --git a/recipes-devtools/gcc/gcc-cross-initial_4.9.bb b/recipes-devtools/gcc/gcc-cross-initial_4.9.bb
new file mode 100644
index 0000000..1639511
--- /dev/null
+++ b/recipes-devtools/gcc/gcc-cross-initial_4.9.bb
@@ -0,0 +1,2 @@
+require gcc-cross_${PV}.bb
+require gcc-cross-initial.inc
diff --git a/recipes-devtools/gcc/gcc-cross-initial_4.9.bbappend b/recipes-devtools/gcc/gcc-cross-initial_4.9.bbappend
new file mode 100644
index 0000000..1c725f2
--- /dev/null
+++ b/recipes-devtools/gcc/gcc-cross-initial_4.9.bbappend
@@ -0,0 +1 @@
+require gcc-fsl.inc
diff --git a/recipes-devtools/gcc/gcc-cross.inc b/recipes-devtools/gcc/gcc-cross.inc
new file mode 100644
index 0000000..a6df45e
--- /dev/null
+++ b/recipes-devtools/gcc/gcc-cross.inc
@@ -0,0 +1,216 @@
+inherit cross
+
+INHIBIT_DEFAULT_DEPS = "1"
+EXTRADEPENDS = ""
+DEPENDS = "virtual/${TARGET_PREFIX}binutils virtual/${TARGET_PREFIX}libc-for-gcc ${EXTRADEPENDS} ${NATIVEDEPS}"
+PROVIDES = "virtual/${TARGET_PREFIX}gcc virtual/${TARGET_PREFIX}g++"
+python () {
+    if d.getVar("TARGET_OS").startswith("linux"):
+        d.setVar("EXTRADEPENDS", "linux-libc-headers")
+}
+
+PN = "gcc-cross-${TARGET_ARCH}"
+
+# Ignore how TARGET_ARCH is computed.
+TARGET_ARCH[vardepvalue] = "${TARGET_ARCH}"
+
+require recipes-devtools/gcc/gcc-configure-common.inc
+
+# While we want the 'gnu' hash style, we explicitly set it to sysv here to
+# ensure that any recipe which doesn't obey our LDFLAGS (which also set it to
+# gnu) will hit a QA failure.
+LINKER_HASH_STYLE ?= "sysv"
+
+EXTRA_OECONF += "--enable-poison-system-directories"
+EXTRA_OECONF_append_sh4 = " \
+    --with-multilib-list= \
+    --enable-incomplete-targets \
+"
+
+EXTRA_OECONF += "\
+    --with-mpfr=${STAGING_DIR_NATIVE}${prefix_native} \
+    --with-system-zlib \
+"
+
+DEPENDS_remove_libc-baremetal := "virtual/${TARGET_PREFIX}libc-for-gcc"
+EXTRA_OECONF_append_libc-baremetal = " --without-headers"
+EXTRA_OECONF_remove_libc-baremetal = "--enable-threads=posix"
+
+EXTRA_OECONF_PATHS = "\
+    --with-gxx-include-dir=/not/exist${target_includedir}/c++/${BINV} \
+    --with-sysroot=/not/exist \
+    --with-build-sysroot=${STAGING_DIR_TARGET} \
+"
+
+ARCH_FLAGS_FOR_TARGET += "-isystem${STAGING_DIR_TARGET}${target_includedir}"
+
+do_compile () {
+	export CC="${BUILD_CC}"
+	export AR_FOR_TARGET="${TARGET_SYS}-ar"
+	export RANLIB_FOR_TARGET="${TARGET_SYS}-ranlib"
+	export LD_FOR_TARGET="${TARGET_SYS}-ld"
+	export NM_FOR_TARGET="${TARGET_SYS}-nm"
+	export CC_FOR_TARGET="${CCACHE} ${TARGET_SYS}-gcc"
+	export CFLAGS_FOR_TARGET="${TARGET_CFLAGS}"
+	export CPPFLAGS_FOR_TARGET="${TARGET_CPPFLAGS}"
+	export CXXFLAGS_FOR_TARGET="${TARGET_CXXFLAGS}"
+	export LDFLAGS_FOR_TARGET="${TARGET_LDFLAGS}"
+
+	oe_runmake all-host configure-target-libgcc
+	(cd ${B}/${TARGET_SYS}/libgcc; oe_runmake enable-execute-stack.c unwind.h md-unwind-support.h sfp-machine.h gthr-default.h)
+	# now generate script to drive testing
+	echo "#!/usr/bin/env sh" >${B}/${TARGET_PREFIX}testgcc
+	set >> ${B}/${TARGET_PREFIX}testgcc
+	# prune out the unneeded vars
+	sed -i -e "/^BASH/d" ${B}/${TARGET_PREFIX}testgcc
+	sed -i -e "/^USER/d" ${B}/${TARGET_PREFIX}testgcc
+	sed -i -e "/^OPT/d" ${B}/${TARGET_PREFIX}testgcc
+	sed -i -e "/^DIRSTACK/d" ${B}/${TARGET_PREFIX}testgcc
+	sed -i -e "/^EUID/d" ${B}/${TARGET_PREFIX}testgcc
+	sed -i -e "/^FUNCNAME/d" ${B}/${TARGET_PREFIX}testgcc
+	sed -i -e "/^GROUPS/d" ${B}/${TARGET_PREFIX}testgcc
+	sed -i -e "/^HOST/d" ${B}/${TARGET_PREFIX}testgcc
+	sed -i -e "/^HOME/d" ${B}/${TARGET_PREFIX}testgcc
+	sed -i -e "/^IFS/d" ${B}/${TARGET_PREFIX}testgcc
+	sed -i -e "/^LC_ALL/d" ${B}/${TARGET_PREFIX}testgcc
+	sed -i -e "/^LOGNAME/d" ${B}/${TARGET_PREFIX}testgcc
+	sed -i -e "/^MACHTYPE/d" ${B}/${TARGET_PREFIX}testgcc
+	sed -i -e "/^OSTYPE/d" ${B}/${TARGET_PREFIX}testgcc
+	sed -i -e "/^PIPE/d" ${B}/${TARGET_PREFIX}testgcc
+	sed -i -e "/