* [PATCH] S/390: Fix warning in "*movstr" pattern.
@ 2015-11-03 17:17 Dominik Vogt
2015-11-03 17:47 ` Ulrich Weigand
0 siblings, 1 reply; 11+ messages in thread
From: Dominik Vogt @ 2015-11-03 17:17 UTC (permalink / raw)
To: gcc-patches
[-- Attachment #1: Type: text/plain, Size: 138 bytes --]
The attached patch fixes the message "warning: dest missing a
mode?" from s390.md.
Ciao
Dominik ^_^ ^_^
--
Dominik Vogt
IBM Germany
[-- Attachment #2: 0001-ChangeLog --]
[-- Type: text/plain, Size: 65 bytes --]
gcc/ChangeLog
* config/s390/s390.md ("*movstr"): Fix warning.
[-- Attachment #3: 0001-S-390-Fix-warning-in-movstr-pattern.patch --]
[-- Type: text/x-diff, Size: 817 bytes --]
From e03251cacf2004e4cb302de03b44bb1a3f6ad827 Mon Sep 17 00:00:00 2001
From: Dominik Vogt <vogt@linux.vnet.ibm.com>
Date: Tue, 3 Nov 2015 18:03:02 +0100
Subject: [PATCH] S/390: Fix warning in "*movstr" pattern.
---
gcc/config/s390/s390.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gcc/config/s390/s390.md b/gcc/config/s390/s390.md
index ea65c74..8a6f31d 100644
--- a/gcc/config/s390/s390.md
+++ b/gcc/config/s390/s390.md
@@ -2936,7 +2936,7 @@
(set (mem:BLK (match_operand:P 1 "register_operand" "0"))
(mem:BLK (match_operand:P 3 "register_operand" "2")))
(set (match_operand:P 0 "register_operand" "=d")
- (unspec [(mem:BLK (match_dup 1))
+ (unspec:P [(mem:BLK (match_dup 1))
(mem:BLK (match_dup 3))
(reg:SI 0)] UNSPEC_MVST))
(clobber (reg:CC CC_REGNUM))]
--
2.3.0
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] S/390: Fix warning in "*movstr" pattern.
2015-11-03 17:17 [PATCH] S/390: Fix warning in "*movstr" pattern Dominik Vogt
@ 2015-11-03 17:47 ` Ulrich Weigand
2015-11-04 1:39 ` Dominik Vogt
0 siblings, 1 reply; 11+ messages in thread
From: Ulrich Weigand @ 2015-11-03 17:47 UTC (permalink / raw)
To: vogt; +Cc: gcc-patches
Dominik Vogt wrote:
> @@ -2936,7 +2936,7 @@
> (set (mem:BLK (match_operand:P 1 "register_operand" "0"))
> (mem:BLK (match_operand:P 3 "register_operand" "2")))
> (set (match_operand:P 0 "register_operand" "=d")
> - (unspec [(mem:BLK (match_dup 1))
> + (unspec:P [(mem:BLK (match_dup 1))
> (mem:BLK (match_dup 3))
> (reg:SI 0)] UNSPEC_MVST))
> (clobber (reg:CC CC_REGNUM))]
Don't you have to change the expander too? Otherwise the
pattern will no longer match ...
Bye,
Ulrich
--
Dr. Ulrich Weigand
GNU/Linux compilers and toolchain
Ulrich.Weigand@de.ibm.com
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] S/390: Fix warning in "*movstr" pattern.
2015-11-03 17:47 ` Ulrich Weigand
@ 2015-11-04 1:39 ` Dominik Vogt
2015-11-09 12:33 ` Andreas Krebbel
0 siblings, 1 reply; 11+ messages in thread
From: Dominik Vogt @ 2015-11-04 1:39 UTC (permalink / raw)
To: gcc-patches; +Cc: Ulrich Weigand, Andreas Krebbel
[-- Attachment #1: Type: text/plain, Size: 853 bytes --]
On Tue, Nov 03, 2015 at 06:47:28PM +0100, Ulrich Weigand wrote:
> Dominik Vogt wrote:
>
> > @@ -2936,7 +2936,7 @@
> > (set (mem:BLK (match_operand:P 1 "register_operand" "0"))
> > (mem:BLK (match_operand:P 3 "register_operand" "2")))
> > (set (match_operand:P 0 "register_operand" "=d")
> > - (unspec [(mem:BLK (match_dup 1))
> > + (unspec:P [(mem:BLK (match_dup 1))
> > (mem:BLK (match_dup 3))
> > (reg:SI 0)] UNSPEC_MVST))
> > (clobber (reg:CC CC_REGNUM))]
>
> Don't you have to change the expander too? Otherwise the
> pattern will no longer match ...
Yes, you're right. This turned out to be a bit tricky to do
because the "movstr" expander doesn't allow variants with
different modes. :-/
New patch attached, including a test case that works on 31-bit and
64-bit.
Ciao
Dominik ^_^ ^_^
--
Dominik Vogt
IBM Germany
[-- Attachment #2: 0001-v2-ChangeLog --]
[-- Type: text/plain, Size: 250 bytes --]
gcc/ChangeLog
* config/s390/s390.md ("movstr", "*movstr"): Fix warning.
("movstr<P:mode>"): New indirect expanders used by "movstr".
gcc/testsuite/ChangeLog
* gcc.target/s390/md/movstr-1.c: New test.
* gcc.target/s390/s390.exp: Add subdir md.
[-- Attachment #3: 0001-v2-S-390-Fix-warning-in-movstr-pattern.patch --]
[-- Type: text/x-diff, Size: 2345 bytes --]
From 0b007894db4f276394904599baf91245110a6e4b Mon Sep 17 00:00:00 2001
From: Dominik Vogt <vogt@linux.vnet.ibm.com>
Date: Tue, 3 Nov 2015 18:03:02 +0100
Subject: [PATCH] S/390: Fix warning in "*movstr" pattern.
---
gcc/config/s390/s390.md | 20 +++++++++++++++++---
gcc/testsuite/gcc.target/s390/s390.exp | 3 +++
2 files changed, 20 insertions(+), 3 deletions(-)
diff --git a/gcc/config/s390/s390.md b/gcc/config/s390/s390.md
index ea65c74..81020f73 100644
--- a/gcc/config/s390/s390.md
+++ b/gcc/config/s390/s390.md
@@ -2909,13 +2909,27 @@
;
(define_expand "movstr"
+ ;; The pattern is never generated.
+ [(match_operand 0 "" "")
+ (match_operand 1 "" "")
+ (match_operand 2 "" "")]
+ ""
+{
+ if (TARGET_64BIT)
+ emit_insn (gen_movstrdi (operands[0], operands[1], operands[2]));
+ else
+ emit_insn (gen_movstrsi (operands[0], operands[1], operands[2]));
+ DONE;
+})
+
+(define_expand "movstr<P:mode>"
[(set (reg:SI 0) (const_int 0))
(parallel
[(clobber (match_dup 3))
(set (match_operand:BLK 1 "memory_operand" "")
(match_operand:BLK 2 "memory_operand" ""))
- (set (match_operand 0 "register_operand" "")
- (unspec [(match_dup 1)
+ (set (match_operand:P 0 "register_operand" "")
+ (unspec:P [(match_dup 1)
(match_dup 2)
(reg:SI 0)] UNSPEC_MVST))
(clobber (reg:CC CC_REGNUM))])]
@@ -2936,7 +2950,7 @@
(set (mem:BLK (match_operand:P 1 "register_operand" "0"))
(mem:BLK (match_operand:P 3 "register_operand" "2")))
(set (match_operand:P 0 "register_operand" "=d")
- (unspec [(mem:BLK (match_dup 1))
+ (unspec:P [(mem:BLK (match_dup 1))
(mem:BLK (match_dup 3))
(reg:SI 0)] UNSPEC_MVST))
(clobber (reg:CC CC_REGNUM))]
diff --git a/gcc/testsuite/gcc.target/s390/s390.exp b/gcc/testsuite/gcc.target/s390/s390.exp
index 87433dd..2a4718f 100644
--- a/gcc/testsuite/gcc.target/s390/s390.exp
+++ b/gcc/testsuite/gcc.target/s390/s390.exp
@@ -88,6 +88,9 @@ dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*vector*/*.\[cS\]]] \
dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/target-attribute/*.\[cS\]]] \
"" $DEFAULT_CFLAGS
+dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/md/*.\[cS\]]] \
+ "" $DEFAULT_CFLAGS
+
# Additional hotpatch torture tests.
torture-init
set HOTPATCH_TEST_OPTS [list -Os -O0 -O1 -O2 -O3]
--
2.3.0
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] S/390: Fix warning in "*movstr" pattern.
2015-11-04 1:39 ` Dominik Vogt
@ 2015-11-09 12:33 ` Andreas Krebbel
2015-11-30 14:48 ` Dominik Vogt
0 siblings, 1 reply; 11+ messages in thread
From: Andreas Krebbel @ 2015-11-09 12:33 UTC (permalink / raw)
To: vogt; +Cc: Ulrich.Weigand, gcc-patches
On 11/04/2015 02:39 AM, Dominik Vogt wrote:
> On Tue, Nov 03, 2015 at 06:47:28PM +0100, Ulrich Weigand wrote:
>> Dominik Vogt wrote:
>>
>>> @@ -2936,7 +2936,7 @@
>>> (set (mem:BLK (match_operand:P 1 "register_operand" "0"))
>>> (mem:BLK (match_operand:P 3 "register_operand" "2")))
>>> (set (match_operand:P 0 "register_operand" "=d")
>>> - (unspec [(mem:BLK (match_dup 1))
>>> + (unspec:P [(mem:BLK (match_dup 1))
>>> (mem:BLK (match_dup 3))
>>> (reg:SI 0)] UNSPEC_MVST))
>>> (clobber (reg:CC CC_REGNUM))]
>>
>> Don't you have to change the expander too? Otherwise the
>> pattern will no longer match ...
>
> Yes, you're right. This turned out to be a bit tricky to do
> because the "movstr" expander doesn't allow variants with
> different modes. :-/
>
> New patch attached, including a test case that works on 31-bit and
> 64-bit.
Could you please check that the generated code doesn't change with a larger code base (e.g.
speccpu)? It should not affect it but I really think we omitted the mode here for a reason
(although I don't remember why).
-Andreas-
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] S/390: Fix warning in "*movstr" pattern.
2015-11-09 12:33 ` Andreas Krebbel
@ 2015-11-30 14:48 ` Dominik Vogt
2015-12-02 8:59 ` Andreas Krebbel
0 siblings, 1 reply; 11+ messages in thread
From: Dominik Vogt @ 2015-11-30 14:48 UTC (permalink / raw)
To: gcc-patches; +Cc: Andreas Krebbel, Ulrich Weigand
[-- Attachment #1: Type: text/plain, Size: 1489 bytes --]
On Mon, Nov 09, 2015 at 01:33:23PM +0100, Andreas Krebbel wrote:
> On 11/04/2015 02:39 AM, Dominik Vogt wrote:
> > On Tue, Nov 03, 2015 at 06:47:28PM +0100, Ulrich Weigand wrote:
> >> Dominik Vogt wrote:
> >>
> >>> @@ -2936,7 +2936,7 @@
> >>> (set (mem:BLK (match_operand:P 1 "register_operand" "0"))
> >>> (mem:BLK (match_operand:P 3 "register_operand" "2")))
> >>> (set (match_operand:P 0 "register_operand" "=d")
> >>> - (unspec [(mem:BLK (match_dup 1))
> >>> + (unspec:P [(mem:BLK (match_dup 1))
> >>> (mem:BLK (match_dup 3))
> >>> (reg:SI 0)] UNSPEC_MVST))
> >>> (clobber (reg:CC CC_REGNUM))]
> >>
> >> Don't you have to change the expander too? Otherwise the
> >> pattern will no longer match ...
> >
> > Yes, you're right. This turned out to be a bit tricky to do
> > because the "movstr" expander doesn't allow variants with
> > different modes. :-/
> >
> > New patch attached, including a test case that works on 31-bit and
> > 64-bit.
>
> Could you please check that the generated code doesn't change with a larger code base (e.g.
> speccpu)? It should not affect it but I really think we omitted the mode here for a reason
> (although I don't remember why).
The attached patch contains a little cleanup in the s390.exp
script and a 31-bit test case. This has successfully passed the
SPEC2006 testsuite without measurable changes in performance. In
my eyes this is now clean to be committed.
Ciao
Dominik ^_^ ^_^
--
Dominik Vogt
IBM Germany
[-- Attachment #2: 0001-v3-ChangeLog --]
[-- Type: text/plain, Size: 284 bytes --]
gcc/ChangeLog
* config/s390/s390.md ("movstr", "*movstr"): Fix warning.
("movstr<P:mode>"): New indirect expanders used by "movstr".
gcc/testsuite/ChangeLog
* gcc.target/s390/md/movstr-1.c: New test.
* gcc.target/s390/s390.exp: Add subdir md.
Do not run hotpatch tests twice.
[-- Attachment #3: 0001-v3-S-390-Fix-warning-in-movstr-pattern.patch --]
[-- Type: text/x-diff, Size: 3931 bytes --]
From 7680c94169918aa22b10d923b18c676e59506d4d Mon Sep 17 00:00:00 2001
From: Dominik Vogt <vogt@linux.vnet.ibm.com>
Date: Tue, 3 Nov 2015 18:03:02 +0100
Subject: [PATCH] S/390: Fix warning in "*movstr" pattern.
---
gcc/config/s390/s390.md | 20 +++++++++++++++++---
gcc/testsuite/gcc.target/s390/md/movstr-1.c | 11 +++++++++++
gcc/testsuite/gcc.target/s390/s390.exp | 25 ++++++++++++++++++++-----
3 files changed, 48 insertions(+), 8 deletions(-)
create mode 100644 gcc/testsuite/gcc.target/s390/md/movstr-1.c
diff --git a/gcc/config/s390/s390.md b/gcc/config/s390/s390.md
index f2bb24c..75e9af7 100644
--- a/gcc/config/s390/s390.md
+++ b/gcc/config/s390/s390.md
@@ -2910,13 +2910,27 @@
;
(define_expand "movstr"
+ ;; The pattern is never generated.
+ [(match_operand 0 "" "")
+ (match_operand 1 "" "")
+ (match_operand 2 "" "")]
+ ""
+{
+ if (TARGET_64BIT)
+ emit_insn (gen_movstrdi (operands[0], operands[1], operands[2]));
+ else
+ emit_insn (gen_movstrsi (operands[0], operands[1], operands[2]));
+ DONE;
+})
+
+(define_expand "movstr<P:mode>"
[(set (reg:SI 0) (const_int 0))
(parallel
[(clobber (match_dup 3))
(set (match_operand:BLK 1 "memory_operand" "")
(match_operand:BLK 2 "memory_operand" ""))
- (set (match_operand 0 "register_operand" "")
- (unspec [(match_dup 1)
+ (set (match_operand:P 0 "register_operand" "")
+ (unspec:P [(match_dup 1)
(match_dup 2)
(reg:SI 0)] UNSPEC_MVST))
(clobber (reg:CC CC_REGNUM))])]
@@ -2937,7 +2951,7 @@
(set (mem:BLK (match_operand:P 1 "register_operand" "0"))
(mem:BLK (match_operand:P 3 "register_operand" "2")))
(set (match_operand:P 0 "register_operand" "=d")
- (unspec [(mem:BLK (match_dup 1))
+ (unspec:P [(mem:BLK (match_dup 1))
(mem:BLK (match_dup 3))
(reg:SI 0)] UNSPEC_MVST))
(clobber (reg:CC CC_REGNUM))]
diff --git a/gcc/testsuite/gcc.target/s390/md/movstr-1.c b/gcc/testsuite/gcc.target/s390/md/movstr-1.c
new file mode 100644
index 0000000..3429054
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/md/movstr-1.c
@@ -0,0 +1,11 @@
+/* Machine description pattern tests. */
+
+/* { dg-do assemble } */
+/* { dg-options "-dP -save-temps" } */
+
+void test(char *dest, const char *src)
+{
+ __builtin_stpcpy (dest, src);
+}
+
+/* { dg-final { scan-assembler-times "\{\\*movstr\}" 1 } } */
diff --git a/gcc/testsuite/gcc.target/s390/s390.exp b/gcc/testsuite/gcc.target/s390/s390.exp
index 0b8f80ed..0d7a7eb 100644
--- a/gcc/testsuite/gcc.target/s390/s390.exp
+++ b/gcc/testsuite/gcc.target/s390/s390.exp
@@ -61,20 +61,35 @@ if ![info exists DEFAULT_CFLAGS] then {
# Initialize `dg'.
dg-init
-set hotpatch_tests $srcdir/$subdir/hotpatch-\[0-9\]*.c
+set md_tests $srcdir/$subdir/md/*.c
# Main loop.
dg-runtest [lsort [prune [glob -nocomplain $srcdir/$subdir/*.\[cS\]] \
- $hotpatch_tests]] "" $DEFAULT_CFLAGS
+ $md_tests]] "" $DEFAULT_CFLAGS
dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*vector*/*.\[cS\]]] \
"" $DEFAULT_CFLAGS
+dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/md/*.\[cS\]]] \
+ "" $DEFAULT_CFLAGS
+
# Additional hotpatch torture tests.
torture-init
-set HOTPATCH_TEST_OPTS [list -Os -O0 -O1 -O2 -O3]
-set-torture-options $HOTPATCH_TEST_OPTS
-gcc-dg-runtest [lsort [glob -nocomplain $hotpatch_tests]] "" $DEFAULT_CFLAGS
+set-torture-options [list -Os -O0 -O1 -O2 -O3]
+gcc-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/hotpatch-\[0-9\]*.c]] \
+ "" $DEFAULT_CFLAGS
+torture-finish
+
+# Additional md torture tests.
+torture-init
+set MD_TEST_OPTS [list \
+ {-Os -march=z900} {-Os -march=z13} \
+ {-O0 -march=z900} {-O0 -march=z13} \
+ {-O1 -march=z900} {-O1 -march=z13} \
+ {-O2 -march=z900} {-O2 -march=z13} \
+ {-O3 -march=z900} {-O3 -march=z13}]
+set-torture-options $MD_TEST_OPTS
+gcc-dg-runtest [lsort [glob -nocomplain $md_tests]] "" $DEFAULT_CFLAGS
torture-finish
# All done.
--
2.3.0
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] S/390: Fix warning in "*movstr" pattern.
2015-11-30 14:48 ` Dominik Vogt
@ 2015-12-02 8:59 ` Andreas Krebbel
2015-12-02 9:12 ` Dominik Vogt
0 siblings, 1 reply; 11+ messages in thread
From: Andreas Krebbel @ 2015-12-02 8:59 UTC (permalink / raw)
To: gcc-patches, vogt; +Cc: Ulrich Weigand
On 11/30/2015 03:45 PM, Dominik Vogt wrote:
> On Mon, Nov 09, 2015 at 01:33:23PM +0100, Andreas Krebbel wrote:
>> On 11/04/2015 02:39 AM, Dominik Vogt wrote:
>>> On Tue, Nov 03, 2015 at 06:47:28PM +0100, Ulrich Weigand wrote:
>>>> Dominik Vogt wrote:
+++ b/gcc/testsuite/gcc.target/s390/md/movstr-1.c
@@ -0,0 +1,11 @@
+/* Machine description pattern tests. */
+
+/* { dg-do assemble } */
+/* { dg-options "-dP -save-temps" } */
-save-temps is not necessary for a dg-do assemble test.
+# Additional md torture tests.
+torture-init
+set MD_TEST_OPTS [list \
+ {-Os -march=z900} {-Os -march=z13} \
+ {-O0 -march=z900} {-O0 -march=z13} \
+ {-O1 -march=z900} {-O1 -march=z13} \
+ {-O2 -march=z900} {-O2 -march=z13} \
+ {-O3 -march=z900} {-O3 -march=z13}]
+set-torture-options $MD_TEST_OPTS
+gcc-dg-runtest [lsort [glob -nocomplain $md_tests]] "" $DEFAULT_CFLAGS
torture-finish
Does it really make sense to use different -march options for the md/ tests? Whether a certain
pattern will match usually depends on the -march level. I would say the -march option needs to be
part of testcase.
-Andreas-
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] S/390: Fix warning in "*movstr" pattern.
2015-12-02 8:59 ` Andreas Krebbel
@ 2015-12-02 9:12 ` Dominik Vogt
2015-12-02 10:06 ` Dominik Vogt
0 siblings, 1 reply; 11+ messages in thread
From: Dominik Vogt @ 2015-12-02 9:12 UTC (permalink / raw)
To: gcc-patches; +Cc: Andreas Krebbel, Ulrich Weigand
On Wed, Dec 02, 2015 at 09:59:10AM +0100, Andreas Krebbel wrote:
> On 11/30/2015 03:45 PM, Dominik Vogt wrote:
> > On Mon, Nov 09, 2015 at 01:33:23PM +0100, Andreas Krebbel wrote:
> >> On 11/04/2015 02:39 AM, Dominik Vogt wrote:
> >>> On Tue, Nov 03, 2015 at 06:47:28PM +0100, Ulrich Weigand wrote:
> >>>> Dominik Vogt wrote:
> > +++ b/gcc/testsuite/gcc.target/s390/md/movstr-1.c
> > @@ -0,0 +1,11 @@
> > +/* Machine description pattern tests. */
> > +
> > +/* { dg-do assemble } */
> > +/* { dg-options "-dP -save-temps" } */
>
> -save-temps is not necessary for a dg-do assemble test.
It *is* necessary for "assemble", but not for "compile" which
should be used here. Anyway, I want to upgrade the test to a
"run" test that also veryfies whether the generated code does the
right thing.
> > +# Additional md torture tests.
> > +torture-init
> > +set MD_TEST_OPTS [list \
> > + {-Os -march=z900} {-Os -march=z13} \
> > + {-O0 -march=z900} {-O0 -march=z13} \
> > + {-O1 -march=z900} {-O1 -march=z13} \
> > + {-O2 -march=z900} {-O2 -march=z13} \
> > + {-O3 -march=z900} {-O3 -march=z13}]
> > +set-torture-options $MD_TEST_OPTS
> > +gcc-dg-runtest [lsort [glob -nocomplain $md_tests]] "" $DEFAULT_CFLAGS
> > torture-finish
>
> Does it really make sense to use different -march options for the
> md/ tests? Whether a certain pattern will match usually depends on
> the -march level. I would say the -march option needs to be part
> of testcase.
Agreed, but I think with "run" tests various -march= and -O
options are useful.
Ciao
Dominik ^_^ ^_^
--
Dominik Vogt
IBM Germany
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] S/390: Fix warning in "*movstr" pattern.
2015-12-02 9:12 ` Dominik Vogt
@ 2015-12-02 10:06 ` Dominik Vogt
2015-12-03 14:20 ` Dominik Vogt
0 siblings, 1 reply; 11+ messages in thread
From: Dominik Vogt @ 2015-12-02 10:06 UTC (permalink / raw)
To: gcc-patches; +Cc: Andreas Krebbel, Ulrich Weigand
[-- Attachment #1: Type: text/plain, Size: 1780 bytes --]
On Wed, Dec 02, 2015 at 10:11:54AM +0100, Dominik Vogt wrote:
> On Wed, Dec 02, 2015 at 09:59:10AM +0100, Andreas Krebbel wrote:
> > On 11/30/2015 03:45 PM, Dominik Vogt wrote:
> > > On Mon, Nov 09, 2015 at 01:33:23PM +0100, Andreas Krebbel wrote:
> > >> On 11/04/2015 02:39 AM, Dominik Vogt wrote:
> > >>> On Tue, Nov 03, 2015 at 06:47:28PM +0100, Ulrich Weigand wrote:
> > >>>> Dominik Vogt wrote:
> > > +++ b/gcc/testsuite/gcc.target/s390/md/movstr-1.c
> > > @@ -0,0 +1,11 @@
> > > +/* Machine description pattern tests. */
> > > +
> > > +/* { dg-do assemble } */
> > > +/* { dg-options "-dP -save-temps" } */
> >
> > -save-temps is not necessary for a dg-do assemble test.
>
> It *is* necessary for "assemble", but not for "compile" which
> should be used here. Anyway, I want to upgrade the test to a
> "run" test that also veryfies whether the generated code does the
> right thing.
>
> > > +# Additional md torture tests.
> > > +torture-init
> > > +set MD_TEST_OPTS [list \
> > > + {-Os -march=z900} {-Os -march=z13} \
> > > + {-O0 -march=z900} {-O0 -march=z13} \
> > > + {-O1 -march=z900} {-O1 -march=z13} \
> > > + {-O2 -march=z900} {-O2 -march=z13} \
> > > + {-O3 -march=z900} {-O3 -march=z13}]
> > > +set-torture-options $MD_TEST_OPTS
> > > +gcc-dg-runtest [lsort [glob -nocomplain $md_tests]] "" $DEFAULT_CFLAGS
> > > torture-finish
> >
> > Does it really make sense to use different -march options for the
> > md/ tests? Whether a certain pattern will match usually depends on
> > the -march level. I would say the -march option needs to be part
> > of testcase.
>
> Agreed, but I think with "run" tests various -march= and -O
> options are useful.
Version 4 of the patch attached (enhanced test case).
Ciao
Dominik ^_^ ^_^
--
Dominik Vogt
IBM Germany
[-- Attachment #2: 0001-v4-ChangeLog --]
[-- Type: text/plain, Size: 280 bytes --]
gcc/ChangeLog
* config/s390/s390.md ("movstr", "*movstr"): Fix warning.
("movstr<P:mode>"): New indirect expanders used by "movstr".
testsuite/ChangeLog
* gcc.target/s390/md/movstr-1.c: New test.
* gcc.target/s390/s390.exp: Add subdir md.
Do not run hotpatch tests twice.
[-- Attachment #3: 0001-v4-S-390-Fix-warning-in-movstr-pattern.patch --]
[-- Type: text/x-diff, Size: 4221 bytes --]
From 552c1d416ef33acaa2a119149238666a171cbb1b Mon Sep 17 00:00:00 2001
From: Dominik Vogt <vogt@linux.vnet.ibm.com>
Date: Tue, 3 Nov 2015 18:03:02 +0100
Subject: [PATCH] S/390: Fix warning in "*movstr" pattern.
---
gcc/config/s390/s390.md | 20 +++++++++++++++++---
gcc/testsuite/gcc.target/s390/md/movstr-1.c | 29 +++++++++++++++++++++++++++++
gcc/testsuite/gcc.target/s390/s390.exp | 25 ++++++++++++++++++++-----
3 files changed, 66 insertions(+), 8 deletions(-)
create mode 100644 gcc/testsuite/gcc.target/s390/md/movstr-1.c
diff --git a/gcc/config/s390/s390.md b/gcc/config/s390/s390.md
index e5db537..7eca315 100644
--- a/gcc/config/s390/s390.md
+++ b/gcc/config/s390/s390.md
@@ -2910,13 +2910,27 @@
;
(define_expand "movstr"
+ ;; The pattern is never generated.
+ [(match_operand 0 "" "")
+ (match_operand 1 "" "")
+ (match_operand 2 "" "")]
+ ""
+{
+ if (TARGET_64BIT)
+ emit_insn (gen_movstrdi (operands[0], operands[1], operands[2]));
+ else
+ emit_insn (gen_movstrsi (operands[0], operands[1], operands[2]));
+ DONE;
+})
+
+(define_expand "movstr<P:mode>"
[(set (reg:SI 0) (const_int 0))
(parallel
[(clobber (match_dup 3))
(set (match_operand:BLK 1 "memory_operand" "")
(match_operand:BLK 2 "memory_operand" ""))
- (set (match_operand 0 "register_operand" "")
- (unspec [(match_dup 1)
+ (set (match_operand:P 0 "register_operand" "")
+ (unspec:P [(match_dup 1)
(match_dup 2)
(reg:SI 0)] UNSPEC_MVST))
(clobber (reg:CC CC_REGNUM))])]
@@ -2937,7 +2951,7 @@
(set (mem:BLK (match_operand:P 1 "register_operand" "0"))
(mem:BLK (match_operand:P 3 "register_operand" "2")))
(set (match_operand:P 0 "register_operand" "=d")
- (unspec [(mem:BLK (match_dup 1))
+ (unspec:P [(mem:BLK (match_dup 1))
(mem:BLK (match_dup 3))
(reg:SI 0)] UNSPEC_MVST))
(clobber (reg:CC CC_REGNUM))]
diff --git a/gcc/testsuite/gcc.target/s390/md/movstr-1.c b/gcc/testsuite/gcc.target/s390/md/movstr-1.c
new file mode 100644
index 0000000..2fce743
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/md/movstr-1.c
@@ -0,0 +1,29 @@
+/* Machine description pattern tests. */
+
+/* { dg-do run } */
+/* { dg-options "-dP" } */
+
+void test(char *dest, const char *src)
+{
+ __builtin_stpcpy (dest, src);
+}
+
+/* { dg-final { scan-assembler-times {{[*]movstr}} 1 } } */
+
+#include <string.h>
+#include <stdio.h>
+
+#define LEN 200
+char buf[LEN];
+
+int main(void)
+{
+ memset(buf, 0, LEN);
+ test(buf, "hello world!");
+ if (strcmp(buf, "hello world!") != 0)
+ {
+ fprintf(stderr, "error: test() failed\n");
+ return 1;
+ }
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/s390/s390.exp b/gcc/testsuite/gcc.target/s390/s390.exp
index 0b8f80ed..0d7a7eb 100644
--- a/gcc/testsuite/gcc.target/s390/s390.exp
+++ b/gcc/testsuite/gcc.target/s390/s390.exp
@@ -61,20 +61,35 @@ if ![info exists DEFAULT_CFLAGS] then {
# Initialize `dg'.
dg-init
-set hotpatch_tests $srcdir/$subdir/hotpatch-\[0-9\]*.c
+set md_tests $srcdir/$subdir/md/*.c
# Main loop.
dg-runtest [lsort [prune [glob -nocomplain $srcdir/$subdir/*.\[cS\]] \
- $hotpatch_tests]] "" $DEFAULT_CFLAGS
+ $md_tests]] "" $DEFAULT_CFLAGS
dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*vector*/*.\[cS\]]] \
"" $DEFAULT_CFLAGS
+dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/md/*.\[cS\]]] \
+ "" $DEFAULT_CFLAGS
+
# Additional hotpatch torture tests.
torture-init
-set HOTPATCH_TEST_OPTS [list -Os -O0 -O1 -O2 -O3]
-set-torture-options $HOTPATCH_TEST_OPTS
-gcc-dg-runtest [lsort [glob -nocomplain $hotpatch_tests]] "" $DEFAULT_CFLAGS
+set-torture-options [list -Os -O0 -O1 -O2 -O3]
+gcc-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/hotpatch-\[0-9\]*.c]] \
+ "" $DEFAULT_CFLAGS
+torture-finish
+
+# Additional md torture tests.
+torture-init
+set MD_TEST_OPTS [list \
+ {-Os -march=z900} {-Os -march=z13} \
+ {-O0 -march=z900} {-O0 -march=z13} \
+ {-O1 -march=z900} {-O1 -march=z13} \
+ {-O2 -march=z900} {-O2 -march=z13} \
+ {-O3 -march=z900} {-O3 -march=z13}]
+set-torture-options $MD_TEST_OPTS
+gcc-dg-runtest [lsort [glob -nocomplain $md_tests]] "" $DEFAULT_CFLAGS
torture-finish
# All done.
--
2.3.0
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] S/390: Fix warning in "*movstr" pattern.
2015-12-02 10:06 ` Dominik Vogt
@ 2015-12-03 14:20 ` Dominik Vogt
2015-12-04 17:12 ` Dominik Vogt
0 siblings, 1 reply; 11+ messages in thread
From: Dominik Vogt @ 2015-12-03 14:20 UTC (permalink / raw)
To: gcc-patches; +Cc: Andreas Krebbel
[-- Attachment #1: Type: text/plain, Size: 129 bytes --]
Version 5 with two fixes to the test case. :-/ (ChangeLog is the
same.)
Ciao
Dominik ^_^ ^_^
--
Dominik Vogt
IBM Germany
[-- Attachment #2: 0001-v5-S-390-Fix-warning-in-movstr-pattern.patch --]
[-- Type: text/x-diff, Size: 4259 bytes --]
From 5965f62501b271285bacb90b11ef3f748338d1cf Mon Sep 17 00:00:00 2001
From: Dominik Vogt <vogt@linux.vnet.ibm.com>
Date: Tue, 3 Nov 2015 18:03:02 +0100
Subject: [PATCH] S/390: Fix warning in "*movstr" pattern.
---
gcc/config/s390/s390.md | 20 ++++++++++++++++---
gcc/testsuite/gcc.target/s390/md/movstr-1.c | 30 +++++++++++++++++++++++++++++
gcc/testsuite/gcc.target/s390/s390.exp | 25 +++++++++++++++++++-----
3 files changed, 67 insertions(+), 8 deletions(-)
create mode 100644 gcc/testsuite/gcc.target/s390/md/movstr-1.c
diff --git a/gcc/config/s390/s390.md b/gcc/config/s390/s390.md
index e5db537..7eca315 100644
--- a/gcc/config/s390/s390.md
+++ b/gcc/config/s390/s390.md
@@ -2910,13 +2910,27 @@
;
(define_expand "movstr"
+ ;; The pattern is never generated.
+ [(match_operand 0 "" "")
+ (match_operand 1 "" "")
+ (match_operand 2 "" "")]
+ ""
+{
+ if (TARGET_64BIT)
+ emit_insn (gen_movstrdi (operands[0], operands[1], operands[2]));
+ else
+ emit_insn (gen_movstrsi (operands[0], operands[1], operands[2]));
+ DONE;
+})
+
+(define_expand "movstr<P:mode>"
[(set (reg:SI 0) (const_int 0))
(parallel
[(clobber (match_dup 3))
(set (match_operand:BLK 1 "memory_operand" "")
(match_operand:BLK 2 "memory_operand" ""))
- (set (match_operand 0 "register_operand" "")
- (unspec [(match_dup 1)
+ (set (match_operand:P 0 "register_operand" "")
+ (unspec:P [(match_dup 1)
(match_dup 2)
(reg:SI 0)] UNSPEC_MVST))
(clobber (reg:CC CC_REGNUM))])]
@@ -2937,7 +2951,7 @@
(set (mem:BLK (match_operand:P 1 "register_operand" "0"))
(mem:BLK (match_operand:P 3 "register_operand" "2")))
(set (match_operand:P 0 "register_operand" "=d")
- (unspec [(mem:BLK (match_dup 1))
+ (unspec:P [(mem:BLK (match_dup 1))
(mem:BLK (match_dup 3))
(reg:SI 0)] UNSPEC_MVST))
(clobber (reg:CC CC_REGNUM))]
diff --git a/gcc/testsuite/gcc.target/s390/md/movstr-1.c b/gcc/testsuite/gcc.target/s390/md/movstr-1.c
new file mode 100644
index 0000000..6ab0050
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/md/movstr-1.c
@@ -0,0 +1,30 @@
+/* Machine description pattern tests. */
+
+/* { dg-do run } */
+/* { dg-options "-dP -save-temps" } */
+
+__attribute__ ((noinline))
+void test(char *dest, const char *src)
+{
+ __builtin_stpcpy (dest, src);
+}
+
+/* { dg-final { scan-assembler-times {{[*]movstr}} 1 } } */
+
+#include <string.h>
+#include <stdio.h>
+
+#define LEN 200
+char buf[LEN];
+
+int main(void)
+{
+ memset(buf, 0, LEN);
+ test(buf, "hello world!");
+ if (strcmp(buf, "hello world!") != 0)
+ {
+ fprintf(stderr, "error: test() failed\n");
+ return 1;
+ }
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/s390/s390.exp b/gcc/testsuite/gcc.target/s390/s390.exp
index 0b8f80ed..0d7a7eb 100644
--- a/gcc/testsuite/gcc.target/s390/s390.exp
+++ b/gcc/testsuite/gcc.target/s390/s390.exp
@@ -61,20 +61,35 @@ if ![info exists DEFAULT_CFLAGS] then {
# Initialize `dg'.
dg-init
-set hotpatch_tests $srcdir/$subdir/hotpatch-\[0-9\]*.c
+set md_tests $srcdir/$subdir/md/*.c
# Main loop.
dg-runtest [lsort [prune [glob -nocomplain $srcdir/$subdir/*.\[cS\]] \
- $hotpatch_tests]] "" $DEFAULT_CFLAGS
+ $md_tests]] "" $DEFAULT_CFLAGS
dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*vector*/*.\[cS\]]] \
"" $DEFAULT_CFLAGS
+dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/md/*.\[cS\]]] \
+ "" $DEFAULT_CFLAGS
+
# Additional hotpatch torture tests.
torture-init
-set HOTPATCH_TEST_OPTS [list -Os -O0 -O1 -O2 -O3]
-set-torture-options $HOTPATCH_TEST_OPTS
-gcc-dg-runtest [lsort [glob -nocomplain $hotpatch_tests]] "" $DEFAULT_CFLAGS
+set-torture-options [list -Os -O0 -O1 -O2 -O3]
+gcc-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/hotpatch-\[0-9\]*.c]] \
+ "" $DEFAULT_CFLAGS
+torture-finish
+
+# Additional md torture tests.
+torture-init
+set MD_TEST_OPTS [list \
+ {-Os -march=z900} {-Os -march=z13} \
+ {-O0 -march=z900} {-O0 -march=z13} \
+ {-O1 -march=z900} {-O1 -march=z13} \
+ {-O2 -march=z900} {-O2 -march=z13} \
+ {-O3 -march=z900} {-O3 -march=z13}]
+set-torture-options $MD_TEST_OPTS
+gcc-dg-runtest [lsort [glob -nocomplain $md_tests]] "" $DEFAULT_CFLAGS
torture-finish
# All done.
--
2.3.0
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] S/390: Fix warning in "*movstr" pattern.
2015-12-03 14:20 ` Dominik Vogt
@ 2015-12-04 17:12 ` Dominik Vogt
2015-12-11 11:20 ` Andreas Krebbel
0 siblings, 1 reply; 11+ messages in thread
From: Dominik Vogt @ 2015-12-04 17:12 UTC (permalink / raw)
To: gcc-patches; +Cc: Andreas Krebbel, Ulrich Weigand
[-- Attachment #1: Type: text/plain, Size: 106 bytes --]
Version 6 with another fix. This should work now.
Ciao
Dominik ^_^ ^_^
--
Dominik Vogt
IBM Germany
[-- Attachment #2: 0001-v6-ChangeLog --]
[-- Type: text/plain, Size: 283 bytes --]
gcc/ChangeLog
* config/s390/s390.md ("movstr", "*movstr"): Fix warning.
("movstr<P:mode>"): New indirect expanders used by "movstr".
gcc/testsuite/ChangeLog
* gcc.target/s390/md/movstr-1.c: New test.
* gcc.target/s390/s390.exp: Add subdir md.
Do not run hotpatch tests twice.
[-- Attachment #3: 0001-v6-S-390-Fix-warning-in-movstr-pattern.patch --]
[-- Type: text/x-diff, Size: 4181 bytes --]
From 3bbf6dd63bfd290848f8445f4309c5fcda92f18b Mon Sep 17 00:00:00 2001
From: Dominik Vogt <vogt@linux.vnet.ibm.com>
Date: Tue, 3 Nov 2015 18:03:02 +0100
Subject: [PATCH] S/390: Fix warning in "*movstr" pattern.
---
gcc/config/s390/s390.md | 19 ++++++++++++++++---
gcc/testsuite/gcc.target/s390/md/movstr-1.c | 24 ++++++++++++++++++++++++
gcc/testsuite/gcc.target/s390/s390.exp | 25 ++++++++++++++++++++-----
3 files changed, 60 insertions(+), 8 deletions(-)
create mode 100644 gcc/testsuite/gcc.target/s390/md/movstr-1.c
diff --git a/gcc/config/s390/s390.md b/gcc/config/s390/s390.md
index e5db537..bc24a36 100644
--- a/gcc/config/s390/s390.md
+++ b/gcc/config/s390/s390.md
@@ -2910,13 +2910,26 @@
;
(define_expand "movstr"
+ [(match_operand 0 "register_operand" "")
+ (match_operand 1 "memory_operand" "")
+ (match_operand 2 "memory_operand" "")]
+ ""
+{
+ if (TARGET_64BIT)
+ emit_insn (gen_movstrdi (operands[0], operands[1], operands[2]));
+ else
+ emit_insn (gen_movstrsi (operands[0], operands[1], operands[2]));
+ DONE;
+})
+
+(define_expand "movstr<P:mode>"
[(set (reg:SI 0) (const_int 0))
(parallel
[(clobber (match_dup 3))
(set (match_operand:BLK 1 "memory_operand" "")
(match_operand:BLK 2 "memory_operand" ""))
- (set (match_operand 0 "register_operand" "")
- (unspec [(match_dup 1)
+ (set (match_operand:P 0 "register_operand" "")
+ (unspec:P [(match_dup 1)
(match_dup 2)
(reg:SI 0)] UNSPEC_MVST))
(clobber (reg:CC CC_REGNUM))])]
@@ -2937,7 +2950,7 @@
(set (mem:BLK (match_operand:P 1 "register_operand" "0"))
(mem:BLK (match_operand:P 3 "register_operand" "2")))
(set (match_operand:P 0 "register_operand" "=d")
- (unspec [(mem:BLK (match_dup 1))
+ (unspec:P [(mem:BLK (match_dup 1))
(mem:BLK (match_dup 3))
(reg:SI 0)] UNSPEC_MVST))
(clobber (reg:CC CC_REGNUM))]
diff --git a/gcc/testsuite/gcc.target/s390/md/movstr-1.c b/gcc/testsuite/gcc.target/s390/md/movstr-1.c
new file mode 100644
index 0000000..7da749b
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/md/movstr-1.c
@@ -0,0 +1,24 @@
+/* Machine description pattern tests. */
+
+/* { dg-do run } */
+/* { dg-options "-dP -save-temps" } */
+
+__attribute__ ((noinline))
+void test(char *dest, const char *src)
+{
+ __builtin_stpcpy (dest, src);
+}
+
+/* { dg-final { scan-assembler-times {{[*]movstr}} 1 } } */
+
+#define LEN 200
+char buf[LEN];
+
+int main(void)
+{
+ __builtin_memset(buf, 0, LEN);
+ test(buf, "hello world!");
+ if (__builtin_strcmp(buf, "hello world!") != 0)
+ __builtin_abort();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/s390/s390.exp b/gcc/testsuite/gcc.target/s390/s390.exp
index 0b8f80ed..0d7a7eb 100644
--- a/gcc/testsuite/gcc.target/s390/s390.exp
+++ b/gcc/testsuite/gcc.target/s390/s390.exp
@@ -61,20 +61,35 @@ if ![info exists DEFAULT_CFLAGS] then {
# Initialize `dg'.
dg-init
-set hotpatch_tests $srcdir/$subdir/hotpatch-\[0-9\]*.c
+set md_tests $srcdir/$subdir/md/*.c
# Main loop.
dg-runtest [lsort [prune [glob -nocomplain $srcdir/$subdir/*.\[cS\]] \
- $hotpatch_tests]] "" $DEFAULT_CFLAGS
+ $md_tests]] "" $DEFAULT_CFLAGS
dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*vector*/*.\[cS\]]] \
"" $DEFAULT_CFLAGS
+dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/md/*.\[cS\]]] \
+ "" $DEFAULT_CFLAGS
+
# Additional hotpatch torture tests.
torture-init
-set HOTPATCH_TEST_OPTS [list -Os -O0 -O1 -O2 -O3]
-set-torture-options $HOTPATCH_TEST_OPTS
-gcc-dg-runtest [lsort [glob -nocomplain $hotpatch_tests]] "" $DEFAULT_CFLAGS
+set-torture-options [list -Os -O0 -O1 -O2 -O3]
+gcc-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/hotpatch-\[0-9\]*.c]] \
+ "" $DEFAULT_CFLAGS
+torture-finish
+
+# Additional md torture tests.
+torture-init
+set MD_TEST_OPTS [list \
+ {-Os -march=z900} {-Os -march=z13} \
+ {-O0 -march=z900} {-O0 -march=z13} \
+ {-O1 -march=z900} {-O1 -march=z13} \
+ {-O2 -march=z900} {-O2 -march=z13} \
+ {-O3 -march=z900} {-O3 -march=z13}]
+set-torture-options $MD_TEST_OPTS
+gcc-dg-runtest [lsort [glob -nocomplain $md_tests]] "" $DEFAULT_CFLAGS
torture-finish
# All done.
--
2.3.0
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] S/390: Fix warning in "*movstr" pattern.
2015-12-04 17:12 ` Dominik Vogt
@ 2015-12-11 11:20 ` Andreas Krebbel
0 siblings, 0 replies; 11+ messages in thread
From: Andreas Krebbel @ 2015-12-11 11:20 UTC (permalink / raw)
To: gcc-patches, vogt
On 12/04/2015 06:12 PM, Dominik Vogt wrote:
> Version 6 with another fix. This should work now.
Applied. Thanks!
-Andreas-
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2015-12-11 11:20 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-03 17:17 [PATCH] S/390: Fix warning in "*movstr" pattern Dominik Vogt
2015-11-03 17:47 ` Ulrich Weigand
2015-11-04 1:39 ` Dominik Vogt
2015-11-09 12:33 ` Andreas Krebbel
2015-11-30 14:48 ` Dominik Vogt
2015-12-02 8:59 ` Andreas Krebbel
2015-12-02 9:12 ` Dominik Vogt
2015-12-02 10:06 ` Dominik Vogt
2015-12-03 14:20 ` Dominik Vogt
2015-12-04 17:12 ` Dominik Vogt
2015-12-11 11:20 ` Andreas Krebbel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).