aboutsummaryrefslogtreecommitdiff
path: root/gcc/config
diff options
context:
space:
mode:
authorAndreas Krebbel <krebbel@linux.ibm.com>2019-04-02 11:03:40 +0000
committerAndreas Krebbel <krebbel@gcc.gnu.org>2019-04-02 11:03:40 +0000
commitb112d1c928df130cd5481e0f751242c7217ec83d (patch)
treeb2d1ef70af524dccd721eac0779fdeccf2e0c38f /gcc/config
parent3278804e59a76e7f140a522286d7ac88c2cdb916 (diff)
downloadgcc-b112d1c928df130cd5481e0f751242c7217ec83d.zip
gcc-b112d1c928df130cd5481e0f751242c7217ec83d.tar.gz
gcc-b112d1c928df130cd5481e0f751242c7217ec83d.tar.bz2
S/390: arch13: vector load/store byte reversed element for builtins
2019-04-02 Andreas Krebbel <krebbel@linux.ibm.com> * config/s390/vecintrin.h: Map vec_vster low-level builtins to vec_vler. * config/s390/vx-builtins.md ("*vec_insert_and_zero_bswap<mode>") ("*vec_set_bswap_elem<mode>", "*vec_set_bswap_vec<mode>") ("*vec_extract_bswap_vec<mode>", "*vec_extract_bswap_elem<mode>"): New insn definitions. gcc/testsuite/ChangeLog: 2019-04-02 Andreas Krebbel <krebbel@linux.ibm.com> * gcc.target/s390/zvector/bswap-and-replicate-1.c: New test. * gcc.target/s390/zvector/get-element-bswap-1.c: New test. * gcc.target/s390/zvector/get-element-bswap-2.c: New test. * gcc.target/s390/zvector/get-element-bswap-3.c: New test. * gcc.target/s390/zvector/get-element-bswap-4.c: New test. * gcc.target/s390/zvector/set-element-bswap-1.c: New test. * gcc.target/s390/zvector/set-element-bswap-2.c: New test. * gcc.target/s390/zvector/set-element-bswap-3.c: New test. From-SVN: r270086
Diffstat (limited to 'gcc/config')
-rw-r--r--gcc/config/s390/vecintrin.h14
-rw-r--r--gcc/config/s390/vx-builtins.md63
2 files changed, 77 insertions, 0 deletions
diff --git a/gcc/config/s390/vecintrin.h b/gcc/config/s390/vecintrin.h
index 1220bf6..05707a1 100644
--- a/gcc/config/s390/vecintrin.h
+++ b/gcc/config/s390/vecintrin.h
@@ -159,6 +159,20 @@ __lcbb(const void *ptr, int bndry)
| __VEC_CLASS_FP_SUBNORMAL_N, &cc); \
cc != 3 ? 1 : 0; \
})
+
+#define vec_vstbrh vec_vlbrh
+#define vec_vstbrf vec_vlbrf
+#define vec_vstbrg vec_vlbrg
+#define vec_vstbrq vec_vlbrq
+#define vec_vstbrf_flt vec_vlbrf_flt
+#define vec_vstbrg_dbl vec_vlbrg_dbl
+
+#define vec_vsterb vec_vlerb
+#define vec_vsterh vec_vlerh
+#define vec_vsterf vec_vlerh
+#define vec_vsterg vec_vlerh
+#define vec_vsterf_flt vec_vlerf_flt
+#define vec_vsterg_dbl vec_vlerg_dbl
#define vec_gather_element __builtin_s390_vec_gather_element
#define vec_xl __builtin_s390_vec_xl
#define vec_xld2 __builtin_s390_vec_xld2
diff --git a/gcc/config/s390/vx-builtins.md b/gcc/config/s390/vx-builtins.md
index 55b49f4..8d837c4 100644
--- a/gcc/config/s390/vx-builtins.md
+++ b/gcc/config/s390/vx-builtins.md
@@ -181,6 +181,18 @@
"vllez<bhfgq>\t%v0,%1"
[(set_attr "op_type" "VRX")])
+; vec_revb (vec_insert_and_zero(x)) bswap-and-replicate-1.c
+; vllebrzh, vllebrzf, vllebrzg
+(define_insn "*vec_insert_and_zero_bswap<mode>"
+ [(set (match_operand:V_HW_HSD 0 "register_operand" "=v")
+ (bswap:V_HW_HSD (unspec:V_HW_HSD
+ [(match_operand:<non_vec> 1 "memory_operand" "R")]
+ UNSPEC_VEC_INSERT_AND_ZERO)))]
+ "TARGET_VXE2"
+ "vllebrz<bhfgq>\t%v0,%1"
+ [(set_attr "op_type" "VRX")])
+
+
(define_insn "vlbb"
[(set (match_operand:V16QI 0 "register_operand" "=v")
(unspec:V16QI [(match_operand:BLK 1 "memory_operand" "R")
@@ -2139,3 +2151,54 @@
constv = force_const_mem (V16QImode, gen_rtx_CONST_VECTOR (V16QImode, gen_rtvec_v (16, perm_rtx)));
emit_move_insn (operands[2], constv);
})
+
+; vec_insert (__builtin_bswap32 (*a), b, 1) set-element-bswap-2.c
+; b[1] = __builtin_bswap32 (*a) set-element-bswap-3.c
+; vlebrh, vlebrf, vlebrg
+(define_insn "*vec_set_bswap_elem<mode>"
+ [(set (match_operand:V_HW_HSD 0 "register_operand" "=v")
+ (unspec:V_HW_HSD [(bswap:<non_vec> (match_operand:<non_vec> 1 "memory_operand" "R"))
+ (match_operand:SI 2 "const_int_operand" "C")
+ (match_operand:V_HW_HSD 3 "register_operand" "0")]
+ UNSPEC_VEC_SET))]
+ "TARGET_VXE2 && UINTVAL (operands[2]) < GET_MODE_NUNITS (<V_HW_HSD:MODE>mode)"
+ "vlebr<bhfgq>\t%v0,%1,%2"
+ [(set_attr "op_type" "VRX")])
+
+; vec_revb (vec_insert (*a, vec_revb (b), 1)) set-element-bswap-1.c
+; vlebrh, vlebrf, vlebrg
+(define_insn "*vec_set_bswap_vec<mode>"
+ [(set (match_operand:V_HW_HSD 0 "register_operand" "=v")
+ (bswap:V_HW_HSD
+ (unspec:V_HW_HSD [(match_operand:<non_vec> 1 "memory_operand" "R")
+ (match_operand:SI 2 "const_int_operand" "C")
+ (bswap:V_HW_HSD (match_operand:V_HW_HSD 3 "register_operand" "0"))]
+ UNSPEC_VEC_SET)))]
+ "TARGET_VXE2 && UINTVAL (operands[2]) < GET_MODE_NUNITS (<V_HW_HSD:MODE>mode)"
+ "vlebr<bhfgq>\t%v0,%1,%2"
+ [(set_attr "op_type" "VRX")])
+
+; *a = vec_extract (vec_revb (b), 1); get-element-bswap-3.c
+; *a = vec_revb (b)[1]; get-element-bswap-4.c
+; vstebrh, vstebrf, vstebrg
+(define_insn "*vec_extract_bswap_vec<mode>"
+ [(set (match_operand:<non_vec> 0 "memory_operand" "=R")
+ (unspec:<non_vec> [(bswap:V_HW_HSD (match_operand:V_HW_HSD 1 "register_operand" "v"))
+ (match_operand:SI 2 "const_int_operand" "C")]
+ UNSPEC_VEC_EXTRACT))]
+ "TARGET_VXE2 && UINTVAL (operands[2]) < GET_MODE_NUNITS (<V_HW_HSD:MODE>mode)"
+ "vstebr<bhfgq>\t%v1,%0,%2"
+ [(set_attr "op_type" "VRX")])
+
+; *a = __builtin_bswap32 (vec_extract (b, 1)); get-element-bswap-1.c
+; *a = __builtin_bswap32 (b[1]); get-element-bswap-2.c
+; vstebrh, vstebrf, vstebrg
+(define_insn "*vec_extract_bswap_elem<mode>"
+ [(set (match_operand:<non_vec> 0 "memory_operand" "=R")
+ (bswap:<non_vec>
+ (unspec:<non_vec> [(match_operand:V_HW_HSD 1 "register_operand" "v")
+ (match_operand:SI 2 "const_int_operand" "C")]
+ UNSPEC_VEC_EXTRACT)))]
+ "TARGET_VXE2 && UINTVAL (operands[2]) < GET_MODE_NUNITS (<V_HW_HSD:MODE>mode)"
+ "vstebr<bhfgq>\t%v1,%0,%2"
+ [(set_attr "op_type" "VRX")])