< prev index next >

src/cpu/s390/vm/assembler_s390.hpp

Print this page
rev 12485 : 8173465: Introduce NearLabel for branches known to be short.


  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.
  23  *
  24  */
  25 
  26 #ifndef CPU_S390_VM_ASSEMBLER_S390_HPP
  27 #define CPU_S390_VM_ASSEMBLER_S390_HPP
  28 
  29 #undef  LUCY_DBG
  30 
  31 #define NearLabel Label
  32 
  33 // Immediate is an abstraction to represent the various immediate
  34 // operands which exist on z/Architecture. Neither this class nor
  35 // instances hereof have an own state. It consists of methods only.
  36 class Immediate VALUE_OBJ_CLASS_SPEC {
  37 
  38  public:
  39     static bool is_simm(int64_t x, unsigned int nbits) {
  40       // nbits < 2   --> false
  41       // nbits >= 64 --> true
  42       assert(2 <= nbits && nbits < 64, "Don't call, use statically known result.");
  43       const int64_t min      = -(1L << (nbits-1));
  44       const int64_t maxplus1 =  (1L << (nbits-1));
  45       return min <= x && x < maxplus1;
  46     }
  47     static bool is_simm32(int64_t x) {
  48       return is_simm(x, 32);
  49     }
  50     static bool is_simm20(int64_t x) {
  51       return is_simm(x, 20);
  52     }




  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.
  23  *
  24  */
  25 
  26 #ifndef CPU_S390_VM_ASSEMBLER_S390_HPP
  27 #define CPU_S390_VM_ASSEMBLER_S390_HPP
  28 
  29 #undef  LUCY_DBG
  30 


  31 // Immediate is an abstraction to represent the various immediate
  32 // operands which exist on z/Architecture. Neither this class nor
  33 // instances hereof have an own state. It consists of methods only.
  34 class Immediate VALUE_OBJ_CLASS_SPEC {
  35 
  36  public:
  37     static bool is_simm(int64_t x, unsigned int nbits) {
  38       // nbits < 2   --> false
  39       // nbits >= 64 --> true
  40       assert(2 <= nbits && nbits < 64, "Don't call, use statically known result.");
  41       const int64_t min      = -(1L << (nbits-1));
  42       const int64_t maxplus1 =  (1L << (nbits-1));
  43       return min <= x && x < maxplus1;
  44     }
  45     static bool is_simm32(int64_t x) {
  46       return is_simm(x, 32);
  47     }
  48     static bool is_simm20(int64_t x) {
  49       return is_simm(x, 20);
  50     }


< prev index next >