[PATCH,PTX] Add support for CUDA 9
Cesar Philippidis
cesar@codesourcery.com
Fri Jan 19 04:27:00 GMT 2018
On 12/19/2017 04:39 PM, Tom de Vries wrote:
> On 12/20/2017 12:25 AM, Cesar Philippidis wrote:
>> og7-ptx-cuda9.diff
>>
>>
>> 2017-12-19 Cesar Philippidis <cesar@codesourcery.com>
>>
>> Â Â Â Â gcc/
>> Â Â Â Â * config/nvptx/nvptx.c (output_init_frag): Don't use generic address
>> Â Â Â Â spaces for function labels.
>>
>> Â Â Â Â gcc/testsuite/
>> Â Â Â Â * gcc.target/nvptx/indirect_call.c: New test.
>>
>>
>> diff --git a/gcc/config/nvptx/nvptx.c b/gcc/config/nvptx/nvptx.c
>> index dfb27ef..a7b4c09 100644
>> --- a/gcc/config/nvptx/nvptx.c
>> +++ b/gcc/config/nvptx/nvptx.c
>> @@ -1894,9 +1894,15 @@ output_init_frag (rtx sym)
>> Â Â Â Â Â Â if (sym)
>> Â Â Â Â Â {
>> -Â Â Â Â Â fprintf (asm_out_file, "generic(");
>> +Â Â Â Â Â bool function = SYMBOL_REF_DECL (sym)
>> +Â Â Â && (TREE_CODE (SYMBOL_REF_DECL (sym)) == FUNCTION_DECL);
>
> Please indent using parentheses like this:
>
> bool function = (SYMBOL_REF_DECL (sym)
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â && (TREE_CODE (SYMBOL_REF_DECL (sym)) == ...));
Done.
>> +Â Â Â Â Â if (!function)
>> +Â Â Â fprintf (asm_out_file, "generic(");
>> Â Â Â Â Â Â Â output_address (VOIDmode, sym);
>> -Â Â Â Â Â fprintf (asm_out_file, val ? ") + " : ")");
>> +Â Â Â Â Â if (!function)
>> +Â Â Â fprintf (asm_out_file, val ? ") + " : ")");
>> +Â Â Â Â Â else if (val)
>> +Â Â Â fprintf (asm_out_file, " + ");
>
>
> Please use:
>
> Â Â Â Â Â if (!function)
> Â Â Â Â fprintf (asm_out_file, ")");
> Â Â Â Â Â if (val)
> Â Â Â Â fprintf (asm_out_file, " + ");
Done.
>> Â Â Â Â Â }
>> Â Â Â Â if (!sym || val)
>> diff --git a/gcc/testsuite/gcc.target/nvptx/indirect_call.c
>> b/gcc/testsuite/gcc.target/nvptx/indirect_call.c
>> new file mode 100644
>> index 0000000..39992a7
>> --- /dev/null
>> +++ b/gcc/testsuite/gcc.target/nvptx/indirect_call.c
>> @@ -0,0 +1,19 @@
>> +/* { dg-options "-O2 -msoft-stack" } */
>> +/* { dg-do run } */
>> +
>> +int
>> +f1 (int a)
>> +{
>> +Â return a + 1;
>> +}
>> +
>> +int (*f2)(int) = f1;
>> +
>> +int
>> +main ()
>> +{
>> +Â if (f2 (100) != 101)
>> +Â Â Â __builtin_abort();
>> +
>> +Â return 0;
>> +}
>>
Here's the updated patch with the changes that you requested. There are
no new regressions in trunk. I tested it on my desktop running driver
387.34 on a Pascal GPU.
Is this OK for trunk?
Cesar
-------------- next part --------------
A non-text attachment was scrubbed...
Name: trunk-cuda9.diff
Type: text/x-patch
Size: 1363 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20180119/89eb6181/attachment.bin>
More information about the Gcc-patches
mailing list