< prev index next >

src/cpu/ppc/vm/register_ppc.cpp

Print this page
rev 13392 : Improve VSX->VR conversion safety
   1 /*
   2  * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
   3  * Copyright (c) 2012, 2013 SAP SE. All rights reserved.
   4  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   5  *
   6  * This code is free software; you can redistribute it and/or modify it
   7  * under the terms of the GNU General Public License version 2 only, as
   8  * published by the Free Software Foundation.
   9  *
  10  * This code is distributed in the hope that it will be useful, but WITHOUT
  11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  12  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  13  * version 2 for more details (a copy is included in the LICENSE file that
  14  * accompanied this code).
  15  *
  16  * You should have received a copy of the GNU General Public License version
  17  * 2 along with this work; if not, write to the Free Software Foundation,
  18  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  19  *
  20  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  21  * or visit www.oracle.com if you need additional information or have any
  22  * questions.


  64     "SR_XER", "SR_LR", "SR_CTR", "SR_VRSAVE", "SR_SPEFSCR", "SR_PPR"
  65   };
  66   return is_valid() ? names[encoding()] : "snoreg";
  67 }
  68 
  69 const char* VectorRegisterImpl::name() const {
  70   const char* names[number_of_registers] = {
  71     "VR0",  "VR1",  "VR2",  "VR3",  "VR4",  "VR5",  "VR6",  "VR7",
  72     "VR8",  "VR9",  "VR10", "VR11", "VR12", "VR13", "VR14", "VR15",
  73     "VR16", "VR17", "VR18", "VR19", "VR20", "VR21", "VR22", "VR23",
  74     "VR24", "VR25", "VR26", "VR27", "VR28", "VR29", "VR30", "VR31"
  75   };
  76   return is_valid() ? names[encoding()] : "vnoreg";
  77 }
  78 
  79 const char* VectorSRegisterImpl::name() const {
  80   const char* names[number_of_registers] = {
  81     "VSR0",  "VSR1",  "VSR2",  "VSR3",  "VSR4",  "VSR5",  "VSR6",  "VSR7",
  82     "VSR8",  "VSR9",  "VSR10", "VSR11", "VSR12", "VSR13", "VSR14", "VSR15",
  83     "VSR16", "VSR17", "VSR18", "VSR19", "VSR20", "VSR21", "VSR22", "VSR23",
  84     "VSR24", "VSR25", "VSR26", "VSR27", "VSR28", "VSR29", "VSR30", "VSR31"




  85   };
  86   return is_valid() ? names[encoding()] : "vsnoreg";
  87 }
  88 







   1 /*
   2  * Copyright (c) 2000, 2013, 2017, Oracle and/or its affiliates. All rights reserved.
   3  * Copyright (c) 2012, 2013 SAP SE. All rights reserved.
   4  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   5  *
   6  * This code is free software; you can redistribute it and/or modify it
   7  * under the terms of the GNU General Public License version 2 only, as
   8  * published by the Free Software Foundation.
   9  *
  10  * This code is distributed in the hope that it will be useful, but WITHOUT
  11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  12  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  13  * version 2 for more details (a copy is included in the LICENSE file that
  14  * accompanied this code).
  15  *
  16  * You should have received a copy of the GNU General Public License version
  17  * 2 along with this work; if not, write to the Free Software Foundation,
  18  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  19  *
  20  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  21  * or visit www.oracle.com if you need additional information or have any
  22  * questions.


  64     "SR_XER", "SR_LR", "SR_CTR", "SR_VRSAVE", "SR_SPEFSCR", "SR_PPR"
  65   };
  66   return is_valid() ? names[encoding()] : "snoreg";
  67 }
  68 
  69 const char* VectorRegisterImpl::name() const {
  70   const char* names[number_of_registers] = {
  71     "VR0",  "VR1",  "VR2",  "VR3",  "VR4",  "VR5",  "VR6",  "VR7",
  72     "VR8",  "VR9",  "VR10", "VR11", "VR12", "VR13", "VR14", "VR15",
  73     "VR16", "VR17", "VR18", "VR19", "VR20", "VR21", "VR22", "VR23",
  74     "VR24", "VR25", "VR26", "VR27", "VR28", "VR29", "VR30", "VR31"
  75   };
  76   return is_valid() ? names[encoding()] : "vnoreg";
  77 }
  78 
  79 const char* VectorSRegisterImpl::name() const {
  80   const char* names[number_of_registers] = {
  81     "VSR0",  "VSR1",  "VSR2",  "VSR3",  "VSR4",  "VSR5",  "VSR6",  "VSR7",
  82     "VSR8",  "VSR9",  "VSR10", "VSR11", "VSR12", "VSR13", "VSR14", "VSR15",
  83     "VSR16", "VSR17", "VSR18", "VSR19", "VSR20", "VSR21", "VSR22", "VSR23",
  84     "VSR24", "VSR25", "VSR26", "VSR27", "VSR28", "VSR29", "VSR30", "VSR31",
  85     "VSR32", "VSR33", "VSR34", "VSR35", "VSR36", "VSR37", "VSR38", "VSR39",
  86     "VSR40", "VSR41", "VSR42", "VSR43", "VSR44", "VSR45", "VSR46", "VSR47",
  87     "VSR48", "VSR49", "VSR50", "VSR51", "VSR52", "VSR53", "VSR54", "VSR55",
  88     "VSR56", "VSR57", "VSR58", "VSR59", "VSR60", "VSR61", "VSR62", "VSR63"
  89   };
  90   return is_valid() ? names[encoding()] : "vsnoreg";
  91 }
  92 
  93 // Method to convert a VectorRegister to a Vector-Scalar Register (VectorSRegister)
  94 VectorSRegister VectorRegisterImpl::to_vsr() const {
  95   if ((encoding() == vnoreg->encoding()) || (encoding() < 0) || (encoding() > 31)) {
  96     return vsnoregi;
  97   }
  98   return as_VectorSRegister(encoding() + 32);
  99 }
< prev index next >