User account creation filtered due to spam.

Bug 52144 - ARM should support arm/thumb function attribute to permit different instruction sets in the same source
Summary: ARM should support arm/thumb function attribute to permit different instructi...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 4.7.0
: P3 enhancement
Target Milestone: ---
Assignee: chrbr
URL:
Keywords:
: 59884 (view as bug list)
Depends on:
Blocks: 45729 59884 65837
  Show dependency treegraph
 
Reported: 2012-02-06 23:01 UTC by Rafaël Carré
Modified: 2015-09-15 13:43 UTC (History)
3 users (show)

See Also:
Host:
Target: arm*-*-*
Build:
Known to work:
Known to fail:
Last reconfirmed: 2012-02-06 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Rafaël Carré 2012-02-06 23:01:42 UTC
Reference: First message of http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40419

Mixing thumb and ARM in the same source is currently not possible.

That would permit LTO to work when mixing those and close http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45729
Comment 1 Andrew Pinski 2012-02-06 23:03:04 UTC
Confirmed.
Comment 2 chrbr 2015-05-20 12:59:36 UTC
*** Bug 59884 has been marked as a duplicate of this bug. ***
Comment 4 chrbr 2015-05-26 14:06:48 UTC
Author: chrbr
Date: Tue May 26 14:06:17 2015
New Revision: 223699

URL: https://gcc.gnu.org/viewcvs?rev=223699&root=gcc&view=rev
Log:
 2015-05-13  Christian Bruel  <christian.bruel@st.com>

	PR target/52144
	* config/arm/arm.c (arm_option_check_internal)
	(arm_option_params_internal): Check opts->target_flags to set macros.
	(TREE_TARGET_ARM, TREE_TARGET_THUMB)
	(TREE_TARGET_THUMB1, TREE_TARGET_THUMB2) Replace with...
	(TARGET_ARM_P, TARGET_THUMB_P, TARGET_THUMB1_P, TARGET_THUMB2_P)
	(builtin_define): Replaced with def_or_undef_macro.
	* config/arm/arm.h (TREE_TARGET_ARM, TREE_TARGET_THUMB)
	TREE_TARGET_THUMB1, TREE_TARGET_THUMB2) Redefine with...
	(TARGET_ARM_P, TARGET_THUMB_P, TARGET_THUMB1_P, TARGET_THUMB2_P)
	(TARGET_32BIT_P, TARGET_ARM_QBIT_P, TARGET_ARM_SAT_P, TARGET_IDIV_P)
	(TARGET_HAVE_LDREX_P, TARGET_HAVE_LDREXBH_P, TARGET_HAVE_LDREXD_P)
	(TARGET_ARM_FEATURE_LDREX_P)
	(TARGET_DSP_MULTIPLY_P, TARGET_INT_SIMD_P): New macros.
	(def_or_undef_macro): New function.


Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/arm/arm-c.c
    trunk/gcc/config/arm/arm.c
    trunk/gcc/config/arm/arm.h
Comment 5 chrbr 2015-06-10 07:51:31 UTC
Author: chrbr
Date: Wed Jun 10 07:50:59 2015
New Revision: 224314

URL: https://gcc.gnu.org/viewcvs?rev=224314&root=gcc&view=rev
Log:
Add ARM/thumb attribute target

	PR target/52144

	* config/arm/arm.opt (THUMB, arm_restrict_it, inline_asm_unified): Save.
	* config/arm/arm-protos.h (arm_valid_target_attribute_tree): Declare.
	(arm_reset_previous_fndecl, arm_change_mode_p): Likewise.
	* config/arm/arm.h (SWITCHABLE_TARGET): Define.
	* config/arm/arm.c (arm_reset_previous_fndecl): New functions.
	(arm_valid_target_attribute_tree, arm_change_mode_p): Likewise.
	(arm_valid_target_attribute_p): Likewise.
	(arm_set_current_function, arm_can_inline_p): Likewise.
	(arm_valid_target_attribute_rec): Likewise.
	(arm_previous_fndecl): New variable.
	(TARGET_SET_CURRENT_FUNCTION, TARGET_OPTION_VALID_ATTRIBUTE_P): Define.
	(TARGET_CAN_INLINE_P): Define.
	(arm_asm_trampoline_template): Emit mode.
	(arm_file_start): Don't set unified syntax.
	(arm_declare_function_name): Set unified syntax and mode.
	(arm_option_override): Init target_option_default_node.
	and target_option_current_node.
	* config/arm/arm.md (*call_value_symbol): Set mode when possible.
	(*call_symbol): Likewise.
	* doc/extend.texi: Document ARM/Thumb target attribute.
	* doc/invoke.texi: Likewise.

	* gcc.target/arm/attr_arm.c: New test
	* gcc.target/arm/attr_arm-err.c: New test
	* gcc.target/arm/attr_thumb.c: New test
	* gcc.target/arm/attr_thumb-static.c: New test


Added:
    trunk/gcc/testsuite/gcc.target/arm/attr_arm-err.c
    trunk/gcc/testsuite/gcc.target/arm/attr_arm.c
    trunk/gcc/testsuite/gcc.target/arm/attr_thumb-static.c
    trunk/gcc/testsuite/gcc.target/arm/attr_thumb.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/arm/arm-protos.h
    trunk/gcc/config/arm/arm.c
    trunk/gcc/config/arm/arm.h
    trunk/gcc/config/arm/arm.md
    trunk/gcc/config/arm/arm.opt
    trunk/gcc/doc/extend.texi
    trunk/gcc/doc/invoke.texi
    trunk/gcc/testsuite/ChangeLog
