bfd macro conversion to inline functions
[deliverable/binutils-gdb.git] / sim / ppc / altivec.igen
index 9f10b2619299c2d5c2f90b81908e382c900be2a5..59db2e50b3d78f4b7b3e3ec4caa8ed1d83254f45 100644 (file)
@@ -1,6 +1,6 @@
 # Altivec instruction set, for PSIM, the PowerPC simulator.
 
-# Copyright 2003 Free Software Foundation, Inc.
+# Copyright 2003-2019 Free Software Foundation, Inc.
 
 # Contributed by Red Hat Inc; developed under contract from Motorola.
 # Written by matthew green <mrg@redhat.com>.
@@ -9,7 +9,7 @@
 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
+# the Free Software Foundation; either version 3 of the License, or
 # (at your option) any later version.
 
 # This program is distributed in the hope that it will be useful,
@@ -18,9 +18,7 @@
 # GNU General Public License for more details.
 
 # You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330,
-# Boston, MA 02111-1307, USA.  */
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 
 #
@@ -1636,12 +1634,17 @@ unsigned32::model-function::altivec_unsigned_saturate_32:signed64 val, int *sat
 
 0.4,6.VS,11.VA,16.VB,21.VC,26.43:VX:av:vperm %VD, %VA, %VB, %VC:Vector Permute
        int i, who;
+       /* The permutation vector might have us read into the source vectors
+          back at positions before the iteration index, so we must latch the
+          sources to prevent early-clobbering in case the destination vector
+          is the same as one of them.  */
+       vreg myvA = (*vA), myvB = (*vB);
        for (i = 0; i < 16; i++) {
          who = (*vC).b[AV_BINDEX(i)] & 0x1f;
          if (who & 0x10)
-           (*vS).b[AV_BINDEX(i)] = (*vB).b[AV_BINDEX(who & 0xf)];
+           (*vS).b[AV_BINDEX(i)] = myvB.b[AV_BINDEX(who & 0xf)];
          else
-           (*vS).b[AV_BINDEX(i)] = (*vA).b[AV_BINDEX(who & 0xf)];
+           (*vS).b[AV_BINDEX(i)] = myvA.b[AV_BINDEX(who & 0xf)];
        }
        PPC_INSN_VR(VS_BITMASK, VA_BITMASK | VB_BITMASK | VC_BITMASK);
 
This page took 0.026278 seconds and 4 git commands to generate.