This is part of a series to remove uses of for_each_rtx from the ports. Tested by making sure there were no code changes for gcc.dg, gcc.c-torture and g++.dg for x86_64-linux-gnu, and also by a boostrap. OK to install?
Thanks, Richard gcc/ * config/i386/i386.c: Include rtl-iter.h (ix86_check_avx256_register): Take a const_rtx and return a bool. (ix86_check_avx256_stores): Update call accordingly. (ix86_avx_u128_mode_entry, ix86_avx_u128_mode_exit): Likewise. (ix86_avx_u128_mode_needed): Likewise. Use FOR_EACH_SUBRTX. Index: gcc/config/i386/i386.c =================================================================== --- gcc/config/i386/i386.c 2014-10-25 09:48:53.074537743 +0100 +++ gcc/config/i386/i386.c 2014-10-25 09:51:15.189792126 +0100 @@ -88,6 +88,7 @@ the Free Software Foundation; either ver #include "tree-vectorizer.h" #include "shrink-wrap.h" #include "builtins.h" +#include "rtl-iter.h" static rtx legitimize_dllimport_symbol (rtx, bool); static rtx legitimize_pe_coff_extern_decl (rtx, bool); @@ -16114,19 +16115,14 @@ output_387_binary_op (rtx insn, rtx *ope /* Check if a 256bit AVX register is referenced inside of EXP. */ -static int -ix86_check_avx256_register (rtx *pexp, void *) +static bool +ix86_check_avx256_register (const_rtx exp) { - rtx exp = *pexp; - if (GET_CODE (exp) == SUBREG) exp = SUBREG_REG (exp); - if (REG_P (exp) - && VALID_AVX256_REG_OR_OI_MODE (GET_MODE (exp))) - return 1; - - return 0; + return (REG_P (exp) + && VALID_AVX256_REG_OR_OI_MODE (GET_MODE (exp))); } /* Return needed mode for entity in optimize_mode_switching pass. */ @@ -16148,7 +16144,7 @@ ix86_avx_u128_mode_needed (rtx_insn *ins { rtx arg = XEXP (XEXP (link, 0), 0); - if (ix86_check_avx256_register (&arg, NULL)) + if (ix86_check_avx256_register (arg)) return AVX_U128_DIRTY; } } @@ -16160,8 +16156,10 @@ ix86_avx_u128_mode_needed (rtx_insn *ins changes state only when a 256bit register is written to, but we need to prevent the compiler from moving optimal insertion point above eventual read from 256bit register. */ - if (for_each_rtx (&PATTERN (insn), ix86_check_avx256_register, NULL)) - return AVX_U128_DIRTY; + subrtx_iterator::array_type array; + FOR_EACH_SUBRTX (iter, array, PATTERN (insn), NONCONST) + if (ix86_check_avx256_register (*iter)) + return AVX_U128_DIRTY; return AVX_U128_ANY; } @@ -16245,7 +16243,7 @@ ix86_mode_needed (int entity, rtx_insn * static void ix86_check_avx256_stores (rtx dest, const_rtx, void *data) { - if (ix86_check_avx256_register (&dest, NULL)) + if (ix86_check_avx256_register (dest)) { bool *used = (bool *) data; *used = true; @@ -16310,7 +16308,7 @@ ix86_avx_u128_mode_entry (void) { rtx incoming = DECL_INCOMING_RTL (arg); - if (incoming && ix86_check_avx256_register (&incoming, NULL)) + if (incoming && ix86_check_avx256_register (incoming)) return AVX_U128_DIRTY; } @@ -16344,7 +16342,7 @@ ix86_avx_u128_mode_exit (void) /* Exit mode is set to AVX_U128_DIRTY if there are 256bit modes used in the function return register. */ - if (reg && ix86_check_avx256_register (®, NULL)) + if (reg && ix86_check_avx256_register (reg)) return AVX_U128_DIRTY; return AVX_U128_CLEAN;