+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
| 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
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
;;
*)
case 0x2964:
cpu = "z13";
break;
+ default:
+ cpu = "arch12";
+ break;
}
}
if (has_features == 0 && strncmp (buf, "features", 8) == 0)
#undef B_INT
#undef B_HTM
#undef B_VX
+#undef B_VXE
#undef BFLAGS_MASK_INIT
#define BFLAGS_MASK_INIT (B_INT)
#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>)
/* 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);
PROCESSOR_2817_Z196,
PROCESSOR_2827_ZEC12,
PROCESSOR_2964_Z13,
+ PROCESSOR_ARCH12,
PROCESSOR_NATIVE,
PROCESSOR_max
};
{ "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 }
};
"(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)
instruction gets issued per cycle. */
case PROCESSOR_2827_ZEC12:
case PROCESSOR_2964_Z13:
+ case PROCESSOR_ARCH12:
default:
return 1;
}
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))
switch (s390_tune)
{
case PROCESSOR_2964_Z13:
+ case PROCESSOR_ARCH12:
*units = 3;
if (get_attr_z13_unit_lsu (insn))
mask |= 1 << 0;
break;
}
- if (s390_tune == PROCESSOR_2964_Z13)
+ if (s390_tune >= PROCESSOR_2964_Z13)
{
int units, i;
unsigned unit_mask, m = 1;
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;
}
}
- if (s390_tune == PROCESSOR_2964_Z13)
+ if (s390_tune >= PROCESSOR_2964_Z13)
{
int units, i;
unsigned unit_mask, m = 1;
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;
}
fprintf (file, " sched state: %d\n", s390_sched_state);
- if (s390_tune == PROCESSOR_2964_Z13)
+ if (s390_tune >= PROCESSOR_2964_Z13)
{
int units, j;
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
#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))
(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
;; 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" ""
(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)))
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
+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
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
}
} "-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