S/390: arch12: Add arch12 option.

This patch covers the mechanical work of making the new architecture
option arch12 available wherever it will be needed later.

gcc/testsuite/ChangeLog:

2017-03-24  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>

	* gcc.target/s390/s390.exp: Run tests in arch12 and vxe dirs.
	* lib/target-supports.exp: Add effective target check s390_vxe.

gcc/ChangeLog:

2017-03-24  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>

	* common/config/s390/s390-common.c (processor_flags_table): Add
	arch12.
	* config.gcc: Add arch12.
	* config/s390/driver-native.c (s390_host_detect_local_cpu):
	Default to arch12 for unknown CPU model numbers.
	* config/s390/s390-builtins.def: Add B_VXE builtin flag.
	* config/s390/s390-c.c (s390_cpu_cpp_builtins_internal): Adjust
	PROCESSOR_max sanity check.
	* config/s390/s390-opts.h (enum processor_type): Add
	PROCESSOR_ARCH12.
	* config/s390/s390.c (processor_table): Add arch12.
	(s390_expand_builtin): Add check for B_VXE flag.
	(s390_issue_rate): Add PROCESSOR_ARCH12.
	(s390_get_sched_attrmask): Likewise.
	(s390_get_unit_mask): Likewise.
	(s390_sched_score): Enable z13 scheduling for arch12.
	(s390_sched_reorder): Likewise.
	(s390_sched_variable_issue): Likewise.
	* config/s390/s390.h (enum processor_flags): Add PF_ARCH12 and
	PF_VXE.
	(s390_tune_attr): Use z13 scheduling also for arch12.
	(TARGET_CPU_ARCH12, TARGET_CPU_ARCH12_P, TARGET_CPU_VXE)
	(TARGET_CPU_VXE_P, TARGET_ARCH12, TARGET_ARCH12_P, TARGET_VXE)
	(TARGET_VXE_P): New macros.
	* config/s390/s390.md: Add arch12 to cpu attribute.  Add arch12
	and vxe to cpu_facility.  Add arch12 and vxe to enabled attribute.
	* config/s390/s390.opt: Add arch12 as processor_type.

From-SVN: r246452
This commit is contained in:
Andreas Krebbel 2017-03-24 13:59:51 +00:00 committed by Andreas Krebbel
parent 9751ad6e9b
commit 6654e96fc8
14 changed files with 120 additions and 16 deletions

View File

@ -1,3 +1,33 @@
2017-03-24 Andreas Krebbel <krebbel@linux.vnet.ibm.com>
* common/config/s390/s390-common.c (processor_flags_table): Add
arch12.
* config.gcc: Add arch12.
* config/s390/driver-native.c (s390_host_detect_local_cpu):
Default to arch12 for unknown CPU model numbers.
* config/s390/s390-builtins.def: Add B_VXE builtin flag.
* config/s390/s390-c.c (s390_cpu_cpp_builtins_internal): Adjust
PROCESSOR_max sanity check.
* config/s390/s390-opts.h (enum processor_type): Add
PROCESSOR_ARCH12.
* config/s390/s390.c (processor_table): Add arch12.
(s390_expand_builtin): Add check for B_VXE flag.
(s390_issue_rate): Add PROCESSOR_ARCH12.
(s390_get_sched_attrmask): Likewise.
(s390_get_unit_mask): Likewise.
(s390_sched_score): Enable z13 scheduling for arch12.
(s390_sched_reorder): Likewise.
(s390_sched_variable_issue): Likewise.
* config/s390/s390.h (enum processor_flags): Add PF_ARCH12 and
PF_VXE.
(s390_tune_attr): Use z13 scheduling also for arch12.
(TARGET_CPU_ARCH12, TARGET_CPU_ARCH12_P, TARGET_CPU_VXE)
(TARGET_CPU_VXE_P, TARGET_ARCH12, TARGET_ARCH12_P, TARGET_VXE)
(TARGET_VXE_P): New macros.
* config/s390/s390.md: Add arch12 to cpu attribute. Add arch12
and vxe to cpu_facility. Add arch12 and vxe to enabled attribute.
* config/s390/s390.opt: Add arch12 as processor_type.
2017-03-24 Andreas Krebbel <krebbel@linux.vnet.ibm.com>
* config/s390/s390.md

View File

