aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2024-06-12 16:05:57 +0200
committerMarc Poulhiès <dkm@gcc.gnu.org>2024-06-27 10:19:13 +0200
commit5c8b7fcc04b1ec412e11ae3d77f704c19a63ab07 (patch)
treedd243d82fbe641f09564c4438f15321f0d8a1a57
parentfdbc04d13f0e993ecf1a36680c8f7768dfb522fb (diff)
downloadgcc-5c8b7fcc04b1ec412e11ae3d77f704c19a63ab07.zip
gcc-5c8b7fcc04b1ec412e11ae3d77f704c19a63ab07.tar.gz
gcc-5c8b7fcc04b1ec412e11ae3d77f704c19a63ab07.tar.bz2
ada: Remove last uses of System.Address_Operations in runtime library
This completes the switch from using System.Address_Operations to using only System.Storage_Elements in the runtime library. The remaining uses were for simple optimizations that can be done by the optimizer alone. gcc/ada/ * libgnat/s-carsi8.adb: Remove clauses for System.Address_Operations and use only operations of System.Storage_Elements for addresses. * libgnat/s-casi16.adb: Likewise. * libgnat/s-casi32.adb: Likewise. * libgnat/s-casi64.adb: Likewise. * libgnat/s-casi128.adb: Likewise. * libgnat/s-carun8.adb: Likewise. * libgnat/s-caun16.adb: Likewise. * libgnat/s-caun32.adb: Likewise. * libgnat/s-caun64.adb: Likewise. * libgnat/s-caun128.adb: Likewise. * libgnat/s-geveop.adb: Likewise.
-rw-r--r--gcc/ada/libgnat/s-carsi8.adb8
-rw-r--r--gcc/ada/libgnat/s-carun8.adb8
-rw-r--r--gcc/ada/libgnat/s-casi128.adb7
-rw-r--r--gcc/ada/libgnat/s-casi16.adb11
-rw-r--r--gcc/ada/libgnat/s-casi32.adb7
-rw-r--r--gcc/ada/libgnat/s-casi64.adb7
-rw-r--r--gcc/ada/libgnat/s-caun128.adb7
-rw-r--r--gcc/ada/libgnat/s-caun16.adb11
-rw-r--r--gcc/ada/libgnat/s-caun32.adb7
-rw-r--r--gcc/ada/libgnat/s-caun64.adb7
-rw-r--r--gcc/ada/libgnat/s-geveop.adb33
11 files changed, 64 insertions, 49 deletions
diff --git a/gcc/ada/libgnat/s-carsi8.adb b/gcc/ada/libgnat/s-carsi8.adb
index 2a6c532d..7eb545a 100644
--- a/gcc/ada/libgnat/s-carsi8.adb
+++ b/gcc/ada/libgnat/s-carsi8.adb
@@ -29,8 +29,7 @@
-- --
------------------------------------------------------------------------------
-with System.Address_Operations; use System.Address_Operations;
-with System.Storage_Elements; use System.Storage_Elements;
+with System.Storage_Elements; use System.Storage_Elements;
with Ada.Unchecked_Conversion;
@@ -77,7 +76,10 @@ package body System.Compare_Array_Signed_8 is
begin
-- If operands are non-aligned, or length is too short, go by bytes
- if ModA (OrA (Left, Right), 4) /= 0 or else Compare_Len < 4 then
+ if Left mod Storage_Offset (4) /= 0
+ or else Right mod Storage_Offset (4) /= 0
+ or else Compare_Len < 4
+ then
return Compare_Array_S8_Unaligned (Left, Right, Left_Len, Right_Len);
end if;
diff --git a/gcc/ada/libgnat/s-carun8.adb b/gcc/ada/libgnat/s-carun8.adb
index 27422e5..e4cac20 100644
--- a/gcc/ada/libgnat/s-carun8.adb
+++ b/gcc/ada/libgnat/s-carun8.adb
@@ -29,8 +29,7 @@
-- --
------------------------------------------------------------------------------
-with System.Address_Operations; use System.Address_Operations;
-with System.Storage_Elements; use System.Storage_Elements;
+with System.Storage_Elements; use System.Storage_Elements;
with Ada.Unchecked_Conversion;
@@ -76,7 +75,10 @@ package body System.Compare_Array_Unsigned_8 is
begin
-- If operands are non-aligned, or length is too short, go by bytes
- if ModA (OrA (Left, Right), 4) /= 0 or else Compare_Len < 4 then
+ if Left mod Storage_Offset (4) /= 0
+ or else Right mod Storage_Offset (4) /= 0
+ or else Compare_Len < 4
+ then
return Compare_Array_U8_Unaligned (Left, Right, Left_Len, Right_Len);
end if;
diff --git a/gcc/ada/libgnat/s-casi128.adb b/gcc/ada/libgnat/s-casi128.adb
index 3d36141..1b65c8c 100644
--- a/gcc/ada/libgnat/s-casi128.adb
+++ b/gcc/ada/libgnat/s-casi128.adb
@@ -29,8 +29,7 @@
-- --
------------------------------------------------------------------------------
-with System.Address_Operations; use System.Address_Operations;
-with System.Storage_Elements; use System.Storage_Elements;
+with System.Storage_Elements; use System.Storage_Elements;
with Ada.Unchecked_Conversion;
@@ -70,7 +69,9 @@ package body System.Compare_Array_Signed_128 is
begin
-- Case of going by aligned quadruple words
- if ModA (OrA (Left, Right), 16) = 0 then
+ if Left mod Storage_Offset (16) = 0
+ and then Right mod Storage_Offset (16) = 0
+ then
while Clen /= 0 loop
if W (L).all /= W (R).all then
if W (L).all > W (R).all then
diff --git a/gcc/ada/libgnat/s-casi16.adb b/gcc/ada/libgnat/s-casi16.adb
index 01771d1..e3411c9 100644
--- a/gcc/ada/libgnat/s-casi16.adb
+++ b/gcc/ada/libgnat/s-casi16.adb
@@ -29,8 +29,7 @@
-- --
------------------------------------------------------------------------------
-with System.Address_Operations; use System.Address_Operations;
-with System.Storage_Elements; use System.Storage_Elements;
+with System.Storage_Elements; use System.Storage_Elements;
with Ada.Unchecked_Conversion;
@@ -78,7 +77,9 @@ package body System.Compare_Array_Signed_16 is
begin
-- Go by words if possible
- if ModA (OrA (Left, Right), 4) = 0 then
+ if Left mod Storage_Offset (4) = 0
+ and then Right mod Storage_Offset (4) = 0
+ then
while Clen > 1
and then W (L).all = W (R).all
loop
@@ -90,7 +91,9 @@ package body System.Compare_Array_Signed_16 is
-- Case of going by aligned half words
- if ModA (OrA (Left, Right), 2) = 0 then
+ if Left mod Storage_Offset (2) = 0
+ and then Right mod Storage_Offset (2) = 0
+ then
while Clen /= 0 loop
if H (L).all /= H (R).all then
if H (L).all > H (R).all then
diff --git a/gcc/ada/libgnat/s-casi32.adb b/gcc/ada/libgnat/s-casi32.adb
index 24ad9ef..43e4717 100644
--- a/gcc/ada/libgnat/s-casi32.adb
+++ b/gcc/ada/libgnat/s-casi32.adb
@@ -29,8 +29,7 @@
-- --
------------------------------------------------------------------------------
-with System.Address_Operations; use System.Address_Operations;
-with System.Storage_Elements; use System.Storage_Elements;
+with System.Storage_Elements; use System.Storage_Elements;
with Ada.Unchecked_Conversion;
@@ -73,7 +72,9 @@ package body System.Compare_Array_Signed_32 is
begin
-- Case of going by aligned words
- if ModA (OrA (Left, Right), 4) = 0 then
+ if Left mod Storage_Offset (4) = 0
+ and then Right mod Storage_Offset (4) = 0
+ then
while Clen /= 0 loop
if W (L).all /= W (R).all then
if W (L).all > W (R).all then
diff --git a/gcc/ada/libgnat/s-casi64.adb b/gcc/ada/libgnat/s-casi64.adb
index bcadea1..0625d1f5 100644
--- a/gcc/ada/libgnat/s-casi64.adb
+++ b/gcc/ada/libgnat/s-casi64.adb
@@ -29,8 +29,7 @@
-- --
------------------------------------------------------------------------------
-with System.Address_Operations; use System.Address_Operations;
-with System.Storage_Elements; use System.Storage_Elements;
+with System.Storage_Elements; use System.Storage_Elements;
with Ada.Unchecked_Conversion;
@@ -73,7 +72,9 @@ package body System.Compare_Array_Signed_64 is
begin
-- Case of going by aligned double words
- if ModA (OrA (Left, Right), 8) = 0 then
+ if Left mod Storage_Offset (8) = 0
+ and then Right mod Storage_Offset (8) = 0
+ then
while Clen /= 0 loop
if W (L).all /= W (R).all then
if W (L).all > W (R).all then
diff --git a/gcc/ada/libgnat/s-caun128.adb b/gcc/ada/libgnat/s-caun128.adb
index 113c4d4..f16f134 100644
--- a/gcc/ada/libgnat/s-caun128.adb
+++ b/gcc/ada/libgnat/s-caun128.adb
@@ -29,8 +29,7 @@
-- --
------------------------------------------------------------------------------
-with System.Address_Operations; use System.Address_Operations;
-with System.Storage_Elements; use System.Storage_Elements;
+with System.Storage_Elements; use System.Storage_Elements;
with Ada.Unchecked_Conversion;
@@ -69,7 +68,9 @@ package body System.Compare_Array_Unsigned_128 is
begin
-- Case of going by aligned quadruple words
- if ModA (OrA (Left, Right), 16) = 0 then
+ if Left mod Storage_Offset (16) = 0
+ and then Right mod Storage_Offset (16) = 0
+ then
while Clen /= 0 loop
if W (L).all /= W (R).all then
if W (L).all > W (R).all then
diff --git a/gcc/ada/libgnat/s-caun16.adb b/gcc/ada/libgnat/s-caun16.adb
index 82f9d5b..77a617e 100644
--- a/gcc/ada/libgnat/s-caun16.adb
+++ b/gcc/ada/libgnat/s-caun16.adb
@@ -29,8 +29,7 @@
-- --
------------------------------------------------------------------------------
-with System.Address_Operations; use System.Address_Operations;
-with System.Storage_Elements; use System.Storage_Elements;
+with System.Storage_Elements; use System.Storage_Elements;
with Ada.Unchecked_Conversion;
@@ -78,7 +77,9 @@ package body System.Compare_Array_Unsigned_16 is
begin
-- Go by words if possible
- if ModA (OrA (Left, Right), 4) = 0 then
+ if Left mod Storage_Offset (4) = 0
+ and then Right mod Storage_Offset (4) = 0
+ then
while Clen > 1
and then W (L).all = W (R).all
loop
@@ -90,7 +91,9 @@ package body System.Compare_Array_Unsigned_16 is
-- Case of going by aligned half words
- if ModA (OrA (Left, Right), 2) = 0 then
+ if Left mod Storage_Offset (2) = 0
+ and then Right mod Storage_Offset (2) = 0
+ then
while Clen /= 0 loop
if H (L).all /= H (R).all then
if H (L).all > H (R).all then
diff --git a/gcc/ada/libgnat/s-caun32.adb b/gcc/ada/libgnat/s-caun32.adb
index 0be3a2d..6bd31f5 100644
--- a/gcc/ada/libgnat/s-caun32.adb
+++ b/gcc/ada/libgnat/s-caun32.adb
@@ -29,8 +29,7 @@
-- --
------------------------------------------------------------------------------
-with System.Address_Operations; use System.Address_Operations;
-with System.Storage_Elements; use System.Storage_Elements;
+with System.Storage_Elements; use System.Storage_Elements;
with Ada.Unchecked_Conversion;
@@ -73,7 +72,9 @@ package body System.Compare_Array_Unsigned_32 is
begin
-- Case of going by aligned words
- if ModA (OrA (Left, Right), 4) = 0 then
+ if Left mod Storage_Offset (4) = 0
+ and then Right mod Storage_Offset (4) = 0
+ then
while Clen /= 0 loop
if W (L).all /= W (R).all then
if W (L).all > W (R).all then
diff --git a/gcc/ada/libgnat/s-caun64.adb b/gcc/ada/libgnat/s-caun64.adb
index 92d7d13..1018cbe 100644
--- a/gcc/ada/libgnat/s-caun64.adb
+++ b/gcc/ada/libgnat/s-caun64.adb
@@ -29,8 +29,7 @@
-- --
------------------------------------------------------------------------------
-with System.Address_Operations; use System.Address_Operations;
-with System.Storage_Elements; use System.Storage_Elements;
+with System.Storage_Elements; use System.Storage_Elements;
with Ada.Unchecked_Conversion;
@@ -72,7 +71,9 @@ package body System.Compare_Array_Unsigned_64 is
begin
-- Case of going by aligned double words
- if ModA (OrA (Left, Right), 8) = 0 then
+ if Left mod Storage_Offset (8) = 0
+ and then Right mod Storage_Offset (8) = 0
+ then
while Clen /= 0 loop
if W (L).all /= W (R).all then
if W (L).all > W (R).all then
diff --git a/gcc/ada/libgnat/s-geveop.adb b/gcc/ada/libgnat/s-geveop.adb
index 2f679b4..ab8ac1e 100644
--- a/gcc/ada/libgnat/s-geveop.adb
+++ b/gcc/ada/libgnat/s-geveop.adb
@@ -29,8 +29,7 @@
-- --
------------------------------------------------------------------------------
-with System.Address_Operations; use System.Address_Operations;
-with System.Storage_Elements; use System.Storage_Elements;
+with System.Storage_Elements; use System.Storage_Elements;
with Ada.Unchecked_Conversion;
@@ -49,15 +48,10 @@ package body System.Generic_Vector_Operations is
(R, X, Y : System.Address;
Length : System.Storage_Elements.Storage_Count)
is
- RA : Address := R;
- XA : Address := X;
- YA : Address := Y;
- -- Address of next element to process in R, X and Y
-
VI : constant Integer_Address := Integer_Address (VU);
Unaligned : constant Integer_Address :=
- Boolean'Pos (OrA (OrA (RA, XA), YA) mod VU /= 0) - 1;
+ (if R mod VU /= 0 or X mod VU /= 0 or Y mod VU /= 0 then 0 else -1);
-- Zero iff one or more argument addresses is not aligned, else all 1's
type Vector_Ptr is access all Vectors.Vector;
@@ -74,10 +68,15 @@ package body System.Generic_Vector_Operations is
-- Vector'Size > Storage_Unit
-- VI > 0
SA : constant Address :=
- XA + Storage_Offset
- ((Integer_Address (Length) / VI * VI) and Unaligned);
+ X + Storage_Offset
+ ((Integer_Address (Length) / VI * VI) and Unaligned);
-- First address of argument X to start serial processing
+ RA : Address := R;
+ XA : Address := X;
+ YA : Address := Y;
+ -- Address of next element to process in R, X and Y
+
begin
while XA < SA loop
VP (RA).all := Vector_Op (VP (XA).all, VP (YA).all);
@@ -102,14 +101,10 @@ package body System.Generic_Vector_Operations is
(R, X : System.Address;
Length : System.Storage_Elements.Storage_Count)
is
- RA : Address := R;
- XA : Address := X;
- -- Address of next element to process in R and X
-
VI : constant Integer_Address := Integer_Address (VU);
Unaligned : constant Integer_Address :=
- Boolean'Pos (OrA (RA, XA) mod VU /= 0) - 1;
+ (if R mod VU /= 0 or X mod VU /= 0 then 0 else -1);
-- Zero iff one or more argument addresses is not aligned, else all 1's
type Vector_Ptr is access all Vectors.Vector;
@@ -126,10 +121,14 @@ package body System.Generic_Vector_Operations is
-- Vector'Size > Storage_Unit
-- VI > 0
SA : constant Address :=
- XA + Storage_Offset
- ((Integer_Address (Length) / VI * VI) and Unaligned);
+ X + Storage_Offset
+ ((Integer_Address (Length) / VI * VI) and Unaligned);
-- First address of argument X to start serial processing
+ RA : Address := R;
+ XA : Address := X;
+ -- Address of next element to process in R and X
+
begin
while XA < SA loop
VP (RA).all := Vector_Op (VP (XA).all);