This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH]: MMX/x87 FPU mode switching and MMX vectorizer, all-in-one patch


Hello!

This patch is a collection of four separate patches, needed to implement MMX
vectorizer with automatic x87/MMX mode switching. Patch is diffed against latest
gcc-4.1-20050716 snapshot.

Following patches are included in this all-in one patch:

- Fix __builtin_apply problems with MMX registers
[http://gcc.gnu.org/ml/gcc-patches/2005-07/msg00989.html]

- Enable vectorizer for TARGET_MMX (+ fix two 3dnow! failures)
[http://gcc.gnu.org/ml/gcc-patches/2005-07/msg00909.html]

- Implement automatic x87/MMX mode switching, take 3
[http://gcc.gnu.org/ml/gcc-patches/2005-07/msg00895.html]

- Midlevel patch for MMX/x87 mode switching
[http://gcc.gnu.org/ml/gcc-patches/2005-07/msg00894.html]


Bootstrapped on i686-pc-linux-gnu, regtested for c and c++, no new regressions.


2005-07-14  Uros Bizjak  <uros@kss-loka.si>

	* builtins.c (FUNCTION_VALUE_REGNO_P_APPLY_RESULT): Define
	to FUNCTION_VALUE_REGNO_P if undefined.
	(FUNCTION_ARG_REGNO_P_APPLY_ARGS): Define to
	FUNCTION_ARG_REGNO_P if undefined.
	(apply_args_size): Use FUNCTION_ARG_REGNO_P_APPLY_ARGS.
	(apply_result_size): Use FUNCTION_VALUE_REGNO_P_APPLY_RESULT.

	* config/i386/i386-protos.h (ix86_function_value_regno_p):
	Add new bool argument.
	(ix86_function_arg_regno_p): Add new bool argument.
	* config/i386/i386.h (FUNCTION_VALUE_REGNO_P): Add new
	argument in call to ix86_function_value_regno_p ().
	(FUNCTION_VALUE_REGNO_P_APPLY_RESULT): New define.
	(FUNCTION_ARG_REGNO_P): Add new argument in call to
	ix86_function_arg_regno_p ().
	(FUNCTION_ARG_REGNO_P_APPLY_ARGS): New define.
	* config/i386/i386.c (ix86_function_arg_regno_p): Add new
	from_builtin function argument. Do not return true for MMX
	registers when TARGET_80387 and from_builtin are set.
	(ix86_function_value_regno_p): Add new from_builtin function
	argument. Do not return true for MMX registers when 
	TARGET_80387 and from_builtin are set.


2005-07-13  Uros Bizjak  <uros@kss-loka.si>

	* config/i386/i386.h (UNITS_PER_SIMD_WORD): Return 8 for
	TARGET_MMX.

	* config/i386/i386.c (enum ix86_builtins):
	IX86_BUILTIN_VEC_INIT_V2SF, IX86_BUILTIN_VEC_EXT_V2SF: New codes.
	(struct builtin_description bdesc_2arg)
	[IX86_BUILTIN_PSLLW, IX86_BUILTIN_PSLLWI, IX86_BUILTIN_PSLLD]
	[IX86_BUILTIN_PSLLDI, IX86_BUILTIN_PSRLW, IX86_BUILTIN_PSRLWI]
	[IX86_BUILTIN_PSRLD, IX86_BUILTIN_PSRLDI]: Rename icode from
	CODE_FOR_mmx_* to CODE_FOR_*.
	(ix86_init_mmx_sse_builtins): __builtin_ia32_vec_init_v2sf,
	__builtin_ia32_vec_init_v2si: Initialize builtins.
	(ix86_expand_builtin): IX86_BUILTIN_VEC_INIT_V2SF,
	IX86_BUILTIN_VEC_EXT_V2SF: Handle new builtin codes.

	* config/i386/mm3dnow.h (_m_from_float): Implement using
	__builtin_ia32_vec_init_v2sf.
	(_m_to_float): Implement using __builtin_ia32_vec_ext_v2sf macro.

	* config/i386/mmx.md ("vec_setv2sf", "vec_setv2si", "vec_setv4hi")
	("vec_setv8qi"): Set mmx_ok parameter in call to
	ix86_expand_vector_set() to true.
	("vec_extractv2sf", "vec_extractv2si", "vec_extractv4hi")
	("vec_extractv8qi"): Set mmx_ok parameter in call to
	ix86_expand_vector_extract() to true.
	("vec_initv2sf", "vec_initv2si", "vec_initv4hi", "vec_initv8qi"):
	Set mmx_ok parameter in call to ix86_expand_vector_init()
	to true.
	("neg<mode>2", "add<mode>3", "sub<mode>3", "mulv4hi3", "umaxv8qi3")
	("smaxv4hi3", "uminv8qi3", "sminv4hi3", "vcond<mode>", "vconduv8qi")
	("one_cmpl<mode>2", "and<mode>3", "ior<mode>3", "xor<mode>3"):
	New expanders.
	("ashr<mode>3"): Rename from "mmx_ashr<mode>3".
	("lshr<mode>3"): Rename from "mmx_lshr<mode>3".
	("ashl<mode>3"): Rename from "mmx_ashl<mode>3".

	* config/i386/sse.md ("sse_cvtpi2ps"): Set "unit" attribute
	to "mmx".
	("*vec_concatv2di"): Set "unit" attribute to "mmx" for mmx
	register operand.


2005-07-13  Uros Bizjak  <uros@kss-loka.si>

	* reg-stack.c (subst_stack_regs_pat): Handle MMX/x87 FPU mode
	UNSPEC_EFPU and UNSPEC_EMMS switching instructions.
	(subst_stack_regs): Handle CALL_INSN_SETS for stack registers.
	(convert_regs_entry): Do not emit stack compensation code if
	all stack regs are live at function entry.
	(convert_regs_exit): Handle EPILOGUE_USES mentioned stack
	registers at function exit.

	* config/i386/i386-modes.def (ALLREGS): New RANDOM_MODE.

	* config/i386/i386-protos.h (emit_i387_cw_initialization):
	Remove prototype.
	(ix86_epilogue_uses): New prototype.
	(ix86_call_insn_sets): New prototype.
	(ix86_call_insn_uses): New prototype.
	(ix86_mode_after): New prototype.
	(ix86_mode_entry): New prototype.
	(ix86_mode_exit): New prototype.
	(ix86_emit_mode_set): New prototype.

	* config/i386/i386.h (HARD_REGNO_NREGS):Return 8 for
	ALLREGS mode.
	(EPILOGUE_USES): New define.
	(CALL_INSN_SETS): New define.
	(CALL_INSN_USES): New define.
	(enum ix86_fpu_mode): New enum.
	(enum ix86_entity): Add new I387_FPU_MODE entity.
	(NUM_MODES_FOR_MODE_SWITCHING): Add FPU_MODE_ANY to
	enable switching for I387_FPU_MODE entity.
	(LIFE_ANALYSIS_AFTER_MODE_SWITCHING): New define.
	(MODE_AFTER): New define.
	(MODE_ENTRY): New define.
	(MODE_EXIT): New define.
	(EMIT_MODE_SET): Change definition to use ix86_emit_mode_set.
	(struct machine_function): Add fpu_mode_changed variable.
	(ix86_fpu_mode_changed): New define.

	* config/i386/i386.c (ix86_mode_needed): Handle I387_FPU_MODE
	entity.
	(ix86_mode_after): New function.
	(ix86_mode_entry): New function.
	(ix86_mode_exit): New function.
	(ix86_emit_mode_set): Renamed from emit_i387_cw_initialization.
	Handle I387_FPU_MODE entity.
	(ix86_init_machine_status): Set optimize_mode_switching flag
	for I387_FPU_MODE entity if (TARGET_80387 && TARGET_MMX).
	(ix86_epilogue_uses): New function.
	(ix86_call_insn_uses): New function.
	(ix86_call_insn_sets): New function.
	(ix86_expand_builtin) [IX86_BUILTIN_EMMS, IX86_BUILTIN_FEMMS]:
	Do not emit instruction patterns anymore.

	* config/i386/i386.md (UNSPECV_FEMMS): Remove UNSPECV constant.
	(UNSPECV_EFPU): New UNSPECV constant.
	(FIRSTFP_REG, FIRSTMMX_REG): New constants.

	* config/i386/mmx.md ("efpu", "emms"): New instruction definitions.
	("mmx_emms", "mmx_femms"): Remove instruction definition.


2005-07-13  Uros Bizjak  <uros@kss-loka.si>

	* caller-save.c (save_call_clobbered_regs): Handle
	CALL_INSN_SETS to mark additional used and set registers
	in function call.
	* flow.c (propagate_one_insn): Handle CALL_INSN_SETS
	and CALL_INSN_USES macros to mark additional used and set
	registers in function call.
	* mode-switching.c (rest_of_handle_mode_switching): Perform
	register life analysis after optimize_mode_switching pass if
	LIFE_ANALYSIS_AFTER_MODE_SWITCHING is defined and set.
	(optimize_mode_switching): Change MODE_AFTER to include entity.

	* config/sh/sh.h (MODE_AFTER): Change define to include entity.

	* doc/tm.texi (Function Entry): Document CALL_INSN_SETS
	and CALL_INSN_USES macros.
	(Mode Switching): Document LIFE_ANALYSIS_AFTER_MODE_SWITCHING
	macro. Change description of MODE_AFTER macro to include
	entity variable.

Uros.

Attachment: mmx.diff.bz2
Description: BZip2 compressed data


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]