public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH 2/2] s/390: Implement "target" attribute.
  2015-09-25 14:16 [PATCH] s/390: Implement "target" attribute Dominik Vogt
@ 2015-09-25 14:16 ` Dominik Vogt
  2015-12-04 14:36   ` Andreas Krebbel
  2015-09-25 15:05 ` [PATCH 1/2] " Dominik Vogt
       [not found] ` <20150925140123.GB14892@linux.vnet.ibm.com>
  2 siblings, 1 reply; 16+ messages in thread
From: Dominik Vogt @ 2015-09-25 14:16 UTC (permalink / raw)
  To: gcc-patches; +Cc: Andreas Krebbel, Ulrich Weigand

[-- Attachment #1: Type: text/plain, Size: 1620 bytes --]

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

[-- Attachment #2: 0002-ChangeLog --]
[-- Type: text/plain, Size: 523 bytes --]

gcc/ChangeLog

	* config/s390/s390.c (s390_asm_file_start): Implement hook function to
	emit .machine and .machinemode to the top of the assembler file.
	(TARGET_ASM_FILE_START): Provide target hook.
	(s390_asm_output_machine_for_arch): Protect with
	HAVE_AS_MACHINE_MACHINEMODE instead of S390_USE_TARGET_ATTRIBUTE.

gcc/testsuite/ChangeLog

	* gcc.target/s390/asm-machine-1.c: Updated.
	* gcc.target/s390/asm-machine-2.c: Updated.
	* gcc.target/s390/asm-machine-3.c: Updated.
	* gcc.target/s390/asm-machine-4.c: Updated.

[-- Attachment #3: 0002-S-390-Emit-.machine-and-.machinemode-at-start-of-ass.patch --]
[-- Type: text/x-diff, Size: 6432 bytes --]

From 43563dc64dc8574493d5361140dbff2fbd366a27 Mon Sep 17 00:00:00 2001
From: Dominik Vogt <vogt@linux.vnet.ibm.com>
Date: Fri, 28 Aug 2015 10:39:10 +0100
Subject: [PATCH 2/2] S/390: Emit .machine and .machinemode at start of
 assembler files.

---
 gcc/config/s390/s390.c                        | 16 +++++++++++++++-
 gcc/testsuite/gcc.target/s390/asm-machine-1.c |  7 +++++--
 gcc/testsuite/gcc.target/s390/asm-machine-2.c |  9 ++++++---
 gcc/testsuite/gcc.target/s390/asm-machine-3.c |  9 ++++++---
 gcc/testsuite/gcc.target/s390/asm-machine-4.c |  9 ++++++---
 5 files changed, 38 insertions(+), 12 deletions(-)

diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c
index c40f1c5..2711301 100644
--- a/gcc/config/s390/s390.c
+++ b/gcc/config/s390/s390.c
@@ -6723,7 +6723,7 @@ s390_function_num_hotpatch_hw (tree decl,
 /* Write the current .machine and .machinemode specification to the assembler
    file.  */
 
-#if S390_USE_TARGET_ATTRIBUTE
+#ifdef HAVE_AS_MACHINE_MACHINEMODE
 static void
 s390_asm_output_machine_for_arch (FILE *asm_out_file)
 {
@@ -14363,6 +14363,15 @@ s390_vector_alignment (const_tree type)
   return MIN (64, tree_to_shwi (TYPE_SIZE (type)));
 }
 
+#ifdef HAVE_AS_MACHINE_MACHINEMODE
+/* Implement TARGET_ASM_FILE_START.  */
+static void
+s390_asm_file_start (void)
+{
+  s390_asm_output_machine_for_arch (asm_out_file);
+}
+#endif
+
 /* Implement TARGET_ASM_FILE_END.  */
 static void
 s390_asm_file_end (void)
@@ -14662,6 +14671,11 @@ s390_invalid_binary_op (int op ATTRIBUTE_UNUSED, const_tree type1, const_tree ty
 #undef TARGET_INVALID_BINARY_OP
 #define TARGET_INVALID_BINARY_OP s390_invalid_binary_op
 
+#ifdef HAVE_AS_MACHINE_MACHINEMODE
+#undef TARGET_ASM_FILE_START
+#define TARGET_ASM_FILE_START s390_asm_file_start
+#endif
+
 #undef TARGET_ASM_FILE_END
 #define TARGET_ASM_FILE_END s390_asm_file_end
 
diff --git a/gcc/testsuite/gcc.target/s390/asm-machine-1.c b/gcc/testsuite/gcc.target/s390/asm-machine-1.c
index a5326e1..430d923 100644
--- a/gcc/testsuite/gcc.target/s390/asm-machine-1.c
+++ b/gcc/testsuite/gcc.target/s390/asm-machine-1.c
@@ -3,7 +3,10 @@
 /* { dg-require-effective-target target_attribute } */
 /* { dg-options "-march=z13 -mzarch" } */
 
+/* { dg-final { scan-assembler-times "\t\.machine \"z13\"" 1 } } */
+/* { dg-final { scan-assembler-times "\t\.machinemode zarch" 1 } } */
+
 void foo(void) { }
 
-/* { dg-final { scan-assembler-not "\t\.machine " } } */
-/* { dg-final { scan-assembler-not "\t\.machinemode " } } */
+/* { dg-final { scan-assembler-times "\t\.machine " 1 } } */
+/* { dg-final { scan-assembler-times "\t\.machinemode " 1 } } */
diff --git a/gcc/testsuite/gcc.target/s390/asm-machine-2.c b/gcc/testsuite/gcc.target/s390/asm-machine-2.c
index 910438e..6817e2a 100644
--- a/gcc/testsuite/gcc.target/s390/asm-machine-2.c
+++ b/gcc/testsuite/gcc.target/s390/asm-machine-2.c
@@ -3,6 +3,9 @@
 /* { dg-require-effective-target target_attribute } */
 /* { dg-options "-march=z13 -mzarch" } */
 
+/* { dg-final { scan-assembler-times "\t\.machine \"z13\"" 1 } } */
+/* { dg-final { scan-assembler-times "\t\.machinemode zarch" 2 } } */
+
 void foo(void) { }
 
 __attribute__ ((target("arch=z10")))
@@ -12,8 +15,8 @@ void bar(void) { }
 /* { dg-final { scan-assembler-times "\t\.machine pop" 1 } } */
 /* { dg-final { scan-assembler-times "\t\.machine \"z10\"" 1 } } */
 /* { dg-final { scan-assembler-times "\t\.machinemode push" 1 } } */
-/* { dg-final { scan-assembler-times "\t\.machinemode zarch" 1 } } */
+/* { dg-final { scan-assembler-times "\t\.machinemode zarch" 2 } } */
 /* { dg-final { scan-assembler-times "\t\.machinemode pop" 1 } } */
 
-/* { dg-final { scan-assembler-times "\t\.machine " 3 } } */
-/* { dg-final { scan-assembler-times "\t\.machinemode " 3 } } */
+/* { dg-final { scan-assembler-times "\t\.machine " 4 } } */
+/* { dg-final { scan-assembler-times "\t\.machinemode " 4 } } */
diff --git a/gcc/testsuite/gcc.target/s390/asm-machine-3.c b/gcc/testsuite/gcc.target/s390/asm-machine-3.c
index b056b19..3ae57a8 100644
--- a/gcc/testsuite/gcc.target/s390/asm-machine-3.c
+++ b/gcc/testsuite/gcc.target/s390/asm-machine-3.c
@@ -3,6 +3,9 @@
 /* { dg-require-effective-target target_attribute } */
 /* { dg-options "-march=z13 -mzarch" } */
 
+/* { dg-final { scan-assembler-times "\t\.machine \"z13\"" 1 } } */
+/* { dg-final { scan-assembler-times "\t\.machinemode zarch" 2 } } */
+
 void foo(void) { }
 
 #pragma GCC target("arch=z10")
@@ -12,8 +15,8 @@ void bar(void) { }
 /* { dg-final { scan-assembler-times "\t\.machine pop" 1 } } */
 /* { dg-final { scan-assembler-times "\t\.machine \"z10\"" 1 } } */
 /* { dg-final { scan-assembler-times "\t\.machinemode push" 1 } } */
-/* { dg-final { scan-assembler-times "\t\.machinemode zarch" 1 } } */
+/* { dg-final { scan-assembler-times "\t\.machinemode zarch" 2 } } */
 /* { dg-final { scan-assembler-times "\t\.machinemode pop" 1 } } */
 
-/* { dg-final { scan-assembler-times "\t\.machine " 3 } } */
-/* { dg-final { scan-assembler-times "\t\.machinemode " 3 } } */
+/* { dg-final { scan-assembler-times "\t\.machine " 4 } } */
+/* { dg-final { scan-assembler-times "\t\.machinemode " 4 } } */
diff --git a/gcc/testsuite/gcc.target/s390/asm-machine-4.c b/gcc/testsuite/gcc.target/s390/asm-machine-4.c
index af9ab1c..932bfe6 100644
--- a/gcc/testsuite/gcc.target/s390/asm-machine-4.c
+++ b/gcc/testsuite/gcc.target/s390/asm-machine-4.c
@@ -3,6 +3,9 @@
 /* { dg-require-effective-target target_attribute } */
 /* { dg-options "-march=z13 -mzarch" } */
 
+/* { dg-final { scan-assembler-times "\t\.machine \"z13\"" 1 } } */
+/* { dg-final { scan-assembler-times "\t\.machinemode zarch" 2 } } */
+
 void foo(void) { }
 
 #pragma GCC target("arch=z196")
@@ -13,8 +16,8 @@ void bar(void) { }
 /* { dg-final { scan-assembler-times "\t\.machine pop" 1 } } */
 /* { dg-final { scan-assembler-times "\t\.machine \"z10\"" 1 } } */
 /* { dg-final { scan-assembler-times "\t\.machinemode push" 1 } } */
-/* { dg-final { scan-assembler-times "\t\.machinemode zarch" 1 } } */
+/* { dg-final { scan-assembler-times "\t\.machinemode zarch" 2 } } */
 /* { dg-final { scan-assembler-times "\t\.machinemode pop" 1 } } */
 
-/* { dg-final { scan-assembler-times "\t\.machine " 3 } } */
-/* { dg-final { scan-assembler-times "\t\.machinemode " 3 } } */
+/* { dg-final { scan-assembler-times "\t\.machine " 4 } } */
+/* { dg-final { scan-assembler-times "\t\.machinemode " 4 } } */
-- 
2.3.0


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH] s/390: Implement "target" attribute.
@ 2015-09-25 14:16 Dominik Vogt
  2015-09-25 14:16 ` [PATCH 2/2] " Dominik Vogt
                   ` (2 more replies)
  0 siblings, 3 replies; 16+ messages in thread
From: Dominik Vogt @ 2015-09-25 14:16 UTC (permalink / raw)
  To: gcc-patches; +Cc: Andreas Krebbel, Ulrich Weigand

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

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH 1/2] s/390: Implement "target" attribute.
  2015-09-25 14:16 [PATCH] s/390: Implement "target" attribute Dominik Vogt
  2015-09-25 14:16 ` [PATCH 2/2] " Dominik Vogt
@ 2015-09-25 15:05 ` Dominik Vogt
       [not found] ` <20150925140123.GB14892@linux.vnet.ibm.com>
  2 siblings, 0 replies; 16+ messages in thread
From: Dominik Vogt @ 2015-09-25 15:05 UTC (permalink / raw)
  To: gcc-patches; +Cc: Andreas Krebbel, Ulrich Weigand

[-- Attachment #1: Type: text/plain, Size: 1620 bytes --]

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

[-- Attachment #2: 0001-ChangeLog --]
[-- Type: text/plain, Size: 11745 bytes --]

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 #3: 0001-S-390-Implement-attribute-target-and-pragma-GCC-targ.patch.gz --]
[-- Type: application/octet-stream, Size: 75322 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 1/2] s/390: Implement "target" attribute.
       [not found] ` <20150925140123.GB14892@linux.vnet.ibm.com>
@ 2015-10-16 12:33   ` Dominik Vogt
  2015-10-26 10:11     ` Dominik Vogt
  0 siblings, 1 reply; 16+ messages in thread
From: Dominik Vogt @ 2015-10-16 12:33 UTC (permalink / raw)
  To: gcc-patches; +Cc: Andreas Krebbel, Ulrich Weigand

[-- Attachment #1: Type: text/plain, Size: 1759 bytes --]

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

This is an updated version of patch 1 that uses existing hooks and
works without any change to common code.  (Second patch is
unchanged).

Ciao

Dominik ^_^  ^_^

-- 

Dominik Vogt
IBM Germany

[-- Attachment #2: 0001-ChangeLog --]
[-- Type: text/plain, Size: 11134 bytes --]

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.
	(s390_asm_output_function_prefix): Declare hook.
	(s390_asm_declare_function_size): Likewise.
	* 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.
	(ASM_DECLARE_FUNCTION_SIZE): Provide hook.
	(ASM_OUTPUT_FUNCTION_PREFIX): Likewise.
	* 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_function_prefix): Likewise.
	(s390_asm_declare_function_size):  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/tattr-1.c: New test.
	* gcc.target/s390/target-attribute/tattr-2.c: New test.
	* gcc.target/s390/target-attribute/tattr-3.c: New test.
	* gcc.target/s390/target-attribute/tattr-4.c: New test.
	* gcc.target/s390/target-attribute/tattr-5.c: New test.
	* gcc.target/s390/target-attribute/tattr-6.c: New test.
	* gcc.target/s390/target-attribute/tattr-7.c: New test.
	* gcc.target/s390/target-attribute/tattr-8.c: New test.
	* gcc.target/s390/target-attribute/tattr-9.c: New test.
	* gcc.target/s390/target-attribute/tattr-10.c: New test.
	* gcc.target/s390/target-attribute/tattr-11.c: New test.
	* gcc.target/s390/target-attribute/tattr-12.c: New test.
	* gcc.target/s390/target-attribute/tattr-13.c: New test.
	* gcc.target/s390/target-attribute/tattr-14.c: New test.
	* gcc.target/s390/target-attribute/tattr-15.c: New test.
	* gcc.target/s390/target-attribute/tattr-16.c: New test.
	* gcc.target/s390/target-attribute/tattr-17.c: New test.
	* gcc.target/s390/target-attribute/tattr-18.c: New test.
	* gcc.target/s390/target-attribute/tattr-19.c: New test.
	* gcc.target/s390/target-attribute/tattr-arch-tune-1.c: New test.
	* gcc.target/s390/target-attribute/tattr-arch-tune-2.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-1.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-2.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-3.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-4.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-5.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-6.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-7.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-8.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-9.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-10.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-11.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-12.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-13.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-14.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-15.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-16.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-17.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-18.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-19.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-20.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-21.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-22.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-23.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-24.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-25.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-26.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-27.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-28.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-29.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-30.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-31.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-32.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-1.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-2.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-3.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-4.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-5.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-6.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-7.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-8.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-9.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-10.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-11.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-12.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-13.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-14.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-15.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-16.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-17.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-18.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-19.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-20.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-21.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-22.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-23.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-24.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-25.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-26.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-27.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-28.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-29.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-30.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-31.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-32.c: New test.
	* gcc.target/s390/target-attribute/tpragma-struct-vx-2.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.
	* gcc.target/s390/s390-c++.exp
	(check_effective_target_target_attribute): Likewise.

[-- Attachment #3: 0001-S-390-Implement-attribute-target-and-pragma-GCC-targ.patch.gz --]
[-- Type: application/octet-stream, Size: 76114 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 1/2] s/390: Implement "target" attribute.
  2015-10-16 12:33   ` Dominik Vogt
@ 2015-10-26 10:11     ` Dominik Vogt
  2015-10-26 12:16       ` Dominik Vogt
  2015-10-30 14:29       ` Andreas Krebbel
  0 siblings, 2 replies; 16+ messages in thread
From: Dominik Vogt @ 2015-10-26 10:11 UTC (permalink / raw)
  To: gcc-patches; +Cc: Andreas Krebbel

[-- Attachment #1: Type: text/plain, Size: 1892 bytes --]

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

Version 3 of the patch:

 * Adapted to current HEAD.
 * Uses the B_VX and B_HTM flags in stead of the suggested B_GROUP.
 * Vector builtins depend on the VX flag instead of ZVECTOR.
 * Removed a dead error message in s390_expand_builtin.
 * Improved comment in s390.exp.

Ciao

Dominik ^_^  ^_^

-- 

Dominik Vogt
IBM Germany

[-- Attachment #2: 0001-ChangeLog --]
[-- Type: text/plain, Size: 11134 bytes --]

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.
	(s390_asm_output_function_prefix): Declare hook.
	(s390_asm_declare_function_size): Likewise.
	* 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.
	(ASM_DECLARE_FUNCTION_SIZE): Provide hook.
	(ASM_OUTPUT_FUNCTION_PREFIX): Likewise.
	* 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_function_prefix): Likewise.
	(s390_asm_declare_function_size):  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/tattr-1.c: New test.
	* gcc.target/s390/target-attribute/tattr-2.c: New test.
	* gcc.target/s390/target-attribute/tattr-3.c: New test.
	* gcc.target/s390/target-attribute/tattr-4.c: New test.
	* gcc.target/s390/target-attribute/tattr-5.c: New test.
	* gcc.target/s390/target-attribute/tattr-6.c: New test.
	* gcc.target/s390/target-attribute/tattr-7.c: New test.
	* gcc.target/s390/target-attribute/tattr-8.c: New test.
	* gcc.target/s390/target-attribute/tattr-9.c: New test.
	* gcc.target/s390/target-attribute/tattr-10.c: New test.
	* gcc.target/s390/target-attribute/tattr-11.c: New test.
	* gcc.target/s390/target-attribute/tattr-12.c: New test.
	* gcc.target/s390/target-attribute/tattr-13.c: New test.
	* gcc.target/s390/target-attribute/tattr-14.c: New test.
	* gcc.target/s390/target-attribute/tattr-15.c: New test.
	* gcc.target/s390/target-attribute/tattr-16.c: New test.
	* gcc.target/s390/target-attribute/tattr-17.c: New test.
	* gcc.target/s390/target-attribute/tattr-18.c: New test.
	* gcc.target/s390/target-attribute/tattr-19.c: New test.
	* gcc.target/s390/target-attribute/tattr-arch-tune-1.c: New test.
	* gcc.target/s390/target-attribute/tattr-arch-tune-2.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-1.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-2.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-3.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-4.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-5.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-6.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-7.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-8.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-9.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-10.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-11.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-12.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-13.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-14.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-15.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-16.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-17.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-18.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-19.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-20.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-21.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-22.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-23.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-24.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-25.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-26.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-27.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-28.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-29.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-30.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-31.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-32.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-1.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-2.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-3.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-4.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-5.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-6.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-7.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-8.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-9.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-10.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-11.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-12.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-13.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-14.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-15.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-16.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-17.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-18.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-19.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-20.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-21.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-22.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-23.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-24.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-25.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-26.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-27.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-28.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-29.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-30.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-31.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-32.c: New test.
	* gcc.target/s390/target-attribute/tpragma-struct-vx-2.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.
	* gcc.target/s390/s390-c++.exp
	(check_effective_target_target_attribute): Likewise.

[-- Attachment #3: 0001-S-390-Implement-attribute-target-and-pragma-GCC-targ.patch.gz --]
[-- Type: application/octet-stream, Size: 75341 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 1/2] s/390: Implement "target" attribute.
  2015-10-26 10:11     ` Dominik Vogt
@ 2015-10-26 12:16       ` Dominik Vogt
  2015-10-30 14:29       ` Andreas Krebbel
  1 sibling, 0 replies; 16+ messages in thread
From: Dominik Vogt @ 2015-10-26 12:16 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 1701 bytes --]

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

Version 4 of the patch:

 * Adapted to current HEAD again.
 * ChangeLog cleanup

Ciao

Dominik ^_^  ^_^

-- 

Dominik Vogt
IBM Germany

[-- Attachment #2: 0001-ChangeLog --]
[-- Type: text/plain, Size: 10276 bytes --]

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, march=, mbackchain, mdebug, mesa, mhard-dfp),
	(mhard-float, mlong-double-128, mlong-double-64, mhtm, mvx),
	(mpacked-stack, msmall-exec, msoft-float, mstack-guard=, mstack-size=),
	(mtune=, mmvcle, mzvector, mzarch, mbranch-cost=, mwarn-dynamicstack),
	(mwarn-framesize=): Save option.
	(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.
	(s390_asm_output_function_prefix): Declare hook.
	(s390_asm_declare_function_size): Likewise.
	* 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, TARGET_CPU_ZARCH_P),
	(TARGET_CPU_LONG_DISPLACEMENT_P, TARGET_CPU_EXTIMM_P, TARGET_CPU_DFP_P),
	(TARGET_CPU_Z10_P, TARGET_CPU_Z196_P, TARGET_CPU_ZEC12_P),
	(TARGET_CPU_HTM_P, TARGET_CPU_Z13_P, TARGET_CPU_VX_P),
	(TARGET_HARD_FLOAT_P, TARGET_LONG_DISPLACEMENT_P, TARGET_EXTIMM_P),
	(TARGET_DFP_P, TARGET_Z10_P, TARGET_Z196_P, TARGET_ZEC12_P),
	(TARGET_HTM_P, TARGET_Z13_P, TARGET_VX_P, TARGET_CPU_EXTIMM),
	(TARGET_CPU_DFP, TARGET_CPU_Z10, TARGET_CPU_Z196, TARGET_CPU_ZEC12),
	(TARGET_CPU_HTM, TARGET_CPU_Z13, TARGET_LONG_DISPLACEMENT),
	(TARGET_EXTIMM, TARGET_DFP, TARGET_Z10, TARGET_Z196, TARGET_ZEC12),
	(TARGET_Z13, TARGET_VX, S390_USE_TARGET_ATTRIBUTE),
	(S390_USE_ARCHITECTURE_MODIFIERS, SWITCHABLE_TARGET),
	(ASM_DECLARE_FUNCTION_SIZE, ASM_OUTPUT_FUNCTION_PREFIX): Likewise.
	* 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_function_prefix): Likewise.
	(s390_asm_declare_function_size):  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_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/tattr-1.c: New test.
	* gcc.target/s390/target-attribute/tattr-2.c: New test.
	* gcc.target/s390/target-attribute/tattr-3.c: New test.
	* gcc.target/s390/target-attribute/tattr-4.c: New test.
	* gcc.target/s390/target-attribute/tattr-5.c: New test.
	* gcc.target/s390/target-attribute/tattr-6.c: New test.
	* gcc.target/s390/target-attribute/tattr-7.c: New test.
	* gcc.target/s390/target-attribute/tattr-8.c: New test.
	* gcc.target/s390/target-attribute/tattr-9.c: New test.
	* gcc.target/s390/target-attribute/tattr-10.c: New test.
	* gcc.target/s390/target-attribute/tattr-11.c: New test.
	* gcc.target/s390/target-attribute/tattr-12.c: New test.
	* gcc.target/s390/target-attribute/tattr-13.c: New test.
	* gcc.target/s390/target-attribute/tattr-14.c: New test.
	* gcc.target/s390/target-attribute/tattr-15.c: New test.
	* gcc.target/s390/target-attribute/tattr-16.c: New test.
	* gcc.target/s390/target-attribute/tattr-17.c: New test.
	* gcc.target/s390/target-attribute/tattr-18.c: New test.
	* gcc.target/s390/target-attribute/tattr-19.c: New test.
	* gcc.target/s390/target-attribute/tattr-arch-tune-1.c: New test.
	* gcc.target/s390/target-attribute/tattr-arch-tune-2.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-1.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-2.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-3.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-4.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-5.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-6.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-7.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-8.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-9.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-10.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-11.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-12.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-13.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-14.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-15.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-16.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-17.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-18.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-19.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-20.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-21.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-22.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-23.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-24.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-25.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-26.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-27.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-28.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-29.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-30.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-31.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-32.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-1.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-2.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-3.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-4.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-5.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-6.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-7.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-8.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-9.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-10.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-11.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-12.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-13.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-14.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-15.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-16.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-17.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-18.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-19.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-20.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-21.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-22.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-23.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-24.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-25.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-26.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-27.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-28.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-29.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-30.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-31.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-32.c: New test.
	* gcc.target/s390/target-attribute/tpragma-struct-vx-2.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.
	* gcc.target/s390/s390-c++.exp
	(check_effective_target_target_attribute): Likewise.

[-- Attachment #3: 0001-S-390-Implement-attribute-target-and-pragma-GCC-targ.patch.gz --]
[-- Type: application/octet-stream, Size: 75355 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 1/2] s/390: Implement "target" attribute.
  2015-10-26 10:11     ` Dominik Vogt
  2015-10-26 12:16       ` Dominik Vogt
@ 2015-10-30 14:29       ` Andreas Krebbel
  2015-10-31 18:01         ` Dominik Vogt
                           ` (2 more replies)
  1 sibling, 3 replies; 16+ messages in thread
From: Andreas Krebbel @ 2015-10-30 14:29 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 16860 bytes --]

Hi Dominik,

on-top of the discussions we had off-list I only have a few additional
comments/questions.

Apart from that the patch looks good to me. Thanks!

Bye,

-Andreas-

> diff --git a/gcc/common/config/s390/s390-common.c b/gcc/common/config/s390/s390-common.c
> index 43459c8..4cf0df7 100644
> --- a/gcc/common/config/s390/s390-common.c
> +++ b/gcc/common/config/s390/s390-common.c
> @@ -79,41 +79,27 @@ s390_option_init_struct (struct gcc_options *opts)
>
>  /* Implement TARGET_HANDLE_OPTION.  */
>
> -static bool
> -s390_handle_option (struct gcc_options *opts,
> +bool
> +s390_handle_option (struct gcc_options *opts ATTRIBUTE_UNUSED,
>  		    struct gcc_options *opts_set ATTRIBUTE_UNUSED,
>    		    const struct cl_decoded_option *decoded,
>  		    location_t loc)
>  {
>    size_t code = decoded->opt_index;
> -  const char *arg = decoded->arg;
>    int value = decoded->value;
>
>    switch (code)
>      {
> -    case OPT_march_:
> -      opts->x_s390_arch_flags = processor_flags_table[value];
> -      opts->x_s390_arch_string = arg;
> -      return true;
> -
>      case OPT_mstack_guard_:
> -      if (exact_log2 (value) == -1)
> +      if (value != 0 && exact_log2 (value) == -1)
>  	error_at (loc, "stack guard value must be an exact power of 2");
>        return true;
>
>      case OPT_mstack_size_:
> -      if (exact_log2 (value) == -1)
> +      if (value != 0 && exact_log2 (value) == -1)
>  	error_at (loc, "stack size must be an exact power of 2");
>        return true;

This probably is supposed to allow disabling of stack_guard and
stack-size options with 0 settings. Would removing the
`RejectNegative' in s390.opt be an option? I'm not sure but perhaps we
discussed this off-list already.

...
> +/* Helper function that defines or undefines macros.  If SET is true, the macro
> +   MACRO_DEF is defined.  If SET is false, the macro MACRO_UNDEF is undefined.
> +   Nothing is done if SET and WAS_SET have the same value.  */
> +static void
> +s390_def_or_undef_macro (cpp_reader *pfile, bool set, bool was_set,
> +			 const char *macro_def, const char *macro_undef)
>  {
> -  cpp_assert (pfile, "cpu=s390");
> -  cpp_assert (pfile, "machine=s390");
> -  cpp_define (pfile, "__s390__");
> -  if (TARGET_ZARCH)
> -    cpp_define (pfile, "__zarch__");
> -  if (TARGET_64BIT)
> -    cpp_define (pfile, "__s390x__");
> -  if (TARGET_LONG_DOUBLE_128)
> -    cpp_define (pfile, "__LONG_DOUBLE_128__");
> -  if (TARGET_HTM)
> -    cpp_define (pfile, "__HTM__");
> -  if (TARGET_ZVECTOR)
> +  if (set == was_set)
> +    return;
> +  if (set)
> +    cpp_define (pfile, macro_def);
> +  else
> +    cpp_undef (pfile, macro_undef);
> +}
> +
> +/* Internal function to either define or undef the appropriate system
> +   macros.  */
> +static void
> +s390_cpu_cpp_builtins_internal (cpp_reader *pfile,
> +				struct cl_target_option *opts,
> +				struct cl_target_option *old_opts)
> +{
> +  bool old;
> +  bool set;
> +
> +  old = (!old_opts) ? false : TARGET_HTM_P (old_opts);
> +  set = TARGET_HTM_P (opts);
> +  s390_def_or_undef_macro (pfile, set, old, "__HTM__", "__HTM__");
> +
> +  old = (!old_opts) ? false : TARGET_ZVECTOR_P (old_opts->x_target_flags);
> +  set = TARGET_ZVECTOR_P (opts->x_target_flags);
> +  s390_def_or_undef_macro (pfile, set, old, "__VEC__=10301", "__VEC__");
> +  s390_def_or_undef_macro (pfile, set, old,
> +			   "__vector=__attribute__((vector_size(16)))",
> +			   "__vector__");
> +  s390_def_or_undef_macro (pfile, set, old,
> +			   "__bool=__attribute__((s390_vector_bool)) unsigned",
> +			   "__bool");
> +  if (!flag_iso)
>      {
> -      cpp_define (pfile, "__VEC__=10301");
> -      cpp_define (pfile, "__vector=__attribute__((vector_size(16)))");
> -      cpp_define (pfile, "__bool=__attribute__((s390_vector_bool)) unsigned");
> +      s390_def_or_undef_macro (pfile, set, old, "__VECTOR_KEYWORD_SUPPORTED__",
> +			       "__VECTOR_KEYWORD_SUPPORTED__");
> +      s390_def_or_undef_macro (pfile, set, old, "vector=vector", "vector");
> +      s390_def_or_undef_macro (pfile, set, old, "bool=bool", "bool");
>
> -      if (!flag_iso)
> +      if (set && __vector_keyword == NULL)
>  	{
> -	  cpp_define (pfile, "__VECTOR_KEYWORD_SUPPORTED__");
> -	  cpp_define (pfile, "vector=vector");
> -	  cpp_define (pfile, "bool=bool");
> -
>  	  __vector_keyword = get_identifier ("__vector");
>  	  C_CPP_HASHNODE (__vector_keyword)->flags |= NODE_CONDITIONAL;
>

Slightly better:

static void
s390_def_or_undef_macro (cpp_reader *pfile,
			 int mask,
			 struct cl_target_option *newopts,
			 struct cl_target_option *oldopts,
			 const char *macro_def, const char *macro_undef)
{
  bool old;
  bool set;

  old = (!old_opts) ? false : old_opts->x_target_flags & mask;
  set = new_opts->x_target_flags & mask;

  if (set == was_set)
    return;
  if (set)
    cpp_define (pfile, macro_def);
  else
    cpp_undef (pfile, macro_undef);
}

/* Internal function to either define or undef the appropriate system
   macros.  */
static void
s390_cpu_cpp_builtins_internal (cpp_reader *pfile,
				struct cl_target_option *opts,
				struct cl_target_option *old_opts)
{
  s390_def_or_undef_macro (pfile, MASK_OPT_HTM, opts, oldopts,
			   "__HTM__", "__HTM__");
  ...


> @@ -335,6 +355,87 @@ s390_cpu_cpp_builtins (cpp_reader *pfile)
>      }
>  }
>
> +/* Define platform dependent macros.  */
> +void
> +s390_cpu_cpp_builtins (cpp_reader *pfile)
> +{
> +  struct cl_target_option opts;
> +
> +  cpp_assert (pfile, "cpu=s390");
> +  cpp_assert (pfile, "machine=s390");
> +  cpp_define (pfile, "__s390__");
> +  if (TARGET_ZARCH)
> +    cpp_define (pfile, "__zarch__");
> +  if (TARGET_64BIT)
> +    cpp_define (pfile, "__s390x__");
> +  if (TARGET_LONG_DOUBLE_128)
> +    cpp_define (pfile, "__LONG_DOUBLE_128__");
> +  cl_target_option_save (&opts, &global_options);
> +  s390_cpu_cpp_builtins_internal (pfile, &opts, NULL);
> +}
> +
> +#if S390_USE_TARGET_ATTRIBUTE
> +/* Hook to validate the current #pragma GCC target and set the state, and
> +   update the macros based on what was changed.  If ARGS is NULL, then
> +   POP_TARGET is used to reset the options.  */
> +
> +static bool
> +s390_pragma_target_parse (tree args, tree pop_target)
> +{
> +  tree prev_tree = build_target_option_node (&global_options);
> +  tree cur_tree;
> +
> +  {
> +    gcc_options options;
> +    tree def_tree;
> +
> +    memcpy (&options, &global_options, sizeof (options));
options = global_options;

> +    def_tree = (pop_target ? pop_target : target_option_default_node);
> +    cl_target_option_restore (&options, TREE_TARGET_OPTION (def_tree));
> +    if (! args)
> +      cur_tree = def_tree;
> +    else
> +      {
> +	gcc_options options_set;
> +
> +	memcpy (&options_set, &global_options_set, sizeof (options_set));
options_set = global_options_set;

> +	cur_tree = s390_valid_target_attribute_tree (args, &options,
> +						     &options_set, true);
> +	if (!cur_tree || cur_tree == error_mark_node)
> +	  return false;
Don't you need to do:
global_options_set = options_set;

> +      }
> +    memcpy (&global_options, &options, sizeof (options));
global_options = options;

All the backup and restore of the option structures is probably done
here to prevent half-way parsed options from staying in the data
structures while running into an error - right?!  Is this really a
problem, e.g. the i386 back-end does not seem to do it?

...
> @@ -761,10 +784,30 @@ s390_expand_builtin (tree exp, rtx target, rtx subtarget ATTRIBUTE_UNUSED,
>    if (TARGET_DEBUG_ARG)
>      {
>        fprintf (stderr,
> -	       "s390_expand_builtin, code = %4d, %s\n",
> -	       (int)fcode, IDENTIFIER_POINTER (DECL_NAME (fndecl)));
> +	       "s390_expand_builtin, code = %4d, %s, bflags = 0x%x\n",
> +	       (int)fcode, IDENTIFIER_POINTER (DECL_NAME (fndecl)),
> +	       bflags_for_builtin (fcode));
>      }
>
> +  if (S390_USE_TARGET_ATTRIBUTE)
> +    {
> +      unsigned int bflags;
> +
> +      bflags = bflags_for_builtin (fcode);
> +      /* Cast to int to avoid Warning "comparison is always true".  */

What cast?
> +      if ((bflags & B_HTM) &&!TARGET_HTM)
> +     {
> +       error ("Builtin %qF is not supported without -mhtm "
...
> +static void
> +s390_option_override_internal (struct gcc_options *opts,
> +			       struct gcc_options *opts_set)
> +{
>    /* Architecture mode defaults according to ABI.  */
> -  if (!(target_flags_explicit & MASK_ZARCH))
> +  if (!(opts_set->x_target_flags & MASK_ZARCH))
>      {
>        if (TARGET_64BIT)
> -	target_flags |= MASK_ZARCH;
> +	opts->x_target_flags |= MASK_ZARCH;
>        else
> -	target_flags &= ~MASK_ZARCH;
> +	opts->x_target_flags &= ~MASK_ZARCH;
>      }
>
> -  /* Set the march default in case it hasn't been specified on
> -     cmdline.  */
> -  if (s390_arch == PROCESSOR_max)
> +  /* Set the march default in case it hasn't been specified on cmdline.  */
> +  if (opts->x_s390_arch == PROCESSOR_max)
>      {
> -      s390_arch_string = TARGET_ZARCH? "z900" : "g5";
> -      s390_arch = TARGET_ZARCH ? PROCESSOR_2064_Z900 : PROCESSOR_9672_G5;
> -      s390_arch_flags = processor_flags_table[(int)s390_arch];
> +      opts->x_s390_arch = TARGET_ZARCH_P (opts->x_target_flags)
> +	? PROCESSOR_2064_Z900 : PROCESSOR_9672_G5;
> +      opts->x_s390_arch_specified = 0;
>      }
> -
> +  else
> +    OPTS->X_S390_ARCH_SPECIFIED = 1;
> +  OPTS->X_S390_ARCH_FLAGS = PROCESSOR_FLAGS_TABLE[(INT) OPTS->X_S390_ARCH];
>    /* DETERMINE PROCESSOR TO TUNE FOR.  */
> -  IF (S390_TUNE == PROCESSOR_MAX)
> +  IF (OPTS->X_S390_TUNE == PROCESSOR_MAX)
>      {
> -      S390_TUNE = S390_ARCH;
> -      S390_TUNE_FLAGS = S390_ARCH_FLAGS;
> +      OPTS->X_S390_TUNE = OPTS->X_S390_ARCH;
> +      OPTS->X_S390_TUNE_SPECIFIED = 0;
>      }
> +  ELSE
> +    OPTS->X_S390_TUNE_SPECIFIED = 1;
> +  OPTS->X_S390_TUNE_FLAGS = PROCESSOR_FLAGS_TABLE[OPTS->X_S390_TUNE];

Why do we need x_s390_arch_specified and x_s390_tune_specified?  You
should be able to use opts_set->x_s390_arch and opts_set->x_s390_tune
instead? (patch attached, your tests keep working with that change).

...
> +/* Return a TARGET_OPTION_NODE tree of the target options listed or NULL.  */
> +
> +tree
> +s390_valid_target_attribute_tree (tree args,
> +				  struct gcc_options *opts,
> +				  struct gcc_options *opts_set,
> +				  bool force_pragma)
> +{
> +  int orig_arch_specified = s390_arch_specified;
> +  int orig_tune_specified = s390_tune_specified;
> +  tree t = NULL_TREE;
> +  struct gcc_options new_opts_set;
> +
> +  memset (&new_opts_set, 0, sizeof (new_opts_set));
> +
> +  /* Process each of the options on the chain.  */
> +  if (! s390_valid_target_attribute_inner_p (args, opts, &new_opts_set,
> +					     force_pragma))
> +    return error_mark_node;
> +
> +  /* If some option was set (even if it has not changed), rerun
> +     s390_option_override_internal, and then save the options away.  */
> +  if (new_opts_set.x_target_flags
> +      || new_opts_set.x_s390_arch
> +      || new_opts_set.x_s390_tune
> +      || new_opts_set.x_s390_stack_guard
> +      || new_opts_set.x_s390_stack_size
> +      || new_opts_set.x_s390_branch_cost
> +      || new_opts_set.x_s390_warn_framesize
> +      || new_opts_set.x_s390_warn_dynamicstack_p
> +      )
> +    {
> +      /* If we are using the default tune= or arch=, undo the value assigned,
> +	 and use the default.  */
> +      if (!new_opts_set.x_s390_arch)
> +	{
> +	  if (!orig_arch_specified)
> +	    opts->x_s390_arch = PROCESSOR_max;
> +	}
> +      if (!new_opts_set.x_s390_tune && new_opts_set.x_s390_arch)
> +	{
> +	  if (opts->x_s390_arch != PROCESSOR_max)
> +	    opts->x_s390_tune = PROCESSOR_max;
> +	  else if (!orig_tune_specified)
> +	    opts->x_s390_tune = PROCESSOR_max;
> +	}
> +
> +      {
> +	struct gcc_options joined_opts_set;
> +	unsigned char *src = (unsigned char *)&new_opts_set;
> +	unsigned char *dest = (unsigned char *)&joined_opts_set;
> +	unsigned int i;
> +
> +	/* Make a joined copy of the original and the additional option flags.
> +	 */
> +	memcpy (&joined_opts_set, opts_set, sizeof (*opts_set));
joined_opts_set = opts_set;

> +	for (i = 0; i < sizeof(*opts_set); i++)
> +	  dest[i] |= src[i];
> +
> +	/* Do any overrides, such as arch=xxx, or tune=xxx support.  */
> +	s390_option_override_internal (opts, &joined_opts_set);
> +      }
> +
> +      /* Save the current options unless we are validating options for
> +	 #pragma.  */
> +      t = build_target_option_node (opts);
> +    }
> +
> +  return t;
> +}
> +
> +/* Hook to validate attribute((target("string"))).  */
> +
> +static bool
> +s390_valid_target_attribute_p (tree fndecl,
> +			       tree ARG_UNUSED (name),
> +			       tree args,
> +			       int ARG_UNUSED (flags))
> +{
> +  struct gcc_options func_options;
> +  tree new_target, new_optimize;
> +  bool ret = true;
> +
> +  /* attribute((target("default"))) does nothing, beyond
> +     affecting multi-versioning.  */
> +  if (TREE_VALUE (args)
> +      && TREE_CODE (TREE_VALUE (args)) == STRING_CST
> +      && TREE_CHAIN (args) == NULL_TREE
> +      && strcmp (TREE_STRING_POINTER (TREE_VALUE (args)), "default") == 0)
> +    return true;
> +
> +  tree old_optimize = build_optimization_node (&global_options);
> +
> +  /* Get the optimization options of the current function.  */
> +  tree func_optimize = DECL_FUNCTION_SPECIFIC_OPTIMIZATION (fndecl);
> +
> +  if (!func_optimize)
> +    func_optimize = old_optimize;
> +
> +  /* Init func_options.  */
> +  memset (&func_options, 0, sizeof (func_options));
> +  init_options_struct (&func_options, NULL);
> +  lang_hooks.init_options_struct (&func_options);
> +
> +  cl_optimization_restore (&func_options, TREE_OPTIMIZATION (func_optimize));
> +
> +  /* Initialize func_options to the default before its target options can
> +     be set.  */
> +  cl_target_option_restore (&func_options,
> +			    TREE_TARGET_OPTION (target_option_default_node));
> +
> +  new_target = s390_valid_target_attribute_tree (args, &func_options,
> +						 &global_options_set,
> +						 (args ==
> +						  current_target_pragma));
> +  new_optimize = build_optimization_node (&func_options);
> +  if (new_target == error_mark_node)
> +    ret = false;
> +  else if (fndecl && new_target)
> +    {
> +      DECL_FUNCTION_SPECIFIC_TARGET (fndecl) = new_target;
> +      if (old_optimize != new_optimize)
> +	DECL_FUNCTION_SPECIFIC_OPTIMIZATION (fndecl) = new_optimize;
> +    }
> +
> +  return ret;
> +}
> +
> +/* Set targets globals to the default (or current #pragma GCC target
> +   if active).  Invalidate s390_previous_fndecl cache.  */
> +
> +void
> +s390_reset_previous_fndecl (void)
> +{
> +  tree new_tree = target_option_current_node;
> +  cl_target_option_restore (&global_options, TREE_TARGET_OPTION (new_tree));
> +  if (TREE_TARGET_GLOBALS (new_tree))
> +    restore_target_globals (TREE_TARGET_GLOBALS (new_tree));
> +  else if (new_tree == target_option_default_node)
> +    restore_target_globals (&default_target_globals);
> +  else
> +    TREE_TARGET_GLOBALS (new_tree) = save_target_globals_default_opts ();
> +  s390_previous_fndecl = NULL_TREE;
> +}
> +
> +/* Establish appropriate back-end context for processing the function
> +   FNDECL.  The argument might be NULL to indicate processing at top
> +   level, outside of any function scope.  */
> +static void
> +s390_set_current_function (tree fndecl)
> +{
> +  /* Only change the context if the function changes.  This hook is called
> +     several times in the course of compiling a function, and we don't want to
> +     slow things down too much or call target_reinit when it isn't safe.  */
> +  if (fndecl == s390_previous_fndecl)
> +    return;
> +
> +  tree old_tree;
> +  if (s390_previous_fndecl == NULL_TREE)
> +    old_tree = target_option_current_node;
> +  else if (DECL_FUNCTION_SPECIFIC_TARGET (s390_previous_fndecl))
> +    old_tree = DECL_FUNCTION_SPECIFIC_TARGET (s390_previous_fndecl);
> +  else
> +    old_tree = target_option_default_node;
> +
> +  if (fndecl == NULL_TREE)
> +    {
> +      if (old_tree != target_option_current_node)
> +	s390_reset_previous_fndecl ();
> +      return;
> +    }
> +
> +  tree new_tree = DECL_FUNCTION_SPECIFIC_TARGET (fndecl);
> +  if (new_tree == NULL_TREE)
> +    new_tree = target_option_default_node;
> +
> +  if (old_tree != new_tree)
> +    {
> +      cl_target_option_restore (&global_options, TREE_TARGET_OPTION (new_tree));
> +      if (TREE_TARGET_GLOBALS (new_tree))
> +	restore_target_globals (TREE_TARGET_GLOBALS (new_tree));
> +      else if (new_tree == target_option_default_node)
> +	restore_target_globals (&default_target_globals);
> +      else
> +	TREE_TARGET_GLOBALS (new_tree) = save_target_globals_default_opts ();

This last part is almost s390_reset_previous_fndecl. Perhaps it could
be merged?!

> +    }
> +  s390_previous_fndecl = fndecl;
> +}
> +#endif
...


[-- Attachment #2: targetattr-changes.patch --]
[-- Type: text/x-diff, Size: 5749 bytes --]

diff --git a/gcc/config/s390/s390-c.c b/gcc/config/s390/s390-c.c
index dc05c17..0c5fe57 100644
--- a/gcc/config/s390/s390-c.c
+++ b/gcc/config/s390/s390-c.c
@@ -389,7 +389,7 @@ s390_pragma_target_parse (tree args, tree pop_target)
     gcc_options options;
     tree def_tree;
 
-    memcpy (&options, &global_options, sizeof (options));
+    options = global_options;
     def_tree = (pop_target ? pop_target : target_option_default_node);
     cl_target_option_restore (&options, TREE_TARGET_OPTION (def_tree));
     if (! args)
@@ -398,13 +398,14 @@ s390_pragma_target_parse (tree args, tree pop_target)
       {
 	gcc_options options_set;
 
-	memcpy (&options_set, &global_options_set, sizeof (options_set));
+	options_set = global_options_set;
 	cur_tree = s390_valid_target_attribute_tree (args, &options,
 						     &options_set, true);
 	if (!cur_tree || cur_tree == error_mark_node)
 	  return false;
+	global_options_set = options_set;
       }
-    memcpy (&global_options, &options, sizeof (options));
+    global_options = options;
   }
 
   target_option_current_node = cur_tree;
diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c
index 3c5a042..a94420b 100644
--- a/gcc/config/s390/s390.c
+++ b/gcc/config/s390/s390.c
@@ -13532,23 +13532,15 @@ s390_option_override_internal (struct gcc_options *opts,
     }
 
   /* Set the march default in case it hasn't been specified on cmdline.  */
-  if (opts->x_s390_arch == PROCESSOR_max)
-    {
-      opts->x_s390_arch = TARGET_ZARCH_P (opts->x_target_flags)
-	? PROCESSOR_2064_Z900 : PROCESSOR_9672_G5;
-      opts->x_s390_arch_specified = 0;
-    }
-  else
-    opts->x_s390_arch_specified = 1;
+  if (!opts_set->x_s390_arch)
+    opts->x_s390_arch = TARGET_ZARCH_P (opts->x_target_flags)
+      ? PROCESSOR_2064_Z900 : PROCESSOR_9672_G5;
+
   opts->x_s390_arch_flags = processor_flags_table[(int) opts->x_s390_arch];
   /* Determine processor to tune for.  */
-  if (opts->x_s390_tune == PROCESSOR_max)
-    {
-      opts->x_s390_tune = opts->x_s390_arch;
-      opts->x_s390_tune_specified = 0;
-    }
-  else
-    opts->x_s390_tune_specified = 1;
+  if (!opts_set->x_s390_tune)
+    opts->x_s390_tune = opts->x_s390_arch;
+
   opts->x_s390_tune_flags = processor_flags_table[opts->x_s390_tune];
 
   /* Sanity checks.  */
@@ -14033,8 +14025,6 @@ s390_valid_target_attribute_tree (tree args,
 				  struct gcc_options *opts_set,
 				  bool force_pragma)
 {
-  int orig_arch_specified = s390_arch_specified;
-  int orig_tune_specified = s390_tune_specified;
   tree t = NULL_TREE;
   struct gcc_options new_opts_set;
 
@@ -14054,45 +14044,29 @@ s390_valid_target_attribute_tree (tree args,
       || new_opts_set.x_s390_stack_size
       || new_opts_set.x_s390_branch_cost
       || new_opts_set.x_s390_warn_framesize
-      || new_opts_set.x_s390_warn_dynamicstack_p
-      )
+      || new_opts_set.x_s390_warn_dynamicstack_p)
     {
-      /* If we are using the default tune= or arch=, undo the value assigned,
-	 and use the default.  */
-      if (!new_opts_set.x_s390_arch)
-	{
-	  if (!orig_arch_specified)
-	    opts->x_s390_arch = PROCESSOR_max;
-	}
-      if (!new_opts_set.x_s390_tune && new_opts_set.x_s390_arch)
-	{
-	  if (opts->x_s390_arch != PROCESSOR_max)
-	    opts->x_s390_tune = PROCESSOR_max;
-	  else if (!orig_tune_specified)
-	    opts->x_s390_tune = PROCESSOR_max;
-	}
+      struct gcc_options joined_opts_set;
+      unsigned char *src = (unsigned char *)&new_opts_set;
+      unsigned char *dest = (unsigned char *)&joined_opts_set;
+      unsigned int i;
 
-      {
-	struct gcc_options joined_opts_set;
-	unsigned char *src = (unsigned char *)&new_opts_set;
-	unsigned char *dest = (unsigned char *)&joined_opts_set;
-	unsigned int i;
-
-	/* Make a joined copy of the original and the additional option flags.
-	 */
-	memcpy (&joined_opts_set, opts_set, sizeof (*opts_set));
-	for (i = 0; i < sizeof(*opts_set); i++)
-	  dest[i] |= src[i];
-
-	/* Do any overrides, such as arch=xxx, or tune=xxx support.  */
-	s390_option_override_internal (opts, &joined_opts_set);
-      }
+      /* A single -march overwrites a former -mtune.  */
+      if (new_opts_set.x_s390_arch && !new_opts_set.x_s390_tune)
+	opts_set->x_s390_tune = (enum processor_type)0;
 
+      /* Make a joined copy of the original and the additional option
+	 flags.  */
+      joined_opts_set = *opts_set;
+      for (i = 0; i < sizeof(*opts_set); i++)
+	dest[i] |= src[i];
+
+      /* Do any overrides, such as arch=xxx, or tune=xxx support.  */
+      s390_option_override_internal (opts, &joined_opts_set);
       /* Save the current options unless we are validating options for
 	 #pragma.  */
       t = build_target_option_node (opts);
     }
-
   return t;
 }
 
diff --git a/gcc/config/s390/s390.opt b/gcc/config/s390/s390.opt
index 4bddda5..409ec72 100644
--- a/gcc/config/s390/s390.opt
+++ b/gcc/config/s390/s390.opt
@@ -23,18 +23,10 @@ config/s390/s390-opts.h
 
 ;; Definitions to add to the cl_target_option and gcc_options structures
 
-;; whether -march was specified
-TargetVariable
-unsigned char s390_arch_specified
-
 ;; Flags derived from s390_arch
 TargetVariable
 int s390_arch_flags
 
-;; whether -mtune was specified
-TargetVariable
-unsigned char s390_tune_specified
-
 ;; Flags derived from s390_tune
 TargetVariable
 int s390_tune_flags
@@ -158,7 +150,7 @@ Target RejectNegative Joined UInteger Var(s390_stack_size) Save
 Emit extra code in the function prologue in order to trap if the stack size exceeds the given limit.
 
 mtune=
-Target RejectNegative Joined Enum(processor_type) Var(s390_tune) Init(PROCESSOR_max) Save.
+Target RejectNegative Joined Enum(processor_type) Var(s390_tune) Init(PROCESSOR_max) Save
 Schedule code for given CPU
 
 mmvcle

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 1/2] s/390: Implement "target" attribute.
  2015-10-30 14:29       ` Andreas Krebbel
@ 2015-10-31 18:01         ` Dominik Vogt
  2015-11-09  7:10           ` Andreas Krebbel
  2015-12-04 14:14           ` Dominik Vogt
  2015-11-02  8:44         ` Dominik Vogt
  2015-11-02 10:47         ` Dominik Vogt
  2 siblings, 2 replies; 16+ messages in thread
From: Dominik Vogt @ 2015-10-31 18:01 UTC (permalink / raw)
  To: gcc-patches; +Cc: Andreas Krebbel

To improve readability, I'll split my answers (see below) into
several separate messages.

> > index 43459c8..4cf0df7 100644
> > --- a/gcc/common/config/s390/s390-common.c
> > +++ b/gcc/common/config/s390/s390-common.c
> > @@ -79,41 +79,27 @@ s390_option_init_struct (struct gcc_options *opts)
> >
> >  /* Implement TARGET_HANDLE_OPTION.  */
> >
> > -static bool
> > -s390_handle_option (struct gcc_options *opts,
> > +bool
> > +s390_handle_option (struct gcc_options *opts ATTRIBUTE_UNUSED,
> >  		    struct gcc_options *opts_set ATTRIBUTE_UNUSED,
> >    		    const struct cl_decoded_option *decoded,
> >  		    location_t loc)
> >  {
> >    size_t code = decoded->opt_index;
> > -  const char *arg = decoded->arg;
> >    int value = decoded->value;
> >
> >    switch (code)
> >      {
> > -    case OPT_march_:
> > -      opts->x_s390_arch_flags = processor_flags_table[value];
> > -      opts->x_s390_arch_string = arg;
> > -      return true;
> > -
> >      case OPT_mstack_guard_:
> > -      if (exact_log2 (value) == -1)
> > +      if (value != 0 && exact_log2 (value) == -1)
> >  	error_at (loc, "stack guard value must be an exact power of 2");
> >        return true;
> >
> >      case OPT_mstack_size_:
> > -      if (exact_log2 (value) == -1)
> > +      if (value != 0 && exact_log2 (value) == -1)
> >  	error_at (loc, "stack size must be an exact power of 2");
> >        return true;
> 
> This probably is supposed to allow disabling of stack_guard and
> stack-size options with 0 settings. Would removing the
> `RejectNegative' in s390.opt be an option?

The value 0 is meant to restore the default behaviour, i.e. switch
off -mstack-guard= or resotre the default stack size for
-mstack-size=.

If we remove the RejectNegative from the options, they still
require to be used as "-mno-stack-...=<number>".  The number is
ignored of course, and we'd have to add two more cases to the
function.  In other words, more code for less usability.

As an alternative, I can add something like this:

  mno-stack-guard 
  Target RejectNegative Alias(mstack-guard=,0) Negative(mstack-guard=) 

This installs -mno-stack-guard as an alias for -mstack-guard=0 and
provides the interface the user probably expects.  The patch above
is still necessary though.

--

But what the heck is this "exact power of 2" limitation good for
in the first place?  Why is a stack size of 1, 2 or
36028797018963968 valid, but not 800?  Shouldn't the stack size
(and the size of the stack guard) just be multiples of the stack
slot size?

> > +    memcpy (&options, &global_options, sizeof (options));
> options = global_options;

Oops.

> > +      /* Cast to int to avoid Warning "comparison is always true".  */
> What cast?

Sorry, just forgot to remove the comment when changing the code
last time.

> -      || new_opts_set.x_s390_warn_dynamicstack_p
> -      )
> +      || new_opts_set.x_s390_warn_dynamicstack_p)

Ok.

> -
>    return t;

Ok.

>  mtune=
> -Target RejectNegative Joined Enum(processor_type) Var(s390_tune) Init(PROCESSOR_max) Save.
> +Target RejectNegative Joined Enum(processor_type) Var(s390_tune) Init(PROCESSOR_max) Save
>  Schedule code for given CPU

The full stop should be at the end of the help text, of course.

Ciao

Dominik ^_^  ^_^

-- 

Dominik Vogt
IBM Germany

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 1/2] s/390: Implement "target" attribute.
  2015-10-30 14:29       ` Andreas Krebbel
  2015-10-31 18:01         ` Dominik Vogt
@ 2015-11-02  8:44         ` Dominik Vogt
  2015-11-09 13:09           ` Andreas Krebbel
  2015-11-02 10:47         ` Dominik Vogt
  2 siblings, 1 reply; 16+ messages in thread
From: Dominik Vogt @ 2015-11-02  8:44 UTC (permalink / raw)
  To: gcc-patches; +Cc: Andreas Krebbel, Ulrich Weigand

(@Uli: I'd like to hear your opinion on this issue.
Original message:
https://gcc.gnu.org/ml/gcc-patches/2015-10/msg03403.html).

On Fri, Oct 30, 2015 at 03:09:39PM +0100, Andreas Krebbel wrote:
> Why do we need x_s390_arch_specified and x_s390_tune_specified?  You
> should be able to use opts_set->x_s390_arch and opts_set->x_s390_tune
> instead? (patch attached, your tests keep working with that change).

The idea was that -mtune on the command line is *not* overridden
by the "arch" target attribute.  This would allow to change the
architecture for a specific function and keep the -mtune= option
from the command line.  But as a matter of fact, the current patch
doesn't do it either (bug?).

Example:

  -- foo.c --
  __attribute__ ((target("arch=z1EC12")))
  void foo(void) { ... }
  -- foo.c --

  $ gcc -c -mtune=z13 foo.c -o foo-z13.c   # ==> tuned for zEC12
  $ gcc -c -mtune=z10 foo.c -o foo-z10.c   # ==> tuned for zEC12

If this requirement is dropped, it should be possible to get rid
of the s390_..._specified thing as it is not used for anything
else (it probably was in earlier patches).

(Your patch:) 
> +      /* A single -march overwrites a former -mtune.  */
> +      if (new_opts_set.x_s390_arch && !new_opts_set.x_s390_tune)
> +	opts_set->x_s390_tune = (enum processor_type)0;

We cannot just overwrite the old *opts structure.  There may not
be a backup of it ...

> +      /* Make a joined copy of the original and the additional option
> +	 flags.  */
> +      joined_opts_set = *opts_set;
> +      for (i = 0; i < sizeof(*opts_set); i++)
> +	dest[i] |= src[i];

... rather reset the bit in the joined structure.

      if (new_opts_set.x_s390_arch && !new_opts_set.x_s390_tune)
	joined_opts_set->x_s390_tune = new_opts_set->x_s390_tune;

(The opts_set parameter should really be const; I'll check if this
can be done.)

Ciao

Dominik ^_^  ^_^

-- 

Dominik Vogt
IBM Germany

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 1/2] s/390: Implement "target" attribute.
  2015-10-30 14:29       ` Andreas Krebbel
  2015-10-31 18:01         ` Dominik Vogt
  2015-11-02  8:44         ` Dominik Vogt
@ 2015-11-02 10:47         ` Dominik Vogt
  2 siblings, 0 replies; 16+ messages in thread
From: Dominik Vogt @ 2015-11-02 10:47 UTC (permalink / raw)
  To: gcc-patches; +Cc: Andreas Krebbel

> > +/* Define platform dependent macros.  */
> > +void
> > +s390_cpu_cpp_builtins (cpp_reader *pfile)
> > +{
> > +  struct cl_target_option opts;
> > +
> > +  cpp_assert (pfile, "cpu=s390");
> > +  cpp_assert (pfile, "machine=s390");
> > +  cpp_define (pfile, "__s390__");
> > +  if (TARGET_ZARCH)
> > +    cpp_define (pfile, "__zarch__");
> > +  if (TARGET_64BIT)
> > +    cpp_define (pfile, "__s390x__");
> > +  if (TARGET_LONG_DOUBLE_128)
> > +    cpp_define (pfile, "__LONG_DOUBLE_128__");
> > +  cl_target_option_save (&opts, &global_options);
> > +  s390_cpu_cpp_builtins_internal (pfile, &opts, NULL);
> > +}
> > +
> > +#if S390_USE_TARGET_ATTRIBUTE
> > +/* Hook to validate the current #pragma GCC target and set the state, and
> > +   update the macros based on what was changed.  If ARGS is NULL, then
> > +   POP_TARGET is used to reset the options.  */
> > +
> > +static bool
> > +s390_pragma_target_parse (tree args, tree pop_target)
> > +{
> > +  tree prev_tree = build_target_option_node (&global_options);
> > +  tree cur_tree;
> > +
> > +  {
> > +    gcc_options options;
> > +    tree def_tree;
> > +
> > +    memcpy (&options, &global_options, sizeof (options));
> options = global_options;
> 
> > +    def_tree = (pop_target ? pop_target : target_option_default_node);
> > +    cl_target_option_restore (&options, TREE_TARGET_OPTION (def_tree));
> > +    if (! args)
> > +      cur_tree = def_tree;
> > +    else
> > +      {
> > +	gcc_options options_set;
> > +
> > +	memcpy (&options_set, &global_options_set, sizeof (options_set));
> options_set = global_options_set;
> 
> > +	cur_tree = s390_valid_target_attribute_tree (args, &options,
> > +						     &options_set, true);
> > +	if (!cur_tree || cur_tree == error_mark_node)
> > +	  return false;
> Don't you need to do:
> global_options_set = options_set;
> 
> > +      }
> > +    memcpy (&global_options, &options, sizeof (options));
> global_options = options;
> 
> All the backup and restore of the option structures is probably done
> here to prevent half-way parsed options from staying in the data
> structures while running into an error - right?!  Is this really a
> problem, e.g. the i386 back-end does not seem to do it?

I386 also has a backup in prev_tree, but we have that too, so
"options" can be removed.  Note that if parsing fails on i386, it
still overwrites global_opts_set and never restores it.

What this code does is somewhat strange anyway.  According to the
documentation, the pragma works as if any following functions had
its options wrapped in a target attribute.  So, the pragma should
only have an effect on functions, but *actually* the code
immediately modifies the global_opts structure when the pragma is
parsed.  I wonder if this is intentional.

> > +  if (old_tree != new_tree)
> > +    {
> > +      cl_target_option_restore (&global_options, TREE_TARGET_OPTION (new_tree));
> > +      if (TREE_TARGET_GLOBALS (new_tree))
> > +	restore_target_globals (TREE_TARGET_GLOBALS (new_tree));
> > +      else if (new_tree == target_option_default_node)
> > +	restore_target_globals (&default_target_globals);
> > +      else
> > +	TREE_TARGET_GLOBALS (new_tree) = save_target_globals_default_opts ();
> 
> This last part is almost s390_reset_previous_fndecl. Perhaps it could
> be merged?!

Done.

Ciao

Dominik ^_^  ^_^

-- 

Dominik Vogt
IBM Germany

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 1/2] s/390: Implement "target" attribute.
  2015-10-31 18:01         ` Dominik Vogt
@ 2015-11-09  7:10           ` Andreas Krebbel
  2015-12-04 14:14           ` Dominik Vogt
  1 sibling, 0 replies; 16+ messages in thread
From: Andreas Krebbel @ 2015-11-09  7:10 UTC (permalink / raw)
  To: gcc-patches

On 10/31/2015 06:58 PM, Dominik Vogt wrote:
> But what the heck is this "exact power of 2" limitation good for
> in the first place?  Why is a stack size of 1, 2 or
> 36028797018963968 valid, but not 800?  Shouldn't the stack size
> (and the size of the stack guard) just be multiples of the stack
> slot size?

That's because of the way we implement the stack check.  We use test under mask to check for certain
bits instead of doing the full math and compare.

-Andreas-


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 1/2] s/390: Implement "target" attribute.
  2015-11-02  8:44         ` Dominik Vogt
@ 2015-11-09 13:09           ` Andreas Krebbel
  2015-11-17 19:23             ` Dominik Vogt
  0 siblings, 1 reply; 16+ messages in thread
From: Andreas Krebbel @ 2015-11-09 13:09 UTC (permalink / raw)
  To: gcc-patches, Ulrich Weigand

On 11/02/2015 09:44 AM, Dominik Vogt wrote:
> (@Uli: I'd like to hear your opinion on this issue.
> Original message:
> https://gcc.gnu.org/ml/gcc-patches/2015-10/msg03403.html).
> 
> On Fri, Oct 30, 2015 at 03:09:39PM +0100, Andreas Krebbel wrote:
>> Why do we need x_s390_arch_specified and x_s390_tune_specified?  You
>> should be able to use opts_set->x_s390_arch and opts_set->x_s390_tune
>> instead? (patch attached, your tests keep working with that change).
> 
> The idea was that -mtune on the command line is *not* overridden
> by the "arch" target attribute.  This would allow to change the
> architecture for a specific function and keep the -mtune= option
> from the command line.  But as a matter of fact, the current patch
> doesn't do it either (bug?).

Your testcases even seem to check for this behavior so it looked intentional to me.  But I agree
that being able to keep the -mtune cmdline value for a function while only changing the used
instruction set would be good.

Could you please elaborate why implementing this requires the new flags?

-Andreas-

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 1/2] s/390: Implement "target" attribute.
  2015-11-09 13:09           ` Andreas Krebbel
@ 2015-11-17 19:23             ` Dominik Vogt
  0 siblings, 0 replies; 16+ messages in thread
From: Dominik Vogt @ 2015-11-17 19:23 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 1451 bytes --]

On Mon, Nov 09, 2015 at 02:09:31PM +0100, Andreas Krebbel wrote:
> On 11/02/2015 09:44 AM, Dominik Vogt wrote:
> > (@Uli: I'd like to hear your opinion on this issue.
> > Original message:
> > https://gcc.gnu.org/ml/gcc-patches/2015-10/msg03403.html).
> > 
> > On Fri, Oct 30, 2015 at 03:09:39PM +0100, Andreas Krebbel wrote:
> >> Why do we need x_s390_arch_specified and x_s390_tune_specified?  You
> >> should be able to use opts_set->x_s390_arch and opts_set->x_s390_tune
> >> instead? (patch attached, your tests keep working with that change).
> > 
> > The idea was that -mtune on the command line is *not* overridden
> > by the "arch" target attribute.  This would allow to change the
> > architecture for a specific function and keep the -mtune= option
> > from the command line.  But as a matter of fact, the current patch
> > doesn't do it either (bug?).

> Your testcases even seem to check for this behavior so it looked
> intentional to me.  But I agree that being able to keep the -mtune
> cmdline value for a function while only changing the used
> instruction set would be good.
> 
> Could you please elaborate why implementing this requires the new flags?

I turns out that this is not necessary at all.  New patch attached
with all the proposed changes.  The code got even simpler without
the special logic for -mtune= handling.

The new patch has already passed full testsuite.

Ciao

Dominik ^_^  ^_^

-- 

Dominik Vogt
IBM Germany

[-- Attachment #2: 0001-ChangeLog --]
[-- Type: text/plain, Size: 10257 bytes --]

gcc/ChangeLog

	* config/s390/s390.opt (s390_arch_string): Remove.
	(s390_tune_string): Likewise.
	(s390_cost_pointer): Add Variable.
	(s390_tune_flags): Add TargetVariable.
	(s390_arch_flags, march=, mbackchain, mdebug, mesa, mhard-dfp),
	(mhard-float, mlong-double-128, mlong-double-64, mhtm, mvx),
	(mpacked-stack, msmall-exec, msoft-float, mstack-guard=, mstack-size=),
	(mtune=, mmvcle, mzvector, mzarch, mbranch-cost=, mwarn-dynamicstack),
	(mwarn-framesize=): Save option.
	(mno-stack-guard, mno-stack-guard): New option.
	(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.
	(s390_asm_output_function_prefix): Declare hook.
	(s390_asm_declare_function_size): Likewise.
	* 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, TARGET_CPU_ZARCH_P),
	(TARGET_CPU_LONG_DISPLACEMENT_P, TARGET_CPU_EXTIMM_P, TARGET_CPU_DFP_P),
	(TARGET_CPU_Z10_P, TARGET_CPU_Z196_P, TARGET_CPU_ZEC12_P),
	(TARGET_CPU_HTM_P, TARGET_CPU_Z13_P, TARGET_CPU_VX_P),
	(TARGET_HARD_FLOAT_P, TARGET_LONG_DISPLACEMENT_P, TARGET_EXTIMM_P),
	(TARGET_DFP_P, TARGET_Z10_P, TARGET_Z196_P, TARGET_ZEC12_P),
	(TARGET_HTM_P, TARGET_Z13_P, TARGET_VX_P, TARGET_CPU_EXTIMM),
	(TARGET_CPU_DFP, TARGET_CPU_Z10, TARGET_CPU_Z196, TARGET_CPU_ZEC12),
	(TARGET_CPU_HTM, TARGET_CPU_Z13, TARGET_LONG_DISPLACEMENT),
	(TARGET_EXTIMM, TARGET_DFP, TARGET_Z10, TARGET_Z196, TARGET_ZEC12),
	(TARGET_Z13, TARGET_VX, S390_USE_TARGET_ATTRIBUTE),
	(S390_USE_ARCHITECTURE_MODIFIERS, SWITCHABLE_TARGET),
	(ASM_DECLARE_FUNCTION_SIZE, ASM_OUTPUT_FUNCTION_PREFIX): Likewise.
	* 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_function_prefix): Likewise.
	(s390_asm_declare_function_size):  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_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/tattr-1.c: New test.
	* gcc.target/s390/target-attribute/tattr-2.c: New test.
	* gcc.target/s390/target-attribute/tattr-3.c: New test.
	* gcc.target/s390/target-attribute/tattr-4.c: New test.
	* gcc.target/s390/target-attribute/tattr-5.c: New test.
	* gcc.target/s390/target-attribute/tattr-6.c: New test.
	* gcc.target/s390/target-attribute/tattr-7.c: New test.
	* gcc.target/s390/target-attribute/tattr-8.c: New test.
	* gcc.target/s390/target-attribute/tattr-9.c: New test.
	* gcc.target/s390/target-attribute/tattr-10.c: New test.
	* gcc.target/s390/target-attribute/tattr-11.c: New test.
	* gcc.target/s390/target-attribute/tattr-12.c: New test.
	* gcc.target/s390/target-attribute/tattr-13.c: New test.
	* gcc.target/s390/target-attribute/tattr-14.c: New test.
	* gcc.target/s390/target-attribute/tattr-15.c: New test.
	* gcc.target/s390/target-attribute/tattr-16.c: New test.
	* gcc.target/s390/target-attribute/tattr-17.c: New test.
	* gcc.target/s390/target-attribute/tattr-18.c: New test.
	* gcc.target/s390/target-attribute/tattr-19.c: New test.
	* gcc.target/s390/target-attribute/tattr-arch-tune-1.c: New test.
	* gcc.target/s390/target-attribute/tattr-arch-tune-2.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-1.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-2.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-3.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-4.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-5.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-6.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-7.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-8.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-9.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-10.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-11.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-12.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-13.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-14.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-15.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-16.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-17.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-18.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-19.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-20.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-21.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-22.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-23.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-24.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-25.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-26.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-27.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-28.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-29.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-30.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-31.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-32.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-1.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-2.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-3.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-4.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-5.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-6.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-7.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-8.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-9.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-10.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-11.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-12.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-13.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-14.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-15.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-16.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-17.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-18.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-19.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-20.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-21.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-22.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-23.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-24.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-25.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-26.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-27.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-28.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-29.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-30.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-31.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-32.c: New test.
	* gcc.target/s390/target-attribute/tpragma-struct-vx-2.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.
	* gcc.target/s390/s390-c++.exp
	(check_effective_target_target_attribute): Likewise.

[-- Attachment #3: 0001-S-390-Implement-attribute-target-and-pragma-GCC-targ.patch.gz --]
[-- Type: application/octet-stream, Size: 75057 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 1/2] s/390: Implement "target" attribute.
  2015-10-31 18:01         ` Dominik Vogt
  2015-11-09  7:10           ` Andreas Krebbel
@ 2015-12-04 14:14           ` Dominik Vogt
  2015-12-04 14:36             ` Andreas Krebbel
  1 sibling, 1 reply; 16+ messages in thread
From: Dominik Vogt @ 2015-12-04 14:14 UTC (permalink / raw)
  To: gcc-patches; +Cc: Andreas Krebbel

[-- Attachment #1: Type: text/plain, Size: 210 bytes --]

Next version of the patch with the changes discussed internally.
(Sorry for the version number; I now use my internam branch
numbers for sake of clarity.)

Ciao

Dominik ^_^  ^_^

-- 

Dominik Vogt
IBM Germany

[-- Attachment #2: 0001-v21-ChangeLog --]
[-- Type: text/plain, Size: 10256 bytes --]

gcc/ChangeLog

	* config/s390/s390.opt (s390_arch_string): Remove.
	(s390_tune_string): Likewise.
	(s390_cost_pointer): Add Variable.
	(s390_tune_flags): Add TargetVariable.
	(s390_arch_flags, march=, mbackchain, mdebug, mesa, mhard-dfp),
	(mhard-float, mlong-double-128, mlong-double-64, mhtm, mvx),
	(mpacked-stack, msmall-exec, msoft-float, mstack-guard=, mstack-size=),
	(mtune=, mmvcle, mzvector, mzarch, mbranch-cost=, mwarn-dynamicstack),
	(mwarn-framesize=): Save option.
	(mno-stack-guard, mno-stack-guard): New option.
	(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.
	(s390_asm_output_function_prefix): Declare hook.
	(s390_asm_declare_function_size): Likewise.
	* 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, TARGET_CPU_ZARCH_P),
	(TARGET_CPU_LONG_DISPLACEMENT_P, TARGET_CPU_EXTIMM_P, TARGET_CPU_DFP_P),
	(TARGET_CPU_Z10_P, TARGET_CPU_Z196_P, TARGET_CPU_ZEC12_P),
	(TARGET_CPU_HTM_P, TARGET_CPU_Z13_P, TARGET_CPU_VX_P),
	(TARGET_HARD_FLOAT_P, TARGET_LONG_DISPLACEMENT_P, TARGET_EXTIMM_P),
	(TARGET_DFP_P, TARGET_Z10_P, TARGET_Z196_P, TARGET_ZEC12_P),
	(TARGET_HTM_P, TARGET_Z13_P, TARGET_VX_P, TARGET_CPU_EXTIMM),
	(TARGET_CPU_DFP, TARGET_CPU_Z10, TARGET_CPU_Z196, TARGET_CPU_ZEC12),
	(TARGET_CPU_HTM, TARGET_CPU_Z13, TARGET_LONG_DISPLACEMENT),
	(TARGET_EXTIMM, TARGET_DFP, TARGET_Z10, TARGET_Z196, TARGET_ZEC12),
	(TARGET_Z13, TARGET_VX, S390_USE_TARGET_ATTRIBUTE),
	(S390_USE_ARCHITECTURE_MODIFIERS, SWITCHABLE_TARGET),
	(ASM_DECLARE_FUNCTION_SIZE, ASM_OUTPUT_FUNCTION_PREFIX): Likewise.
	* 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_function_prefix): Likewise.
	(s390_asm_declare_function_size):  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_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/tattr-1.c: New test.
	* gcc.target/s390/target-attribute/tattr-2.c: New test.
	* gcc.target/s390/target-attribute/tattr-3.c: New test.
	* gcc.target/s390/target-attribute/tattr-4.c: New test.
	* gcc.target/s390/target-attribute/tattr-5.c: New test.
	* gcc.target/s390/target-attribute/tattr-6.c: New test.
	* gcc.target/s390/target-attribute/tattr-7.c: New test.
	* gcc.target/s390/target-attribute/tattr-8.c: New test.
	* gcc.target/s390/target-attribute/tattr-9.c: New test.
	* gcc.target/s390/target-attribute/tattr-10.c: New test.
	* gcc.target/s390/target-attribute/tattr-11.c: New test.
	* gcc.target/s390/target-attribute/tattr-12.c: New test.
	* gcc.target/s390/target-attribute/tattr-13.c: New test.
	* gcc.target/s390/target-attribute/tattr-14.c: New test.
	* gcc.target/s390/target-attribute/tattr-15.c: New test.
	* gcc.target/s390/target-attribute/tattr-16.c: New test.
	* gcc.target/s390/target-attribute/tattr-17.c: New test.
	* gcc.target/s390/target-attribute/tattr-18.c: New test.
	* gcc.target/s390/target-attribute/tattr-19.c: New test.
	* gcc.target/s390/target-attribute/tattr-arch-tune-1.c: New test.
	* gcc.target/s390/target-attribute/tattr-arch-tune-2.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-1.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-2.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-3.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-4.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-5.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-6.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-7.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-8.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-9.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-10.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-11.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-12.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-13.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-14.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-15.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-16.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-17.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-18.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-19.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-20.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-21.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-22.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-23.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-24.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-25.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-26.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-27.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-28.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-29.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-30.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-31.c: New test.
	* gcc.target/s390/target-attribute/tattr-m31-32.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-1.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-2.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-3.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-4.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-5.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-6.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-7.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-8.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-9.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-10.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-11.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-12.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-13.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-14.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-15.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-16.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-17.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-18.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-19.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-20.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-21.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-22.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-23.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-24.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-25.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-26.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-27.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-28.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-29.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-30.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-31.c: New test.
	* gcc.target/s390/target-attribute/tattr-m64-32.c: New test.
	* gcc.target/s390/target-attribute/tpragma-struct-vx-2.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.
	* gcc.target/s390/s390-c++.exp
	(check_effective_target_target_attribute): Likewise.

[-- Attachment #3: 0001-v21-S-390-Implement-attribute-target-and-pragma-GCC-targ.patch.gz --]
[-- Type: application/octet-stream, Size: 74987 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 1/2] s/390: Implement "target" attribute.
  2015-12-04 14:14           ` Dominik Vogt
@ 2015-12-04 14:36             ` Andreas Krebbel
  0 siblings, 0 replies; 16+ messages in thread
From: Andreas Krebbel @ 2015-12-04 14:36 UTC (permalink / raw)
  To: gcc-patches, vogt

On 12/04/2015 03:14 PM, Dominik Vogt wrote:
> Next version of the patch with the changes discussed internally.
> (Sorry for the version number; I now use my internam branch
> numbers for sake of clarity.)

Applied. Thanks!

-Andreas-


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 2/2] s/390: Implement "target" attribute.
  2015-09-25 14:16 ` [PATCH 2/2] " Dominik Vogt
@ 2015-12-04 14:36   ` Andreas Krebbel
  0 siblings, 0 replies; 16+ messages in thread
From: Andreas Krebbel @ 2015-12-04 14:36 UTC (permalink / raw)
  To: gcc-patches, vogt

On 09/25/2015 04:02 PM, Dominik Vogt wrote:
> 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

Applied. Thanks!

-Andreas-


^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2015-12-04 14:36 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-25 14:16 [PATCH] s/390: Implement "target" attribute Dominik Vogt
2015-09-25 14:16 ` [PATCH 2/2] " Dominik Vogt
2015-12-04 14:36   ` Andreas Krebbel
2015-09-25 15:05 ` [PATCH 1/2] " Dominik Vogt
     [not found] ` <20150925140123.GB14892@linux.vnet.ibm.com>
2015-10-16 12:33   ` Dominik Vogt
2015-10-26 10:11     ` Dominik Vogt
2015-10-26 12:16       ` Dominik Vogt
2015-10-30 14:29       ` Andreas Krebbel
2015-10-31 18:01         ` Dominik Vogt
2015-11-09  7:10           ` Andreas Krebbel
2015-12-04 14:14           ` Dominik Vogt
2015-12-04 14:36             ` Andreas Krebbel
2015-11-02  8:44         ` Dominik Vogt
2015-11-09 13:09           ` Andreas Krebbel
2015-11-17 19:23             ` Dominik Vogt
2015-11-02 10:47         ` Dominik Vogt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).