On Fri, Sep 25, 2015 at 02:59:41PM +0100, Dominik Vogt wrote:
> The following set of two patches implements the function
> __attribute__ ((target("..."))) and the corresponding #pragma GCC
> target("...") on S/390.  It comes with certain limitations:
> 
>  * It is not possible to change any options that affect the ABI or
>    the definition of target macros by using the attribute (vx,
>    htm, zarch and others).  Some of them are still supported but
>    unable to change the definition of the corresponding target macros.
>    In these cases, the pragma has to be used.  One reason for this
>    is that it is not possible to change the definition of the target
>    macros with the attribute, but the implementation of some features
>    relies on them.
> 
>  * Even with the pragma it is not possible to switch between zarch
>    and esa architecture because internal data typed would have to be
>    changed at Gcc run time.
> 
> The second patch contains a long term change in the interface with
> the assembler.  Currently, the compiler wrapper passes the same
> -march= and -mtune= options to the compiler and the assembler.
> The patch makes this obsolete by emitting ".machine" and
> ".machinemode" dirctives to the top of the assembly language file.
> The old way ist still supported but may be removed once the
> ".machine" feature is supported by all as versions in the field.
> 
> The second patch depends on the first one, and both require the
> (latest) change proposed in this thread:
> https://gcc.gnu.org/ml/gcc-patches/2015-09/msg01546.html

Ciao

Dominik ^_^  ^_^

-- 

