diff options
author | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-10-31 17:58:30 +0000 |
---|---|---|
committer | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-10-31 17:58:30 +0000 |
commit | 87b72bc89adf0766846674e4d94c7ccba01486e5 (patch) | |
tree | c7717f2cdc96f51106ff1ce02d2cd57e31863522 /gcc/ada/g-alleve.adb | |
parent | c0d40c9a5eabd7eb4034ac7b92053cb2a2cedae4 (diff) | |
download | gcc-87b72bc89adf0766846674e4d94c7ccba01486e5.tar.gz |
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@118272 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/g-alleve.adb')
-rw-r--r-- | gcc/ada/g-alleve.adb | 53 |
1 files changed, 34 insertions, 19 deletions
diff --git a/gcc/ada/g-alleve.adb b/gcc/ada/g-alleve.adb index 2da86977c3f..3f760e4793c 100644 --- a/gcc/ada/g-alleve.adb +++ b/gcc/ada/g-alleve.adb @@ -7,7 +7,7 @@ -- B o d y -- -- (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 -- -- 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 --------- function lvx (A : c_long; B : c_ptr) return LL_VSI is - EA : Integer_Address; - begin - EA := Bound_Align (Integer_Address (A) + To_Integer (B), 16); + -- Simulate the altivec unit behavior regarding what Effective Address + -- is accessed, stripping off the input address least significant bits + -- wrt to vector alignment. - declare - D : LL_VSI; - for D'Address use To_Address (EA); - begin - return D; - end; + -- On targets where VECTOR_ALIGNMENT is less than the vector size (16), + -- an address within a vector is not necessarily rounded back at the + -- vector start address. Besides, rounding on 16 makes no sense on such + -- targets because the address of a properly aligned vector (that is, + -- a proper multiple of VECTOR_ALIGNMENT) could be affected, which we + -- 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; ----------- @@ -4407,17 +4418,21 @@ package body GNAT.Altivec.Low_Level_Vectors is ---------- procedure stvx (A : LL_VSI; B : c_int; C : c_ptr) is - EA : Integer_Address; - begin - EA := Bound_Align (Integer_Address (B) + To_Integer (C), 16); + -- Simulate the altivec unit behavior regarding what Effective Address + -- is accessed, stripping off the input address least significant bits + -- wrt to vector alignment (see comment in lvx for further details). - declare - D : LL_VSI; - for D'Address use To_Address (EA); - begin - D := A; - end; + EA : constant System.Address := + To_Address + (Bound_Align + (Integer_Address (B) + To_Integer (C), VECTOR_ALIGNMENT)); + + D : LL_VSI; + for D'Address use EA; + + begin + D := A; end stvx; ------------ |