Comment 6 chrbr 2015-06-11 08:51:49 UTC
Author: chrbr
Date: Thu Jun 11 08:51:17 2015
New Revision: 224365

URL: https://gcc.gnu.org/viewcvs?rev=224365&root=gcc&view=rev
Log:
Add ARM/thumb pragma target 

	PR target/52144
	* config/arm/arm-c.c (arm_cpu_cpp_builtins): Conditionally define
	 macros in ...
	(arm_cpu_builtins): New function.
	(arm_pragma_target_parse): Call arm_cpu_builtins.
	* config/arm/arm-protos.h (arm_cpu_builtins): Declare.
	(arm_register_target_pragmas): Likewise.
	* config/arm/arm.h (REGISTER_TARGET_PRAGMAS):
	 Call arm_register_target_pragmas.
	* config/arm/arm-c.c (arm_register_target_pragmas): New function.
	(arm_pragma_target_parse): Likewise.

	PR target/52144
	* gcc.target/arm/pragma_attribute.c: New test.


Added:
    trunk/gcc/testsuite/gcc.target/arm/pragma_attribute.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/arm/arm-c.c
    trunk/gcc/config/arm/arm-protos.h
    trunk/gcc/config/arm/arm.h
    trunk/gcc/testsuite/ChangeLog
Comment 7 chrbr 2015-06-19 06:58:54 UTC
Author: chrbr
Date: Fri Jun 19 06:58:22 2015
New Revision: 224638

URL: https://gcc.gnu.org/viewcvs?rev=224638&root=gcc&view=rev
Log:
PR target/66541
PR target/52144
* config/arm/arm.c (arm_set_current_function): Handle
explicit default options.


Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/arm/arm.c
Comment 8 chrbr 2015-06-22 07:32:47 UTC
Author: chrbr
Date: Mon Jun 22 07:32:15 2015
New Revision: 224721

URL: https://gcc.gnu.org/viewcvs?rev=224721&root=gcc&view=rev
Log:
Add -mflip-thumb for testing.

PR target/52144n
* config/arm/arm.c (add_attribute, arm_insert_attributes): New functions
(TARGET_INSERT_ATTRIBUTES): Define.
(thumb_flipper): New var.
* config/arm/arm.opt (-mflip-thumb): New switch.

PR target/52144
* gcc.target/arm/flip-thumb.c: New test.


Added:
    trunk/gcc/testsuite/gcc.target/arm/flip-thumb.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/arm/arm.c
    trunk/gcc/config/arm/arm.opt
    trunk/gcc/testsuite/ChangeLog
Comment 9 chrbr 2015-06-22 08:22:22 UTC
attribute ((thumb,arm)) should be fine for 6.0.0 r224722
Comment 10 chrbr 2015-07-07 07:56:42 UTC
Author: chrbr
Date: Tue Jul  7 07:56:10 2015
New Revision: 225503

URL: https://gcc.gnu.org/viewcvs?rev=225503&root=gcc&view=rev
Log:
Cleanup arch file directive.

PR target/52144
* config/arm/elf.h (TARGET_ASM_FILE_START_APP_OFF): Delete.

PR target/52144
* gcc.target/arm/flip-thumb.c: Fix scan.
* gcc.target/arm/attr_thumb.c: Test for all targets. Fix scan.
* gcc.target/arm/attr_arm.c: Test for all targets. Fix scan.
* gcc.target/arm/attr_thumb-static.c: Test for all targets.
Fix return value.


Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/arm/elf.h
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/gcc.target/arm/attr_arm.c
    trunk/gcc/testsuite/gcc.target/arm/attr_thumb-static.c
    trunk/gcc/testsuite/gcc.target/arm/attr_thumb.c
    trunk/gcc/testsuite/gcc.target/arm/flip-thumb.c
Comment 11 chrbr 2015-09-15 13:43:49 UTC
Author: chrbr
Date: Tue Sep 15 13:43:17 2015
New Revision: 227795

URL: https://gcc.gnu.org/viewcvs?rev=227795&root=gcc&view=rev
Log:
2015-09-15  Christian Bruel  <christian.bruel@st.com>

	PR target/52144
	* config/arm/arm.c (arm_option_params_internal): Remove opts parameter.
	* config/arm/arm-c.c (arm_cpu_builtins): Declare static.
	Remove flags parameter.
	* config/arm/arm.h (TARGET_32BIT_P, TARGET_ARM_QBIT_P)
	(TARGET_ARM_SAT_P, TARGET_IDIV_P, TARGET_HAVE_LDREX_P)
	(TARGET_HAVE_LDREXBH_P, TARGET_HAVE_LDREXD_P, TARGET_DSP_MULTIPLY_P)
	(TARGET_ARM_FEATURE_LDREX_P, TARGET_INT_SIMD_P): Redefine macros with...
	(TARGET_ARM_SAT, TARGET_IDIV, TARGET_HAVE_LDREX)
	(TARGET_HAVE_LDREXBH, TARGET_HAVE_LDREXD, TARGET_ARM_FEATURE_LDREX)
	(TARGET_DSP_MULTIPLY, TARGET_INT_SIMD): Redefined macros.
	* gcc/config/arm/arm-protos.h (arm_cpu_builtins): Remove declaration.


Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/arm/arm-c.c
    trunk/gcc/config/arm/arm-protos.h
    trunk/gcc/config/arm/arm.c
    trunk/gcc/config/arm/arm.h