diff options
author | Stefan Schulze Frielinghaus <stefansf@linux.ibm.com> | 2024-06-17 08:37:11 +0200 |
---|---|---|
committer | Stefan Schulze Frielinghaus <stefansf@linux.ibm.com> | 2024-06-17 08:37:11 +0200 |
commit | 9965acb77cbd686283a9d0a867c80b1e710f46b9 (patch) | |
tree | 253738455048e444fc7813a14d1282f8376385cf /gcc | |
parent | 2ab143df110a40bd41b5368ef84819953bf971b1 (diff) | |
download | gcc-9965acb77cbd686283a9d0a867c80b1e710f46b9.zip gcc-9965acb77cbd686283a9d0a867c80b1e710f46b9.tar.gz gcc-9965acb77cbd686283a9d0a867c80b1e710f46b9.tar.bz2 |
s390: Extend two element float vector
This implements a V2SF -> V2DF extend.
gcc/ChangeLog:
* config/s390/vector.md (*vmrhf_half<mode>): New.
(extendv2sfv2df2): New.
gcc/testsuite/ChangeLog:
* gcc.target/s390/vector/vec-extend-3.c: New test.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/config/s390/vector.md | 28 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/s390/vector/vec-extend-3.c | 18 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/s390/vector/vgm-df-1.c | 30 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/s390/vector/vgm-di-1.c | 102 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/s390/vector/vgm-hi-1.c | 212 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/s390/vector/vgm-int128-1.c | 64 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/s390/vector/vgm-longdouble-1.c | 55 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/s390/vector/vgm-qi-1.c | 213 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/s390/vector/vgm-sf-1.c | 43 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/s390/vector/vgm-si-1.c | 146 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/s390/vector/vgm-ti-1.c | 63 |
11 files changed, 974 insertions, 0 deletions
diff --git a/gcc/config/s390/vector.md b/gcc/config/s390/vector.md index a931a4b..40de0c7 100644 --- a/gcc/config/s390/vector.md +++ b/gcc/config/s390/vector.md @@ -895,6 +895,17 @@ "vmrhf\t%0,%1,%2"; [(set_attr "op_type" "VRR")]) +(define_insn "*vmrhf_half<mode>" + [(set (match_operand:V_HW_4 0 "register_operand" "=v") + (vec_select:V_HW_4 + (vec_concat:V_HW_4 (match_operand:<vec_halfnumelts> 1 "register_operand" "v") + (match_operand:<vec_halfnumelts> 2 "register_operand" "v")) + (parallel [(const_int 0) (const_int 2) + (const_int 1) (const_int 3)])))] + "TARGET_VX" + "vmrhf\t%0,%1,%2"; + [(set_attr "op_type" "VRR")]) + (define_insn "*vmrlf" [(set (match_operand:V_HW_4 0 "register_operand" "=v") (vec_select:V_HW_4 @@ -2394,6 +2405,23 @@ "vup<zero_extend>h<bhfgq>\t%0,%1" [(set_attr "op_type" "VRR")]) +(define_expand "extendv2sfv2df2" + [(set (match_dup 2) + (vec_select:V4SF + (vec_concat:V4SF (match_operand:V2SF 1 "register_operand") + (match_dup 1)) + (parallel [(const_int 0) (const_int 2) + (const_int 1) (const_int 3)]))) + (set (match_operand:V2DF 0 "register_operand") + (float_extend:V2DF + (vec_select:V2SF + (match_dup 2) + (parallel [(const_int 0) (const_int 2)]))))] + "TARGET_VX" +{ + operands[2] = gen_reg_rtx (V4SFmode); +}) + ;; vector unpack v16qi ; signed diff --git a/gcc/testsuite/gcc.target/s390/vector/vec-extend-3.c b/gcc/testsuite/gcc.target/s390/vector/vec-extend-3.c new file mode 100644 index 0000000..2b02e7b --- /dev/null +++ b/gcc/testsuite/gcc.target/s390/vector/vec-extend-3.c @@ -0,0 +1,18 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -march=z13 -mzarch" } */ +/* { dg-final { check-function-bodies "**" "" "" } } */ + +typedef float v2sf __attribute__ ((vector_size (8))); +typedef double v2df __attribute__ ((vector_size (16))); + +/* +** extendv2sfv2df2: +** vmrhf %v24,%v24,%v24 +** vldeb %v24,%v24 +** br %r14 +*/ + +v2df extendv2sfv2df2 (v2sf x) +{ + return __builtin_convertvector (x, v2df); +} diff --git a/gcc/testsuite/gcc.target/s390/vector/vgm-df-1.c b/gcc/testsuite/gcc.target/s390/vector/vgm-df-1.c new file mode 100644 index 0000000..07aa6b9 --- /dev/null +++ b/gcc/testsuite/gcc.target/s390/vector/vgm-df-1.c @@ -0,0 +1,30 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -march=z13 -mzarch" } */ +/* { dg-final { check-function-bodies "**" "" "" } } */ + +typedef double v1df __attribute__ ((vector_size (8))); +typedef double v2df __attribute__ ((vector_size (16))); + +/* +** test_v1df_via_vgmb: +** vgmb %v24,0,1 +** br %r14 +*/ + +v1df +test_v1df_via_vgmb (void) +{ + return (v1df){-8577.505882352939806878566741943359375}; +} + +/* +** test_v2df_via_vgmb: +** vgmb %v24,0,1 +** br %r14 +*/ + +v2df +test_v2df_via_vgmb (void) +{ + return (v2df){-8577.505882352939806878566741943359375, -8577.505882352939806878566741943359375}; +} diff --git a/gcc/testsuite/gcc.target/s390/vector/vgm-di-1.c b/gcc/testsuite/gcc.target/s390/vector/vgm-di-1.c new file mode 100644 index 0000000..fa608f2 --- /dev/null +++ b/gcc/testsuite/gcc.target/s390/vector/vgm-di-1.c @@ -0,0 +1,102 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -march=z13 -mzarch" } */ +/* { dg-final { check-function-bodies "**" "" "" } } */ + +typedef long long v1di __attribute__ ((vector_size (8))); +typedef long long v2di __attribute__ ((vector_size (16))); + +/* +** test_v1di_via_vgmb: +** vgmb %v24,0,2 +** br %r14 +*/ + +v1di +test_v1di_via_vgmb (void) +{ + return (v1di){0xe0e0e0e0e0e0e0e0}; +} + +/* +** test_v2di_via_vgmb: +** vgmb %v24,0,2 +** br %r14 +*/ + +v2di +test_v2di_via_vgmb (void) +{ + return (v2di){0xe0e0e0e0e0e0e0e0, 0xe0e0e0e0e0e0e0e0}; +} + +/* +** test_v1di_via_vgmb_wrap: +** vgmb %v24,5,2 +** br %r14 +*/ + +v1di +test_v1di_via_vgmb_wrap (void) +{ + return (v1di){0xe7e7e7e7e7e7e7e7}; +} + +/* +** test_v2di_via_vgmb_wrap: +** vgmb %v24,5,2 +** br %r14 +*/ + +v2di +test_v2di_via_vgmb_wrap (void) +{ + return (v2di){0xe7e7e7e7e7e7e7e7, 0xe7e7e7e7e7e7e7e7}; +} + +/* +** test_v1di_via_vgmh: +** vgmh %v24,5,10 +** br %r14 +*/ + +v1di +test_v1di_via_vgmh (void) +{ + return (v1di){0x7e007e007e007e0}; +} + +/* +** test_v2di_via_vgmh: +** vgmh %v24,5,10 +** br %r14 +*/ + +v2di +test_v2di_via_vgmh (void) +{ + return (v2di){0x7e007e007e007e0, 0x7e007e007e007e0}; +} + +/* +** test_v1di_via_vgmg: +** vgmg %v24,17,46 +** br %r14 +*/ + +v1di +test_v1di_via_vgmg (void) +{ + return (v1di){0x7ffffffe0000}; +} + +/* +** test_v2di_via_vgmg: +** vgmg %v24,17,46 +** br %r14 +*/ + +v2di +test_v2di_via_vgmg (void) +{ + return (v2di){0x7ffffffe0000, 0x7ffffffe0000}; +} diff --git a/gcc/testsuite/gcc.target/s390/vector/vgm-hi-1.c b/gcc/testsuite/gcc.target/s390/vector/vgm-hi-1.c new file mode 100644 index 0000000..da06479 --- /dev/null +++ b/gcc/testsuite/gcc.target/s390/vector/vgm-hi-1.c @@ -0,0 +1,212 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -march=z13 -mzarch" } */ +/* { dg-final { check-function-bodies "**" "" "" } } */ + +typedef short v1hi __attribute__ ((vector_size (2))); +typedef short v2hi __attribute__ ((vector_size (4))); +typedef short v4hi __attribute__ ((vector_size (8))); +typedef short v8hi __attribute__ ((vector_size (16))); + +/* +** test_v1hi_via_vgmb: +** vgmb %v24,0,2 +** br %r14 +*/ + +v1hi +test_v1hi_via_vgmb (void) +{ + return (v1hi){0xe0e0}; +} + +/* +** test_v2hi_via_vgmb: +** vgmb %v24,0,2 +** br %r14 +*/ + +v2hi +test_v2hi_via_vgmb (void) +{ + return (v2hi){0xe0e0, 0xe0e0}; +} + +/* +** test_v4hi_via_vgmb: +** vgmb %v24,0,2 +** br %r14 +*/ + +v4hi +test_v4hi_via_vgmb (void) +{ + return (v4hi){0xe0e0, 0xe0e0, 0xe0e0, 0xe0e0}; +} + +/* +** test_v8hi_via_vgmb: +** vgmb %v24,0,2 +** br %r14 +*/ + +v8hi +test_v8hi_via_vgmb (void) +{ + return (v8hi){0xe0e0, 0xe0e0, 0xe0e0, 0xe0e0, 0xe0e0, 0xe0e0, 0xe0e0, 0xe0e0}; +} + +/* +** test_v1hi_via_vgmb_wrap: +** vgmb %v24,5,2 +** br %r14 +*/ + +v1hi +test_v1hi_via_vgmb_wrap (void) +{ + return (v1hi){0xe7e7}; +} + +/* +** test_v2hi_via_vgmb_wrap: +** vgmb %v24,5,2 +** br %r14 +*/ + +v2hi +test_v2hi_via_vgmb_wrap (void) +{ + return (v2hi){0xe7e7, 0xe7e7}; +} + +/* +** test_v4hi_via_vgmb_wrap: +** vgmb %v24,5,2 +** br %r14 +*/ + +v4hi +test_v4hi_via_vgmb_wrap (void) +{ + return (v4hi){0xe7e7, 0xe7e7, 0xe7e7, 0xe7e7}; +} + +/* +** test_v8hi_via_vgmb_wrap: +** vgmb %v24,5,2 +** br %r14 +*/ + +v8hi +test_v8hi_via_vgmb_wrap (void) +{ + return (v8hi){0xe7e7, 0xe7e7, 0xe7e7, 0xe7e7, 0xe7e7, 0xe7e7, 0xe7e7, 0xe7e7}; +} + +/* +** test_v1hi_via_vgmh: +** vgmh %v24,5,10 +** br %r14 +*/ + +v1hi +test_v1hi_via_vgmh (void) +{ + return (v1hi){0x7e0}; +} + +/* +** test_v2hi_via_vgmh: +** vgmh %v24,5,10 +** br %r14 +*/ + +v2hi +test_v2hi_via_vgmh (void) +{ + return (v2hi){0x7e0, 0x7e0}; +} + +/* +** test_v4hi_via_vgmh: +** vgmh %v24,5,10 +** br %r14 +*/ + +v4hi +test_v4hi_via_vgmh (void) +{ + return (v4hi){0x7e0, 0x7e0, 0x7e0, 0x7e0}; +} + +/* +** test_v8hi_via_vgmh: +** vgmh %v24,5,10 +** br %r14 +*/ + +v8hi +test_v8hi_via_vgmh (void) +{ + return (v8hi){0x7e0, 0x7e0, 0x7e0, 0x7e0, 0x7e0, 0x7e0, 0x7e0, 0x7e0}; +} + +/* +** test_v2hi_via_vgmf: +** vgmf %v24,1,30 +** br %r14 +*/ + +v2hi +test_v2hi_via_vgmf (void) +{ + return (v2hi){0x7fff, 0xfffe}; +} + +/* +** test_v4hi_via_vgmf: +** vgmf %v24,1,30 +** br %r14 +*/ + +v4hi +test_v4hi_via_vgmf (void) +{ + return (v4hi){0x7fff, 0xfffe, 0x7fff, 0xfffe}; +} + +/* +** test_v8hi_via_vgmf: +** vgmf %v24,1,30 +** br %r14 +*/ + +v8hi +test_v8hi_via_vgmf (void) +{ + return (v8hi){0x7fff, 0xfffe, 0x7fff, 0xfffe, 0x7fff, 0xfffe, 0x7fff, 0xfffe}; +} + +/* +** test_v4hi_via_vgmg: +** vgmg %v24,1,62 +** br %r14 +*/ + +v4hi +test_v4hi_via_vgmg (void) +{ + return (v4hi){0x7fff, 0xffff, 0xffff, 0xfffe}; +} + +/* +** test_v8hi_via_vgmg: +** vgmg %v24,1,62 +** br %r14 +*/ + +v8hi +test_v8hi_via_vgmg (void) +{ + return (v8hi){0x7fff, 0xffff, 0xffff, 0xfffe, 0x7fff, 0xffff, 0xffff, 0xfffe}; +} diff --git a/gcc/testsuite/gcc.target/s390/vector/vgm-int128-1.c b/gcc/testsuite/gcc.target/s390/vector/vgm-int128-1.c new file mode 100644 index 0000000..a106013 --- /dev/null +++ b/gcc/testsuite/gcc.target/s390/vector/vgm-int128-1.c @@ -0,0 +1,64 @@ +/* { dg-do compile { target lp64 } } */ +/* { dg-options "-O2 -march=z13 -mzarch -fdump-tree-optimized" } */ +/* { dg-final { check-function-bodies "**" "" "" } } */ + +/* As time of writing this, there is no support for 128-bit integer literals. + Therefore, we have to emulate them as e.g. via two long literals. However, + this test is all about __int128 constants. Thus, ensure that we end up with + 128-bit constants before expanding. */ +/* { dg-final { scan-tree-dump "= 0xe0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e;" "optimized" } } */ +/* { dg-final { scan-tree-dump "= 0x7ffe7ffe7ffe7ffe7ffe7ffe7ffe7ffe;" "optimized" } } */ +/* { dg-final { scan-tree-dump "= 0x7ffffffe7ffffffe7ffffffe7ffffffe;" "optimized" } } */ +/* { dg-final { scan-tree-dump "= 0x7ffffffffffffffe7ffffffffffffffe;" "optimized" } } */ + +/* +** test_int128_via_vgmb: +** vgmb (%v[0-9]+),4,6 +** vst \1,0\(%r2\),3 +** br %r14 +*/ + +__int128 +test_int128_via_vgmb (void) +{ + return ((__int128) 0x0e0e0e0e0e0e0e0e << 64) | 0x0e0e0e0e0e0e0e0e; +} + +/* +** test_int128_via_vgmh: +** vgmh (%v[0-9]+),1,14 +** vst \1,0\(%r2\),3 +** br %r14 +*/ + +__int128 +test_int128_via_vgmh (void) +{ + return ((__int128) 0x7ffe7ffe7ffe7ffe << 64) | 0x7ffe7ffe7ffe7ffe; +} + +/* +** test_int128_via_vgmf: +** vgmf (%v[0-9]+),1,30 +** vst \1,0\(%r2\),3 +** br %r14 +*/ + +__int128 +test_int128_via_vgmf (void) +{ + return ((__int128) 0x7ffffffe7ffffffe << 64) | 0x7ffffffe7ffffffe; +} + +/* +** test_int128_via_vgmg: +** vgmg (%v[0-9]+),1,62 +** vst \1,0\(%r2\),3 +** br %r14 +*/ + +__int128 +test_int128_via_vgmg (void) +{ + return ((__int128) 0x7ffffffffffffffe << 64) | 0x7ffffffffffffffe; +} diff --git a/gcc/testsuite/gcc.target/s390/vector/vgm-longdouble-1.c b/gcc/testsuite/gcc.target/s390/vector/vgm-longdouble-1.c new file mode 100644 index 0000000..0217815 --- /dev/null +++ b/gcc/testsuite/gcc.target/s390/vector/vgm-longdouble-1.c @@ -0,0 +1,55 @@ +/* { dg-do compile { target lp64 } } */ +/* { dg-options "-O2 -march=z14 -mzarch -fdump-tree-optimized" } */ +/* { dg-final { check-function-bodies "**" "" "" } } */ + +/* +** test_longdouble_via_vgmb: +** vgmb (%v[0-9]+),4,6 +** vst \1,0\(%r2\),3 +** br %r14 +*/ + +long double +test_longdouble_via_vgmb (void) +{ + return 2.263171865473961260249112278523378513150597635104e-3849L; +} + +/* +** test_longdouble_via_vgmh: +** vgmh (%v[0-9]+),1,14 +** vst \1,0\(%r2\),3 +** br %r14 +*/ + +long double +test_longdouble_via_vgmh (void) +{ + return 8.9228500591371968978175957554634715383668519805586e+4931L; +} + +/* +** test_longdouble_via_vgmf: +** vgmf (%v[0-9]+),9,30 +** vst \1,0\(%r2\),3 +** br %r14 +*/ + +long double +test_longdouble_via_vgmf (void) +{ + return 5.7202348769040302108562404806917908642856158381792e-4894L; +} + +/* +** test_longdouble_via_vgmg: +** vgmg (%v[0-9]+),9,62 +** vst \1,0\(%r2\),3 +** br %r14 +*/ + +long double +test_longdouble_via_vgmg (void) +{ + return 5.7203220768525291179165318133287569460629228746232e-4894L; +} diff --git a/gcc/testsuite/gcc.target/s390/vector/vgm-qi-1.c b/gcc/testsuite/gcc.target/s390/vector/vgm-qi-1.c new file mode 100644 index 0000000..06e7062 --- /dev/null +++ b/gcc/testsuite/gcc.target/s390/vector/vgm-qi-1.c @@ -0,0 +1,213 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -march=z13 -mzarch" } */ +/* { dg-final { check-function-bodies "**" "" "" } } */ + +typedef signed char v1qi __attribute__ ((vector_size (1))); +typedef signed char v2qi __attribute__ ((vector_size (2))); +typedef signed char v4qi __attribute__ ((vector_size (4))); +typedef signed char v8qi __attribute__ ((vector_size (8))); +typedef signed char v16qi __attribute__ ((vector_size (16))); + +/* +** test_v1qi_via_vgmb: +** vgmb %v24,0,2 +** br %r14 +*/ + +v1qi +test_v1qi_via_vgmb (void) +{ + return (v1qi){0xe0}; +} + +/* +** test_v2qi_via_vgmb: +** vgmb %v24,0,2 +** br %r14 +*/ + +v2qi +test_v2qi_via_vgmb (void) +{ + return (v2qi){0xe0, 0xe0}; +} + +/* +** test_v4qi_via_vgmb: +** vgmb %v24,0,2 +** br %r14 +*/ + +v4qi +test_v4qi_via_vgmb (void) +{ + return (v4qi){0xe0, 0xe0, 0xe0, 0xe0}; +} + +/* +** test_v8qi_via_vgmb: +** vgmb %v24,0,2 +** br %r14 +*/ + +v8qi +test_v8qi_via_vgmb (void) +{ + return (v8qi){0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0}; +} + +/* +** test_v16qi_via_vgmb: +** vgmb %v24,0,2 +** br %r14 +*/ + +v16qi +test_v16qi_via_vgmb (void) +{ + return (v16qi){0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0}; +} + +/* +** test_v1qi_via_vgmb_wrap: +** vgmb %v24,5,2 +** br %r14 +*/ + +v1qi +test_v1qi_via_vgmb_wrap (void) +{ + return (v1qi){0xe7}; +} + +/* +** test_v2qi_via_vgmb_wrap: +** vgmb %v24,5,2 +** br %r14 +*/ + +v2qi +test_v2qi_via_vgmb_wrap (void) +{ + return (v2qi){0xe7, 0xe7}; +} + +/* +** test_v4qi_via_vgmb_wrap: +** vgmb %v24,5,2 +** br %r14 +*/ + +v4qi +test_v4qi_via_vgmb_wrap (void) +{ + return (v4qi){0xe7, 0xe7, 0xe7, 0xe7}; +} + +/* +** test_v8qi_via_vgmb_wrap: +** vgmb %v24,5,2 +** br %r14 +*/ + +v8qi +test_v8qi_via_vgmb_wrap (void) +{ + return (v8qi){0xe7, 0xe7, 0xe7, 0xe7, 0xe7, 0xe7, 0xe7, 0xe7}; +} + +/* +** test_v16qi_via_vgmb_wrap: +** vgmb %v24,5,2 +** br %r14 +*/ + +v16qi +test_v16qi_via_vgmb_wrap (void) +{ + return (v16qi){0xe7, 0xe7, 0xe7, 0xe7, 0xe7, 0xe7, 0xe7, 0xe7, 0xe7, 0xe7, 0xe7, 0xe7, 0xe7, 0xe7, 0xe7, 0xe7}; +} + +/* +** test_v2qi_via_vgmh: +** vgmh %v24,1,14 +** br %r14 +*/ + +v2qi +test_v2qi_via_vgmh (void) +{ + return (v2qi){0x7f, 0xfe}; +} + +/* +** test_v4qi_via_vgmh: +** vgmh %v24,1,14 +** br %r14 +*/ + +v4qi +test_v4qi_via_vgmh (void) +{ + return (v4qi){0x7f, 0xfe, 0x7f, 0xfe}; +} + +/* +** test_v8qi_via_vgmh: +** vgmh %v24,1,14 +** br %r14 +*/ + +v8qi +test_v8qi_via_vgmh (void) +{ + return (v8qi){0x7f, 0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f, 0xfe}; +} + +/* +** test_v16qi_via_vgmh: +** vgmh %v24,1,14 +** br %r14 +*/ + +v16qi +test_v16qi_via_vgmh (void) +{ + return (v16qi){0x7f, 0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f, 0xfe}; +} + +/* +** test_v4qi_via_vgmf: +** vgmf %v24,1,30 +** br %r14 +*/ + +v4qi +test_v4qi_via_vgmf (void) +{ + return (v4qi){0x7f, 0xff, 0xff, 0xfe}; +} + +/* +** test_v8qi_via_vgmf: +** vgmf %v24,1,30 +** br %r14 +*/ + +v8qi +test_v8qi_via_vgmf (void) +{ + return (v8qi){0x7f, 0xff, 0xff, 0xfe, 0x7f, 0xff, 0xff, 0xfe}; +} + +/* +** test_v8qi_via_vgmg: +** vgmg %v24,1,62 +** br %r14 +*/ + +v8qi +test_v8qi_via_vgmg (void) +{ + return (v8qi){0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe}; +} diff --git a/gcc/testsuite/gcc.target/s390/vector/vgm-sf-1.c b/gcc/testsuite/gcc.target/s390/vector/vgm-sf-1.c new file mode 100644 index 0000000..1beaec9 --- /dev/null +++ b/gcc/testsuite/gcc.target/s390/vector/vgm-sf-1.c @@ -0,0 +1,43 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -march=z14 -mzarch" } */ +/* { dg-final { check-function-bodies "**" "" "" } } */ + +typedef float v1sf __attribute__ ((vector_size (4))); +typedef float v2sf __attribute__ ((vector_size (8))); +typedef float v4sf __attribute__ ((vector_size (16))); + +/* +** test_v1sf_via_vgmb: +** vgmb %v24,0,3 +** br %r14 +*/ + +v1sf +test_v1sf_via_vgmb (void) +{ + return (v1sf){-5.9654142e29}; +} + +/* +** test_v2sf_via_vgmb: +** vgmb %v24,0,3 +** br %r14 +*/ + +v2sf +test_v2sf_via_vgmb (void) +{ + return (v2sf){-5.9654142e29, -5.9654142e29}; +} + +/* +** test_v4sf_via_vgmb: +** vgmb %v24,0,3 +** br %r14 +*/ + +v4sf +test_v4sf_via_vgmb (void) +{ + return (v4sf){-5.9654142e29, -5.9654142e29, -5.9654142e29, -5.9654142e29}; +} diff --git a/gcc/testsuite/gcc.target/s390/vector/vgm-si-1.c b/gcc/testsuite/gcc.target/s390/vector/vgm-si-1.c new file mode 100644 index 0000000..a3e9d57 --- /dev/null +++ b/gcc/testsuite/gcc.target/s390/vector/vgm-si-1.c @@ -0,0 +1,146 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -march=z13 -mzarch" } */ +/* { dg-final { check-function-bodies "**" "" "" } } */ + +typedef int v1si __attribute__ ((vector_size (4))); +typedef int v2si __attribute__ ((vector_size (8))); +typedef int v4si __attribute__ ((vector_size (16))); + +/* +** test_v1si_via_vgmb: +** vgmb %v24,0,2 +** br %r14 +*/ + +v1si +test_v1si_via_vgmb (void) +{ + return (v1si){0xe0e0e0e0}; +} + +/* +** test_v2si_via_vgmb: +** vgmb %v24,0,2 +** br %r14 +*/ + +v2si +test_v2si_via_vgmb (void) +{ + return (v2si){0xe0e0e0e0, 0xe0e0e0e0}; +} + +/* +** test_v4si_via_vgmb: +** vgmb %v24,0,2 +** br %r14 +*/ + +v4si +test_v4si_via_vgmb (void) +{ + return (v4si){0xe0e0e0e0, 0xe0e0e0e0, 0xe0e0e0e0, 0xe0e0e0e0}; +} + +/* +** test_v1si_via_vgmb_wrap: +** vgmb %v24,5,2 +** br %r14 +*/ + +v1si +test_v1si_via_vgmb_wrap (void) +{ + return (v1si){0xe7e7e7e7}; +} + +/* +** test_v2si_via_vgmb_wrap: +** vgmb %v24,5,2 +** br %r14 +*/ + +v2si +test_v2si_via_vgmb_wrap (void) +{ + return (v2si){0xe7e7e7e7, 0xe7e7e7e7}; +} + +/* +** test_v4si_via_vgmb_wrap: +** vgmb %v24,5,2 +** br %r14 +*/ + +v4si +test_v4si_via_vgmb_wrap (void) +{ + return (v4si){0xe7e7e7e7, 0xe7e7e7e7, 0xe7e7e7e7, 0xe7e7e7e7}; +} + +/* +** test_v1si_via_vgmh: +** vgmh %v24,5,10 +** br %r14 +*/ + +v1si +test_v1si_via_vgmh (void) +{ + return (v1si){0x7e007e0}; +} + +/* +** test_v2si_via_vgmh: +** vgmh %v24,5,10 +** br %r14 +*/ + +__attribute__ ((noipa)) +v2si +test_v2si_via_vgmh (void) +{ + return (v2si){0x7e007e0, 0x7e007e0}; +} + +/* +** test_v4si_via_vgmh: +** vgmh %v24,5,10 +** br %r14 +*/ + +v4si +test_v4si_via_vgmh (void) +{ + return (v4si){0x7e007e0, 0x7e007e0, 0x7e007e0, 0x7e007e0}; +} + +/* +** test_v2si_via_vgmg: +** vgmg %v24,17,46 +** br %r14 +*/ + +__attribute__ ((noipa)) +v2si +test_v2si_via_vgmg (void) +{ + return (v2si){0x7fff, 0xfffe0000}; +} + +/* +** test_v4si_via_vgmg: +** vgmg %v24,17,46 +** br %r14 +*/ + +v4si +test_v4si_via_vgmg (void) +{ + return (v4si){0x7fff, 0xfffe0000, 0x7fff, 0xfffe0000}; +} + +int main (void) +{ + test_v2si_via_vgmh (); +} diff --git a/gcc/testsuite/gcc.target/s390/vector/vgm-ti-1.c b/gcc/testsuite/gcc.target/s390/vector/vgm-ti-1.c new file mode 100644 index 0000000..c77457c --- /dev/null +++ b/gcc/testsuite/gcc.target/s390/vector/vgm-ti-1.c @@ -0,0 +1,63 @@ +/* { dg-do compile { target lp64 } } */ +/* { dg-options "-O2 -march=z13 -mzarch -fdump-tree-optimized" } */ +/* { dg-final { check-function-bodies "**" "" "" } } */ + +/* As time of writing this, there is no support for 128-bit integer literals. + Therefore, we have to emulate them as e.g. via two long literals. However, + this test is all about V1TI const vectors. Thus, ensure that we end up with + a V1TI const vector before expanding. */ +/* { dg-final { scan-tree-dump "{ 0xe0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e }" "optimized" } } */ +/* { dg-final { scan-tree-dump "{ 0x7ffe7ffe7ffe7ffe7ffe7ffe7ffe7ffe }" "optimized" } } */ +/* { dg-final { scan-tree-dump "{ 0x7ffffffe7ffffffe7ffffffe7ffffffe }" "optimized" } } */ +/* { dg-final { scan-tree-dump "{ 0x7ffffffffffffffe7ffffffffffffffe }" "optimized" } } */ + +typedef __int128 v1ti __attribute__ ((vector_size (16))); +typedef long v2di __attribute__ ((vector_size (16))); + +/* +** test_v1ti_via_vgmb: +** vgmb %v24,4,6 +** br %r14 +*/ + +v1ti +test_v1ti_via_vgmb (void) +{ + return (v1ti)(v2di){0x0e0e0e0e0e0e0e0e, 0x0e0e0e0e0e0e0e0e}; +} + +/* +** test_v1ti_via_vgmh: +** vgmh %v24,1,14 +** br %r14 +*/ + +v1ti +test_v1ti_via_vgmh (void) +{ + return (v1ti)(v2di){0x7ffe7ffe7ffe7ffe, 0x7ffe7ffe7ffe7ffe}; +} + +/* +** test_v1ti_via_vgmf: +** vgmf %v24,1,30 +** br %r14 +*/ + +v1ti +test_v1ti_via_vgmf (void) +{ + return (v1ti)(v2di){0x7ffffffe7ffffffe, 0x7ffffffe7ffffffe}; +} + +/* +** test_v1ti_via_vgmg: +** vgmg %v24,1,62 +** br %r14 +*/ + +v1ti +test_v1ti_via_vgmg (void) +{ + return (v1ti)(v2di){0x7ffffffffffffffe, 0x7ffffffffffffffe}; +} |