* [Ada] Add support for __builtin_prefetch
@ 2019-05-28 7:44 Eric Botcazou
0 siblings, 0 replies; only message in thread
From: Eric Botcazou @ 2019-05-28 7:44 UTC (permalink / raw)
To: gcc-patches
[-- Attachment #1: Type: text/plain, Size: 392 bytes --]
This adds support for __builtin_prefetch in Ada.
Tested on x86_64-suse-linux, applied on the mainline.
2019-05-28 Eric Botcazou <ebotcazou@adacore.com>
* gcc-interface/decl.c (intrin_arglists_compatible_p): Do not return
false if the internal builtin uses a variable list.
2019-05-28 Eric Botcazou <ebotcazou@adacore.com>
* gnat.dg/prefetch1.ad[sb]: New test.
--
Eric Botcazou
[-- Attachment #2: p.diff --]
[-- Type: text/x-patch, Size: 649 bytes --]
Index: gcc-interface/decl.c
===================================================================
--- gcc-interface/decl.c (revision 271528)
+++ gcc-interface/decl.c (working copy)
@@ -9174,9 +9174,9 @@ intrin_arglists_compatible_p (intrin_bin
if (!ada_type && !btin_type)
break;
- /* If one list is shorter than the other, they fail to match. */
- if (!ada_type || !btin_type)
- return false;
+ /* If the internal builtin uses a variable list, accept anything. */
+ if (!btin_type)
+ break;
/* If we're done with the Ada args and not with the internal builtin
args, or the other way around, complain. */
[-- Attachment #3: prefetch1.ads --]
[-- Type: text/x-adasrc, Size: 190 bytes --]
with System;
package Prefetch1 is
procedure My_Proc1 (Addr : System.Address);
procedure My_Proc2 (Addr : System.Address);
procedure My_Proc3 (Addr : System.Address);
end Prefetch1;
[-- Attachment #4: prefetch1.adb --]
[-- Type: text/x-adasrc, Size: 718 bytes --]
-- { dg-do compile }
package body Prefetch1 is
procedure Prefetch_1 (Addr : System.Address);
pragma Import (Intrinsic, Prefetch_1, "__builtin_prefetch");
procedure Prefetch_2 (Addr : System.Address; RW : Integer);
pragma Import (Intrinsic, Prefetch_2, "__builtin_prefetch");
procedure Prefetch_3 (Addr : System.Address; RW : Integer; Locality : Integer);
pragma Import (Intrinsic, Prefetch_3, "__builtin_prefetch");
procedure My_Proc1 (Addr : System.Address) is
begin
Prefetch_1 (Addr);
end;
procedure My_Proc2 (Addr : System.Address) is
begin
Prefetch_2 (Addr, 1);
end;
procedure My_Proc3 (Addr : System.Address) is
begin
Prefetch_3 (Addr, 1, 1);
end;
end Prefetch1;
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2019-05-28 7:21 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-28 7:44 [Ada] Add support for __builtin_prefetch Eric Botcazou
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).