@ -45,7 +45,10 @@ EXPORTED_CONST int processor_flags_table[] =
| PF_EXTIMM | PF_DFP | PF_Z10 | PF_Z196 | PF_ZEC12 | PF_TX,
/* z13 */ PF_IEEE_FLOAT | PF_ZARCH | PF_LONG_DISPLACEMENT
| PF_EXTIMM | PF_DFP | PF_Z10 | PF_Z196 | PF_ZEC12 | PF_TX
| PF_Z13 | PF_VX
| PF_Z13 | PF_VX,
/* arch12 */ PF_IEEE_FLOAT | PF_ZARCH | PF_LONG_DISPLACEMENT
| PF_EXTIMM | PF_DFP | PF_Z10 | PF_Z196 | PF_ZEC12 | PF_TX
| PF_Z13 | PF_VX | PF_VXE | PF_ARCH12
};
/* Change optimizations to be performed, depending on the

View File

@ -4331,7 +4331,7 @@ case "${target}" in
for which in arch tune; do
eval "val=\$with_$which"
case ${val} in
"" | native | g5 | g6 | z900 | z990 | z9-109 | z9-ec | z10 | z196 | zEC12 | z13 | arch3 | arch5 | arch6 | arch7 | arch8 | arch9 | arch10 | arch11)
"" | native | g5 | g6 | z900 | z990 | z9-109 | z9-ec | z10 | z196 | zEC12 | z13 | arch3 | arch5 | arch6 | arch7 | arch8 | arch9 | arch10 | arch11 | arch12)
# OK
;;
*)

View File

@ -114,6 +114,9 @@ s390_host_detect_local_cpu (int argc, const char **argv)
case 0x2964:
cpu = "z13";
break;
default:
cpu = "arch12";
break;
}
}
if (has_features == 0 && strncmp (buf, "features", 8) == 0)

View File

@ -270,6 +270,7 @@
#undef B_INT
#undef B_HTM
#undef B_VX
#undef B_VXE
#undef BFLAGS_MASK_INIT
#define BFLAGS_MASK_INIT (B_INT)
@ -277,7 +278,7 @@
#define B_INT (1 << 0) /* Internal builtins. This builtin cannot be used in user programs. */
#define B_HTM (1 << 1) /* Builtins requiring the transactional execution facility. */
#define B_VX (1 << 2) /* Builtins requiring the z13 vector extensions. */
#define B_VXE (1 << 3) /* Builtins requiring the arch12 vector extensions. */
/* B_DEF defines a standard (not overloaded) builtin
B_DEF (<builtin name>, <RTL expander name>, <function attributes>, <builtin flags>, <operand flags, see above>, <fntype>)

View File

@ -339,7 +339,7 @@ s390_cpu_cpp_builtins_internal (cpp_reader *pfile,
/* Z9_EC has the same level as Z9_109. */
arch_level--;
/* Review when a new arch is added and increase the value. */
char dummy[23 - 2 * PROCESSOR_max] __attribute__((unused));
char dummy[(PROCESSOR_max > 12) ? -1 : 1] __attribute__((unused));
sprintf (macro_def, "__ARCH__=%d", arch_level);
cpp_undef (pfile, "__ARCH__");
cpp_define (pfile, macro_def);

View File

@ -38,6 +38,7 @@ enum processor_type
PROCESSOR_2817_Z196,
PROCESSOR_2827_ZEC12,
PROCESSOR_2964_Z13,
PROCESSOR_ARCH12,
PROCESSOR_NATIVE,
PROCESSOR_max
};

View File

