From: Andreas Krebbel Date: Fri, 6 Oct 2017 09:18:37 +0000 (+0000) Subject: PR82317: S/390: Fix vec_min/vec_max builtins for IBM z13. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=6fcb90c624db95f1b483e0d403e95215d4732bd6;p=gcc.git PR82317: S/390: Fix vec_min/vec_max builtins for IBM z13. With IBM z14 a hardware instruction for floating point min and max has been added while for IBM z13 we emulated min/max for vector double with compare and select. This testcase makes sure that we fall back to the emulated variant when compiling for z13. gcc/ChangeLog: 2017-10-06 Andreas Krebbel PR target/82317 * config/s390/s390-builtin-types.def: Regenerate. * config/s390/s390-builtins.def (s390_vfmaxdb_4, s390_vfmindb_4): Change flag from B_VXE to B_VX. (s390_vec_min_dbl): Remove B_VXE flag. gcc/testsuite/ChangeLog: 2017-10-06 Andreas Krebbel PR target/82317 * gcc.target/s390/zvector/pr82317.c: New test. From-SVN: r253480 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 218260c5109..a69364a896f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2017-10-06 Andreas Krebbel + + PR target/82317 + * config/s390/s390-builtin-types.def: Regenerate. + * config/s390/s390-builtins.def (s390_vfmaxdb_4, s390_vfmindb_4): + Change flag from B_VXE to B_VX. + (s390_vec_min_dbl): Remove B_VXE flag. + 2017-10-06 Richard Biener * graphite-isl-ast-to-gimple.c: Include ssa.h and tree-ssa.h. diff --git a/gcc/config/s390/s390-builtin-types.def b/gcc/config/s390/s390-builtin-types.def index b7f33030eb9..b466aa13e63 100644 --- a/gcc/config/s390/s390-builtin-types.def +++ b/gcc/config/s390/s390-builtin-types.def @@ -54,74 +54,74 @@ s390_builtin_types[T6]) DEF_TYPE (BT_INT, integer_type_node, 0) DEF_TYPE (BT_VOID, void_type_node, 0) -DEF_TYPE (BT_ULONG, long_unsigned_type_node, 0) DEF_TYPE (BT_UINT64, c_uint64_type_node, 0) -DEF_TYPE (BT_INT128, intTI_type_node, 0) DEF_TYPE (BT_UINT, unsigned_type_node, 0) DEF_TYPE (BT_VOIDCONST, void_type_node, 1) -DEF_TYPE (BT_USHORTCONST, short_unsigned_type_node, 1) -DEF_TYPE (BT_SHORTCONST, short_integer_type_node, 1) -DEF_TYPE (BT_UCHARCONST, unsigned_char_type_node, 1) DEF_TYPE (BT_INTCONST, integer_type_node, 1) -DEF_TYPE (BT_SCHARCONST, signed_char_type_node, 1) DEF_TYPE (BT_UCHAR, unsigned_char_type_node, 0) -DEF_TYPE (BT_SHORT, short_integer_type_node, 0) -DEF_TYPE (BT_LONG, long_integer_type_node, 0) -DEF_TYPE (BT_SCHAR, signed_char_type_node, 0) -DEF_TYPE (BT_USHORT, short_unsigned_type_node, 0) -DEF_TYPE (BT_ULONGLONG, long_long_unsigned_type_node, 0) -DEF_TYPE (BT_DBLCONST, double_type_node, 1) +DEF_TYPE (BT_UINTCONST, unsigned_type_node, 1) DEF_TYPE (BT_FLT, float_type_node, 0) -DEF_TYPE (BT_DBL, double_type_node, 0) DEF_TYPE (BT_FLTCONST, float_type_node, 1) -DEF_TYPE (BT_ULONGLONGCONST, long_long_unsigned_type_node, 1) DEF_TYPE (BT_LONGLONG, long_long_integer_type_node, 0) +DEF_TYPE (BT_ULONGLONG, long_long_unsigned_type_node, 0) DEF_TYPE (BT_LONGLONGCONST, long_long_integer_type_node, 1) -DEF_TYPE (BT_UINTCONST, unsigned_type_node, 1) -DEF_VECTOR_TYPE (BT_UV2DI, BT_ULONGLONG, 2) -DEF_VECTOR_TYPE (BT_V2DI, BT_LONGLONG, 2) -DEF_VECTOR_TYPE (BT_V8HI, BT_SHORT, 8) +DEF_TYPE (BT_ULONGLONGCONST, long_long_unsigned_type_node, 1) +DEF_TYPE (BT_DBL, double_type_node, 0) +DEF_TYPE (BT_DBLCONST, double_type_node, 1) +DEF_TYPE (BT_USHORT, short_unsigned_type_node, 0) +DEF_TYPE (BT_SCHAR, signed_char_type_node, 0) +DEF_TYPE (BT_LONG, long_integer_type_node, 0) +DEF_TYPE (BT_SHORT, short_integer_type_node, 0) +DEF_TYPE (BT_SCHARCONST, signed_char_type_node, 1) +DEF_TYPE (BT_UCHARCONST, unsigned_char_type_node, 1) +DEF_TYPE (BT_SHORTCONST, short_integer_type_node, 1) +DEF_TYPE (BT_USHORTCONST, short_unsigned_type_node, 1) +DEF_TYPE (BT_INT128, intTI_type_node, 0) +DEF_TYPE (BT_ULONG, long_unsigned_type_node, 0) DEF_VECTOR_TYPE (BT_V4SI, BT_INT, 4) DEF_VECTOR_TYPE (BT_UV4SI, BT_UINT, 4) -DEF_VECTOR_TYPE (BT_V16QI, BT_SCHAR, 16) -DEF_VECTOR_TYPE (BT_UV8HI, BT_USHORT, 8) DEF_VECTOR_TYPE (BT_V4SF, BT_FLT, 4) +DEF_VECTOR_TYPE (BT_V2DI, BT_LONGLONG, 2) +DEF_VECTOR_TYPE (BT_UV2DI, BT_ULONGLONG, 2) DEF_VECTOR_TYPE (BT_V2DF, BT_DBL, 2) DEF_VECTOR_TYPE (BT_UV16QI, BT_UCHAR, 16) -DEF_POINTER_TYPE (BT_USHORTPTR, BT_USHORT) -DEF_POINTER_TYPE (BT_UINTCONSTPTR, BT_UINTCONST) +DEF_VECTOR_TYPE (BT_UV8HI, BT_USHORT, 8) +DEF_VECTOR_TYPE (BT_V16QI, BT_SCHAR, 16) +DEF_VECTOR_TYPE (BT_V8HI, BT_SHORT, 8) DEF_POINTER_TYPE (BT_VOIDPTR, BT_VOID) -DEF_POINTER_TYPE (BT_ULONGLONGCONSTPTR, BT_ULONGLONGCONST) DEF_POINTER_TYPE (BT_UINT64PTR, BT_UINT64) +DEF_POINTER_TYPE (BT_VOIDCONSTPTR, BT_VOIDCONST) +DEF_POINTER_TYPE (BT_INTCONSTPTR, BT_INTCONST) +DEF_POINTER_TYPE (BT_UINTCONSTPTR, BT_UINTCONST) DEF_POINTER_TYPE (BT_FLTCONSTPTR, BT_FLTCONST) -DEF_POINTER_TYPE (BT_USHORTCONSTPTR, BT_USHORTCONST) +DEF_POINTER_TYPE (BT_LONGLONGCONSTPTR, BT_LONGLONGCONST) +DEF_POINTER_TYPE (BT_ULONGLONGCONSTPTR, BT_ULONGLONGCONST) +DEF_POINTER_TYPE (BT_DBLCONSTPTR, BT_DBLCONST) DEF_POINTER_TYPE (BT_SCHARPTR, BT_SCHAR) DEF_POINTER_TYPE (BT_UCHARPTR, BT_UCHAR) -DEF_POINTER_TYPE (BT_VOIDCONSTPTR, BT_VOIDCONST) -DEF_POINTER_TYPE (BT_LONGLONGCONSTPTR, BT_LONGLONGCONST) DEF_POINTER_TYPE (BT_SHORTPTR, BT_SHORT) -DEF_POINTER_TYPE (BT_DBLCONSTPTR, BT_DBLCONST) +DEF_POINTER_TYPE (BT_USHORTPTR, BT_USHORT) DEF_POINTER_TYPE (BT_INTPTR, BT_INT) DEF_POINTER_TYPE (BT_UINTPTR, BT_UINT) DEF_POINTER_TYPE (BT_LONGLONGPTR, BT_LONGLONG) DEF_POINTER_TYPE (BT_ULONGLONGPTR, BT_ULONGLONG) -DEF_POINTER_TYPE (BT_INTCONSTPTR, BT_INTCONST) +DEF_POINTER_TYPE (BT_FLTPTR, BT_FLT) DEF_POINTER_TYPE (BT_DBLPTR, BT_DBL) -DEF_POINTER_TYPE (BT_SHORTCONSTPTR, BT_SHORTCONST) -DEF_POINTER_TYPE (BT_UCHARCONSTPTR, BT_UCHARCONST) DEF_POINTER_TYPE (BT_SCHARCONSTPTR, BT_SCHARCONST) -DEF_POINTER_TYPE (BT_FLTPTR, BT_FLT) -DEF_DISTINCT_TYPE (BT_BCHAR, BT_UCHAR) -DEF_DISTINCT_TYPE (BT_BSHORT, BT_USHORT) +DEF_POINTER_TYPE (BT_UCHARCONSTPTR, BT_UCHARCONST) +DEF_POINTER_TYPE (BT_SHORTCONSTPTR, BT_SHORTCONST) +DEF_POINTER_TYPE (BT_USHORTCONSTPTR, BT_USHORTCONST) DEF_DISTINCT_TYPE (BT_BINT, BT_UINT) DEF_DISTINCT_TYPE (BT_BLONGLONG, BT_ULONGLONG) -DEF_OPAQUE_VECTOR_TYPE (BT_BV8HI, BT_BSHORT, 8) +DEF_DISTINCT_TYPE (BT_BCHAR, BT_UCHAR) +DEF_DISTINCT_TYPE (BT_BSHORT, BT_USHORT) DEF_OPAQUE_VECTOR_TYPE (BT_OV4SI, BT_INT, 4) -DEF_OPAQUE_VECTOR_TYPE (BT_BV16QI, BT_BCHAR, 16) -DEF_OPAQUE_VECTOR_TYPE (BT_BV2DI, BT_BLONGLONG, 2) -DEF_OPAQUE_VECTOR_TYPE (BT_OV2DI, BT_LONGLONG, 2) DEF_OPAQUE_VECTOR_TYPE (BT_OUV4SI, BT_UINT, 4) DEF_OPAQUE_VECTOR_TYPE (BT_BV4SI, BT_BINT, 4) +DEF_OPAQUE_VECTOR_TYPE (BT_BV2DI, BT_BLONGLONG, 2) +DEF_OPAQUE_VECTOR_TYPE (BT_BV16QI, BT_BCHAR, 16) +DEF_OPAQUE_VECTOR_TYPE (BT_BV8HI, BT_BSHORT, 8) +DEF_OPAQUE_VECTOR_TYPE (BT_OV2DI, BT_LONGLONG, 2) DEF_FN_TYPE_0 (BT_FN_INT, BT_INT) DEF_FN_TYPE_0 (BT_FN_UINT, BT_UINT) DEF_FN_TYPE_1 (BT_FN_INT_INT, BT_INT, BT_INT) diff --git a/gcc/config/s390/s390-builtins.def b/gcc/config/s390/s390-builtins.def index 3f7bae7ca56..7007e388dda 100644 --- a/gcc/config/s390/s390-builtins.def +++ b/gcc/config/s390/s390-builtins.def @@ -1701,7 +1701,7 @@ B_DEF (s390_vmxlg, umaxv2di3, 0, B_DEF (s390_vfmaxsb, vfmaxv4sf, 0, B_VXE, O3_U4, BT_FN_V4SF_V4SF_V4SF_INT) B_DEF (s390_vfmaxdb, vfmaxv2df, 0, B_VXE, O3_U4, BT_FN_V2DF_V2DF_V2DF_INT) B_DEF (s390_vfmaxsb_4, smaxv4sf3, 0, B_INT | B_VXE, 0, BT_FN_V4SF_V4SF_V4SF) -B_DEF (s390_vfmaxdb_4, smaxv2df3, 0, B_INT | B_VXE, 0, BT_FN_V2DF_V2DF_V2DF) +B_DEF (s390_vfmaxdb_4, smaxv2df3, 0, B_INT | B_VX, 0, BT_FN_V2DF_V2DF_V2DF) OB_DEF (s390_vec_min, s390_vec_min_s8_a, s390_vec_min_dbl, B_VX, BT_FN_OV4SI_OV4SI_OV4SI) OB_DEF_VAR (s390_vec_min_s8_a, s390_vmnb, B_DEP, 0, BT_OV_V16QI_BV16QI_V16QI) @@ -1729,7 +1729,7 @@ OB_DEF_VAR (s390_vec_min_u64_a, s390_vmnlg, B_DEP, OB_DEF_VAR (s390_vec_min_u64_b, s390_vmnlg, 0, 0, BT_OV_UV2DI_UV2DI_UV2DI) OB_DEF_VAR (s390_vec_min_u64_c, s390_vmnlg, B_DEP, 0, BT_OV_UV2DI_UV2DI_BV2DI) OB_DEF_VAR (s390_vec_min_flt, s390_vfminsb_4, B_VXE, 0, BT_OV_V4SF_V4SF_V4SF) -OB_DEF_VAR (s390_vec_min_dbl, s390_vfmindb_4, B_VXE, 0, BT_OV_V2DF_V2DF_V2DF) +OB_DEF_VAR (s390_vec_min_dbl, s390_vfmindb_4, 0, 0, BT_OV_V2DF_V2DF_V2DF) B_DEF (s390_vmnb, sminv16qi3, 0, B_VX, 0, BT_FN_V16QI_BV16QI_V16QI) B_DEF (s390_vmnlb, uminv16qi3, 0, B_VX, 0, BT_FN_UV16QI_UV16QI_UV16QI) @@ -1742,7 +1742,7 @@ B_DEF (s390_vmnlg, uminv2di3, 0, B_DEF (s390_vfminsb, vfminv4sf, 0, B_VXE, O3_U4, BT_FN_V4SF_V4SF_V4SF_INT) B_DEF (s390_vfmindb, vfminv2df, 0, B_VXE, O3_U4, BT_FN_V2DF_V2DF_V2DF_INT) B_DEF (s390_vfminsb_4, sminv4sf3, 0, B_INT | B_VXE, 0, BT_FN_V4SF_V4SF_V4SF) /* vfminsb */ -B_DEF (s390_vfmindb_4, sminv2df3, 0, B_INT | B_VXE, 0, BT_FN_V2DF_V2DF_V2DF) /* vfmindb */ +B_DEF (s390_vfmindb_4, sminv2df3, 0, B_INT | B_VX, 0, BT_FN_V2DF_V2DF_V2DF) /* vfmindb */ OB_DEF (s390_vec_mladd, s390_vec_mladd_u8, s390_vec_mladd_s32_c,B_VX, BT_FN_OV4SI_OV4SI_OV4SI_OV4SI) OB_DEF_VAR (s390_vec_mladd_u8, s390_vmalb, 0, 0, BT_OV_UV16QI_UV16QI_UV16QI_UV16QI) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 64783cdf70b..181935b4003 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2017-10-06 Andreas Krebbel + + PR target/82317 + * gcc.target/s390/zvector/pr82317.c: New test. + 2017-10-06 Richard Biener PR tree-optimization/82422 diff --git a/gcc/testsuite/gcc.target/s390/zvector/pr82317.c b/gcc/testsuite/gcc.target/s390/zvector/pr82317.c new file mode 100644 index 00000000000..4b7cc834043 --- /dev/null +++ b/gcc/testsuite/gcc.target/s390/zvector/pr82317.c @@ -0,0 +1,19 @@ +/* { dg-do compile { target { s390*-*-* } } } */ +/* { dg-options "-march=z13 -mzarch -mzvector" } */ + +/* With IBM z14 a hardware instruction for floating point min and max + has been added while for IBM z13 we emulated min/max for vector + double with compare and select. This testcase makes sure that we + fall back to the emulated variant when compiling for z13. */ + +#include + +vector double +foo (vector double a, vector double b) { + return vec_min (a, b); +} + +vector double +bar (vector double a, vector double b) { + return vec_max (a, b); +}