summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/s390/target-attribute/tattr-arch-tune-2.c
diff options
context:
space:
mode:
authorkrebbel <krebbel@138bc75d-0d04-0410-961f-82ee72b054a4>2015-12-04 14:30:42 +0000
committerkrebbel <krebbel@138bc75d-0d04-0410-961f-82ee72b054a4>2015-12-04 14:30:42 +0000
commit7a0cee35f9d427ed7e17ac99bbfac0c437278743 (patch)
tree94300fd777cd59b02e41f3e7bbfeeba143dc1b6c /gcc/testsuite/gcc.target/s390/target-attribute/tattr-arch-tune-2.c
parent9841c6ee5b694050bb3fbff91fd094888aa8e9c3 (diff)
downloadgcc-7a0cee35f9d427ed7e17ac99bbfac0c437278743.tar.gz
[PATCH 1/2] S/390: Implement "target" attribute.
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@231271 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/gcc.target/s390/target-attribute/tattr-arch-tune-2.c')
-rw-r--r--gcc/testsuite/gcc.target/s390/target-attribute/tattr-arch-tune-2.c160
1 files changed, 160 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.target/s390/target-attribute/tattr-arch-tune-2.c b/gcc/testsuite/gcc.target/s390/target-attribute/tattr-arch-tune-2.c
new file mode 100644
index 00000000000..d21a522eeb8
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/target-attribute/tattr-arch-tune-2.c
@@ -0,0 +1,160 @@
+/* Functional tests for the "target" attribute and pragma. */
+
+/* { dg-require-effective-target target_attribute } */
+/* { dg-options "-mdebug -march=z13 -mtune=z10" } */
+
+/**
+ ** no pragma
+ **/
+
+void fn_p0_1 (void) { }
+/* { dg-final { scan-assembler "fn:fn_p0_1 ar9" } } */
+/* { dg-final { scan-assembler "fn:fn_p0_1 tu6" } } */
+
+__attribute__ ((target("arch=zEC12")))
+void fn_p0_2 (void) { }
+/* { dg-final { scan-assembler "fn:fn_p0_2 ar8" } } */
+/* { dg-final { scan-assembler "fn:fn_p0_2 tu6" } } */
+
+__attribute__ ((target("tune=z196")))
+void fn_p0_3 (void) { }
+/* { dg-final { scan-assembler "fn:fn_p0_3 ar9" } } */
+/* { dg-final { scan-assembler "fn:fn_p0_3 tu7" } } */
+
+__attribute__ ((target("arch=zEC12,tune=z196")))
+void fn_p0_4 (void) { }
+/* { dg-final { scan-assembler "fn:fn_p0_4 ar8" } } */
+/* { dg-final { scan-assembler "fn:fn_p0_4 tu7" } } */
+
+__attribute__ ((target("tune=z196,arch=zEC12")))
+void fn_p0_5 (void) { }
+/* { dg-final { scan-assembler "fn:fn_p0_5 ar8" } } */
+/* { dg-final { scan-assembler "fn:fn_p0_5 tu7" } } */
+
+/**
+ ** arch pragma
+ **/
+
+#pragma GCC target ("arch=z9-ec")
+
+void fn_pa_1 (void) { }
+/* { dg-final { scan-assembler "fn:fn_pa_1 ar5" } } */
+/* { dg-final { scan-assembler "fn:fn_pa_1 tu6" } } */
+
+__attribute__ ((target("arch=zEC12")))
+void fn_pa_2 (void) { }
+/* { dg-final { scan-assembler "fn:fn_pa_2 ar8" } } */
+/* { dg-final { scan-assembler "fn:fn_pa_2 tu6" } } */
+
+__attribute__ ((target("tune=z196")))
+void fn_pa_3 (void) { }
+/* { dg-final { scan-assembler "fn:fn_pa_3 ar5" } } */
+/* { dg-final { scan-assembler "fn:fn_pa_3 tu7" } } */
+
+__attribute__ ((target("arch=zEC12,tune=z196")))
+void fn_pa_4 (void) { }
+/* { dg-final { scan-assembler "fn:fn_pa_4 ar8" } } */
+/* { dg-final { scan-assembler "fn:fn_pa_4 tu7" } } */
+
+__attribute__ ((target("tune=z196,arch=zEC12")))
+void fn_pa_5 (void) { }
+/* { dg-final { scan-assembler "fn:fn_pa_5 ar8" } } */
+/* { dg-final { scan-assembler "fn:fn_pa_5 tu7" } } */
+
+#pragma GCC reset_options
+
+/**
+ ** tune pragma
+ **/
+
+#pragma GCC target ("tune=z9-109")
+
+void fn_pt_1 (void) { }
+/* { dg-final { scan-assembler "fn:fn_pt_1 ar9" } } */
+/* { dg-final { scan-assembler "fn:fn_pt_1 tu4" } } */
+
+__attribute__ ((target("arch=zEC12")))
+void fn_pt_2 (void) { }
+/* { dg-final { scan-assembler "fn:fn_pt_2 ar8" } } */
+/* { dg-final { scan-assembler "fn:fn_pt_2 tu4" } } */
+
+__attribute__ ((target("tune=z196")))
+void fn_pt_3 (void) { }
+/* { dg-final { scan-assembler "fn:fn_pt_3 ar9" } } */
+/* { dg-final { scan-assembler "fn:fn_pt_3 tu7" } } */
+
+__attribute__ ((target("arch=zEC12,tune=z196")))
+void fn_pt_4 (void) { }
+/* { dg-final { scan-assembler "fn:fn_pt_4 ar8" } } */
+/* { dg-final { scan-assembler "fn:fn_pt_4 tu7" } } */
+
+__attribute__ ((target("tune=z196,arch=zEC12")))
+void fn_pt_5 (void) { }
+/* { dg-final { scan-assembler "fn:fn_pt_5 ar8" } } */
+/* { dg-final { scan-assembler "fn:fn_pt_5 tu7" } } */
+
+#pragma GCC reset_options
+
+/**
+ ** arch and tune pragmas
+ **/
+
+#pragma GCC target ("arch=z9-ec,tune=z9-109")
+
+void fn_pat_1 (void) { }
+/* { dg-final { scan-assembler "fn:fn_pat_1 ar5" } } */
+/* { dg-final { scan-assembler "fn:fn_pat_1 tu4" } } */
+
+__attribute__ ((target("arch=zEC12")))
+void fn_pat_2 (void) { }
+/* { dg-final { scan-assembler "fn:fn_pat_2 ar8" } } */
+/* { dg-final { scan-assembler "fn:fn_pat_2 tu4" } } */
+
+__attribute__ ((target("tune=z196")))
+void fn_pat_3 (void) { }
+/* { dg-final { scan-assembler "fn:fn_pat_3 ar5" } } */
+/* { dg-final { scan-assembler "fn:fn_pat_3 tu7" } } */
+
+__attribute__ ((target("arch=zEC12,tune=z196")))
+void fn_pat_4 (void) { }
+/* { dg-final { scan-assembler "fn:fn_pat_4 ar8" } } */
+/* { dg-final { scan-assembler "fn:fn_pat_4 tu7" } } */
+
+__attribute__ ((target("tune=z196,arch=zEC12")))
+void fn_pat_5 (void) { }
+/* { dg-final { scan-assembler "fn:fn_pat_5 ar8" } } */
+/* { dg-final { scan-assembler "fn:fn_pat_5 tu7" } } */
+
+#pragma GCC reset_options
+
+/**
+ ** tune and arch pragmas
+ **/
+
+#pragma GCC target ("tune=z9-109,arch=z9-ec")
+
+void fn_pta_1 (void) { }
+/* { dg-final { scan-assembler "fn:fn_pta_1 ar5" } } */
+/* { dg-final { scan-assembler "fn:fn_pta_1 tu4" } } */
+
+__attribute__ ((target("arch=zEC12")))
+void fn_pta_2 (void) { }
+/* { dg-final { scan-assembler "fn:fn_pta_2 ar8" } } */
+/* { dg-final { scan-assembler "fn:fn_pta_2 tu4" } } */
+
+__attribute__ ((target("tune=z196")))
+void fn_pta_3 (void) { }
+/* { dg-final { scan-assembler "fn:fn_pta_3 ar5" } } */
+/* { dg-final { scan-assembler "fn:fn_pta_3 tu7" } } */
+
+__attribute__ ((target("arch=zEC12,tune=z196")))
+void fn_pta_4 (void) { }
+/* { dg-final { scan-assembler "fn:fn_pta_4 ar8" } } */
+/* { dg-final { scan-assembler "fn:fn_pta_4 tu7" } } */
+
+__attribute__ ((target("tune=z196,arch=zEC12")))
+void fn_pta_5 (void) { }
+/* { dg-final { scan-assembler "fn:fn_pta_5 ar8" } } */
+/* { dg-final { scan-assembler "fn:fn_pta_5 tu7" } } */
+
+#pragma GCC reset_options