diff options
author | krebbel <krebbel@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-12-02 08:02:05 +0000 |
---|---|---|
committer | krebbel <krebbel@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-12-02 08:02:05 +0000 |
commit | 0570ddf12f048976484882d756b040ac28ceecf7 (patch) | |
tree | a5991879e9d12bb69d626968632fea239e448ffb /gcc/config/s390 | |
parent | 1a65652ee2fe660d4cb35d99a0697c1e1ac87443 (diff) | |
download | gcc-0570ddf12f048976484882d756b040ac28ceecf7.tar.gz |
S/390: Fix vec_splat_* builtins.
gcc/testsuite/ChangeLog:
2015-12-02 Andreas Krebbel <krebbel@linux.vnet.ibm.com>
* gcc.target/s390/zvector/vec-splat-2.c: New test.
gcc/ChangeLog:
2015-12-02 Andreas Krebbel <krebbel@linux.vnet.ibm.com>
* config/s390/s390-builtin-types.def: New builtin types added.
* config/s390/s390-builtins.def: Add s390_vec_splat_* definitions.
* config/s390/s390.c (s390_expand_builtin): Always truncate
constants to the mode in the pattern.
* config/s390/vecintrin.h: Let the vec_splat_* macros point to the
respective builtin __builtin_s390_vec_splat_*.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@231157 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/config/s390')
-rw-r--r-- | gcc/config/s390/s390-builtin-types.def | 3 | ||||
-rw-r--r-- | gcc/config/s390/s390-builtins.def | 9 | ||||
-rw-r--r-- | gcc/config/s390/s390.c | 9 | ||||
-rw-r--r-- | gcc/config/s390/vecintrin.h | 16 |
4 files changed, 29 insertions, 8 deletions
diff --git a/gcc/config/s390/s390-builtin-types.def b/gcc/config/s390/s390-builtin-types.def index 724e0b6b9ec..bd3d534cbb2 100644 --- a/gcc/config/s390/s390-builtin-types.def +++ b/gcc/config/s390/s390-builtin-types.def @@ -139,16 +139,19 @@ DEF_FN_TYPE_2 (BT_FN_UV16QI_USHORT, B_VX, BT_UV16QI, BT_USHORT) DEF_FN_TYPE_2 (BT_FN_UV16QI_UV16QI, B_VX, BT_UV16QI, BT_UV16QI) DEF_FN_TYPE_2 (BT_FN_UV2DI_ULONGLONG, B_VX, BT_UV2DI, BT_ULONGLONG) DEF_FN_TYPE_2 (BT_FN_UV2DI_ULONGLONGCONSTPTR, B_VX, BT_UV2DI, BT_ULONGLONGCONSTPTR) +DEF_FN_TYPE_2 (BT_FN_UV2DI_USHORT, B_VX, BT_UV2DI, BT_USHORT) DEF_FN_TYPE_2 (BT_FN_UV2DI_UV2DI, B_VX, BT_UV2DI, BT_UV2DI) DEF_FN_TYPE_2 (BT_FN_UV2DI_UV4SI, B_VX, BT_UV2DI, BT_UV4SI) DEF_FN_TYPE_2 (BT_FN_UV4SI_UINT, B_VX, BT_UV4SI, BT_UINT) DEF_FN_TYPE_2 (BT_FN_UV4SI_UINTCONSTPTR, B_VX, BT_UV4SI, BT_UINTCONSTPTR) +DEF_FN_TYPE_2 (BT_FN_UV4SI_USHORT, B_VX, BT_UV4SI, BT_USHORT) DEF_FN_TYPE_2 (BT_FN_UV4SI_UV4SI, B_VX, BT_UV4SI, BT_UV4SI) DEF_FN_TYPE_2 (BT_FN_UV4SI_UV8HI, B_VX, BT_UV4SI, BT_UV8HI) DEF_FN_TYPE_2 (BT_FN_UV8HI_USHORT, B_VX, BT_UV8HI, BT_USHORT) DEF_FN_TYPE_2 (BT_FN_UV8HI_USHORTCONSTPTR, B_VX, BT_UV8HI, BT_USHORTCONSTPTR) DEF_FN_TYPE_2 (BT_FN_UV8HI_UV16QI, B_VX, BT_UV8HI, BT_UV16QI) DEF_FN_TYPE_2 (BT_FN_UV8HI_UV8HI, B_VX, BT_UV8HI, BT_UV8HI) +DEF_FN_TYPE_2 (BT_FN_V16QI_SCHAR, B_VX, BT_V16QI, BT_SCHAR) DEF_FN_TYPE_2 (BT_FN_V16QI_UCHAR, B_VX, BT_V16QI, BT_UCHAR) DEF_FN_TYPE_2 (BT_FN_V16QI_V16QI, B_VX, BT_V16QI, BT_V16QI) DEF_FN_TYPE_2 (BT_FN_V2DF_DBL, B_VX, BT_V2DF, BT_DBL) diff --git a/gcc/config/s390/s390-builtins.def b/gcc/config/s390/s390-builtins.def index b267b04e2a7..0b6961e21c9 100644 --- a/gcc/config/s390/s390-builtins.def +++ b/gcc/config/s390/s390-builtins.def @@ -362,6 +362,15 @@ B_DEF (s390_vrepih, vec_splatsv8hi, 0, B_DEF (s390_vrepif, vec_splatsv4si, 0, B_VX, O1_S16, BT_FN_V4SI_SHORT) B_DEF (s390_vrepig, vec_splatsv2di, 0, B_VX, O1_S16, BT_FN_V2DI_SHORT) +B_DEF (s390_vec_splat_u8, vec_splatsv16qi, 0, B_VX, O1_U8, BT_FN_UV16QI_UCHAR) +B_DEF (s390_vec_splat_s8, vec_splatsv16qi, 0, B_VX, O1_S8, BT_FN_V16QI_SCHAR) +B_DEF (s390_vec_splat_u16, vec_splatsv8hi, 0, B_VX, O1_U16, BT_FN_UV8HI_USHORT) +B_DEF (s390_vec_splat_s16, vec_splatsv8hi, 0, B_VX, O1_S16, BT_FN_V8HI_SHORT) +B_DEF (s390_vec_splat_u32, vec_splatsv4si, 0, B_VX, O1_U16, BT_FN_UV4SI_USHORT) +B_DEF (s390_vec_splat_s32, vec_splatsv4si, 0, B_VX, O1_S16, BT_FN_V4SI_SHORT) +B_DEF (s390_vec_splat_u64, vec_splatsv2di, 0, B_VX, O1_U16, BT_FN_UV2DI_USHORT) +B_DEF (s390_vec_splat_s64, vec_splatsv2di, 0, B_VX, O1_S16, BT_FN_V2DI_SHORT) + OB_DEF (s390_vec_insert, s390_vec_insert_s8, s390_vec_insert_dbl,B_VX, BT_FN_OV4SI_INT_OV4SI_INT) OB_DEF_VAR (s390_vec_insert_s8, s390_vlvgb, O3_ELEM, BT_OV_V16QI_SCHAR_V16QI_INT) OB_DEF_VAR (s390_vec_insert_u8, s390_vlvgb, O3_ELEM, BT_OV_UV16QI_UCHAR_UV16QI_INT) diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c index 73465ef21e4..7e7ed45230a 100644 --- a/gcc/config/s390/s390.c +++ b/gcc/config/s390/s390.c @@ -835,6 +835,15 @@ s390_expand_builtin (tree exp, rtx target, rtx subtarget ATTRIBUTE_UNUSED, insn_op = &insn_data[icode].operand[arity + nonvoid]; op[arity] = expand_expr (arg, NULL_RTX, insn_op->mode, EXPAND_NORMAL); + /* expand_expr truncates constants to the target mode only if it + is "convenient". However, our checks below rely on this + being done. */ + if (CONST_INT_P (op[arity]) + && SCALAR_INT_MODE_P (insn_op->mode) + && GET_MODE (op[arity]) != insn_op->mode) + op[arity] = GEN_INT (trunc_int_for_mode (INTVAL (op[arity]), + insn_op->mode)); + /* Wrap the expanded RTX for pointer types into a MEM expr with the proper mode. This allows us to use e.g. (match_operand "memory_operand"..) in the insn patterns instead of (mem diff --git a/gcc/config/s390/vecintrin.h b/gcc/config/s390/vecintrin.h index 2e26e3a0653..c24dcb42eb4 100644 --- a/gcc/config/s390/vecintrin.h +++ b/gcc/config/s390/vecintrin.h @@ -67,14 +67,14 @@ __lcbb(const void *ptr, int bndry) #define vec_genmasks_16 __builtin_s390_vgmh #define vec_genmasks_32 __builtin_s390_vgmf #define vec_genmasks_64 __builtin_s390_vgmg -#define vec_splat_u8 __builtin_s390_vlrepb -#define vec_splat_s8 __builtin_s390_vlrepb -#define vec_splat_u16 __builtin_s390_vlreph -#define vec_splat_s16 __builtin_s390_vlreph -#define vec_splat_u32 __builtin_s390_vlrepf -#define vec_splat_s32 __builtin_s390_vlrepf -#define vec_splat_u64 __builtin_s390_vlrepg -#define vec_splat_s64 __builtin_s390_vlrepg +#define vec_splat_u8 __builtin_s390_vec_splat_u8 +#define vec_splat_s8 __builtin_s390_vec_splat_s8 +#define vec_splat_u16 __builtin_s390_vec_splat_u16 +#define vec_splat_s16 __builtin_s390_vec_splat_s16 +#define vec_splat_u32 __builtin_s390_vec_splat_u32 +#define vec_splat_s32 __builtin_s390_vec_splat_s32 +#define vec_splat_u64 __builtin_s390_vec_splat_u64 +#define vec_splat_s64 __builtin_s390_vec_splat_s64 #define vec_add_u128 __builtin_s390_vaq #define vec_addc_u128 __builtin_s390_vaccq #define vec_adde_u128 __builtin_s390_vacq |