Dominik Vogt
IBM Germany
gcc/ChangeLog

        * config/s390/s390.opt (s390_arch_string): Remove.
        (s390_tune_string): Likewise.
        (s390_cost_pointer): Add Variable.
        (s390_arch_specified): Add TargetVariable.
        (s390_tune_specified): Likewise.
        (s390_tune_flags): Likewise.
        (s390_arch_flags): Save option.
        (march=): Likewise.
        (mbackchain): Likewise.
        (mdebug): Likewise.
        (mesa): Likewise.
        (mhard-dfp): Likewise.
        (mhard-float): Likewise.
        (mlong-double-128): Likewise.
        (mlong-double-64): Likewise.
        (mhtm): Likewise.
        (mvx): Likewise.
        (mpacked-stack): Likewise.
        (msmall-exec): Likewise.
        (msoft-float): Likewise.
        (mstack-guard=): Likewise.
        (mstack-size=): Likewise.
        (mtune=): Likewise.
        (mmvcle): Likewise.
        (mzvector): Likewise.
        (mzarch): Likewise.
        (mbranch-cost=): Likewise.
        (mwarn-dynamicstack): Likewise.
        (mwarn-framesize=): Likewise.
        (mwarn-dynamicstack): Allow mno-warn-dynamicstack.
        (mwarn-framesize=): Convert to UInteger (negative values are rejected
        now).
        * config/s390/s390-c.c (s390_cpu_cpp_builtins_internal): Split setting
        macros changeable through the GCC target pragma into a separate
        function.
        (s390_cpu_cpp_builtins): Likewise.
        (s390_pragma_target_parse): New function, implement GCC target pragma
        if enabled.
        (s390_register_target_pragmas): Register s390_pragma_target_parse if
        available.
        * common/config/s390/s390-common.c (s390_handle_option):
        Export.
        Move setting s390_arch_flags to s390.c.
        Remove s390_tune_flags.
        Allow 0 as argument to -mstack-size (switch to default value).
        Allow 0 as argument to -mstack-guard (switch off).
        Remove now unnecessary explicit parsing code for -mwarn-framesize.
        * config/s390/s390-protos.h (s390_handle_option): Export.
        (s390_valid_target_attribute_tree): Export.
        (s390_reset_previous_fndecl): Export.
        * config/s390/s390-builtins.def: Use new macro B_GROUP to mark the start
        and end of HTM and VX builtins.
        * config/s390/s390-builtins.h (B_GROUP): Use macro.
        * config/s390/s390-opts.h: Add comment about processor_type usage.
        * config/s390/s390.h (TARGET_CPU_IEEE_FLOAT_P): New macro.
        (TARGET_CPU_ZARCH_P): Likewise.
        (TARGET_CPU_LONG_DISPLACEMENT_P): Likewise
        (TARGET_CPU_EXTIMM_P): Likewise
        (TARGET_CPU_DFP_P): Likewise
        (TARGET_CPU_Z10_P): Likewise
        (TARGET_CPU_Z196_P): Likewise
        (TARGET_CPU_ZEC12_P): Likewise
        (TARGET_CPU_HTM_P): Likewise
        (TARGET_CPU_Z13_P): Likewise
        (TARGET_CPU_VX_P): Likewise
        (TARGET_HARD_FLOAT_P): Likewise
        (TARGET_LONG_DISPLACEMENT_P): Likewise
        (TARGET_EXTIMM_P): Likewise
        (TARGET_DFP_P): Likewise
        (TARGET_Z10_P): Likewise
        (TARGET_Z196_P): Likewise
        (TARGET_ZEC12_P): Likewise
        (TARGET_HTM_P): Likewise
        (TARGET_Z13_P): Likewise
        (TARGET_VX_P): Likewise
        (TARGET_CPU_EXTIMM): Fix indentation
        (TARGET_CPU_DFP): Likewise.
        (TARGET_CPU_Z10): Likewise.
        (TARGET_CPU_Z196): Likewise.
        (TARGET_CPU_ZEC12): Likewise.
        (TARGET_CPU_HTM): Likewise.
        (TARGET_CPU_Z13):  Likewise.
        (TARGET_LONG_DISPLACEMENT): Likewise.
        (TARGET_EXTIMM): Likewise.
        (TARGET_DFP): Likewise.
        (TARGET_Z10): Likewise.
        (TARGET_Z196): Likewise.
        (TARGET_ZEC12): Likewise.
        (TARGET_Z13): Likewise.
        (TARGET_VX): Likewise.
        (S390_USE_TARGET_ATTRIBUTE): Helper macro.
        (S390_USE_ARCHITECTURE_MODIFIERS): Likewise.
        (SWITCHABLE_TARGET): Define to enable target attribute.
        * config/s390/vecintrin.h: Use vector definitions even if __VEC__ is
        undefined.
        (vec_all_nan): Rewrite as macro using statement expressions to avoid
        that the vector keyword needs to be defined when including the file.
        (vec_all_numeric): Likewise.
        (vec_any_nan): Likewise.
        (vec_any_numeric):  Likewise.
        * config/s390/s390.c (s390_previous_fndecl): New static variable.
        (s390_set_current_function): New function.
        (s390_cost): Wrapper macro to allow defining the cost table pointer in
        the options file.
        (processor_table): Table for march= and mtune= parsing.
        (s390_init_builtins): Enable all builtins and types unconditionally.
        (s390_expand_builtin): Generate an error message if builtin is not
        supported by current options.
        Correct an error message.
        (s390_function_specific_restore): New function to set s390_cost.
        (s390_asm_output_machine_for_arch): New function for emitting .machine
        and .machinmode directives to the assembler file.
        (s390_asm_output_start_function_header): Likewise.
        (s390_asm_output_end_function_footer): Likewise
        (s390_asm_output_function_label): Add mdebug output for feature testing.
        (s390_option_override): Move implementation into internal function.
        (s390_option_override_internal): Likewise.
        Implement option overriding based on current options.
        (s390_valid_target_attribute_inner_p): New function implementing target
        attribute logic.
        (s390_valid_target_attribute_tree): Likewise.
        (s390_valid_target_attribute_p): Likewise.
        (s390_reset_previous_fndecl): Likewise.
        (s390_set_current_function): Likewise.
        (TARGET_SET_CURRENT_FUNCTION): Provide target hook function.
        (TARGET_ASM_FUNCTION_START): Likewise.
        (TARGET_ASM_FUNCTION_END): Likewise.
        (TARGET_OPTION_VALID_ATTRIBUTE_P): Likewise.
        (TARGET_OPTION_RESTORE): Likewise.
        * doc/extend.texi: S390: Document target attribute and pragma.
        * config.in: Regenerated.
        * configure: Regenerated.
        * configure.ac: S390: Check for .machinemode and .machine in gas.
        S390: Check for architecture modifiers support in gas.

