From 6c678e78b40d3c80c1d2fc7c4ab446f9a69d12d5 Mon Sep 17 00:00:00 2001 From: krebbel Date: Fri, 19 Feb 2016 10:37:19 +0000 Subject: [PATCH] S/390: z13 Change predicates of 128 bit add sub. So far usage of 128 bit add/sub instruction was rejected if the second operand was a constant because the predicate rejected this. gcc/testsuite/ChangeLog: * gcc.target/s390/vector/int128-1.c: New test. gcc/ChangeLog: * config/s390/vector.md ("add3", "sub3"): Change the predicate of op2 from nonimmediate to general and let reload fix it if necessary. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@233554 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 6 ++++ gcc/config/s390/vector.md | 4 +-- gcc/testsuite/ChangeLog | 4 +++ gcc/testsuite/gcc.target/s390/vector/int128-1.c | 47 +++++++++++++++++++++++++ 4 files changed, 59 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/gcc.target/s390/vector/int128-1.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 06fedf0..471a01b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,11 @@ 2016-02-19 Andreas Krebbel + * config/s390/vector.md ("add3", "sub3"): + Change the predicate of op2 from nonimmediate to general and let + reload fix it if necessary. + +2016-02-19 Andreas Krebbel + * config/s390/vecintrin.h (vec_sub_u128): Define missing macro. 2016-02-19 Andreas Krebbel diff --git a/gcc/config/s390/vector.md b/gcc/config/s390/vector.md index 2302a8f..cdb9ba6 100644 --- a/gcc/config/s390/vector.md +++ b/gcc/config/s390/vector.md @@ -454,7 +454,7 @@ (define_insn "add3" [(set (match_operand:VIT 0 "nonimmediate_operand" "=v") (plus:VIT (match_operand:VIT 1 "nonimmediate_operand" "v") - (match_operand:VIT 2 "nonimmediate_operand" "v")))] + (match_operand:VIT 2 "general_operand" "v")))] "TARGET_VX" "va\t%v0,%v1,%v2" [(set_attr "op_type" "VRR")]) @@ -463,7 +463,7 @@ (define_insn "sub3" [(set (match_operand:VIT 0 "nonimmediate_operand" "=v") (minus:VIT (match_operand:VIT 1 "nonimmediate_operand" "v") - (match_operand:VIT 2 "nonimmediate_operand" "v")))] + (match_operand:VIT 2 "general_operand" "v")))] "TARGET_VX" "vs\t%v0,%v1,%v2" [(set_attr "op_type" "VRR")]) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index abb2ed6..4a0dbab 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,9 @@ 2016-02-19 Andreas Krebbel + * gcc.target/s390/vector/int128-1.c: New test. + +2016-02-19 Andreas Krebbel + * gcc.target/s390/vector/vec-vcond-1.c: New test. 2016-02-19 Andreas Krebbel diff --git a/gcc/testsuite/gcc.target/s390/vector/int128-1.c b/gcc/testsuite/gcc.target/s390/vector/int128-1.c new file mode 100644 index 0000000..b4a16b8 --- /dev/null +++ b/gcc/testsuite/gcc.target/s390/vector/int128-1.c @@ -0,0 +1,47 @@ +/* Check that vaq/vsq are used for int128 operations. */ + +/* { dg-do compile { target { lp64 } } } */ +/* { dg-options "-O3 -mzarch -march=z13" } */ + + +const __int128 c = (__int128)0x0123456789abcd55 + ((__int128)7 << 64); + + +__int128 +addreg(__int128 a, __int128 b) +{ + return a + b; +} + +__int128 +addconst(__int128 a) +{ + return a + c; +} + +__int128 +addmem(__int128 *a, __int128_t *b) +{ + return *a + *b; +} + +__int128 +subreg(__int128 a, __int128 b) +{ + return a - b; +} + +__int128 +subconst(__int128 a) +{ + return a - c; /* This becomes vaq as well. */ +} + +__int128 +submem(__int128 *a, __int128_t *b) +{ + return *a - *b; +} + +/* { dg-final { scan-assembler-times "vaq" 4 } } */ +/* { dg-final { scan-assembler-times "vsq" 2 } } */ -- 2.7.4