[PATCH, VECTOR ABI] Add __attribute__((__simd__)) to GCC.

Kyrill Tkachov kyrylo.tkachov@arm.com
Fri Nov 20 12:15:00 GMT 2015


Hi Kirill,

On 18/11/15 14:11, Kirill Yukhin wrote:
> Hello Andreas, Devid.
>
> On 18 Nov 10:45, Andreas Schwab wrote:
>> Kirill Yukhin <kirill.yukhin@gmail.com> writes:
>>
>>> diff --git a/gcc/testsuite/c-c++-common/attr-simd.c b/gcc/testsuite/c-c++-common/attr-simd.c
>>> new file mode 100644
>>> index 0000000..b4eda34
>>> --- /dev/null
>>> +++ b/gcc/testsuite/c-c++-common/attr-simd.c
>>> @@ -0,0 +1,32 @@
>>> +/* { dg-do compile } */
>>> +/* { dg-options "-fdump-tree-optimized" } */
>>> +
>>> +__attribute__((__simd__))
>>> +extern
>>> +int simd_attr (void)
>>> +{
>>> +  return 0;
>>> +}
>>> +
>>> +/* { dg-final { scan-tree-dump "simd_attr\[ \\t\]simdclone|vector" "optimized" } } */
>> On ia64:
>>
>> FAIL: c-c++-common/attr-simd.c  -Wc++-compat   scan-tree-dump optimized "simd_attr[ \\t]simdclone|vector"
>> FAIL: c-c++-common/attr-simd.c  -Wc++-compat   scan-tree-dump optimized "simd_attr2[ \\t]simdclone|vector"
>>
>> $ grep simd_attr attr-simd.c.194t.optimized
>> ;; Function simd_attr (simd_attr, funcdef_no=0, decl_uid=1389, cgraph_uid=0, symbol_order=0)
>> simd_attr ()
>> ;; Function simd_attr2 (simd_attr2, funcdef_no=1, decl_uid=1392, cgraph_uid=1, symbol_order=1)
>> simd_attr2 ()
> As far as vABI is supported on x86_64/i?86 only, I am going to enable mentioned `scan-tree-dump' only
> for these targets. This should cure both IA64 and Power.
>
> Concerning attr-simd-3.c. It is known issue: PR68158.
> And I believe this test should work everywhere as far as PR is resolved.
> I'll put xfail into the test.
> Which will lead to (in g++.log):
> gcc/testsuite/c-c++-common/attr-simd-3.c:5:48: warning: '__simd__' attribute does not apply to types\
>   [-Wattributes]^M
> output is:
> gcc/testsuite/c-c++-common/attr-simd-3.c:5:48: warning: '__simd__' attribute does not apply to types\
>   [-Wattributes]^M
>
> XFAIL: c-c++-common/attr-simd-3.c  -std=gnu++98 PR68158 (test for errors, line 5)
> FAIL: c-c++-common/attr-simd-3.c  -std=gnu++98 (test for excess errors)
> Excess errors:
> gcc/testsuite/c-c++-common/attr-simd-3.c:5:48: warning: '__simd__' attribute does not apply to types\
>   [-Wattributes]
>
> Patch in the bottom.
>
> gcc/tessuite/
> 	* c-c++-common/attr-simd-3.c: Put xfail (PR68158) on dg-error.

This test fails on bare-metal targets that don't support -fcilkplus or -pthread.
Would you consider moving them to the cilkplus testing directory or adding an appropriate
effective target check?

Thanks,
Kyrill

> 	* c-c++-common/attr-simd.c: Limit scan of dump to x86_64/i?86.
>
>> Andreas.
>>
>> -- 
>> Andreas Schwab, SUSE Labs, schwab@suse.de
>> GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
>> "And now for something completely different."
> diff --git a/gcc/testsuite/c-c++-common/attr-simd-3.c b/gcc/testsuite/c-c++-common/attr-simd-3.c
> index 2bbdf04..35dd4c0 100644
> --- a/gcc/testsuite/c-c++-common/attr-simd-3.c
> +++ b/gcc/testsuite/c-c++-common/attr-simd-3.c
> @@ -2,4 +2,4 @@
>   /* { dg-options "-fcilkplus" } */
>   /* { dg-prune-output "undeclared here \\(not in a function\\)|\[^\n\r\]* was not declared in this scope" } */
>
> -void f () __attribute__((__simd__, __vector__)); /* { dg-error "in the same function marked as a Cilk Plus" } */
> +void f () __attribute__((__simd__, __vector__)); /* { dg-error "in the same function marked as a Cilk Plus" "PR68158" { xfail c++ } } */
> diff --git a/gcc/testsuite/c-c++-common/attr-simd.c b/gcc/testsuite/c-c++-common/attr-simd.c
> index 61974e3..7674588 100644
> --- a/gcc/testsuite/c-c++-common/attr-simd.c
> +++ b/gcc/testsuite/c-c++-common/attr-simd.c
> @@ -11,7 +11,7 @@ int simd_attr (void)
>     return 0;
>   }
>
> -/* { dg-final { scan-tree-dump "simd_attr\[ \\t\]simdclone|vector" "optimized" } } */
> +/* { dg-final { scan-tree-dump "simd_attr\[ \\t\]simdclone|vector" "optimized" { target { i?86-*-* x86_64-*-* } } } } */
>   /* { dg-final { scan-assembler-times "_ZGVbN4_simd_attr:" 1 { target { i?86-*-* x86_64-*-* } } } } */
>   /* { dg-final { scan-assembler-times "_ZGVbM4_simd_attr:" 1 { target { i?86-*-* x86_64-*-* } } } } */
>   /* { dg-final { scan-assembler-times "_ZGVcN4_simd_attr:" 1 { target { i?86-*-* x86_64-*-* } } } } */
> @@ -29,7 +29,7 @@ int simd_attr2 (void)
>     return 0;
>   }
>
> -/* { dg-final { scan-tree-dump "simd_attr2\[ \\t\]simdclone|vector" "optimized" } } */
> +/* { dg-final { scan-tree-dump "simd_attr2\[ \\t\]simdclone|vector" "optimized" { target { i?86-*-* x86_64-*-* } } } } */
>   /* { dg-final { scan-assembler-times "_ZGVbN4_simd_attr2:" 1 { target { i?86-*-* x86_64-*-* } } } } */
>   /* { dg-final { scan-assembler-times "_ZGVbM4_simd_attr2:" 1 { target { i?86-*-* x86_64-*-* } } } } */
>   /* { dg-final { scan-assembler-times "_ZGVcN4_simd_attr2:" 1 { target { i?86-*-* x86_64-*-* } } } } */
>



More information about the Gcc-patches mailing list