@ -334,6 +334,7 @@ const processor_table[] =
{ "z196", PROCESSOR_2817_Z196, &z196_cost },
{ "zEC12", PROCESSOR_2827_ZEC12, &zEC12_cost },
{ "z13", PROCESSOR_2964_Z13, &zEC12_cost },
{ "arch12", PROCESSOR_ARCH12, &zEC12_cost },
{ "native", PROCESSOR_NATIVE, NULL }
};
@ -824,12 +825,18 @@ s390_expand_builtin (tree exp, rtx target, rtx subtarget ATTRIBUTE_UNUSED,
"(default with -march=zEC12 and higher).", fndecl);
return const0_rtx;
}
if ((bflags & B_VX) && !TARGET_VX)
if (((bflags & B_VX) || (bflags & B_VXE)) && !TARGET_VX)
{
error ("builtin %qF is not supported without -mvx "
"(default with -march=z13 and higher).", fndecl);
return const0_rtx;
}
if ((bflags & B_VXE) && !TARGET_VXE)
{
error ("Builtin %qF requires arch12 or higher.", fndecl);
return const0_rtx;
}
}
if (fcode >= S390_OVERLOADED_BUILTIN_VAR_OFFSET
&& fcode < S390_ALL_BUILTIN_MAX)
@ -7781,6 +7788,7 @@ s390_issue_rate (void)
instruction gets issued per cycle. */
case PROCESSOR_2827_ZEC12:
case PROCESSOR_2964_Z13:
case PROCESSOR_ARCH12:
default:
return 1;
}
@ -13987,6 +13995,7 @@ s390_get_sched_attrmask (rtx_insn *insn)
mask |= S390_SCHED_ATTR_MASK_GROUPALONE;
break;
case PROCESSOR_2964_Z13:
case PROCESSOR_ARCH12:
if (get_attr_z13_cracked (insn))
mask |= S390_SCHED_ATTR_MASK_CRACKED;
if (get_attr_z13_expanded (insn))
@ -14010,6 +14019,7 @@ s390_get_unit_mask (rtx_insn *insn, int *units)
switch (s390_tune)
{
case PROCESSOR_2964_Z13:
case PROCESSOR_ARCH12:
*units = 3;
if (get_attr_z13_unit_lsu (insn))
mask |= 1 << 0;
@ -14082,7 +14092,7 @@ s390_sched_score (rtx_insn *insn)
break;
}
if (s390_tune == PROCESSOR_2964_Z13)
if (s390_tune >= PROCESSOR_2964_Z13)
{
int units, i;
unsigned unit_mask, m = 1;
@ -14187,7 +14197,7 @@ s390_sched_reorder (FILE *file, int verbose,
PRINT_SCHED_ATTR (S390_SCHED_ATTR_MASK_ENDGROUP, endgroup);
PRINT_SCHED_ATTR (S390_SCHED_ATTR_MASK_GROUPALONE, groupalone);
#undef PRINT_SCHED_ATTR
if (s390_tune == PROCESSOR_2964_Z13)
if (s390_tune >= PROCESSOR_2964_Z13)
{
unsigned int unit_mask, m = 1;
int units, j;
@ -14250,7 +14260,7 @@ s390_sched_variable_issue (FILE *file, int verbose, rtx_insn *insn, int more)
}
}
if (s390_tune == PROCESSOR_2964_Z13)
if (s390_tune >= PROCESSOR_2964_Z13)
{
int units, i;
unsigned unit_mask, m = 1;
@ -14279,7 +14289,7 @@ s390_sched_variable_issue (FILE *file, int verbose, rtx_insn *insn, int more)
PRINT_SCHED_ATTR (S390_SCHED_ATTR_MASK_GROUPALONE, groupalone);
#undef PRINT_SCHED_ATTR
if (s390_tune == PROCESSOR_2964_Z13)
if (s390_tune >= PROCESSOR_2964_Z13)
{
unsigned int unit_mask, m = 1;
int units, j;
@ -14293,7 +14303,7 @@ s390_sched_variable_issue (FILE *file, int verbose, rtx_insn *insn, int more)
}
fprintf (file, " sched state: %d\n", s390_sched_state);
if (s390_tune == PROCESSOR_2964_Z13)
if (s390_tune >= PROCESSOR_2964_Z13)
{
int units, j;

View File

@ -37,12 +37,14 @@ enum processor_flags
PF_ZEC12 = 128,
PF_TX = 256,
PF_Z13 = 512,
PF_VX = 1024
PF_VX = 1024,
PF_ARCH12 = 2048,
PF_VXE = 4096
};
/* This is necessary to avoid a warning about comparing different enum
types. */
#define s390_tune_attr ((enum attr_cpu)s390_tune)
#define s390_tune_attr ((enum attr_cpu)(s390_tune > PROCESSOR_2964_Z13 ? PROCESSOR_2964_Z13 : s390_tune ))
/* These flags indicate that the generated code should run on a cpu
providing the respective hardware facility regardless of the
@ -87,11 +89,19 @@ enum processor_flags
#define TARGET_CPU_Z13 \
(s390_arch_flags & PF_Z13)
#define TARGET_CPU_Z13_P(opts) \
(opts->x_s390_arch_flags & PF_Z13)
(opts->x_s390_arch_flags & PF_Z13)
#define TARGET_CPU_VX \
(s390_arch_flags & PF_VX)
(s390_arch_flags & PF_VX)
#define TARGET_CPU_VX_P(opts) \
(opts->x_s390_arch_flags & PF_VX)
#define TARGET_CPU_ARCH12 \
(s390_arch_flags & PF_ARCH12)
#define TARGET_CPU_ARCH12_P(opts) \
(opts->x_s390_arch_flags & PF_ARCH12)
#define TARGET_CPU_VXE \
(s390_arch_flags & PF_VXE)
#define TARGET_CPU_VXE_P(opts) \
(opts->x_s390_arch_flags & PF_VXE)
#define TARGET_HARD_FLOAT_P(opts) (!TARGET_SOFT_FLOAT_P(opts))
@ -137,6 +147,13 @@ enum processor_flags
(TARGET_ZARCH_P (opts->x_target_flags) && TARGET_CPU_VX_P (opts) \
&& TARGET_OPT_VX_P (opts->x_target_flags) \
&& TARGET_HARD_FLOAT_P (opts->x_target_flags))
#define TARGET_ARCH12 (TARGET_ZARCH && TARGET_CPU_ARCH12)
#define TARGET_ARCH12_P(opts) \
(TARGET_ZARCH_P (opts->x_target_flags) && TARGET_CPU_ARCH12_P (opts))
#define TARGET_VXE \
(TARGET_VX && TARGET_CPU_VXE)
#define TARGET_VXE_P(opts) \
(TARGET_VX_P (opts) && TARGET_CPU_VXE_P (opts))
#ifdef HAVE_AS_MACHINE_MACHINEMODE
#define S390_USE_TARGET_ATTRIBUTE 1

View File

@ -478,11 +478,11 @@
;; distinguish between g5 and g6, but there are differences between the two
;; CPUs could in theory be modeled.
(define_attr "cpu" "g5,g6,z900,z990,z9_109,z9_ec,z10,z196,zEC12,z13"
(define_attr "cpu" "g5,g6,z900,z990,z9_109,z9_ec,z10,z196,zEC12,z13,arch12"
(const (symbol_ref "s390_tune_attr")))
(define_attr "cpu_facility"
"standard,ieee,zarch,cpu_zarch,longdisp,extimm,dfp,z10,z196,zEC12,vx,z13"
"standard,ieee,zarch,cpu_zarch,longdisp,extimm,dfp,z10,z196,zEC12,vx,z13,arch12,vxe"
(const_string "standard"))
(define_attr "enabled" ""
@ -532,6 +532,14 @@
(and (eq_attr "cpu_facility" "z13")
(match_test "TARGET_Z13"))
(const_int 1)
(and (eq_attr "cpu_facility" "arch12")
(match_test "TARGET_ARCH12"))
(const_int 1)
(and (eq_attr "cpu_facility" "vxe")
(match_test "TARGET_VXE"))
(const_int 1)
]
(const_int 0)))

View File

@ -112,6 +112,9 @@ Enum(processor_type) String(z13) Value(PROCESSOR_2964_Z13)
EnumValue
Enum(processor_type) String(arch11) Value(PROCESSOR_2964_Z13)
EnumValue
Enum(processor_type) String(arch12) Value(PROCESSOR_ARCH12)
EnumValue
Enum(processor_type) String(native) Value(PROCESSOR_NATIVE) DriverOnly

View File

@ -1,3 +1,8 @@
2017-03-24 Andreas Krebbel <krebbel@linux.vnet.ibm.com>
* gcc.target/s390/s390.exp: Run tests in arch12 and vxe dirs.
* lib/target-supports.exp: Add effective target check s390_vxe.
2017-03-24 Andreas Krebbel <krebbel@linux.vnet.ibm.com>
* gcc.target/s390/vector/vec-scalar-cmp-1.c: Adjust for the

View File

@ -209,6 +209,12 @@ dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*vector*/*.{c,S,C}]] \
dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/target-attribute/*.{c,S,C}]] \
"" $DEFAULT_CFLAGS
dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/arch12/*.{c,S,C}]] \
"" "-O3 -march=arch12 -mzarch"
dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/vxe/*.{c,S}]] \
"" "-O3 -march=arch12 -mzarch"
dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/md/*.{c,S,C}]] \
"" $DEFAULT_CFLAGS

View File

@ -8227,6 +8227,23 @@ proc check_effective_target_s390_vx { } {
}
} "-march=z13 -mzarch" ]
}
# Same as above but for the arch12 vector enhancement facility. Test
# is performed with the vector nand instruction.
proc check_effective_target_s390_vxe { } {
if ![istarget s390*-*-*] then {
return 0;
}
return [check_runtime s390_check_vxe {
int main (void)
{
asm ("vnn %%v24, %%v26, %%v28" : : : "v24", "v26", "v28");
return 0;
}
} "-march=arch12 -mzarch" ]
}
#For versions of ARM architectures that have hardware div insn,
#disable the divmod transform