gcc/testsuite/ChangeLog

        * gcc.target/s390/asm-machine-1.c: New test.
        * gcc.target/s390/asm-machine-2.c: New test.
        * gcc.target/s390/asm-machine-3.c: New test.
        * gcc.target/s390/asm-machine-4.c: New test.
        * gcc.target/s390/target-attribute/target-attribute-1.c: New test.
        * gcc.target/s390/target-attribute/target-attribute-2.c: New test.
        * gcc.target/s390/target-attribute/target-attribute-3.c: New test.
        * gcc.target/s390/target-attribute/target-attribute-4.c: New test.
        * gcc.target/s390/target-attribute/target-attribute-5.c: New test.
        * gcc.target/s390/target-attribute/target-attribute-6.c: New test.
        * gcc.target/s390/target-attribute/target-attribute-7.c: New test.
        * gcc.target/s390/target-attribute/target-attribute-8.c: New test.
        * gcc.target/s390/target-attribute/target-attribute-9.c: New test.
        * gcc.target/s390/target-attribute/target-attribute-10.c: New test.
        * gcc.target/s390/target-attribute/target-attribute-11.c: New test.
        * gcc.target/s390/target-attribute/target-attribute-12.c: New test.
        * gcc.target/s390/target-attribute/target-attribute-13.c: New test.
        * gcc.target/s390/target-attribute/target-attribute-14.c: New test.
        * gcc.target/s390/target-attribute/target-attribute-15.c: New test.
        * gcc.target/s390/target-attribute/target-attribute-16.c: New test.
        * gcc.target/s390/target-attribute/target-attribute-17.c: New test.
        * gcc.target/s390/target-attribute/target-attribute-18.c: New test.
        * gcc.target/s390/target-attribute/target-attribute-19.c: New test.
        * gcc.target/s390/target-attribute/target-attribute-arch-tune-1.c: New
        test.
        * gcc.target/s390/target-attribute/target-attribute-arch-tune-2.c: New
        test.
        * gcc.target/s390/target-attribute/target-attribute-m31-1.c: New test.
        * gcc.target/s390/target-attribute/target-attribute-m31-2.c: New test.
        * gcc.target/s390/target-attribute/target-attribute-m31-3.c: New test.
        * gcc.target/s390/target-attribute/target-attribute-m31-4.c: New test.
        * gcc.target/s390/target-attribute/target-attribute-m31-5.c: New test.
        * gcc.target/s390/target-attribute/target-attribute-m31-6.c: New test.
        * gcc.target/s390/target-attribute/target-attribute-m31-7.c: New test.
        * gcc.target/s390/target-attribute/target-attribute-m31-8.c: New test.
        * gcc.target/s390/target-attribute/target-attribute-m31-9.c: New test.
        * gcc.target/s390/target-attribute/target-attribute-m31-10.c: New test.
        * gcc.target/s390/target-attribute/target-attribute-m31-11.c: New test.
        * gcc.target/s390/target-attribute/target-attribute-m31-12.c: New test.
        * gcc.target/s390/target-attribute/target-attribute-m31-13.c: New test.
        * gcc.target/s390/target-attribute/target-attribute-m31-14.c: New test.
        * gcc.target/s390/target-attribute/target-attribute-m31-15.c: New test.
        * gcc.target/s390/target-attribute/target-attribute-m31-16.c: New test.
        * gcc.target/s390/target-attribute/target-attribute-m31-17.c: New test.
        * gcc.target/s390/target-attribute/target-attribute-m31-18.c: New test.
        * gcc.target/s390/target-attribute/target-attribute-m31-19.c: New test.
        * gcc.target/s390/target-attribute/target-attribute-m31-20.c: New test.
        * gcc.target/s390/target-attribute/target-attribute-m31-21.c: New test.
        * gcc.target/s390/target-attribute/target-attribute-m31-22.c: New test.
        * gcc.target/s390/target-attribute/target-attribute-m31-23.c: New test.
        * gcc.target/s390/target-attribute/target-attribute-m31-24.c: New test.
        * gcc.target/s390/target-attribute/target-attribute-m31-25.c: New test.
        * gcc.target/s390/target-attribute/target-attribute-m31-26.c: New test.
        * gcc.target/s390/target-attribute/target-attribute-m31-27.c: New test.
        * gcc.target/s390/target-attribute/target-attribute-m31-28.c: New test.
        * gcc.target/s390/target-attribute/target-attribute-m31-29.c: New test.
        * gcc.target/s390/target-attribute/target-attribute-m31-30.c: New test.
        * gcc.target/s390/target-attribute/target-attribute-m31-31.c: New test.
        * gcc.target/s390/target-attribute/target-attribute-m31-32.c: New test.
        * gcc.target/s390/target-attribute/target-attribute-m64-1.c: New test.
        * gcc.target/s390/target-attribute/target-attribute-m64-2.c: New test.
        * gcc.target/s390/target-attribute/target-attribute-m64-3.c: New test.
        * gcc.target/s390/target-attribute/target-attribute-m64-4.c: New test.
        * gcc.target/s390/target-attribute/target-attribute-m64-5.c: New test.
        * gcc.target/s390/target-attribute/target-attribute-m64-6.c: New test.
        * gcc.target/s390/target-attribute/target-attribute-m64-7.c: New test.
        * gcc.target/s390/target-attribute/target-attribute-m64-8.c: New test.
        * gcc.target/s390/target-attribute/target-attribute-m64-9.c: New test.
        * gcc.target/s390/target-attribute/target-attribute-m64-10.c: New test.
        * gcc.target/s390/target-attribute/target-attribute-m64-11.c: New test.
        * gcc.target/s390/target-attribute/target-attribute-m64-12.c: New test.
        * gcc.target/s390/target-attribute/target-attribute-m64-13.c: New test.
        * gcc.target/s390/target-attribute/target-attribute-m64-14.c: New test.
        * gcc.target/s390/target-attribute/target-attribute-m64-15.c: New test.
        * gcc.target/s390/target-attribute/target-attribute-m64-16.c: New test.
        * gcc.target/s390/target-attribute/target-attribute-m64-17.c: New test.
        * gcc.target/s390/target-attribute/target-attribute-m64-18.c: New test.
        * gcc.target/s390/target-attribute/target-attribute-m64-19.c: New test.
        * gcc.target/s390/target-attribute/target-attribute-m64-20.c: New test.
        * gcc.target/s390/target-attribute/target-attribute-m64-21.c: New test.
        * gcc.target/s390/target-attribute/target-attribute-m64-22.c: New test.
        * gcc.target/s390/target-attribute/target-attribute-m64-23.c: New test.
        * gcc.target/s390/target-attribute/target-attribute-m64-24.c: New test.
        * gcc.target/s390/target-attribute/target-attribute-m64-25.c: New test.
        * gcc.target/s390/target-attribute/target-attribute-m64-26.c: New test.
        * gcc.target/s390/target-attribute/target-attribute-m64-27.c: New test.
        * gcc.target/s390/target-attribute/target-attribute-m64-28.c: New test.
        * gcc.target/s390/target-attribute/target-attribute-m64-29.c: New test.
        * gcc.target/s390/target-attribute/target-attribute-m64-30.c: New test.
        * gcc.target/s390/target-attribute/target-attribute-m64-31.c: New test.
        * gcc.target/s390/target-attribute/target-attribute-m64-32.c: New test.
        * gcc.target/s390/s390.exp (check_effective_target_target_attribute):
        Add check whether target attribute is available.
        Run test in target-attribute subdir.

Attachment: 0001-S-390-Implement-attribute-target-and-pragma-GCC-targ.patch.gz
Description: Binary data

Reply via email to