diff mbox

[PR43597,ARM,TESTCASE]

Message ID 4E24146F.8000508@codesourcery.com
State New
Headers show

Commit Message

Tom de Vries July 18, 2011, 11:09 a.m. UTC
Hi,

PR43597 was fixed by http://gcc.gnu.org/viewcvs?view=revision&revision=172032.

This patch adds a testcase.

OK for trunk?

Thanks,
- Tom

2011-07-18  Tom de Vries  <tom@codesourcery.com>

    PR target/43597
    * gcc.target/arm/pr43597.c: New test.

Comments

Richard Earnshaw July 18, 2011, 12:19 p.m. UTC | #1
On 18/07/11 12:09, Tom de Vries wrote:
> Hi,
> 
> PR43597 was fixed by http://gcc.gnu.org/viewcvs?view=revision&revision=172032.
> 
> This patch adds a testcase.
> 
> OK for trunk?
> 
> Thanks,
> - Tom
> 
> 2011-07-18  Tom de Vries  <tom@codesourcery.com>
> 
>     PR target/43597
>     * gcc.target/arm/pr43597.c: New test.
> 
> 

No, don't pass -mthumb through dg-options unless you're using something
like require-effective-target.

In this case the post-compile tests are all gated on thumb2.  So why not
make the whole test just require arm_thumb2_ok?

R.


> 
> 
> pr43597.patch
> 
> 
> Index: gcc.target/arm/pr43597.c
> ===================================================================
> --- /dev/null (new file)
> +++ gcc.target/arm/pr43597.c (revision 0)
> @@ -0,0 +1,24 @@
> +/* { dg-do assemble } */
> +/* { dg-options "-Os -save-temps -mthumb" } */
> +
> +extern int bar();
> +extern void bar2(int);
> +int foo4()
> +{
> +     int result = 0;
> +     int f = -1;
> +     f = bar();
> +     if (f < 0) {
> +         result = 1;
> +         goto bail;
> +     }
> +      bar();
> +bail:
> +      bar2(f);
> +      return result;
> +}
> +
> +/* { dg-final { scan-assembler-times "sub" 1 { target arm_thumb2_ok } } } */
> +/* { dg-final { scan-assembler-times "cmp" 0 { target arm_thumb2_ok } } } */
> +/* { dg-final { object-size text <= 30 { target arm_thumb2_ok } } } */
> +/* { dg-final { cleanup-saved-temps "pr43597" } } */
Janis Johnson July 31, 2011, 7:21 p.m. UTC | #2
On 07/18/2011 05:19 AM, Richard Earnshaw wrote:
> On 18/07/11 12:09, Tom de Vries wrote:
>> Hi,
>>
>> PR43597 was fixed by http://gcc.gnu.org/viewcvs?view=revision&revision=172032.
>>
>> This patch adds a testcase.
>>
>> OK for trunk?
>>
>> Thanks,
>> - Tom
>>
>> 2011-07-18  Tom de Vries  <tom@codesourcery.com>
>>
>>     PR target/43597
>>     * gcc.target/arm/pr43597.c: New test.
>>
>>
> 
> No, don't pass -mthumb through dg-options unless you're using something
> like require-effective-target.
> 
> In this case the post-compile tests are all gated on thumb2.  So why not
> make the whole test just require arm_thumb2_ok?
> 
> R.
>

arm_thumb2_ok says that the target generates thumb2 code with -thumb.
arm_thumb2 says that with no additional options it generates thumb2
code.

The test could use either "dg-require-effective-target arm_thumb2" or
"dg-require-effective-target arm_thumb2_ok" plus "dg-options "-mthumb";
for either of those the checks on dg-final aren't necessary.

Janis

> 
>>
>>
>> pr43597.patch
>>
>>
>> Index: gcc.target/arm/pr43597.c
>> ===================================================================
>> --- /dev/null (new file)
>> +++ gcc.target/arm/pr43597.c (revision 0)
>> @@ -0,0 +1,24 @@
>> +/* { dg-do assemble } */
>> +/* { dg-options "-Os -save-temps -mthumb" } */
>> +
>> +extern int bar();
>> +extern void bar2(int);
>> +int foo4()
>> +{
>> +     int result = 0;
>> +     int f = -1;
>> +     f = bar();
>> +     if (f < 0) {
>> +         result = 1;
>> +         goto bail;
>> +     }
>> +      bar();
>> +bail:
>> +      bar2(f);
>> +      return result;
>> +}
>> +
>> +/* { dg-final { scan-assembler-times "sub" 1 { target arm_thumb2_ok } } } */
>> +/* { dg-final { scan-assembler-times "cmp" 0 { target arm_thumb2_ok } } } */
>> +/* { dg-final { object-size text <= 30 { target arm_thumb2_ok } } } */
>> +/* { dg-final { cleanup-saved-temps "pr43597" } } */
> 
>
diff mbox

Patch

Index: gcc.target/arm/pr43597.c
===================================================================
--- /dev/null (new file)
+++ gcc.target/arm/pr43597.c (revision 0)
@@ -0,0 +1,24 @@ 
+/* { dg-do assemble } */
+/* { dg-options "-Os -save-temps -mthumb" } */
+
+extern int bar();
+extern void bar2(int);
+int foo4()
+{
+     int result = 0;
+     int f = -1;
+     f = bar();
+     if (f < 0) {
+         result = 1;
+         goto bail;
+     }
+      bar();
+bail:
+      bar2(f);
+      return result;
+}
+
+/* { dg-final { scan-assembler-times "sub" 1 { target arm_thumb2_ok } } } */
+/* { dg-final { scan-assembler-times "cmp" 0 { target arm_thumb2_ok } } } */
+/* { dg-final { object-size text <= 30 { target arm_thumb2_ok } } } */
+/* { dg-final { cleanup-saved-temps "pr43597" } } */