Commit bae7876b by Olivier Hainque Committed by Arnaud Charlet

g-alleve.adb (lvx, stvx): Ceil-Round the Effective Address to the closest…

g-alleve.adb (lvx, stvx): Ceil-Round the Effective Address to the closest multiple of VECTOR_ALIGNMENT...

2006-10-31  Olivier Hainque  <hainque@adacore.com>

	* g-alleve.adb (lvx, stvx): Ceil-Round the Effective Address to the
	closest multiple of VECTOR_ALIGNMENT and not the closest multiple of 16.

From-SVN: r118272
parent 3f1ede06
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
-- B o d y -- -- B o d y --
-- (Soft Binding Version) -- -- (Soft Binding Version) --
-- -- -- --
-- Copyright (C) 2004-2005, Free Software Foundation, Inc. -- -- Copyright (C) 2004-2006, Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -2818,17 +2818,28 @@ package body GNAT.Altivec.Low_Level_Vectors is ...@@ -2818,17 +2818,28 @@ package body GNAT.Altivec.Low_Level_Vectors is
--------- ---------
function lvx (A : c_long; B : c_ptr) return LL_VSI is function lvx (A : c_long; B : c_ptr) return LL_VSI is
EA : Integer_Address;
begin -- Simulate the altivec unit behavior regarding what Effective Address
EA := Bound_Align (Integer_Address (A) + To_Integer (B), 16); -- is accessed, stripping off the input address least significant bits
-- wrt to vector alignment.
declare -- On targets where VECTOR_ALIGNMENT is less than the vector size (16),
D : LL_VSI; -- an address within a vector is not necessarily rounded back at the
for D'Address use To_Address (EA); -- vector start address. Besides, rounding on 16 makes no sense on such
begin -- targets because the address of a properly aligned vector (that is,
return D; -- a proper multiple of VECTOR_ALIGNMENT) could be affected, which we
end; -- want never to happen.
EA : constant System.Address :=
To_Address
(Bound_Align
(Integer_Address (A) + To_Integer (B), VECTOR_ALIGNMENT));
D : LL_VSI;
for D'Address use EA;
begin
return D;
end lvx; end lvx;
----------- -----------
...@@ -4407,17 +4418,21 @@ package body GNAT.Altivec.Low_Level_Vectors is ...@@ -4407,17 +4418,21 @@ package body GNAT.Altivec.Low_Level_Vectors is
---------- ----------
procedure stvx (A : LL_VSI; B : c_int; C : c_ptr) is procedure stvx (A : LL_VSI; B : c_int; C : c_ptr) is
EA : Integer_Address;
begin -- Simulate the altivec unit behavior regarding what Effective Address
EA := Bound_Align (Integer_Address (B) + To_Integer (C), 16); -- is accessed, stripping off the input address least significant bits
-- wrt to vector alignment (see comment in lvx for further details).
declare EA : constant System.Address :=
D : LL_VSI; To_Address
for D'Address use To_Address (EA); (Bound_Align
begin (Integer_Address (B) + To_Integer (C), VECTOR_ALIGNMENT));
D := A;
end; D : LL_VSI;
for D'Address use EA;
begin
D := A;
end stvx; end stvx;
------------ ------------
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment