* [GSoC][match-and-simplify] add more constant folding tests
@ 2014-08-17 19:41 Prathamesh Kulkarni
2014-08-18 11:05 ` Richard Biener
2014-08-18 17:40 ` David Malcolm
0 siblings, 2 replies; 5+ messages in thread
From: Prathamesh Kulkarni @ 2014-08-17 19:41 UTC (permalink / raw)
To: Richard Biener, Diego Novillo, gcc-patches, Maxim Kuvyrkov
[-- Attachment #1: Type: text/plain, Size: 201 bytes --]
We now have at-least one test-case for each of constant folding patterns
in match-constant-folding.pd
[gcc/testsuite/gcc.dg/tree-ssa]
* match-constant-folding.c: Add test-cases.
Thanks,
Prathamesh
[-- Attachment #2: constant-folding-tests.patch --]
[-- Type: text/x-patch, Size: 1849 bytes --]
Index: match-constant-folding.c
===================================================================
--- match-constant-folding.c (revision 214020)
+++ match-constant-folding.c (working copy)
@@ -55,4 +55,68 @@ int c6(int x)
}
/* { dg-final { scan-tree-dump "Match-and-simplified x_\\d\+\\(D\\) \\* t1_\\d\+ to x_\\d\+\\(D\\)" "ccp1" } } */
+/* x / 1 -> x */
+int c7(int x)
+{
+ int t1 = 1;
+ int c7_val = x / t1;
+ return c7_val;
+}
+/* { dg-final { scan-tree-dump "Match-and-simplified x_\\d\+\\(D\\) / t1_\\d\+ to x_\\d\+\\(D\\)" "ccp1" } } */
+
+/* x % x -> 1 */
+int c8(int x)
+{
+ int t1 = x;
+ int c8_val = x % t1;
+ return c8_val;
+}
+/* { dg-final { scan-tree-dump "gimple_simplified to c8_val_\\d\+ = 0" "forwprop1" } } */
+
+/* x | 0 -> x */
+int c9(int x)
+{
+ int t1 = 0;
+ int c9_val = x | t1;
+ return c9_val;
+}
+/* { dg-final { scan-tree-dump "Match-and-simplified x_\\d\+\\(D\\) | t1_\\d\+ to x_\\d\+\\(D\\)" "ccp1" } } */
+
+/* x | -1 -> -1 */
+int c10(int x)
+{
+ int t1 = -1;
+ int c10_val = x | t1;
+ return c10_val;
+}
+/* { dg-final { scan-tree-dump "Match-and-simplified x_\\d\+\\(D\\) | t1_\\d\+ to -1" "ccp1" } } */
+
+/* x & -1 -> x */
+int c11(int x)
+{
+ int t1 = -1;
+ int c11_val = x & t1;
+ return c11_val;
+}
+/* { dg-final { scan-tree-dump "Match-and-simplified x_\\d\+\\(D\\) & t1_\\d\+ to x_\\d\+\\(D\\)" "ccp1" } } */
+
+/* x & 0 -> 0 */
+int c12(int x)
+{
+ int t1 = 0;
+ int c12_val = x & t1;
+ return c12_val;
+}
+/* { dg-final { scan-tree-dump "Match-and-simplified x_\\d\+\\(D\\) & t1_\\d\+ to 0" "ccp1" } } */
+
+/* x ^ 0 -> x */
+int c13(int x)
+{
+ int t1 = 0;
+ int c13_val = x ^ t1;
+ return c13_val;
+}
+/* { dg-final { scan-tree-dump "Match-and-simplified x_\\d\+\\(D\\) \\^ t1_\\d\+ to x_\\d\+\\(D\\)" "ccp1" } } */
+
+
/* { dg-final { cleanup-tree-dump "forwprop2" } } */
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [GSoC][match-and-simplify] add more constant folding tests
2014-08-17 19:41 [GSoC][match-and-simplify] add more constant folding tests Prathamesh Kulkarni
@ 2014-08-18 11:05 ` Richard Biener
2014-08-18 17:40 ` David Malcolm
1 sibling, 0 replies; 5+ messages in thread
From: Richard Biener @ 2014-08-18 11:05 UTC (permalink / raw)
To: Prathamesh Kulkarni; +Cc: Diego Novillo, gcc-patches, Maxim Kuvyrkov
On Sun, Aug 17, 2014 at 9:41 PM, Prathamesh Kulkarni
<bilbotheelffriend@gmail.com> wrote:
> We now have at-least one test-case for each of constant folding patterns
> in match-constant-folding.pd
>
> [gcc/testsuite/gcc.dg/tree-ssa]
> * match-constant-folding.c: Add test-cases.
Thanks - committed.
Richard.
> Thanks,
> Prathamesh
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [GSoC][match-and-simplify] add more constant folding tests
2014-08-17 19:41 [GSoC][match-and-simplify] add more constant folding tests Prathamesh Kulkarni
2014-08-18 11:05 ` Richard Biener
@ 2014-08-18 17:40 ` David Malcolm
2014-08-18 18:00 ` Prathamesh Kulkarni
1 sibling, 1 reply; 5+ messages in thread
From: David Malcolm @ 2014-08-18 17:40 UTC (permalink / raw)
To: Prathamesh Kulkarni
Cc: Richard Biener, Diego Novillo, gcc-patches, Maxim Kuvyrkov
On Mon, 2014-08-18 at 01:11 +0530, Prathamesh Kulkarni wrote:
> We now have at-least one test-case for each of constant folding
> patterns
> in match-constant-folding.pd
>
> [gcc/testsuite/gcc.dg/tree-ssa]
> * match-constant-folding.c: Add test-cases.
>
> [...snip...]
A minor nit for one of the comments, for modulo division:
> Index: match-constant-folding.c
> ===================================================================
> --- match-constant-folding.c (revision 214020)
> +++ match-constant-folding.c (working copy)
[...]
> +/* x % x -> 1 */
^
0, rather than 1, surely?
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [GSoC][match-and-simplify] add more constant folding tests
2014-08-18 17:40 ` David Malcolm
@ 2014-08-18 18:00 ` Prathamesh Kulkarni
2014-08-19 8:16 ` Richard Biener
0 siblings, 1 reply; 5+ messages in thread
From: Prathamesh Kulkarni @ 2014-08-18 18:00 UTC (permalink / raw)
To: David Malcolm; +Cc: Richard Biener, Diego Novillo, gcc-patches, Maxim Kuvyrkov
[-- Attachment #1: Type: text/plain, Size: 814 bytes --]
On Mon, Aug 18, 2014 at 11:06 PM, David Malcolm <dmalcolm@redhat.com> wrote:
> On Mon, 2014-08-18 at 01:11 +0530, Prathamesh Kulkarni wrote:
>> We now have at-least one test-case for each of constant folding
>> patterns
>> in match-constant-folding.pd
>>
>> [gcc/testsuite/gcc.dg/tree-ssa]
>> * match-constant-folding.c: Add test-cases.
>>
>> [...snip...]
>
> A minor nit for one of the comments, for modulo division:
>
>> Index: match-constant-folding.c
>> ===================================================================
>> --- match-constant-folding.c (revision 214020)
>> +++ match-constant-folding.c (working copy)
> [...]
>
>> +/* x % x -> 1 */
> ^
> 0, rather than 1, surely?
Thanks, fixed in this patch.
* testsuite/match-constant-folding.c: Fix typo.
Regards,
Prathamesh
>
>
>
[-- Attachment #2: foo.patch --]
[-- Type: text/x-patch, Size: 410 bytes --]
Index: match-constant-folding.c
===================================================================
--- match-constant-folding.c (revision 214101)
+++ match-constant-folding.c (working copy)
@@ -64,7 +64,7 @@ int c7(int x)
}
/* { dg-final { scan-tree-dump "Match-and-simplified x_\\d\+\\(D\\) / t1_\\d\+ to x_\\d\+\\(D\\)" "ccp1" } } */
-/* x % x -> 1 */
+/* x % x -> 0 */
int c8(int x)
{
int t1 = x;
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [GSoC][match-and-simplify] add more constant folding tests
2014-08-18 18:00 ` Prathamesh Kulkarni
@ 2014-08-19 8:16 ` Richard Biener
0 siblings, 0 replies; 5+ messages in thread
From: Richard Biener @ 2014-08-19 8:16 UTC (permalink / raw)
To: Prathamesh Kulkarni
Cc: David Malcolm, Diego Novillo, gcc-patches, Maxim Kuvyrkov
On Mon, Aug 18, 2014 at 8:00 PM, Prathamesh Kulkarni
<bilbotheelffriend@gmail.com> wrote:
> On Mon, Aug 18, 2014 at 11:06 PM, David Malcolm <dmalcolm@redhat.com> wrote:
>> On Mon, 2014-08-18 at 01:11 +0530, Prathamesh Kulkarni wrote:
>>> We now have at-least one test-case for each of constant folding
>>> patterns
>>> in match-constant-folding.pd
>>>
>>> [gcc/testsuite/gcc.dg/tree-ssa]
>>> * match-constant-folding.c: Add test-cases.
>>>
>>> [...snip...]
>>
>> A minor nit for one of the comments, for modulo division:
>>
>>> Index: match-constant-folding.c
>>> ===================================================================
>>> --- match-constant-folding.c (revision 214020)
>>> +++ match-constant-folding.c (working copy)
>> [...]
>>
>>> +/* x % x -> 1 */
>> ^
>> 0, rather than 1, surely?
> Thanks, fixed in this patch.
>
> * testsuite/match-constant-folding.c: Fix typo.
Applied.
Richard.
> Regards,
> Prathamesh
>>
>>
>>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2014-08-19 8:16 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-17 19:41 [GSoC][match-and-simplify] add more constant folding tests Prathamesh Kulkarni
2014-08-18 11:05 ` Richard Biener
2014-08-18 17:40 ` David Malcolm
2014-08-18 18:00 ` Prathamesh Kulkarni
2014-08-19 8:16 ` Richard Biener
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).