hotspot/src/cpu/ppc/vm/ppc.ad
author kvn
Thu, 17 Jul 2014 15:40:04 -0700
changeset 25916 c5c22fab48fd
parent 25715 d5a8dbdc5150
child 25930 eae8b7490d2c
permissions -rw-r--r--
8050942: PPC64: implement template interpreter for ppc64le Reviewed-by: kvn, goetz Contributed-by: asmundak@google.com
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
     1
//
24018
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents: 23498
diff changeset
     2
// Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents: 23498
diff changeset
     3
// Copyright 2012, 2014 SAP AG. All rights reserved.
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
     4
// DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
     5
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
     6
// This code is free software; you can redistribute it and/or modify it
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
     7
// under the terms of the GNU General Public License version 2 only, as
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
     8
// published by the Free Software Foundation.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
     9
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
    10
// This code is distributed in the hope that it will be useful, but WITHOUT
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
    11
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
    12
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
    13
// version 2 for more details (a copy is included in the LICENSE file that
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
    14
// accompanied this code).
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
    15
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
    16
// You should have received a copy of the GNU General Public License version
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
    17
// 2 along with this work; if not, write to the Free Software Foundation,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
    18
// Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
    19
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
    20
// Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
    21
// or visit www.oracle.com if you need additional information or have any
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
    22
// questions.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
    23
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
    24
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
    25
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
    26
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
    27
// PPC64 Architecture Description File
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
    28
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
    29
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
    30
//----------REGISTER DEFINITION BLOCK------------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
    31
// This information is used by the matcher and the register allocator to
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
    32
// describe individual registers and classes of registers within the target
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
    33
// architecture.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
    34
register %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
    35
//----------Architecture Description Register Definitions----------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
    36
// General Registers
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
    37
// "reg_def"  name (register save type, C convention save type,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
    38
//                  ideal register type, encoding);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
    39
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
    40
// Register Save Types:
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
    41
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
    42
//   NS  = No-Save:     The register allocator assumes that these registers
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
    43
//                      can be used without saving upon entry to the method, &
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
    44
//                      that they do not need to be saved at call sites.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
    45
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
    46
//   SOC = Save-On-Call: The register allocator assumes that these registers
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
    47
//                      can be used without saving upon entry to the method,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
    48
//                      but that they must be saved at call sites.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
    49
//                      These are called "volatiles" on ppc.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
    50
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
    51
//   SOE = Save-On-Entry: The register allocator assumes that these registers
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
    52
//                      must be saved before using them upon entry to the
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
    53
//                      method, but they do not need to be saved at call
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
    54
//                      sites.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
    55
//                      These are called "nonvolatiles" on ppc.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
    56
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
    57
//   AS  = Always-Save:   The register allocator assumes that these registers
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
    58
//                      must be saved before using them upon entry to the
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
    59
//                      method, & that they must be saved at call sites.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
    60
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
    61
// Ideal Register Type is used to determine how to save & restore a
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
    62
// register. Op_RegI will get spilled with LoadI/StoreI, Op_RegP will get
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
    63
// spilled with LoadP/StoreP. If the register supports both, use Op_RegI.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
    64
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
    65
// The encoding number is the actual bit-pattern placed into the opcodes.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
    66
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
    67
// PPC64 register definitions, based on the 64-bit PowerPC ELF ABI
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
    68
// Supplement Version 1.7 as of 2003-10-29.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
    69
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
    70
// For each 64-bit register we must define two registers: the register
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
    71
// itself, e.g. R3, and a corresponding virtual other (32-bit-)'half',
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
    72
// e.g. R3_H, which is needed by the allocator, but is not used
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
    73
// for stores, loads, etc.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
    74
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
    75
// ----------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
    76
// Integer/Long Registers
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
    77
// ----------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
    78
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
    79
  // PPC64 has 32 64-bit integer registers.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
    80
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
    81
  // types: v = volatile, nv = non-volatile, s = system
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
    82
  reg_def R0   ( SOC, SOC, Op_RegI,  0, R0->as_VMReg()         );  // v   used in prologs
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
    83
  reg_def R0_H ( SOC, SOC, Op_RegI, 99, R0->as_VMReg()->next() );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
    84
  reg_def R1   ( NS,  NS,  Op_RegI,  1, R1->as_VMReg()         );  // s   SP
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
    85
  reg_def R1_H ( NS,  NS,  Op_RegI, 99, R1->as_VMReg()->next() );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
    86
  reg_def R2   ( SOC, SOC, Op_RegI,  2, R2->as_VMReg()         );  // v   TOC
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
    87
  reg_def R2_H ( SOC, SOC, Op_RegI, 99, R2->as_VMReg()->next() );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
    88
  reg_def R3   ( SOC, SOC, Op_RegI,  3, R3->as_VMReg()         );  // v   iarg1 & iret
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
    89
  reg_def R3_H ( SOC, SOC, Op_RegI, 99, R3->as_VMReg()->next() );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
    90
  reg_def R4   ( SOC, SOC, Op_RegI,  4, R4->as_VMReg()         );  //     iarg2
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
    91
  reg_def R4_H ( SOC, SOC, Op_RegI, 99, R4->as_VMReg()->next() );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
    92
  reg_def R5   ( SOC, SOC, Op_RegI,  5, R5->as_VMReg()         );  // v   iarg3
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
    93
  reg_def R5_H ( SOC, SOC, Op_RegI, 99, R5->as_VMReg()->next() );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
    94
  reg_def R6   ( SOC, SOC, Op_RegI,  6, R6->as_VMReg()         );  // v   iarg4
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
    95
  reg_def R6_H ( SOC, SOC, Op_RegI, 99, R6->as_VMReg()->next() );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
    96
  reg_def R7   ( SOC, SOC, Op_RegI,  7, R7->as_VMReg()         );  // v   iarg5
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
    97
  reg_def R7_H ( SOC, SOC, Op_RegI, 99, R7->as_VMReg()->next() );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
    98
  reg_def R8   ( SOC, SOC, Op_RegI,  8, R8->as_VMReg()         );  // v   iarg6
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
    99
  reg_def R8_H ( SOC, SOC, Op_RegI, 99, R8->as_VMReg()->next() );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   100
  reg_def R9   ( SOC, SOC, Op_RegI,  9, R9->as_VMReg()         );  // v   iarg7
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   101
  reg_def R9_H ( SOC, SOC, Op_RegI, 99, R9->as_VMReg()->next() );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   102
  reg_def R10  ( SOC, SOC, Op_RegI, 10, R10->as_VMReg()        );  // v   iarg8
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   103
  reg_def R10_H( SOC, SOC, Op_RegI, 99, R10->as_VMReg()->next());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   104
  reg_def R11  ( SOC, SOC, Op_RegI, 11, R11->as_VMReg()        );  // v   ENV / scratch
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   105
  reg_def R11_H( SOC, SOC, Op_RegI, 99, R11->as_VMReg()->next());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   106
  reg_def R12  ( SOC, SOC, Op_RegI, 12, R12->as_VMReg()        );  // v   scratch
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   107
  reg_def R12_H( SOC, SOC, Op_RegI, 99, R12->as_VMReg()->next());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   108
  reg_def R13  ( NS,  NS,  Op_RegI, 13, R13->as_VMReg()        );  // s   system thread id
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   109
  reg_def R13_H( NS,  NS,  Op_RegI, 99, R13->as_VMReg()->next());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   110
  reg_def R14  ( SOC, SOE, Op_RegI, 14, R14->as_VMReg()        );  // nv
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   111
  reg_def R14_H( SOC, SOE, Op_RegI, 99, R14->as_VMReg()->next());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   112
  reg_def R15  ( SOC, SOE, Op_RegI, 15, R15->as_VMReg()        );  // nv
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   113
  reg_def R15_H( SOC, SOE, Op_RegI, 99, R15->as_VMReg()->next());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   114
  reg_def R16  ( SOC, SOE, Op_RegI, 16, R16->as_VMReg()        );  // nv
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   115
  reg_def R16_H( SOC, SOE, Op_RegI, 99, R16->as_VMReg()->next());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   116
  reg_def R17  ( SOC, SOE, Op_RegI, 17, R17->as_VMReg()        );  // nv
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   117
  reg_def R17_H( SOC, SOE, Op_RegI, 99, R17->as_VMReg()->next());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   118
  reg_def R18  ( SOC, SOE, Op_RegI, 18, R18->as_VMReg()        );  // nv
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   119
  reg_def R18_H( SOC, SOE, Op_RegI, 99, R18->as_VMReg()->next());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   120
  reg_def R19  ( SOC, SOE, Op_RegI, 19, R19->as_VMReg()        );  // nv
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   121
  reg_def R19_H( SOC, SOE, Op_RegI, 99, R19->as_VMReg()->next());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   122
  reg_def R20  ( SOC, SOE, Op_RegI, 20, R20->as_VMReg()        );  // nv
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   123
  reg_def R20_H( SOC, SOE, Op_RegI, 99, R20->as_VMReg()->next());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   124
  reg_def R21  ( SOC, SOE, Op_RegI, 21, R21->as_VMReg()        );  // nv
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   125
  reg_def R21_H( SOC, SOE, Op_RegI, 99, R21->as_VMReg()->next());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   126
  reg_def R22  ( SOC, SOE, Op_RegI, 22, R22->as_VMReg()        );  // nv
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   127
  reg_def R22_H( SOC, SOE, Op_RegI, 99, R22->as_VMReg()->next());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   128
  reg_def R23  ( SOC, SOE, Op_RegI, 23, R23->as_VMReg()        );  // nv
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   129
  reg_def R23_H( SOC, SOE, Op_RegI, 99, R23->as_VMReg()->next());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   130
  reg_def R24  ( SOC, SOE, Op_RegI, 24, R24->as_VMReg()        );  // nv
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   131
  reg_def R24_H( SOC, SOE, Op_RegI, 99, R24->as_VMReg()->next());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   132
  reg_def R25  ( SOC, SOE, Op_RegI, 25, R25->as_VMReg()        );  // nv
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   133
  reg_def R25_H( SOC, SOE, Op_RegI, 99, R25->as_VMReg()->next());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   134
  reg_def R26  ( SOC, SOE, Op_RegI, 26, R26->as_VMReg()        );  // nv
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   135
  reg_def R26_H( SOC, SOE, Op_RegI, 99, R26->as_VMReg()->next());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   136
  reg_def R27  ( SOC, SOE, Op_RegI, 27, R27->as_VMReg()        );  // nv
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   137
  reg_def R27_H( SOC, SOE, Op_RegI, 99, R27->as_VMReg()->next());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   138
  reg_def R28  ( SOC, SOE, Op_RegI, 28, R28->as_VMReg()        );  // nv
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   139
  reg_def R28_H( SOC, SOE, Op_RegI, 99, R28->as_VMReg()->next());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   140
  reg_def R29  ( SOC, SOE, Op_RegI, 29, R29->as_VMReg()        );  // nv
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   141
  reg_def R29_H( SOC, SOE, Op_RegI, 99, R29->as_VMReg()->next());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   142
  reg_def R30  ( SOC, SOE, Op_RegI, 30, R30->as_VMReg()        );  // nv
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   143
  reg_def R30_H( SOC, SOE, Op_RegI, 99, R30->as_VMReg()->next());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   144
  reg_def R31  ( SOC, SOE, Op_RegI, 31, R31->as_VMReg()        );  // nv
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   145
  reg_def R31_H( SOC, SOE, Op_RegI, 99, R31->as_VMReg()->next());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   146
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   147
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   148
// ----------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   149
// Float/Double Registers
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   150
// ----------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   151
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   152
  // Double Registers
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   153
  // The rules of ADL require that double registers be defined in pairs.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   154
  // Each pair must be two 32-bit values, but not necessarily a pair of
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   155
  // single float registers. In each pair, ADLC-assigned register numbers
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   156
  // must be adjacent, with the lower number even. Finally, when the
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   157
  // CPU stores such a register pair to memory, the word associated with
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   158
  // the lower ADLC-assigned number must be stored to the lower address.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   159
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   160
  // PPC64 has 32 64-bit floating-point registers. Each can store a single
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   161
  // or double precision floating-point value.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   162
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   163
  // types: v = volatile, nv = non-volatile, s = system
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   164
  reg_def F0   ( SOC, SOC, Op_RegF,  0, F0->as_VMReg()         );  // v   scratch
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   165
  reg_def F0_H ( SOC, SOC, Op_RegF, 99, F0->as_VMReg()->next() );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   166
  reg_def F1   ( SOC, SOC, Op_RegF,  1, F1->as_VMReg()         );  // v   farg1 & fret
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   167
  reg_def F1_H ( SOC, SOC, Op_RegF, 99, F1->as_VMReg()->next() );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   168
  reg_def F2   ( SOC, SOC, Op_RegF,  2, F2->as_VMReg()         );  // v   farg2
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   169
  reg_def F2_H ( SOC, SOC, Op_RegF, 99, F2->as_VMReg()->next() );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   170
  reg_def F3   ( SOC, SOC, Op_RegF,  3, F3->as_VMReg()         );  // v   farg3
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   171
  reg_def F3_H ( SOC, SOC, Op_RegF, 99, F3->as_VMReg()->next() );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   172
  reg_def F4   ( SOC, SOC, Op_RegF,  4, F4->as_VMReg()         );  // v   farg4
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   173
  reg_def F4_H ( SOC, SOC, Op_RegF, 99, F4->as_VMReg()->next() );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   174
  reg_def F5   ( SOC, SOC, Op_RegF,  5, F5->as_VMReg()         );  // v   farg5
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   175
  reg_def F5_H ( SOC, SOC, Op_RegF, 99, F5->as_VMReg()->next() );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   176
  reg_def F6   ( SOC, SOC, Op_RegF,  6, F6->as_VMReg()         );  // v   farg6
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   177
  reg_def F6_H ( SOC, SOC, Op_RegF, 99, F6->as_VMReg()->next() );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   178
  reg_def F7   ( SOC, SOC, Op_RegF,  7, F7->as_VMReg()         );  // v   farg7
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   179
  reg_def F7_H ( SOC, SOC, Op_RegF, 99, F7->as_VMReg()->next() );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   180
  reg_def F8   ( SOC, SOC, Op_RegF,  8, F8->as_VMReg()         );  // v   farg8
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   181
  reg_def F8_H ( SOC, SOC, Op_RegF, 99, F8->as_VMReg()->next() );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   182
  reg_def F9   ( SOC, SOC, Op_RegF,  9, F9->as_VMReg()         );  // v   farg9
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   183
  reg_def F9_H ( SOC, SOC, Op_RegF, 99, F9->as_VMReg()->next() );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   184
  reg_def F10  ( SOC, SOC, Op_RegF, 10, F10->as_VMReg()        );  // v   farg10
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   185
  reg_def F10_H( SOC, SOC, Op_RegF, 99, F10->as_VMReg()->next());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   186
  reg_def F11  ( SOC, SOC, Op_RegF, 11, F11->as_VMReg()        );  // v   farg11
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   187
  reg_def F11_H( SOC, SOC, Op_RegF, 99, F11->as_VMReg()->next());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   188
  reg_def F12  ( SOC, SOC, Op_RegF, 12, F12->as_VMReg()        );  // v   farg12
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   189
  reg_def F12_H( SOC, SOC, Op_RegF, 99, F12->as_VMReg()->next());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   190
  reg_def F13  ( SOC, SOC, Op_RegF, 13, F13->as_VMReg()        );  // v   farg13
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   191
  reg_def F13_H( SOC, SOC, Op_RegF, 99, F13->as_VMReg()->next());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   192
  reg_def F14  ( SOC, SOE, Op_RegF, 14, F14->as_VMReg()        );  // nv
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   193
  reg_def F14_H( SOC, SOE, Op_RegF, 99, F14->as_VMReg()->next());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   194
  reg_def F15  ( SOC, SOE, Op_RegF, 15, F15->as_VMReg()        );  // nv
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   195
  reg_def F15_H( SOC, SOE, Op_RegF, 99, F15->as_VMReg()->next());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   196
  reg_def F16  ( SOC, SOE, Op_RegF, 16, F16->as_VMReg()        );  // nv
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   197
  reg_def F16_H( SOC, SOE, Op_RegF, 99, F16->as_VMReg()->next());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   198
  reg_def F17  ( SOC, SOE, Op_RegF, 17, F17->as_VMReg()        );  // nv
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   199
  reg_def F17_H( SOC, SOE, Op_RegF, 99, F17->as_VMReg()->next());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   200
  reg_def F18  ( SOC, SOE, Op_RegF, 18, F18->as_VMReg()        );  // nv
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   201
  reg_def F18_H( SOC, SOE, Op_RegF, 99, F18->as_VMReg()->next());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   202
  reg_def F19  ( SOC, SOE, Op_RegF, 19, F19->as_VMReg()        );  // nv
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   203
  reg_def F19_H( SOC, SOE, Op_RegF, 99, F19->as_VMReg()->next());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   204
  reg_def F20  ( SOC, SOE, Op_RegF, 20, F20->as_VMReg()        );  // nv
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   205
  reg_def F20_H( SOC, SOE, Op_RegF, 99, F20->as_VMReg()->next());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   206
  reg_def F21  ( SOC, SOE, Op_RegF, 21, F21->as_VMReg()        );  // nv
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   207
  reg_def F21_H( SOC, SOE, Op_RegF, 99, F21->as_VMReg()->next());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   208
  reg_def F22  ( SOC, SOE, Op_RegF, 22, F22->as_VMReg()        );  // nv
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   209
  reg_def F22_H( SOC, SOE, Op_RegF, 99, F22->as_VMReg()->next());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   210
  reg_def F23  ( SOC, SOE, Op_RegF, 23, F23->as_VMReg()        );  // nv
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   211
  reg_def F23_H( SOC, SOE, Op_RegF, 99, F23->as_VMReg()->next());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   212
  reg_def F24  ( SOC, SOE, Op_RegF, 24, F24->as_VMReg()        );  // nv
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   213
  reg_def F24_H( SOC, SOE, Op_RegF, 99, F24->as_VMReg()->next());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   214
  reg_def F25  ( SOC, SOE, Op_RegF, 25, F25->as_VMReg()        );  // nv
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   215
  reg_def F25_H( SOC, SOE, Op_RegF, 99, F25->as_VMReg()->next());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   216
  reg_def F26  ( SOC, SOE, Op_RegF, 26, F26->as_VMReg()        );  // nv
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   217
  reg_def F26_H( SOC, SOE, Op_RegF, 99, F26->as_VMReg()->next());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   218
  reg_def F27  ( SOC, SOE, Op_RegF, 27, F27->as_VMReg()        );  // nv
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   219
  reg_def F27_H( SOC, SOE, Op_RegF, 99, F27->as_VMReg()->next());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   220
  reg_def F28  ( SOC, SOE, Op_RegF, 28, F28->as_VMReg()        );  // nv
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   221
  reg_def F28_H( SOC, SOE, Op_RegF, 99, F28->as_VMReg()->next());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   222
  reg_def F29  ( SOC, SOE, Op_RegF, 29, F29->as_VMReg()        );  // nv
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   223
  reg_def F29_H( SOC, SOE, Op_RegF, 99, F29->as_VMReg()->next());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   224
  reg_def F30  ( SOC, SOE, Op_RegF, 30, F30->as_VMReg()        );  // nv
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   225
  reg_def F30_H( SOC, SOE, Op_RegF, 99, F30->as_VMReg()->next());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   226
  reg_def F31  ( SOC, SOE, Op_RegF, 31, F31->as_VMReg()        );  // nv
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   227
  reg_def F31_H( SOC, SOE, Op_RegF, 99, F31->as_VMReg()->next());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   228
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   229
// ----------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   230
// Special Registers
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   231
// ----------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   232
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   233
// Condition Codes Flag Registers
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   234
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   235
  // PPC64 has 8 condition code "registers" which are all contained
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   236
  // in the CR register.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   237
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   238
  // types: v = volatile, nv = non-volatile, s = system
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   239
  reg_def CCR0(SOC, SOC, Op_RegFlags, 0, CCR0->as_VMReg());  // v
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   240
  reg_def CCR1(SOC, SOC, Op_RegFlags, 1, CCR1->as_VMReg());  // v
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   241
  reg_def CCR2(SOC, SOC, Op_RegFlags, 2, CCR2->as_VMReg());  // nv
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   242
  reg_def CCR3(SOC, SOC, Op_RegFlags, 3, CCR3->as_VMReg());  // nv
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   243
  reg_def CCR4(SOC, SOC, Op_RegFlags, 4, CCR4->as_VMReg());  // nv
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   244
  reg_def CCR5(SOC, SOC, Op_RegFlags, 5, CCR5->as_VMReg());  // v
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   245
  reg_def CCR6(SOC, SOC, Op_RegFlags, 6, CCR6->as_VMReg());  // v
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   246
  reg_def CCR7(SOC, SOC, Op_RegFlags, 7, CCR7->as_VMReg());  // v
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   247
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   248
  // Special registers of PPC64
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   249
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   250
  reg_def SR_XER(    SOC, SOC, Op_RegP, 0, SR_XER->as_VMReg());     // v
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   251
  reg_def SR_LR(     SOC, SOC, Op_RegP, 1, SR_LR->as_VMReg());      // v
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   252
  reg_def SR_CTR(    SOC, SOC, Op_RegP, 2, SR_CTR->as_VMReg());     // v
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   253
  reg_def SR_VRSAVE( SOC, SOC, Op_RegP, 3, SR_VRSAVE->as_VMReg());  // v
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   254
  reg_def SR_SPEFSCR(SOC, SOC, Op_RegP, 4, SR_SPEFSCR->as_VMReg()); // v
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   255
  reg_def SR_PPR(    SOC, SOC, Op_RegP, 5, SR_PPR->as_VMReg());     // v
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   256
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   257
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   258
// ----------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   259
// Specify priority of register selection within phases of register
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   260
// allocation. Highest priority is first. A useful heuristic is to
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   261
// give registers a low priority when they are required by machine
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   262
// instructions, like EAX and EDX on I486, and choose no-save registers
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   263
// before save-on-call, & save-on-call before save-on-entry. Registers
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   264
// which participate in fixed calling sequences should come last.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   265
// Registers which are used as pairs must fall on an even boundary.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   266
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   267
// It's worth about 1% on SPEC geomean to get this right.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   268
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   269
// Chunk0, chunk1, and chunk2 form the MachRegisterNumbers enumeration
25715
d5a8dbdc5150 8049325: Introduce and clean up umbrella headers for the files in the cpu subdirectories.
goetz
parents: 25374
diff changeset
   270
// in adGlobals_ppc.hpp which defines the <register>_num values, e.g.
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   271
// R3_num. Therefore, R3_num may not be (and in reality is not)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   272
// the same as R3->encoding()! Furthermore, we cannot make any
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   273
// assumptions on ordering, e.g. R3_num may be less than R2_num.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   274
// Additionally, the function
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   275
//   static enum RC rc_class(OptoReg::Name reg )
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   276
// maps a given <register>_num value to its chunk type (except for flags)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   277
// and its current implementation relies on chunk0 and chunk1 having a
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   278
// size of 64 each.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   279
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   280
// If you change this allocation class, please have a look at the
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   281
// default values for the parameters RoundRobinIntegerRegIntervalStart
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   282
// and RoundRobinFloatRegIntervalStart
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   283
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   284
alloc_class chunk0 (
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   285
  // Chunk0 contains *all* 64 integer registers halves.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   286
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   287
  // "non-volatile" registers
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   288
  R14, R14_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   289
  R15, R15_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   290
  R17, R17_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   291
  R18, R18_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   292
  R19, R19_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   293
  R20, R20_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   294
  R21, R21_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   295
  R22, R22_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   296
  R23, R23_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   297
  R24, R24_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   298
  R25, R25_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   299
  R26, R26_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   300
  R27, R27_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   301
  R28, R28_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   302
  R29, R29_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   303
  R30, R30_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   304
  R31, R31_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   305
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   306
  // scratch/special registers
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   307
  R11, R11_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   308
  R12, R12_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   309
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   310
  // argument registers
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   311
  R10, R10_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   312
  R9,  R9_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   313
  R8,  R8_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   314
  R7,  R7_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   315
  R6,  R6_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   316
  R5,  R5_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   317
  R4,  R4_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   318
  R3,  R3_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   319
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   320
  // special registers, not available for allocation
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   321
  R16, R16_H,     // R16_thread
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   322
  R13, R13_H,     // system thread id
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   323
  R2,  R2_H,      // may be used for TOC
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   324
  R1,  R1_H,      // SP
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   325
  R0,  R0_H       // R0 (scratch)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   326
);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   327
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   328
// If you change this allocation class, please have a look at the
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   329
// default values for the parameters RoundRobinIntegerRegIntervalStart
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   330
// and RoundRobinFloatRegIntervalStart
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   331
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   332
alloc_class chunk1 (
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   333
  // Chunk1 contains *all* 64 floating-point registers halves.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   334
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   335
  // scratch register
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   336
  F0,  F0_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   337
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   338
  // argument registers
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   339
  F13, F13_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   340
  F12, F12_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   341
  F11, F11_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   342
  F10, F10_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   343
  F9,  F9_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   344
  F8,  F8_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   345
  F7,  F7_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   346
  F6,  F6_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   347
  F5,  F5_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   348
  F4,  F4_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   349
  F3,  F3_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   350
  F2,  F2_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   351
  F1,  F1_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   352
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   353
  // non-volatile registers
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   354
  F14, F14_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   355
  F15, F15_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   356
  F16, F16_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   357
  F17, F17_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   358
  F18, F18_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   359
  F19, F19_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   360
  F20, F20_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   361
  F21, F21_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   362
  F22, F22_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   363
  F23, F23_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   364
  F24, F24_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   365
  F25, F25_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   366
  F26, F26_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   367
  F27, F27_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   368
  F28, F28_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   369
  F29, F29_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   370
  F30, F30_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   371
  F31, F31_H
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   372
);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   373
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   374
alloc_class chunk2 (
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   375
  // Chunk2 contains *all* 8 condition code registers.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   376
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   377
  CCR0,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   378
  CCR1,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   379
  CCR2,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   380
  CCR3,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   381
  CCR4,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   382
  CCR5,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   383
  CCR6,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   384
  CCR7
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   385
);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   386
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   387
alloc_class chunk3 (
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   388
  // special registers
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   389
  // These registers are not allocated, but used for nodes generated by postalloc expand.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   390
  SR_XER,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   391
  SR_LR,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   392
  SR_CTR,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   393
  SR_VRSAVE,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   394
  SR_SPEFSCR,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   395
  SR_PPR
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   396
);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   397
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   398
//-------Architecture Description Register Classes-----------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   399
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   400
// Several register classes are automatically defined based upon
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   401
// information in this architecture description.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   402
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   403
// 1) reg_class inline_cache_reg           ( as defined in frame section )
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   404
// 2) reg_class compiler_method_oop_reg    ( as defined in frame section )
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   405
// 2) reg_class interpreter_method_oop_reg ( as defined in frame section )
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   406
// 3) reg_class stack_slots( /* one chunk of stack-based "registers" */ )
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   407
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   408
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   409
// ----------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   410
// 32 Bit Register Classes
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   411
// ----------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   412
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   413
// We specify registers twice, once as read/write, and once read-only.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   414
// We use the read-only registers for source operands. With this, we
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   415
// can include preset read only registers in this class, as a hard-coded
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   416
// '0'-register. (We used to simulate this on ppc.)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   417
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   418
// 32 bit registers that can be read and written i.e. these registers
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   419
// can be dest (or src) of normal instructions.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   420
reg_class bits32_reg_rw(
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   421
/*R0*/              // R0
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   422
/*R1*/              // SP
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   423
  R2,               // TOC
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   424
  R3,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   425
  R4,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   426
  R5,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   427
  R6,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   428
  R7,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   429
  R8,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   430
  R9,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   431
  R10,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   432
  R11,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   433
  R12,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   434
/*R13*/             // system thread id
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   435
  R14,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   436
  R15,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   437
/*R16*/             // R16_thread
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   438
  R17,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   439
  R18,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   440
  R19,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   441
  R20,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   442
  R21,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   443
  R22,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   444
  R23,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   445
  R24,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   446
  R25,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   447
  R26,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   448
  R27,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   449
  R28,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   450
/*R29*/             // global TOC
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   451
/*R30*/             // Narrow Oop Base
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   452
  R31
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   453
);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   454
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   455
// 32 bit registers that can only be read i.e. these registers can
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   456
// only be src of all instructions.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   457
reg_class bits32_reg_ro(
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   458
/*R0*/              // R0
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   459
/*R1*/              // SP
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   460
  R2                // TOC
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   461
  R3,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   462
  R4,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   463
  R5,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   464
  R6,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   465
  R7,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   466
  R8,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   467
  R9,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   468
  R10,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   469
  R11,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   470
  R12,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   471
/*R13*/             // system thread id
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   472
  R14,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   473
  R15,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   474
/*R16*/             // R16_thread
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   475
  R17,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   476
  R18,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   477
  R19,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   478
  R20,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   479
  R21,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   480
  R22,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   481
  R23,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   482
  R24,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   483
  R25,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   484
  R26,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   485
  R27,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   486
  R28,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   487
/*R29*/
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   488
/*R30*/             // Narrow Oop Base
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   489
  R31
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   490
);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   491
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   492
// Complement-required-in-pipeline operands for narrow oops.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   493
reg_class bits32_reg_ro_not_complement (
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   494
/*R0*/     // R0
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   495
  R1,      // SP
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   496
  R2,      // TOC
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   497
  R3,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   498
  R4,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   499
  R5,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   500
  R6,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   501
  R7,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   502
  R8,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   503
  R9,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   504
  R10,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   505
  R11,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   506
  R12,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   507
/*R13,*/   // system thread id
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   508
  R14,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   509
  R15,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   510
  R16,    // R16_thread
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   511
  R17,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   512
  R18,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   513
  R19,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   514
  R20,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   515
  R21,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   516
  R22,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   517
/*R23,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   518
  R24,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   519
  R25,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   520
  R26,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   521
  R27,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   522
  R28,*/
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   523
/*R29,*/ // TODO: let allocator handle TOC!!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   524
/*R30,*/
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   525
  R31
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   526
);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   527
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   528
// Complement-required-in-pipeline operands for narrow oops.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   529
// See 64-bit declaration.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   530
reg_class bits32_reg_ro_complement (
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   531
  R23,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   532
  R24,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   533
  R25,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   534
  R26,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   535
  R27,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   536
  R28
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   537
);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   538
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   539
reg_class rscratch1_bits32_reg(R11);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   540
reg_class rscratch2_bits32_reg(R12);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   541
reg_class rarg1_bits32_reg(R3);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   542
reg_class rarg2_bits32_reg(R4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   543
reg_class rarg3_bits32_reg(R5);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   544
reg_class rarg4_bits32_reg(R6);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   545
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   546
// ----------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   547
// 64 Bit Register Classes
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   548
// ----------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   549
// 64-bit build means 64-bit pointers means hi/lo pairs
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   550
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   551
reg_class rscratch1_bits64_reg(R11_H, R11);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   552
reg_class rscratch2_bits64_reg(R12_H, R12);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   553
reg_class rarg1_bits64_reg(R3_H, R3);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   554
reg_class rarg2_bits64_reg(R4_H, R4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   555
reg_class rarg3_bits64_reg(R5_H, R5);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   556
reg_class rarg4_bits64_reg(R6_H, R6);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   557
// Thread register, 'written' by tlsLoadP, see there.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   558
reg_class thread_bits64_reg(R16_H, R16);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   559
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   560
reg_class r19_bits64_reg(R19_H, R19);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   561
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   562
// 64 bit registers that can be read and written i.e. these registers
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   563
// can be dest (or src) of normal instructions.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   564
reg_class bits64_reg_rw(
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   565
/*R0_H,  R0*/     // R0
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   566
/*R1_H,  R1*/     // SP
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   567
  R2_H,  R2,      // TOC
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   568
  R3_H,  R3,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   569
  R4_H,  R4,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   570
  R5_H,  R5,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   571
  R6_H,  R6,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   572
  R7_H,  R7,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   573
  R8_H,  R8,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   574
  R9_H,  R9,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   575
  R10_H, R10,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   576
  R11_H, R11,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   577
  R12_H, R12,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   578
/*R13_H, R13*/   // system thread id
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   579
  R14_H, R14,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   580
  R15_H, R15,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   581
/*R16_H, R16*/   // R16_thread
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   582
  R17_H, R17,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   583
  R18_H, R18,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   584
  R19_H, R19,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   585
  R20_H, R20,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   586
  R21_H, R21,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   587
  R22_H, R22,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   588
  R23_H, R23,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   589
  R24_H, R24,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   590
  R25_H, R25,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   591
  R26_H, R26,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   592
  R27_H, R27,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   593
  R28_H, R28,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   594
/*R29_H, R29*/
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   595
/*R30_H, R30*/
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   596
  R31_H, R31
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   597
);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   598
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   599
// 64 bit registers used excluding r2, r11 and r12
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   600
// Used to hold the TOC to avoid collisions with expanded LeafCall which uses
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   601
// r2, r11 and r12 internally.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   602
reg_class bits64_reg_leaf_call(
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   603
/*R0_H,  R0*/     // R0
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   604
/*R1_H,  R1*/     // SP
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   605
/*R2_H,  R2*/     // TOC
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   606
  R3_H,  R3,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   607
  R4_H,  R4,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   608
  R5_H,  R5,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   609
  R6_H,  R6,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   610
  R7_H,  R7,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   611
  R8_H,  R8,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   612
  R9_H,  R9,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   613
  R10_H, R10,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   614
/*R11_H, R11*/
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   615
/*R12_H, R12*/
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   616
/*R13_H, R13*/   // system thread id
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   617
  R14_H, R14,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   618
  R15_H, R15,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   619
/*R16_H, R16*/   // R16_thread
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   620
  R17_H, R17,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   621
  R18_H, R18,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   622
  R19_H, R19,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   623
  R20_H, R20,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   624
  R21_H, R21,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   625
  R22_H, R22,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   626
  R23_H, R23,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   627
  R24_H, R24,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   628
  R25_H, R25,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   629
  R26_H, R26,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   630
  R27_H, R27,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   631
  R28_H, R28,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   632
/*R29_H, R29*/
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   633
/*R30_H, R30*/
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   634
  R31_H, R31
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   635
);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   636
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   637
// Used to hold the TOC to avoid collisions with expanded DynamicCall
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   638
// which uses r19 as inline cache internally and expanded LeafCall which uses
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   639
// r2, r11 and r12 internally.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   640
reg_class bits64_constant_table_base(
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   641
/*R0_H,  R0*/     // R0
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   642
/*R1_H,  R1*/     // SP
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   643
/*R2_H,  R2*/     // TOC
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   644
  R3_H,  R3,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   645
  R4_H,  R4,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   646
  R5_H,  R5,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   647
  R6_H,  R6,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   648
  R7_H,  R7,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   649
  R8_H,  R8,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   650
  R9_H,  R9,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   651
  R10_H, R10,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   652
/*R11_H, R11*/
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   653
/*R12_H, R12*/
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   654
/*R13_H, R13*/   // system thread id
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   655
  R14_H, R14,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   656
  R15_H, R15,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   657
/*R16_H, R16*/   // R16_thread
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   658
  R17_H, R17,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   659
  R18_H, R18,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   660
/*R19_H, R19*/
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   661
  R20_H, R20,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   662
  R21_H, R21,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   663
  R22_H, R22,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   664
  R23_H, R23,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   665
  R24_H, R24,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   666
  R25_H, R25,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   667
  R26_H, R26,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   668
  R27_H, R27,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   669
  R28_H, R28,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   670
/*R29_H, R29*/
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   671
/*R30_H, R30*/
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   672
  R31_H, R31
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   673
);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   674
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   675
// 64 bit registers that can only be read i.e. these registers can
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   676
// only be src of all instructions.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   677
reg_class bits64_reg_ro(
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   678
/*R0_H,  R0*/     // R0
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   679
  R1_H,  R1,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   680
  R2_H,  R2,       // TOC
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   681
  R3_H,  R3,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   682
  R4_H,  R4,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   683
  R5_H,  R5,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   684
  R6_H,  R6,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   685
  R7_H,  R7,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   686
  R8_H,  R8,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   687
  R9_H,  R9,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   688
  R10_H, R10,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   689
  R11_H, R11,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   690
  R12_H, R12,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   691
/*R13_H, R13*/   // system thread id
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   692
  R14_H, R14,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   693
  R15_H, R15,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   694
  R16_H, R16,    // R16_thread
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   695
  R17_H, R17,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   696
  R18_H, R18,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   697
  R19_H, R19,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   698
  R20_H, R20,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   699
  R21_H, R21,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   700
  R22_H, R22,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   701
  R23_H, R23,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   702
  R24_H, R24,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   703
  R25_H, R25,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   704
  R26_H, R26,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   705
  R27_H, R27,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   706
  R28_H, R28,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   707
/*R29_H, R29*/ // TODO: let allocator handle TOC!!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   708
/*R30_H, R30,*/
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   709
  R31_H, R31
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   710
);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   711
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   712
// Complement-required-in-pipeline operands.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   713
reg_class bits64_reg_ro_not_complement (
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   714
/*R0_H,  R0*/     // R0
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   715
  R1_H,  R1,      // SP
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   716
  R2_H,  R2,      // TOC
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   717
  R3_H,  R3,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   718
  R4_H,  R4,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   719
  R5_H,  R5,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   720
  R6_H,  R6,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   721
  R7_H,  R7,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   722
  R8_H,  R8,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   723
  R9_H,  R9,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   724
  R10_H, R10,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   725
  R11_H, R11,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   726
  R12_H, R12,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   727
/*R13_H, R13*/   // system thread id
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   728
  R14_H, R14,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   729
  R15_H, R15,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   730
  R16_H, R16,    // R16_thread
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   731
  R17_H, R17,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   732
  R18_H, R18,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   733
  R19_H, R19,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   734
  R20_H, R20,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   735
  R21_H, R21,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   736
  R22_H, R22,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   737
/*R23_H, R23,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   738
  R24_H, R24,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   739
  R25_H, R25,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   740
  R26_H, R26,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   741
  R27_H, R27,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   742
  R28_H, R28,*/
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   743
/*R29_H, R29*/ // TODO: let allocator handle TOC!!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   744
/*R30_H, R30,*/
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   745
  R31_H, R31
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   746
);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   747
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   748
// Complement-required-in-pipeline operands.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   749
// This register mask is used for the trap instructions that implement
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   750
// the null checks on AIX. The trap instruction first computes the
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   751
// complement of the value it shall trap on. Because of this, the
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   752
// instruction can not be scheduled in the same cycle as an other
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   753
// instruction reading the normal value of the same register. So we
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   754
// force the value to check into 'bits64_reg_ro_not_complement'
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   755
// and then copy it to 'bits64_reg_ro_complement' for the trap.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   756
reg_class bits64_reg_ro_complement (
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   757
  R23_H, R23,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   758
  R24_H, R24,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   759
  R25_H, R25,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   760
  R26_H, R26,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   761
  R27_H, R27,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   762
  R28_H, R28
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   763
);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   764
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   765
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   766
// ----------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   767
// Special Class for Condition Code Flags Register
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   768
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   769
reg_class int_flags(
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   770
/*CCR0*/             // scratch
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   771
/*CCR1*/             // scratch
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   772
/*CCR2*/             // nv!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   773
/*CCR3*/             // nv!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   774
/*CCR4*/             // nv!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   775
  CCR5,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   776
  CCR6,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   777
  CCR7
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   778
);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   779
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   780
reg_class int_flags_CR0(CCR0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   781
reg_class int_flags_CR1(CCR1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   782
reg_class int_flags_CR6(CCR6);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   783
reg_class ctr_reg(SR_CTR);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   784
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   785
// ----------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   786
// Float Register Classes
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   787
// ----------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   788
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   789
reg_class flt_reg(
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   790
/*F0*/              // scratch
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   791
  F1,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   792
  F2,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   793
  F3,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   794
  F4,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   795
  F5,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   796
  F6,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   797
  F7,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   798
  F8,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   799
  F9,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   800
  F10,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   801
  F11,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   802
  F12,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   803
  F13,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   804
  F14,              // nv!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   805
  F15,              // nv!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   806
  F16,              // nv!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   807
  F17,              // nv!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   808
  F18,              // nv!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   809
  F19,              // nv!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   810
  F20,              // nv!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   811
  F21,              // nv!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   812
  F22,              // nv!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   813
  F23,              // nv!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   814
  F24,              // nv!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   815
  F25,              // nv!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   816
  F26,              // nv!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   817
  F27,              // nv!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   818
  F28,              // nv!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   819
  F29,              // nv!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   820
  F30,              // nv!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   821
  F31               // nv!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   822
);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   823
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   824
// Double precision float registers have virtual `high halves' that
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   825
// are needed by the allocator.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   826
reg_class dbl_reg(
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   827
/*F0,  F0_H*/     // scratch
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   828
  F1,  F1_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   829
  F2,  F2_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   830
  F3,  F3_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   831
  F4,  F4_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   832
  F5,  F5_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   833
  F6,  F6_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   834
  F7,  F7_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   835
  F8,  F8_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   836
  F9,  F9_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   837
  F10, F10_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   838
  F11, F11_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   839
  F12, F12_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   840
  F13, F13_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   841
  F14, F14_H,    // nv!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   842
  F15, F15_H,    // nv!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   843
  F16, F16_H,    // nv!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   844
  F17, F17_H,    // nv!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   845
  F18, F18_H,    // nv!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   846
  F19, F19_H,    // nv!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   847
  F20, F20_H,    // nv!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   848
  F21, F21_H,    // nv!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   849
  F22, F22_H,    // nv!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   850
  F23, F23_H,    // nv!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   851
  F24, F24_H,    // nv!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   852
  F25, F25_H,    // nv!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   853
  F26, F26_H,    // nv!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   854
  F27, F27_H,    // nv!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   855
  F28, F28_H,    // nv!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   856
  F29, F29_H,    // nv!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   857
  F30, F30_H,    // nv!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   858
  F31, F31_H     // nv!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   859
);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   860
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   861
 %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   862
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   863
//----------DEFINITION BLOCK---------------------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   864
// Define name --> value mappings to inform the ADLC of an integer valued name
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   865
// Current support includes integer values in the range [0, 0x7FFFFFFF]
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   866
// Format:
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   867
//        int_def  <name>         ( <int_value>, <expression>);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   868
// Generated Code in ad_<arch>.hpp
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   869
//        #define  <name>   (<expression>)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   870
//        // value == <int_value>
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   871
// Generated code in ad_<arch>.cpp adlc_verification()
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   872
//        assert( <name> == <int_value>, "Expect (<expression>) to equal <int_value>");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   873
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   874
definitions %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   875
  // The default cost (of an ALU instruction).
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   876
  int_def DEFAULT_COST_LOW        (     30,      30);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   877
  int_def DEFAULT_COST            (    100,     100);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   878
  int_def HUGE_COST               (1000000, 1000000);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   879
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   880
  // Memory refs
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   881
  int_def MEMORY_REF_COST_LOW     (    200, DEFAULT_COST * 2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   882
  int_def MEMORY_REF_COST         (    300, DEFAULT_COST * 3);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   883
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   884
  // Branches are even more expensive.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   885
  int_def BRANCH_COST             (    900, DEFAULT_COST * 9);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   886
  int_def CALL_COST               (   1300, DEFAULT_COST * 13);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   887
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   888
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   889
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   890
//----------SOURCE BLOCK-------------------------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   891
// This is a block of C++ code which provides values, functions, and
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   892
// definitions necessary in the rest of the architecture description.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   893
source_hpp %{
23498
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
   894
  // Header information of the source block.
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
   895
  // Method declarations/definitions which are used outside
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
   896
  // the ad-scope can conveniently be defined here.
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
   897
  //
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
   898
  // To keep related declarations/definitions/uses close together,
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
   899
  // we switch between source %{ }% and source_hpp %{ }% freely as needed.
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
   900
24349
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
   901
  // Returns true if Node n is followed by a MemBar node that
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   902
  // will do an acquire. If so, this node must not do the acquire
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   903
  // operation.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   904
  bool followed_by_acquire(const Node *n);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   905
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   906
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   907
source %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   908
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   909
// Optimize load-acquire.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   910
//
24349
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
   911
// Check if acquire is unnecessary due to following operation that does
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   912
// acquire anyways.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   913
// Walk the pattern:
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   914
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   915
//      n: Load.acq
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   916
//           |
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   917
//      MemBarAcquire
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   918
//       |         |
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   919
//  Proj(ctrl)  Proj(mem)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   920
//       |         |
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   921
//   MemBarRelease/Volatile
24349
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
   922
//
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   923
bool followed_by_acquire(const Node *load) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   924
  assert(load->is_Load(), "So far implemented only for loads.");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   925
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   926
  // Find MemBarAcquire.
24349
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
   927
  const Node *mba = NULL;
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   928
  for (DUIterator_Fast imax, i = load->fast_outs(imax); i < imax; i++) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   929
    const Node *out = load->fast_out(i);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   930
    if (out->Opcode() == Op_MemBarAcquire) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   931
      if (out->in(0) == load) continue; // Skip control edge, membar should be found via precedence edge.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   932
      mba = out;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   933
      break;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   934
    }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   935
  }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   936
  if (!mba) return false;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   937
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   938
  // Find following MemBar node.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   939
  //
24349
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
   940
  // The following node must be reachable by control AND memory
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   941
  // edge to assure no other operations are in between the two nodes.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   942
  //
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   943
  // So first get the Proj node, mem_proj, to use it to iterate forward.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   944
  Node *mem_proj = NULL;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   945
  for (DUIterator_Fast imax, i = mba->fast_outs(imax); i < imax; i++) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   946
    mem_proj = mba->fast_out(i);      // Throw out-of-bounds if proj not found
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   947
    assert(mem_proj->is_Proj(), "only projections here");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   948
    ProjNode *proj = mem_proj->as_Proj();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   949
    if (proj->_con == TypeFunc::Memory &&
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   950
        !Compile::current()->node_arena()->contains(mem_proj)) // Unmatched old-space only
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   951
      break;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   952
  }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   953
  assert(mem_proj->as_Proj()->_con == TypeFunc::Memory, "Graph broken");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   954
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   955
  // Search MemBar behind Proj. If there are other memory operations
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   956
  // behind the Proj we lost.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   957
  for (DUIterator_Fast jmax, j = mem_proj->fast_outs(jmax); j < jmax; j++) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   958
    Node *x = mem_proj->fast_out(j);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   959
    // Proj might have an edge to a store or load node which precedes the membar.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   960
    if (x->is_Mem()) return false;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   961
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   962
    // On PPC64 release and volatile are implemented by an instruction
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   963
    // that also has acquire semantics. I.e. there is no need for an
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   964
    // acquire before these.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   965
    int xop = x->Opcode();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   966
    if (xop == Op_MemBarRelease || xop == Op_MemBarVolatile) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   967
      // Make sure we're not missing Call/Phi/MergeMem by checking
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   968
      // control edges. The control edge must directly lead back
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   969
      // to the MemBarAcquire
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   970
      Node *ctrl_proj = x->in(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   971
      if (ctrl_proj->is_Proj() && ctrl_proj->in(0) == mba) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   972
        return true;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   973
      }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   974
    }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   975
  }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   976
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   977
  return false;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   978
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   979
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   980
#define __ _masm.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   981
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   982
// Tertiary op of a LoadP or StoreP encoding.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   983
#define REGP_OP true
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   984
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   985
// ****************************************************************************
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   986
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   987
// REQUIRED FUNCTIONALITY
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   988
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   989
// !!!!! Special hack to get all type of calls to specify the byte offset
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   990
//       from the start of the call to the point where the return address
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   991
//       will point.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   992
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   993
// PPC port: Removed use of lazy constant construct.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   994
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   995
int MachCallStaticJavaNode::ret_addr_offset() {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   996
  // It's only a single branch-and-link instruction.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   997
  return 4;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   998
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   999
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1000
int MachCallDynamicJavaNode::ret_addr_offset() {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1001
  // Offset is 4 with postalloc expanded calls (bl is one instruction). We use
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1002
  // postalloc expanded calls if we use inline caches and do not update method data.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1003
  if (UseInlineCaches)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1004
    return 4;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1005
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1006
  int vtable_index = this->_vtable_index;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1007
  if (vtable_index < 0) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1008
    // Must be invalid_vtable_index, not nonvirtual_vtable_index.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1009
    assert(vtable_index == Method::invalid_vtable_index, "correct sentinel value");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1010
    return 12;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1011
  } else {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1012
    assert(!UseInlineCaches, "expect vtable calls only if not using ICs");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1013
    return 24;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1014
  }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1015
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1016
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1017
int MachCallRuntimeNode::ret_addr_offset() {
23211
954e3a81da29 8035647: PPC64: Support for elf v2 abi.
goetz
parents: 22927
diff changeset
  1018
#if defined(ABI_ELFv2)
954e3a81da29 8035647: PPC64: Support for elf v2 abi.
goetz
parents: 22927
diff changeset
  1019
  return 28;
954e3a81da29 8035647: PPC64: Support for elf v2 abi.
goetz
parents: 22927
diff changeset
  1020
#else
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1021
  return 40;
23211
954e3a81da29 8035647: PPC64: Support for elf v2 abi.
goetz
parents: 22927
diff changeset
  1022
#endif
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1023
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1024
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1025
//=============================================================================
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1026
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1027
// condition code conversions
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1028
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1029
static int cc_to_boint(int cc) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1030
  return Assembler::bcondCRbiIs0 | (cc & 8);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1031
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1032
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1033
static int cc_to_inverse_boint(int cc) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1034
  return Assembler::bcondCRbiIs0 | (8-(cc & 8));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1035
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1036
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1037
static int cc_to_biint(int cc, int flags_reg) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1038
  return (flags_reg << 2) | (cc & 3);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1039
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1040
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1041
//=============================================================================
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1042
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1043
// Compute padding required for nodes which need alignment. The padding
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1044
// is the number of bytes (not instructions) which will be inserted before
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1045
// the instruction. The padding must match the size of a NOP instruction.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1046
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1047
int string_indexOf_imm1_charNode::compute_padding(int current_offset) const {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1048
  return (3*4-current_offset)&31;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1049
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1050
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1051
int string_indexOf_imm1Node::compute_padding(int current_offset) const {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1052
  return (2*4-current_offset)&31;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1053
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1054
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1055
int string_indexOf_immNode::compute_padding(int current_offset) const {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1056
  return (3*4-current_offset)&31;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1057
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1058
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1059
int string_indexOfNode::compute_padding(int current_offset) const {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1060
  return (1*4-current_offset)&31;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1061
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1062
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1063
int string_compareNode::compute_padding(int current_offset) const {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1064
  return (4*4-current_offset)&31;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1065
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1066
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1067
int string_equals_immNode::compute_padding(int current_offset) const {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1068
  if (opnd_array(3)->constant() < 16) return 0; // Don't insert nops for short version (loop completely unrolled).
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1069
  return (2*4-current_offset)&31;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1070
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1071
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1072
int string_equalsNode::compute_padding(int current_offset) const {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1073
  return (7*4-current_offset)&31;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1074
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1075
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1076
int inlineCallClearArrayNode::compute_padding(int current_offset) const {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1077
  return (2*4-current_offset)&31;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1078
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1079
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1080
//=============================================================================
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1081
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1082
// Indicate if the safepoint node needs the polling page as an input.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1083
bool SafePointNode::needs_polling_address_input() {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1084
  // The address is loaded from thread by a seperate node.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1085
  return true;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1086
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1087
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1088
//=============================================================================
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1089
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1090
// Emit an interrupt that is caught by the debugger (for debugging compiler).
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1091
void emit_break(CodeBuffer &cbuf) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1092
  MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1093
  __ illtrap();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1094
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1095
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1096
#ifndef PRODUCT
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1097
void MachBreakpointNode::format(PhaseRegAlloc *ra_, outputStream *st) const {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1098
  st->print("BREAKPOINT");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1099
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1100
#endif
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1101
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1102
void MachBreakpointNode::emit(CodeBuffer &cbuf, PhaseRegAlloc *ra_) const {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1103
  emit_break(cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1104
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1105
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1106
uint MachBreakpointNode::size(PhaseRegAlloc *ra_) const {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1107
  return MachNode::size(ra_);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1108
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1109
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1110
//=============================================================================
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1111
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1112
void emit_nop(CodeBuffer &cbuf) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1113
  MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1114
  __ nop();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1115
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1116
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1117
static inline void emit_long(CodeBuffer &cbuf, int value) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1118
  *((int*)(cbuf.insts_end())) = value;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1119
  cbuf.set_insts_end(cbuf.insts_end() + BytesPerInstWord);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1120
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1121
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1122
//=============================================================================
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1123
23498
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  1124
%} // interrupt source
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  1125
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  1126
source_hpp %{ // Header information of the source block.
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  1127
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  1128
//--------------------------------------------------------------
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  1129
//---<  Used for optimization in Compile::Shorten_branches  >---
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  1130
//--------------------------------------------------------------
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  1131
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  1132
const uint trampoline_stub_size     =  6 * BytesPerInstWord;
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  1133
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  1134
class CallStubImpl {
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  1135
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  1136
 public:
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  1137
24349
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  1138
  // Emit call stub, compiled java to interpreter.
23498
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  1139
  static void emit_trampoline_stub(MacroAssembler &_masm, int destination_toc_offset, int insts_call_instruction_offset);
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  1140
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  1141
  // Size of call trampoline stub.
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  1142
  // This doesn't need to be accurate to the byte, but it
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  1143
  // must be larger than or equal to the real size of the stub.
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  1144
  static uint size_call_trampoline() {
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  1145
    return trampoline_stub_size;
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  1146
  }
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  1147
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  1148
  // number of relocations needed by a call trampoline stub
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  1149
  static uint reloc_call_trampoline() {
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  1150
    return 5;
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  1151
  }
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  1152
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  1153
};
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  1154
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  1155
%} // end source_hpp
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  1156
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  1157
source %{
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  1158
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1159
// Emit a trampoline stub for a call to a target which is too far away.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1160
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1161
// code sequences:
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1162
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1163
// call-site:
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1164
//   branch-and-link to <destination> or <trampoline stub>
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1165
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1166
// Related trampoline stub for this call-site in the stub section:
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1167
//   load the call target from the constant pool
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1168
//   branch via CTR (LR/link still points to the call-site above)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1169
23498
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  1170
void CallStubImpl::emit_trampoline_stub(MacroAssembler &_masm, int destination_toc_offset, int insts_call_instruction_offset) {
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1171
  // Start the stub.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1172
  address stub = __ start_a_stub(Compile::MAX_stubs_size/2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1173
  if (stub == NULL) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1174
    Compile::current()->env()->record_out_of_memory_failure();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1175
    return;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1176
  }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1177
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1178
  // For java_to_interp stubs we use R11_scratch1 as scratch register
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1179
  // and in call trampoline stubs we use R12_scratch2. This way we
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1180
  // can distinguish them (see is_NativeCallTrampolineStub_at()).
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1181
  Register reg_scratch = R12_scratch2;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1182
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1183
  // Create a trampoline stub relocation which relates this trampoline stub
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1184
  // with the call instruction at insts_call_instruction_offset in the
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1185
  // instructions code-section.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1186
  __ relocate(trampoline_stub_Relocation::spec(__ code()->insts()->start() + insts_call_instruction_offset));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1187
  const int stub_start_offset = __ offset();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1188
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1189
  // Now, create the trampoline stub's code:
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1190
  // - load the TOC
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1191
  // - load the call target from the constant pool
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1192
  // - call
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1193
  __ calculate_address_from_global_toc(reg_scratch, __ method_toc());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1194
  __ ld_largeoffset_unchecked(reg_scratch, destination_toc_offset, reg_scratch, false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1195
  __ mtctr(reg_scratch);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1196
  __ bctr();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1197
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1198
  const address stub_start_addr = __ addr_at(stub_start_offset);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1199
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1200
  // FIXME: Assert that the trampoline stub can be identified and patched.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1201
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1202
  // Assert that the encoded destination_toc_offset can be identified and that it is correct.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1203
  assert(destination_toc_offset == NativeCallTrampolineStub_at(stub_start_addr)->destination_toc_offset(),
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1204
         "encoded offset into the constant pool must match");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1205
  // Trampoline_stub_size should be good.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1206
  assert((uint)(__ offset() - stub_start_offset) <= trampoline_stub_size, "should be good size");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1207
  assert(is_NativeCallTrampolineStub_at(stub_start_addr), "doesn't look like a trampoline");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1208
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1209
  // End the stub.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1210
  __ end_a_stub();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1211
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1212
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1213
//=============================================================================
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1214
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1215
// Emit an inline branch-and-link call and a related trampoline stub.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1216
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1217
// code sequences:
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1218
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1219
// call-site:
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1220
//   branch-and-link to <destination> or <trampoline stub>
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1221
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1222
// Related trampoline stub for this call-site in the stub section:
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1223
//   load the call target from the constant pool
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1224
//   branch via CTR (LR/link still points to the call-site above)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1225
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1226
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1227
typedef struct {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1228
  int insts_call_instruction_offset;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1229
  int ret_addr_offset;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1230
} EmitCallOffsets;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1231
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1232
// Emit a branch-and-link instruction that branches to a trampoline.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1233
// - Remember the offset of the branch-and-link instruction.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1234
// - Add a relocation at the branch-and-link instruction.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1235
// - Emit a branch-and-link.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1236
// - Remember the return pc offset.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1237
EmitCallOffsets emit_call_with_trampoline_stub(MacroAssembler &_masm, address entry_point, relocInfo::relocType rtype) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1238
  EmitCallOffsets offsets = { -1, -1 };
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1239
  const int start_offset = __ offset();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1240
  offsets.insts_call_instruction_offset = __ offset();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1241
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1242
  // No entry point given, use the current pc.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1243
  if (entry_point == NULL) entry_point = __ pc();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1244
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1245
  if (!Compile::current()->in_scratch_emit_size()) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1246
    // Put the entry point as a constant into the constant pool.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1247
    const address entry_point_toc_addr   = __ address_constant(entry_point, RelocationHolder::none);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1248
    const int     entry_point_toc_offset = __ offset_to_method_toc(entry_point_toc_addr);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1249
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1250
    // Emit the trampoline stub which will be related to the branch-and-link below.
23498
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  1251
    CallStubImpl::emit_trampoline_stub(_masm, entry_point_toc_offset, offsets.insts_call_instruction_offset);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1252
    __ relocate(rtype);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1253
  }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1254
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1255
  // Note: At this point we do not have the address of the trampoline
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1256
  // stub, and the entry point might be too far away for bl, so __ pc()
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1257
  // serves as dummy and the bl will be patched later.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1258
  __ bl((address) __ pc());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1259
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1260
  offsets.ret_addr_offset = __ offset() - start_offset;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1261
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1262
  return offsets;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1263
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1264
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1265
//=============================================================================
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1266
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1267
// Factory for creating loadConL* nodes for large/small constant pool.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1268
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1269
static inline jlong replicate_immF(float con) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1270
  // Replicate float con 2 times and pack into vector.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1271
  int val = *((int*)&con);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1272
  jlong lval = val;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1273
  lval = (lval << 32) | (lval & 0xFFFFFFFFl);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1274
  return lval;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1275
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1276
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1277
//=============================================================================
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1278
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1279
const RegMask& MachConstantBaseNode::_out_RegMask = BITS64_CONSTANT_TABLE_BASE_mask();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1280
int Compile::ConstantTable::calculate_table_base_offset() const {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1281
  return 0;  // absolute addressing, no offset
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1282
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1283
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1284
bool MachConstantBaseNode::requires_postalloc_expand() const { return true; }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1285
void MachConstantBaseNode::postalloc_expand(GrowableArray <Node *> *nodes, PhaseRegAlloc *ra_) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1286
  Compile *C = ra_->C;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1287
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  1288
  iRegPdstOper *op_dst = new iRegPdstOper();
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  1289
  MachNode *m1 = new loadToc_hiNode();
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  1290
  MachNode *m2 = new loadToc_loNode();
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1291
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1292
  m1->add_req(NULL);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1293
  m2->add_req(NULL, m1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1294
  m1->_opnds[0] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1295
  m2->_opnds[0] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1296
  m2->_opnds[1] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1297
  ra_->set_pair(m1->_idx, ra_->get_reg_second(this), ra_->get_reg_first(this));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1298
  ra_->set_pair(m2->_idx, ra_->get_reg_second(this), ra_->get_reg_first(this));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1299
  nodes->push(m1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1300
  nodes->push(m2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1301
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1302
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1303
void MachConstantBaseNode::emit(CodeBuffer& cbuf, PhaseRegAlloc* ra_) const {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1304
  // Is postalloc expanded.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1305
  ShouldNotReachHere();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1306
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1307
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1308
uint MachConstantBaseNode::size(PhaseRegAlloc* ra_) const {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1309
  return 0;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1310
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1311
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1312
#ifndef PRODUCT
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1313
void MachConstantBaseNode::format(PhaseRegAlloc* ra_, outputStream* st) const {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1314
  st->print("-- \t// MachConstantBaseNode (empty encoding)");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1315
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1316
#endif
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1317
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1318
//=============================================================================
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1319
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1320
#ifndef PRODUCT
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1321
void MachPrologNode::format(PhaseRegAlloc *ra_, outputStream *st) const {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1322
  Compile* C = ra_->C;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1323
  const long framesize = C->frame_slots() << LogBytesPerInt;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1324
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1325
  st->print("PROLOG\n\t");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1326
  if (C->need_stack_bang(framesize)) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1327
    st->print("stack_overflow_check\n\t");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1328
  }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1329
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1330
  if (!false /* TODO: PPC port C->is_frameless_method()*/) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1331
    st->print("save return pc\n\t");
25374
d7fb2af5d53c 8048169: Change 8037816 breaks HS build on PPC64 and CPP-Interpreter platforms
coleenp
parents: 24923
diff changeset
  1332
    st->print("push frame %ld\n\t", -framesize);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1333
  }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1334
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1335
#endif
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1336
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1337
// Macro used instead of the common __ to emulate the pipes of PPC.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1338
// Instead of e.g. __ ld(...) one hase to write ___(ld) ld(...) This enables the
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1339
// micro scheduler to cope with "hand written" assembler like in the prolog. Though
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1340
// still no scheduling of this code is possible, the micro scheduler is aware of the
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1341
// code and can update its internal data. The following mechanism is used to achieve this:
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1342
// The micro scheduler calls size() of each compound node during scheduling. size() does a
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1343
// dummy emit and only during this dummy emit C->hb_scheduling() is not NULL.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1344
#if 0 // TODO: PPC port
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1345
#define ___(op) if (UsePower6SchedulerPPC64 && C->hb_scheduling())                    \
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1346
                  C->hb_scheduling()->_pdScheduling->PdEmulatePipe(ppc64Opcode_##op); \
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1347
                _masm.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1348
#define ___stop if (UsePower6SchedulerPPC64 && C->hb_scheduling())                    \
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1349
                  C->hb_scheduling()->_pdScheduling->PdEmulatePipe(archOpcode_none)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1350
#define ___advance if (UsePower6SchedulerPPC64 && C->hb_scheduling())                 \
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1351
                  C->hb_scheduling()->_pdScheduling->advance_offset
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1352
#else
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1353
#define ___(op) if (UsePower6SchedulerPPC64)                                          \
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1354
                  Unimplemented();                                                    \
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1355
                _masm.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1356
#define ___stop if (UsePower6SchedulerPPC64)                                          \
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1357
                  Unimplemented()
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1358
#define ___advance if (UsePower6SchedulerPPC64)                                       \
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1359
                  Unimplemented()
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1360
#endif
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1361
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1362
void MachPrologNode::emit(CodeBuffer &cbuf, PhaseRegAlloc *ra_) const {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1363
  Compile* C = ra_->C;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1364
  MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1365
24018
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents: 23498
diff changeset
  1366
  const long framesize = C->frame_size_in_bytes();
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents: 23498
diff changeset
  1367
  assert(framesize % (2 * wordSize) == 0, "must preserve 2*wordSize alignment");
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1368
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1369
  const bool method_is_frameless      = false /* TODO: PPC port C->is_frameless_method()*/;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1370
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1371
  const Register return_pc            = R20; // Must match return_addr() in frame section.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1372
  const Register callers_sp           = R21;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1373
  const Register push_frame_temp      = R22;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1374
  const Register toc_temp             = R23;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1375
  assert_different_registers(R11, return_pc, callers_sp, push_frame_temp, toc_temp);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1376
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1377
  if (method_is_frameless) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1378
    // Add nop at beginning of all frameless methods to prevent any
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1379
    // oop instructions from getting overwritten by make_not_entrant
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1380
    // (patching attempt would fail).
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1381
    ___(nop) nop();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1382
  } else {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1383
    // Get return pc.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1384
    ___(mflr) mflr(return_pc);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1385
  }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1386
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1387
  // Calls to C2R adapters often do not accept exceptional returns.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1388
  // We require that their callers must bang for them. But be
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1389
  // careful, because some VM calls (such as call site linkage) can
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1390
  // use several kilobytes of stack. But the stack safety zone should
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1391
  // account for that. See bugs 4446381, 4468289, 4497237.
24018
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents: 23498
diff changeset
  1392
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents: 23498
diff changeset
  1393
  int bangsize = C->bang_size_in_bytes();
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents: 23498
diff changeset
  1394
  assert(bangsize >= framesize || bangsize <= 0, "stack bang size incorrect");
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents: 23498
diff changeset
  1395
  if (C->need_stack_bang(bangsize) && UseStackBanging) {
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1396
    // Unfortunately we cannot use the function provided in
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1397
    // assembler.cpp as we have to emulate the pipes. So I had to
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1398
    // insert the code of generate_stack_overflow_check(), see
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1399
    // assembler.cpp for some illuminative comments.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1400
    const int page_size = os::vm_page_size();
24018
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents: 23498
diff changeset
  1401
    int bang_end = StackShadowPages * page_size;
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1402
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1403
    // This is how far the previous frame's stack banging extended.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1404
    const int bang_end_safe = bang_end;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1405
24018
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents: 23498
diff changeset
  1406
    if (bangsize > page_size) {
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents: 23498
diff changeset
  1407
      bang_end += bangsize;
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1408
    }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1409
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1410
    int bang_offset = bang_end_safe;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1411
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1412
    while (bang_offset <= bang_end) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1413
      // Need at least one stack bang at end of shadow zone.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1414
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1415
      // Again I had to copy code, this time from assembler_ppc64.cpp,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1416
      // bang_stack_with_offset - see there for comments.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1417
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1418
      // Stack grows down, caller passes positive offset.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1419
      assert(bang_offset > 0, "must bang with positive offset");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1420
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1421
      long stdoffset = -bang_offset;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1422
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1423
      if (Assembler::is_simm(stdoffset, 16)) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1424
        // Signed 16 bit offset, a simple std is ok.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1425
        if (UseLoadInstructionsForStackBangingPPC64) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1426
          ___(ld) ld(R0,  (int)(signed short)stdoffset, R1_SP);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1427
        } else {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1428
          ___(std) std(R0, (int)(signed short)stdoffset, R1_SP);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1429
        }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1430
      } else if (Assembler::is_simm(stdoffset, 31)) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1431
        // Use largeoffset calculations for addis & ld/std.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1432
        const int hi = MacroAssembler::largeoffset_si16_si16_hi(stdoffset);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1433
        const int lo = MacroAssembler::largeoffset_si16_si16_lo(stdoffset);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1434
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1435
        Register tmp = R11;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1436
        ___(addis) addis(tmp, R1_SP, hi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1437
        if (UseLoadInstructionsForStackBangingPPC64) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1438
          ___(ld) ld(R0, lo, tmp);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1439
        } else {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1440
          ___(std) std(R0, lo, tmp);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1441
        }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1442
      } else {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1443
        ShouldNotReachHere();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1444
      }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1445
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1446
      bang_offset += page_size;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1447
    }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1448
    // R11 trashed
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1449
  } // C->need_stack_bang(framesize) && UseStackBanging
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1450
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1451
  unsigned int bytes = (unsigned int)framesize;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1452
  long offset = Assembler::align_addr(bytes, frame::alignment_in_bytes);
24018
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents: 23498
diff changeset
  1453
  ciMethod *currMethod = C->method();
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1454
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1455
  // Optimized version for most common case.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1456
  if (UsePower6SchedulerPPC64 &&
22867
309bcf262a19 8031319: PPC64: Some fixes in ppc and aix coding.
goetz
parents: 22865
diff changeset
  1457
      !method_is_frameless && Assembler::is_simm((int)(-offset), 16) &&
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1458
      !(false /* ConstantsALot TODO: PPC port*/)) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1459
    ___(or) mr(callers_sp, R1_SP);
22867
309bcf262a19 8031319: PPC64: Some fixes in ppc and aix coding.
goetz
parents: 22865
diff changeset
  1460
    ___(std) std(return_pc, _abi(lr), R1_SP);
309bcf262a19 8031319: PPC64: Some fixes in ppc and aix coding.
goetz
parents: 22865
diff changeset
  1461
    ___(stdu) stdu(R1_SP, -offset, R1_SP);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1462
    return;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1463
  }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1464
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1465
  if (!method_is_frameless) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1466
    // Get callers sp.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1467
    ___(or) mr(callers_sp, R1_SP);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1468
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1469
    // Push method's frame, modifies SP.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1470
    assert(Assembler::is_uimm(framesize, 32U), "wrong type");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1471
    // The ABI is already accounted for in 'framesize' via the
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1472
    // 'out_preserve' area.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1473
    Register tmp = push_frame_temp;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1474
    // Had to insert code of push_frame((unsigned int)framesize, push_frame_temp).
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1475
    if (Assembler::is_simm(-offset, 16)) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1476
      ___(stdu) stdu(R1_SP, -offset, R1_SP);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1477
    } else {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1478
      long x = -offset;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1479
      // Had to insert load_const(tmp, -offset).
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1480
      ___(addis)  lis( tmp, (int)((signed short)(((x >> 32) & 0xffff0000) >> 16)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1481
      ___(ori)    ori( tmp, tmp, ((x >> 32) & 0x0000ffff));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1482
      ___(rldicr) sldi(tmp, tmp, 32);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1483
      ___(oris)   oris(tmp, tmp, (x & 0xffff0000) >> 16);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1484
      ___(ori)    ori( tmp, tmp, (x & 0x0000ffff));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1485
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1486
      ___(stdux) stdux(R1_SP, R1_SP, tmp);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1487
    }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1488
  }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1489
#if 0 // TODO: PPC port
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1490
  // For testing large constant pools, emit a lot of constants to constant pool.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1491
  // "Randomize" const_size.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1492
  if (ConstantsALot) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1493
    const int num_consts = const_size();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1494
    for (int i = 0; i < num_consts; i++) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1495
      __ long_constant(0xB0B5B00BBABE);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1496
    }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1497
  }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1498
#endif
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1499
  if (!method_is_frameless) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1500
    // Save return pc.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1501
    ___(std) std(return_pc, _abi(lr), callers_sp);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1502
  }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1503
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1504
#undef ___
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1505
#undef ___stop
22867
309bcf262a19 8031319: PPC64: Some fixes in ppc and aix coding.
goetz
parents: 22865
diff changeset
  1506
#undef ___advance
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1507
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1508
uint MachPrologNode::size(PhaseRegAlloc *ra_) const {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1509
  // Variable size. determine dynamically.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1510
  return MachNode::size(ra_);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1511
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1512
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1513
int MachPrologNode::reloc() const {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1514
  // Return number of relocatable values contained in this instruction.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1515
  return 1; // 1 reloc entry for load_const(toc).
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1516
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1517
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1518
//=============================================================================
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1519
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1520
#ifndef PRODUCT
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1521
void MachEpilogNode::format(PhaseRegAlloc *ra_, outputStream *st) const {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1522
  Compile* C = ra_->C;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1523
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1524
  st->print("EPILOG\n\t");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1525
  st->print("restore return pc\n\t");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1526
  st->print("pop frame\n\t");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1527
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1528
  if (do_polling() && C->is_method_compilation()) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1529
    st->print("touch polling page\n\t");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1530
  }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1531
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1532
#endif
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1533
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1534
void MachEpilogNode::emit(CodeBuffer &cbuf, PhaseRegAlloc *ra_) const {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1535
  Compile* C = ra_->C;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1536
  MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1537
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1538
  const long framesize = ((long)C->frame_slots()) << LogBytesPerInt;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1539
  assert(framesize >= 0, "negative frame-size?");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1540
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1541
  const bool method_needs_polling = do_polling() && C->is_method_compilation();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1542
  const bool method_is_frameless  = false /* TODO: PPC port C->is_frameless_method()*/;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1543
  const Register return_pc        = R11;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1544
  const Register polling_page     = R12;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1545
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1546
  if (!method_is_frameless) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1547
    // Restore return pc relative to callers' sp.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1548
    __ ld(return_pc, ((int)framesize) + _abi(lr), R1_SP);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1549
  }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1550
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1551
  if (method_needs_polling) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1552
    if (LoadPollAddressFromThread) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1553
      // TODO: PPC port __ ld(polling_page, in_bytes(JavaThread::poll_address_offset()), R16_thread);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1554
      Unimplemented();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1555
    } else {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1556
      __ load_const_optimized(polling_page, (long)(address) os::get_polling_page()); // TODO: PPC port: get_standard_polling_page()
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1557
    }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1558
  }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1559
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1560
  if (!method_is_frameless) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1561
    // Move return pc to LR.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1562
    __ mtlr(return_pc);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1563
    // Pop frame (fixed frame-size).
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1564
    __ addi(R1_SP, R1_SP, (int)framesize);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1565
  }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1566
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1567
  if (method_needs_polling) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1568
    // We need to mark the code position where the load from the safepoint
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1569
    // polling page was emitted as relocInfo::poll_return_type here.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1570
    __ relocate(relocInfo::poll_return_type);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1571
    __ load_from_polling_page(polling_page);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1572
  }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1573
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1574
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1575
uint MachEpilogNode::size(PhaseRegAlloc *ra_) const {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1576
  // Variable size. Determine dynamically.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1577
  return MachNode::size(ra_);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1578
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1579
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1580
int MachEpilogNode::reloc() const {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1581
  // Return number of relocatable values contained in this instruction.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1582
  return 1; // 1 for load_from_polling_page.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1583
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1584
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1585
const Pipeline * MachEpilogNode::pipeline() const {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1586
  return MachNode::pipeline_class();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1587
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1588
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1589
// This method seems to be obsolete. It is declared in machnode.hpp
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1590
// and defined in all *.ad files, but it is never called. Should we
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1591
// get rid of it?
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1592
int MachEpilogNode::safepoint_offset() const {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1593
  assert(do_polling(), "no return for this epilog node");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1594
  return 0;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1595
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1596
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1597
#if 0 // TODO: PPC port
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1598
void MachLoadPollAddrLateNode::emit(CodeBuffer& cbuf, PhaseRegAlloc* ra_) const {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1599
  MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1600
  if (LoadPollAddressFromThread) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1601
    _masm.ld(R11, in_bytes(JavaThread::poll_address_offset()), R16_thread);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1602
  } else {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1603
    _masm.nop();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1604
  }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1605
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1606
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1607
uint MachLoadPollAddrLateNode::size(PhaseRegAlloc* ra_) const {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1608
  if (LoadPollAddressFromThread) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1609
    return 4;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1610
  } else {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1611
    return 4;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1612
  }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1613
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1614
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1615
#ifndef PRODUCT
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1616
void MachLoadPollAddrLateNode::format(PhaseRegAlloc* ra_, outputStream* st) const {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1617
  st->print_cr(" LD R11, PollAddressOffset, R16_thread \t// LoadPollAddressFromThread");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1618
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1619
#endif
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1620
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1621
const RegMask &MachLoadPollAddrLateNode::out_RegMask() const {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1622
  return RSCRATCH1_BITS64_REG_mask();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1623
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1624
#endif // PPC port
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1625
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1626
// =============================================================================
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1627
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1628
// Figure out which register class each belongs in: rc_int, rc_float or
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1629
// rc_stack.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1630
enum RC { rc_bad, rc_int, rc_float, rc_stack };
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1631
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1632
static enum RC rc_class(OptoReg::Name reg) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1633
  // Return the register class for the given register. The given register
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1634
  // reg is a <register>_num value, which is an index into the MachRegisterNumbers
25715
d5a8dbdc5150 8049325: Introduce and clean up umbrella headers for the files in the cpu subdirectories.
goetz
parents: 25374
diff changeset
  1635
  // enumeration in adGlobals_ppc.hpp.
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1636
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1637
  if (reg == OptoReg::Bad) return rc_bad;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1638
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1639
  // We have 64 integer register halves, starting at index 0.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1640
  if (reg < 64) return rc_int;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1641
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1642
  // We have 64 floating-point register halves, starting at index 64.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1643
  if (reg < 64+64) return rc_float;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1644
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1645
  // Between float regs & stack are the flags regs.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1646
  assert(OptoReg::is_stack(reg), "blow up if spilling flags");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1647
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1648
  return rc_stack;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1649
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1650
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1651
static int ld_st_helper(CodeBuffer *cbuf, const char *op_str, uint opcode, int reg, int offset,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1652
                        bool do_print, Compile* C, outputStream *st) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1653
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1654
  assert(opcode == Assembler::LD_OPCODE   ||
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1655
         opcode == Assembler::STD_OPCODE  ||
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1656
         opcode == Assembler::LWZ_OPCODE  ||
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1657
         opcode == Assembler::STW_OPCODE  ||
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1658
         opcode == Assembler::LFD_OPCODE  ||
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1659
         opcode == Assembler::STFD_OPCODE ||
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1660
         opcode == Assembler::LFS_OPCODE  ||
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1661
         opcode == Assembler::STFS_OPCODE,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1662
         "opcode not supported");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1663
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1664
  if (cbuf) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1665
    int d =
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1666
      (Assembler::LD_OPCODE == opcode || Assembler::STD_OPCODE == opcode) ?
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1667
        Assembler::ds(offset+0 /* TODO: PPC port C->frame_slots_sp_bias_in_bytes()*/)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1668
      : Assembler::d1(offset+0 /* TODO: PPC port C->frame_slots_sp_bias_in_bytes()*/); // Makes no difference in opt build.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1669
    emit_long(*cbuf, opcode | Assembler::rt(Matcher::_regEncode[reg]) | d | Assembler::ra(R1_SP));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1670
  }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1671
#ifndef PRODUCT
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1672
  else if (do_print) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1673
    st->print("%-7s %s, [R1_SP + #%d+%d] \t// spill copy",
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1674
              op_str,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1675
              Matcher::regName[reg],
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1676
              offset, 0 /* TODO: PPC port C->frame_slots_sp_bias_in_bytes()*/);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1677
  }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1678
#endif
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1679
  return 4; // size
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1680
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1681
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1682
uint MachSpillCopyNode::implementation(CodeBuffer *cbuf, PhaseRegAlloc *ra_, bool do_size, outputStream *st) const {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1683
  Compile* C = ra_->C;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1684
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1685
  // Get registers to move.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1686
  OptoReg::Name src_hi = ra_->get_reg_second(in(1));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1687
  OptoReg::Name src_lo = ra_->get_reg_first(in(1));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1688
  OptoReg::Name dst_hi = ra_->get_reg_second(this);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1689
  OptoReg::Name dst_lo = ra_->get_reg_first(this);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1690
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1691
  enum RC src_hi_rc = rc_class(src_hi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1692
  enum RC src_lo_rc = rc_class(src_lo);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1693
  enum RC dst_hi_rc = rc_class(dst_hi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1694
  enum RC dst_lo_rc = rc_class(dst_lo);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1695
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1696
  assert(src_lo != OptoReg::Bad && dst_lo != OptoReg::Bad, "must move at least 1 register");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1697
  if (src_hi != OptoReg::Bad)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1698
    assert((src_lo&1)==0 && src_lo+1==src_hi &&
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1699
           (dst_lo&1)==0 && dst_lo+1==dst_hi,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1700
           "expected aligned-adjacent pairs");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1701
  // Generate spill code!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1702
  int size = 0;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1703
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1704
  if (src_lo == dst_lo && src_hi == dst_hi)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1705
    return size;            // Self copy, no move.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1706
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1707
  // --------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1708
  // Memory->Memory Spill. Use R0 to hold the value.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1709
  if (src_lo_rc == rc_stack && dst_lo_rc == rc_stack) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1710
    int src_offset = ra_->reg2offset(src_lo);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1711
    int dst_offset = ra_->reg2offset(dst_lo);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1712
    if (src_hi != OptoReg::Bad) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1713
      assert(src_hi_rc==rc_stack && dst_hi_rc==rc_stack,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1714
             "expected same type of move for high parts");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1715
      size += ld_st_helper(cbuf, "LD  ", Assembler::LD_OPCODE,  R0_num, src_offset, !do_size, C, st);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1716
      if (!cbuf && !do_size) st->print("\n\t");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1717
      size += ld_st_helper(cbuf, "STD ", Assembler::STD_OPCODE, R0_num, dst_offset, !do_size, C, st);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1718
    } else {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1719
      size += ld_st_helper(cbuf, "LWZ ", Assembler::LWZ_OPCODE, R0_num, src_offset, !do_size, C, st);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1720
      if (!cbuf && !do_size) st->print("\n\t");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1721
      size += ld_st_helper(cbuf, "STW ", Assembler::STW_OPCODE, R0_num, dst_offset, !do_size, C, st);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1722
    }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1723
    return size;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1724
  }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1725
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1726
  // --------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1727
  // Check for float->int copy; requires a trip through memory.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1728
  if (src_lo_rc == rc_float && dst_lo_rc == rc_int) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1729
    Unimplemented();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1730
  }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1731
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1732
  // --------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1733
  // Check for integer reg-reg copy.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1734
  if (src_lo_rc == rc_int && dst_lo_rc == rc_int) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1735
      Register Rsrc = as_Register(Matcher::_regEncode[src_lo]);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1736
      Register Rdst = as_Register(Matcher::_regEncode[dst_lo]);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1737
      size = (Rsrc != Rdst) ? 4 : 0;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1738
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1739
      if (cbuf) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1740
        MacroAssembler _masm(cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1741
        if (size) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1742
          __ mr(Rdst, Rsrc);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1743
        }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1744
      }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1745
#ifndef PRODUCT
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1746
      else if (!do_size) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1747
        if (size) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1748
          st->print("%-7s %s, %s \t// spill copy", "MR", Matcher::regName[dst_lo], Matcher::regName[src_lo]);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1749
        } else {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1750
          st->print("%-7s %s, %s \t// spill copy", "MR-NOP", Matcher::regName[dst_lo], Matcher::regName[src_lo]);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1751
        }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1752
      }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1753
#endif
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1754
      return size;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1755
  }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1756
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1757
  // Check for integer store.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1758
  if (src_lo_rc == rc_int && dst_lo_rc == rc_stack) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1759
    int dst_offset = ra_->reg2offset(dst_lo);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1760
    if (src_hi != OptoReg::Bad) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1761
      assert(src_hi_rc==rc_int && dst_hi_rc==rc_stack,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1762
             "expected same type of move for high parts");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1763
      size += ld_st_helper(cbuf, "STD ", Assembler::STD_OPCODE, src_lo, dst_offset, !do_size, C, st);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1764
    } else {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1765
      size += ld_st_helper(cbuf, "STW ", Assembler::STW_OPCODE, src_lo, dst_offset, !do_size, C, st);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1766
    }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1767
    return size;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1768
  }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1769
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1770
  // Check for integer load.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1771
  if (dst_lo_rc == rc_int && src_lo_rc == rc_stack) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1772
    int src_offset = ra_->reg2offset(src_lo);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1773
    if (src_hi != OptoReg::Bad) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1774
      assert(dst_hi_rc==rc_int && src_hi_rc==rc_stack,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1775
             "expected same type of move for high parts");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1776
      size += ld_st_helper(cbuf, "LD  ", Assembler::LD_OPCODE, dst_lo, src_offset, !do_size, C, st);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1777
    } else {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1778
      size += ld_st_helper(cbuf, "LWZ ", Assembler::LWZ_OPCODE, dst_lo, src_offset, !do_size, C, st);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1779
    }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1780
    return size;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1781
  }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1782
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1783
  // Check for float reg-reg copy.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1784
  if (src_lo_rc == rc_float && dst_lo_rc == rc_float) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1785
    if (cbuf) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1786
      MacroAssembler _masm(cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1787
      FloatRegister Rsrc = as_FloatRegister(Matcher::_regEncode[src_lo]);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1788
      FloatRegister Rdst = as_FloatRegister(Matcher::_regEncode[dst_lo]);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1789
      __ fmr(Rdst, Rsrc);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1790
    }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1791
#ifndef PRODUCT
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1792
    else if (!do_size) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1793
      st->print("%-7s %s, %s \t// spill copy", "FMR", Matcher::regName[dst_lo], Matcher::regName[src_lo]);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1794
    }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1795
#endif
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1796
    return 4;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1797
  }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1798
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1799
  // Check for float store.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1800
  if (src_lo_rc == rc_float && dst_lo_rc == rc_stack) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1801
    int dst_offset = ra_->reg2offset(dst_lo);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1802
    if (src_hi != OptoReg::Bad) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1803
      assert(src_hi_rc==rc_float && dst_hi_rc==rc_stack,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1804
             "expected same type of move for high parts");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1805
      size += ld_st_helper(cbuf, "STFD", Assembler::STFD_OPCODE, src_lo, dst_offset, !do_size, C, st);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1806
    } else {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1807
      size += ld_st_helper(cbuf, "STFS", Assembler::STFS_OPCODE, src_lo, dst_offset, !do_size, C, st);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1808
    }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1809
    return size;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1810
  }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1811
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1812
  // Check for float load.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1813
  if (dst_lo_rc == rc_float && src_lo_rc == rc_stack) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1814
    int src_offset = ra_->reg2offset(src_lo);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1815
    if (src_hi != OptoReg::Bad) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1816
      assert(dst_hi_rc==rc_float && src_hi_rc==rc_stack,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1817
             "expected same type of move for high parts");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1818
      size += ld_st_helper(cbuf, "LFD ", Assembler::LFD_OPCODE, dst_lo, src_offset, !do_size, C, st);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1819
    } else {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1820
      size += ld_st_helper(cbuf, "LFS ", Assembler::LFS_OPCODE, dst_lo, src_offset, !do_size, C, st);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1821
    }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1822
    return size;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1823
  }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1824
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1825
  // --------------------------------------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1826
  // Check for hi bits still needing moving. Only happens for misaligned
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1827
  // arguments to native calls.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1828
  if (src_hi == dst_hi)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1829
    return size;               // Self copy; no move.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1830
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1831
  assert(src_hi_rc != rc_bad && dst_hi_rc != rc_bad, "src_hi & dst_hi cannot be Bad");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1832
  ShouldNotReachHere(); // Unimplemented
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1833
  return 0;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1834
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1835
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1836
#ifndef PRODUCT
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1837
void MachSpillCopyNode::format(PhaseRegAlloc *ra_, outputStream *st) const {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1838
  if (!ra_)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1839
    st->print("N%d = SpillCopy(N%d)", _idx, in(1)->_idx);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1840
  else
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1841
    implementation(NULL, ra_, false, st);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1842
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1843
#endif
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1844
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1845
void MachSpillCopyNode::emit(CodeBuffer &cbuf, PhaseRegAlloc *ra_) const {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1846
  implementation(&cbuf, ra_, false, NULL);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1847
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1848
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1849
uint MachSpillCopyNode::size(PhaseRegAlloc *ra_) const {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1850
  return implementation(NULL, ra_, true, NULL);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1851
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1852
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1853
#if 0 // TODO: PPC port
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1854
ArchOpcode MachSpillCopyNode_archOpcode(MachSpillCopyNode *n, PhaseRegAlloc *ra_) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1855
#ifndef PRODUCT
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1856
  if (ra_->node_regs_max_index() == 0) return archOpcode_undefined;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1857
#endif
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1858
  assert(ra_->node_regs_max_index() != 0, "");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1859
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1860
  // Get registers to move.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1861
  OptoReg::Name src_hi = ra_->get_reg_second(n->in(1));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1862
  OptoReg::Name src_lo = ra_->get_reg_first(n->in(1));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1863
  OptoReg::Name dst_hi = ra_->get_reg_second(n);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1864
  OptoReg::Name dst_lo = ra_->get_reg_first(n);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1865
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1866
  enum RC src_lo_rc = rc_class(src_lo);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1867
  enum RC dst_lo_rc = rc_class(dst_lo);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1868
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1869
  if (src_lo == dst_lo && src_hi == dst_hi)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1870
    return ppc64Opcode_none;            // Self copy, no move.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1871
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1872
  // --------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1873
  // Memory->Memory Spill. Use R0 to hold the value.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1874
  if (src_lo_rc == rc_stack && dst_lo_rc == rc_stack) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1875
    return ppc64Opcode_compound;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1876
  }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1877
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1878
  // --------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1879
  // Check for float->int copy; requires a trip through memory.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1880
  if (src_lo_rc == rc_float && dst_lo_rc == rc_int) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1881
    Unimplemented();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1882
  }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1883
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1884
  // --------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1885
  // Check for integer reg-reg copy.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1886
  if (src_lo_rc == rc_int && dst_lo_rc == rc_int) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1887
    Register Rsrc = as_Register(Matcher::_regEncode[src_lo]);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1888
    Register Rdst = as_Register(Matcher::_regEncode[dst_lo]);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1889
    if (Rsrc == Rdst) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1890
      return ppc64Opcode_none;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1891
    } else {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1892
      return ppc64Opcode_or;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1893
    }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1894
  }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1895
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1896
  // Check for integer store.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1897
  if (src_lo_rc == rc_int && dst_lo_rc == rc_stack) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1898
    if (src_hi != OptoReg::Bad) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1899
      return ppc64Opcode_std;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1900
    } else {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1901
      return ppc64Opcode_stw;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1902
    }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1903
  }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1904
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1905
  // Check for integer load.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1906
  if (dst_lo_rc == rc_int && src_lo_rc == rc_stack) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1907
    if (src_hi != OptoReg::Bad) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1908
      return ppc64Opcode_ld;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1909
    } else {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1910
      return ppc64Opcode_lwz;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1911
    }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1912
  }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1913
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1914
  // Check for float reg-reg copy.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1915
  if (src_lo_rc == rc_float && dst_lo_rc == rc_float) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1916
    return ppc64Opcode_fmr;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1917
  }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1918
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1919
  // Check for float store.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1920
  if (src_lo_rc == rc_float && dst_lo_rc == rc_stack) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1921
    if (src_hi != OptoReg::Bad) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1922
      return ppc64Opcode_stfd;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1923
    } else {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1924
      return ppc64Opcode_stfs;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1925
    }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1926
  }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1927
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1928
  // Check for float load.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1929
  if (dst_lo_rc == rc_float && src_lo_rc == rc_stack) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1930
    if (src_hi != OptoReg::Bad) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1931
      return ppc64Opcode_lfd;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1932
    } else {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1933
      return ppc64Opcode_lfs;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1934
    }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1935
  }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1936
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1937
  // --------------------------------------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1938
  // Check for hi bits still needing moving. Only happens for misaligned
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1939
  // arguments to native calls.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1940
  if (src_hi == dst_hi)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1941
    return ppc64Opcode_none;               // Self copy; no move.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1942
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1943
  ShouldNotReachHere();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1944
  return ppc64Opcode_undefined;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1945
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1946
#endif // PPC port
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1947
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1948
#ifndef PRODUCT
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1949
void MachNopNode::format(PhaseRegAlloc *ra_, outputStream *st) const {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1950
  st->print("NOP \t// %d nops to pad for loops.", _count);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1951
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1952
#endif
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1953
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1954
void MachNopNode::emit(CodeBuffer &cbuf, PhaseRegAlloc *) const {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1955
  MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1956
  // _count contains the number of nops needed for padding.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1957
  for (int i = 0; i < _count; i++) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1958
    __ nop();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1959
  }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1960
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1961
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1962
uint MachNopNode::size(PhaseRegAlloc *ra_) const {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1963
   return _count * 4;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1964
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1965
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1966
#ifndef PRODUCT
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1967
void BoxLockNode::format(PhaseRegAlloc *ra_, outputStream *st) const {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1968
  int offset = ra_->reg2offset(in_RegMask(0).find_first_elem());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1969
  int reg = ra_->get_reg_first(this);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1970
  st->print("ADDI %s, SP, %d \t// box node", Matcher::regName[reg], offset);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1971
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1972
#endif
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1973
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1974
void BoxLockNode::emit(CodeBuffer &cbuf, PhaseRegAlloc *ra_) const {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1975
  MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1976
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1977
  int offset = ra_->reg2offset(in_RegMask(0).find_first_elem());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1978
  int reg    = ra_->get_encode(this);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1979
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1980
  if (Assembler::is_simm(offset, 16)) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1981
    __ addi(as_Register(reg), R1, offset);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1982
  } else {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1983
    ShouldNotReachHere();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1984
  }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1985
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1986
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1987
uint BoxLockNode::size(PhaseRegAlloc *ra_) const {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1988
  // BoxLockNode is not a MachNode, so we can't just call MachNode::size(ra_).
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1989
  return 4;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1990
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1991
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1992
#ifndef PRODUCT
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1993
void MachUEPNode::format(PhaseRegAlloc *ra_, outputStream *st) const {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1994
  st->print_cr("---- MachUEPNode ----");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1995
  st->print_cr("...");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1996
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1997
#endif
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1998
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1999
void MachUEPNode::emit(CodeBuffer &cbuf, PhaseRegAlloc *ra_) const {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2000
  // This is the unverified entry point.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2001
  MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2002
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2003
  // Inline_cache contains a klass.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2004
  Register ic_klass       = as_Register(Matcher::inline_cache_reg_encode());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2005
  Register receiver_klass = R0;  // tmp
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2006
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2007
  assert_different_registers(ic_klass, receiver_klass, R11_scratch1, R3_ARG1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2008
  assert(R11_scratch1 == R11, "need prologue scratch register");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2009
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2010
  // Check for NULL argument if we don't have implicit null checks.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2011
  if (!ImplicitNullChecks || !os::zero_page_read_protected()) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2012
    if (TrapBasedNullChecks) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2013
      __ trap_null_check(R3_ARG1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2014
    } else {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2015
      Label valid;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2016
      __ cmpdi(CCR0, R3_ARG1, 0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2017
      __ bne_predict_taken(CCR0, valid);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2018
      // We have a null argument, branch to ic_miss_stub.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2019
      __ b64_patchable((address)SharedRuntime::get_ic_miss_stub(),
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2020
                           relocInfo::runtime_call_type);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2021
      __ bind(valid);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2022
    }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2023
  }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2024
  // Assume argument is not NULL, load klass from receiver.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2025
  __ load_klass(receiver_klass, R3_ARG1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2026
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2027
  if (TrapBasedICMissChecks) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2028
    __ trap_ic_miss_check(receiver_klass, ic_klass);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2029
  } else {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2030
    Label valid;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2031
    __ cmpd(CCR0, receiver_klass, ic_klass);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2032
    __ beq_predict_taken(CCR0, valid);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2033
    // We have an unexpected klass, branch to ic_miss_stub.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2034
    __ b64_patchable((address)SharedRuntime::get_ic_miss_stub(),
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2035
                         relocInfo::runtime_call_type);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2036
    __ bind(valid);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2037
  }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2038
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2039
  // Argument is valid and klass is as expected, continue.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2040
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2041
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2042
#if 0 // TODO: PPC port
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2043
// Optimize UEP code on z (save a load_const() call in main path).
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2044
int MachUEPNode::ep_offset() {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2045
  return 0;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2046
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2047
#endif
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2048
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2049
uint MachUEPNode::size(PhaseRegAlloc *ra_) const {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2050
  // Variable size. Determine dynamically.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2051
  return MachNode::size(ra_);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2052
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2053
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2054
//=============================================================================
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2055
23498
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  2056
%} // interrupt source
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  2057
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  2058
source_hpp %{ // Header information of the source block.
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  2059
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  2060
class HandlerImpl {
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  2061
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  2062
 public:
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  2063
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  2064
  static int emit_exception_handler(CodeBuffer &cbuf);
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  2065
  static int emit_deopt_handler(CodeBuffer& cbuf);
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  2066
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  2067
  static uint size_exception_handler() {
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  2068
    // The exception_handler is a b64_patchable.
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  2069
    return MacroAssembler::b64_patchable_size;
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  2070
  }
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  2071
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  2072
  static uint size_deopt_handler() {
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  2073
    // The deopt_handler is a bl64_patchable.
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  2074
    return MacroAssembler::bl64_patchable_size;
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  2075
  }
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  2076
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  2077
};
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  2078
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  2079
%} // end source_hpp
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  2080
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  2081
source %{
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  2082
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  2083
int HandlerImpl::emit_exception_handler(CodeBuffer &cbuf) {
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2084
  MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2085
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2086
  address base = __ start_a_stub(size_exception_handler());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2087
  if (base == NULL) return 0; // CodeBuffer::expand failed
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2088
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2089
  int offset = __ offset();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2090
  __ b64_patchable((address)OptoRuntime::exception_blob()->content_begin(),
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2091
                       relocInfo::runtime_call_type);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2092
  assert(__ offset() - offset == (int)size_exception_handler(), "must be fixed size");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2093
  __ end_a_stub();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2094
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2095
  return offset;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2096
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2097
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2098
// The deopt_handler is like the exception handler, but it calls to
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2099
// the deoptimization blob instead of jumping to the exception blob.
23498
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  2100
int HandlerImpl::emit_deopt_handler(CodeBuffer& cbuf) {
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2101
  MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2102
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2103
  address base = __ start_a_stub(size_deopt_handler());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2104
  if (base == NULL) return 0; // CodeBuffer::expand failed
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2105
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2106
  int offset = __ offset();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2107
  __ bl64_patchable((address)SharedRuntime::deopt_blob()->unpack(),
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2108
                        relocInfo::runtime_call_type);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2109
  assert(__ offset() - offset == (int) size_deopt_handler(), "must be fixed size");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2110
  __ end_a_stub();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2111
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2112
  return offset;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2113
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2114
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2115
//=============================================================================
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2116
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2117
// Use a frame slots bias for frameless methods if accessing the stack.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2118
static int frame_slots_bias(int reg_enc, PhaseRegAlloc* ra_) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2119
  if (as_Register(reg_enc) == R1_SP) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2120
    return 0; // TODO: PPC port ra_->C->frame_slots_sp_bias_in_bytes();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2121
  }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2122
  return 0;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2123
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2124
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2125
const bool Matcher::match_rule_supported(int opcode) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2126
  if (!has_match_rule(opcode))
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2127
    return false;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2128
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2129
  switch (opcode) {
22879
177361c49b26 8035394: PPC64: Make usage of intrinsic dsqrt depend on processor recognition.
goetz
parents: 22874
diff changeset
  2130
  case Op_SqrtD:
177361c49b26 8035394: PPC64: Make usage of intrinsic dsqrt depend on processor recognition.
goetz
parents: 22874
diff changeset
  2131
    return VM_Version::has_fsqrt();
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2132
  case Op_CountLeadingZerosI:
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2133
  case Op_CountLeadingZerosL:
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2134
  case Op_CountTrailingZerosI:
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2135
  case Op_CountTrailingZerosL:
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2136
    if (!UseCountLeadingZerosInstructionsPPC64)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2137
      return false;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2138
    break;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2139
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2140
  case Op_PopCountI:
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2141
  case Op_PopCountL:
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2142
    return (UsePopCountInstruction && VM_Version::has_popcntw());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2143
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2144
  case Op_StrComp:
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2145
    return SpecialStringCompareTo;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2146
  case Op_StrEquals:
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2147
    return SpecialStringEquals;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2148
  case Op_StrIndexOf:
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2149
    return SpecialStringIndexOf;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2150
  }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2151
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2152
  return true;  // Per default match rules are supported.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2153
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2154
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2155
int Matcher::regnum_to_fpu_offset(int regnum) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2156
  // No user for this method?
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2157
  Unimplemented();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2158
  return 999;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2159
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2160
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2161
const bool Matcher::convL2FSupported(void) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2162
  // fcfids can do the conversion (>= Power7).
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2163
  // fcfid + frsp showed rounding problem when result should be 0x3f800001.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2164
  return VM_Version::has_fcfids(); // False means that conversion is done by runtime call.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2165
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2166
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2167
// Vector width in bytes.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2168
const int Matcher::vector_width_in_bytes(BasicType bt) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2169
  assert(MaxVectorSize == 8, "");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2170
  return 8;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2171
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2172
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2173
// Vector ideal reg.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2174
const int Matcher::vector_ideal_reg(int size) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2175
  assert(MaxVectorSize == 8 && size == 8, "");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2176
  return Op_RegL;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2177
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2178
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2179
const int Matcher::vector_shift_count_ideal_reg(int size) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2180
  fatal("vector shift is not supported");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2181
  return Node::NotAMachineReg;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2182
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2183
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2184
// Limits on vector size (number of elements) loaded into vector.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2185
const int Matcher::max_vector_size(const BasicType bt) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2186
  assert(is_java_primitive(bt), "only primitive type vectors");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2187
  return vector_width_in_bytes(bt)/type2aelembytes(bt);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2188
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2189
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2190
const int Matcher::min_vector_size(const BasicType bt) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2191
  return max_vector_size(bt); // Same as max.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2192
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2193
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2194
// PPC doesn't support misaligned vectors store/load.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2195
const bool Matcher::misaligned_vectors_ok() {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2196
  return false;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2197
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2198
22874
9918cae8623d 8033117: PPC64: Adapt to 8002074: Support for AES on SPARC
goetz
parents: 22867
diff changeset
  2199
// PPC AES support not yet implemented
9918cae8623d 8033117: PPC64: Adapt to 8002074: Support for AES on SPARC
goetz
parents: 22867
diff changeset
  2200
const bool Matcher::pass_original_key_for_aes() {
9918cae8623d 8033117: PPC64: Adapt to 8002074: Support for AES on SPARC
goetz
parents: 22867
diff changeset
  2201
  return false;
9918cae8623d 8033117: PPC64: Adapt to 8002074: Support for AES on SPARC
goetz
parents: 22867
diff changeset
  2202
}
9918cae8623d 8033117: PPC64: Adapt to 8002074: Support for AES on SPARC
goetz
parents: 22867
diff changeset
  2203
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2204
// RETURNS: whether this branch offset is short enough that a short
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2205
// branch can be used.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2206
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2207
// If the platform does not provide any short branch variants, then
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2208
// this method should return `false' for offset 0.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2209
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2210
// `Compile::Fill_buffer' will decide on basis of this information
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2211
// whether to do the pass `Compile::Shorten_branches' at all.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2212
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2213
// And `Compile::Shorten_branches' will decide on basis of this
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2214
// information whether to replace particular branch sites by short
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2215
// ones.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2216
bool Matcher::is_short_branch_offset(int rule, int br_size, int offset) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2217
  // Is the offset within the range of a ppc64 pc relative branch?
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2218
  bool b;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2219
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2220
  const int safety_zone = 3 * BytesPerInstWord;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2221
  b = Assembler::is_simm((offset<0 ? offset-safety_zone : offset+safety_zone),
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2222
                         29 - 16 + 1 + 2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2223
  return b;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2224
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2225
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2226
const bool Matcher::isSimpleConstant64(jlong value) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2227
  // Probably always true, even if a temp register is required.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2228
  return true;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2229
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2230
/* TODO: PPC port
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2231
// Make a new machine dependent decode node (with its operands).
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2232
MachTypeNode *Matcher::make_decode_node(Compile *C) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2233
  assert(Universe::narrow_oop_base() == NULL && Universe::narrow_oop_shift() == 0,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2234
         "This method is only implemented for unscaled cOops mode so far");
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  2235
  MachTypeNode *decode = new decodeN_unscaledNode();
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  2236
  decode->set_opnd_array(0, new iRegPdstOper());
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  2237
  decode->set_opnd_array(1, new iRegNsrcOper());
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2238
  return decode;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2239
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2240
*/
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2241
// Threshold size for cleararray.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2242
const int Matcher::init_array_short_size = 8 * BytesPerLong;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2243
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2244
// false => size gets scaled to BytesPerLong, ok.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2245
const bool Matcher::init_array_count_is_in_bytes = false;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2246
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2247
// Use conditional move (CMOVL) on Power7.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2248
const int Matcher::long_cmove_cost() { return 0; } // this only makes long cmoves more expensive than int cmoves
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2249
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2250
// Suppress CMOVF. Conditional move available (sort of) on PPC64 only from P7 onwards. Not exploited yet.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2251
// fsel doesn't accept a condition register as input, so this would be slightly different.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2252
const int Matcher::float_cmove_cost() { return ConditionalMoveLimit; }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2253
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2254
// Power6 requires postalloc expand (see block.cpp for description of postalloc expand).
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2255
const bool Matcher::require_postalloc_expand = true;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2256
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2257
// Should the Matcher clone shifts on addressing modes, expecting them to
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2258
// be subsumed into complex addressing expressions or compute them into
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2259
// registers? True for Intel but false for most RISCs.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2260
const bool Matcher::clone_shift_expressions = false;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2261
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2262
// Do we need to mask the count passed to shift instructions or does
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2263
// the cpu only look at the lower 5/6 bits anyway?
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2264
// Off, as masks are generated in expand rules where required.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2265
// Constant shift counts are handled in Ideal phase.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2266
const bool Matcher::need_masked_shift_count = false;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2267
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2268
// This affects two different things:
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2269
//  - how Decode nodes are matched
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2270
//  - how ImplicitNullCheck opportunities are recognized
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2271
// If true, the matcher will try to remove all Decodes and match them
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2272
// (as operands) into nodes. NullChecks are not prepared to deal with
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2273
// Decodes by final_graph_reshaping().
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2274
// If false, final_graph_reshaping() forces the decode behind the Cmp
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2275
// for a NullCheck. The matcher matches the Decode node into a register.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2276
// Implicit_null_check optimization moves the Decode along with the
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2277
// memory operation back up before the NullCheck.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2278
bool Matcher::narrow_oop_use_complex_address() {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2279
  // TODO: PPC port if (MatchDecodeNodes) return true;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2280
  return false;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2281
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2282
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2283
bool Matcher::narrow_klass_use_complex_address() {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2284
  NOT_LP64(ShouldNotCallThis());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2285
  assert(UseCompressedClassPointers, "only for compressed klass code");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2286
  // TODO: PPC port if (MatchDecodeNodes) return true;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2287
  return false;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2288
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2289
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2290
// Is it better to copy float constants, or load them directly from memory?
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2291
// Intel can load a float constant from a direct address, requiring no
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2292
// extra registers. Most RISCs will have to materialize an address into a
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2293
// register first, so they would do better to copy the constant from stack.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2294
const bool Matcher::rematerialize_float_constants = false;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2295
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2296
// If CPU can load and store mis-aligned doubles directly then no fixup is
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2297
// needed. Else we split the double into 2 integer pieces and move it
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2298
// piece-by-piece. Only happens when passing doubles into C code as the
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2299
// Java calling convention forces doubles to be aligned.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2300
const bool Matcher::misaligned_doubles_ok = true;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2301
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2302
void Matcher::pd_implicit_null_fixup(MachNode *node, uint idx) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2303
 Unimplemented();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2304
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2305
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2306
// Advertise here if the CPU requires explicit rounding operations
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2307
// to implement the UseStrictFP mode.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2308
const bool Matcher::strict_fp_requires_explicit_rounding = false;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2309
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2310
// Do floats take an entire double register or just half?
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2311
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2312
// A float occupies a ppc64 double register. For the allocator, a
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2313
// ppc64 double register appears as a pair of float registers.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2314
bool Matcher::float_in_double() { return true; }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2315
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2316
// Do ints take an entire long register or just half?
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2317
// The relevant question is how the int is callee-saved:
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2318
// the whole long is written but de-opt'ing will have to extract
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2319
// the relevant 32 bits.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2320
const bool Matcher::int_in_long = true;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2321
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2322
// Constants for c2c and c calling conventions.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2323
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2324
const MachRegisterNumbers iarg_reg[8] = {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2325
  R3_num, R4_num, R5_num, R6_num,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2326
  R7_num, R8_num, R9_num, R10_num
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2327
};
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2328
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2329
const MachRegisterNumbers farg_reg[13] = {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2330
  F1_num, F2_num, F3_num, F4_num,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2331
  F5_num, F6_num, F7_num, F8_num,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2332
  F9_num, F10_num, F11_num, F12_num,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2333
  F13_num
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2334
};
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2335
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2336
const int num_iarg_registers = sizeof(iarg_reg) / sizeof(iarg_reg[0]);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2337
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2338
const int num_farg_registers = sizeof(farg_reg) / sizeof(farg_reg[0]);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2339
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2340
// Return whether or not this register is ever used as an argument. This
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2341
// function is used on startup to build the trampoline stubs in generateOptoStub.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2342
// Registers not mentioned will be killed by the VM call in the trampoline, and
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2343
// arguments in those registers not be available to the callee.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2344
bool Matcher::can_be_java_arg(int reg) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2345
  // We return true for all registers contained in iarg_reg[] and
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2346
  // farg_reg[] and their virtual halves.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2347
  // We must include the virtual halves in order to get STDs and LDs
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2348
  // instead of STWs and LWs in the trampoline stubs.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2349
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2350
  if (   reg == R3_num  || reg == R3_H_num
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2351
      || reg == R4_num  || reg == R4_H_num
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2352
      || reg == R5_num  || reg == R5_H_num
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2353
      || reg == R6_num  || reg == R6_H_num
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2354
      || reg == R7_num  || reg == R7_H_num
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2355
      || reg == R8_num  || reg == R8_H_num
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2356
      || reg == R9_num  || reg == R9_H_num
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2357
      || reg == R10_num || reg == R10_H_num)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2358
    return true;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2359
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2360
  if (   reg == F1_num  || reg == F1_H_num
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2361
      || reg == F2_num  || reg == F2_H_num
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2362
      || reg == F3_num  || reg == F3_H_num
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2363
      || reg == F4_num  || reg == F4_H_num
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2364
      || reg == F5_num  || reg == F5_H_num
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2365
      || reg == F6_num  || reg == F6_H_num
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2366
      || reg == F7_num  || reg == F7_H_num
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2367
      || reg == F8_num  || reg == F8_H_num
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2368
      || reg == F9_num  || reg == F9_H_num
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2369
      || reg == F10_num || reg == F10_H_num
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2370
      || reg == F11_num || reg == F11_H_num
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2371
      || reg == F12_num || reg == F12_H_num
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2372
      || reg == F13_num || reg == F13_H_num)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2373
    return true;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2374
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2375
  return false;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2376
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2377
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2378
bool Matcher::is_spillable_arg(int reg) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2379
  return can_be_java_arg(reg);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2380
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2381
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2382
bool Matcher::use_asm_for_ldiv_by_con(jlong divisor) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2383
  return false;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2384
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2385
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2386
// Register for DIVI projection of divmodI.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2387
RegMask Matcher::divI_proj_mask() {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2388
  ShouldNotReachHere();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2389
  return RegMask();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2390
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2391
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2392
// Register for MODI projection of divmodI.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2393
RegMask Matcher::modI_proj_mask() {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2394
  ShouldNotReachHere();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2395
  return RegMask();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2396
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2397
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2398
// Register for DIVL projection of divmodL.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2399
RegMask Matcher::divL_proj_mask() {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2400
  ShouldNotReachHere();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2401
  return RegMask();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2402
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2403
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2404
// Register for MODL projection of divmodL.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2405
RegMask Matcher::modL_proj_mask() {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2406
  ShouldNotReachHere();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2407
  return RegMask();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2408
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2409
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2410
const RegMask Matcher::method_handle_invoke_SP_save_mask() {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2411
  return RegMask();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2412
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2413
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2414
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2415
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2416
//----------ENCODING BLOCK-----------------------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2417
// This block specifies the encoding classes used by the compiler to output
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2418
// byte streams. Encoding classes are parameterized macros used by
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2419
// Machine Instruction Nodes in order to generate the bit encoding of the
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2420
// instruction. Operands specify their base encoding interface with the
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2421
// interface keyword. There are currently supported four interfaces,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2422
// REG_INTER, CONST_INTER, MEMORY_INTER, & COND_INTER. REG_INTER causes an
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2423
// operand to generate a function which returns its register number when
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2424
// queried. CONST_INTER causes an operand to generate a function which
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2425
// returns the value of the constant when queried. MEMORY_INTER causes an
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2426
// operand to generate four functions which return the Base Register, the
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2427
// Index Register, the Scale Value, and the Offset Value of the operand when
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2428
// queried. COND_INTER causes an operand to generate six functions which
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2429
// return the encoding code (ie - encoding bits for the instruction)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2430
// associated with each basic boolean condition for a conditional instruction.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2431
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2432
// Instructions specify two basic values for encoding. Again, a function
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2433
// is available to check if the constant displacement is an oop. They use the
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2434
// ins_encode keyword to specify their encoding classes (which must be
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2435
// a sequence of enc_class names, and their parameters, specified in
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2436
// the encoding block), and they use the
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2437
// opcode keyword to specify, in order, their primary, secondary, and
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2438
// tertiary opcode. Only the opcode sections which a particular instruction
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2439
// needs for encoding need to be specified.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2440
encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2441
  enc_class enc_unimplemented %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2442
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2443
    MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2444
    __ unimplemented("Unimplemented mach node encoding in AD file.", 13);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2445
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2446
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2447
  enc_class enc_untested %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2448
#ifdef ASSERT
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2449
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2450
    MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2451
    __ untested("Untested mach node encoding in AD file.");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2452
#else
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2453
    // TODO: PPC port $archOpcode(ppc64Opcode_none);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2454
#endif
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2455
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2456
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2457
  enc_class enc_lbz(iRegIdst dst, memory mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2458
    // TODO: PPC port $archOpcode(ppc64Opcode_lbz);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2459
    MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2460
    int Idisp = $mem$$disp + frame_slots_bias($mem$$base, ra_);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2461
    __ lbz($dst$$Register, Idisp, $mem$$base$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2462
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2463
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2464
  // Load acquire.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2465
  enc_class enc_lbz_ac(iRegIdst dst, memory mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2466
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2467
    MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2468
    int Idisp = $mem$$disp + frame_slots_bias($mem$$base, ra_);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2469
    __ lbz($dst$$Register, Idisp, $mem$$base$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2470
    __ twi_0($dst$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2471
    __ isync();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2472
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2473
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2474
  enc_class enc_lhz(iRegIdst dst, memory mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2475
    // TODO: PPC port $archOpcode(ppc64Opcode_lhz);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2476
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2477
    MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2478
    int Idisp = $mem$$disp + frame_slots_bias($mem$$base, ra_);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2479
    __ lhz($dst$$Register, Idisp, $mem$$base$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2480
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2481
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2482
  // Load acquire.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2483
  enc_class enc_lhz_ac(iRegIdst dst, memory mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2484
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2485
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2486
    MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2487
    int Idisp = $mem$$disp + frame_slots_bias($mem$$base, ra_);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2488
    __ lhz($dst$$Register, Idisp, $mem$$base$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2489
    __ twi_0($dst$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2490
    __ isync();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2491
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2492
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2493
  enc_class enc_lwz(iRegIdst dst, memory mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2494
    // TODO: PPC port $archOpcode(ppc64Opcode_lwz);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2495
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2496
    MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2497
    int Idisp = $mem$$disp + frame_slots_bias($mem$$base, ra_);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2498
    __ lwz($dst$$Register, Idisp, $mem$$base$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2499
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2500
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2501
  // Load acquire.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2502
  enc_class enc_lwz_ac(iRegIdst dst, memory mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2503
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2504
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2505
    MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2506
    int Idisp = $mem$$disp + frame_slots_bias($mem$$base, ra_);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2507
    __ lwz($dst$$Register, Idisp, $mem$$base$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2508
    __ twi_0($dst$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2509
    __ isync();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2510
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2511
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2512
  enc_class enc_ld(iRegLdst dst, memoryAlg4 mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2513
    // TODO: PPC port $archOpcode(ppc64Opcode_ld);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2514
    MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2515
    int Idisp = $mem$$disp + frame_slots_bias($mem$$base, ra_);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2516
    // Operand 'ds' requires 4-alignment.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2517
    assert((Idisp & 0x3) == 0, "unaligned offset");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2518
    __ ld($dst$$Register, Idisp, $mem$$base$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2519
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2520
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2521
  // Load acquire.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2522
  enc_class enc_ld_ac(iRegLdst dst, memoryAlg4 mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2523
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2524
    MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2525
    int Idisp = $mem$$disp + frame_slots_bias($mem$$base, ra_);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2526
    // Operand 'ds' requires 4-alignment.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2527
    assert((Idisp & 0x3) == 0, "unaligned offset");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2528
    __ ld($dst$$Register, Idisp, $mem$$base$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2529
    __ twi_0($dst$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2530
    __ isync();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2531
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2532
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2533
  enc_class enc_lfd(RegF dst, memory mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2534
    // TODO: PPC port $archOpcode(ppc64Opcode_lfd);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2535
    MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2536
    int Idisp = $mem$$disp + frame_slots_bias($mem$$base, ra_);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2537
    __ lfd($dst$$FloatRegister, Idisp, $mem$$base$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2538
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2539
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2540
  enc_class enc_load_long_constL(iRegLdst dst, immL src, iRegLdst toc) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2541
    // TODO: PPC port $archOpcode(ppc64Opcode_ld);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2542
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2543
    MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2544
    int toc_offset = 0;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2545
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2546
    if (!ra_->C->in_scratch_emit_size()) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2547
      address const_toc_addr;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2548
      // Create a non-oop constant, no relocation needed.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2549
      // If it is an IC, it has a virtual_call_Relocation.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2550
      const_toc_addr = __ long_constant((jlong)$src$$constant);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2551
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2552
      // Get the constant's TOC offset.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2553
      toc_offset = __ offset_to_method_toc(const_toc_addr);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2554
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2555
      // Keep the current instruction offset in mind.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2556
      ((loadConLNode*)this)->_cbuf_insts_offset = __ offset();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2557
    }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2558
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2559
    __ ld($dst$$Register, toc_offset, $toc$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2560
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2561
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2562
  enc_class enc_load_long_constL_hi(iRegLdst dst, iRegLdst toc, immL src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2563
    // TODO: PPC port $archOpcode(ppc64Opcode_addis);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2564
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2565
    MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2566
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2567
    if (!ra_->C->in_scratch_emit_size()) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2568
      address const_toc_addr;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2569
      // Create a non-oop constant, no relocation needed.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2570
      // If it is an IC, it has a virtual_call_Relocation.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2571
      const_toc_addr = __ long_constant((jlong)$src$$constant);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2572
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2573
      // Get the constant's TOC offset.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2574
      const int toc_offset = __ offset_to_method_toc(const_toc_addr);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2575
      // Store the toc offset of the constant.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2576
      ((loadConL_hiNode*)this)->_const_toc_offset = toc_offset;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2577
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2578
      // Also keep the current instruction offset in mind.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2579
      ((loadConL_hiNode*)this)->_cbuf_insts_offset = __ offset();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2580
    }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2581
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2582
    __ addis($dst$$Register, $toc$$Register, MacroAssembler::largeoffset_si16_si16_hi(_const_toc_offset));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2583
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2584
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2585
%} // encode
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2586
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2587
source %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2588
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2589
typedef struct {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2590
  loadConL_hiNode *_large_hi;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2591
  loadConL_loNode *_large_lo;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2592
  loadConLNode    *_small;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2593
  MachNode        *_last;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2594
} loadConLNodesTuple;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2595
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2596
loadConLNodesTuple loadConLNodesTuple_create(Compile *C, PhaseRegAlloc *ra_, Node *toc, immLOper *immSrc,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2597
                                             OptoReg::Name reg_second, OptoReg::Name reg_first) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2598
  loadConLNodesTuple nodes;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2599
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2600
  const bool large_constant_pool = true; // TODO: PPC port C->cfg()->_consts_size > 4000;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2601
  if (large_constant_pool) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2602
    // Create new nodes.
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  2603
    loadConL_hiNode *m1 = new loadConL_hiNode();
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  2604
    loadConL_loNode *m2 = new loadConL_loNode();
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2605
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2606
    // inputs for new nodes
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2607
    m1->add_req(NULL, toc);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2608
    m2->add_req(NULL, m1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2609
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2610
    // operands for new nodes
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  2611
    m1->_opnds[0] = new iRegLdstOper(); // dst
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  2612
    m1->_opnds[1] = immSrc;             // src
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  2613
    m1->_opnds[2] = new iRegPdstOper(); // toc
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  2614
    m2->_opnds[0] = new iRegLdstOper(); // dst
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  2615
    m2->_opnds[1] = immSrc;             // src
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  2616
    m2->_opnds[2] = new iRegLdstOper(); // base
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2617
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2618
    // Initialize ins_attrib TOC fields.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2619
    m1->_const_toc_offset = -1;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2620
    m2->_const_toc_offset_hi_node = m1;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2621
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2622
    // Initialize ins_attrib instruction offset.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2623
    m1->_cbuf_insts_offset = -1;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2624
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2625
    // register allocation for new nodes
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2626
    ra_->set_pair(m1->_idx, reg_second, reg_first);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2627
    ra_->set_pair(m2->_idx, reg_second, reg_first);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2628
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2629
    // Create result.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2630
    nodes._large_hi = m1;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2631
    nodes._large_lo = m2;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2632
    nodes._small = NULL;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2633
    nodes._last = nodes._large_lo;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2634
    assert(m2->bottom_type()->isa_long(), "must be long");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2635
  } else {
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  2636
    loadConLNode *m2 = new loadConLNode();
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2637
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2638
    // inputs for new nodes
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2639
    m2->add_req(NULL, toc);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2640
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2641
    // operands for new nodes
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  2642
    m2->_opnds[0] = new iRegLdstOper(); // dst
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  2643
    m2->_opnds[1] = immSrc;             // src
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  2644
    m2->_opnds[2] = new iRegPdstOper(); // toc
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2645
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2646
    // Initialize ins_attrib instruction offset.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2647
    m2->_cbuf_insts_offset = -1;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2648
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2649
    // register allocation for new nodes
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2650
    ra_->set_pair(m2->_idx, reg_second, reg_first);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2651
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2652
    // Create result.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2653
    nodes._large_hi = NULL;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2654
    nodes._large_lo = NULL;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2655
    nodes._small = m2;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2656
    nodes._last = nodes._small;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2657
    assert(m2->bottom_type()->isa_long(), "must be long");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2658
  }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2659
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2660
  return nodes;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2661
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2662
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2663
%} // source
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2664
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2665
encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2666
  // Postalloc expand emitter for loading a long constant from the method's TOC.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2667
  // Enc_class needed as consttanttablebase is not supported by postalloc
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2668
  // expand.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2669
  enc_class postalloc_expand_load_long_constant(iRegLdst dst, immL src, iRegLdst toc) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2670
    // Create new nodes.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2671
    loadConLNodesTuple loadConLNodes =
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2672
      loadConLNodesTuple_create(C, ra_, n_toc, op_src,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2673
                                ra_->get_reg_second(this), ra_->get_reg_first(this));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2674
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2675
    // Push new nodes.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2676
    if (loadConLNodes._large_hi) nodes->push(loadConLNodes._large_hi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2677
    if (loadConLNodes._last)     nodes->push(loadConLNodes._last);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2678
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2679
    // some asserts
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2680
    assert(nodes->length() >= 1, "must have created at least 1 node");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2681
    assert(loadConLNodes._last->bottom_type()->isa_long(), "must be long");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2682
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2683
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2684
  enc_class enc_load_long_constP(iRegLdst dst, immP src, iRegLdst toc) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2685
    // TODO: PPC port $archOpcode(ppc64Opcode_ld);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2686
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2687
    MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2688
    int toc_offset = 0;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2689
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2690
    if (!ra_->C->in_scratch_emit_size()) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2691
      intptr_t val = $src$$constant;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2692
      relocInfo::relocType constant_reloc = $src->constant_reloc();  // src
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2693
      address const_toc_addr;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2694
      if (constant_reloc == relocInfo::oop_type) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2695
        // Create an oop constant and a corresponding relocation.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2696
        AddressLiteral a = __ allocate_oop_address((jobject)val);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2697
        const_toc_addr = __ address_constant((address)a.value(), RelocationHolder::none);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2698
        __ relocate(a.rspec());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2699
      } else if (constant_reloc == relocInfo::metadata_type) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2700
        AddressLiteral a = __ allocate_metadata_address((Metadata *)val);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2701
        const_toc_addr = __ address_constant((address)a.value(), RelocationHolder::none);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2702
        __ relocate(a.rspec());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2703
      } else {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2704
        // Create a non-oop constant, no relocation needed.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2705
        const_toc_addr = __ long_constant((jlong)$src$$constant);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2706
      }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2707
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2708
      // Get the constant's TOC offset.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2709
      toc_offset = __ offset_to_method_toc(const_toc_addr);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2710
    }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2711
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2712
    __ ld($dst$$Register, toc_offset, $toc$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2713
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2714
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2715
  enc_class enc_load_long_constP_hi(iRegLdst dst, immP src, iRegLdst toc) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2716
    // TODO: PPC port $archOpcode(ppc64Opcode_addis);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2717
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2718
    MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2719
    if (!ra_->C->in_scratch_emit_size()) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2720
      intptr_t val = $src$$constant;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2721
      relocInfo::relocType constant_reloc = $src->constant_reloc();  // src
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2722
      address const_toc_addr;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2723
      if (constant_reloc == relocInfo::oop_type) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2724
        // Create an oop constant and a corresponding relocation.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2725
        AddressLiteral a = __ allocate_oop_address((jobject)val);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2726
        const_toc_addr = __ address_constant((address)a.value(), RelocationHolder::none);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2727
        __ relocate(a.rspec());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2728
      } else if (constant_reloc == relocInfo::metadata_type) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2729
        AddressLiteral a = __ allocate_metadata_address((Metadata *)val);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2730
        const_toc_addr = __ address_constant((address)a.value(), RelocationHolder::none);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2731
        __ relocate(a.rspec());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2732
      } else {  // non-oop pointers, e.g. card mark base, heap top
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2733
        // Create a non-oop constant, no relocation needed.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2734
        const_toc_addr = __ long_constant((jlong)$src$$constant);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2735
      }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2736
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2737
      // Get the constant's TOC offset.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2738
      const int toc_offset = __ offset_to_method_toc(const_toc_addr);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2739
      // Store the toc offset of the constant.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2740
      ((loadConP_hiNode*)this)->_const_toc_offset = toc_offset;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2741
    }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2742
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2743
    __ addis($dst$$Register, $toc$$Register, MacroAssembler::largeoffset_si16_si16_hi(_const_toc_offset));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2744
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2745
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2746
  // Postalloc expand emitter for loading a ptr constant from the method's TOC.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2747
  // Enc_class needed as consttanttablebase is not supported by postalloc
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2748
  // expand.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2749
  enc_class postalloc_expand_load_ptr_constant(iRegPdst dst, immP src, iRegLdst toc) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2750
    const bool large_constant_pool = true; // TODO: PPC port C->cfg()->_consts_size > 4000;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2751
    if (large_constant_pool) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2752
      // Create new nodes.
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  2753
      loadConP_hiNode *m1 = new loadConP_hiNode();
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  2754
      loadConP_loNode *m2 = new loadConP_loNode();
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2755
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2756
      // inputs for new nodes
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2757
      m1->add_req(NULL, n_toc);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2758
      m2->add_req(NULL, m1);
24349
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  2759
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2760
      // operands for new nodes
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  2761
      m1->_opnds[0] = new iRegPdstOper(); // dst
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  2762
      m1->_opnds[1] = op_src;             // src
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  2763
      m1->_opnds[2] = new iRegPdstOper(); // toc
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  2764
      m2->_opnds[0] = new iRegPdstOper(); // dst
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  2765
      m2->_opnds[1] = op_src;             // src
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  2766
      m2->_opnds[2] = new iRegLdstOper(); // base
24349
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  2767
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2768
      // Initialize ins_attrib TOC fields.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2769
      m1->_const_toc_offset = -1;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2770
      m2->_const_toc_offset_hi_node = m1;
24349
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  2771
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2772
      // Register allocation for new nodes.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2773
      ra_->set_pair(m1->_idx, ra_->get_reg_second(this), ra_->get_reg_first(this));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2774
      ra_->set_pair(m2->_idx, ra_->get_reg_second(this), ra_->get_reg_first(this));
24349
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  2775
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2776
      nodes->push(m1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2777
      nodes->push(m2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2778
      assert(m2->bottom_type()->isa_ptr(), "must be ptr");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2779
    } else {
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  2780
      loadConPNode *m2 = new loadConPNode();
24349
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  2781
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2782
      // inputs for new nodes
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2783
      m2->add_req(NULL, n_toc);
24349
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  2784
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2785
      // operands for new nodes
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  2786
      m2->_opnds[0] = new iRegPdstOper(); // dst
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  2787
      m2->_opnds[1] = op_src;             // src
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  2788
      m2->_opnds[2] = new iRegPdstOper(); // toc
24349
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  2789
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2790
      // Register allocation for new nodes.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2791
      ra_->set_pair(m2->_idx, ra_->get_reg_second(this), ra_->get_reg_first(this));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2792
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2793
      nodes->push(m2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2794
      assert(m2->bottom_type()->isa_ptr(), "must be ptr");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2795
    }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2796
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2797
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2798
  // Enc_class needed as consttanttablebase is not supported by postalloc
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2799
  // expand.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2800
  enc_class postalloc_expand_load_float_constant(regF dst, immF src, iRegLdst toc) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2801
    bool large_constant_pool = true; // TODO: PPC port C->cfg()->_consts_size > 4000;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2802
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2803
    MachNode *m2;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2804
    if (large_constant_pool) {
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  2805
      m2 = new loadConFCompNode();
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2806
    } else {
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  2807
      m2 = new loadConFNode();
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2808
    }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2809
    // inputs for new nodes
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2810
    m2->add_req(NULL, n_toc);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2811
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2812
    // operands for new nodes
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2813
    m2->_opnds[0] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2814
    m2->_opnds[1] = op_src;
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  2815
    m2->_opnds[2] = new iRegPdstOper(); // constanttablebase
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2816
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2817
    // register allocation for new nodes
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2818
    ra_->set_pair(m2->_idx, ra_->get_reg_second(this), ra_->get_reg_first(this));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2819
    nodes->push(m2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2820
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2821
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2822
  // Enc_class needed as consttanttablebase is not supported by postalloc
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2823
  // expand.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2824
  enc_class postalloc_expand_load_double_constant(regD dst, immD src, iRegLdst toc) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2825
    bool large_constant_pool = true; // TODO: PPC port C->cfg()->_consts_size > 4000;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2826
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2827
    MachNode *m2;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2828
    if (large_constant_pool) {
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  2829
      m2 = new loadConDCompNode();
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2830
    } else {
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  2831
      m2 = new loadConDNode();
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2832
    }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2833
    // inputs for new nodes
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2834
    m2->add_req(NULL, n_toc);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2835
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2836
    // operands for new nodes
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2837
    m2->_opnds[0] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2838
    m2->_opnds[1] = op_src;
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  2839
    m2->_opnds[2] = new iRegPdstOper(); // constanttablebase
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2840
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2841
    // register allocation for new nodes
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2842
    ra_->set_pair(m2->_idx, ra_->get_reg_second(this), ra_->get_reg_first(this));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2843
    nodes->push(m2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2844
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2845
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2846
  enc_class enc_stw(iRegIsrc src, memory mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2847
    // TODO: PPC port $archOpcode(ppc64Opcode_stw);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2848
    MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2849
    int Idisp = $mem$$disp + frame_slots_bias($mem$$base, ra_);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2850
    __ stw($src$$Register, Idisp, $mem$$base$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2851
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2852
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2853
  enc_class enc_std(iRegIsrc src, memoryAlg4 mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2854
    // TODO: PPC port $archOpcode(ppc64Opcode_std);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2855
    MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2856
    int Idisp = $mem$$disp + frame_slots_bias($mem$$base, ra_);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2857
    // Operand 'ds' requires 4-alignment.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2858
    assert((Idisp & 0x3) == 0, "unaligned offset");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2859
    __ std($src$$Register, Idisp, $mem$$base$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2860
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2862
  enc_class enc_stfs(RegF src, memory mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2863
    // TODO: PPC port $archOpcode(ppc64Opcode_stfs);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2864
    MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2865
    int Idisp = $mem$$disp + frame_slots_bias($mem$$base, ra_);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2866
    __ stfs($src$$FloatRegister, Idisp, $mem$$base$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2867
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2868
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2869
  enc_class enc_stfd(RegF src, memory mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2870
    // TODO: PPC port $archOpcode(ppc64Opcode_stfd);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2871
    MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2872
    int Idisp = $mem$$disp + frame_slots_bias($mem$$base, ra_);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2873
    __ stfd($src$$FloatRegister, Idisp, $mem$$base$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2874
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2875
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2876
  // Use release_store for card-marking to ensure that previous
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2877
  // oop-stores are visible before the card-mark change.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2878
  enc_class enc_cms_card_mark(memory mem, iRegLdst releaseFieldAddr) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2879
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2880
    // FIXME: Implement this as a cmove and use a fixed condition code
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2881
    // register which is written on every transition to compiled code,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2882
    // e.g. in call-stub and when returning from runtime stubs.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2883
    //
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2884
    // Proposed code sequence for the cmove implementation:
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2885
    //
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2886
    // Label skip_release;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2887
    // __ beq(CCRfixed, skip_release);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2888
    // __ release();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2889
    // __ bind(skip_release);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2890
    // __ stb(card mark);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2891
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2892
    MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2893
    Label skip_storestore;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2894
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2895
#if 0 // TODO: PPC port
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2896
    // Check CMSCollectorCardTableModRefBSExt::_requires_release and do the
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2897
    // StoreStore barrier conditionally.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2898
    __ lwz(R0, 0, $releaseFieldAddr$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2899
    __ cmpwi(CCR0, R0, 0);
22867
309bcf262a19 8031319: PPC64: Some fixes in ppc and aix coding.
goetz
parents: 22865
diff changeset
  2900
    __ beq_predict_taken(CCR0, skip_storestore);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2901
#endif
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2902
    __ li(R0, 0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2903
    __ membar(Assembler::StoreStore);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2904
#if 0 // TODO: PPC port
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2905
    __ bind(skip_storestore);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2906
#endif
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2907
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2908
    // Do the store.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2909
    if ($mem$$index == 0) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2910
      __ stb(R0, $mem$$disp, $mem$$base$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2911
    } else {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2912
      assert(0 == $mem$$disp, "no displacement possible with indexed load/stores on ppc");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2913
      __ stbx(R0, $mem$$base$$Register, $mem$$index$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2914
    }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2915
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2916
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2917
  enc_class postalloc_expand_encode_oop(iRegNdst dst, iRegPdst src, flagsReg crx) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2918
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2919
    if (VM_Version::has_isel()) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2920
      // use isel instruction with Power 7
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  2921
      cmpP_reg_imm16Node *n_compare  = new cmpP_reg_imm16Node();
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  2922
      encodeP_subNode    *n_sub_base = new encodeP_subNode();
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  2923
      encodeP_shiftNode  *n_shift    = new encodeP_shiftNode();
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  2924
      cond_set_0_oopNode *n_cond_set = new cond_set_0_oopNode();
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2925
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2926
      n_compare->add_req(n_region, n_src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2927
      n_compare->_opnds[0] = op_crx;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2928
      n_compare->_opnds[1] = op_src;
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  2929
      n_compare->_opnds[2] = new immL16Oper(0);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2930
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2931
      n_sub_base->add_req(n_region, n_src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2932
      n_sub_base->_opnds[0] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2933
      n_sub_base->_opnds[1] = op_src;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2934
      n_sub_base->_bottom_type = _bottom_type;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2935
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2936
      n_shift->add_req(n_region, n_sub_base);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2937
      n_shift->_opnds[0] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2938
      n_shift->_opnds[1] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2939
      n_shift->_bottom_type = _bottom_type;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2940
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2941
      n_cond_set->add_req(n_region, n_compare, n_shift);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2942
      n_cond_set->_opnds[0] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2943
      n_cond_set->_opnds[1] = op_crx;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2944
      n_cond_set->_opnds[2] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2945
      n_cond_set->_bottom_type = _bottom_type;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2946
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2947
      ra_->set_pair(n_compare->_idx, ra_->get_reg_second(n_crx), ra_->get_reg_first(n_crx));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2948
      ra_->set_pair(n_sub_base->_idx, ra_->get_reg_second(this), ra_->get_reg_first(this));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2949
      ra_->set_pair(n_shift->_idx, ra_->get_reg_second(this), ra_->get_reg_first(this));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2950
      ra_->set_pair(n_cond_set->_idx, ra_->get_reg_second(this), ra_->get_reg_first(this));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2951
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2952
      nodes->push(n_compare);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2953
      nodes->push(n_sub_base);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2954
      nodes->push(n_shift);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2955
      nodes->push(n_cond_set);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2956
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2957
    } else {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2958
      // before Power 7
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  2959
      moveRegNode        *n_move     = new moveRegNode();
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  2960
      cmpP_reg_imm16Node *n_compare  = new cmpP_reg_imm16Node();
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  2961
      encodeP_shiftNode  *n_shift    = new encodeP_shiftNode();
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  2962
      cond_sub_baseNode  *n_sub_base = new cond_sub_baseNode();
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2963
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2964
      n_move->add_req(n_region, n_src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2965
      n_move->_opnds[0] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2966
      n_move->_opnds[1] = op_src;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2967
      ra_->set_oop(n_move, true); // Until here, 'n_move' still produces an oop.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2968
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2969
      n_compare->add_req(n_region, n_src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2970
      n_compare->add_prec(n_move);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2971
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2972
      n_compare->_opnds[0] = op_crx;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2973
      n_compare->_opnds[1] = op_src;
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  2974
      n_compare->_opnds[2] = new immL16Oper(0);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2975
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2976
      n_sub_base->add_req(n_region, n_compare, n_src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2977
      n_sub_base->_opnds[0] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2978
      n_sub_base->_opnds[1] = op_crx;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2979
      n_sub_base->_opnds[2] = op_src;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2980
      n_sub_base->_bottom_type = _bottom_type;
24349
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  2981
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2982
      n_shift->add_req(n_region, n_sub_base);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2983
      n_shift->_opnds[0] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2984
      n_shift->_opnds[1] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2985
      n_shift->_bottom_type = _bottom_type;
24349
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  2986
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2987
      ra_->set_pair(n_shift->_idx, ra_->get_reg_second(this), ra_->get_reg_first(this));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2988
      ra_->set_pair(n_compare->_idx, ra_->get_reg_second(n_crx), ra_->get_reg_first(n_crx));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2989
      ra_->set_pair(n_sub_base->_idx, ra_->get_reg_second(this), ra_->get_reg_first(this));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2990
      ra_->set_pair(n_move->_idx, ra_->get_reg_second(this), ra_->get_reg_first(this));
24349
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  2991
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2992
      nodes->push(n_move);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2993
      nodes->push(n_compare);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2994
      nodes->push(n_sub_base);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2995
      nodes->push(n_shift);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2996
    }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2997
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2998
    assert(!(ra_->is_oop(this)), "sanity"); // This is not supposed to be GC'ed.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2999
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3000
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3001
  enc_class postalloc_expand_encode_oop_not_null(iRegNdst dst, iRegPdst src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3002
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  3003
    encodeP_subNode *n1 = new encodeP_subNode();
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3004
    n1->add_req(n_region, n_src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3005
    n1->_opnds[0] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3006
    n1->_opnds[1] = op_src;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3007
    n1->_bottom_type = _bottom_type;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3008
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  3009
    encodeP_shiftNode *n2 = new encodeP_shiftNode();
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3010
    n2->add_req(n_region, n1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3011
    n2->_opnds[0] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3012
    n2->_opnds[1] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3013
    n2->_bottom_type = _bottom_type;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3014
    ra_->set_pair(n1->_idx, ra_->get_reg_second(this), ra_->get_reg_first(this));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3015
    ra_->set_pair(n2->_idx, ra_->get_reg_second(this), ra_->get_reg_first(this));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3016
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3017
    nodes->push(n1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3018
    nodes->push(n2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3019
    assert(!(ra_->is_oop(this)), "sanity"); // This is not supposed to be GC'ed.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3020
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3021
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3022
  enc_class postalloc_expand_decode_oop(iRegPdst dst, iRegNsrc src, flagsReg crx) %{
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  3023
    decodeN_shiftNode *n_shift    = new decodeN_shiftNode();
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  3024
    cmpN_reg_imm0Node *n_compare  = new cmpN_reg_imm0Node();
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3025
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3026
    n_compare->add_req(n_region, n_src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3027
    n_compare->_opnds[0] = op_crx;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3028
    n_compare->_opnds[1] = op_src;
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  3029
    n_compare->_opnds[2] = new immN_0Oper(TypeNarrowOop::NULL_PTR);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3030
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3031
    n_shift->add_req(n_region, n_src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3032
    n_shift->_opnds[0] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3033
    n_shift->_opnds[1] = op_src;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3034
    n_shift->_bottom_type = _bottom_type;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3035
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3036
    if (VM_Version::has_isel()) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3037
      // use isel instruction with Power 7
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3038
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  3039
      decodeN_addNode *n_add_base = new decodeN_addNode();
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3040
      n_add_base->add_req(n_region, n_shift);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3041
      n_add_base->_opnds[0] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3042
      n_add_base->_opnds[1] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3043
      n_add_base->_bottom_type = _bottom_type;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3044
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  3045
      cond_set_0_ptrNode *n_cond_set = new cond_set_0_ptrNode();
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3046
      n_cond_set->add_req(n_region, n_compare, n_add_base);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3047
      n_cond_set->_opnds[0] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3048
      n_cond_set->_opnds[1] = op_crx;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3049
      n_cond_set->_opnds[2] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3050
      n_cond_set->_bottom_type = _bottom_type;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3051
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3052
      assert(ra_->is_oop(this) == true, "A decodeN node must produce an oop!");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3053
      ra_->set_oop(n_cond_set, true);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3054
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3055
      ra_->set_pair(n_shift->_idx, ra_->get_reg_second(this), ra_->get_reg_first(this));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3056
      ra_->set_pair(n_compare->_idx, ra_->get_reg_second(n_crx), ra_->get_reg_first(n_crx));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3057
      ra_->set_pair(n_add_base->_idx, ra_->get_reg_second(this), ra_->get_reg_first(this));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3058
      ra_->set_pair(n_cond_set->_idx, ra_->get_reg_second(this), ra_->get_reg_first(this));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3059
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3060
      nodes->push(n_compare);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3061
      nodes->push(n_shift);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3062
      nodes->push(n_add_base);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3063
      nodes->push(n_cond_set);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3064
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3065
    } else {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3066
      // before Power 7
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  3067
      cond_add_baseNode *n_add_base = new cond_add_baseNode();
24349
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  3068
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3069
      n_add_base->add_req(n_region, n_compare, n_shift);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3070
      n_add_base->_opnds[0] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3071
      n_add_base->_opnds[1] = op_crx;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3072
      n_add_base->_opnds[2] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3073
      n_add_base->_bottom_type = _bottom_type;
24349
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  3074
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3075
      assert(ra_->is_oop(this) == true, "A decodeN node must produce an oop!");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3076
      ra_->set_oop(n_add_base, true);
24349
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  3077
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3078
      ra_->set_pair(n_shift->_idx, ra_->get_reg_second(this), ra_->get_reg_first(this));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3079
      ra_->set_pair(n_compare->_idx, ra_->get_reg_second(n_crx), ra_->get_reg_first(n_crx));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3080
      ra_->set_pair(n_add_base->_idx, ra_->get_reg_second(this), ra_->get_reg_first(this));
24349
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  3081
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3082
      nodes->push(n_compare);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3083
      nodes->push(n_shift);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3084
      nodes->push(n_add_base);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3085
    }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3086
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3087
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3088
  enc_class postalloc_expand_decode_oop_not_null(iRegPdst dst, iRegNsrc src) %{
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  3089
    decodeN_shiftNode *n1 = new decodeN_shiftNode();
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3090
    n1->add_req(n_region, n_src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3091
    n1->_opnds[0] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3092
    n1->_opnds[1] = op_src;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3093
    n1->_bottom_type = _bottom_type;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3094
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  3095
    decodeN_addNode *n2 = new decodeN_addNode();
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3096
    n2->add_req(n_region, n1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3097
    n2->_opnds[0] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3098
    n2->_opnds[1] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3099
    n2->_bottom_type = _bottom_type;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3100
    ra_->set_pair(n1->_idx, ra_->get_reg_second(this), ra_->get_reg_first(this));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3101
    ra_->set_pair(n2->_idx, ra_->get_reg_second(this), ra_->get_reg_first(this));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3102
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3103
    assert(ra_->is_oop(this) == true, "A decodeN node must produce an oop!");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3104
    ra_->set_oop(n2, true);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3105
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3106
    nodes->push(n1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3107
    nodes->push(n2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3108
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3109
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3110
  enc_class enc_cmove_reg(iRegIdst dst, flagsReg crx, iRegIsrc src, cmpOp cmp) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3111
    // TODO: PPC port $archOpcode(ppc64Opcode_cmove);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3112
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3113
    MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3114
    int cc        = $cmp$$cmpcode;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3115
    int flags_reg = $crx$$reg;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3116
    Label done;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3117
    assert((Assembler::bcondCRbiIs1 & ~Assembler::bcondCRbiIs0) == 8, "check encoding");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3118
    // Branch if not (cmp crx).
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3119
    __ bc(cc_to_inverse_boint(cc), cc_to_biint(cc, flags_reg), done);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3120
    __ mr($dst$$Register, $src$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3121
    // TODO PPC port __ endgroup_if_needed(_size == 12);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3122
    __ bind(done);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3123
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3124
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3125
  enc_class enc_cmove_imm(iRegIdst dst, flagsReg crx, immI16 src, cmpOp cmp) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3126
    // TODO: PPC port $archOpcode(ppc64Opcode_cmove);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3127
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3128
    MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3129
    Label done;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3130
    assert((Assembler::bcondCRbiIs1 & ~Assembler::bcondCRbiIs0) == 8, "check encoding");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3131
    // Branch if not (cmp crx).
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3132
    __ bc(cc_to_inverse_boint($cmp$$cmpcode), cc_to_biint($cmp$$cmpcode, $crx$$reg), done);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3133
    __ li($dst$$Register, $src$$constant);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3134
    // TODO PPC port __ endgroup_if_needed(_size == 12);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3135
    __ bind(done);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3136
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3137
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3138
  // New atomics.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3139
  enc_class enc_GetAndAddI(iRegIdst res, iRegPdst mem_ptr, iRegIsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3140
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3141
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3142
    MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3143
    Register Rtmp   = R0;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3144
    Register Rres   = $res$$Register;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3145
    Register Rsrc   = $src$$Register;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3146
    Register Rptr   = $mem_ptr$$Register;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3147
    bool RegCollision = (Rres == Rsrc) || (Rres == Rptr);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3148
    Register Rold   = RegCollision ? Rtmp : Rres;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3149
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3150
    Label Lretry;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3151
    __ bind(Lretry);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3152
    __ lwarx(Rold, Rptr, MacroAssembler::cmpxchgx_hint_atomic_update());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3153
    __ add(Rtmp, Rsrc, Rold);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3154
    __ stwcx_(Rtmp, Rptr);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3155
    if (UseStaticBranchPredictionInCompareAndSwapPPC64) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3156
      __ bne_predict_not_taken(CCR0, Lretry);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3157
    } else {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3158
      __ bne(                  CCR0, Lretry);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3159
    }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3160
    if (RegCollision) __ subf(Rres, Rsrc, Rtmp);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3161
    __ fence();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3162
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3163
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3164
  enc_class enc_GetAndAddL(iRegLdst res, iRegPdst mem_ptr, iRegLsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3165
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3166
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3167
    MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3168
    Register Rtmp   = R0;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3169
    Register Rres   = $res$$Register;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3170
    Register Rsrc   = $src$$Register;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3171
    Register Rptr   = $mem_ptr$$Register;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3172
    bool RegCollision = (Rres == Rsrc) || (Rres == Rptr);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3173
    Register Rold   = RegCollision ? Rtmp : Rres;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3174
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3175
    Label Lretry;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3176
    __ bind(Lretry);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3177
    __ ldarx(Rold, Rptr, MacroAssembler::cmpxchgx_hint_atomic_update());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3178
    __ add(Rtmp, Rsrc, Rold);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3179
    __ stdcx_(Rtmp, Rptr);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3180
    if (UseStaticBranchPredictionInCompareAndSwapPPC64) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3181
      __ bne_predict_not_taken(CCR0, Lretry);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3182
    } else {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3183
      __ bne(                  CCR0, Lretry);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3184
    }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3185
    if (RegCollision) __ subf(Rres, Rsrc, Rtmp);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3186
    __ fence();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3187
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3188
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3189
  enc_class enc_GetAndSetI(iRegIdst res, iRegPdst mem_ptr, iRegIsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3190
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3191
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3192
    MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3193
    Register Rtmp   = R0;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3194
    Register Rres   = $res$$Register;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3195
    Register Rsrc   = $src$$Register;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3196
    Register Rptr   = $mem_ptr$$Register;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3197
    bool RegCollision = (Rres == Rsrc) || (Rres == Rptr);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3198
    Register Rold   = RegCollision ? Rtmp : Rres;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3199
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3200
    Label Lretry;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3201
    __ bind(Lretry);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3202
    __ lwarx(Rold, Rptr, MacroAssembler::cmpxchgx_hint_atomic_update());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3203
    __ stwcx_(Rsrc, Rptr);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3204
    if (UseStaticBranchPredictionInCompareAndSwapPPC64) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3205
      __ bne_predict_not_taken(CCR0, Lretry);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3206
    } else {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3207
      __ bne(                  CCR0, Lretry);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3208
    }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3209
    if (RegCollision) __ mr(Rres, Rtmp);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3210
    __ fence();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3211
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3212
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3213
  enc_class enc_GetAndSetL(iRegLdst res, iRegPdst mem_ptr, iRegLsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3214
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3215
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3216
    MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3217
    Register Rtmp   = R0;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3218
    Register Rres   = $res$$Register;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3219
    Register Rsrc   = $src$$Register;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3220
    Register Rptr   = $mem_ptr$$Register;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3221
    bool RegCollision = (Rres == Rsrc) || (Rres == Rptr);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3222
    Register Rold   = RegCollision ? Rtmp : Rres;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3223
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3224
    Label Lretry;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3225
    __ bind(Lretry);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3226
    __ ldarx(Rold, Rptr, MacroAssembler::cmpxchgx_hint_atomic_update());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3227
    __ stdcx_(Rsrc, Rptr);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3228
    if (UseStaticBranchPredictionInCompareAndSwapPPC64) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3229
      __ bne_predict_not_taken(CCR0, Lretry);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3230
    } else {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3231
      __ bne(                  CCR0, Lretry);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3232
    }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3233
    if (RegCollision) __ mr(Rres, Rtmp);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3234
    __ fence();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3235
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3236
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3237
  // This enc_class is needed so that scheduler gets proper
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3238
  // input mapping for latency computation.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3239
  enc_class enc_andc(iRegIdst dst, iRegIsrc src1, iRegIsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3240
    // TODO: PPC port $archOpcode(ppc64Opcode_andc);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3241
    MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3242
    __ andc($dst$$Register, $src1$$Register, $src2$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3243
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3244
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3245
  enc_class enc_convI2B_regI__cmove(iRegIdst dst, iRegIsrc src, flagsReg crx, immI16 zero, immI16 notzero) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3246
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3247
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3248
    MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3249
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3250
    Label done;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3251
    __ cmpwi($crx$$CondRegister, $src$$Register, 0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3252
    __ li($dst$$Register, $zero$$constant);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3253
    __ beq($crx$$CondRegister, done);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3254
    __ li($dst$$Register, $notzero$$constant);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3255
    __ bind(done);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3256
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3257
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3258
  enc_class enc_convP2B_regP__cmove(iRegIdst dst, iRegPsrc src, flagsReg crx, immI16 zero, immI16 notzero) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3259
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3260
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3261
    MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3262
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3263
    Label done;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3264
    __ cmpdi($crx$$CondRegister, $src$$Register, 0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3265
    __ li($dst$$Register, $zero$$constant);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3266
    __ beq($crx$$CondRegister, done);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3267
    __ li($dst$$Register, $notzero$$constant);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3268
    __ bind(done);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3269
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3270
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3271
  enc_class enc_cmove_bso_stackSlotL(iRegLdst dst, flagsReg crx, stackSlotL mem ) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3272
    // TODO: PPC port $archOpcode(ppc64Opcode_cmove);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3273
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3274
    MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3275
    int Idisp = $mem$$disp + frame_slots_bias($mem$$base, ra_);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3276
    Label done;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3277
    __ bso($crx$$CondRegister, done);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3278
    __ ld($dst$$Register, Idisp, $mem$$base$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3279
    // TODO PPC port __ endgroup_if_needed(_size == 12);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3280
    __ bind(done);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3281
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3282
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3283
  enc_class enc_bc(flagsReg crx, cmpOp cmp, Label lbl) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3284
    // TODO: PPC port $archOpcode(ppc64Opcode_bc);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3285
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3286
    MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3287
    Label d;   // dummy
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3288
    __ bind(d);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3289
    Label* p = ($lbl$$label);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3290
    // `p' is `NULL' when this encoding class is used only to
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3291
    // determine the size of the encoded instruction.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3292
    Label& l = (NULL == p)? d : *(p);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3293
    int cc = $cmp$$cmpcode;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3294
    int flags_reg = $crx$$reg;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3295
    assert((Assembler::bcondCRbiIs1 & ~Assembler::bcondCRbiIs0) == 8, "check encoding");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3296
    int bhint = Assembler::bhintNoHint;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3297
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3298
    if (UseStaticBranchPredictionForUncommonPathsPPC64) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3299
      if (_prob <= PROB_NEVER) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3300
        bhint = Assembler::bhintIsNotTaken;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3301
      } else if (_prob >= PROB_ALWAYS) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3302
        bhint = Assembler::bhintIsTaken;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3303
      }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3304
    }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3305
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3306
    __ bc(Assembler::add_bhint_to_boint(bhint, cc_to_boint(cc)),
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3307
          cc_to_biint(cc, flags_reg),
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3308
          l);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3309
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3310
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3311
  enc_class enc_bc_far(flagsReg crx, cmpOp cmp, Label lbl) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3312
    // The scheduler doesn't know about branch shortening, so we set the opcode
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3313
    // to ppc64Opcode_bc in order to hide this detail from the scheduler.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3314
    // TODO: PPC port $archOpcode(ppc64Opcode_bc);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3315
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3316
    MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3317
    Label d;    // dummy
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3318
    __ bind(d);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3319
    Label* p = ($lbl$$label);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3320
    // `p' is `NULL' when this encoding class is used only to
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3321
    // determine the size of the encoded instruction.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3322
    Label& l = (NULL == p)? d : *(p);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3323
    int cc = $cmp$$cmpcode;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3324
    int flags_reg = $crx$$reg;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3325
    int bhint = Assembler::bhintNoHint;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3326
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3327
    if (UseStaticBranchPredictionForUncommonPathsPPC64) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3328
      if (_prob <= PROB_NEVER) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3329
        bhint = Assembler::bhintIsNotTaken;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3330
      } else if (_prob >= PROB_ALWAYS) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3331
        bhint = Assembler::bhintIsTaken;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3332
      }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3333
    }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3334
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3335
    // Tell the conditional far branch to optimize itself when being relocated.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3336
    __ bc_far(Assembler::add_bhint_to_boint(bhint, cc_to_boint(cc)),
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3337
                  cc_to_biint(cc, flags_reg),
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3338
                  l,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3339
                  MacroAssembler::bc_far_optimize_on_relocate);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3340
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3341
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3342
  // Branch used with Power6 scheduling (can be shortened without changing the node).
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3343
  enc_class enc_bc_short_far(flagsReg crx, cmpOp cmp, Label lbl) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3344
    // The scheduler doesn't know about branch shortening, so we set the opcode
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3345
    // to ppc64Opcode_bc in order to hide this detail from the scheduler.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3346
    // TODO: PPC port $archOpcode(ppc64Opcode_bc);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3347
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3348
    MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3349
    Label d;   // dummy
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3350
    __ bind(d);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3351
    Label* p = ($lbl$$label);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3352
    // `p' is `NULL' when this encoding class is used only to
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3353
    // determine the size of the encoded instruction.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3354
    Label& l = (NULL == p)? d : *(p);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3355
    int cc = $cmp$$cmpcode;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3356
    int flags_reg = $crx$$reg;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3357
    int bhint = Assembler::bhintNoHint;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3358
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3359
    if (UseStaticBranchPredictionForUncommonPathsPPC64) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3360
      if (_prob <= PROB_NEVER) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3361
        bhint = Assembler::bhintIsNotTaken;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3362
      } else if (_prob >= PROB_ALWAYS) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3363
        bhint = Assembler::bhintIsTaken;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3364
      }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3365
    }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3366
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3367
#if 0 // TODO: PPC port
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3368
    if (_size == 8) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3369
      // Tell the conditional far branch to optimize itself when being relocated.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3370
      __ bc_far(Assembler::add_bhint_to_boint(bhint, cc_to_boint(cc)),
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3371
                    cc_to_biint(cc, flags_reg),
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3372
                    l,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3373
                    MacroAssembler::bc_far_optimize_on_relocate);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3374
    } else {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3375
      __ bc    (Assembler::add_bhint_to_boint(bhint, cc_to_boint(cc)),
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3376
                    cc_to_biint(cc, flags_reg),
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3377
                    l);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3378
    }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3379
#endif
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3380
    Unimplemented();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3381
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3382
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3383
  // Postalloc expand emitter for loading a replicatef float constant from
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3384
  // the method's TOC.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3385
  // Enc_class needed as consttanttablebase is not supported by postalloc
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3386
  // expand.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3387
  enc_class postalloc_expand_load_replF_constant(iRegLdst dst, immF src, iRegLdst toc) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3388
    // Create new nodes.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3389
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3390
    // Make an operand with the bit pattern to load as float.
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  3391
    immLOper *op_repl = new immLOper((jlong)replicate_immF(op_src->constantF()));
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3392
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3393
    loadConLNodesTuple loadConLNodes =
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3394
      loadConLNodesTuple_create(C, ra_, n_toc, op_repl,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3395
                                ra_->get_reg_second(this), ra_->get_reg_first(this));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3396
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3397
    // Push new nodes.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3398
    if (loadConLNodes._large_hi) nodes->push(loadConLNodes._large_hi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3399
    if (loadConLNodes._last)     nodes->push(loadConLNodes._last);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3400
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3401
    assert(nodes->length() >= 1, "must have created at least 1 node");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3402
    assert(loadConLNodes._last->bottom_type()->isa_long(), "must be long");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3403
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3404
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3405
  // This enc_class is needed so that scheduler gets proper
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3406
  // input mapping for latency computation.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3407
  enc_class enc_poll(immI dst, iRegLdst poll) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3408
    // TODO: PPC port $archOpcode(ppc64Opcode_ld);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3409
    // Fake operand dst needed for PPC scheduler.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3410
    assert($dst$$constant == 0x0, "dst must be 0x0");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3411
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3412
    MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3413
    // Mark the code position where the load from the safepoint
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3414
    // polling page was emitted as relocInfo::poll_type.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3415
    __ relocate(relocInfo::poll_type);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3416
    __ load_from_polling_page($poll$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3417
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3418
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3419
  // A Java static call or a runtime call.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3420
  //
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3421
  // Branch-and-link relative to a trampoline.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3422
  // The trampoline loads the target address and does a long branch to there.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3423
  // In case we call java, the trampoline branches to a interpreter_stub
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3424
  // which loads the inline cache and the real call target from the constant pool.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3425
  //
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3426
  // This basically looks like this:
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3427
  //
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3428
  // >>>> consts      -+  -+
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3429
  //                   |   |- offset1
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3430
  // [call target1]    | <-+
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3431
  // [IC cache]        |- offset2
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3432
  // [call target2] <--+
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3433
  //
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3434
  // <<<< consts
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3435
  // >>>> insts
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3436
  //
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3437
  // bl offset16               -+  -+             ??? // How many bits available?
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3438
  //                            |   |
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3439
  // <<<< insts                 |   |
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3440
  // >>>> stubs                 |   |
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3441
  //                            |   |- trampoline_stub_Reloc
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3442
  // trampoline stub:           | <-+
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3443
  //   r2 = toc                 |
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3444
  //   r2 = [r2 + offset1]      |       // Load call target1 from const section
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3445
  //   mtctr r2                 |
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3446
  //   bctr                     |- static_stub_Reloc
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3447
  // comp_to_interp_stub:   <---+
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3448
  //   r1 = toc
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3449
  //   ICreg = [r1 + IC_offset]         // Load IC from const section
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3450
  //   r1    = [r1 + offset2]           // Load call target2 from const section
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3451
  //   mtctr r1
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3452
  //   bctr
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3453
  //
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3454
  // <<<< stubs
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3455
  //
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3456
  // The call instruction in the code either
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3457
  // - Branches directly to a compiled method if the offset is encodable in instruction.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3458
  // - Branches to the trampoline stub if the offset to the compiled method is not encodable.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3459
  // - Branches to the compiled_to_interp stub if the target is interpreted.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3460
  //
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3461
  // Further there are three relocations from the loads to the constants in
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3462
  // the constant section.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3463
  //
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3464
  // Usage of r1 and r2 in the stubs allows to distinguish them.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3465
  enc_class enc_java_static_call(method meth) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3466
    // TODO: PPC port $archOpcode(ppc64Opcode_bl);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3467
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3468
    MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3469
    address entry_point = (address)$meth$$method;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3470
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3471
    if (!_method) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3472
      // A call to a runtime wrapper, e.g. new, new_typeArray_Java, uncommon_trap.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3473
      emit_call_with_trampoline_stub(_masm, entry_point, relocInfo::runtime_call_type);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3474
    } else {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3475
      // Remember the offset not the address.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3476
      const int start_offset = __ offset();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3477
      // The trampoline stub.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3478
      if (!Compile::current()->in_scratch_emit_size()) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3479
        // No entry point given, use the current pc.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3480
        // Make sure branch fits into
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3481
        if (entry_point == 0) entry_point = __ pc();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3482
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3483
        // Put the entry point as a constant into the constant pool.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3484
        const address entry_point_toc_addr   = __ address_constant(entry_point, RelocationHolder::none);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3485
        const int     entry_point_toc_offset = __ offset_to_method_toc(entry_point_toc_addr);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3486
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3487
        // Emit the trampoline stub which will be related to the branch-and-link below.
23498
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  3488
        CallStubImpl::emit_trampoline_stub(_masm, entry_point_toc_offset, start_offset);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3489
        __ relocate(_optimized_virtual ?
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3490
                    relocInfo::opt_virtual_call_type : relocInfo::static_call_type);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3491
      }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3492
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3493
      // The real call.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3494
      // Note: At this point we do not have the address of the trampoline
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3495
      // stub, and the entry point might be too far away for bl, so __ pc()
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3496
      // serves as dummy and the bl will be patched later.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3497
      cbuf.set_insts_mark();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3498
      __ bl(__ pc());  // Emits a relocation.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3499
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3500
      // The stub for call to interpreter.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3501
      CompiledStaticCall::emit_to_interp_stub(cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3502
    }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3503
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3504
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3505
  // Emit a method handle call.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3506
  //
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3507
  // Method handle calls from compiled to compiled are going thru a
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3508
  // c2i -> i2c adapter, extending the frame for their arguments. The
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3509
  // caller however, returns directly to the compiled callee, that has
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3510
  // to cope with the extended frame. We restore the original frame by
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3511
  // loading the callers sp and adding the calculated framesize.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3512
  enc_class enc_java_handle_call(method meth) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3513
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3514
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3515
    MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3516
    address entry_point = (address)$meth$$method;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3517
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3518
    // Remember the offset not the address.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3519
    const int start_offset = __ offset();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3520
    // The trampoline stub.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3521
    if (!ra_->C->in_scratch_emit_size()) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3522
      // No entry point given, use the current pc.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3523
      // Make sure branch fits into
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3524
      if (entry_point == 0) entry_point = __ pc();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3525
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3526
      // Put the entry point as a constant into the constant pool.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3527
      const address entry_point_toc_addr   = __ address_constant(entry_point, RelocationHolder::none);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3528
      const int     entry_point_toc_offset = __ offset_to_method_toc(entry_point_toc_addr);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3529
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3530
      // Emit the trampoline stub which will be related to the branch-and-link below.
23498
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  3531
      CallStubImpl::emit_trampoline_stub(_masm, entry_point_toc_offset, start_offset);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3532
      assert(_optimized_virtual, "methodHandle call should be a virtual call");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3533
      __ relocate(relocInfo::opt_virtual_call_type);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3534
    }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3535
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3536
    // The real call.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3537
    // Note: At this point we do not have the address of the trampoline
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3538
    // stub, and the entry point might be too far away for bl, so __ pc()
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3539
    // serves as dummy and the bl will be patched later.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3540
    cbuf.set_insts_mark();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3541
    __ bl(__ pc());  // Emits a relocation.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3542
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3543
    assert(_method, "execute next statement conditionally");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3544
    // The stub for call to interpreter.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3545
    CompiledStaticCall::emit_to_interp_stub(cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3546
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3547
    // Restore original sp.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3548
    __ ld(R11_scratch1, 0, R1_SP); // Load caller sp.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3549
    const long framesize = ra_->C->frame_slots() << LogBytesPerInt;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3550
    unsigned int bytes = (unsigned int)framesize;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3551
    long offset = Assembler::align_addr(bytes, frame::alignment_in_bytes);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3552
    if (Assembler::is_simm(-offset, 16)) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3553
      __ addi(R1_SP, R11_scratch1, -offset);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3554
    } else {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3555
      __ load_const_optimized(R12_scratch2, -offset);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3556
      __ add(R1_SP, R11_scratch1, R12_scratch2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3557
    }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3558
#ifdef ASSERT
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3559
  __ ld(R12_scratch2, 0, R1_SP); // Load from unextended_sp.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3560
  __ cmpd(CCR0, R11_scratch1, R12_scratch2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3561
  __ asm_assert_eq("backlink changed", 0x8000);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3562
#endif
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3563
    // If fails should store backlink before unextending.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3564
22867
309bcf262a19 8031319: PPC64: Some fixes in ppc and aix coding.
goetz
parents: 22865
diff changeset
  3565
    if (ra_->C->env()->failing()) {
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3566
      return;
22867
309bcf262a19 8031319: PPC64: Some fixes in ppc and aix coding.
goetz
parents: 22865
diff changeset
  3567
    }
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3568
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3569
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3570
  // Second node of expanded dynamic call - the call.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3571
  enc_class enc_java_dynamic_call_sched(method meth) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3572
    // TODO: PPC port $archOpcode(ppc64Opcode_bl);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3573
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3574
    MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3575
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3576
    if (!ra_->C->in_scratch_emit_size()) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3577
      // Create a call trampoline stub for the given method.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3578
      const address entry_point = !($meth$$method) ? 0 : (address)$meth$$method;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3579
      const address entry_point_const = __ address_constant(entry_point, RelocationHolder::none);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3580
      const int entry_point_const_toc_offset = __ offset_to_method_toc(entry_point_const);
23498
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  3581
      CallStubImpl::emit_trampoline_stub(_masm, entry_point_const_toc_offset, __ offset());
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3582
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3583
      if (ra_->C->env()->failing())
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3584
        return;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3585
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3586
      // Build relocation at call site with ic position as data.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3587
      assert((_load_ic_hi_node != NULL && _load_ic_node == NULL) ||
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3588
             (_load_ic_hi_node == NULL && _load_ic_node != NULL),
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3589
             "must have one, but can't have both");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3590
      assert((_load_ic_hi_node != NULL && _load_ic_hi_node->_cbuf_insts_offset != -1) ||
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3591
             (_load_ic_node != NULL    && _load_ic_node->_cbuf_insts_offset != -1),
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3592
             "must contain instruction offset");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3593
      const int virtual_call_oop_addr_offset = _load_ic_hi_node != NULL
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3594
        ? _load_ic_hi_node->_cbuf_insts_offset
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3595
        : _load_ic_node->_cbuf_insts_offset;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3596
      const address virtual_call_oop_addr = __ addr_at(virtual_call_oop_addr_offset);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3597
      assert(MacroAssembler::is_load_const_from_method_toc_at(virtual_call_oop_addr),
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3598
             "should be load from TOC");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3599
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3600
      __ relocate(virtual_call_Relocation::spec(virtual_call_oop_addr));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3601
    }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3602
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3603
    // At this point I do not have the address of the trampoline stub,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3604
    // and the entry point might be too far away for bl. Pc() serves
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3605
    // as dummy and bl will be patched later.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3606
    __ bl((address) __ pc());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3607
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3608
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3609
  // postalloc expand emitter for virtual calls.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3610
  enc_class postalloc_expand_java_dynamic_call_sched(method meth, iRegLdst toc) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3611
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3612
    // Create the nodes for loading the IC from the TOC.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3613
    loadConLNodesTuple loadConLNodes_IC =
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  3614
      loadConLNodesTuple_create(C, ra_, n_toc, new immLOper((jlong)Universe::non_oop_word()),
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3615
                                OptoReg::Name(R19_H_num), OptoReg::Name(R19_num));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3616
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3617
    // Create the call node.
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  3618
    CallDynamicJavaDirectSchedNode *call = new CallDynamicJavaDirectSchedNode();
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3619
    call->_method_handle_invoke = _method_handle_invoke;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3620
    call->_vtable_index      = _vtable_index;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3621
    call->_method            = _method;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3622
    call->_bci               = _bci;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3623
    call->_optimized_virtual = _optimized_virtual;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3624
    call->_tf                = _tf;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3625
    call->_entry_point       = _entry_point;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3626
    call->_cnt               = _cnt;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3627
    call->_argsize           = _argsize;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3628
    call->_oop_map           = _oop_map;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3629
    call->_jvms              = _jvms;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3630
    call->_jvmadj            = _jvmadj;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3631
    call->_in_rms            = _in_rms;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3632
    call->_nesting           = _nesting;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3633
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3634
    // New call needs all inputs of old call.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3635
    // Req...
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3636
    for (uint i = 0; i < req(); ++i) {
22865
3b8857d7b3cc 8030863: PPC64: (part 220): ConstantTableBase for calls between args and jvms
goetz
parents: 22861
diff changeset
  3637
      // The expanded node does not need toc any more.
24349
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  3638
      // Add the inline cache constant here instead. This expresses the
22865
3b8857d7b3cc 8030863: PPC64: (part 220): ConstantTableBase for calls between args and jvms
goetz
parents: 22861
diff changeset
  3639
      // register of the inline cache must be live at the call.
3b8857d7b3cc 8030863: PPC64: (part 220): ConstantTableBase for calls between args and jvms
goetz
parents: 22861
diff changeset
  3640
      // Else we would have to adapt JVMState by -1.
3b8857d7b3cc 8030863: PPC64: (part 220): ConstantTableBase for calls between args and jvms
goetz
parents: 22861
diff changeset
  3641
      if (i == mach_constant_base_node_input()) {
24349
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  3642
        call->add_req(loadConLNodes_IC._last);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3643
      } else {
22865
3b8857d7b3cc 8030863: PPC64: (part 220): ConstantTableBase for calls between args and jvms
goetz
parents: 22861
diff changeset
  3644
        call->add_req(in(i));
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3645
      }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3646
    }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3647
    // ...as well as prec
22865
3b8857d7b3cc 8030863: PPC64: (part 220): ConstantTableBase for calls between args and jvms
goetz
parents: 22861
diff changeset
  3648
    for (uint i = req(); i < len(); ++i) {
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3649
      call->add_prec(in(i));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3650
    }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3651
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3652
    // Remember nodes loading the inline cache into r19.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3653
    call->_load_ic_hi_node = loadConLNodes_IC._large_hi;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3654
    call->_load_ic_node    = loadConLNodes_IC._small;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3655
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3656
    // Operands for new nodes.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3657
    call->_opnds[0] = _opnds[0];
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3658
    call->_opnds[1] = _opnds[1];
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3659
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3660
    // Only the inline cache is associated with a register.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3661
    assert(Matcher::inline_cache_reg() == OptoReg::Name(R19_num), "ic reg should be R19");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3662
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3663
    // Push new nodes.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3664
    if (loadConLNodes_IC._large_hi) nodes->push(loadConLNodes_IC._large_hi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3665
    if (loadConLNodes_IC._last)     nodes->push(loadConLNodes_IC._last);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3666
    nodes->push(call);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3667
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3668
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3669
  // Compound version of call dynamic
24349
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  3670
  // Toc is only passed so that it can be used in ins_encode statement.
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  3671
  // In the code we have to use $constanttablebase.
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3672
  enc_class enc_java_dynamic_call(method meth, iRegLdst toc) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3673
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3674
    MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3675
    int start_offset = __ offset();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3676
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3677
    Register Rtoc = (ra_) ? $constanttablebase : R2_TOC;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3678
#if 0
24349
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  3679
    int vtable_index = this->_vtable_index;
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3680
    if (_vtable_index < 0) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3681
      // Must be invalid_vtable_index, not nonvirtual_vtable_index.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3682
      assert(_vtable_index == Method::invalid_vtable_index, "correct sentinel value");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3683
      Register ic_reg = as_Register(Matcher::inline_cache_reg_encode());
24349
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  3684
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  3685
      // Virtual call relocation will point to ic load.
22865
3b8857d7b3cc 8030863: PPC64: (part 220): ConstantTableBase for calls between args and jvms
goetz
parents: 22861
diff changeset
  3686
      address virtual_call_meta_addr = __ pc();
24349
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  3687
      // Load a clear inline cache.
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  3688
      AddressLiteral empty_ic((address) Universe::non_oop_word());
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  3689
      __ load_const_from_method_toc(ic_reg, empty_ic, Rtoc);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3690
      // CALL to fixup routine.  Fixup routine uses ScopeDesc info
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3691
      // to determine who we intended to call.
22865
3b8857d7b3cc 8030863: PPC64: (part 220): ConstantTableBase for calls between args and jvms
goetz
parents: 22861
diff changeset
  3692
      __ relocate(virtual_call_Relocation::spec(virtual_call_meta_addr));
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3693
      emit_call_with_trampoline_stub(_masm, (address)$meth$$method, relocInfo::none);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3694
      assert(((MachCallDynamicJavaNode*)this)->ret_addr_offset() == __ offset() - start_offset,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3695
             "Fix constant in ret_addr_offset()");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3696
    } else {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3697
      assert(!UseInlineCaches, "expect vtable calls only if not using ICs");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3698
      // Go thru the vtable. Get receiver klass. Receiver already
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3699
      // checked for non-null. If we'll go thru a C2I adapter, the
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3700
      // interpreter expects method in R19_method.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3701
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3702
      __ load_klass(R11_scratch1, R3);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3703
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3704
      int entry_offset = InstanceKlass::vtable_start_offset() + _vtable_index * vtableEntry::size();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3705
      int v_off = entry_offset * wordSize + vtableEntry::method_offset_in_bytes();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3706
      __ li(R19_method, v_off);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3707
      __ ldx(R19_method/*method oop*/, R19_method/*method offset*/, R11_scratch1/*class*/);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3708
      // NOTE: for vtable dispatches, the vtable entry will never be
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3709
      // null. However it may very well end up in handle_wrong_method
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3710
      // if the method is abstract for the particular class.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3711
      __ ld(R11_scratch1, in_bytes(Method::from_compiled_offset()), R19_method);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3712
      // Call target. Either compiled code or C2I adapter.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3713
      __ mtctr(R11_scratch1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3714
      __ bctrl();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3715
      if (((MachCallDynamicJavaNode*)this)->ret_addr_offset() != __ offset() - start_offset) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3716
        tty->print(" %d, %d\n", ((MachCallDynamicJavaNode*)this)->ret_addr_offset(),__ offset() - start_offset);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3717
      }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3718
      assert(((MachCallDynamicJavaNode*)this)->ret_addr_offset() == __ offset() - start_offset,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3719
             "Fix constant in ret_addr_offset()");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3720
    }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3721
#endif
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3722
    Unimplemented();  // ret_addr_offset not yet fixed. Depends on compressed oops (load klass!).
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3723
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3724
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3725
  // a runtime call
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3726
  enc_class enc_java_to_runtime_call (method meth) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3727
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3728
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3729
    MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3730
    const address start_pc = __ pc();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3731
23211
954e3a81da29 8035647: PPC64: Support for elf v2 abi.
goetz
parents: 22927
diff changeset
  3732
#if defined(ABI_ELFv2)
954e3a81da29 8035647: PPC64: Support for elf v2 abi.
goetz
parents: 22927
diff changeset
  3733
    address entry= !($meth$$method) ? NULL : (address)$meth$$method;
954e3a81da29 8035647: PPC64: Support for elf v2 abi.
goetz
parents: 22927
diff changeset
  3734
    __ call_c(entry, relocInfo::runtime_call_type);
954e3a81da29 8035647: PPC64: Support for elf v2 abi.
goetz
parents: 22927
diff changeset
  3735
#else
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3736
    // The function we're going to call.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3737
    FunctionDescriptor fdtemp;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3738
    const FunctionDescriptor* fd = !($meth$$method) ? &fdtemp : (FunctionDescriptor*)$meth$$method;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3739
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3740
    Register Rtoc = R12_scratch2;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3741
    // Calculate the method's TOC.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3742
    __ calculate_address_from_global_toc(Rtoc, __ method_toc());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3743
    // Put entry, env, toc into the constant pool, this needs up to 3 constant
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3744
    // pool entries; call_c_using_toc will optimize the call.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3745
    __ call_c_using_toc(fd, relocInfo::runtime_call_type, Rtoc);
23211
954e3a81da29 8035647: PPC64: Support for elf v2 abi.
goetz
parents: 22927
diff changeset
  3746
#endif
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3747
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3748
    // Check the ret_addr_offset.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3749
    assert(((MachCallRuntimeNode*)this)->ret_addr_offset() ==  __ last_calls_return_pc() - start_pc,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3750
           "Fix constant in ret_addr_offset()");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3751
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3752
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3753
  // Move to ctr for leaf call.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3754
  // This enc_class is needed so that scheduler gets proper
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3755
  // input mapping for latency computation.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3756
  enc_class enc_leaf_call_mtctr(iRegLsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3757
    // TODO: PPC port $archOpcode(ppc64Opcode_mtctr);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3758
    MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3759
    __ mtctr($src$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3760
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3761
23211
954e3a81da29 8035647: PPC64: Support for elf v2 abi.
goetz
parents: 22927
diff changeset
  3762
  // Postalloc expand emitter for runtime leaf calls.
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3763
  enc_class postalloc_expand_java_to_runtime_call(method meth, iRegLdst toc) %{
23211
954e3a81da29 8035647: PPC64: Support for elf v2 abi.
goetz
parents: 22927
diff changeset
  3764
    loadConLNodesTuple loadConLNodes_Entry;
954e3a81da29 8035647: PPC64: Support for elf v2 abi.
goetz
parents: 22927
diff changeset
  3765
#if defined(ABI_ELFv2)
954e3a81da29 8035647: PPC64: Support for elf v2 abi.
goetz
parents: 22927
diff changeset
  3766
    jlong entry_address = (jlong) this->entry_point();
954e3a81da29 8035647: PPC64: Support for elf v2 abi.
goetz
parents: 22927
diff changeset
  3767
    assert(entry_address, "need address here");
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  3768
    loadConLNodes_Entry = loadConLNodesTuple_create(C, ra_, n_toc, new immLOper(entry_address),
23211
954e3a81da29 8035647: PPC64: Support for elf v2 abi.
goetz
parents: 22927
diff changeset
  3769
                                                    OptoReg::Name(R12_H_num), OptoReg::Name(R12_num));
954e3a81da29 8035647: PPC64: Support for elf v2 abi.
goetz
parents: 22927
diff changeset
  3770
#else
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3771
    // Get the struct that describes the function we are about to call.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3772
    FunctionDescriptor* fd = (FunctionDescriptor*) this->entry_point();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3773
    assert(fd, "need fd here");
23211
954e3a81da29 8035647: PPC64: Support for elf v2 abi.
goetz
parents: 22927
diff changeset
  3774
    jlong entry_address = (jlong) fd->entry();
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3775
    // new nodes
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3776
    loadConLNodesTuple loadConLNodes_Env;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3777
    loadConLNodesTuple loadConLNodes_Toc;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3778
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3779
    // Create nodes and operands for loading the entry point.
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  3780
    loadConLNodes_Entry = loadConLNodesTuple_create(C, ra_, n_toc, new immLOper(entry_address),
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3781
                                                    OptoReg::Name(R12_H_num), OptoReg::Name(R12_num));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3782
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3783
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3784
    // Create nodes and operands for loading the env pointer.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3785
    if (fd->env() != NULL) {
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  3786
      loadConLNodes_Env = loadConLNodesTuple_create(C, ra_, n_toc, new immLOper((jlong) fd->env()),
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3787
                                                    OptoReg::Name(R11_H_num), OptoReg::Name(R11_num));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3788
    } else {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3789
      loadConLNodes_Env._large_hi = NULL;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3790
      loadConLNodes_Env._large_lo = NULL;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3791
      loadConLNodes_Env._small    = NULL;
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  3792
      loadConLNodes_Env._last = new loadConL16Node();
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  3793
      loadConLNodes_Env._last->_opnds[0] = new iRegLdstOper();
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  3794
      loadConLNodes_Env._last->_opnds[1] = new immL16Oper(0);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3795
      ra_->set_pair(loadConLNodes_Env._last->_idx, OptoReg::Name(R11_H_num), OptoReg::Name(R11_num));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3796
    }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3797
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3798
    // Create nodes and operands for loading the Toc point.
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  3799
    loadConLNodes_Toc = loadConLNodesTuple_create(C, ra_, n_toc, new immLOper((jlong) fd->toc()),
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3800
                                                  OptoReg::Name(R2_H_num), OptoReg::Name(R2_num));
23211
954e3a81da29 8035647: PPC64: Support for elf v2 abi.
goetz
parents: 22927
diff changeset
  3801
#endif // ABI_ELFv2
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3802
    // mtctr node
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  3803
    MachNode *mtctr = new CallLeafDirect_mtctrNode();
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3804
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3805
    assert(loadConLNodes_Entry._last != NULL, "entry must exist");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3806
    mtctr->add_req(0, loadConLNodes_Entry._last);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3807
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  3808
    mtctr->_opnds[0] = new iRegLdstOper();
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  3809
    mtctr->_opnds[1] = new iRegLdstOper();
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3810
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3811
    // call node
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  3812
    MachCallLeafNode *call = new CallLeafDirectNode();
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3813
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3814
    call->_opnds[0] = _opnds[0];
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  3815
    call->_opnds[1] = new methodOper((intptr_t) entry_address); // May get set later.
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3816
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3817
    // Make the new call node look like the old one.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3818
    call->_name        = _name;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3819
    call->_tf          = _tf;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3820
    call->_entry_point = _entry_point;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3821
    call->_cnt         = _cnt;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3822
    call->_argsize     = _argsize;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3823
    call->_oop_map     = _oop_map;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3824
    guarantee(!_jvms, "You must clone the jvms and adapt the offsets by fix_jvms().");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3825
    call->_jvms        = NULL;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3826
    call->_jvmadj      = _jvmadj;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3827
    call->_in_rms      = _in_rms;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3828
    call->_nesting     = _nesting;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3829
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3830
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3831
    // New call needs all inputs of old call.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3832
    // Req...
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3833
    for (uint i = 0; i < req(); ++i) {
22865
3b8857d7b3cc 8030863: PPC64: (part 220): ConstantTableBase for calls between args and jvms
goetz
parents: 22861
diff changeset
  3834
      if (i != mach_constant_base_node_input()) {
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3835
        call->add_req(in(i));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3836
      }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3837
    }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3838
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3839
    // These must be reqired edges, as the registers are live up to
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3840
    // the call. Else the constants are handled as kills.
22865
3b8857d7b3cc 8030863: PPC64: (part 220): ConstantTableBase for calls between args and jvms
goetz
parents: 22861
diff changeset
  3841
    call->add_req(mtctr);
23211
954e3a81da29 8035647: PPC64: Support for elf v2 abi.
goetz
parents: 22927
diff changeset
  3842
#if !defined(ABI_ELFv2)
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3843
    call->add_req(loadConLNodes_Env._last);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3844
    call->add_req(loadConLNodes_Toc._last);
23211
954e3a81da29 8035647: PPC64: Support for elf v2 abi.
goetz
parents: 22927
diff changeset
  3845
#endif
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3846
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3847
    // ...as well as prec
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3848
    for (uint i = req(); i < len(); ++i) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3849
      call->add_prec(in(i));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3850
    }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3851
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3852
    // registers
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3853
    ra_->set1(mtctr->_idx, OptoReg::Name(SR_CTR_num));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3854
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3855
    // Insert the new nodes.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3856
    if (loadConLNodes_Entry._large_hi) nodes->push(loadConLNodes_Entry._large_hi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3857
    if (loadConLNodes_Entry._last)     nodes->push(loadConLNodes_Entry._last);
23211
954e3a81da29 8035647: PPC64: Support for elf v2 abi.
goetz
parents: 22927
diff changeset
  3858
#if !defined(ABI_ELFv2)
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3859
    if (loadConLNodes_Env._large_hi)   nodes->push(loadConLNodes_Env._large_hi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3860
    if (loadConLNodes_Env._last)       nodes->push(loadConLNodes_Env._last);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3861
    if (loadConLNodes_Toc._large_hi)   nodes->push(loadConLNodes_Toc._large_hi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3862
    if (loadConLNodes_Toc._last)       nodes->push(loadConLNodes_Toc._last);
23211
954e3a81da29 8035647: PPC64: Support for elf v2 abi.
goetz
parents: 22927
diff changeset
  3863
#endif
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3864
    nodes->push(mtctr);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3865
    nodes->push(call);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3866
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3867
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3868
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3869
//----------FRAME--------------------------------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3870
// Definition of frame structure and management information.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3871
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3872
frame %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3873
  // What direction does stack grow in (assumed to be same for native & Java).
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3874
  stack_direction(TOWARDS_LOW);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3875
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3876
  // These two registers define part of the calling convention between
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3877
  // compiled code and the interpreter.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3878
22865
3b8857d7b3cc 8030863: PPC64: (part 220): ConstantTableBase for calls between args and jvms
goetz
parents: 22861
diff changeset
  3879
  // Inline Cache Register or method for I2C.
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3880
  inline_cache_reg(R19); // R19_method
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3881
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3882
  // Method Oop Register when calling interpreter.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3883
  interpreter_method_oop_reg(R19); // R19_method
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3884
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3885
  // Optional: name the operand used by cisc-spilling to access
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3886
  // [stack_pointer + offset].
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3887
  cisc_spilling_operand_name(indOffset);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3888
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3889
  // Number of stack slots consumed by a Monitor enter.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3890
  sync_stack_slots((frame::jit_monitor_size / VMRegImpl::stack_slot_size));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3891
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3892
  // Compiled code's Frame Pointer.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3893
  frame_pointer(R1); // R1_SP
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3894
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3895
  // Interpreter stores its frame pointer in a register which is
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3896
  // stored to the stack by I2CAdaptors. I2CAdaptors convert from
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3897
  // interpreted java to compiled java.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3898
  //
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3899
  // R14_state holds pointer to caller's cInterpreter.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3900
  interpreter_frame_pointer(R14); // R14_state
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3901
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3902
  stack_alignment(frame::alignment_in_bytes);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3903
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3904
  in_preserve_stack_slots((frame::jit_in_preserve_size / VMRegImpl::stack_slot_size));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3905
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3906
  // Number of outgoing stack slots killed above the
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3907
  // out_preserve_stack_slots for calls to C. Supports the var-args
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3908
  // backing area for register parms.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3909
  //
23211
954e3a81da29 8035647: PPC64: Support for elf v2 abi.
goetz
parents: 22927
diff changeset
  3910
  varargs_C_out_slots_killed(((frame::abi_reg_args_size - frame::jit_out_preserve_size) / VMRegImpl::stack_slot_size));
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3911
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3912
  // The after-PROLOG location of the return address. Location of
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3913
  // return address specifies a type (REG or STACK) and a number
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3914
  // representing the register number (i.e. - use a register name) or
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3915
  // stack slot.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3916
  //
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3917
  // A: Link register is stored in stack slot ...
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3918
  // M:  ... but it's in the caller's frame according to PPC-64 ABI.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3919
  // J: Therefore, we make sure that the link register is also in R11_scratch1
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3920
  //    at the end of the prolog.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3921
  // B: We use R20, now.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3922
  //return_addr(REG R20);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3923
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3924
  // G: After reading the comments made by all the luminaries on their
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3925
  //    failure to tell the compiler where the return address really is,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3926
  //    I hardly dare to try myself.  However, I'm convinced it's in slot
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3927
  //    4 what apparently works and saves us some spills.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3928
  return_addr(STACK 4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3929
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3930
  // This is the body of the function
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3931
  //
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3932
  // void Matcher::calling_convention(OptoRegPair* sig, // array of ideal regs
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3933
  //                                  uint length,      // length of array
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3934
  //                                  bool is_outgoing)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3935
  //
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3936
  // The `sig' array is to be updated. sig[j] represents the location
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3937
  // of the j-th argument, either a register or a stack slot.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3938
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3939
  // Comment taken from i486.ad:
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3940
  // Body of function which returns an integer array locating
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3941
  // arguments either in registers or in stack slots. Passed an array
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3942
  // of ideal registers called "sig" and a "length" count. Stack-slot
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3943
  // offsets are based on outgoing arguments, i.e. a CALLER setting up
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3944
  // arguments for a CALLEE. Incoming stack arguments are
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3945
  // automatically biased by the preserve_stack_slots field above.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3946
  calling_convention %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3947
    // No difference between ingoing/outgoing. Just pass false.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3948
    SharedRuntime::java_calling_convention(sig_bt, regs, length, false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3949
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3950
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3951
  // Comment taken from i486.ad:
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3952
  // Body of function which returns an integer array locating
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3953
  // arguments either in registers or in stack slots. Passed an array
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3954
  // of ideal registers called "sig" and a "length" count. Stack-slot
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3955
  // offsets are based on outgoing arguments, i.e. a CALLER setting up
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3956
  // arguments for a CALLEE. Incoming stack arguments are
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3957
  // automatically biased by the preserve_stack_slots field above.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3958
  c_calling_convention %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3959
    // This is obviously always outgoing.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3960
    // C argument in register AND stack slot.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3961
    (void) SharedRuntime::c_calling_convention(sig_bt, regs, /*regs2=*/NULL, length);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3962
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3963
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3964
  // Location of native (C/C++) and interpreter return values. This
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3965
  // is specified to be the same as Java. In the 32-bit VM, long
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3966
  // values are actually returned from native calls in O0:O1 and
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3967
  // returned to the interpreter in I0:I1. The copying to and from
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3968
  // the register pairs is done by the appropriate call and epilog
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3969
  // opcodes. This simplifies the register allocator.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3970
  c_return_value %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3971
    assert((ideal_reg >= Op_RegI && ideal_reg <= Op_RegL) ||
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3972
            (ideal_reg == Op_RegN && Universe::narrow_oop_base() == NULL && Universe::narrow_oop_shift() == 0),
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3973
            "only return normal values");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3974
    // enum names from opcodes.hpp:    Op_Node Op_Set Op_RegN       Op_RegI       Op_RegP       Op_RegF       Op_RegD       Op_RegL
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3975
    static int typeToRegLo[Op_RegL+1] = { 0,   0,     R3_num,   R3_num,   R3_num,   F1_num,   F1_num,   R3_num };
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3976
    static int typeToRegHi[Op_RegL+1] = { 0,   0,     OptoReg::Bad, R3_H_num, R3_H_num, OptoReg::Bad, F1_H_num, R3_H_num };
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3977
    return OptoRegPair(typeToRegHi[ideal_reg], typeToRegLo[ideal_reg]);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3978
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3979
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3980
  // Location of compiled Java return values.  Same as C
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3981
  return_value %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3982
    assert((ideal_reg >= Op_RegI && ideal_reg <= Op_RegL) ||
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3983
            (ideal_reg == Op_RegN && Universe::narrow_oop_base() == NULL && Universe::narrow_oop_shift() == 0),
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3984
            "only return normal values");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3985
    // enum names from opcodes.hpp:    Op_Node Op_Set Op_RegN       Op_RegI       Op_RegP       Op_RegF       Op_RegD       Op_RegL
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3986
    static int typeToRegLo[Op_RegL+1] = { 0,   0,     R3_num,   R3_num,   R3_num,   F1_num,   F1_num,   R3_num };
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3987
    static int typeToRegHi[Op_RegL+1] = { 0,   0,     OptoReg::Bad, R3_H_num, R3_H_num, OptoReg::Bad, F1_H_num, R3_H_num };
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3988
    return OptoRegPair(typeToRegHi[ideal_reg], typeToRegLo[ideal_reg]);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3989
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3990
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3991
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3992
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3993
//----------ATTRIBUTES---------------------------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3994
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3995
//----------Operand Attributes-------------------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3996
op_attrib op_cost(1);          // Required cost attribute.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3997
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3998
//----------Instruction Attributes---------------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3999
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4000
// Cost attribute. required.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4001
ins_attrib ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4002
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4003
// Is this instruction a non-matching short branch variant of some
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4004
// long branch? Not required.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4005
ins_attrib ins_short_branch(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4006
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4007
ins_attrib ins_is_TrapBasedCheckNode(true);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4008
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4009
// Number of constants.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4010
// This instruction uses the given number of constants
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4011
// (optional attribute).
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4012
// This is needed to determine in time whether the constant pool will
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4013
// exceed 4000 entries. Before postalloc_expand the overall number of constants
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4014
// is determined. It's also used to compute the constant pool size
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4015
// in Output().
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4016
ins_attrib ins_num_consts(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4017
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4018
// Required alignment attribute (must be a power of 2) specifies the
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4019
// alignment that some part of the instruction (not necessarily the
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4020
// start) requires. If > 1, a compute_padding() function must be
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4021
// provided for the instruction.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4022
ins_attrib ins_alignment(1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4023
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4024
// Enforce/prohibit rematerializations.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4025
// - If an instruction is attributed with 'ins_cannot_rematerialize(true)'
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4026
//   then rematerialization of that instruction is prohibited and the
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4027
//   instruction's value will be spilled if necessary.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4028
//   Causes that MachNode::rematerialize() returns false.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4029
// - If an instruction is attributed with 'ins_should_rematerialize(true)'
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4030
//   then rematerialization should be enforced and a copy of the instruction
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4031
//   should be inserted if possible; rematerialization is not guaranteed.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4032
//   Note: this may result in rematerializations in front of every use.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4033
//   Causes that MachNode::rematerialize() can return true.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4034
// (optional attribute)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4035
ins_attrib ins_cannot_rematerialize(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4036
ins_attrib ins_should_rematerialize(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4037
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4038
// Instruction has variable size depending on alignment.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4039
ins_attrib ins_variable_size_depending_on_alignment(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4040
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4041
// Instruction is a nop.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4042
ins_attrib ins_is_nop(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4043
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4044
// Instruction is mapped to a MachIfFastLock node (instead of MachFastLock).
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4045
ins_attrib ins_use_mach_if_fast_lock_node(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4046
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4047
// Field for the toc offset of a constant.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4048
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4049
// This is needed if the toc offset is not encodable as an immediate in
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4050
// the PPC load instruction. If so, the upper (hi) bits of the offset are
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4051
// added to the toc, and from this a load with immediate is performed.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4052
// With postalloc expand, we get two nodes that require the same offset
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4053
// but which don't know about each other. The offset is only known
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4054
// when the constant is added to the constant pool during emitting.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4055
// It is generated in the 'hi'-node adding the upper bits, and saved
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4056
// in this node.  The 'lo'-node has a link to the 'hi'-node and reads
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4057
// the offset from there when it gets encoded.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4058
ins_attrib ins_field_const_toc_offset(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4059
ins_attrib ins_field_const_toc_offset_hi_node(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4060
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4061
// A field that can hold the instructions offset in the code buffer.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4062
// Set in the nodes emitter.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4063
ins_attrib ins_field_cbuf_insts_offset(-1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4064
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4065
// Fields for referencing a call's load-IC-node.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4066
// If the toc offset can not be encoded as an immediate in a load, we
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4067
// use two nodes.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4068
ins_attrib ins_field_load_ic_hi_node(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4069
ins_attrib ins_field_load_ic_node(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4070
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4071
//----------OPERANDS-----------------------------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4072
// Operand definitions must precede instruction definitions for correct
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4073
// parsing in the ADLC because operands constitute user defined types
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4074
// which are used in instruction definitions.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4075
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4076
// Formats are generated automatically for constants and base registers.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4077
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4078
//----------Simple Operands----------------------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4079
// Immediate Operands
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4080
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4081
// Integer Immediate: 32-bit
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4082
operand immI() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4083
  match(ConI);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4084
  op_cost(40);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4085
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4086
  interface(CONST_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4087
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4088
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4089
operand immI8() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4090
  predicate(Assembler::is_simm(n->get_int(), 8));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4091
  op_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4092
  match(ConI);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4093
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4094
  interface(CONST_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4095
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4096
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4097
// Integer Immediate: 16-bit
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4098
operand immI16() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4099
  predicate(Assembler::is_simm(n->get_int(), 16));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4100
  op_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4101
  match(ConI);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4102
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4103
  interface(CONST_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4104
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4105
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4106
// Integer Immediate: 32-bit, where lowest 16 bits are 0x0000.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4107
operand immIhi16() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4108
  predicate(((n->get_int() & 0xffff0000) != 0) && ((n->get_int() & 0xffff) == 0));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4109
  match(ConI);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4110
  op_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4111
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4112
  interface(CONST_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4113
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4114
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4115
operand immInegpow2() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4116
  predicate(is_power_of_2_long((jlong) (julong) (juint) (-(n->get_int()))));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4117
  match(ConI);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4118
  op_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4119
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4120
  interface(CONST_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4121
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4122
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4123
operand immIpow2minus1() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4124
  predicate(is_power_of_2_long((((jlong) (n->get_int()))+1)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4125
  match(ConI);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4126
  op_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4127
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4128
  interface(CONST_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4129
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4130
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4131
operand immIpowerOf2() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4132
  predicate(is_power_of_2_long((((jlong) (julong) (juint) (n->get_int())))));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4133
  match(ConI);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4134
  op_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4135
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4136
  interface(CONST_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4137
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4138
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4139
// Unsigned Integer Immediate: the values 0-31
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4140
operand uimmI5() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4141
  predicate(Assembler::is_uimm(n->get_int(), 5));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4142
  match(ConI);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4143
  op_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4144
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4145
  interface(CONST_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4146
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4147
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4148
// Unsigned Integer Immediate: 6-bit
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4149
operand uimmI6() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4150
  predicate(Assembler::is_uimm(n->get_int(), 6));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4151
  match(ConI);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4152
  op_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4153
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4154
  interface(CONST_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4155
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4156
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4157
// Unsigned Integer Immediate:  6-bit int, greater than 32
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4158
operand uimmI6_ge32() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4159
  predicate(Assembler::is_uimm(n->get_int(), 6) && n->get_int() >= 32);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4160
  match(ConI);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4161
  op_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4162
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4163
  interface(CONST_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4164
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4165
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4166
// Unsigned Integer Immediate: 15-bit
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4167
operand uimmI15() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4168
  predicate(Assembler::is_uimm(n->get_int(), 15));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4169
  match(ConI);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4170
  op_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4171
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4172
  interface(CONST_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4173
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4174
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4175
// Unsigned Integer Immediate: 16-bit
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4176
operand uimmI16() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4177
  predicate(Assembler::is_uimm(n->get_int(), 16));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4178
  match(ConI);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4179
  op_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4180
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4181
  interface(CONST_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4182
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4183
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4184
// constant 'int 0'.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4185
operand immI_0() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4186
  predicate(n->get_int() == 0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4187
  match(ConI);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4188
  op_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4189
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4190
  interface(CONST_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4191
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4192
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4193
// constant 'int 1'.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4194
operand immI_1() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4195
  predicate(n->get_int() == 1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4196
  match(ConI);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4197
  op_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4198
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4199
  interface(CONST_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4200
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4201
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4202
// constant 'int -1'.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4203
operand immI_minus1() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4204
  predicate(n->get_int() == -1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4205
  match(ConI);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4206
  op_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4207
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4208
  interface(CONST_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4209
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4210
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4211
// int value 16.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4212
operand immI_16() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4213
  predicate(n->get_int() == 16);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4214
  match(ConI);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4215
  op_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4216
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4217
  interface(CONST_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4218
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4219
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4220
// int value 24.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4221
operand immI_24() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4222
  predicate(n->get_int() == 24);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4223
  match(ConI);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4224
  op_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4225
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4226
  interface(CONST_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4227
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4228
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4229
// Compressed oops constants
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4230
// Pointer Immediate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4231
operand immN() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4232
  match(ConN);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4233
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4234
  op_cost(10);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4235
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4236
  interface(CONST_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4237
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4238
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4239
// NULL Pointer Immediate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4240
operand immN_0() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4241
  predicate(n->get_narrowcon() == 0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4242
  match(ConN);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4243
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4244
  op_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4245
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4246
  interface(CONST_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4247
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4248
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4249
// Compressed klass constants
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4250
operand immNKlass() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4251
  match(ConNKlass);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4252
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4253
  op_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4254
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4255
  interface(CONST_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4256
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4257
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4258
// This operand can be used to avoid matching of an instruct
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4259
// with chain rule.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4260
operand immNKlass_NM() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4261
  match(ConNKlass);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4262
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4263
  op_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4264
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4265
  interface(CONST_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4266
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4267
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4268
// Pointer Immediate: 64-bit
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4269
operand immP() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4270
  match(ConP);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4271
  op_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4272
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4273
  interface(CONST_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4274
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4275
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4276
// Operand to avoid match of loadConP.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4277
// This operand can be used to avoid matching of an instruct
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4278
// with chain rule.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4279
operand immP_NM() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4280
  match(ConP);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4281
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4282
  op_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4283
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4284
  interface(CONST_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4285
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4286
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4287
// costant 'pointer 0'.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4288
operand immP_0() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4289
  predicate(n->get_ptr() == 0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4290
  match(ConP);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4291
  op_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4292
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4293
  interface(CONST_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4294
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4295
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4296
// pointer 0x0 or 0x1
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4297
operand immP_0or1() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4298
  predicate((n->get_ptr() == 0) || (n->get_ptr() == 1));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4299
  match(ConP);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4300
  op_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4301
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4302
  interface(CONST_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4303
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4304
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4305
operand immL() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4306
  match(ConL);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4307
  op_cost(40);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4308
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4309
  interface(CONST_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4310
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4311
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4312
// Long Immediate: 16-bit
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4313
operand immL16() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4314
  predicate(Assembler::is_simm(n->get_long(), 16));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4315
  match(ConL);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4316
  op_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4317
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4318
  interface(CONST_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4319
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4320
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4321
// Long Immediate: 16-bit, 4-aligned
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4322
operand immL16Alg4() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4323
  predicate(Assembler::is_simm(n->get_long(), 16) && ((n->get_long() & 0x3) == 0));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4324
  match(ConL);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4325
  op_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4326
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4327
  interface(CONST_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4328
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4329
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4330
// Long Immediate: 32-bit, where lowest 16 bits are 0x0000.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4331
operand immL32hi16() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4332
  predicate(Assembler::is_simm(n->get_long(), 32) && ((n->get_long() & 0xffffL) == 0L));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4333
  match(ConL);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4334
  op_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4335
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4336
  interface(CONST_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4337
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4338
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4339
// Long Immediate: 32-bit
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4340
operand immL32() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4341
  predicate(Assembler::is_simm(n->get_long(), 32));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4342
  match(ConL);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4343
  op_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4344
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4345
  interface(CONST_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4346
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4347
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4348
// Long Immediate: 64-bit, where highest 16 bits are not 0x0000.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4349
operand immLhighest16() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4350
  predicate((n->get_long() & 0xffff000000000000L) != 0L && (n->get_long() & 0x0000ffffffffffffL) == 0L);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4351
  match(ConL);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4352
  op_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4353
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4354
  interface(CONST_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4355
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4356
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4357
operand immLnegpow2() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4358
  predicate(is_power_of_2_long((jlong)-(n->get_long())));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4359
  match(ConL);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4360
  op_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4361
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4362
  interface(CONST_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4363
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4364
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4365
operand immLpow2minus1() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4366
  predicate(is_power_of_2_long((((jlong) (n->get_long()))+1)) &&
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4367
            (n->get_long() != (jlong)0xffffffffffffffffL));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4368
  match(ConL);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4369
  op_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4370
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4371
  interface(CONST_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4372
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4373
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4374
// constant 'long 0'.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4375
operand immL_0() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4376
  predicate(n->get_long() == 0L);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4377
  match(ConL);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4378
  op_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4379
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4380
  interface(CONST_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4381
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4382
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4383
// constat ' long -1'.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4384
operand immL_minus1() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4385
  predicate(n->get_long() == -1L);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4386
  match(ConL);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4387
  op_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4388
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4389
  interface(CONST_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4390
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4391
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4392
// Long Immediate: low 32-bit mask
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4393
operand immL_32bits() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4394
  predicate(n->get_long() == 0xFFFFFFFFL);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4395
  match(ConL);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4396
  op_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4397
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4398
  interface(CONST_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4399
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4400
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4401
// Unsigned Long Immediate: 16-bit
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4402
operand uimmL16() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4403
  predicate(Assembler::is_uimm(n->get_long(), 16));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4404
  match(ConL);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4405
  op_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4406
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4407
  interface(CONST_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4408
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4409
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4410
// Float Immediate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4411
operand immF() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4412
  match(ConF);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4413
  op_cost(40);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4414
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4415
  interface(CONST_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4416
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4417
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4418
// constant 'float +0.0'.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4419
operand immF_0() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4420
  predicate((n->getf() == 0) &&
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4421
            (fpclassify(n->getf()) == FP_ZERO) && (signbit(n->getf()) == 0));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4422
  match(ConF);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4423
  op_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4424
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4425
  interface(CONST_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4426
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4427
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4428
// Double Immediate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4429
operand immD() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4430
  match(ConD);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4431
  op_cost(40);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4432
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4433
  interface(CONST_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4434
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4435
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4436
// Integer Register Operands
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4437
// Integer Destination Register
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4438
// See definition of reg_class bits32_reg_rw.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4439
operand iRegIdst() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4440
  constraint(ALLOC_IN_RC(bits32_reg_rw));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4441
  match(RegI);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4442
  match(rscratch1RegI);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4443
  match(rscratch2RegI);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4444
  match(rarg1RegI);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4445
  match(rarg2RegI);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4446
  match(rarg3RegI);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4447
  match(rarg4RegI);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4448
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4449
  interface(REG_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4450
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4451
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4452
// Integer Source Register
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4453
// See definition of reg_class bits32_reg_ro.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4454
operand iRegIsrc() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4455
  constraint(ALLOC_IN_RC(bits32_reg_ro));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4456
  match(RegI);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4457
  match(rscratch1RegI);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4458
  match(rscratch2RegI);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4459
  match(rarg1RegI);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4460
  match(rarg2RegI);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4461
  match(rarg3RegI);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4462
  match(rarg4RegI);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4463
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4464
  interface(REG_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4465
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4466
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4467
operand rscratch1RegI() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4468
  constraint(ALLOC_IN_RC(rscratch1_bits32_reg));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4469
  match(iRegIdst);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4470
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4471
  interface(REG_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4472
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4473
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4474
operand rscratch2RegI() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4475
  constraint(ALLOC_IN_RC(rscratch2_bits32_reg));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4476
  match(iRegIdst);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4477
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4478
  interface(REG_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4479
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4480
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4481
operand rarg1RegI() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4482
  constraint(ALLOC_IN_RC(rarg1_bits32_reg));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4483
  match(iRegIdst);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4484
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4485
  interface(REG_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4486
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4487
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4488
operand rarg2RegI() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4489
  constraint(ALLOC_IN_RC(rarg2_bits32_reg));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4490
  match(iRegIdst);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4491
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4492
  interface(REG_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4493
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4494
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4495
operand rarg3RegI() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4496
  constraint(ALLOC_IN_RC(rarg3_bits32_reg));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4497
  match(iRegIdst);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4498
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4499
  interface(REG_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4500
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4501
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4502
operand rarg4RegI() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4503
  constraint(ALLOC_IN_RC(rarg4_bits32_reg));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4504
  match(iRegIdst);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4505
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4506
  interface(REG_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4507
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4508
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4509
operand rarg1RegL() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4510
  constraint(ALLOC_IN_RC(rarg1_bits64_reg));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4511
  match(iRegLdst);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4512
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4513
  interface(REG_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4514
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4515
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4516
operand rarg2RegL() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4517
  constraint(ALLOC_IN_RC(rarg2_bits64_reg));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4518
  match(iRegLdst);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4519
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4520
  interface(REG_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4521
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4522
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4523
operand rarg3RegL() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4524
  constraint(ALLOC_IN_RC(rarg3_bits64_reg));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4525
  match(iRegLdst);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4526
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4527
  interface(REG_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4528
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4529
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4530
operand rarg4RegL() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4531
  constraint(ALLOC_IN_RC(rarg4_bits64_reg));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4532
  match(iRegLdst);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4533
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4534
  interface(REG_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4535
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4536
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4537
// Pointer Destination Register
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4538
// See definition of reg_class bits64_reg_rw.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4539
operand iRegPdst() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4540
  constraint(ALLOC_IN_RC(bits64_reg_rw));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4541
  match(RegP);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4542
  match(rscratch1RegP);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4543
  match(rscratch2RegP);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4544
  match(rarg1RegP);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4545
  match(rarg2RegP);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4546
  match(rarg3RegP);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4547
  match(rarg4RegP);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4548
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4549
  interface(REG_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4550
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4551
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4552
// Pointer Destination Register
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4553
// Operand not using r11 and r12 (killed in epilog).
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4554
operand iRegPdstNoScratch() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4555
  constraint(ALLOC_IN_RC(bits64_reg_leaf_call));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4556
  match(RegP);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4557
  match(rarg1RegP);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4558
  match(rarg2RegP);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4559
  match(rarg3RegP);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4560
  match(rarg4RegP);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4561
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4562
  interface(REG_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4563
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4564
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4565
// Pointer Source Register
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4566
// See definition of reg_class bits64_reg_ro.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4567
operand iRegPsrc() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4568
  constraint(ALLOC_IN_RC(bits64_reg_ro));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4569
  match(RegP);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4570
  match(iRegPdst);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4571
  match(rscratch1RegP);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4572
  match(rscratch2RegP);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4573
  match(rarg1RegP);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4574
  match(rarg2RegP);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4575
  match(rarg3RegP);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4576
  match(rarg4RegP);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4577
  match(threadRegP);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4578
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4579
  interface(REG_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4580
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4581
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4582
// Thread operand.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4583
operand threadRegP() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4584
  constraint(ALLOC_IN_RC(thread_bits64_reg));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4585
  match(iRegPdst);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4586
  format %{ "R16" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4587
  interface(REG_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4588
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4589
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4590
operand rscratch1RegP() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4591
  constraint(ALLOC_IN_RC(rscratch1_bits64_reg));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4592
  match(iRegPdst);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4593
  format %{ "R11" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4594
  interface(REG_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4595
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4596
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4597
operand rscratch2RegP() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4598
  constraint(ALLOC_IN_RC(rscratch2_bits64_reg));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4599
  match(iRegPdst);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4600
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4601
  interface(REG_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4602
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4603
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4604
operand rarg1RegP() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4605
  constraint(ALLOC_IN_RC(rarg1_bits64_reg));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4606
  match(iRegPdst);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4607
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4608
  interface(REG_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4609
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4610
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4611
operand rarg2RegP() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4612
  constraint(ALLOC_IN_RC(rarg2_bits64_reg));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4613
  match(iRegPdst);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4614
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4615
  interface(REG_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4616
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4617
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4618
operand rarg3RegP() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4619
  constraint(ALLOC_IN_RC(rarg3_bits64_reg));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4620
  match(iRegPdst);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4621
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4622
  interface(REG_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4623
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4624
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4625
operand rarg4RegP() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4626
  constraint(ALLOC_IN_RC(rarg4_bits64_reg));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4627
  match(iRegPdst);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4628
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4629
  interface(REG_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4630
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4631
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4632
operand iRegNsrc() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4633
  constraint(ALLOC_IN_RC(bits32_reg_ro));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4634
  match(RegN);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4635
  match(iRegNdst);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4636
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4637
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4638
  interface(REG_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4639
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4640
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4641
operand iRegNdst() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4642
  constraint(ALLOC_IN_RC(bits32_reg_rw));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4643
  match(RegN);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4644
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4645
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4646
  interface(REG_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4647
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4648
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4649
// Long Destination Register
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4650
// See definition of reg_class bits64_reg_rw.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4651
operand iRegLdst() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4652
  constraint(ALLOC_IN_RC(bits64_reg_rw));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4653
  match(RegL);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4654
  match(rscratch1RegL);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4655
  match(rscratch2RegL);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4656
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4657
  interface(REG_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4658
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4659
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4660
// Long Source Register
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4661
// See definition of reg_class bits64_reg_ro.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4662
operand iRegLsrc() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4663
  constraint(ALLOC_IN_RC(bits64_reg_ro));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4664
  match(RegL);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4665
  match(iRegLdst);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4666
  match(rscratch1RegL);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4667
  match(rscratch2RegL);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4668
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4669
  interface(REG_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4670
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4671
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4672
// Special operand for ConvL2I.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4673
operand iRegL2Isrc(iRegLsrc reg) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4674
  constraint(ALLOC_IN_RC(bits64_reg_ro));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4675
  match(ConvL2I reg);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4676
  format %{ "ConvL2I($reg)" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4677
  interface(REG_INTER)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4678
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4679
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4680
operand rscratch1RegL() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4681
  constraint(ALLOC_IN_RC(rscratch1_bits64_reg));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4682
  match(RegL);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4683
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4684
  interface(REG_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4685
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4686
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4687
operand rscratch2RegL() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4688
  constraint(ALLOC_IN_RC(rscratch2_bits64_reg));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4689
  match(RegL);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4690
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4691
  interface(REG_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4692
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4693
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4694
// Condition Code Flag Registers
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4695
operand flagsReg() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4696
  constraint(ALLOC_IN_RC(int_flags));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4697
  match(RegFlags);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4698
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4699
  interface(REG_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4700
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4701
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4702
// Condition Code Flag Register CR0
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4703
operand flagsRegCR0() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4704
  constraint(ALLOC_IN_RC(int_flags_CR0));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4705
  match(RegFlags);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4706
  format %{ "CR0" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4707
  interface(REG_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4708
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4709
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4710
operand flagsRegCR1() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4711
  constraint(ALLOC_IN_RC(int_flags_CR1));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4712
  match(RegFlags);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4713
  format %{ "CR1" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4714
  interface(REG_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4715
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4716
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4717
operand flagsRegCR6() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4718
  constraint(ALLOC_IN_RC(int_flags_CR6));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4719
  match(RegFlags);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4720
  format %{ "CR6" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4721
  interface(REG_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4722
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4723
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4724
operand regCTR() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4725
  constraint(ALLOC_IN_RC(ctr_reg));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4726
  // RegFlags should work. Introducing a RegSpecial type would cause a
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4727
  // lot of changes.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4728
  match(RegFlags);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4729
  format %{"SR_CTR" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4730
  interface(REG_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4731
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4732
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4733
operand regD() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4734
  constraint(ALLOC_IN_RC(dbl_reg));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4735
  match(RegD);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4736
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4737
  interface(REG_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4738
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4739
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4740
operand regF() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4741
  constraint(ALLOC_IN_RC(flt_reg));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4742
  match(RegF);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4743
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4744
  interface(REG_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4745
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4746
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4747
// Special Registers
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4748
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4749
// Method Register
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4750
operand inline_cache_regP(iRegPdst reg) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4751
  constraint(ALLOC_IN_RC(r19_bits64_reg)); // inline_cache_reg
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4752
  match(reg);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4753
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4754
  interface(REG_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4755
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4756
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4757
operand compiler_method_oop_regP(iRegPdst reg) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4758
  constraint(ALLOC_IN_RC(rscratch1_bits64_reg)); // compiler_method_oop_reg
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4759
  match(reg);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4760
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4761
  interface(REG_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4762
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4763
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4764
operand interpreter_method_oop_regP(iRegPdst reg) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4765
  constraint(ALLOC_IN_RC(r19_bits64_reg)); // interpreter_method_oop_reg
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4766
  match(reg);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4767
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4768
  interface(REG_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4769
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4770
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4771
// Operands to remove register moves in unscaled mode.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4772
// Match read/write registers with an EncodeP node if neither shift nor add are required.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4773
operand iRegP2N(iRegPsrc reg) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4774
  predicate(false /* TODO: PPC port MatchDecodeNodes*/&& Universe::narrow_oop_shift() == 0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4775
  constraint(ALLOC_IN_RC(bits64_reg_ro));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4776
  match(EncodeP reg);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4777
  format %{ "$reg" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4778
  interface(REG_INTER)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4779
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4780
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4781
operand iRegN2P(iRegNsrc reg) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4782
  predicate(false /* TODO: PPC port MatchDecodeNodes*/);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4783
  constraint(ALLOC_IN_RC(bits32_reg_ro));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4784
  match(DecodeN reg);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4785
  match(DecodeNKlass reg);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4786
  format %{ "$reg" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4787
  interface(REG_INTER)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4788
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4789
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4790
//----------Complex Operands---------------------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4791
// Indirect Memory Reference
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4792
operand indirect(iRegPsrc reg) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4793
  constraint(ALLOC_IN_RC(bits64_reg_ro));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4794
  match(reg);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4795
  op_cost(100);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4796
  format %{ "[$reg]" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4797
  interface(MEMORY_INTER) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4798
    base($reg);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4799
    index(0x0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4800
    scale(0x0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4801
    disp(0x0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4802
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4803
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4804
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4805
// Indirect with Offset
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4806
operand indOffset16(iRegPsrc reg, immL16 offset) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4807
  constraint(ALLOC_IN_RC(bits64_reg_ro));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4808
  match(AddP reg offset);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4809
  op_cost(100);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4810
  format %{ "[$reg + $offset]" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4811
  interface(MEMORY_INTER) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4812
    base($reg);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4813
    index(0x0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4814
    scale(0x0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4815
    disp($offset);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4816
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4817
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4818
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4819
// Indirect with 4-aligned Offset
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4820
operand indOffset16Alg4(iRegPsrc reg, immL16Alg4 offset) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4821
  constraint(ALLOC_IN_RC(bits64_reg_ro));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4822
  match(AddP reg offset);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4823
  op_cost(100);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4824
  format %{ "[$reg + $offset]" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4825
  interface(MEMORY_INTER) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4826
    base($reg);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4827
    index(0x0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4828
    scale(0x0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4829
    disp($offset);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4830
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4831
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4832
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4833
//----------Complex Operands for Compressed OOPs-------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4834
// Compressed OOPs with narrow_oop_shift == 0.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4835
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4836
// Indirect Memory Reference, compressed OOP
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4837
operand indirectNarrow(iRegNsrc reg) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4838
  predicate(false /* TODO: PPC port MatchDecodeNodes*/);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4839
  constraint(ALLOC_IN_RC(bits64_reg_ro));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4840
  match(DecodeN reg);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4841
  match(DecodeNKlass reg);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4842
  op_cost(100);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4843
  format %{ "[$reg]" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4844
  interface(MEMORY_INTER) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4845
    base($reg);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4846
    index(0x0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4847
    scale(0x0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4848
    disp(0x0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4849
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4850
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4851
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4852
// Indirect with Offset, compressed OOP
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4853
operand indOffset16Narrow(iRegNsrc reg, immL16 offset) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4854
  predicate(false /* TODO: PPC port MatchDecodeNodes*/);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4855
  constraint(ALLOC_IN_RC(bits64_reg_ro));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4856
  match(AddP (DecodeN reg) offset);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4857
  match(AddP (DecodeNKlass reg) offset);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4858
  op_cost(100);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4859
  format %{ "[$reg + $offset]" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4860
  interface(MEMORY_INTER) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4861
    base($reg);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4862
    index(0x0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4863
    scale(0x0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4864
    disp($offset);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4865
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4866
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4867
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4868
// Indirect with 4-aligned Offset, compressed OOP
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4869
operand indOffset16NarrowAlg4(iRegNsrc reg, immL16Alg4 offset) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4870
  predicate(false /* TODO: PPC port MatchDecodeNodes*/);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4871
  constraint(ALLOC_IN_RC(bits64_reg_ro));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4872
  match(AddP (DecodeN reg) offset);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4873
  match(AddP (DecodeNKlass reg) offset);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4874
  op_cost(100);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4875
  format %{ "[$reg + $offset]" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4876
  interface(MEMORY_INTER) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4877
    base($reg);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4878
    index(0x0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4879
    scale(0x0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4880
    disp($offset);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4881
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4882
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4883
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4884
//----------Special Memory Operands--------------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4885
// Stack Slot Operand
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4886
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4887
// This operand is used for loading and storing temporary values on
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4888
// the stack where a match requires a value to flow through memory.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4889
operand stackSlotI(sRegI reg) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4890
  constraint(ALLOC_IN_RC(stack_slots));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4891
  op_cost(100);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4892
  //match(RegI);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4893
  format %{ "[sp+$reg]" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4894
  interface(MEMORY_INTER) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4895
    base(0x1);   // R1_SP
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4896
    index(0x0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4897
    scale(0x0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4898
    disp($reg);  // Stack Offset
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4899
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4900
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4901
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4902
operand stackSlotL(sRegL reg) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4903
  constraint(ALLOC_IN_RC(stack_slots));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4904
  op_cost(100);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4905
  //match(RegL);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4906
  format %{ "[sp+$reg]" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4907
  interface(MEMORY_INTER) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4908
    base(0x1);   // R1_SP
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4909
    index(0x0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4910
    scale(0x0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4911
    disp($reg);  // Stack Offset
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4912
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4913
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4914
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4915
operand stackSlotP(sRegP reg) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4916
  constraint(ALLOC_IN_RC(stack_slots));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4917
  op_cost(100);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4918
  //match(RegP);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4919
  format %{ "[sp+$reg]" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4920
  interface(MEMORY_INTER) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4921
    base(0x1);   // R1_SP
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4922
    index(0x0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4923
    scale(0x0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4924
    disp($reg);  // Stack Offset
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4925
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4926
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4927
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4928
operand stackSlotF(sRegF reg) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4929
  constraint(ALLOC_IN_RC(stack_slots));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4930
  op_cost(100);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4931
  //match(RegF);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4932
  format %{ "[sp+$reg]" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4933
  interface(MEMORY_INTER) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4934
    base(0x1);   // R1_SP
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4935
    index(0x0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4936
    scale(0x0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4937
    disp($reg);  // Stack Offset
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4938
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4939
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4940
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4941
operand stackSlotD(sRegD reg) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4942
  constraint(ALLOC_IN_RC(stack_slots));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4943
  op_cost(100);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4944
  //match(RegD);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4945
  format %{ "[sp+$reg]" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4946
  interface(MEMORY_INTER) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4947
    base(0x1);   // R1_SP
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4948
    index(0x0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4949
    scale(0x0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4950
    disp($reg);  // Stack Offset
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4951
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4952
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4953
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4954
// Operands for expressing Control Flow
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4955
// NOTE: Label is a predefined operand which should not be redefined in
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4956
//       the AD file. It is generically handled within the ADLC.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4957
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4958
//----------Conditional Branch Operands----------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4959
// Comparison Op
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4960
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4961
// This is the operation of the comparison, and is limited to the
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4962
// following set of codes: L (<), LE (<=), G (>), GE (>=), E (==), NE
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4963
// (!=).
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4964
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4965
// Other attributes of the comparison, such as unsignedness, are specified
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4966
// by the comparison instruction that sets a condition code flags register.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4967
// That result is represented by a flags operand whose subtype is appropriate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4968
// to the unsignedness (etc.) of the comparison.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4969
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4970
// Later, the instruction which matches both the Comparison Op (a Bool) and
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4971
// the flags (produced by the Cmp) specifies the coding of the comparison op
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4972
// by matching a specific subtype of Bool operand below.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4973
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4974
// When used for floating point comparisons: unordered same as less.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4975
operand cmpOp() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4976
  match(Bool);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4977
  format %{ "" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4978
  interface(COND_INTER) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4979
                           // BO only encodes bit 4 of bcondCRbiIsX, as bits 1-3 are always '100'.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4980
                           //           BO          &  BI
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4981
    equal(0xA);            // 10 10:   bcondCRbiIs1 & Condition::equal
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4982
    not_equal(0x2);        // 00 10:   bcondCRbiIs0 & Condition::equal
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4983
    less(0x8);             // 10 00:   bcondCRbiIs1 & Condition::less
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4984
    greater_equal(0x0);    // 00 00:   bcondCRbiIs0 & Condition::less
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4985
    less_equal(0x1);       // 00 01:   bcondCRbiIs0 & Condition::greater
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4986
    greater(0x9);          // 10 01:   bcondCRbiIs1 & Condition::greater
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4987
    overflow(0xB);         // 10 11:   bcondCRbiIs1 & Condition::summary_overflow
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4988
    no_overflow(0x3);      // 00 11:   bcondCRbiIs0 & Condition::summary_overflow
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4989
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4990
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4991
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4992
//----------OPERAND CLASSES----------------------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4993
// Operand Classes are groups of operands that are used to simplify
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4994
// instruction definitions by not requiring the AD writer to specify
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4995
// seperate instructions for every form of operand when the
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4996
// instruction accepts multiple operand types with the same basic
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4997
// encoding and format. The classic case of this is memory operands.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4998
// Indirect is not included since its use is limited to Compare & Swap.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4999
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5000
opclass memory(indirect, indOffset16 /*, indIndex, tlsReference*/, indirectNarrow, indOffset16Narrow);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5001
// Memory operand where offsets are 4-aligned. Required for ld, std.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5002
opclass memoryAlg4(indirect, indOffset16Alg4, indirectNarrow, indOffset16NarrowAlg4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5003
opclass indirectMemory(indirect, indirectNarrow);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5004
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5005
// Special opclass for I and ConvL2I.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5006
opclass iRegIsrc_iRegL2Isrc(iRegIsrc, iRegL2Isrc);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5007
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5008
// Operand classes to match encode and decode. iRegN_P2N is only used
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5009
// for storeN. I have never seen an encode node elsewhere.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5010
opclass iRegN_P2N(iRegNsrc, iRegP2N);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5011
opclass iRegP_N2P(iRegPsrc, iRegN2P);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5012
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5013
//----------PIPELINE-----------------------------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5014
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5015
pipeline %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5016
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5017
// See J.M.Tendler et al. "Power4 system microarchitecture", IBM
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5018
// J. Res. & Dev., No. 1, Jan. 2002.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5019
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5020
//----------ATTRIBUTES---------------------------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5021
attributes %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5022
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5023
  // Power4 instructions are of fixed length.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5024
  fixed_size_instructions;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5025
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5026
  // TODO: if `bundle' means number of instructions fetched
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5027
  // per cycle, this is 8. If `bundle' means Power4 `group', that is
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5028
  // max instructions issued per cycle, this is 5.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5029
  max_instructions_per_bundle = 8;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5030
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5031
  // A Power4 instruction is 4 bytes long.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5032
  instruction_unit_size = 4;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5033
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5034
  // The Power4 processor fetches 64 bytes...
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5035
  instruction_fetch_unit_size = 64;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5036
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5037
  // ...in one line
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5038
  instruction_fetch_units = 1
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5039
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5040
  // Unused, list one so that array generated by adlc is not empty.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5041
  // Aix compiler chokes if _nop_count = 0.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5042
  nops(fxNop);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5043
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5044
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5045
//----------RESOURCES----------------------------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5046
// Resources are the functional units available to the machine
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5047
resources(
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5048
   PPC_BR,         // branch unit
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5049
   PPC_CR,         // condition unit
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5050
   PPC_FX1,        // integer arithmetic unit 1
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5051
   PPC_FX2,        // integer arithmetic unit 2
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5052
   PPC_LDST1,      // load/store unit 1
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5053
   PPC_LDST2,      // load/store unit 2
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5054
   PPC_FP1,        // float arithmetic unit 1
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5055
   PPC_FP2,        // float arithmetic unit 2
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5056
   PPC_LDST = PPC_LDST1 | PPC_LDST2,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5057
   PPC_FX = PPC_FX1 | PPC_FX2,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5058
   PPC_FP = PPC_FP1 | PPC_FP2
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5059
 );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5060
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5061
//----------PIPELINE DESCRIPTION-----------------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5062
// Pipeline Description specifies the stages in the machine's pipeline
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5063
pipe_desc(
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5064
   // Power4 longest pipeline path
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5065
   PPC_IF,   // instruction fetch
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5066
   PPC_IC,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5067
   //PPC_BP, // branch prediction
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5068
   PPC_D0,   // decode
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5069
   PPC_D1,   // decode
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5070
   PPC_D2,   // decode
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5071
   PPC_D3,   // decode
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5072
   PPC_Xfer1,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5073
   PPC_GD,   // group definition
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5074
   PPC_MP,   // map
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5075
   PPC_ISS,  // issue
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5076
   PPC_RF,   // resource fetch
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5077
   PPC_EX1,  // execute (all units)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5078
   PPC_EX2,  // execute (FP, LDST)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5079
   PPC_EX3,  // execute (FP, LDST)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5080
   PPC_EX4,  // execute (FP)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5081
   PPC_EX5,  // execute (FP)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5082
   PPC_EX6,  // execute (FP)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5083
   PPC_WB,   // write back
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5084
   PPC_Xfer2,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5085
   PPC_CP
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5086
 );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5087
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5088
//----------PIPELINE CLASSES---------------------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5089
// Pipeline Classes describe the stages in which input and output are
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5090
// referenced by the hardware pipeline.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5091
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5092
// Simple pipeline classes.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5093
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5094
// Default pipeline class.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5095
pipe_class pipe_class_default() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5096
  single_instruction;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5097
  fixed_latency(2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5098
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5099
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5100
// Pipeline class for empty instructions.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5101
pipe_class pipe_class_empty() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5102
  single_instruction;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5103
  fixed_latency(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5104
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5105
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5106
// Pipeline class for compares.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5107
pipe_class pipe_class_compare() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5108
  single_instruction;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5109
  fixed_latency(16);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5110
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5111
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5112
// Pipeline class for traps.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5113
pipe_class pipe_class_trap() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5114
  single_instruction;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5115
  fixed_latency(100);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5116
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5117
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5118
// Pipeline class for memory operations.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5119
pipe_class pipe_class_memory() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5120
  single_instruction;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5121
  fixed_latency(16);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5122
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5123
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5124
// Pipeline class for call.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5125
pipe_class pipe_class_call() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5126
  single_instruction;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5127
  fixed_latency(100);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5128
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5129
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5130
// Define the class for the Nop node.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5131
define %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5132
   MachNop = pipe_class_default;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5133
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5134
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5135
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5136
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5137
//----------INSTRUCTIONS-------------------------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5138
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5139
// Naming of instructions:
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5140
//   opA_operB / opA_operB_operC:
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5141
//     Operation 'op' with one or two source operands 'oper'. Result
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5142
//     type is A, source operand types are B and C.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5143
//     Iff A == B == C, B and C are left out.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5144
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5145
// The instructions are ordered according to the following scheme:
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5146
//  - loads
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5147
//  - load constants
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5148
//  - prefetch
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5149
//  - store
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5150
//  - encode/decode
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5151
//  - membar
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5152
//  - conditional moves
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5153
//  - compare & swap
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5154
//  - arithmetic and logic operations
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5155
//    * int: Add, Sub, Mul, Div, Mod
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5156
//    * int: lShift, arShift, urShift, rot
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5157
//    * float: Add, Sub, Mul, Div
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5158
//    * and, or, xor ...
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5159
//  - register moves: float <-> int, reg <-> stack, repl
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5160
//  - cast (high level type cast, XtoP, castPP, castII, not_null etc.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5161
//  - conv (low level type cast requiring bit changes (sign extend etc)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5162
//  - compares, range & zero checks.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5163
//  - branches
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5164
//  - complex operations, intrinsics, min, max, replicate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5165
//  - lock
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5166
//  - Calls
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5167
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5168
// If there are similar instructions with different types they are sorted:
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5169
// int before float
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5170
// small before big
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5171
// signed before unsigned
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5172
// e.g., loadS before loadUS before loadI before loadF.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5173
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5174
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5175
//----------Load/Store Instructions--------------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5176
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5177
//----------Load Instructions--------------------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5178
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5179
// Converts byte to int.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5180
// As convB2I_reg, but without match rule.  The match rule of convB2I_reg
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5181
// reuses the 'amount' operand, but adlc expects that operand specification
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5182
// and operands in match rule are equivalent.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5183
instruct convB2I_reg_2(iRegIdst dst, iRegIsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5184
  effect(DEF dst, USE src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5185
  format %{ "EXTSB   $dst, $src \t// byte->int" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5186
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5187
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5188
    // TODO: PPC port $archOpcode(ppc64Opcode_extsb);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5189
    __ extsb($dst$$Register, $src$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5190
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5191
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5192
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5193
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5194
instruct loadUB_indirect(iRegIdst dst, indirectMemory mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5195
  // match-rule, false predicate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5196
  match(Set dst (LoadB mem));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5197
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5198
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5199
  format %{ "LBZ     $dst, $mem" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5200
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5201
  ins_encode( enc_lbz(dst, mem) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5202
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5203
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5204
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5205
instruct loadUB_indirect_ac(iRegIdst dst, indirectMemory mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5206
  // match-rule, false predicate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5207
  match(Set dst (LoadB mem));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5208
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5209
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5210
  format %{ "LBZ     $dst, $mem\n\t"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5211
            "TWI     $dst\n\t"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5212
            "ISYNC" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5213
  size(12);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5214
  ins_encode( enc_lbz_ac(dst, mem) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5215
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5216
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5217
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5218
// Load Byte (8bit signed). LoadB = LoadUB + ConvUB2B.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5219
instruct loadB_indirect_Ex(iRegIdst dst, indirectMemory mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5220
  match(Set dst (LoadB mem));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5221
  predicate(n->as_Load()->is_unordered() || followed_by_acquire(n));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5222
  ins_cost(MEMORY_REF_COST + DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5223
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5224
    iRegIdst tmp;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5225
    loadUB_indirect(tmp, mem);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5226
    convB2I_reg_2(dst, tmp);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5227
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5228
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5229
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5230
instruct loadB_indirect_ac_Ex(iRegIdst dst, indirectMemory mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5231
  match(Set dst (LoadB mem));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5232
  ins_cost(3*MEMORY_REF_COST + DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5233
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5234
    iRegIdst tmp;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5235
    loadUB_indirect_ac(tmp, mem);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5236
    convB2I_reg_2(dst, tmp);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5237
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5238
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5239
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5240
instruct loadUB_indOffset16(iRegIdst dst, indOffset16 mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5241
  // match-rule, false predicate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5242
  match(Set dst (LoadB mem));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5243
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5244
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5245
  format %{ "LBZ     $dst, $mem" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5246
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5247
  ins_encode( enc_lbz(dst, mem) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5248
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5249
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5250
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5251
instruct loadUB_indOffset16_ac(iRegIdst dst, indOffset16 mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5252
  // match-rule, false predicate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5253
  match(Set dst (LoadB mem));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5254
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5255
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5256
  format %{ "LBZ     $dst, $mem\n\t"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5257
            "TWI     $dst\n\t"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5258
            "ISYNC" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5259
  size(12);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5260
  ins_encode( enc_lbz_ac(dst, mem) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5261
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5262
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5263
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5264
// Load Byte (8bit signed). LoadB = LoadUB + ConvUB2B.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5265
instruct loadB_indOffset16_Ex(iRegIdst dst, indOffset16 mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5266
  match(Set dst (LoadB mem));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5267
  predicate(n->as_Load()->is_unordered() || followed_by_acquire(n));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5268
  ins_cost(MEMORY_REF_COST + DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5269
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5270
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5271
    iRegIdst tmp;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5272
    loadUB_indOffset16(tmp, mem);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5273
    convB2I_reg_2(dst, tmp);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5274
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5275
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5276
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5277
instruct loadB_indOffset16_ac_Ex(iRegIdst dst, indOffset16 mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5278
  match(Set dst (LoadB mem));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5279
  ins_cost(3*MEMORY_REF_COST + DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5280
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5281
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5282
    iRegIdst tmp;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5283
    loadUB_indOffset16_ac(tmp, mem);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5284
    convB2I_reg_2(dst, tmp);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5285
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5286
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5287
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5288
// Load Unsigned Byte (8bit UNsigned) into an int reg.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5289
instruct loadUB(iRegIdst dst, memory mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5290
  predicate(n->as_Load()->is_unordered() || followed_by_acquire(n));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5291
  match(Set dst (LoadUB mem));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5292
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5293
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5294
  format %{ "LBZ     $dst, $mem \t// byte, zero-extend to int" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5295
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5296
  ins_encode( enc_lbz(dst, mem) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5297
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5298
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5299
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5300
// Load  Unsigned Byte (8bit UNsigned) acquire.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5301
instruct loadUB_ac(iRegIdst dst, memory mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5302
  match(Set dst (LoadUB mem));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5303
  ins_cost(3*MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5304
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5305
  format %{ "LBZ     $dst, $mem \t// byte, zero-extend to int, acquire\n\t"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5306
            "TWI     $dst\n\t"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5307
            "ISYNC" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5308
  size(12);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5309
  ins_encode( enc_lbz_ac(dst, mem) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5310
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5311
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5312
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5313
// Load Unsigned Byte (8bit UNsigned) into a Long Register.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5314
instruct loadUB2L(iRegLdst dst, memory mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5315
  match(Set dst (ConvI2L (LoadUB mem)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5316
  predicate(_kids[0]->_leaf->as_Load()->is_unordered() || followed_by_acquire(_kids[0]->_leaf));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5317
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5318
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5319
  format %{ "LBZ     $dst, $mem \t// byte, zero-extend to long" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5320
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5321
  ins_encode( enc_lbz(dst, mem) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5322
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5323
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5324
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5325
instruct loadUB2L_ac(iRegLdst dst, memory mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5326
  match(Set dst (ConvI2L (LoadUB mem)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5327
  ins_cost(3*MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5328
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5329
  format %{ "LBZ     $dst, $mem \t// byte, zero-extend to long, acquire\n\t"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5330
            "TWI     $dst\n\t"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5331
            "ISYNC" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5332
  size(12);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5333
  ins_encode( enc_lbz_ac(dst, mem) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5334
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5335
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5336
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5337
// Load Short (16bit signed)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5338
instruct loadS(iRegIdst dst, memory mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5339
  match(Set dst (LoadS mem));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5340
  predicate(n->as_Load()->is_unordered() || followed_by_acquire(n));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5341
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5342
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5343
  format %{ "LHA     $dst, $mem" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5344
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5345
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5346
    // TODO: PPC port $archOpcode(ppc64Opcode_lha);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5347
    int Idisp = $mem$$disp + frame_slots_bias($mem$$base, ra_);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5348
    __ lha($dst$$Register, Idisp, $mem$$base$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5349
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5350
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5351
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5352
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5353
// Load Short (16bit signed) acquire.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5354
instruct loadS_ac(iRegIdst dst, memory mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5355
  match(Set dst (LoadS mem));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5356
  ins_cost(3*MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5357
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5358
  format %{ "LHA     $dst, $mem\t acquire\n\t"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5359
            "TWI     $dst\n\t"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5360
            "ISYNC" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5361
  size(12);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5362
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5363
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5364
    int Idisp = $mem$$disp + frame_slots_bias($mem$$base, ra_);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5365
    __ lha($dst$$Register, Idisp, $mem$$base$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5366
    __ twi_0($dst$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5367
    __ isync();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5368
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5369
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5370
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5371
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5372
// Load Char (16bit unsigned)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5373
instruct loadUS(iRegIdst dst, memory mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5374
  match(Set dst (LoadUS mem));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5375
  predicate(n->as_Load()->is_unordered() || followed_by_acquire(n));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5376
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5377
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5378
  format %{ "LHZ     $dst, $mem" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5379
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5380
  ins_encode( enc_lhz(dst, mem) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5381
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5382
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5383
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5384
// Load Char (16bit unsigned) acquire.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5385
instruct loadUS_ac(iRegIdst dst, memory mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5386
  match(Set dst (LoadUS mem));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5387
  ins_cost(3*MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5388
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5389
  format %{ "LHZ     $dst, $mem \t// acquire\n\t"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5390
            "TWI     $dst\n\t"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5391
            "ISYNC" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5392
  size(12);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5393
  ins_encode( enc_lhz_ac(dst, mem) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5394
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5395
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5396
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5397
// Load Unsigned Short/Char (16bit UNsigned) into a Long Register.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5398
instruct loadUS2L(iRegLdst dst, memory mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5399
  match(Set dst (ConvI2L (LoadUS mem)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5400
  predicate(_kids[0]->_leaf->as_Load()->is_unordered() || followed_by_acquire(_kids[0]->_leaf));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5401
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5402
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5403
  format %{ "LHZ     $dst, $mem \t// short, zero-extend to long" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5404
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5405
  ins_encode( enc_lhz(dst, mem) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5406
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5407
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5408
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5409
// Load Unsigned Short/Char (16bit UNsigned) into a Long Register acquire.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5410
instruct loadUS2L_ac(iRegLdst dst, memory mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5411
  match(Set dst (ConvI2L (LoadUS mem)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5412
  ins_cost(3*MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5413
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5414
  format %{ "LHZ     $dst, $mem \t// short, zero-extend to long, acquire\n\t"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5415
            "TWI     $dst\n\t"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5416
            "ISYNC" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5417
  size(12);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5418
  ins_encode( enc_lhz_ac(dst, mem) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5419
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5420
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5421
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5422
// Load Integer.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5423
instruct loadI(iRegIdst dst, memory mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5424
  match(Set dst (LoadI mem));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5425
  predicate(n->as_Load()->is_unordered() || followed_by_acquire(n));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5426
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5427
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5428
  format %{ "LWZ     $dst, $mem" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5429
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5430
  ins_encode( enc_lwz(dst, mem) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5431
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5432
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5433
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5434
// Load Integer acquire.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5435
instruct loadI_ac(iRegIdst dst, memory mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5436
  match(Set dst (LoadI mem));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5437
  ins_cost(3*MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5438
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5439
  format %{ "LWZ     $dst, $mem \t// load acquire\n\t"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5440
            "TWI     $dst\n\t"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5441
            "ISYNC" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5442
  size(12);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5443
  ins_encode( enc_lwz_ac(dst, mem) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5444
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5445
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5446
24349
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  5447
// Match loading integer and casting it to unsigned int in
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5448
// long register.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5449
// LoadI + ConvI2L + AndL 0xffffffff.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5450
instruct loadUI2L(iRegLdst dst, memory mem, immL_32bits mask) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5451
  match(Set dst (AndL (ConvI2L (LoadI mem)) mask));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5452
  predicate(_kids[0]->_kids[0]->_leaf->as_Load()->is_unordered());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5453
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5454
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5455
  format %{ "LWZ     $dst, $mem \t// zero-extend to long" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5456
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5457
  ins_encode( enc_lwz(dst, mem) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5458
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5459
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5460
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5461
// Match loading integer and casting it to long.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5462
instruct loadI2L(iRegLdst dst, memory mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5463
  match(Set dst (ConvI2L (LoadI mem)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5464
  predicate(_kids[0]->_leaf->as_Load()->is_unordered());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5465
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5466
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5467
  format %{ "LWA     $dst, $mem \t// loadI2L" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5468
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5469
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5470
    // TODO: PPC port $archOpcode(ppc64Opcode_lwa);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5471
    int Idisp = $mem$$disp + frame_slots_bias($mem$$base, ra_);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5472
    __ lwa($dst$$Register, Idisp, $mem$$base$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5473
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5474
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5475
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5476
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5477
// Match loading integer and casting it to long - acquire.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5478
instruct loadI2L_ac(iRegLdst dst, memory mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5479
  match(Set dst (ConvI2L (LoadI mem)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5480
  ins_cost(3*MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5481
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5482
  format %{ "LWA     $dst, $mem \t// loadI2L acquire"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5483
            "TWI     $dst\n\t"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5484
            "ISYNC" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5485
  size(12);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5486
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5487
    // TODO: PPC port $archOpcode(ppc64Opcode_lwa);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5488
    int Idisp = $mem$$disp + frame_slots_bias($mem$$base, ra_);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5489
    __ lwa($dst$$Register, Idisp, $mem$$base$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5490
    __ twi_0($dst$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5491
    __ isync();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5492
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5493
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5494
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5495
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5496
// Load Long - aligned
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5497
instruct loadL(iRegLdst dst, memoryAlg4 mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5498
  match(Set dst (LoadL mem));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5499
  predicate(n->as_Load()->is_unordered() || followed_by_acquire(n));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5500
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5501
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5502
  format %{ "LD      $dst, $mem \t// long" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5503
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5504
  ins_encode( enc_ld(dst, mem) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5505
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5506
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5507
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5508
// Load Long - aligned acquire.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5509
instruct loadL_ac(iRegLdst dst, memoryAlg4 mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5510
  match(Set dst (LoadL mem));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5511
  ins_cost(3*MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5512
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5513
  format %{ "LD      $dst, $mem \t// long acquire\n\t"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5514
            "TWI     $dst\n\t"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5515
            "ISYNC" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5516
  size(12);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5517
  ins_encode( enc_ld_ac(dst, mem) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5518
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5519
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5520
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5521
// Load Long - UNaligned
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5522
instruct loadL_unaligned(iRegLdst dst, memoryAlg4 mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5523
  match(Set dst (LoadL_unaligned mem));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5524
  // predicate(...) // Unaligned_ac is not needed (and wouldn't make sense).
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5525
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5526
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5527
  format %{ "LD      $dst, $mem \t// unaligned long" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5528
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5529
  ins_encode( enc_ld(dst, mem) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5530
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5531
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5532
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5533
// Load nodes for superwords
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5534
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5535
// Load Aligned Packed Byte
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5536
instruct loadV8(iRegLdst dst, memoryAlg4 mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5537
  predicate(n->as_LoadVector()->memory_size() == 8);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5538
  match(Set dst (LoadVector mem));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5539
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5540
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5541
  format %{ "LD      $dst, $mem \t// load 8-byte Vector" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5542
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5543
  ins_encode( enc_ld(dst, mem) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5544
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5545
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5546
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5547
// Load Range, range = array length (=jint)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5548
instruct loadRange(iRegIdst dst, memory mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5549
  match(Set dst (LoadRange mem));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5550
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5551
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5552
  format %{ "LWZ     $dst, $mem \t// range" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5553
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5554
  ins_encode( enc_lwz(dst, mem) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5555
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5556
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5557
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5558
// Load Compressed Pointer
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5559
instruct loadN(iRegNdst dst, memory mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5560
  match(Set dst (LoadN mem));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5561
  predicate(n->as_Load()->is_unordered() || followed_by_acquire(n));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5562
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5563
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5564
  format %{ "LWZ     $dst, $mem \t// load compressed ptr" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5565
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5566
  ins_encode( enc_lwz(dst, mem) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5567
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5568
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5569
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5570
// Load Compressed Pointer acquire.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5571
instruct loadN_ac(iRegNdst dst, memory mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5572
  match(Set dst (LoadN mem));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5573
  ins_cost(3*MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5574
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5575
  format %{ "LWZ     $dst, $mem \t// load acquire compressed ptr\n\t"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5576
            "TWI     $dst\n\t"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5577
            "ISYNC" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5578
  size(12);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5579
  ins_encode( enc_lwz_ac(dst, mem) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5580
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5581
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5582
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5583
// Load Compressed Pointer and decode it if narrow_oop_shift == 0.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5584
instruct loadN2P_unscaled(iRegPdst dst, memory mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5585
  match(Set dst (DecodeN (LoadN mem)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5586
  predicate(_kids[0]->_leaf->as_Load()->is_unordered() && Universe::narrow_oop_shift() == 0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5587
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5588
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5589
  format %{ "LWZ     $dst, $mem \t// DecodeN (unscaled)" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5590
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5591
  ins_encode( enc_lwz(dst, mem) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5592
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5593
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5594
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5595
// Load Pointer
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5596
instruct loadP(iRegPdst dst, memoryAlg4 mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5597
  match(Set dst (LoadP mem));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5598
  predicate(n->as_Load()->is_unordered() || followed_by_acquire(n));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5599
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5600
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5601
  format %{ "LD      $dst, $mem \t// ptr" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5602
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5603
  ins_encode( enc_ld(dst, mem) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5604
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5605
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5606
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5607
// Load Pointer acquire.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5608
instruct loadP_ac(iRegPdst dst, memoryAlg4 mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5609
  match(Set dst (LoadP mem));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5610
  ins_cost(3*MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5611
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5612
  format %{ "LD      $dst, $mem \t// ptr acquire\n\t"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5613
            "TWI     $dst\n\t"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5614
            "ISYNC" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5615
  size(12);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5616
  ins_encode( enc_ld_ac(dst, mem) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5617
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5618
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5619
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5620
// LoadP + CastP2L
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5621
instruct loadP2X(iRegLdst dst, memoryAlg4 mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5622
  match(Set dst (CastP2X (LoadP mem)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5623
  predicate(_kids[0]->_leaf->as_Load()->is_unordered());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5624
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5625
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5626
  format %{ "LD      $dst, $mem \t// ptr + p2x" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5627
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5628
  ins_encode( enc_ld(dst, mem) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5629
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5630
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5631
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5632
// Load compressed klass pointer.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5633
instruct loadNKlass(iRegNdst dst, memory mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5634
  match(Set dst (LoadNKlass mem));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5635
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5636
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5637
  format %{ "LWZ     $dst, $mem \t// compressed klass ptr" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5638
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5639
  ins_encode( enc_lwz(dst, mem) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5640
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5641
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5642
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5643
//// Load compressed klass and decode it if narrow_klass_shift == 0.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5644
//// TODO: will narrow_klass_shift ever be 0?
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5645
//instruct decodeNKlass2Klass(iRegPdst dst, memory mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5646
//  match(Set dst (DecodeNKlass (LoadNKlass mem)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5647
//  predicate(false /* TODO: PPC port Universe::narrow_klass_shift() == 0*);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5648
//  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5649
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5650
//  format %{ "LWZ     $dst, $mem \t// DecodeNKlass (unscaled)" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5651
//  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5652
//  ins_encode( enc_lwz(dst, mem) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5653
//  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5654
//%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5655
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5656
// Load Klass Pointer
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5657
instruct loadKlass(iRegPdst dst, memoryAlg4 mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5658
  match(Set dst (LoadKlass mem));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5659
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5660
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5661
  format %{ "LD      $dst, $mem \t// klass ptr" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5662
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5663
  ins_encode( enc_ld(dst, mem) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5664
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5665
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5666
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5667
// Load Float
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5668
instruct loadF(regF dst, memory mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5669
  match(Set dst (LoadF mem));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5670
  predicate(n->as_Load()->is_unordered() || followed_by_acquire(n));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5671
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5672
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5673
  format %{ "LFS     $dst, $mem" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5674
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5675
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5676
    // TODO: PPC port $archOpcode(ppc64Opcode_lfs);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5677
    int Idisp = $mem$$disp + frame_slots_bias($mem$$base, ra_);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5678
    __ lfs($dst$$FloatRegister, Idisp, $mem$$base$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5679
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5680
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5681
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5682
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5683
// Load Float acquire.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5684
instruct loadF_ac(regF dst, memory mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5685
  match(Set dst (LoadF mem));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5686
  ins_cost(3*MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5687
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5688
  format %{ "LFS     $dst, $mem \t// acquire\n\t"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5689
            "FCMPU   cr0, $dst, $dst\n\t"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5690
            "BNE     cr0, next\n"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5691
            "next:\n\t"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5692
            "ISYNC" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5693
  size(16);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5694
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5695
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5696
    int Idisp = $mem$$disp + frame_slots_bias($mem$$base, ra_);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5697
    Label next;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5698
    __ lfs($dst$$FloatRegister, Idisp, $mem$$base$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5699
    __ fcmpu(CCR0, $dst$$FloatRegister, $dst$$FloatRegister);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5700
    __ bne(CCR0, next);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5701
    __ bind(next);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5702
    __ isync();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5703
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5704
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5705
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5706
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5707
// Load Double - aligned
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5708
instruct loadD(regD dst, memory mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5709
  match(Set dst (LoadD mem));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5710
  predicate(n->as_Load()->is_unordered() || followed_by_acquire(n));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5711
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5712
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5713
  format %{ "LFD     $dst, $mem" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5714
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5715
  ins_encode( enc_lfd(dst, mem) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5716
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5717
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5718
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5719
// Load Double - aligned acquire.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5720
instruct loadD_ac(regD dst, memory mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5721
  match(Set dst (LoadD mem));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5722
  ins_cost(3*MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5723
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5724
  format %{ "LFD     $dst, $mem \t// acquire\n\t"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5725
            "FCMPU   cr0, $dst, $dst\n\t"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5726
            "BNE     cr0, next\n"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5727
            "next:\n\t"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5728
            "ISYNC" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5729
  size(16);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5730
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5731
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5732
    int Idisp = $mem$$disp + frame_slots_bias($mem$$base, ra_);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5733
    Label next;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5734
    __ lfd($dst$$FloatRegister, Idisp, $mem$$base$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5735
    __ fcmpu(CCR0, $dst$$FloatRegister, $dst$$FloatRegister);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5736
    __ bne(CCR0, next);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5737
    __ bind(next);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5738
    __ isync();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5739
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5740
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5741
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5742
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5743
// Load Double - UNaligned
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5744
instruct loadD_unaligned(regD dst, memory mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5745
  match(Set dst (LoadD_unaligned mem));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5746
  // predicate(...) // Unaligned_ac is not needed (and wouldn't make sense).
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5747
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5748
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5749
  format %{ "LFD     $dst, $mem" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5750
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5751
  ins_encode( enc_lfd(dst, mem) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5752
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5753
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5754
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5755
//----------Constants--------------------------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5756
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5757
// Load MachConstantTableBase: add hi offset to global toc.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5758
// TODO: Handle hidden register r29 in bundler!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5759
instruct loadToc_hi(iRegLdst dst) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5760
  effect(DEF dst);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5761
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5762
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5763
  format %{ "ADDIS   $dst, R29, DISP.hi \t// load TOC hi" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5764
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5765
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5766
    // TODO: PPC port $archOpcode(ppc64Opcode_addis);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5767
    __ calculate_address_from_global_toc_hi16only($dst$$Register, __ method_toc());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5768
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5769
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5770
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5771
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5772
// Load MachConstantTableBase: add lo offset to global toc.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5773
instruct loadToc_lo(iRegLdst dst, iRegLdst src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5774
  effect(DEF dst, USE src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5775
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5776
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5777
  format %{ "ADDI    $dst, $src, DISP.lo \t// load TOC lo" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5778
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5779
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5780
    // TODO: PPC port $archOpcode(ppc64Opcode_ori);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5781
    __ calculate_address_from_global_toc_lo16only($dst$$Register, __ method_toc());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5782
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5783
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5784
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5785
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5786
// Load 16-bit integer constant 0xssss????
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5787
instruct loadConI16(iRegIdst dst, immI16 src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5788
  match(Set dst src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5789
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5790
  format %{ "LI      $dst, $src" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5791
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5792
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5793
    // TODO: PPC port $archOpcode(ppc64Opcode_addi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5794
    __ li($dst$$Register, (int)((short)($src$$constant & 0xFFFF)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5795
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5796
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5797
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5798
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5799
// Load integer constant 0x????0000
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5800
instruct loadConIhi16(iRegIdst dst, immIhi16 src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5801
  match(Set dst src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5802
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5803
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5804
  format %{ "LIS     $dst, $src.hi" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5805
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5806
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5807
    // TODO: PPC port $archOpcode(ppc64Opcode_addis);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5808
    // Lis sign extends 16-bit src then shifts it 16 bit to the left.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5809
    __ lis($dst$$Register, (int)((short)(($src$$constant & 0xFFFF0000) >> 16)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5810
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5811
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5812
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5813
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5814
// Part 2 of loading 32 bit constant: hi16 is is src1 (properly shifted
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5815
// and sign extended), this adds the low 16 bits.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5816
instruct loadConI32_lo16(iRegIdst dst, iRegIsrc src1, immI16 src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5817
  // no match-rule, false predicate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5818
  effect(DEF dst, USE src1, USE src2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5819
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5820
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5821
  format %{ "ORI     $dst, $src1.hi, $src2.lo" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5822
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5823
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5824
    // TODO: PPC port $archOpcode(ppc64Opcode_ori);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5825
    __ ori($dst$$Register, $src1$$Register, ($src2$$constant) & 0xFFFF);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5826
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5827
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5828
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5829
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5830
instruct loadConI_Ex(iRegIdst dst, immI src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5831
  match(Set dst src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5832
  ins_cost(DEFAULT_COST*2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5833
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5834
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5835
    // Would like to use $src$$constant.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5836
    immI16 srcLo %{ _opnds[1]->constant() %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5837
    // srcHi can be 0000 if srcLo sign-extends to a negative number.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5838
    immIhi16 srcHi %{ _opnds[1]->constant() %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5839
    iRegIdst tmpI;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5840
    loadConIhi16(tmpI, srcHi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5841
    loadConI32_lo16(dst, tmpI, srcLo);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5842
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5843
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5844
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5845
// No constant pool entries required.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5846
instruct loadConL16(iRegLdst dst, immL16 src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5847
  match(Set dst src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5848
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5849
  format %{ "LI      $dst, $src \t// long" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5850
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5851
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5852
    // TODO: PPC port $archOpcode(ppc64Opcode_addi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5853
    __ li($dst$$Register, (int)((short) ($src$$constant & 0xFFFF)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5854
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5855
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5856
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5857
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5858
// Load long constant 0xssssssss????0000
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5859
instruct loadConL32hi16(iRegLdst dst, immL32hi16 src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5860
  match(Set dst src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5861
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5862
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5863
  format %{ "LIS     $dst, $src.hi \t// long" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5864
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5865
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5866
    // TODO: PPC port $archOpcode(ppc64Opcode_addis);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5867
    __ lis($dst$$Register, (int)((short)(($src$$constant & 0xFFFF0000) >> 16)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5868
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5869
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5870
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5871
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5872
// To load a 32 bit constant: merge lower 16 bits into already loaded
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5873
// high 16 bits.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5874
instruct loadConL32_lo16(iRegLdst dst, iRegLsrc src1, immL16 src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5875
  // no match-rule, false predicate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5876
  effect(DEF dst, USE src1, USE src2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5877
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5878
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5879
  format %{ "ORI     $dst, $src1, $src2.lo" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5880
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5881
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5882
    // TODO: PPC port $archOpcode(ppc64Opcode_ori);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5883
    __ ori($dst$$Register, $src1$$Register, ($src2$$constant) & 0xFFFF);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5884
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5885
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5886
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5887
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5888
// Load 32-bit long constant
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5889
instruct loadConL32_Ex(iRegLdst dst, immL32 src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5890
  match(Set dst src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5891
  ins_cost(DEFAULT_COST*2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5892
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5893
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5894
    // Would like to use $src$$constant.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5895
    immL16     srcLo %{ _opnds[1]->constant() /*& 0x0000FFFFL */%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5896
    // srcHi can be 0000 if srcLo sign-extends to a negative number.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5897
    immL32hi16 srcHi %{ _opnds[1]->constant() /*& 0xFFFF0000L */%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5898
    iRegLdst tmpL;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5899
    loadConL32hi16(tmpL, srcHi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5900
    loadConL32_lo16(dst, tmpL, srcLo);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5901
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5902
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5903
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5904
// Load long constant 0x????000000000000.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5905
instruct loadConLhighest16_Ex(iRegLdst dst, immLhighest16 src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5906
  match(Set dst src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5907
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5908
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5909
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5910
    immL32hi16 srcHi %{ _opnds[1]->constant() >> 32 /*& 0xFFFF0000L */%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5911
    immI shift32 %{ 32 %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5912
    iRegLdst tmpL;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5913
    loadConL32hi16(tmpL, srcHi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5914
    lshiftL_regL_immI(dst, tmpL, shift32);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5915
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5916
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5917
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5918
// Expand node for constant pool load: small offset.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5919
instruct loadConL(iRegLdst dst, immL src, iRegLdst toc) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5920
  effect(DEF dst, USE src, USE toc);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5921
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5922
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5923
  ins_num_consts(1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5924
  // Needed so that CallDynamicJavaDirect can compute the address of this
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5925
  // instruction for relocation.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5926
  ins_field_cbuf_insts_offset(int);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5927
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5928
  format %{ "LD      $dst, offset, $toc \t// load long $src from TOC" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5929
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5930
  ins_encode( enc_load_long_constL(dst, src, toc) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5931
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5932
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5933
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5934
// Expand node for constant pool load: large offset.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5935
instruct loadConL_hi(iRegLdst dst, immL src, iRegLdst toc) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5936
  effect(DEF dst, USE src, USE toc);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5937
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5938
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5939
  ins_num_consts(1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5940
  ins_field_const_toc_offset(int);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5941
  // Needed so that CallDynamicJavaDirect can compute the address of this
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5942
  // instruction for relocation.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5943
  ins_field_cbuf_insts_offset(int);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5944
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5945
  format %{ "ADDIS   $dst, $toc, offset \t// load long $src from TOC (hi)" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5946
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5947
  ins_encode( enc_load_long_constL_hi(dst, toc, src) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5948
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5949
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5950
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5951
// Expand node for constant pool load: large offset.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5952
// No constant pool entries required.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5953
instruct loadConL_lo(iRegLdst dst, immL src, iRegLdst base) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5954
  effect(DEF dst, USE src, USE base);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5955
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5956
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5957
  ins_field_const_toc_offset_hi_node(loadConL_hiNode*);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5958
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5959
  format %{ "LD      $dst, offset, $base \t// load long $src from TOC (lo)" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5960
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5961
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5962
    // TODO: PPC port $archOpcode(ppc64Opcode_ld);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5963
    int offset = ra_->C->in_scratch_emit_size() ? 0 : _const_toc_offset_hi_node->_const_toc_offset;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5964
    __ ld($dst$$Register, MacroAssembler::largeoffset_si16_si16_lo(offset), $base$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5965
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5966
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5967
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5968
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5969
// Load long constant from constant table. Expand in case of
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5970
// offset > 16 bit is needed.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5971
// Adlc adds toc node MachConstantTableBase.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5972
instruct loadConL_Ex(iRegLdst dst, immL src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5973
  match(Set dst src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5974
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5975
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5976
  format %{ "LD      $dst, offset, $constanttablebase\t// load long $src from table, postalloc expanded" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5977
  // We can not inline the enc_class for the expand as that does not support constanttablebase.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5978
  postalloc_expand( postalloc_expand_load_long_constant(dst, src, constanttablebase) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5979
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5980
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5981
// Load NULL as compressed oop.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5982
instruct loadConN0(iRegNdst dst, immN_0 src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5983
  match(Set dst src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5984
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5985
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5986
  format %{ "LI      $dst, $src \t// compressed ptr" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5987
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5988
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5989
    // TODO: PPC port $archOpcode(ppc64Opcode_addi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5990
    __ li($dst$$Register, 0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5991
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5992
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5993
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5994
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5995
// Load hi part of compressed oop constant.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5996
instruct loadConN_hi(iRegNdst dst, immN src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5997
  effect(DEF dst, USE src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5998
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5999
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6000
  format %{ "LIS     $dst, $src \t// narrow oop hi" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6001
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6002
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6003
    // TODO: PPC port $archOpcode(ppc64Opcode_addis);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6004
    __ lis($dst$$Register, (int)(short)(($src$$constant >> 16) & 0xffff));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6005
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6006
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6007
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6008
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6009
// Add lo part of compressed oop constant to already loaded hi part.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6010
instruct loadConN_lo(iRegNdst dst, iRegNsrc src1, immN src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6011
  effect(DEF dst, USE src1, USE src2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6012
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6013
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6014
  format %{ "ORI     $dst, $src1, $src2 \t// narrow oop lo" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6015
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6016
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6017
    // TODO: PPC port $archOpcode(ppc64Opcode_addi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6018
    assert(__ oop_recorder() != NULL, "this assembler needs an OopRecorder");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6019
    int oop_index = __ oop_recorder()->find_index((jobject)$src2$$constant);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6020
    RelocationHolder rspec = oop_Relocation::spec(oop_index);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6021
    __ relocate(rspec, 1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6022
    __ ori($dst$$Register, $src1$$Register, $src2$$constant & 0xffff);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6023
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6024
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6025
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6026
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6027
// Needed to postalloc expand loadConN: ConN is loaded as ConI
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6028
// leaving the upper 32 bits with sign-extension bits.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6029
// This clears these bits: dst = src & 0xFFFFFFFF.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6030
// TODO: Eventually call this maskN_regN_FFFFFFFF.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6031
instruct clearMs32b(iRegNdst dst, iRegNsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6032
  effect(DEF dst, USE src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6033
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6034
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6035
  format %{ "MASK    $dst, $src, 0xFFFFFFFF" %} // mask
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6036
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6037
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6038
    // TODO: PPC port $archOpcode(ppc64Opcode_rldicl);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6039
    __ clrldi($dst$$Register, $src$$Register, 0x20);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6040
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6041
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6042
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6043
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6044
// Loading ConN must be postalloc expanded so that edges between
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6045
// the nodes are safe. They may not interfere with a safepoint.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6046
// GL TODO: This needs three instructions: better put this into the constant pool.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6047
instruct loadConN_Ex(iRegNdst dst, immN src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6048
  match(Set dst src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6049
  ins_cost(DEFAULT_COST*2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6050
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6051
  format %{ "LoadN   $dst, $src \t// postalloc expanded" %} // mask
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6052
  postalloc_expand %{
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  6053
    MachNode *m1 = new loadConN_hiNode();
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  6054
    MachNode *m2 = new loadConN_loNode();
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  6055
    MachNode *m3 = new clearMs32bNode();
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6056
    m1->add_req(NULL);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6057
    m2->add_req(NULL, m1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6058
    m3->add_req(NULL, m2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6059
    m1->_opnds[0] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6060
    m1->_opnds[1] = op_src;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6061
    m2->_opnds[0] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6062
    m2->_opnds[1] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6063
    m2->_opnds[2] = op_src;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6064
    m3->_opnds[0] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6065
    m3->_opnds[1] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6066
    ra_->set_pair(m1->_idx, ra_->get_reg_second(this), ra_->get_reg_first(this));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6067
    ra_->set_pair(m2->_idx, ra_->get_reg_second(this), ra_->get_reg_first(this));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6068
    ra_->set_pair(m3->_idx, ra_->get_reg_second(this), ra_->get_reg_first(this));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6069
    nodes->push(m1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6070
    nodes->push(m2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6071
    nodes->push(m3);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6072
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6073
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6074
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6075
instruct loadConNKlass_hi(iRegNdst dst, immNKlass src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6076
  effect(DEF dst, USE src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6077
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6078
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6079
  format %{ "LIS     $dst, $src \t// narrow oop hi" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6080
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6081
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6082
    // TODO: PPC port $archOpcode(ppc64Opcode_addis);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6083
    intptr_t Csrc = Klass::encode_klass((Klass *)$src$$constant);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6084
    __ lis($dst$$Register, (int)(short)((Csrc >> 16) & 0xffff));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6085
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6086
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6087
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6088
24349
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  6089
// This needs a match rule so that build_oop_map knows this is
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6090
// not a narrow oop.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6091
instruct loadConNKlass_lo(iRegNdst dst, immNKlass_NM src1, iRegNsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6092
  match(Set dst src1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6093
  effect(TEMP src2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6094
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6095
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6096
  format %{ "ADDI    $dst, $src1, $src2 \t// narrow oop lo" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6097
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6098
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6099
    // TODO: PPC port $archOpcode(ppc64Opcode_addi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6100
    intptr_t Csrc = Klass::encode_klass((Klass *)$src1$$constant);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6101
    assert(__ oop_recorder() != NULL, "this assembler needs an OopRecorder");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6102
    int klass_index = __ oop_recorder()->find_index((Klass *)$src1$$constant);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6103
    RelocationHolder rspec = metadata_Relocation::spec(klass_index);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6104
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6105
    __ relocate(rspec, 1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6106
    __ ori($dst$$Register, $src2$$Register, Csrc & 0xffff);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6107
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6108
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6109
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6110
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6111
// Loading ConNKlass must be postalloc expanded so that edges between
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6112
// the nodes are safe. They may not interfere with a safepoint.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6113
instruct loadConNKlass_Ex(iRegNdst dst, immNKlass src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6114
  match(Set dst src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6115
  ins_cost(DEFAULT_COST*2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6116
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6117
  format %{ "LoadN   $dst, $src \t// postalloc expanded" %} // mask
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6118
  postalloc_expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6119
    // Load high bits into register. Sign extended.
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  6120
    MachNode *m1 = new loadConNKlass_hiNode();
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6121
    m1->add_req(NULL);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6122
    m1->_opnds[0] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6123
    m1->_opnds[1] = op_src;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6124
    ra_->set_pair(m1->_idx, ra_->get_reg_second(this), ra_->get_reg_first(this));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6125
    nodes->push(m1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6126
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6127
    MachNode *m2 = m1;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6128
    if (!Assembler::is_uimm((jlong)Klass::encode_klass((Klass *)op_src->constant()), 31)) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6129
      // Value might be 1-extended. Mask out these bits.
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  6130
      m2 = new clearMs32bNode();
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6131
      m2->add_req(NULL, m1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6132
      m2->_opnds[0] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6133
      m2->_opnds[1] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6134
      ra_->set_pair(m2->_idx, ra_->get_reg_second(this), ra_->get_reg_first(this));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6135
      nodes->push(m2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6136
    }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6137
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  6138
    MachNode *m3 = new loadConNKlass_loNode();
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6139
    m3->add_req(NULL, m2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6140
    m3->_opnds[0] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6141
    m3->_opnds[1] = op_src;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6142
    m3->_opnds[2] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6143
    ra_->set_pair(m3->_idx, ra_->get_reg_second(this), ra_->get_reg_first(this));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6144
    nodes->push(m3);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6145
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6146
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6147
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6148
// 0x1 is used in object initialization (initial object header).
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6149
// No constant pool entries required.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6150
instruct loadConP0or1(iRegPdst dst, immP_0or1 src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6151
  match(Set dst src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6152
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6153
  format %{ "LI      $dst, $src \t// ptr" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6154
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6155
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6156
    // TODO: PPC port $archOpcode(ppc64Opcode_addi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6157
    __ li($dst$$Register, (int)((short)($src$$constant & 0xFFFF)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6158
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6159
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6160
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6161
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6162
// Expand node for constant pool load: small offset.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6163
// The match rule is needed to generate the correct bottom_type(),
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6164
// however this node should never match. The use of predicate is not
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6165
// possible since ADLC forbids predicates for chain rules. The higher
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6166
// costs do not prevent matching in this case. For that reason the
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6167
// operand immP_NM with predicate(false) is used.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6168
instruct loadConP(iRegPdst dst, immP_NM src, iRegLdst toc) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6169
  match(Set dst src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6170
  effect(TEMP toc);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6171
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6172
  ins_num_consts(1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6173
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6174
  format %{ "LD      $dst, offset, $toc \t// load ptr $src from TOC" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6175
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6176
  ins_encode( enc_load_long_constP(dst, src, toc) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6177
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6178
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6179
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6180
// Expand node for constant pool load: large offset.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6181
instruct loadConP_hi(iRegPdst dst, immP_NM src, iRegLdst toc) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6182
  effect(DEF dst, USE src, USE toc);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6183
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6184
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6185
  ins_num_consts(1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6186
  ins_field_const_toc_offset(int);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6187
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6188
  format %{ "ADDIS   $dst, $toc, offset \t// load ptr $src from TOC (hi)" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6189
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6190
  ins_encode( enc_load_long_constP_hi(dst, src, toc) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6191
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6192
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6193
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6194
// Expand node for constant pool load: large offset.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6195
instruct loadConP_lo(iRegPdst dst, immP_NM src, iRegLdst base) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6196
  match(Set dst src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6197
  effect(TEMP base);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6198
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6199
  ins_field_const_toc_offset_hi_node(loadConP_hiNode*);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6200
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6201
  format %{ "LD      $dst, offset, $base \t// load ptr $src from TOC (lo)" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6202
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6203
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6204
    // TODO: PPC port $archOpcode(ppc64Opcode_ld);
22865
3b8857d7b3cc 8030863: PPC64: (part 220): ConstantTableBase for calls between args and jvms
goetz
parents: 22861
diff changeset
  6205
    int offset = ra_->C->in_scratch_emit_size() ? 0 : _const_toc_offset_hi_node->_const_toc_offset;
3b8857d7b3cc 8030863: PPC64: (part 220): ConstantTableBase for calls between args and jvms
goetz
parents: 22861
diff changeset
  6206
    __ ld($dst$$Register, MacroAssembler::largeoffset_si16_si16_lo(offset), $base$$Register);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6207
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6208
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6209
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6210
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6211
// Load pointer constant from constant table. Expand in case an
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6212
// offset > 16 bit is needed.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6213
// Adlc adds toc node MachConstantTableBase.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6214
instruct loadConP_Ex(iRegPdst dst, immP src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6215
  match(Set dst src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6216
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6217
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6218
  // This rule does not use "expand" because then
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6219
  // the result type is not known to be an Oop.  An ADLC
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6220
  // enhancement will be needed to make that work - not worth it!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6221
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6222
  // If this instruction rematerializes, it prolongs the live range
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6223
  // of the toc node, causing illegal graphs.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6224
  // assert(edge_from_to(_reg_node[reg_lo],def)) fails in verify_good_schedule().
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6225
  ins_cannot_rematerialize(true);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6226
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6227
  format %{ "LD    $dst, offset, $constanttablebase \t//  load ptr $src from table, postalloc expanded" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6228
  postalloc_expand( postalloc_expand_load_ptr_constant(dst, src, constanttablebase) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6229
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6230
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6231
// Expand node for constant pool load: small offset.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6232
instruct loadConF(regF dst, immF src, iRegLdst toc) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6233
  effect(DEF dst, USE src, USE toc);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6234
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6235
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6236
  ins_num_consts(1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6237
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6238
  format %{ "LFS     $dst, offset, $toc \t// load float $src from TOC" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6239
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6240
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6241
    // TODO: PPC port $archOpcode(ppc64Opcode_lfs);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6242
    address float_address = __ float_constant($src$$constant);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6243
    __ lfs($dst$$FloatRegister, __ offset_to_method_toc(float_address), $toc$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6244
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6245
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6246
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6247
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6248
// Expand node for constant pool load: large offset.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6249
instruct loadConFComp(regF dst, immF src, iRegLdst toc) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6250
  effect(DEF dst, USE src, USE toc);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6251
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6252
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6253
  ins_num_consts(1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6254
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6255
  format %{ "ADDIS   $toc, $toc, offset_hi\n\t"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6256
            "LFS     $dst, offset_lo, $toc \t// load float $src from TOC (hi/lo)\n\t"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6257
            "ADDIS   $toc, $toc, -offset_hi"%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6258
  size(12);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6259
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6260
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6261
    FloatRegister Rdst    = $dst$$FloatRegister;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6262
    Register Rtoc         = $toc$$Register;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6263
    address float_address = __ float_constant($src$$constant);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6264
    int offset            = __ offset_to_method_toc(float_address);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6265
    int hi = (offset + (1<<15))>>16;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6266
    int lo = offset - hi * (1<<16);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6267
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6268
    __ addis(Rtoc, Rtoc, hi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6269
    __ lfs(Rdst, lo, Rtoc);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6270
    __ addis(Rtoc, Rtoc, -hi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6271
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6272
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6273
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6274
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6275
// Adlc adds toc node MachConstantTableBase.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6276
instruct loadConF_Ex(regF dst, immF src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6277
  match(Set dst src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6278
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6279
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6280
  // See loadConP.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6281
  ins_cannot_rematerialize(true);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6282
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6283
  format %{ "LFS     $dst, offset, $constanttablebase \t// load $src from table, postalloc expanded" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6284
  postalloc_expand( postalloc_expand_load_float_constant(dst, src, constanttablebase) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6285
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6286
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6287
// Expand node for constant pool load: small offset.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6288
instruct loadConD(regD dst, immD src, iRegLdst toc) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6289
  effect(DEF dst, USE src, USE toc);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6290
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6291
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6292
  ins_num_consts(1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6293
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6294
  format %{ "LFD     $dst, offset, $toc \t// load double $src from TOC" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6295
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6296
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6297
    // TODO: PPC port $archOpcode(ppc64Opcode_lfd);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6298
    int offset =  __ offset_to_method_toc(__ double_constant($src$$constant));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6299
    __ lfd($dst$$FloatRegister, offset, $toc$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6300
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6301
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6302
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6303
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6304
// Expand node for constant pool load: large offset.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6305
instruct loadConDComp(regD dst, immD src, iRegLdst toc) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6306
  effect(DEF dst, USE src, USE toc);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6307
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6308
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6309
  ins_num_consts(1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6310
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6311
  format %{ "ADDIS   $toc, $toc, offset_hi\n\t"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6312
            "LFD     $dst, offset_lo, $toc \t// load double $src from TOC (hi/lo)\n\t"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6313
            "ADDIS   $toc, $toc, -offset_hi" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6314
  size(12);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6315
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6316
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6317
    FloatRegister Rdst    = $dst$$FloatRegister;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6318
    Register      Rtoc    = $toc$$Register;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6319
    address float_address = __ double_constant($src$$constant);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6320
    int offset            = __ offset_to_method_toc(float_address);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6321
    int hi = (offset + (1<<15))>>16;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6322
    int lo = offset - hi * (1<<16);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6323
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6324
    __ addis(Rtoc, Rtoc, hi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6325
    __ lfd(Rdst, lo, Rtoc);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6326
    __ addis(Rtoc, Rtoc, -hi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6327
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6328
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6329
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6330
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6331
// Adlc adds toc node MachConstantTableBase.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6332
instruct loadConD_Ex(regD dst, immD src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6333
  match(Set dst src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6334
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6335
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6336
  // See loadConP.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6337
  ins_cannot_rematerialize(true);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6338
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6339
  format %{ "ConD    $dst, offset, $constanttablebase \t// load $src from table, postalloc expanded" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6340
  postalloc_expand( postalloc_expand_load_double_constant(dst, src, constanttablebase) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6341
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6342
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6343
// Prefetch instructions.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6344
// Must be safe to execute with invalid address (cannot fault).
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6345
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6346
instruct prefetchr(indirectMemory mem, iRegLsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6347
  match(PrefetchRead (AddP mem src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6348
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6349
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6350
  format %{ "PREFETCH $mem, 0, $src \t// Prefetch read-many" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6351
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6352
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6353
    // TODO: PPC port $archOpcode(ppc64Opcode_dcbt);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6354
    __ dcbt($src$$Register, $mem$$base$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6355
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6356
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6357
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6358
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6359
instruct prefetchr_no_offset(indirectMemory mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6360
  match(PrefetchRead mem);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6361
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6362
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6363
  format %{ "PREFETCH $mem" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6364
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6365
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6366
    // TODO: PPC port $archOpcode(ppc64Opcode_dcbt);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6367
    __ dcbt($mem$$base$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6368
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6369
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6370
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6371
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6372
instruct prefetchw(indirectMemory mem, iRegLsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6373
  match(PrefetchWrite (AddP mem src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6374
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6375
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6376
  format %{ "PREFETCH $mem, 2, $src \t// Prefetch write-many (and read)" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6377
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6378
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6379
    // TODO: PPC port $archOpcode(ppc64Opcode_dcbtst);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6380
    __ dcbtst($src$$Register, $mem$$base$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6381
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6382
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6383
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6384
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6385
instruct prefetchw_no_offset(indirectMemory mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6386
  match(PrefetchWrite mem);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6387
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6388
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6389
  format %{ "PREFETCH $mem" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6390
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6391
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6392
    // TODO: PPC port $archOpcode(ppc64Opcode_dcbtst);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6393
    __ dcbtst($mem$$base$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6394
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6395
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6396
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6397
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6398
// Special prefetch versions which use the dcbz instruction.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6399
instruct prefetch_alloc_zero(indirectMemory mem, iRegLsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6400
  match(PrefetchAllocation (AddP mem src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6401
  predicate(AllocatePrefetchStyle == 3);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6402
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6403
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6404
  format %{ "PREFETCH $mem, 2, $src \t// Prefetch write-many with zero" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6405
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6406
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6407
    // TODO: PPC port $archOpcode(ppc64Opcode_dcbtst);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6408
    __ dcbz($src$$Register, $mem$$base$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6409
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6410
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6411
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6412
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6413
instruct prefetch_alloc_zero_no_offset(indirectMemory mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6414
  match(PrefetchAllocation mem);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6415
  predicate(AllocatePrefetchStyle == 3);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6416
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6417
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6418
  format %{ "PREFETCH $mem, 2 \t// Prefetch write-many with zero" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6419
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6420
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6421
    // TODO: PPC port $archOpcode(ppc64Opcode_dcbtst);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6422
    __ dcbz($mem$$base$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6423
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6424
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6425
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6426
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6427
instruct prefetch_alloc(indirectMemory mem, iRegLsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6428
  match(PrefetchAllocation (AddP mem src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6429
  predicate(AllocatePrefetchStyle != 3);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6430
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6431
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6432
  format %{ "PREFETCH $mem, 2, $src \t// Prefetch write-many" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6433
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6434
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6435
    // TODO: PPC port $archOpcode(ppc64Opcode_dcbtst);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6436
    __ dcbtst($src$$Register, $mem$$base$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6437
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6438
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6439
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6440
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6441
instruct prefetch_alloc_no_offset(indirectMemory mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6442
  match(PrefetchAllocation mem);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6443
  predicate(AllocatePrefetchStyle != 3);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6444
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6445
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6446
  format %{ "PREFETCH $mem, 2 \t// Prefetch write-many" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6447
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6448
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6449
    // TODO: PPC port $archOpcode(ppc64Opcode_dcbtst);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6450
    __ dcbtst($mem$$base$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6451
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6452
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6453
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6454
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6455
//----------Store Instructions-------------------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6456
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6457
// Store Byte
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6458
instruct storeB(memory mem, iRegIsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6459
  match(Set mem (StoreB mem src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6460
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6461
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6462
  format %{ "STB     $src, $mem \t// byte" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6463
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6464
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6465
    // TODO: PPC port $archOpcode(ppc64Opcode_stb);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6466
    int Idisp = $mem$$disp + frame_slots_bias($mem$$base, ra_);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6467
    __ stb($src$$Register, Idisp, $mem$$base$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6468
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6469
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6470
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6471
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6472
// Store Char/Short
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6473
instruct storeC(memory mem, iRegIsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6474
  match(Set mem (StoreC mem src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6475
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6476
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6477
  format %{ "STH     $src, $mem \t// short" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6478
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6479
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6480
    // TODO: PPC port $archOpcode(ppc64Opcode_sth);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6481
    int Idisp = $mem$$disp + frame_slots_bias($mem$$base, ra_);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6482
    __ sth($src$$Register, Idisp, $mem$$base$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6483
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6484
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6485
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6486
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6487
// Store Integer
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6488
instruct storeI(memory mem, iRegIsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6489
  match(Set mem (StoreI mem src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6490
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6491
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6492
  format %{ "STW     $src, $mem" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6493
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6494
  ins_encode( enc_stw(src, mem) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6495
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6496
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6497
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6498
// ConvL2I + StoreI.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6499
instruct storeI_convL2I(memory mem, iRegLsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6500
  match(Set mem (StoreI mem (ConvL2I src)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6501
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6502
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6503
  format %{ "STW     l2i($src), $mem" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6504
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6505
  ins_encode( enc_stw(src, mem) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6506
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6507
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6508
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6509
// Store Long
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6510
instruct storeL(memoryAlg4 mem, iRegLsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6511
  match(Set mem (StoreL mem src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6512
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6513
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6514
  format %{ "STD     $src, $mem \t// long" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6515
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6516
  ins_encode( enc_std(src, mem) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6517
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6518
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6519
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6520
// Store super word nodes.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6521
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6522
// Store Aligned Packed Byte long register to memory
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6523
instruct storeA8B(memoryAlg4 mem, iRegLsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6524
  predicate(n->as_StoreVector()->memory_size() == 8);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6525
  match(Set mem (StoreVector mem src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6526
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6527
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6528
  format %{ "STD     $mem, $src \t// packed8B" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6529
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6530
  ins_encode( enc_std(src, mem) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6531
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6532
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6533
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6534
// Store Compressed Oop
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6535
instruct storeN(memory dst, iRegN_P2N src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6536
  match(Set dst (StoreN dst src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6537
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6538
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6539
  format %{ "STW     $src, $dst \t// compressed oop" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6540
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6541
  ins_encode( enc_stw(src, dst) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6542
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6543
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6544
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6545
// Store Compressed KLass
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6546
instruct storeNKlass(memory dst, iRegN_P2N src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6547
  match(Set dst (StoreNKlass dst src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6548
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6549
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6550
  format %{ "STW     $src, $dst \t// compressed klass" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6551
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6552
  ins_encode( enc_stw(src, dst) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6553
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6554
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6555
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6556
// Store Pointer
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6557
instruct storeP(memoryAlg4 dst, iRegPsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6558
  match(Set dst (StoreP dst src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6559
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6560
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6561
  format %{ "STD     $src, $dst \t// ptr" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6562
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6563
  ins_encode( enc_std(src, dst) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6564
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6565
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6566
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6567
// Store Float
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6568
instruct storeF(memory mem, regF src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6569
  match(Set mem (StoreF mem src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6570
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6571
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6572
  format %{ "STFS    $src, $mem" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6573
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6574
  ins_encode( enc_stfs(src, mem) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6575
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6576
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6577
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6578
// Store Double
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6579
instruct storeD(memory mem, regD src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6580
  match(Set mem (StoreD mem src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6581
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6582
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6583
  format %{ "STFD    $src, $mem" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6584
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6585
  ins_encode( enc_stfd(src, mem) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6586
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6587
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6588
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6589
//----------Store Instructions With Zeros--------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6590
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6591
// Card-mark for CMS garbage collection.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6592
// This cardmark does an optimization so that it must not always
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6593
// do a releasing store. For this, it gets the address of
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6594
// CMSCollectorCardTableModRefBSExt::_requires_release as input.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6595
// (Using releaseFieldAddr in the match rule is a hack.)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6596
instruct storeCM_CMS(memory mem, iRegLdst releaseFieldAddr) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6597
  match(Set mem (StoreCM mem releaseFieldAddr));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6598
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6599
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6600
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6601
  // See loadConP.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6602
  ins_cannot_rematerialize(true);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6603
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6604
  format %{ "STB     #0, $mem \t// CMS card-mark byte (must be 0!), checking requires_release in [$releaseFieldAddr]" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6605
  ins_encode( enc_cms_card_mark(mem, releaseFieldAddr) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6606
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6607
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6608
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6609
// Card-mark for CMS garbage collection.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6610
// This cardmark does an optimization so that it must not always
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6611
// do a releasing store. For this, it needs the constant address of
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6612
// CMSCollectorCardTableModRefBSExt::_requires_release.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6613
// This constant address is split off here by expand so we can use
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6614
// adlc / matcher functionality to load it from the constant section.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6615
instruct storeCM_CMS_ExEx(memory mem, immI_0 zero) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6616
  match(Set mem (StoreCM mem zero));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6617
  predicate(UseConcMarkSweepGC);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6618
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6619
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6620
    immL baseImm %{ 0 /* TODO: PPC port (jlong)CMSCollectorCardTableModRefBSExt::requires_release_address() */ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6621
    iRegLdst releaseFieldAddress;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6622
    loadConL_Ex(releaseFieldAddress, baseImm);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6623
    storeCM_CMS(mem, releaseFieldAddress);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6624
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6625
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6626
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6627
instruct storeCM_G1(memory mem, immI_0 zero) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6628
  match(Set mem (StoreCM mem zero));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6629
  predicate(UseG1GC);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6630
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6631
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6632
  ins_cannot_rematerialize(true);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6633
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6634
  format %{ "STB     #0, $mem \t// CMS card-mark byte store (G1)" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6635
  size(8);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6636
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6637
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6638
    __ li(R0, 0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6639
    //__ release(); // G1: oops are allowed to get visible after dirty marking
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6640
    guarantee($mem$$base$$Register != R1_SP, "use frame_slots_bias");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6641
    __ stb(R0, $mem$$disp, $mem$$base$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6642
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6643
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6644
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6645
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6646
// Convert oop pointer into compressed form.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6647
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6648
// Nodes for postalloc expand.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6649
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6650
// Shift node for expand.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6651
instruct encodeP_shift(iRegNdst dst, iRegNsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6652
  // The match rule is needed to make it a 'MachTypeNode'!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6653
  match(Set dst (EncodeP src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6654
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6655
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6656
  format %{ "SRDI    $dst, $src, 3 \t// encode" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6657
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6658
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6659
    // TODO: PPC port $archOpcode(ppc64Opcode_rldicl);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6660
    __ srdi($dst$$Register, $src$$Register, Universe::narrow_oop_shift() & 0x3f);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6661
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6662
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6663
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6664
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6665
// Add node for expand.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6666
instruct encodeP_sub(iRegPdst dst, iRegPdst src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6667
  // The match rule is needed to make it a 'MachTypeNode'!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6668
  match(Set dst (EncodeP src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6669
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6670
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6671
  format %{ "SUB     $dst, $src, oop_base \t// encode" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6672
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6673
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6674
    // TODO: PPC port $archOpcode(ppc64Opcode_subf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6675
    __ subf($dst$$Register, R30, $src$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6676
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6677
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6678
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6679
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6680
// Conditional sub base.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6681
instruct cond_sub_base(iRegNdst dst, flagsReg crx, iRegPsrc src1) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6682
  // The match rule is needed to make it a 'MachTypeNode'!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6683
  match(Set dst (EncodeP (Binary crx src1)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6684
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6685
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6686
  ins_variable_size_depending_on_alignment(true);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6687
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6688
  format %{ "BEQ     $crx, done\n\t"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6689
            "SUB     $dst, $src1, R30 \t// encode: subtract base if != NULL\n"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6690
            "done:" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6691
  size(false /* TODO: PPC PORT (InsertEndGroupPPC64 && Compile::current()->do_hb_scheduling())*/ ? 12 : 8);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6692
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6693
    // TODO: PPC port $archOpcode(ppc64Opcode_cmove);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6694
    Label done;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6695
    __ beq($crx$$CondRegister, done);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6696
    __ subf($dst$$Register, R30, $src1$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6697
    // TODO PPC port __ endgroup_if_needed(_size == 12);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6698
    __ bind(done);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6699
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6700
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6701
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6702
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6703
// Power 7 can use isel instruction
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6704
instruct cond_set_0_oop(iRegNdst dst, flagsReg crx, iRegPsrc src1) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6705
  // The match rule is needed to make it a 'MachTypeNode'!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6706
  match(Set dst (EncodeP (Binary crx src1)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6707
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6708
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6709
  format %{ "CMOVE   $dst, $crx eq, 0, $src1 \t// encode: preserve 0" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6710
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6711
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6712
    // This is a Power7 instruction for which no machine description exists.
24349
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  6713
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6714
    __ isel_0($dst$$Register, $crx$$CondRegister, Assembler::equal, $src1$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6715
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6716
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6717
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6718
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6719
// base != 0
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6720
// 32G aligned narrow oop base.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6721
instruct encodeP_32GAligned(iRegNdst dst, iRegPsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6722
  match(Set dst (EncodeP src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6723
  predicate(false /* TODO: PPC port Universe::narrow_oop_base_disjoint()*/);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6724
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6725
  format %{ "EXTRDI  $dst, $src, #32, #3 \t// encode with 32G aligned base" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6726
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6727
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6728
    // TODO: PPC port $archOpcode(ppc64Opcode_rldicl);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6729
    __ rldicl($dst$$Register, $src$$Register, 64-Universe::narrow_oop_shift(), 32);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6730
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6731
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6732
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6733
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6734
// shift != 0, base != 0
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6735
instruct encodeP_Ex(iRegNdst dst, flagsReg crx, iRegPsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6736
  match(Set dst (EncodeP src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6737
  effect(TEMP crx);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6738
  predicate(n->bottom_type()->make_ptr()->ptr() != TypePtr::NotNull &&
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6739
            Universe::narrow_oop_shift() != 0 &&
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6740
            true /* TODO: PPC port Universe::narrow_oop_base_overlaps()*/);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6741
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6742
  format %{ "EncodeP $dst, $crx, $src \t// postalloc expanded" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6743
  postalloc_expand( postalloc_expand_encode_oop(dst, src, crx));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6744
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6745
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6746
// shift != 0, base != 0
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6747
instruct encodeP_not_null_Ex(iRegNdst dst, iRegPsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6748
  match(Set dst (EncodeP src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6749
  predicate(n->bottom_type()->make_ptr()->ptr() == TypePtr::NotNull &&
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6750
            Universe::narrow_oop_shift() != 0 &&
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6751
            true /* TODO: PPC port Universe::narrow_oop_base_overlaps()*/);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6752
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6753
  format %{ "EncodeP $dst, $src\t// $src != Null, postalloc expanded" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6754
  postalloc_expand( postalloc_expand_encode_oop_not_null(dst, src) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6755
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6756
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6757
// shift != 0, base == 0
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6758
// TODO: This is the same as encodeP_shift. Merge!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6759
instruct encodeP_not_null_base_null(iRegNdst dst, iRegPsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6760
  match(Set dst (EncodeP src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6761
  predicate(Universe::narrow_oop_shift() != 0 &&
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6762
            Universe::narrow_oop_base() ==0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6763
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6764
  format %{ "SRDI    $dst, $src, #3 \t// encodeP, $src != NULL" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6765
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6766
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6767
    // TODO: PPC port $archOpcode(ppc64Opcode_rldicl);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6768
    __ srdi($dst$$Register, $src$$Register, Universe::narrow_oop_shift() & 0x3f);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6769
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6770
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6771
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6772
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6773
// Compressed OOPs with narrow_oop_shift == 0.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6774
// shift == 0, base == 0
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6775
instruct encodeP_narrow_oop_shift_0(iRegNdst dst, iRegPsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6776
  match(Set dst (EncodeP src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6777
  predicate(Universe::narrow_oop_shift() == 0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6778
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6779
  format %{ "MR      $dst, $src \t// Ptr->Narrow" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6780
  // variable size, 0 or 4.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6781
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6782
    // TODO: PPC port $archOpcode(ppc64Opcode_or);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6783
    __ mr_if_needed($dst$$Register, $src$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6784
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6785
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6786
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6787
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6788
// Decode nodes.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6789
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6790
// Shift node for expand.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6791
instruct decodeN_shift(iRegPdst dst, iRegPsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6792
  // The match rule is needed to make it a 'MachTypeNode'!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6793
  match(Set dst (DecodeN src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6794
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6795
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6796
  format %{ "SLDI    $dst, $src, #3 \t// DecodeN" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6797
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6798
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6799
    // TODO: PPC port $archOpcode(ppc64Opcode_rldicr);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6800
    __ sldi($dst$$Register, $src$$Register, Universe::narrow_oop_shift());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6801
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6802
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6803
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6804
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6805
// Add node for expand.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6806
instruct decodeN_add(iRegPdst dst, iRegPdst src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6807
  // The match rule is needed to make it a 'MachTypeNode'!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6808
  match(Set dst (DecodeN src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6809
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6810
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6811
  format %{ "ADD     $dst, $src, R30 \t// DecodeN, add oop base" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6812
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6813
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6814
    // TODO: PPC port $archOpcode(ppc64Opcode_add);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6815
    __ add($dst$$Register, $src$$Register, R30);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6816
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6817
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6818
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6819
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6820
// conditianal add base for expand
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6821
instruct cond_add_base(iRegPdst dst, flagsReg crx, iRegPsrc src1) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6822
  // The match rule is needed to make it a 'MachTypeNode'!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6823
  // NOTICE that the rule is nonsense - we just have to make sure that:
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6824
  //  - _matrule->_rChild->_opType == "DecodeN" (see InstructForm::captures_bottom_type() in formssel.cpp)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6825
  //  - we have to match 'crx' to avoid an "illegal USE of non-input: flagsReg crx" error in ADLC.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6826
  match(Set dst (DecodeN (Binary crx src1)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6827
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6828
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6829
  ins_variable_size_depending_on_alignment(true);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6830
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6831
  format %{ "BEQ     $crx, done\n\t"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6832
            "ADD     $dst, $src1, R30 \t// DecodeN: add oop base if $src1 != NULL\n"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6833
            "done:" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6834
  size(false /* TODO: PPC PORT (InsertEndGroupPPC64 && Compile::current()->do_hb_scheduling()) */? 12 : 8);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6835
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6836
    // TODO: PPC port $archOpcode(ppc64Opcode_cmove);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6837
    Label done;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6838
    __ beq($crx$$CondRegister, done);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6839
    __ add($dst$$Register, $src1$$Register, R30);
22865
3b8857d7b3cc 8030863: PPC64: (part 220): ConstantTableBase for calls between args and jvms
goetz
parents: 22861
diff changeset
  6840
    // TODO PPC port  __ endgroup_if_needed(_size == 12);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6841
    __ bind(done);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6842
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6843
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6844
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6845
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6846
instruct cond_set_0_ptr(iRegPdst dst, flagsReg crx, iRegPsrc src1) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6847
  // The match rule is needed to make it a 'MachTypeNode'!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6848
  // NOTICE that the rule is nonsense - we just have to make sure that:
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6849
  //  - _matrule->_rChild->_opType == "DecodeN" (see InstructForm::captures_bottom_type() in formssel.cpp)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6850
  //  - we have to match 'crx' to avoid an "illegal USE of non-input: flagsReg crx" error in ADLC.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6851
  match(Set dst (DecodeN (Binary crx src1)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6852
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6853
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6854
  format %{ "CMOVE   $dst, $crx eq, 0, $src1 \t// decode: preserve 0" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6855
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6856
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6857
    // This is a Power7 instruction for which no machine description exists.
24349
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  6858
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6859
    __ isel_0($dst$$Register, $crx$$CondRegister, Assembler::equal, $src1$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6860
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6861
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6862
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6863
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6864
//  shift != 0, base != 0
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6865
instruct decodeN_Ex(iRegPdst dst, iRegNsrc src, flagsReg crx) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6866
  match(Set dst (DecodeN src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6867
  predicate((n->bottom_type()->is_oopptr()->ptr() != TypePtr::NotNull &&
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6868
             n->bottom_type()->is_oopptr()->ptr() != TypePtr::Constant) &&
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6869
            Universe::narrow_oop_shift() != 0 &&
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6870
            Universe::narrow_oop_base() != 0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6871
  effect(TEMP crx);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6872
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6873
  format %{ "DecodeN $dst, $src \t// Kills $crx, postalloc expanded" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6874
  postalloc_expand( postalloc_expand_decode_oop(dst, src, crx) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6875
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6876
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6877
// shift != 0, base == 0
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6878
instruct decodeN_nullBase(iRegPdst dst, iRegNsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6879
  match(Set dst (DecodeN src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6880
  predicate(Universe::narrow_oop_shift() != 0 &&
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6881
            Universe::narrow_oop_base() == 0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6882
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6883
  format %{ "SLDI    $dst, $src, #3 \t// DecodeN (zerobased)" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6884
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6885
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6886
    // TODO: PPC port $archOpcode(ppc64Opcode_rldicr);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6887
    __ sldi($dst$$Register, $src$$Register, Universe::narrow_oop_shift());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6888
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6889
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6890
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6891
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6892
// src != 0, shift != 0, base != 0
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6893
instruct decodeN_notNull_addBase_Ex(iRegPdst dst, iRegNsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6894
  match(Set dst (DecodeN src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6895
  predicate((n->bottom_type()->is_oopptr()->ptr() == TypePtr::NotNull ||
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6896
             n->bottom_type()->is_oopptr()->ptr() == TypePtr::Constant) &&
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6897
            Universe::narrow_oop_shift() != 0 &&
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6898
            Universe::narrow_oop_base() != 0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6899
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6900
  format %{ "DecodeN $dst, $src \t// $src != NULL, postalloc expanded" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6901
  postalloc_expand( postalloc_expand_decode_oop_not_null(dst, src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6902
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6903
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6904
// Compressed OOPs with narrow_oop_shift == 0.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6905
instruct decodeN_unscaled(iRegPdst dst, iRegNsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6906
  match(Set dst (DecodeN src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6907
  predicate(Universe::narrow_oop_shift() == 0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6908
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6909
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6910
  format %{ "MR      $dst, $src \t// DecodeN (unscaled)" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6911
  // variable size, 0 or 4.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6912
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6913
    // TODO: PPC port $archOpcode(ppc64Opcode_or);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6914
    __ mr_if_needed($dst$$Register, $src$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6915
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6916
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6917
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6918
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6919
// Convert compressed oop into int for vectors alignment masking.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6920
instruct decodeN2I_unscaled(iRegIdst dst, iRegNsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6921
  match(Set dst (ConvL2I (CastP2X (DecodeN src))));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6922
  predicate(Universe::narrow_oop_shift() == 0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6923
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6924
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6925
  format %{ "MR      $dst, $src \t// (int)DecodeN (unscaled)" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6926
  // variable size, 0 or 4.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6927
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6928
    // TODO: PPC port $archOpcode(ppc64Opcode_or);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6929
    __ mr_if_needed($dst$$Register, $src$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6930
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6931
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6932
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6933
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6934
// Convert klass pointer into compressed form.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6935
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6936
// Nodes for postalloc expand.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6937
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6938
// Shift node for expand.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6939
instruct encodePKlass_shift(iRegNdst dst, iRegNsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6940
  // The match rule is needed to make it a 'MachTypeNode'!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6941
  match(Set dst (EncodePKlass src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6942
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6943
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6944
  format %{ "SRDI    $dst, $src, 3 \t// encode" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6945
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6946
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6947
    // TODO: PPC port $archOpcode(ppc64Opcode_rldicl);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6948
    __ srdi($dst$$Register, $src$$Register, Universe::narrow_klass_shift());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6949
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6950
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6951
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6952
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6953
// Add node for expand.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6954
instruct encodePKlass_sub_base(iRegPdst dst, iRegLsrc base, iRegPdst src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6955
  // The match rule is needed to make it a 'MachTypeNode'!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6956
  match(Set dst (EncodePKlass (Binary base src)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6957
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6958
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6959
  format %{ "SUB     $dst, $base, $src \t// encode" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6960
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6961
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6962
    // TODO: PPC port $archOpcode(ppc64Opcode_subf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6963
    __ subf($dst$$Register, $base$$Register, $src$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6964
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6965
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6966
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6967
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6968
// base != 0
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6969
// 32G aligned narrow oop base.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6970
instruct encodePKlass_32GAligned(iRegNdst dst, iRegPsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6971
  match(Set dst (EncodePKlass src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6972
  predicate(false /* TODO: PPC port Universe::narrow_klass_base_disjoint()*/);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6973
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6974
  format %{ "EXTRDI  $dst, $src, #32, #3 \t// encode with 32G aligned base" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6975
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6976
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6977
    // TODO: PPC port $archOpcode(ppc64Opcode_rldicl);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6978
    __ rldicl($dst$$Register, $src$$Register, 64-Universe::narrow_oop_shift(), 32);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6979
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6980
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6981
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6982
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6983
// shift != 0, base != 0
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6984
instruct encodePKlass_not_null_Ex(iRegNdst dst, iRegLsrc base, iRegPsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6985
  match(Set dst (EncodePKlass (Binary base src)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6986
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6987
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6988
  format %{ "EncodePKlass $dst, $src\t// $src != Null, postalloc expanded" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6989
  postalloc_expand %{
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  6990
    encodePKlass_sub_baseNode *n1 = new encodePKlass_sub_baseNode();
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6991
    n1->add_req(n_region, n_base, n_src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6992
    n1->_opnds[0] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6993
    n1->_opnds[1] = op_base;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6994
    n1->_opnds[2] = op_src;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6995
    n1->_bottom_type = _bottom_type;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6996
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  6997
    encodePKlass_shiftNode *n2 = new encodePKlass_shiftNode();
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6998
    n2->add_req(n_region, n1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6999
    n2->_opnds[0] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7000
    n2->_opnds[1] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7001
    n2->_bottom_type = _bottom_type;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7002
    ra_->set_pair(n1->_idx, ra_->get_reg_second(this), ra_->get_reg_first(this));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7003
    ra_->set_pair(n2->_idx, ra_->get_reg_second(this), ra_->get_reg_first(this));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7004
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7005
    nodes->push(n1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7006
    nodes->push(n2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7007
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7008
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7009
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7010
// shift != 0, base != 0
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7011
instruct encodePKlass_not_null_ExEx(iRegNdst dst, iRegPsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7012
  match(Set dst (EncodePKlass src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7013
  //predicate(Universe::narrow_klass_shift() != 0 &&
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7014
  //          true /* TODO: PPC port Universe::narrow_klass_base_overlaps()*/);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7015
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7016
  //format %{ "EncodePKlass $dst, $src\t// $src != Null, postalloc expanded" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7017
  ins_cost(DEFAULT_COST*2);  // Don't count constant.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7018
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7019
    immL baseImm %{ (jlong)(intptr_t)Universe::narrow_klass_base() %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7020
    iRegLdst base;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7021
    loadConL_Ex(base, baseImm);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7022
    encodePKlass_not_null_Ex(dst, base, src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7023
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7024
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7025
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7026
// Decode nodes.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7027
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7028
// Shift node for expand.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7029
instruct decodeNKlass_shift(iRegPdst dst, iRegPsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7030
  // The match rule is needed to make it a 'MachTypeNode'!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7031
  match(Set dst (DecodeNKlass src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7032
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7033
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7034
  format %{ "SLDI    $dst, $src, #3 \t// DecodeNKlass" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7035
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7036
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7037
    // TODO: PPC port $archOpcode(ppc64Opcode_rldicr);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7038
    __ sldi($dst$$Register, $src$$Register, Universe::narrow_klass_shift());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7039
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7040
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7041
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7042
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7043
// Add node for expand.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7044
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7045
instruct decodeNKlass_add_base(iRegPdst dst, iRegLsrc base, iRegPdst src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7046
  // The match rule is needed to make it a 'MachTypeNode'!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7047
  match(Set dst (DecodeNKlass (Binary base src)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7048
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7049
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7050
  format %{ "ADD     $dst, $base, $src \t// DecodeNKlass, add klass base" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7051
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7052
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7053
    // TODO: PPC port $archOpcode(ppc64Opcode_add);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7054
    __ add($dst$$Register, $base$$Register, $src$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7055
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7056
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7057
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7058
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7059
// src != 0, shift != 0, base != 0
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7060
instruct decodeNKlass_notNull_addBase_Ex(iRegPdst dst, iRegLsrc base, iRegNsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7061
  match(Set dst (DecodeNKlass (Binary base src)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7062
  //effect(kill src); // We need a register for the immediate result after shifting.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7063
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7064
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7065
  format %{ "DecodeNKlass $dst =  $base + ($src << 3) \t// $src != NULL, postalloc expanded" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7066
  postalloc_expand %{
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  7067
    decodeNKlass_add_baseNode *n1 = new decodeNKlass_add_baseNode();
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7068
    n1->add_req(n_region, n_base, n_src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7069
    n1->_opnds[0] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7070
    n1->_opnds[1] = op_base;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7071
    n1->_opnds[2] = op_src;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7072
    n1->_bottom_type = _bottom_type;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7073
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  7074
    decodeNKlass_shiftNode *n2 = new decodeNKlass_shiftNode();
24349
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  7075
    n2->add_req(n_region, n1);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7076
    n2->_opnds[0] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7077
    n2->_opnds[1] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7078
    n2->_bottom_type = _bottom_type;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7079
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7080
    ra_->set_pair(n1->_idx, ra_->get_reg_second(this), ra_->get_reg_first(this));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7081
    ra_->set_pair(n2->_idx, ra_->get_reg_second(this), ra_->get_reg_first(this));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7082
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7083
    nodes->push(n1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7084
    nodes->push(n2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7085
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7086
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7087
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7088
// src != 0, shift != 0, base != 0
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7089
instruct decodeNKlass_notNull_addBase_ExEx(iRegPdst dst, iRegNsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7090
  match(Set dst (DecodeNKlass src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7091
  // predicate(Universe::narrow_klass_shift() != 0 &&
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7092
  //           Universe::narrow_klass_base() != 0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7093
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7094
  //format %{ "DecodeNKlass $dst, $src \t// $src != NULL, expanded" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7095
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7096
  ins_cost(DEFAULT_COST*2);  // Don't count constant.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7097
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7098
    // We add first, then we shift. Like this, we can get along with one register less.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7099
    // But we have to load the base pre-shifted.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7100
    immL baseImm %{ (jlong)((intptr_t)Universe::narrow_klass_base() >> Universe::narrow_klass_shift()) %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7101
    iRegLdst base;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7102
    loadConL_Ex(base, baseImm);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7103
    decodeNKlass_notNull_addBase_Ex(dst, base, src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7104
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7105
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7106
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7107
//----------MemBar Instructions-----------------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7108
// Memory barrier flavors
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7109
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7110
instruct membar_acquire() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7111
  match(LoadFence);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7112
  ins_cost(4*MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7113
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7114
  format %{ "MEMBAR-acquire" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7115
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7116
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7117
    // TODO: PPC port $archOpcode(ppc64Opcode_lwsync);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7118
    __ acquire();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7119
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7120
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7121
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7122
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7123
instruct unnecessary_membar_acquire() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7124
  match(MemBarAcquire);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7125
  ins_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7126
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7127
  format %{ " -- \t// redundant MEMBAR-acquire - empty" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7128
  size(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7129
  ins_encode( /*empty*/ );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7130
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7131
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7132
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7133
instruct membar_acquire_lock() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7134
  match(MemBarAcquireLock);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7135
  ins_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7136
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7137
  format %{ " -- \t// redundant MEMBAR-acquire - empty (acquire as part of CAS in prior FastLock)" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7138
  size(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7139
  ins_encode( /*empty*/ );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7140
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7141
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7142
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7143
instruct membar_release() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7144
  match(MemBarRelease);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7145
  match(StoreFence);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7146
  ins_cost(4*MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7147
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7148
  format %{ "MEMBAR-release" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7149
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7150
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7151
    // TODO: PPC port $archOpcode(ppc64Opcode_lwsync);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7152
    __ release();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7153
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7154
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7155
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7156
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7157
instruct membar_storestore() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7158
  match(MemBarStoreStore);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7159
  ins_cost(4*MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7160
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7161
  format %{ "MEMBAR-store-store" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7162
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7163
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7164
    // TODO: PPC port $archOpcode(ppc64Opcode_lwsync);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7165
    __ membar(Assembler::StoreStore);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7166
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7167
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7168
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7169
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7170
instruct membar_release_lock() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7171
  match(MemBarReleaseLock);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7172
  ins_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7173
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7174
  format %{ " -- \t// redundant MEMBAR-release - empty (release in FastUnlock)" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7175
  size(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7176
  ins_encode( /*empty*/ );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7177
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7178
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7179
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7180
instruct membar_volatile() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7181
  match(MemBarVolatile);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7182
  ins_cost(4*MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7183
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7184
  format %{ "MEMBAR-volatile" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7185
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7186
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7187
    // TODO: PPC port $archOpcode(ppc64Opcode_sync);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7188
    __ fence();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7189
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7190
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7191
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7192
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7193
// This optimization is wrong on PPC. The following pattern is not supported:
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7194
//  MemBarVolatile
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7195
//   ^        ^
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7196
//   |        |
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7197
//  CtrlProj MemProj
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7198
//   ^        ^
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7199
//   |        |
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7200
//   |       Load
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7201
//   |
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7202
//  MemBarVolatile
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7203
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7204
//  The first MemBarVolatile could get optimized out! According to
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7205
//  Vladimir, this pattern can not occur on Oracle platforms.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7206
//  However, it does occur on PPC64 (because of membars in
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7207
//  inline_unsafe_load_store).
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7208
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7209
// Add this node again if we found a good solution for inline_unsafe_load_store().
24349
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  7210
// Don't forget to look at the implementation of post_store_load_barrier again,
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7211
// we did other fixes in that method.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7212
//instruct unnecessary_membar_volatile() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7213
//  match(MemBarVolatile);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7214
//  predicate(Matcher::post_store_load_barrier(n));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7215
//  ins_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7216
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7217
//  format %{ " -- \t// redundant MEMBAR-volatile - empty" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7218
//  size(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7219
//  ins_encode( /*empty*/ );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7220
//  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7221
//%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7222
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7223
instruct membar_CPUOrder() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7224
  match(MemBarCPUOrder);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7225
  ins_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7226
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7227
  format %{ " -- \t// MEMBAR-CPUOrder - empty: PPC64 processors are self-consistent." %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7228
  size(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7229
  ins_encode( /*empty*/ );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7230
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7231
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7232
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7233
//----------Conditional Move---------------------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7234
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7235
// Cmove using isel.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7236
instruct cmovI_reg_isel(cmpOp cmp, flagsReg crx, iRegIdst dst, iRegIsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7237
  match(Set dst (CMoveI (Binary cmp crx) (Binary dst src)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7238
  predicate(VM_Version::has_isel());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7239
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7240
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7241
  format %{ "CMOVE   $cmp, $crx, $dst, $src\n\t" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7242
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7243
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7244
    // This is a Power7 instruction for which no machine description
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7245
    // exists. Anyways, the scheduler should be off on Power7.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7246
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7247
    int cc        = $cmp$$cmpcode;
24349
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  7248
    __ isel($dst$$Register, $crx$$CondRegister,
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7249
            (Assembler::Condition)(cc & 3), /*invert*/((~cc) & 8), $src$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7250
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7251
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7252
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7253
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7254
instruct cmovI_reg(cmpOp cmp, flagsReg crx, iRegIdst dst, iRegIsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7255
  match(Set dst (CMoveI (Binary cmp crx) (Binary dst src)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7256
  predicate(!VM_Version::has_isel());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7257
  ins_cost(DEFAULT_COST+BRANCH_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7258
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7259
  ins_variable_size_depending_on_alignment(true);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7260
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7261
  format %{ "CMOVE   $cmp, $crx, $dst, $src\n\t" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7262
  // Worst case is branch + move + stop, no stop without scheduler
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7263
  size(false /* TODO: PPC PORT Compile::current()->do_hb_scheduling()*/ ? 12 : 8);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7264
  ins_encode( enc_cmove_reg(dst, crx, src, cmp) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7265
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7266
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7267
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7268
instruct cmovI_imm(cmpOp cmp, flagsReg crx, iRegIdst dst, immI16 src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7269
  match(Set dst (CMoveI (Binary cmp crx) (Binary dst src)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7270
  ins_cost(DEFAULT_COST+BRANCH_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7271
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7272
  ins_variable_size_depending_on_alignment(true);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7273
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7274
  format %{ "CMOVE   $cmp, $crx, $dst, $src\n\t" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7275
  // Worst case is branch + move + stop, no stop without scheduler
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7276
  size(false /* TODO: PPC PORT Compile::current()->do_hb_scheduling()*/ ? 12 : 8);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7277
  ins_encode( enc_cmove_imm(dst, crx, src, cmp) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7278
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7279
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7280
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7281
// Cmove using isel.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7282
instruct cmovL_reg_isel(cmpOp cmp, flagsReg crx, iRegLdst dst, iRegLsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7283
  match(Set dst (CMoveL (Binary cmp crx) (Binary dst src)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7284
  predicate(VM_Version::has_isel());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7285
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7286
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7287
  format %{ "CMOVE   $cmp, $crx, $dst, $src\n\t" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7288
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7289
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7290
    // This is a Power7 instruction for which no machine description
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7291
    // exists. Anyways, the scheduler should be off on Power7.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7292
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7293
    int cc        = $cmp$$cmpcode;
24349
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  7294
    __ isel($dst$$Register, $crx$$CondRegister,
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7295
            (Assembler::Condition)(cc & 3), /*invert*/((~cc) & 8), $src$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7296
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7297
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7298
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7299
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7300
instruct cmovL_reg(cmpOp cmp, flagsReg crx, iRegLdst dst, iRegLsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7301
  match(Set dst (CMoveL (Binary cmp crx) (Binary dst src)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7302
  predicate(!VM_Version::has_isel());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7303
  ins_cost(DEFAULT_COST+BRANCH_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7304
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7305
  ins_variable_size_depending_on_alignment(true);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7306
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7307
  format %{ "CMOVE   $cmp, $crx, $dst, $src\n\t" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7308
  // Worst case is branch + move + stop, no stop without scheduler.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7309
  size(false /* TODO: PPC PORT Compile::current()->do_hb_scheduling()*/ ? 12 : 8);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7310
  ins_encode( enc_cmove_reg(dst, crx, src, cmp) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7311
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7312
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7313
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7314
instruct cmovL_imm(cmpOp cmp, flagsReg crx, iRegLdst dst, immL16 src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7315
  match(Set dst (CMoveL (Binary cmp crx) (Binary dst src)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7316
  ins_cost(DEFAULT_COST+BRANCH_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7317
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7318
  ins_variable_size_depending_on_alignment(true);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7319
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7320
  format %{ "CMOVE   $cmp, $crx, $dst, $src\n\t" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7321
  // Worst case is branch + move + stop, no stop without scheduler.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7322
  size(false /* TODO: PPC PORT Compile::current()->do_hb_scheduling()*/ ? 12 : 8);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7323
  ins_encode( enc_cmove_imm(dst, crx, src, cmp) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7324
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7325
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7326
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7327
// Cmove using isel.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7328
instruct cmovN_reg_isel(cmpOp cmp, flagsReg crx, iRegNdst dst, iRegNsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7329
  match(Set dst (CMoveN (Binary cmp crx) (Binary dst src)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7330
  predicate(VM_Version::has_isel());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7331
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7332
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7333
  format %{ "CMOVE   $cmp, $crx, $dst, $src\n\t" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7334
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7335
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7336
    // This is a Power7 instruction for which no machine description
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7337
    // exists. Anyways, the scheduler should be off on Power7.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7338
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7339
    int cc        = $cmp$$cmpcode;
24349
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  7340
    __ isel($dst$$Register, $crx$$CondRegister,
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7341
            (Assembler::Condition)(cc & 3), /*invert*/((~cc) & 8), $src$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7342
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7343
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7344
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7345
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7346
// Conditional move for RegN. Only cmov(reg, reg).
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7347
instruct cmovN_reg(cmpOp cmp, flagsReg crx, iRegNdst dst, iRegNsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7348
  match(Set dst (CMoveN (Binary cmp crx) (Binary dst src)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7349
  predicate(!VM_Version::has_isel());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7350
  ins_cost(DEFAULT_COST+BRANCH_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7351
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7352
  ins_variable_size_depending_on_alignment(true);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7353
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7354
  format %{ "CMOVE   $cmp, $crx, $dst, $src\n\t" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7355
  // Worst case is branch + move + stop, no stop without scheduler.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7356
  size(false /* TODO: PPC PORT Compile::current()->do_hb_scheduling()*/ ? 12 : 8);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7357
  ins_encode( enc_cmove_reg(dst, crx, src, cmp) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7358
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7359
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7360
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7361
instruct cmovN_imm(cmpOp cmp, flagsReg crx, iRegNdst dst, immN_0 src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7362
  match(Set dst (CMoveN (Binary cmp crx) (Binary dst src)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7363
  ins_cost(DEFAULT_COST+BRANCH_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7364
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7365
  ins_variable_size_depending_on_alignment(true);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7366
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7367
  format %{ "CMOVE   $cmp, $crx, $dst, $src\n\t" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7368
  // Worst case is branch + move + stop, no stop without scheduler.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7369
  size(false /* TODO: PPC PORT Compile::current()->do_hb_scheduling()*/ ? 12 : 8);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7370
  ins_encode( enc_cmove_imm(dst, crx, src, cmp) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7371
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7372
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7373
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7374
// Cmove using isel.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7375
instruct cmovP_reg_isel(cmpOp cmp, flagsReg crx, iRegPdst dst, iRegPsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7376
  match(Set dst (CMoveP (Binary cmp crx) (Binary dst src)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7377
  predicate(VM_Version::has_isel());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7378
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7379
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7380
  format %{ "CMOVE   $cmp, $crx, $dst, $src\n\t" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7381
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7382
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7383
    // This is a Power7 instruction for which no machine description
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7384
    // exists. Anyways, the scheduler should be off on Power7.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7385
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7386
    int cc        = $cmp$$cmpcode;
24349
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  7387
    __ isel($dst$$Register, $crx$$CondRegister,
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7388
            (Assembler::Condition)(cc & 3), /*invert*/((~cc) & 8), $src$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7389
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7390
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7391
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7392
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7393
instruct cmovP_reg(cmpOp cmp, flagsReg crx, iRegPdst dst, iRegP_N2P src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7394
  match(Set dst (CMoveP (Binary cmp crx) (Binary dst src)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7395
  predicate(!VM_Version::has_isel());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7396
  ins_cost(DEFAULT_COST+BRANCH_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7397
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7398
  ins_variable_size_depending_on_alignment(true);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7399
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7400
  format %{ "CMOVE   $cmp, $crx, $dst, $src\n\t" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7401
  // Worst case is branch + move + stop, no stop without scheduler.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7402
  size(false /* TODO: PPC PORT Compile::current()->do_hb_scheduling()*/ ? 12 : 8);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7403
  ins_encode( enc_cmove_reg(dst, crx, src, cmp) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7404
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7405
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7406
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7407
instruct cmovP_imm(cmpOp cmp, flagsReg crx, iRegPdst dst, immP_0 src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7408
  match(Set dst (CMoveP (Binary cmp crx) (Binary dst src)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7409
  ins_cost(DEFAULT_COST+BRANCH_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7410
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7411
  ins_variable_size_depending_on_alignment(true);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7412
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7413
  format %{ "CMOVE   $cmp, $crx, $dst, $src\n\t" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7414
  // Worst case is branch + move + stop, no stop without scheduler.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7415
  size(false /* TODO: PPC PORT Compile::current()->do_hb_scheduling()*/ ? 12 : 8);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7416
  ins_encode( enc_cmove_imm(dst, crx, src, cmp) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7417
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7418
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7419
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7420
instruct cmovF_reg(cmpOp cmp, flagsReg crx, regF dst, regF src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7421
  match(Set dst (CMoveF (Binary cmp crx) (Binary dst src)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7422
  ins_cost(DEFAULT_COST+BRANCH_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7423
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7424
  ins_variable_size_depending_on_alignment(true);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7425
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7426
  format %{ "CMOVEF  $cmp, $crx, $dst, $src\n\t" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7427
  // Worst case is branch + move + stop, no stop without scheduler.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7428
  size(false /* TODO: PPC PORT (InsertEndGroupPPC64 && Compile::current()->do_hb_scheduling())*/ ? 12 : 8);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7429
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7430
    // TODO: PPC port $archOpcode(ppc64Opcode_cmovef);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7431
    Label done;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7432
    assert((Assembler::bcondCRbiIs1 & ~Assembler::bcondCRbiIs0) == 8, "check encoding");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7433
    // Branch if not (cmp crx).
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7434
    __ bc(cc_to_inverse_boint($cmp$$cmpcode), cc_to_biint($cmp$$cmpcode, $crx$$reg), done);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7435
    __ fmr($dst$$FloatRegister, $src$$FloatRegister);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7436
    // TODO PPC port __ endgroup_if_needed(_size == 12);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7437
    __ bind(done);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7438
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7439
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7440
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7441
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7442
instruct cmovD_reg(cmpOp cmp, flagsReg crx, regD dst, regD src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7443
  match(Set dst (CMoveD (Binary cmp crx) (Binary dst src)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7444
  ins_cost(DEFAULT_COST+BRANCH_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7445
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7446
  ins_variable_size_depending_on_alignment(true);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7447
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7448
  format %{ "CMOVEF  $cmp, $crx, $dst, $src\n\t" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7449
  // Worst case is branch + move + stop, no stop without scheduler.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7450
  size(false /* TODO: PPC PORT (InsertEndGroupPPC64 && Compile::current()->do_hb_scheduling())*/ ? 12 : 8);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7451
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7452
    // TODO: PPC port $archOpcode(ppc64Opcode_cmovef);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7453
    Label done;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7454
    assert((Assembler::bcondCRbiIs1 & ~Assembler::bcondCRbiIs0) == 8, "check encoding");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7455
    // Branch if not (cmp crx).
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7456
    __ bc(cc_to_inverse_boint($cmp$$cmpcode), cc_to_biint($cmp$$cmpcode, $crx$$reg), done);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7457
    __ fmr($dst$$FloatRegister, $src$$FloatRegister);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7458
    // TODO PPC port __ endgroup_if_needed(_size == 12);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7459
    __ bind(done);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7460
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7461
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7462
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7463
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7464
//----------Conditional_store--------------------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7465
// Conditional-store of the updated heap-top.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7466
// Used during allocation of the shared heap.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7467
// Sets flags (EQ) on success. Implemented with a CASA on Sparc.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7468
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7469
// As compareAndSwapL, but return flag register instead of boolean value in
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7470
// int register.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7471
// Used by sun/misc/AtomicLongCSImpl.java.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7472
// Mem_ptr must be a memory operand, else this node does not get
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7473
// Flag_needs_anti_dependence_check set by adlc. If this is not set this node
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7474
// can be rematerialized which leads to errors.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7475
instruct storeLConditional_regP_regL_regL(flagsReg crx, indirect mem_ptr, iRegLsrc oldVal, iRegLsrc newVal) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7476
  match(Set crx (StoreLConditional mem_ptr (Binary oldVal newVal)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7477
  format %{ "CMPXCHGD if ($crx = ($oldVal == *$mem_ptr)) *mem_ptr = $newVal; as bool" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7478
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7479
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7480
    __ cmpxchgd($crx$$CondRegister, R0, $oldVal$$Register, $newVal$$Register, $mem_ptr$$Register,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7481
                MacroAssembler::MemBarNone, MacroAssembler::cmpxchgx_hint_atomic_update(),
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7482
                noreg, NULL, true);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7483
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7484
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7485
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7486
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7487
// As compareAndSwapP, but return flag register instead of boolean value in
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7488
// int register.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7489
// This instruction is matched if UseTLAB is off.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7490
// Mem_ptr must be a memory operand, else this node does not get
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7491
// Flag_needs_anti_dependence_check set by adlc. If this is not set this node
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7492
// can be rematerialized which leads to errors.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7493
instruct storePConditional_regP_regP_regP(flagsReg crx, indirect mem_ptr, iRegPsrc oldVal, iRegPsrc newVal) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7494
  match(Set crx (StorePConditional mem_ptr (Binary oldVal newVal)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7495
  format %{ "CMPXCHGD if ($crx = ($oldVal == *$mem_ptr)) *mem_ptr = $newVal; as bool" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7496
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7497
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7498
    __ cmpxchgd($crx$$CondRegister, R0, $oldVal$$Register, $newVal$$Register, $mem_ptr$$Register,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7499
                MacroAssembler::MemBarNone, MacroAssembler::cmpxchgx_hint_atomic_update(),
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7500
                noreg, NULL, true);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7501
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7502
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7503
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7504
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7505
// Implement LoadPLocked. Must be ordered against changes of the memory location
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7506
// by storePConditional.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7507
// Don't know whether this is ever used.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7508
instruct loadPLocked(iRegPdst dst, memory mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7509
  match(Set dst (LoadPLocked mem));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7510
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7511
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7512
  format %{ "LD      $dst, $mem \t// loadPLocked\n\t"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7513
            "TWI     $dst\n\t"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7514
            "ISYNC" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7515
  size(12);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7516
  ins_encode( enc_ld_ac(dst, mem) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7517
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7518
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7519
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7520
//----------Compare-And-Swap---------------------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7521
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7522
// CompareAndSwap{P,I,L} have more than one output, therefore "CmpI
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7523
// (CompareAndSwap ...)" or "If (CmpI (CompareAndSwap ..))"  cannot be
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7524
// matched.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7525
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7526
instruct compareAndSwapI_regP_regI_regI(iRegIdst res, iRegPdst mem_ptr, iRegIsrc src1, iRegIsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7527
  match(Set res (CompareAndSwapI mem_ptr (Binary src1 src2)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7528
  format %{ "CMPXCHGW $res, $mem_ptr, $src1, $src2; as bool" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7529
  // Variable size: instruction count smaller if regs are disjoint.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7530
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7531
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7532
    // CmpxchgX sets CCR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
24349
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  7533
    __ cmpxchgw(CCR0, R0, $src1$$Register, $src2$$Register, $mem_ptr$$Register,
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  7534
                MacroAssembler::MemBarFenceAfter, MacroAssembler::cmpxchgx_hint_atomic_update(),
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7535
                $res$$Register, true);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7536
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7537
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7538
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7539
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7540
instruct compareAndSwapN_regP_regN_regN(iRegIdst res, iRegPdst mem_ptr, iRegNsrc src1, iRegNsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7541
  match(Set res (CompareAndSwapN mem_ptr (Binary src1 src2)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7542
  format %{ "CMPXCHGW $res, $mem_ptr, $src1, $src2; as bool" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7543
  // Variable size: instruction count smaller if regs are disjoint.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7544
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7545
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7546
    // CmpxchgX sets CCR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7547
    __ cmpxchgw(CCR0, R0, $src1$$Register, $src2$$Register, $mem_ptr$$Register,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7548
                MacroAssembler::MemBarFenceAfter, MacroAssembler::cmpxchgx_hint_atomic_update(),
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7549
                $res$$Register, true);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7550
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7551
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7552
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7553
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7554
instruct compareAndSwapL_regP_regL_regL(iRegIdst res, iRegPdst mem_ptr, iRegLsrc src1, iRegLsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7555
  match(Set res (CompareAndSwapL mem_ptr (Binary src1 src2)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7556
  format %{ "CMPXCHGD $res, $mem_ptr, $src1, $src2; as bool" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7557
  // Variable size: instruction count smaller if regs are disjoint.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7558
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7559
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7560
    // CmpxchgX sets CCR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7561
    __ cmpxchgd(CCR0, R0, $src1$$Register, $src2$$Register, $mem_ptr$$Register,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7562
                MacroAssembler::MemBarFenceAfter, MacroAssembler::cmpxchgx_hint_atomic_update(),
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7563
                $res$$Register, NULL, true);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7564
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7565
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7566
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7567
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7568
instruct compareAndSwapP_regP_regP_regP(iRegIdst res, iRegPdst mem_ptr, iRegPsrc src1, iRegPsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7569
  match(Set res (CompareAndSwapP mem_ptr (Binary src1 src2)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7570
  format %{ "CMPXCHGD $res, $mem_ptr, $src1, $src2; as bool; ptr" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7571
  // Variable size: instruction count smaller if regs are disjoint.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7572
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7573
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7574
    // CmpxchgX sets CCR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7575
    __ cmpxchgd(CCR0, R0, $src1$$Register, $src2$$Register, $mem_ptr$$Register,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7576
                MacroAssembler::MemBarFenceAfter, MacroAssembler::cmpxchgx_hint_atomic_update(),
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7577
                $res$$Register, NULL, true);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7578
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7579
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7580
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7581
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7582
instruct getAndAddI(iRegIdst res, iRegPdst mem_ptr, iRegIsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7583
  match(Set res (GetAndAddI mem_ptr src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7584
  format %{ "GetAndAddI $res, $mem_ptr, $src" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7585
  // Variable size: instruction count smaller if regs are disjoint.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7586
  ins_encode( enc_GetAndAddI(res, mem_ptr, src) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7587
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7588
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7589
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7590
instruct getAndAddL(iRegLdst res, iRegPdst mem_ptr, iRegLsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7591
  match(Set res (GetAndAddL mem_ptr src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7592
  format %{ "GetAndAddL $res, $mem_ptr, $src" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7593
  // Variable size: instruction count smaller if regs are disjoint.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7594
  ins_encode( enc_GetAndAddL(res, mem_ptr, src) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7595
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7596
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7597
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7598
instruct getAndSetI(iRegIdst res, iRegPdst mem_ptr, iRegIsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7599
  match(Set res (GetAndSetI mem_ptr src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7600
  format %{ "GetAndSetI $res, $mem_ptr, $src" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7601
  // Variable size: instruction count smaller if regs are disjoint.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7602
  ins_encode( enc_GetAndSetI(res, mem_ptr, src) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7603
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7604
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7605
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7606
instruct getAndSetL(iRegLdst res, iRegPdst mem_ptr, iRegLsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7607
  match(Set res (GetAndSetL mem_ptr src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7608
  format %{ "GetAndSetL $res, $mem_ptr, $src" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7609
  // Variable size: instruction count smaller if regs are disjoint.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7610
  ins_encode( enc_GetAndSetL(res, mem_ptr, src) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7611
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7612
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7613
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7614
instruct getAndSetP(iRegPdst res, iRegPdst mem_ptr, iRegPsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7615
  match(Set res (GetAndSetP mem_ptr src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7616
  format %{ "GetAndSetP $res, $mem_ptr, $src" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7617
  // Variable size: instruction count smaller if regs are disjoint.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7618
  ins_encode( enc_GetAndSetL(res, mem_ptr, src) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7619
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7620
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7621
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7622
instruct getAndSetN(iRegNdst res, iRegPdst mem_ptr, iRegNsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7623
  match(Set res (GetAndSetN mem_ptr src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7624
  format %{ "GetAndSetN $res, $mem_ptr, $src" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7625
  // Variable size: instruction count smaller if regs are disjoint.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7626
  ins_encode( enc_GetAndSetI(res, mem_ptr, src) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7627
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7628
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7629
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7630
//----------Arithmetic Instructions--------------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7631
// Addition Instructions
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7632
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7633
// Register Addition
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7634
instruct addI_reg_reg(iRegIdst dst, iRegIsrc_iRegL2Isrc src1, iRegIsrc_iRegL2Isrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7635
  match(Set dst (AddI src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7636
  format %{ "ADD     $dst, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7637
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7638
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7639
    // TODO: PPC port $archOpcode(ppc64Opcode_add);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7640
    __ add($dst$$Register, $src1$$Register, $src2$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7641
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7642
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7643
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7644
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7645
// Expand does not work with above instruct. (??)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7646
instruct addI_reg_reg_2(iRegIdst dst, iRegIsrc src1, iRegIsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7647
  // no match-rule
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7648
  effect(DEF dst, USE src1, USE src2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7649
  format %{ "ADD     $dst, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7650
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7651
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7652
    // TODO: PPC port $archOpcode(ppc64Opcode_add);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7653
    __ add($dst$$Register, $src1$$Register, $src2$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7654
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7655
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7656
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7657
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7658
instruct tree_addI_addI_addI_reg_reg_Ex(iRegIdst dst, iRegIsrc src1, iRegIsrc src2, iRegIsrc src3, iRegIsrc src4) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7659
  match(Set dst (AddI (AddI (AddI src1 src2) src3) src4));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7660
  ins_cost(DEFAULT_COST*3);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7661
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7662
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7663
    // FIXME: we should do this in the ideal world.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7664
    iRegIdst tmp1;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7665
    iRegIdst tmp2;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7666
    addI_reg_reg(tmp1, src1, src2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7667
    addI_reg_reg_2(tmp2, src3, src4); // Adlc complains about addI_reg_reg.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7668
    addI_reg_reg(dst, tmp1, tmp2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7669
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7670
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7671
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7672
// Immediate Addition
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7673
instruct addI_reg_imm16(iRegIdst dst, iRegIsrc src1, immI16 src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7674
  match(Set dst (AddI src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7675
  format %{ "ADDI    $dst, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7676
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7677
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7678
    // TODO: PPC port $archOpcode(ppc64Opcode_addi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7679
    __ addi($dst$$Register, $src1$$Register, $src2$$constant);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7680
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7681
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7682
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7683
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7684
// Immediate Addition with 16-bit shifted operand
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7685
instruct addI_reg_immhi16(iRegIdst dst, iRegIsrc src1, immIhi16 src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7686
  match(Set dst (AddI src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7687
  format %{ "ADDIS   $dst, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7688
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7689
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7690
    // TODO: PPC port $archOpcode(ppc64Opcode_addis);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7691
    __ addis($dst$$Register, $src1$$Register, ($src2$$constant)>>16);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7692
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7693
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7694
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7695
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7696
// Long Addition
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7697
instruct addL_reg_reg(iRegLdst dst, iRegLsrc src1, iRegLsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7698
  match(Set dst (AddL src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7699
  format %{ "ADD     $dst, $src1, $src2 \t// long" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7700
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7701
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7702
    // TODO: PPC port $archOpcode(ppc64Opcode_add);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7703
    __ add($dst$$Register, $src1$$Register, $src2$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7704
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7705
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7706
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7707
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7708
// Expand does not work with above instruct. (??)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7709
instruct addL_reg_reg_2(iRegLdst dst, iRegLsrc src1, iRegLsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7710
  // no match-rule
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7711
  effect(DEF dst, USE src1, USE src2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7712
  format %{ "ADD     $dst, $src1, $src2 \t// long" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7713
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7714
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7715
    // TODO: PPC port $archOpcode(ppc64Opcode_add);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7716
    __ add($dst$$Register, $src1$$Register, $src2$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7717
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7718
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7719
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7720
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7721
instruct tree_addL_addL_addL_reg_reg_Ex(iRegLdst dst, iRegLsrc src1, iRegLsrc src2, iRegLsrc src3, iRegLsrc src4) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7722
  match(Set dst (AddL (AddL (AddL src1 src2) src3) src4));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7723
  ins_cost(DEFAULT_COST*3);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7724
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7725
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7726
    // FIXME: we should do this in the ideal world.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7727
    iRegLdst tmp1;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7728
    iRegLdst tmp2;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7729
    addL_reg_reg(tmp1, src1, src2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7730
    addL_reg_reg_2(tmp2, src3, src4); // Adlc complains about orI_reg_reg.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7731
    addL_reg_reg(dst, tmp1, tmp2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7732
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7733
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7734
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7735
// AddL + ConvL2I.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7736
instruct addI_regL_regL(iRegIdst dst, iRegLsrc src1, iRegLsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7737
  match(Set dst (ConvL2I (AddL src1 src2)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7738
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7739
  format %{ "ADD     $dst, $src1, $src2 \t// long + l2i" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7740
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7741
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7742
    // TODO: PPC port $archOpcode(ppc64Opcode_add);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7743
    __ add($dst$$Register, $src1$$Register, $src2$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7744
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7745
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7746
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7747
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7748
// No constant pool entries required.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7749
instruct addL_reg_imm16(iRegLdst dst, iRegLsrc src1, immL16 src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7750
  match(Set dst (AddL src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7751
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7752
  format %{ "ADDI    $dst, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7753
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7754
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7755
    // TODO: PPC port $archOpcode(ppc64Opcode_addi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7756
    __ addi($dst$$Register, $src1$$Register, $src2$$constant);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7757
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7758
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7759
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7760
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7761
// Long Immediate Addition with 16-bit shifted operand.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7762
// No constant pool entries required.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7763
instruct addL_reg_immhi16(iRegLdst dst, iRegLsrc src1, immL32hi16 src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7764
  match(Set dst (AddL src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7765
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7766
  format %{ "ADDIS   $dst, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7767
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7768
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7769
    // TODO: PPC port $archOpcode(ppc64Opcode_addis);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7770
    __ addis($dst$$Register, $src1$$Register, ($src2$$constant)>>16);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7771
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7772
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7773
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7774
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7775
// Pointer Register Addition
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7776
instruct addP_reg_reg(iRegPdst dst, iRegP_N2P src1, iRegLsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7777
  match(Set dst (AddP src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7778
  format %{ "ADD     $dst, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7779
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7780
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7781
    // TODO: PPC port $archOpcode(ppc64Opcode_add);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7782
    __ add($dst$$Register, $src1$$Register, $src2$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7783
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7784
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7785
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7786
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7787
// Pointer Immediate Addition
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7788
// No constant pool entries required.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7789
instruct addP_reg_imm16(iRegPdst dst, iRegP_N2P src1, immL16 src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7790
  match(Set dst (AddP src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7791
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7792
  format %{ "ADDI    $dst, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7793
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7794
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7795
    // TODO: PPC port $archOpcode(ppc64Opcode_addi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7796
    __ addi($dst$$Register, $src1$$Register, $src2$$constant);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7797
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7798
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7799
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7800
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7801
// Pointer Immediate Addition with 16-bit shifted operand.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7802
// No constant pool entries required.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7803
instruct addP_reg_immhi16(iRegPdst dst, iRegP_N2P src1, immL32hi16 src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7804
  match(Set dst (AddP src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7805
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7806
  format %{ "ADDIS   $dst, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7807
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7808
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7809
    // TODO: PPC port $archOpcode(ppc64Opcode_addis);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7810
    __ addis($dst$$Register, $src1$$Register, ($src2$$constant)>>16);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7811
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7812
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7813
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7814
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7815
//---------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7816
// Subtraction Instructions
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7817
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7818
// Register Subtraction
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7819
instruct subI_reg_reg(iRegIdst dst, iRegIsrc src1, iRegIsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7820
  match(Set dst (SubI src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7821
  format %{ "SUBF    $dst, $src2, $src1" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7822
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7823
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7824
    // TODO: PPC port $archOpcode(ppc64Opcode_subf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7825
    __ subf($dst$$Register, $src2$$Register, $src1$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7826
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7827
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7828
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7829
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7830
// Immediate Subtraction
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7831
// The compiler converts "x-c0" into "x+ -c0" (see SubINode::Ideal),
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7832
// so this rule seems to be unused.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7833
instruct subI_reg_imm16(iRegIdst dst, iRegIsrc src1, immI16 src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7834
  match(Set dst (SubI src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7835
  format %{ "SUBI    $dst, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7836
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7837
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7838
    // TODO: PPC port $archOpcode(ppc64Opcode_addi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7839
    __ addi($dst$$Register, $src1$$Register, ($src2$$constant) * (-1));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7840
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7841
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7842
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7843
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7844
// SubI from constant (using subfic).
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7845
instruct subI_imm16_reg(iRegIdst dst, immI16 src1, iRegIsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7846
  match(Set dst (SubI src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7847
  format %{ "SUBI    $dst, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7848
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7849
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7850
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7851
    // TODO: PPC port $archOpcode(ppc64Opcode_subfic);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7852
    __ subfic($dst$$Register, $src2$$Register, $src1$$constant);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7853
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7854
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7855
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7856
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7857
// Turn the sign-bit of an integer into a 32-bit mask, 0x0...0 for
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7858
// positive integers and 0xF...F for negative ones.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7859
instruct signmask32I_regI(iRegIdst dst, iRegIsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7860
  // no match-rule, false predicate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7861
  effect(DEF dst, USE src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7862
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7863
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7864
  format %{ "SRAWI   $dst, $src, #31" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7865
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7866
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7867
    // TODO: PPC port $archOpcode(ppc64Opcode_srawi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7868
    __ srawi($dst$$Register, $src$$Register, 0x1f);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7869
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7870
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7871
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7872
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7873
instruct absI_reg_Ex(iRegIdst dst, iRegIsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7874
  match(Set dst (AbsI src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7875
  ins_cost(DEFAULT_COST*3);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7876
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7877
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7878
    iRegIdst tmp1;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7879
    iRegIdst tmp2;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7880
    signmask32I_regI(tmp1, src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7881
    xorI_reg_reg(tmp2, tmp1, src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7882
    subI_reg_reg(dst, tmp2, tmp1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7883
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7884
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7885
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7886
instruct negI_regI(iRegIdst dst, immI_0 zero, iRegIsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7887
  match(Set dst (SubI zero src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7888
  format %{ "NEG     $dst, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7889
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7890
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7891
    // TODO: PPC port $archOpcode(ppc64Opcode_neg);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7892
    __ neg($dst$$Register, $src2$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7893
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7894
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7895
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7896
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7897
// Long subtraction
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7898
instruct subL_reg_reg(iRegLdst dst, iRegLsrc src1, iRegLsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7899
  match(Set dst (SubL src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7900
  format %{ "SUBF    $dst, $src2, $src1 \t// long" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7901
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7902
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7903
    // TODO: PPC port $archOpcode(ppc64Opcode_subf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7904
    __ subf($dst$$Register, $src2$$Register, $src1$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7905
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7906
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7907
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7908
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7909
// SubL + convL2I.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7910
instruct subI_regL_regL(iRegIdst dst, iRegLsrc src1, iRegLsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7911
  match(Set dst (ConvL2I (SubL src1 src2)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7912
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7913
  format %{ "SUBF    $dst, $src2, $src1 \t// long + l2i" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7914
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7915
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7916
    // TODO: PPC port $archOpcode(ppc64Opcode_subf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7917
    __ subf($dst$$Register, $src2$$Register, $src1$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7918
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7919
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7920
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7921
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7922
// Immediate Subtraction
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7923
// The compiler converts "x-c0" into "x+ -c0" (see SubLNode::Ideal),
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7924
// so this rule seems to be unused.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7925
// No constant pool entries required.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7926
instruct subL_reg_imm16(iRegLdst dst, iRegLsrc src1, immL16 src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7927
  match(Set dst (SubL src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7928
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7929
  format %{ "SUBI    $dst, $src1, $src2 \t// long" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7930
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7931
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7932
    // TODO: PPC port $archOpcode(ppc64Opcode_addi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7933
    __ addi($dst$$Register, $src1$$Register, ($src2$$constant) * (-1));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7934
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7935
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7936
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7937
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7938
// Turn the sign-bit of a long into a 64-bit mask, 0x0...0 for
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7939
// positive longs and 0xF...F for negative ones.
24349
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  7940
instruct signmask64I_regL(iRegIdst dst, iRegLsrc src) %{
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  7941
  // no match-rule, false predicate
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  7942
  effect(DEF dst, USE src);
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  7943
  predicate(false);
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  7944
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  7945
  format %{ "SRADI   $dst, $src, #63" %}
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  7946
  size(4);
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  7947
  ins_encode %{
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  7948
    // TODO: PPC port $archOpcode(ppc64Opcode_sradi);
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  7949
    __ sradi($dst$$Register, $src$$Register, 0x3f);
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  7950
  %}
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  7951
  ins_pipe(pipe_class_default);
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  7952
%}
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  7953
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  7954
// Turn the sign-bit of a long into a 64-bit mask, 0x0...0 for
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  7955
// positive longs and 0xF...F for negative ones.
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  7956
instruct signmask64L_regL(iRegLdst dst, iRegLsrc src) %{
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7957
  // no match-rule, false predicate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7958
  effect(DEF dst, USE src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7959
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7960
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7961
  format %{ "SRADI   $dst, $src, #63" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7962
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7963
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7964
    // TODO: PPC port $archOpcode(ppc64Opcode_sradi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7965
    __ sradi($dst$$Register, $src$$Register, 0x3f);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7966
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7967
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7968
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7969
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7970
// Long negation
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7971
instruct negL_reg_reg(iRegLdst dst, immL_0 zero, iRegLsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7972
  match(Set dst (SubL zero src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7973
  format %{ "NEG     $dst, $src2 \t// long" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7974
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7975
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7976
    // TODO: PPC port $archOpcode(ppc64Opcode_neg);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7977
    __ neg($dst$$Register, $src2$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7978
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7979
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7980
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7981
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7982
// NegL + ConvL2I.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7983
instruct negI_con0_regL(iRegIdst dst, immL_0 zero, iRegLsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7984
  match(Set dst (ConvL2I (SubL zero src2)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7985
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7986
  format %{ "NEG     $dst, $src2 \t// long + l2i" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7987
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7988
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7989
    // TODO: PPC port $archOpcode(ppc64Opcode_neg);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7990
    __ neg($dst$$Register, $src2$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7991
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7992
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7993
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7994
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7995
// Multiplication Instructions
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7996
// Integer Multiplication
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7997
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7998
// Register Multiplication
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7999
instruct mulI_reg_reg(iRegIdst dst, iRegIsrc src1, iRegIsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8000
  match(Set dst (MulI src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8001
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8002
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8003
  format %{ "MULLW   $dst, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8004
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8005
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8006
    // TODO: PPC port $archOpcode(ppc64Opcode_mullw);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8007
    __ mullw($dst$$Register, $src1$$Register, $src2$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8008
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8009
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8010
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8011
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8012
// Immediate Multiplication
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8013
instruct mulI_reg_imm16(iRegIdst dst, iRegIsrc src1, immI16 src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8014
  match(Set dst (MulI src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8015
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8016
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8017
  format %{ "MULLI   $dst, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8018
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8019
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8020
    // TODO: PPC port $archOpcode(ppc64Opcode_mulli);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8021
    __ mulli($dst$$Register, $src1$$Register, $src2$$constant);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8022
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8023
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8024
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8025
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8026
instruct mulL_reg_reg(iRegLdst dst, iRegLsrc src1, iRegLsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8027
  match(Set dst (MulL src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8028
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8029
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8030
  format %{ "MULLD   $dst $src1, $src2 \t// long" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8031
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8032
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8033
    // TODO: PPC port $archOpcode(ppc64Opcode_mulld);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8034
    __ mulld($dst$$Register, $src1$$Register, $src2$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8035
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8036
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8037
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8038
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8039
// Multiply high for optimized long division by constant.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8040
instruct mulHighL_reg_reg(iRegLdst dst, iRegLsrc src1, iRegLsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8041
  match(Set dst (MulHiL src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8042
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8043
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8044
  format %{ "MULHD   $dst $src1, $src2 \t// long" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8045
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8046
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8047
    // TODO: PPC port $archOpcode(ppc64Opcode_mulhd);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8048
    __ mulhd($dst$$Register, $src1$$Register, $src2$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8049
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8050
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8051
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8052
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8053
// Immediate Multiplication
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8054
instruct mulL_reg_imm16(iRegLdst dst, iRegLsrc src1, immL16 src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8055
  match(Set dst (MulL src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8056
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8057
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8058
  format %{ "MULLI   $dst, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8059
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8060
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8061
    // TODO: PPC port $archOpcode(ppc64Opcode_mulli);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8062
    __ mulli($dst$$Register, $src1$$Register, $src2$$constant);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8063
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8064
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8065
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8066
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8067
// Integer Division with Immediate -1: Negate.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8068
instruct divI_reg_immIvalueMinus1(iRegIdst dst, iRegIsrc src1, immI_minus1 src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8069
  match(Set dst (DivI src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8070
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8071
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8072
  format %{ "NEG     $dst, $src1 \t// /-1" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8073
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8074
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8075
    // TODO: PPC port $archOpcode(ppc64Opcode_neg);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8076
    __ neg($dst$$Register, $src1$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8077
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8078
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8079
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8080
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8081
// Integer Division with constant, but not -1.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8082
// We should be able to improve this by checking the type of src2.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8083
// It might well be that src2 is known to be positive.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8084
instruct divI_reg_regnotMinus1(iRegIdst dst, iRegIsrc src1, iRegIsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8085
  match(Set dst (DivI src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8086
  predicate(n->in(2)->find_int_con(-1) != -1); // src2 is a constant, but not -1
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8087
  ins_cost(2*DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8088
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8089
  format %{ "DIVW    $dst, $src1, $src2 \t// /not-1" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8090
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8091
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8092
    // TODO: PPC port $archOpcode(ppc64Opcode_divw);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8093
    __ divw($dst$$Register, $src1$$Register, $src2$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8094
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8095
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8096
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8097
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8098
instruct cmovI_bne_negI_reg(iRegIdst dst, flagsReg crx, iRegIsrc src1) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8099
  effect(USE_DEF dst, USE src1, USE crx);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8100
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8101
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8102
  ins_variable_size_depending_on_alignment(true);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8103
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8104
  format %{ "CMOVE   $dst, neg($src1), $crx" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8105
  // Worst case is branch + move + stop, no stop without scheduler.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8106
  size(false /* TODO: PPC PORT (InsertEndGroupPPC64 && Compile::current()->do_hb_scheduling())*/ ? 12 : 8);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8107
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8108
    // TODO: PPC port $archOpcode(ppc64Opcode_cmove);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8109
    Label done;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8110
    __ bne($crx$$CondRegister, done);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8111
    __ neg($dst$$Register, $src1$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8112
    // TODO PPC port __ endgroup_if_needed(_size == 12);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8113
    __ bind(done);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8114
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8115
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8116
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8117
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8118
// Integer Division with Registers not containing constants.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8119
instruct divI_reg_reg_Ex(iRegIdst dst, iRegIsrc src1, iRegIsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8120
  match(Set dst (DivI src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8121
  ins_cost(10*DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8122
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8123
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8124
    immI16 imm %{ (int)-1 %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8125
    flagsReg tmp1;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8126
    cmpI_reg_imm16(tmp1, src2, imm);          // check src2 == -1
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8127
    divI_reg_regnotMinus1(dst, src1, src2);   // dst = src1 / src2
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8128
    cmovI_bne_negI_reg(dst, tmp1, src1);      // cmove dst = neg(src1) if src2 == -1
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8129
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8130
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8131
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8132
// Long Division with Immediate -1: Negate.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8133
instruct divL_reg_immLvalueMinus1(iRegLdst dst, iRegLsrc src1, immL_minus1 src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8134
  match(Set dst (DivL src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8135
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8136
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8137
  format %{ "NEG     $dst, $src1 \t// /-1, long" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8138
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8139
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8140
    // TODO: PPC port $archOpcode(ppc64Opcode_neg);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8141
    __ neg($dst$$Register, $src1$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8142
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8143
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8144
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8145
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8146
// Long Division with constant, but not -1.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8147
instruct divL_reg_regnotMinus1(iRegLdst dst, iRegLsrc src1, iRegLsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8148
  match(Set dst (DivL src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8149
  predicate(n->in(2)->find_long_con(-1L) != -1L); // Src2 is a constant, but not -1.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8150
  ins_cost(2*DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8151
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8152
  format %{ "DIVD    $dst, $src1, $src2 \t// /not-1, long" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8153
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8154
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8155
    // TODO: PPC port $archOpcode(ppc64Opcode_divd);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8156
    __ divd($dst$$Register, $src1$$Register, $src2$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8157
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8158
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8159
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8160
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8161
instruct cmovL_bne_negL_reg(iRegLdst dst, flagsReg crx, iRegLsrc src1) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8162
  effect(USE_DEF dst, USE src1, USE crx);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8163
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8164
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8165
  ins_variable_size_depending_on_alignment(true);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8166
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8167
  format %{ "CMOVE   $dst, neg($src1), $crx" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8168
  // Worst case is branch + move + stop, no stop without scheduler.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8169
  size(false /* TODO: PPC PORT (InsertEndGroupPPC64 && Compile::current()->do_hb_scheduling())*/ ? 12 : 8);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8170
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8171
    // TODO: PPC port $archOpcode(ppc64Opcode_cmove);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8172
    Label done;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8173
    __ bne($crx$$CondRegister, done);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8174
    __ neg($dst$$Register, $src1$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8175
    // TODO PPC port __ endgroup_if_needed(_size == 12);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8176
    __ bind(done);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8177
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8178
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8179
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8180
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8181
// Long Division with Registers not containing constants.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8182
instruct divL_reg_reg_Ex(iRegLdst dst, iRegLsrc src1, iRegLsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8183
  match(Set dst (DivL src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8184
  ins_cost(10*DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8185
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8186
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8187
    immL16 imm %{ (int)-1 %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8188
    flagsReg tmp1;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8189
    cmpL_reg_imm16(tmp1, src2, imm);          // check src2 == -1
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8190
    divL_reg_regnotMinus1(dst, src1, src2);   // dst = src1 / src2
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8191
    cmovL_bne_negL_reg(dst, tmp1, src1);      // cmove dst = neg(src1) if src2 == -1
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8192
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8193
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8194
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8195
// Integer Remainder with registers.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8196
instruct modI_reg_reg_Ex(iRegIdst dst, iRegIsrc src1, iRegIsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8197
  match(Set dst (ModI src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8198
  ins_cost(10*DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8199
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8200
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8201
    immI16 imm %{ (int)-1 %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8202
    flagsReg tmp1;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8203
    iRegIdst tmp2;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8204
    iRegIdst tmp3;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8205
    cmpI_reg_imm16(tmp1, src2, imm);           // check src2 == -1
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8206
    divI_reg_regnotMinus1(tmp2, src1, src2);   // tmp2 = src1 / src2
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8207
    cmovI_bne_negI_reg(tmp2, tmp1, src1);      // cmove tmp2 = neg(src1) if src2 == -1
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8208
    mulI_reg_reg(tmp3, src2, tmp2);            // tmp3 = src2 * tmp2
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8209
    subI_reg_reg(dst, src1, tmp3);             // dst = src1 - tmp3
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8210
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8211
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8212
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8213
// Long Remainder with registers
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8214
instruct modL_reg_reg_Ex(iRegLdst dst, iRegLsrc src1, iRegLsrc src2, flagsRegCR0 cr0) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8215
  match(Set dst (ModL src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8216
  ins_cost(10*DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8217
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8218
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8219
    immL16 imm %{ (int)-1 %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8220
    flagsReg tmp1;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8221
    iRegLdst tmp2;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8222
    iRegLdst tmp3;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8223
    cmpL_reg_imm16(tmp1, src2, imm);             // check src2 == -1
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8224
    divL_reg_regnotMinus1(tmp2, src1, src2);     // tmp2 = src1 / src2
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8225
    cmovL_bne_negL_reg(tmp2, tmp1, src1);        // cmove tmp2 = neg(src1) if src2 == -1
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8226
    mulL_reg_reg(tmp3, src2, tmp2);              // tmp3 = src2 * tmp2
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8227
    subL_reg_reg(dst, src1, tmp3);               // dst = src1 - tmp3
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8228
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8229
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8230
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8231
// Integer Shift Instructions
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8232
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8233
// Register Shift Left
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8234
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8235
// Clear all but the lowest #mask bits.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8236
// Used to normalize shift amounts in registers.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8237
instruct maskI_reg_imm(iRegIdst dst, iRegIsrc src, uimmI6 mask) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8238
  // no match-rule, false predicate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8239
  effect(DEF dst, USE src, USE mask);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8240
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8241
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8242
  format %{ "MASK    $dst, $src, $mask \t// clear $mask upper bits" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8243
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8244
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8245
    // TODO: PPC port $archOpcode(ppc64Opcode_rldicl);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8246
    __ clrldi($dst$$Register, $src$$Register, $mask$$constant);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8247
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8248
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8249
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8250
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8251
instruct lShiftI_reg_reg(iRegIdst dst, iRegIsrc src1, iRegIsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8252
  // no match-rule, false predicate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8253
  effect(DEF dst, USE src1, USE src2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8254
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8255
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8256
  format %{ "SLW     $dst, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8257
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8258
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8259
    // TODO: PPC port $archOpcode(ppc64Opcode_slw);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8260
    __ slw($dst$$Register, $src1$$Register, $src2$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8261
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8262
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8263
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8264
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8265
instruct lShiftI_reg_reg_Ex(iRegIdst dst, iRegIsrc src1, iRegIsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8266
  match(Set dst (LShiftI src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8267
  ins_cost(DEFAULT_COST*2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8268
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8269
    uimmI6 mask %{ 0x3b /* clear 59 bits, keep 5 */ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8270
    iRegIdst tmpI;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8271
    maskI_reg_imm(tmpI, src2, mask);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8272
    lShiftI_reg_reg(dst, src1, tmpI);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8273
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8274
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8275
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8276
// Register Shift Left Immediate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8277
instruct lShiftI_reg_imm(iRegIdst dst, iRegIsrc src1, immI src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8278
  match(Set dst (LShiftI src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8279
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8280
  format %{ "SLWI    $dst, $src1, ($src2 & 0x1f)" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8281
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8282
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8283
    // TODO: PPC port $archOpcode(ppc64Opcode_rlwinm);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8284
    __ slwi($dst$$Register, $src1$$Register, ($src2$$constant) & 0x1f);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8285
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8286
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8287
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8288
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8289
// AndI with negpow2-constant + LShiftI
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8290
instruct lShiftI_andI_immInegpow2_imm5(iRegIdst dst, iRegIsrc src1, immInegpow2 src2, uimmI5 src3) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8291
  match(Set dst (LShiftI (AndI src1 src2) src3));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8292
  predicate(UseRotateAndMaskInstructionsPPC64);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8293
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8294
  format %{ "RLWINM  $dst, lShiftI(AndI($src1, $src2), $src3)" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8295
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8296
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8297
    // TODO: PPC port $archOpcode(ppc64Opcode_rlwinm); // FIXME: assert that rlwinm is equal to addi
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8298
    long src2      = $src2$$constant;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8299
    long src3      = $src3$$constant;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8300
    long maskbits  = src3 + log2_long((jlong) (julong) (juint) -src2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8301
    if (maskbits >= 32) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8302
      __ li($dst$$Register, 0); // addi
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8303
    } else {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8304
      __ rlwinm($dst$$Register, $src1$$Register, src3 & 0x1f, 0, (31-maskbits) & 0x1f);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8305
    }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8306
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8307
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8308
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8309
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8310
// RShiftI + AndI with negpow2-constant + LShiftI
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8311
instruct lShiftI_andI_immInegpow2_rShiftI_imm5(iRegIdst dst, iRegIsrc src1, immInegpow2 src2, uimmI5 src3) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8312
  match(Set dst (LShiftI (AndI (RShiftI src1 src3) src2) src3));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8313
  predicate(UseRotateAndMaskInstructionsPPC64);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8314
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8315
  format %{ "RLWINM  $dst, lShiftI(AndI(RShiftI($src1, $src3), $src2), $src3)" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8316
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8317
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8318
    // TODO: PPC port $archOpcode(ppc64Opcode_rlwinm); // FIXME: assert that rlwinm is equal to addi
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8319
    long src2      = $src2$$constant;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8320
    long src3      = $src3$$constant;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8321
    long maskbits  = src3 + log2_long((jlong) (julong) (juint) -src2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8322
    if (maskbits >= 32) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8323
      __ li($dst$$Register, 0); // addi
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8324
    } else {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8325
      __ rlwinm($dst$$Register, $src1$$Register, 0, 0, (31-maskbits) & 0x1f);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8326
    }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8327
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8328
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8329
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8330
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8331
instruct lShiftL_regL_regI(iRegLdst dst, iRegLsrc src1, iRegIsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8332
  // no match-rule, false predicate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8333
  effect(DEF dst, USE src1, USE src2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8334
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8335
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8336
  format %{ "SLD     $dst, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8337
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8338
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8339
    // TODO: PPC port $archOpcode(ppc64Opcode_sld);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8340
    __ sld($dst$$Register, $src1$$Register, $src2$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8341
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8342
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8343
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8344
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8345
// Register Shift Left
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8346
instruct lShiftL_regL_regI_Ex(iRegLdst dst, iRegLsrc src1, iRegIsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8347
  match(Set dst (LShiftL src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8348
  ins_cost(DEFAULT_COST*2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8349
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8350
    uimmI6 mask %{ 0x3a /* clear 58 bits, keep 6 */ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8351
    iRegIdst tmpI;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8352
    maskI_reg_imm(tmpI, src2, mask);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8353
    lShiftL_regL_regI(dst, src1, tmpI);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8354
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8355
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8356
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8357
// Register Shift Left Immediate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8358
instruct lshiftL_regL_immI(iRegLdst dst, iRegLsrc src1, immI src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8359
  match(Set dst (LShiftL src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8360
  format %{ "SLDI    $dst, $src1, ($src2 & 0x3f)" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8361
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8362
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8363
    // TODO: PPC port $archOpcode(ppc64Opcode_rldicr);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8364
    __ sldi($dst$$Register, $src1$$Register, ($src2$$constant) & 0x3f);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8365
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8366
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8367
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8368
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8369
// If we shift more than 32 bits, we need not convert I2L.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8370
instruct lShiftL_regI_immGE32(iRegLdst dst, iRegIsrc src1, uimmI6_ge32 src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8371
  match(Set dst (LShiftL (ConvI2L src1) src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8372
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8373
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8374
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8375
  format %{ "SLDI    $dst, i2l($src1), $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8376
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8377
    // TODO: PPC port $archOpcode(ppc64Opcode_rldicr);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8378
    __ sldi($dst$$Register, $src1$$Register, ($src2$$constant) & 0x3f);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8379
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8380
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8381
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8382
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8383
// Shift a postivie int to the left.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8384
// Clrlsldi clears the upper 32 bits and shifts.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8385
instruct scaledPositiveI2L_lShiftL_convI2L_reg_imm6(iRegLdst dst, iRegIsrc src1, uimmI6 src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8386
  match(Set dst (LShiftL (ConvI2L src1) src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8387
  predicate(((ConvI2LNode*)(_kids[0]->_leaf))->type()->is_long()->is_positive_int());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8388
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8389
  format %{ "SLDI    $dst, i2l(positive_int($src1)), $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8390
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8391
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8392
    // TODO: PPC port $archOpcode(ppc64Opcode_rldic);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8393
    __ clrlsldi($dst$$Register, $src1$$Register, 0x20, $src2$$constant);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8394
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8395
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8396
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8397
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8398
instruct arShiftI_reg_reg(iRegIdst dst, iRegIsrc src1, iRegIsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8399
  // no match-rule, false predicate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8400
  effect(DEF dst, USE src1, USE src2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8401
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8402
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8403
  format %{ "SRAW    $dst, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8404
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8405
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8406
    // TODO: PPC port $archOpcode(ppc64Opcode_sraw);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8407
    __ sraw($dst$$Register, $src1$$Register, $src2$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8408
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8409
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8410
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8411
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8412
// Register Arithmetic Shift Right
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8413
instruct arShiftI_reg_reg_Ex(iRegIdst dst, iRegIsrc src1, iRegIsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8414
  match(Set dst (RShiftI src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8415
  ins_cost(DEFAULT_COST*2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8416
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8417
    uimmI6 mask %{ 0x3b /* clear 59 bits, keep 5 */ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8418
    iRegIdst tmpI;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8419
    maskI_reg_imm(tmpI, src2, mask);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8420
    arShiftI_reg_reg(dst, src1, tmpI);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8421
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8422
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8423
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8424
// Register Arithmetic Shift Right Immediate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8425
instruct arShiftI_reg_imm(iRegIdst dst, iRegIsrc src1, immI src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8426
  match(Set dst (RShiftI src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8427
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8428
  format %{ "SRAWI   $dst, $src1, ($src2 & 0x1f)" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8429
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8430
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8431
    // TODO: PPC port $archOpcode(ppc64Opcode_srawi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8432
    __ srawi($dst$$Register, $src1$$Register, ($src2$$constant) & 0x1f);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8433
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8434
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8435
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8436
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8437
instruct arShiftL_regL_regI(iRegLdst dst, iRegLsrc src1, iRegIsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8438
  // no match-rule, false predicate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8439
  effect(DEF dst, USE src1, USE src2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8440
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8441
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8442
  format %{ "SRAD    $dst, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8443
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8444
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8445
    // TODO: PPC port $archOpcode(ppc64Opcode_srad);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8446
    __ srad($dst$$Register, $src1$$Register, $src2$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8447
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8448
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8449
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8450
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8451
// Register Shift Right Arithmetic Long
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8452
instruct arShiftL_regL_regI_Ex(iRegLdst dst, iRegLsrc src1, iRegIsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8453
  match(Set dst (RShiftL src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8454
  ins_cost(DEFAULT_COST*2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8455
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8456
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8457
    uimmI6 mask %{ 0x3a /* clear 58 bits, keep 6 */ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8458
    iRegIdst tmpI;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8459
    maskI_reg_imm(tmpI, src2, mask);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8460
    arShiftL_regL_regI(dst, src1, tmpI);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8461
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8462
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8463
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8464
// Register Shift Right Immediate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8465
instruct arShiftL_regL_immI(iRegLdst dst, iRegLsrc src1, immI src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8466
  match(Set dst (RShiftL src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8467
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8468
  format %{ "SRADI   $dst, $src1, ($src2 & 0x3f)" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8469
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8470
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8471
    // TODO: PPC port $archOpcode(ppc64Opcode_sradi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8472
    __ sradi($dst$$Register, $src1$$Register, ($src2$$constant) & 0x3f);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8473
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8474
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8475
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8476
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8477
// RShiftL + ConvL2I
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8478
instruct convL2I_arShiftL_regL_immI(iRegIdst dst, iRegLsrc src1, immI src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8479
  match(Set dst (ConvL2I (RShiftL src1 src2)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8480
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8481
  format %{ "SRADI   $dst, $src1, ($src2 & 0x3f) \t// long + l2i" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8482
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8483
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8484
    // TODO: PPC port $archOpcode(ppc64Opcode_sradi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8485
    __ sradi($dst$$Register, $src1$$Register, ($src2$$constant) & 0x3f);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8486
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8487
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8488
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8489
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8490
instruct urShiftI_reg_reg(iRegIdst dst, iRegIsrc src1, iRegIsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8491
  // no match-rule, false predicate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8492
  effect(DEF dst, USE src1, USE src2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8493
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8494
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8495
  format %{ "SRW     $dst, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8496
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8497
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8498
    // TODO: PPC port $archOpcode(ppc64Opcode_srw);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8499
    __ srw($dst$$Register, $src1$$Register, $src2$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8500
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8501
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8502
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8503
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8504
// Register Shift Right
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8505
instruct urShiftI_reg_reg_Ex(iRegIdst dst, iRegIsrc src1, iRegIsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8506
  match(Set dst (URShiftI src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8507
  ins_cost(DEFAULT_COST*2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8508
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8509
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8510
    uimmI6 mask %{ 0x3b /* clear 59 bits, keep 5 */ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8511
    iRegIdst tmpI;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8512
    maskI_reg_imm(tmpI, src2, mask);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8513
    urShiftI_reg_reg(dst, src1, tmpI);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8514
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8515
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8516
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8517
// Register Shift Right Immediate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8518
instruct urShiftI_reg_imm(iRegIdst dst, iRegIsrc src1, immI src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8519
  match(Set dst (URShiftI src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8520
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8521
  format %{ "SRWI    $dst, $src1, ($src2 & 0x1f)" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8522
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8523
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8524
    // TODO: PPC port $archOpcode(ppc64Opcode_rlwinm);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8525
    __ srwi($dst$$Register, $src1$$Register, ($src2$$constant) & 0x1f);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8526
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8527
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8528
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8529
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8530
instruct urShiftL_regL_regI(iRegLdst dst, iRegLsrc src1, iRegIsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8531
  // no match-rule, false predicate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8532
  effect(DEF dst, USE src1, USE src2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8533
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8534
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8535
  format %{ "SRD     $dst, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8536
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8537
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8538
    // TODO: PPC port $archOpcode(ppc64Opcode_srd);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8539
    __ srd($dst$$Register, $src1$$Register, $src2$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8540
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8541
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8542
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8543
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8544
// Register Shift Right
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8545
instruct urShiftL_regL_regI_Ex(iRegLdst dst, iRegLsrc src1, iRegIsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8546
  match(Set dst (URShiftL src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8547
  ins_cost(DEFAULT_COST*2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8548
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8549
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8550
    uimmI6 mask %{ 0x3a /* clear 58 bits, keep 6 */ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8551
    iRegIdst tmpI;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8552
    maskI_reg_imm(tmpI, src2, mask);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8553
    urShiftL_regL_regI(dst, src1, tmpI);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8554
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8555
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8556
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8557
// Register Shift Right Immediate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8558
instruct urShiftL_regL_immI(iRegLdst dst, iRegLsrc src1, immI src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8559
  match(Set dst (URShiftL src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8560
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8561
  format %{ "SRDI    $dst, $src1, ($src2 & 0x3f)" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8562
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8563
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8564
    // TODO: PPC port $archOpcode(ppc64Opcode_rldicl);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8565
    __ srdi($dst$$Register, $src1$$Register, ($src2$$constant) & 0x3f);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8566
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8567
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8568
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8569
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8570
// URShiftL + ConvL2I.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8571
instruct convL2I_urShiftL_regL_immI(iRegIdst dst, iRegLsrc src1, immI src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8572
  match(Set dst (ConvL2I (URShiftL src1 src2)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8573
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8574
  format %{ "SRDI    $dst, $src1, ($src2 & 0x3f) \t// long + l2i" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8575
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8576
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8577
    // TODO: PPC port $archOpcode(ppc64Opcode_rldicl);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8578
    __ srdi($dst$$Register, $src1$$Register, ($src2$$constant) & 0x3f);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8579
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8580
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8581
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8582
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8583
// Register Shift Right Immediate with a CastP2X
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8584
instruct shrP_convP2X_reg_imm6(iRegLdst dst, iRegP_N2P src1, uimmI6 src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8585
  match(Set dst (URShiftL (CastP2X src1) src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8586
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8587
  format %{ "SRDI    $dst, $src1, $src2 \t// Cast ptr $src1 to long and shift" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8588
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8589
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8590
    // TODO: PPC port $archOpcode(ppc64Opcode_rldicl);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8591
    __ srdi($dst$$Register, $src1$$Register, ($src2$$constant) & 0x3f);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8592
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8593
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8594
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8595
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8596
instruct sxtI_reg(iRegIdst dst, iRegIsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8597
  match(Set dst (ConvL2I (ConvI2L src)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8598
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8599
  format %{ "EXTSW   $dst, $src \t// int->int" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8600
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8601
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8602
    // TODO: PPC port $archOpcode(ppc64Opcode_extsw);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8603
    __ extsw($dst$$Register, $src$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8604
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8605
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8606
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8607
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8608
//----------Rotate Instructions------------------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8609
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8610
// Rotate Left by 8-bit immediate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8611
instruct rotlI_reg_immi8(iRegIdst dst, iRegIsrc src, immI8 lshift, immI8 rshift) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8612
  match(Set dst (OrI (LShiftI src lshift) (URShiftI src rshift)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8613
  predicate(0 == ((n->in(1)->in(2)->get_int() + n->in(2)->in(2)->get_int()) & 0x1f));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8614
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8615
  format %{ "ROTLWI  $dst, $src, $lshift" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8616
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8617
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8618
    // TODO: PPC port $archOpcode(ppc64Opcode_rlwinm);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8619
    __ rotlwi($dst$$Register, $src$$Register, $lshift$$constant);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8620
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8621
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8622
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8623
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8624
// Rotate Right by 8-bit immediate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8625
instruct rotrI_reg_immi8(iRegIdst dst, iRegIsrc src, immI8 rshift, immI8 lshift) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8626
  match(Set dst (OrI (URShiftI src rshift) (LShiftI src lshift)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8627
  predicate(0 == ((n->in(1)->in(2)->get_int() + n->in(2)->in(2)->get_int()) & 0x1f));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8628
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8629
  format %{ "ROTRWI  $dst, $rshift" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8630
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8631
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8632
    // TODO: PPC port $archOpcode(ppc64Opcode_rlwinm);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8633
    __ rotrwi($dst$$Register, $src$$Register, $rshift$$constant);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8634
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8635
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8636
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8637
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8638
//----------Floating Point Arithmetic Instructions-----------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8639
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8640
// Add float single precision
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8641
instruct addF_reg_reg(regF dst, regF src1, regF src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8642
  match(Set dst (AddF src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8643
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8644
  format %{ "FADDS   $dst, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8645
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8646
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8647
    // TODO: PPC port $archOpcode(ppc64Opcode_fadds);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8648
    __ fadds($dst$$FloatRegister, $src1$$FloatRegister, $src2$$FloatRegister);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8649
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8650
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8651
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8652
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8653
// Add float double precision
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8654
instruct addD_reg_reg(regD dst, regD src1, regD src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8655
  match(Set dst (AddD src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8656
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8657
  format %{ "FADD    $dst, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8658
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8659
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8660
    // TODO: PPC port $archOpcode(ppc64Opcode_fadd);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8661
    __ fadd($dst$$FloatRegister, $src1$$FloatRegister, $src2$$FloatRegister);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8662
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8663
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8664
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8665
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8666
// Sub float single precision
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8667
instruct subF_reg_reg(regF dst, regF src1, regF src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8668
  match(Set dst (SubF src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8669
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8670
  format %{ "FSUBS   $dst, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8671
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8672
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8673
    // TODO: PPC port $archOpcode(ppc64Opcode_fsubs);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8674
    __ fsubs($dst$$FloatRegister, $src1$$FloatRegister, $src2$$FloatRegister);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8675
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8676
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8677
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8678
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8679
// Sub float double precision
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8680
instruct subD_reg_reg(regD dst, regD src1, regD src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8681
  match(Set dst (SubD src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8682
  format %{ "FSUB    $dst, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8683
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8684
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8685
    // TODO: PPC port $archOpcode(ppc64Opcode_fsub);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8686
    __ fsub($dst$$FloatRegister, $src1$$FloatRegister, $src2$$FloatRegister);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8687
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8688
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8689
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8690
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8691
// Mul float single precision
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8692
instruct mulF_reg_reg(regF dst, regF src1, regF src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8693
  match(Set dst (MulF src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8694
  format %{ "FMULS   $dst, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8695
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8696
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8697
    // TODO: PPC port $archOpcode(ppc64Opcode_fmuls);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8698
    __ fmuls($dst$$FloatRegister, $src1$$FloatRegister, $src2$$FloatRegister);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8699
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8700
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8701
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8702
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8703
// Mul float double precision
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8704
instruct mulD_reg_reg(regD dst, regD src1, regD src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8705
  match(Set dst (MulD src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8706
  format %{ "FMUL    $dst, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8707
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8708
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8709
    // TODO: PPC port $archOpcode(ppc64Opcode_fmul);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8710
    __ fmul($dst$$FloatRegister, $src1$$FloatRegister, $src2$$FloatRegister);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8711
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8712
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8713
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8714
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8715
// Div float single precision
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8716
instruct divF_reg_reg(regF dst, regF src1, regF src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8717
  match(Set dst (DivF src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8718
  format %{ "FDIVS   $dst, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8719
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8720
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8721
    // TODO: PPC port $archOpcode(ppc64Opcode_fdivs);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8722
    __ fdivs($dst$$FloatRegister, $src1$$FloatRegister, $src2$$FloatRegister);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8723
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8724
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8725
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8726
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8727
// Div float double precision
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8728
instruct divD_reg_reg(regD dst, regD src1, regD src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8729
  match(Set dst (DivD src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8730
  format %{ "FDIV    $dst, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8731
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8732
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8733
    // TODO: PPC port $archOpcode(ppc64Opcode_fdiv);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8734
    __ fdiv($dst$$FloatRegister, $src1$$FloatRegister, $src2$$FloatRegister);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8735
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8736
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8737
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8738
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8739
// Absolute float single precision
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8740
instruct absF_reg(regF dst, regF src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8741
  match(Set dst (AbsF src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8742
  format %{ "FABS    $dst, $src \t// float" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8743
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8744
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8745
    // TODO: PPC port $archOpcode(ppc64Opcode_fabs);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8746
    __ fabs($dst$$FloatRegister, $src$$FloatRegister);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8747
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8748
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8749
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8750
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8751
// Absolute float double precision
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8752
instruct absD_reg(regD dst, regD src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8753
  match(Set dst (AbsD src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8754
  format %{ "FABS    $dst, $src \t// double" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8755
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8756
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8757
    // TODO: PPC port $archOpcode(ppc64Opcode_fabs);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8758
    __ fabs($dst$$FloatRegister, $src$$FloatRegister);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8759
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8760
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8761
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8762
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8763
instruct negF_reg(regF dst, regF src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8764
  match(Set dst (NegF src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8765
  format %{ "FNEG    $dst, $src \t// float" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8766
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8767
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8768
    // TODO: PPC port $archOpcode(ppc64Opcode_fneg);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8769
    __ fneg($dst$$FloatRegister, $src$$FloatRegister);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8770
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8771
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8772
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8773
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8774
instruct negD_reg(regD dst, regD src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8775
  match(Set dst (NegD src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8776
  format %{ "FNEG    $dst, $src \t// double" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8777
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8778
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8779
    // TODO: PPC port $archOpcode(ppc64Opcode_fneg);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8780
    __ fneg($dst$$FloatRegister, $src$$FloatRegister);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8781
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8782
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8783
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8784
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8785
// AbsF + NegF.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8786
instruct negF_absF_reg(regF dst, regF src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8787
  match(Set dst (NegF (AbsF src)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8788
  format %{ "FNABS   $dst, $src \t// float" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8789
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8790
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8791
    // TODO: PPC port $archOpcode(ppc64Opcode_fnabs);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8792
    __ fnabs($dst$$FloatRegister, $src$$FloatRegister);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8793
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8794
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8795
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8796
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8797
// AbsD + NegD.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8798
instruct negD_absD_reg(regD dst, regD src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8799
  match(Set dst (NegD (AbsD src)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8800
  format %{ "FNABS   $dst, $src \t// double" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8801
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8802
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8803
    // TODO: PPC port $archOpcode(ppc64Opcode_fnabs);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8804
    __ fnabs($dst$$FloatRegister, $src$$FloatRegister);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8805
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8806
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8807
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8808
22879
177361c49b26 8035394: PPC64: Make usage of intrinsic dsqrt depend on processor recognition.
goetz
parents: 22874
diff changeset
  8809
// VM_Version::has_fsqrt() decides if this node will be used.
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8810
// Sqrt float double precision
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8811
instruct sqrtD_reg(regD dst, regD src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8812
  match(Set dst (SqrtD src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8813
  format %{ "FSQRT   $dst, $src" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8814
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8815
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8816
    // TODO: PPC port $archOpcode(ppc64Opcode_fsqrt);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8817
    __ fsqrt($dst$$FloatRegister, $src$$FloatRegister);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8818
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8819
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8820
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8821
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8822
// Single-precision sqrt.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8823
instruct sqrtF_reg(regF dst, regF src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8824
  match(Set dst (ConvD2F (SqrtD (ConvF2D src))));
23492
af5352f40e65 8037915: PPC64/AIX: Several smaller fixes
goetz
parents: 23211
diff changeset
  8825
  predicate(VM_Version::has_fsqrts());
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8826
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8827
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8828
  format %{ "FSQRTS  $dst, $src" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8829
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8830
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8831
    // TODO: PPC port $archOpcode(ppc64Opcode_fsqrts);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8832
    __ fsqrts($dst$$FloatRegister, $src$$FloatRegister);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8833
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8834
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8835
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8836
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8837
instruct roundDouble_nop(regD dst) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8838
  match(Set dst (RoundDouble dst));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8839
  ins_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8840
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8841
  format %{ " -- \t// RoundDouble not needed - empty" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8842
  size(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8843
  // PPC results are already "rounded" (i.e., normal-format IEEE).
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8844
  ins_encode( /*empty*/ );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8845
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8846
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8847
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8848
instruct roundFloat_nop(regF dst) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8849
  match(Set dst (RoundFloat dst));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8850
  ins_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8851
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8852
  format %{ " -- \t// RoundFloat not needed - empty" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8853
  size(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8854
  // PPC results are already "rounded" (i.e., normal-format IEEE).
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8855
  ins_encode( /*empty*/ );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8856
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8857
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8858
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8859
//----------Logical Instructions-----------------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8860
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8861
// And Instructions
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8862
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8863
// Register And
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8864
instruct andI_reg_reg(iRegIdst dst, iRegIsrc src1, iRegIsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8865
  match(Set dst (AndI src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8866
  format %{ "AND     $dst, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8867
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8868
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8869
    // TODO: PPC port $archOpcode(ppc64Opcode_and);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8870
    __ andr($dst$$Register, $src1$$Register, $src2$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8871
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8872
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8873
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8874
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8875
// Immediate And
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8876
instruct andI_reg_uimm16(iRegIdst dst, iRegIsrc src1, uimmI16 src2, flagsRegCR0 cr0) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8877
  match(Set dst (AndI src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8878
  effect(KILL cr0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8879
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8880
  format %{ "ANDI    $dst, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8881
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8882
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8883
    // TODO: PPC port $archOpcode(ppc64Opcode_andi_);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8884
    // FIXME: avoid andi_ ?
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8885
    __ andi_($dst$$Register, $src1$$Register, $src2$$constant);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8886
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8887
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8888
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8889
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8890
// Immediate And where the immediate is a negative power of 2.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8891
instruct andI_reg_immInegpow2(iRegIdst dst, iRegIsrc src1, immInegpow2 src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8892
  match(Set dst (AndI src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8893
  format %{ "ANDWI   $dst, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8894
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8895
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8896
    // TODO: PPC port $archOpcode(ppc64Opcode_rldicr);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8897
    __ clrrdi($dst$$Register, $src1$$Register, log2_long((jlong)(julong)(juint)-($src2$$constant)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8898
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8899
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8900
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8901
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8902
instruct andI_reg_immIpow2minus1(iRegIdst dst, iRegIsrc src1, immIpow2minus1 src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8903
  match(Set dst (AndI src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8904
  format %{ "ANDWI   $dst, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8905
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8906
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8907
    // TODO: PPC port $archOpcode(ppc64Opcode_rldicl);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8908
    __ clrldi($dst$$Register, $src1$$Register, 64-log2_long((((jlong) $src2$$constant)+1)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8909
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8910
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8911
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8912
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8913
instruct andI_reg_immIpowerOf2(iRegIdst dst, iRegIsrc src1, immIpowerOf2 src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8914
  match(Set dst (AndI src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8915
  predicate(UseRotateAndMaskInstructionsPPC64);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8916
  format %{ "ANDWI   $dst, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8917
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8918
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8919
    // TODO: PPC port $archOpcode(ppc64Opcode_rlwinm);
24349
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  8920
    __ rlwinm($dst$$Register, $src1$$Register, 0,
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8921
              (31-log2_long((jlong) $src2$$constant)) & 0x1f, (31-log2_long((jlong) $src2$$constant)) & 0x1f);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8922
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8923
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8924
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8925
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8926
// Register And Long
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8927
instruct andL_reg_reg(iRegLdst dst, iRegLsrc src1, iRegLsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8928
  match(Set dst (AndL src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8929
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8930
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8931
  format %{ "AND     $dst, $src1, $src2 \t// long" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8932
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8933
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8934
    // TODO: PPC port $archOpcode(ppc64Opcode_and);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8935
    __ andr($dst$$Register, $src1$$Register, $src2$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8936
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8937
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8938
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8939
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8940
// Immediate And long
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8941
instruct andL_reg_uimm16(iRegLdst dst, iRegLsrc src1, uimmL16 src2, flagsRegCR0 cr0) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8942
  match(Set dst (AndL src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8943
  effect(KILL cr0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8944
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8945
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8946
  format %{ "ANDI    $dst, $src1, $src2 \t// long" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8947
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8948
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8949
    // TODO: PPC port $archOpcode(ppc64Opcode_andi_);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8950
    // FIXME: avoid andi_ ?
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8951
    __ andi_($dst$$Register, $src1$$Register, $src2$$constant);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8952
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8953
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8954
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8955
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8956
// Immediate And Long where the immediate is a negative power of 2.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8957
instruct andL_reg_immLnegpow2(iRegLdst dst, iRegLsrc src1, immLnegpow2 src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8958
  match(Set dst (AndL src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8959
  format %{ "ANDDI   $dst, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8960
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8961
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8962
    // TODO: PPC port $archOpcode(ppc64Opcode_rldicr);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8963
    __ clrrdi($dst$$Register, $src1$$Register, log2_long((jlong)-$src2$$constant));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8964
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8965
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8966
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8967
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8968
instruct andL_reg_immLpow2minus1(iRegLdst dst, iRegLsrc src1, immLpow2minus1 src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8969
  match(Set dst (AndL src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8970
  format %{ "ANDDI   $dst, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8971
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8972
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8973
    // TODO: PPC port $archOpcode(ppc64Opcode_rldicl);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8974
    __ clrldi($dst$$Register, $src1$$Register, 64-log2_long((((jlong) $src2$$constant)+1)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8975
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8976
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8977
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8978
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8979
// AndL + ConvL2I.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8980
instruct convL2I_andL_reg_immLpow2minus1(iRegIdst dst, iRegLsrc src1, immLpow2minus1 src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8981
  match(Set dst (ConvL2I (AndL src1 src2)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8982
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8983
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8984
  format %{ "ANDDI   $dst, $src1, $src2 \t// long + l2i" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8985
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8986
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8987
    // TODO: PPC port $archOpcode(ppc64Opcode_rldicl);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8988
    __ clrldi($dst$$Register, $src1$$Register, 64-log2_long((((jlong) $src2$$constant)+1)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8989
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8990
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8991
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8992
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8993
// Or Instructions
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8994
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8995
// Register Or
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8996
instruct orI_reg_reg(iRegIdst dst, iRegIsrc src1, iRegIsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8997
  match(Set dst (OrI src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8998
  format %{ "OR      $dst, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8999
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9000
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9001
    // TODO: PPC port $archOpcode(ppc64Opcode_or);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9002
    __ or_unchecked($dst$$Register, $src1$$Register, $src2$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9003
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9004
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9005
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9006
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9007
// Expand does not work with above instruct. (??)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9008
instruct orI_reg_reg_2(iRegIdst dst, iRegIsrc src1, iRegIsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9009
  // no match-rule
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9010
  effect(DEF dst, USE src1, USE src2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9011
  format %{ "OR      $dst, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9012
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9013
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9014
    // TODO: PPC port $archOpcode(ppc64Opcode_or);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9015
    __ or_unchecked($dst$$Register, $src1$$Register, $src2$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9016
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9017
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9018
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9019
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9020
instruct tree_orI_orI_orI_reg_reg_Ex(iRegIdst dst, iRegIsrc src1, iRegIsrc src2, iRegIsrc src3, iRegIsrc src4) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9021
  match(Set dst (OrI (OrI (OrI src1 src2) src3) src4));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9022
  ins_cost(DEFAULT_COST*3);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9023
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9024
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9025
    // FIXME: we should do this in the ideal world.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9026
    iRegIdst tmp1;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9027
    iRegIdst tmp2;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9028
    orI_reg_reg(tmp1, src1, src2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9029
    orI_reg_reg_2(tmp2, src3, src4); // Adlc complains about orI_reg_reg.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9030
    orI_reg_reg(dst, tmp1, tmp2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9031
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9032
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9033
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9034
// Immediate Or
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9035
instruct orI_reg_uimm16(iRegIdst dst, iRegIsrc src1, uimmI16 src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9036
  match(Set dst (OrI src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9037
  format %{ "ORI     $dst, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9038
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9039
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9040
    // TODO: PPC port $archOpcode(ppc64Opcode_ori);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9041
    __ ori($dst$$Register, $src1$$Register, ($src2$$constant) & 0xFFFF);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9042
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9043
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9044
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9045
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9046
// Register Or Long
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9047
instruct orL_reg_reg(iRegLdst dst, iRegLsrc src1, iRegLsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9048
  match(Set dst (OrL src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9049
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9050
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9051
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9052
  format %{ "OR      $dst, $src1, $src2 \t// long" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9053
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9054
    // TODO: PPC port $archOpcode(ppc64Opcode_or);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9055
    __ or_unchecked($dst$$Register, $src1$$Register, $src2$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9056
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9057
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9058
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9059
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9060
// OrL + ConvL2I.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9061
instruct orI_regL_regL(iRegIdst dst, iRegLsrc src1, iRegLsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9062
  match(Set dst (ConvL2I (OrL src1 src2)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9063
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9064
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9065
  format %{ "OR      $dst, $src1, $src2 \t// long + l2i" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9066
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9067
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9068
    // TODO: PPC port $archOpcode(ppc64Opcode_or);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9069
    __ or_unchecked($dst$$Register, $src1$$Register, $src2$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9070
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9071
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9072
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9073
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9074
// Immediate Or long
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9075
instruct orL_reg_uimm16(iRegLdst dst, iRegLsrc src1, uimmL16 con) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9076
  match(Set dst (OrL src1 con));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9077
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9078
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9079
  format %{ "ORI     $dst, $src1, $con \t// long" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9080
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9081
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9082
    // TODO: PPC port $archOpcode(ppc64Opcode_ori);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9083
    __ ori($dst$$Register, $src1$$Register, ($con$$constant) & 0xFFFF);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9084
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9085
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9086
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9087
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9088
// Xor Instructions
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9089
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9090
// Register Xor
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9091
instruct xorI_reg_reg(iRegIdst dst, iRegIsrc src1, iRegIsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9092
  match(Set dst (XorI src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9093
  format %{ "XOR     $dst, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9094
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9095
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9096
    // TODO: PPC port $archOpcode(ppc64Opcode_xor);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9097
    __ xorr($dst$$Register, $src1$$Register, $src2$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9098
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9099
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9100
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9101
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9102
// Expand does not work with above instruct. (??)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9103
instruct xorI_reg_reg_2(iRegIdst dst, iRegIsrc src1, iRegIsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9104
  // no match-rule
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9105
  effect(DEF dst, USE src1, USE src2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9106
  format %{ "XOR     $dst, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9107
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9108
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9109
    // TODO: PPC port $archOpcode(ppc64Opcode_xor);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9110
    __ xorr($dst$$Register, $src1$$Register, $src2$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9111
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9112
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9113
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9114
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9115
instruct tree_xorI_xorI_xorI_reg_reg_Ex(iRegIdst dst, iRegIsrc src1, iRegIsrc src2, iRegIsrc src3, iRegIsrc src4) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9116
  match(Set dst (XorI (XorI (XorI src1 src2) src3) src4));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9117
  ins_cost(DEFAULT_COST*3);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9118
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9119
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9120
    // FIXME: we should do this in the ideal world.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9121
    iRegIdst tmp1;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9122
    iRegIdst tmp2;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9123
    xorI_reg_reg(tmp1, src1, src2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9124
    xorI_reg_reg_2(tmp2, src3, src4); // Adlc complains about xorI_reg_reg.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9125
    xorI_reg_reg(dst, tmp1, tmp2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9126
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9127
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9128
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9129
// Immediate Xor
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9130
instruct xorI_reg_uimm16(iRegIdst dst, iRegIsrc src1, uimmI16 src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9131
  match(Set dst (XorI src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9132
  format %{ "XORI    $dst, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9133
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9134
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9135
    // TODO: PPC port $archOpcode(ppc64Opcode_xori);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9136
    __ xori($dst$$Register, $src1$$Register, $src2$$constant);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9137
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9138
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9139
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9140
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9141
// Register Xor Long
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9142
instruct xorL_reg_reg(iRegLdst dst, iRegLsrc src1, iRegLsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9143
  match(Set dst (XorL src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9144
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9145
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9146
  format %{ "XOR     $dst, $src1, $src2 \t// long" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9147
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9148
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9149
    // TODO: PPC port $archOpcode(ppc64Opcode_xor);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9150
    __ xorr($dst$$Register, $src1$$Register, $src2$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9151
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9152
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9153
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9154
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9155
// XorL + ConvL2I.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9156
instruct xorI_regL_regL(iRegIdst dst, iRegLsrc src1, iRegLsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9157
  match(Set dst (ConvL2I (XorL src1 src2)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9158
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9159
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9160
  format %{ "XOR     $dst, $src1, $src2 \t// long + l2i" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9161
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9162
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9163
    // TODO: PPC port $archOpcode(ppc64Opcode_xor);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9164
    __ xorr($dst$$Register, $src1$$Register, $src2$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9165
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9166
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9167
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9168
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9169
// Immediate Xor Long
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9170
instruct xorL_reg_uimm16(iRegLdst dst, iRegLsrc src1, uimmL16 src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9171
  match(Set dst (XorL src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9172
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9173
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9174
  format %{ "XORI    $dst, $src1, $src2 \t// long" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9175
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9176
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9177
    // TODO: PPC port $archOpcode(ppc64Opcode_xori);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9178
    __ xori($dst$$Register, $src1$$Register, $src2$$constant);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9179
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9180
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9181
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9182
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9183
instruct notI_reg(iRegIdst dst, iRegIsrc src1, immI_minus1 src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9184
  match(Set dst (XorI src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9185
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9186
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9187
  format %{ "NOT     $dst, $src1 ($src2)" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9188
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9189
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9190
    // TODO: PPC port $archOpcode(ppc64Opcode_nor);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9191
    __ nor($dst$$Register, $src1$$Register, $src1$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9192
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9193
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9194
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9195
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9196
instruct notL_reg(iRegLdst dst, iRegLsrc src1, immL_minus1 src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9197
  match(Set dst (XorL src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9198
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9199
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9200
  format %{ "NOT     $dst, $src1 ($src2) \t// long" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9201
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9202
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9203
    // TODO: PPC port $archOpcode(ppc64Opcode_nor);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9204
    __ nor($dst$$Register, $src1$$Register, $src1$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9205
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9206
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9207
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9208
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9209
// And-complement
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9210
instruct andcI_reg_reg(iRegIdst dst, iRegIsrc src1, immI_minus1 src2, iRegIsrc src3) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9211
  match(Set dst (AndI (XorI src1 src2) src3));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9212
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9213
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9214
  format %{ "ANDW    $dst, xori($src1, $src2), $src3" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9215
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9216
  ins_encode( enc_andc(dst, src3, src1) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9217
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9218
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9219
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9220
// And-complement
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9221
instruct andcL_reg_reg(iRegLdst dst, iRegLsrc src1, iRegLsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9222
  // no match-rule, false predicate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9223
  effect(DEF dst, USE src1, USE src2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9224
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9225
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9226
  format %{ "ANDC    $dst, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9227
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9228
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9229
    // TODO: PPC port $archOpcode(ppc64Opcode_andc);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9230
    __ andc($dst$$Register, $src1$$Register, $src2$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9231
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9232
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9233
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9234
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9235
//----------Moves between int/long and float/double----------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9236
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9237
// The following rules move values from int/long registers/stack-locations
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9238
// to float/double registers/stack-locations and vice versa, without doing any
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9239
// conversions. These rules are used to implement the bit-conversion methods
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9240
// of java.lang.Float etc., e.g.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9241
//   int   floatToIntBits(float value)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9242
//   float intBitsToFloat(int bits)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9243
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9244
// Notes on the implementation on ppc64:
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9245
// We only provide rules which move between a register and a stack-location,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9246
// because we always have to go through memory when moving between a float
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9247
// register and an integer register.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9248
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9249
//---------- Chain stack slots between similar types --------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9250
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9251
// These are needed so that the rules below can match.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9252
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9253
// Load integer from stack slot
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9254
instruct stkI_to_regI(iRegIdst dst, stackSlotI src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9255
  match(Set dst src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9256
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9257
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9258
  format %{ "LWZ     $dst, $src" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9259
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9260
  ins_encode( enc_lwz(dst, src) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9261
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9262
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9263
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9264
// Store integer to stack slot
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9265
instruct regI_to_stkI(stackSlotI dst, iRegIsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9266
  match(Set dst src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9267
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9268
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9269
  format %{ "STW     $src, $dst \t// stk" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9270
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9271
  ins_encode( enc_stw(src, dst) ); // rs=rt
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9272
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9273
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9274
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9275
// Load long from stack slot
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9276
instruct stkL_to_regL(iRegLdst dst, stackSlotL src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9277
  match(Set dst src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9278
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9279
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9280
  format %{ "LD      $dst, $src \t// long" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9281
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9282
  ins_encode( enc_ld(dst, src) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9283
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9284
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9285
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9286
// Store long to stack slot
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9287
instruct regL_to_stkL(stackSlotL dst, iRegLsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9288
  match(Set dst src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9289
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9290
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9291
  format %{ "STD     $src, $dst \t// long" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9292
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9293
  ins_encode( enc_std(src, dst) ); // rs=rt
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9294
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9295
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9296
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9297
//----------Moves between int and float
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9298
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9299
// Move float value from float stack-location to integer register.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9300
instruct moveF2I_stack_reg(iRegIdst dst, stackSlotF src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9301
  match(Set dst (MoveF2I src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9302
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9303
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9304
  format %{ "LWZ     $dst, $src \t// MoveF2I" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9305
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9306
  ins_encode( enc_lwz(dst, src) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9307
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9308
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9309
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9310
// Move float value from float register to integer stack-location.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9311
instruct moveF2I_reg_stack(stackSlotI dst, regF src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9312
  match(Set dst (MoveF2I src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9313
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9314
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9315
  format %{ "STFS    $src, $dst \t// MoveF2I" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9316
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9317
  ins_encode( enc_stfs(src, dst) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9318
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9319
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9320
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9321
// Move integer value from integer stack-location to float register.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9322
instruct moveI2F_stack_reg(regF dst, stackSlotI src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9323
  match(Set dst (MoveI2F src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9324
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9325
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9326
  format %{ "LFS     $dst, $src \t// MoveI2F" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9327
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9328
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9329
    // TODO: PPC port $archOpcode(ppc64Opcode_lfs);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9330
    int Idisp = $src$$disp + frame_slots_bias($src$$base, ra_);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9331
    __ lfs($dst$$FloatRegister, Idisp, $src$$base$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9332
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9333
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9334
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9335
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9336
// Move integer value from integer register to float stack-location.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9337
instruct moveI2F_reg_stack(stackSlotF dst, iRegIsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9338
  match(Set dst (MoveI2F src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9339
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9340
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9341
  format %{ "STW     $src, $dst \t// MoveI2F" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9342
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9343
  ins_encode( enc_stw(src, dst) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9344
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9345
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9346
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9347
//----------Moves between long and float
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9348
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9349
instruct moveF2L_reg_stack(stackSlotL dst, regF src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9350
  // no match-rule, false predicate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9351
  effect(DEF dst, USE src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9352
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9353
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9354
  format %{ "storeD  $src, $dst \t// STACK" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9355
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9356
  ins_encode( enc_stfd(src, dst) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9357
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9358
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9359
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9360
//----------Moves between long and double
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9361
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9362
// Move double value from double stack-location to long register.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9363
instruct moveD2L_stack_reg(iRegLdst dst, stackSlotD src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9364
  match(Set dst (MoveD2L src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9365
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9366
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9367
  format %{ "LD      $dst, $src \t// MoveD2L" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9368
  ins_encode( enc_ld(dst, src) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9369
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9370
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9371
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9372
// Move double value from double register to long stack-location.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9373
instruct moveD2L_reg_stack(stackSlotL dst, regD src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9374
  match(Set dst (MoveD2L src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9375
  effect(DEF dst, USE src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9376
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9377
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9378
  format %{ "STFD    $src, $dst \t// MoveD2L" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9379
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9380
  ins_encode( enc_stfd(src, dst) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9381
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9382
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9383
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9384
// Move long value from long stack-location to double register.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9385
instruct moveL2D_stack_reg(regD dst, stackSlotL src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9386
  match(Set dst (MoveL2D src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9387
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9388
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9389
  format %{ "LFD     $dst, $src \t// MoveL2D" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9390
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9391
  ins_encode( enc_lfd(dst, src) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9392
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9393
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9394
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9395
// Move long value from long register to double stack-location.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9396
instruct moveL2D_reg_stack(stackSlotD dst, iRegLsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9397
  match(Set dst (MoveL2D src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9398
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9399
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9400
  format %{ "STD     $src, $dst \t// MoveL2D" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9401
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9402
  ins_encode( enc_std(src, dst) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9403
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9404
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9405
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9406
//----------Register Move Instructions-----------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9407
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9408
// Replicate for Superword
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9409
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9410
instruct moveReg(iRegLdst dst, iRegIsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9411
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9412
  effect(DEF dst, USE src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9413
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9414
  format %{ "MR      $dst, $src \t// replicate " %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9415
  // variable size, 0 or 4.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9416
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9417
    // TODO: PPC port $archOpcode(ppc64Opcode_or);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9418
    __ mr_if_needed($dst$$Register, $src$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9419
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9420
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9421
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9422
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9423
//----------Cast instructions (Java-level type cast)---------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9424
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9425
// Cast Long to Pointer for unsafe natives.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9426
instruct castX2P(iRegPdst dst, iRegLsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9427
  match(Set dst (CastX2P src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9428
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9429
  format %{ "MR      $dst, $src \t// Long->Ptr" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9430
  // variable size, 0 or 4.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9431
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9432
    // TODO: PPC port $archOpcode(ppc64Opcode_or);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9433
    __ mr_if_needed($dst$$Register, $src$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9434
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9435
 ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9436
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9437
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9438
// Cast Pointer to Long for unsafe natives.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9439
instruct castP2X(iRegLdst dst, iRegP_N2P src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9440
  match(Set dst (CastP2X src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9441
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9442
  format %{ "MR      $dst, $src \t// Ptr->Long" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9443
  // variable size, 0 or 4.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9444
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9445
    // TODO: PPC port $archOpcode(ppc64Opcode_or);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9446
    __ mr_if_needed($dst$$Register, $src$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9447
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9448
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9449
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9450
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9451
instruct castPP(iRegPdst dst) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9452
  match(Set dst (CastPP dst));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9453
  format %{ " -- \t// castPP of $dst" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9454
  size(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9455
  ins_encode( /*empty*/ );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9456
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9457
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9458
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9459
instruct castII(iRegIdst dst) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9460
  match(Set dst (CastII dst));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9461
  format %{ " -- \t// castII of $dst" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9462
  size(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9463
  ins_encode( /*empty*/ );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9464
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9465
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9466
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9467
instruct checkCastPP(iRegPdst dst) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9468
  match(Set dst (CheckCastPP dst));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9469
  format %{ " -- \t// checkcastPP of $dst" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9470
  size(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9471
  ins_encode( /*empty*/ );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9472
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9473
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9474
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9475
//----------Convert instructions-----------------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9476
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9477
// Convert to boolean.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9478
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9479
// int_to_bool(src) : { 1   if src != 0
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9480
//                    { 0   else
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9481
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9482
// strategy:
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9483
// 1) Count leading zeros of 32 bit-value src,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9484
//    this returns 32 (0b10.0000) iff src == 0 and <32 otherwise.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9485
// 2) Shift 5 bits to the right, result is 0b1 iff src == 0, 0b0 otherwise.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9486
// 3) Xori the result to get 0b1 if src != 0 and 0b0 if src == 0.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9487
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9488
// convI2Bool
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9489
instruct convI2Bool_reg__cntlz_Ex(iRegIdst dst, iRegIsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9490
  match(Set dst (Conv2B src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9491
  predicate(UseCountLeadingZerosInstructionsPPC64);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9492
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9493
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9494
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9495
    immI shiftAmount %{ 0x5 %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9496
    uimmI16 mask %{ 0x1 %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9497
    iRegIdst tmp1;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9498
    iRegIdst tmp2;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9499
    countLeadingZerosI(tmp1, src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9500
    urShiftI_reg_imm(tmp2, tmp1, shiftAmount);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9501
    xorI_reg_uimm16(dst, tmp2, mask);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9502
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9503
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9504
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9505
instruct convI2Bool_reg__cmove(iRegIdst dst, iRegIsrc src, flagsReg crx) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9506
  match(Set dst (Conv2B src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9507
  effect(TEMP crx);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9508
  predicate(!UseCountLeadingZerosInstructionsPPC64);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9509
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9510
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9511
  format %{ "CMPWI   $crx, $src, #0 \t// convI2B"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9512
            "LI      $dst, #0\n\t"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9513
            "BEQ     $crx, done\n\t"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9514
            "LI      $dst, #1\n"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9515
            "done:" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9516
  size(16);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9517
  ins_encode( enc_convI2B_regI__cmove(dst, src, crx, 0x0, 0x1) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9518
  ins_pipe(pipe_class_compare);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9519
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9520
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9521
// ConvI2B + XorI
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9522
instruct xorI_convI2Bool_reg_immIvalue1__cntlz_Ex(iRegIdst dst, iRegIsrc src, immI_1 mask) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9523
  match(Set dst (XorI (Conv2B src) mask));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9524
  predicate(UseCountLeadingZerosInstructionsPPC64);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9525
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9526
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9527
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9528
    immI shiftAmount %{ 0x5 %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9529
    iRegIdst tmp1;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9530
    countLeadingZerosI(tmp1, src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9531
    urShiftI_reg_imm(dst, tmp1, shiftAmount);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9532
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9533
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9534
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9535
instruct xorI_convI2Bool_reg_immIvalue1__cmove(iRegIdst dst, iRegIsrc src, flagsReg crx, immI_1 mask) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9536
  match(Set dst (XorI (Conv2B src) mask));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9537
  effect(TEMP crx);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9538
  predicate(!UseCountLeadingZerosInstructionsPPC64);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9539
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9540
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9541
  format %{ "CMPWI   $crx, $src, #0 \t// Xor(convI2B($src), $mask)"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9542
            "LI      $dst, #1\n\t"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9543
            "BEQ     $crx, done\n\t"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9544
            "LI      $dst, #0\n"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9545
            "done:" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9546
  size(16);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9547
  ins_encode( enc_convI2B_regI__cmove(dst, src, crx, 0x1, 0x0) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9548
  ins_pipe(pipe_class_compare);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9549
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9550
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9551
// AndI 0b0..010..0 + ConvI2B
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9552
instruct convI2Bool_andI_reg_immIpowerOf2(iRegIdst dst, iRegIsrc src, immIpowerOf2 mask) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9553
  match(Set dst (Conv2B (AndI src mask)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9554
  predicate(UseRotateAndMaskInstructionsPPC64);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9555
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9556
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9557
  format %{ "RLWINM  $dst, $src, $mask \t// convI2B(AndI($src, $mask))" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9558
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9559
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9560
    // TODO: PPC port $archOpcode(ppc64Opcode_rlwinm);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9561
    __ rlwinm($dst$$Register, $src$$Register, (32-log2_long((jlong)$mask$$constant)) & 0x1f, 31, 31);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9562
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9563
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9564
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9565
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9566
// Convert pointer to boolean.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9567
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9568
// ptr_to_bool(src) : { 1   if src != 0
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9569
//                    { 0   else
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9570
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9571
// strategy:
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9572
// 1) Count leading zeros of 64 bit-value src,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9573
//    this returns 64 (0b100.0000) iff src == 0 and <64 otherwise.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9574
// 2) Shift 6 bits to the right, result is 0b1 iff src == 0, 0b0 otherwise.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9575
// 3) Xori the result to get 0b1 if src != 0 and 0b0 if src == 0.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9576
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9577
// ConvP2B
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9578
instruct convP2Bool_reg__cntlz_Ex(iRegIdst dst, iRegP_N2P src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9579
  match(Set dst (Conv2B src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9580
  predicate(UseCountLeadingZerosInstructionsPPC64);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9581
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9582
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9583
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9584
    immI shiftAmount %{ 0x6 %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9585
    uimmI16 mask %{ 0x1 %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9586
    iRegIdst tmp1;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9587
    iRegIdst tmp2;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9588
    countLeadingZerosP(tmp1, src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9589
    urShiftI_reg_imm(tmp2, tmp1, shiftAmount);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9590
    xorI_reg_uimm16(dst, tmp2, mask);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9591
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9592
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9593
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9594
instruct convP2Bool_reg__cmove(iRegIdst dst, iRegP_N2P src, flagsReg crx) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9595
  match(Set dst (Conv2B src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9596
  effect(TEMP crx);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9597
  predicate(!UseCountLeadingZerosInstructionsPPC64);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9598
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9599
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9600
  format %{ "CMPDI   $crx, $src, #0 \t// convP2B"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9601
            "LI      $dst, #0\n\t"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9602
            "BEQ     $crx, done\n\t"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9603
            "LI      $dst, #1\n"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9604
            "done:" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9605
  size(16);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9606
  ins_encode( enc_convP2B_regP__cmove(dst, src, crx, 0x0, 0x1) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9607
  ins_pipe(pipe_class_compare);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9608
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9609
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9610
// ConvP2B + XorI
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9611
instruct xorI_convP2Bool_reg__cntlz_Ex(iRegIdst dst, iRegP_N2P src, immI_1 mask) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9612
  match(Set dst (XorI (Conv2B src) mask));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9613
  predicate(UseCountLeadingZerosInstructionsPPC64);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9614
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9615
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9616
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9617
    immI shiftAmount %{ 0x6 %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9618
    iRegIdst tmp1;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9619
    countLeadingZerosP(tmp1, src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9620
    urShiftI_reg_imm(dst, tmp1, shiftAmount);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9621
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9622
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9623
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9624
instruct xorI_convP2Bool_reg_immIvalue1__cmove(iRegIdst dst, iRegP_N2P src, flagsReg crx, immI_1 mask) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9625
  match(Set dst (XorI (Conv2B src) mask));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9626
  effect(TEMP crx);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9627
  predicate(!UseCountLeadingZerosInstructionsPPC64);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9628
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9629
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9630
  format %{ "CMPDI   $crx, $src, #0 \t// XorI(convP2B($src), $mask)"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9631
            "LI      $dst, #1\n\t"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9632
            "BEQ     $crx, done\n\t"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9633
            "LI      $dst, #0\n"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9634
            "done:" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9635
  size(16);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9636
  ins_encode( enc_convP2B_regP__cmove(dst, src, crx, 0x1, 0x0) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9637
  ins_pipe(pipe_class_compare);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9638
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9639
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9640
// if src1 < src2, return -1 else return 0
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9641
instruct cmpLTMask_reg_reg_Ex(iRegIdst dst, iRegIsrc src1, iRegIsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9642
  match(Set dst (CmpLTMask src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9643
  ins_cost(DEFAULT_COST*4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9644
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9645
  expand %{
24349
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  9646
    iRegLdst src1s;
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  9647
    iRegLdst src2s;
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  9648
    iRegLdst diff;
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  9649
    convI2L_reg(src1s, src1); // Ensure proper sign extension.
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  9650
    convI2L_reg(src2s, src2); // Ensure proper sign extension.
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  9651
    subL_reg_reg(diff, src1s, src2s);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9652
    // Need to consider >=33 bit result, therefore we need signmaskL.
24349
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  9653
    signmask64I_regL(dst, diff);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9654
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9655
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9656
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9657
instruct cmpLTMask_reg_immI0(iRegIdst dst, iRegIsrc src1, immI_0 src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9658
  match(Set dst (CmpLTMask src1 src2)); // if src1 < src2, return -1 else return 0
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9659
  format %{ "SRAWI   $dst, $src1, $src2 \t// CmpLTMask" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9660
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9661
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9662
    // TODO: PPC port $archOpcode(ppc64Opcode_srawi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9663
    __ srawi($dst$$Register, $src1$$Register, 0x1f);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9664
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9665
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9666
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9667
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9668
//----------Arithmetic Conversion Instructions---------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9669
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9670
// Convert to Byte  -- nop
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9671
// Convert to Short -- nop
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9672
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9673
// Convert to Int
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9674
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9675
instruct convB2I_reg(iRegIdst dst, iRegIsrc src, immI_24 amount) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9676
  match(Set dst (RShiftI (LShiftI src amount) amount));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9677
  format %{ "EXTSB   $dst, $src \t// byte->int" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9678
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9679
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9680
    // TODO: PPC port $archOpcode(ppc64Opcode_extsb);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9681
    __ extsb($dst$$Register, $src$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9682
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9683
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9684
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9685
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9686
// LShiftI 16 + RShiftI 16 converts short to int.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9687
instruct convS2I_reg(iRegIdst dst, iRegIsrc src, immI_16 amount) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9688
  match(Set dst (RShiftI (LShiftI src amount) amount));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9689
  format %{ "EXTSH   $dst, $src \t// short->int" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9690
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9691
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9692
    // TODO: PPC port $archOpcode(ppc64Opcode_extsh);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9693
    __ extsh($dst$$Register, $src$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9694
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9695
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9696
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9697
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9698
// ConvL2I + ConvI2L: Sign extend int in long register.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9699
instruct sxtI_L2L_reg(iRegLdst dst, iRegLsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9700
  match(Set dst (ConvI2L (ConvL2I src)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9701
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9702
  format %{ "EXTSW   $dst, $src \t// long->long" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9703
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9704
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9705
    // TODO: PPC port $archOpcode(ppc64Opcode_extsw);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9706
    __ extsw($dst$$Register, $src$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9707
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9708
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9709
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9710
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9711
instruct convL2I_reg(iRegIdst dst, iRegLsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9712
  match(Set dst (ConvL2I src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9713
  format %{ "MR      $dst, $src \t// long->int" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9714
  // variable size, 0 or 4
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9715
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9716
    // TODO: PPC port $archOpcode(ppc64Opcode_or);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9717
    __ mr_if_needed($dst$$Register, $src$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9718
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9719
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9720
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9721
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9722
instruct convD2IRaw_regD(regD dst, regD src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9723
  // no match-rule, false predicate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9724
  effect(DEF dst, USE src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9725
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9726
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9727
  format %{ "FCTIWZ $dst, $src \t// convD2I, $src != NaN" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9728
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9729
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9730
    // TODO: PPC port $archOpcode(ppc64Opcode_fctiwz);;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9731
    __ fctiwz($dst$$FloatRegister, $src$$FloatRegister);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9732
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9733
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9734
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9735
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9736
instruct cmovI_bso_stackSlotL(iRegIdst dst, flagsReg crx, stackSlotL src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9737
  // no match-rule, false predicate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9738
  effect(DEF dst, USE crx, USE src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9739
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9740
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9741
  ins_variable_size_depending_on_alignment(true);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9742
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9743
  format %{ "cmovI   $crx, $dst, $src" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9744
  // Worst case is branch + move + stop, no stop without scheduler.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9745
  size(false /* TODO: PPC PORT(InsertEndGroupPPC64 && Compile::current()->do_hb_scheduling())*/ ? 12 : 8);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9746
  ins_encode( enc_cmove_bso_stackSlotL(dst, crx, src) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9747
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9748
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9749
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9750
instruct cmovI_bso_stackSlotL_conLvalue0_Ex(iRegIdst dst, flagsReg crx, stackSlotL mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9751
  // no match-rule, false predicate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9752
  effect(DEF dst, USE crx, USE mem);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9753
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9754
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9755
  format %{ "CmovI   $dst, $crx, $mem \t// postalloc expanded" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9756
  postalloc_expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9757
    //
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9758
    // replaces
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9759
    //
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9760
    //   region  dst  crx  mem
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9761
    //    \       |    |   /
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9762
    //     dst=cmovI_bso_stackSlotL_conLvalue0
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9763
    //
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9764
    // with
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9765
    //
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9766
    //   region  dst
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9767
    //    \       /
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9768
    //     dst=loadConI16(0)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9769
    //      |
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9770
    //      ^  region  dst  crx  mem
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9771
    //      |   \       |    |    /
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9772
    //      dst=cmovI_bso_stackSlotL
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9773
    //
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9774
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9775
    // Create new nodes.
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  9776
    MachNode *m1 = new loadConI16Node();
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  9777
    MachNode *m2 = new cmovI_bso_stackSlotLNode();
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9778
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9779
    // inputs for new nodes
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9780
    m1->add_req(n_region);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9781
    m2->add_req(n_region, n_crx, n_mem);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9782
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9783
    // precedences for new nodes
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9784
    m2->add_prec(m1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9785
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9786
    // operands for new nodes
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9787
    m1->_opnds[0] = op_dst;
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  9788
    m1->_opnds[1] = new immI16Oper(0);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9789
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9790
    m2->_opnds[0] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9791
    m2->_opnds[1] = op_crx;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9792
    m2->_opnds[2] = op_mem;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9793
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9794
    // registers for new nodes
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9795
    ra_->set_pair(m1->_idx, ra_->get_reg_second(this), ra_->get_reg_first(this)); // dst
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9796
    ra_->set_pair(m2->_idx, ra_->get_reg_second(this), ra_->get_reg_first(this)); // dst
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9797
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9798
    // Insert new nodes.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9799
    nodes->push(m1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9800
    nodes->push(m2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9801
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9802
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9803
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9804
// Double to Int conversion, NaN is mapped to 0.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9805
instruct convD2I_reg_ExEx(iRegIdst dst, regD src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9806
  match(Set dst (ConvD2I src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9807
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9808
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9809
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9810
    regD tmpD;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9811
    stackSlotL tmpS;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9812
    flagsReg crx;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9813
    cmpDUnordered_reg_reg(crx, src, src);               // Check whether src is NaN.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9814
    convD2IRaw_regD(tmpD, src);                         // Convert float to int (speculated).
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9815
    moveD2L_reg_stack(tmpS, tmpD);                      // Store float to stack (speculated).
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9816
    cmovI_bso_stackSlotL_conLvalue0_Ex(dst, crx, tmpS); // Cmove based on NaN check.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9817
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9818
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9819
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9820
instruct convF2IRaw_regF(regF dst, regF src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9821
  // no match-rule, false predicate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9822
  effect(DEF dst, USE src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9823
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9824
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9825
  format %{ "FCTIWZ $dst, $src \t// convF2I, $src != NaN" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9826
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9827
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9828
    // TODO: PPC port $archOpcode(ppc64Opcode_fctiwz);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9829
    __ fctiwz($dst$$FloatRegister, $src$$FloatRegister);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9830
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9831
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9832
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9833
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9834
// Float to Int conversion, NaN is mapped to 0.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9835
instruct convF2I_regF_ExEx(iRegIdst dst, regF src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9836
  match(Set dst (ConvF2I src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9837
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9838
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9839
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9840
    regF tmpF;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9841
    stackSlotL tmpS;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9842
    flagsReg crx;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9843
    cmpFUnordered_reg_reg(crx, src, src);               // Check whether src is NaN.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9844
    convF2IRaw_regF(tmpF, src);                         // Convert float to int (speculated).
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9845
    moveF2L_reg_stack(tmpS, tmpF);                      // Store float to stack (speculated).
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9846
    cmovI_bso_stackSlotL_conLvalue0_Ex(dst, crx, tmpS); // Cmove based on NaN check.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9847
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9848
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9849
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9850
// Convert to Long
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9851
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9852
instruct convI2L_reg(iRegLdst dst, iRegIsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9853
  match(Set dst (ConvI2L src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9854
  format %{ "EXTSW   $dst, $src \t// int->long" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9855
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9856
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9857
    // TODO: PPC port $archOpcode(ppc64Opcode_extsw);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9858
    __ extsw($dst$$Register, $src$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9859
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9860
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9861
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9862
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9863
// Zero-extend: convert unsigned int to long (convUI2L).
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9864
instruct zeroExtendL_regI(iRegLdst dst, iRegIsrc src, immL_32bits mask) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9865
  match(Set dst (AndL (ConvI2L src) mask));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9866
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9867
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9868
  format %{ "CLRLDI  $dst, $src, #32 \t// zero-extend int to long" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9869
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9870
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9871
    // TODO: PPC port $archOpcode(ppc64Opcode_rldicl);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9872
    __ clrldi($dst$$Register, $src$$Register, 32);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9873
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9874
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9875
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9876
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9877
// Zero-extend: convert unsigned int to long in long register.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9878
instruct zeroExtendL_regL(iRegLdst dst, iRegLsrc src, immL_32bits mask) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9879
  match(Set dst (AndL src mask));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9880
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9881
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9882
  format %{ "CLRLDI  $dst, $src, #32 \t// zero-extend int to long" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9883
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9884
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9885
    // TODO: PPC port $archOpcode(ppc64Opcode_rldicl);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9886
    __ clrldi($dst$$Register, $src$$Register, 32);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9887
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9888
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9889
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9890
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9891
instruct convF2LRaw_regF(regF dst, regF src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9892
  // no match-rule, false predicate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9893
  effect(DEF dst, USE src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9894
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9895
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9896
  format %{ "FCTIDZ $dst, $src \t// convF2L, $src != NaN" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9897
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9898
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9899
    // TODO: PPC port $archOpcode(ppc64Opcode_fctiwz);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9900
    __ fctidz($dst$$FloatRegister, $src$$FloatRegister);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9901
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9902
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9903
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9904
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9905
instruct cmovL_bso_stackSlotL(iRegLdst dst, flagsReg crx, stackSlotL src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9906
  // no match-rule, false predicate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9907
  effect(DEF dst, USE crx, USE src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9908
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9909
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9910
  ins_variable_size_depending_on_alignment(true);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9911
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9912
  format %{ "cmovL   $crx, $dst, $src" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9913
  // Worst case is branch + move + stop, no stop without scheduler.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9914
  size(false /* TODO: PPC PORT Compile::current()->do_hb_scheduling()*/ ? 12 : 8);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9915
  ins_encode( enc_cmove_bso_stackSlotL(dst, crx, src) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9916
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9917
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9918
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9919
instruct cmovL_bso_stackSlotL_conLvalue0_Ex(iRegLdst dst, flagsReg crx, stackSlotL mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9920
  // no match-rule, false predicate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9921
  effect(DEF dst, USE crx, USE mem);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9922
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9923
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9924
  format %{ "CmovL   $dst, $crx, $mem \t// postalloc expanded" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9925
  postalloc_expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9926
    //
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9927
    // replaces
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9928
    //
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9929
    //   region  dst  crx  mem
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9930
    //    \       |    |   /
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9931
    //     dst=cmovL_bso_stackSlotL_conLvalue0
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9932
    //
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9933
    // with
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9934
    //
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9935
    //   region  dst
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9936
    //    \       /
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9937
    //     dst=loadConL16(0)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9938
    //      |
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9939
    //      ^  region  dst  crx  mem
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9940
    //      |   \       |    |    /
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9941
    //      dst=cmovL_bso_stackSlotL
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9942
    //
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9943
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9944
    // Create new nodes.
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  9945
    MachNode *m1 = new loadConL16Node();
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  9946
    MachNode *m2 = new cmovL_bso_stackSlotLNode();
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9947
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9948
    // inputs for new nodes
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9949
    m1->add_req(n_region);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9950
    m2->add_req(n_region, n_crx, n_mem);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9951
    m2->add_prec(m1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9952
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9953
    // operands for new nodes
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9954
    m1->_opnds[0] = op_dst;
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  9955
    m1->_opnds[1] = new immL16Oper(0);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9956
    m2->_opnds[0] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9957
    m2->_opnds[1] = op_crx;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9958
    m2->_opnds[2] = op_mem;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9959
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9960
    // registers for new nodes
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9961
    ra_->set_pair(m1->_idx, ra_->get_reg_second(this), ra_->get_reg_first(this)); // dst
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9962
    ra_->set_pair(m2->_idx, ra_->get_reg_second(this), ra_->get_reg_first(this)); // dst
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9963
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9964
    // Insert new nodes.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9965
    nodes->push(m1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9966
    nodes->push(m2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9967
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9968
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9969
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9970
// Float to Long conversion, NaN is mapped to 0.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9971
instruct convF2L_reg_ExEx(iRegLdst dst, regF src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9972
  match(Set dst (ConvF2L src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9973
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9974
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9975
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9976
    regF tmpF;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9977
    stackSlotL tmpS;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9978
    flagsReg crx;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9979
    cmpFUnordered_reg_reg(crx, src, src);               // Check whether src is NaN.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9980
    convF2LRaw_regF(tmpF, src);                         // Convert float to long (speculated).
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9981
    moveF2L_reg_stack(tmpS, tmpF);                      // Store float to stack (speculated).
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9982
    cmovL_bso_stackSlotL_conLvalue0_Ex(dst, crx, tmpS); // Cmove based on NaN check.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9983
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9984
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9985
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9986
instruct convD2LRaw_regD(regD dst, regD src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9987
  // no match-rule, false predicate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9988
  effect(DEF dst, USE src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9989
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9990
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9991
  format %{ "FCTIDZ $dst, $src \t// convD2L $src != NaN" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9992
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9993
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9994
    // TODO: PPC port $archOpcode(ppc64Opcode_fctiwz);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9995
    __ fctidz($dst$$FloatRegister, $src$$FloatRegister);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9996
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9997
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9998
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9999
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10000
// Double to Long conversion, NaN is mapped to 0.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10001
instruct convD2L_reg_ExEx(iRegLdst dst, regD src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10002
  match(Set dst (ConvD2L src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10003
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10004
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10005
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10006
    regD tmpD;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10007
    stackSlotL tmpS;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10008
    flagsReg crx;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10009
    cmpDUnordered_reg_reg(crx, src, src);               // Check whether src is NaN.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10010
    convD2LRaw_regD(tmpD, src);                         // Convert float to long (speculated).
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10011
    moveD2L_reg_stack(tmpS, tmpD);                      // Store float to stack (speculated).
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10012
    cmovL_bso_stackSlotL_conLvalue0_Ex(dst, crx, tmpS); // Cmove based on NaN check.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10013
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10014
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10015
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10016
// Convert to Float
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10017
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10018
// Placed here as needed in expand.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10019
instruct convL2DRaw_regD(regD dst, regD src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10020
  // no match-rule, false predicate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10021
  effect(DEF dst, USE src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10022
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10023
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10024
  format %{ "FCFID $dst, $src \t// convL2D" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10025
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10026
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10027
    // TODO: PPC port $archOpcode(ppc64Opcode_fcfid);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10028
    __ fcfid($dst$$FloatRegister, $src$$FloatRegister);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10029
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10030
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10031
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10032
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10033
// Placed here as needed in expand.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10034
instruct convD2F_reg(regF dst, regD src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10035
  match(Set dst (ConvD2F src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10036
  format %{ "FRSP    $dst, $src \t// convD2F" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10037
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10038
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10039
    // TODO: PPC port $archOpcode(ppc64Opcode_frsp);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10040
    __ frsp($dst$$FloatRegister, $src$$FloatRegister);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10041
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10042
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10043
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10044
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10045
// Integer to Float conversion.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10046
instruct convI2F_ireg_Ex(regF dst, iRegIsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10047
  match(Set dst (ConvI2F src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10048
  predicate(!VM_Version::has_fcfids());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10049
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10050
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10051
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10052
    iRegLdst tmpL;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10053
    stackSlotL tmpS;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10054
    regD tmpD;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10055
    regD tmpD2;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10056
    convI2L_reg(tmpL, src);              // Sign-extension int to long.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10057
    regL_to_stkL(tmpS, tmpL);            // Store long to stack.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10058
    moveL2D_stack_reg(tmpD, tmpS);       // Load long into double register.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10059
    convL2DRaw_regD(tmpD2, tmpD);        // Convert to double.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10060
    convD2F_reg(dst, tmpD2);             // Convert double to float.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10061
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10062
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10063
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10064
instruct convL2FRaw_regF(regF dst, regD src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10065
  // no match-rule, false predicate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10066
  effect(DEF dst, USE src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10067
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10068
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10069
  format %{ "FCFIDS $dst, $src \t// convL2F" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10070
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10071
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10072
    // TODO: PPC port $archOpcode(ppc64Opcode_fcfid);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10073
    __ fcfids($dst$$FloatRegister, $src$$FloatRegister);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10074
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10075
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10076
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10077
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10078
// Integer to Float conversion. Special version for Power7.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10079
instruct convI2F_ireg_fcfids_Ex(regF dst, iRegIsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10080
  match(Set dst (ConvI2F src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10081
  predicate(VM_Version::has_fcfids());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10082
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10083
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10084
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10085
    iRegLdst tmpL;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10086
    stackSlotL tmpS;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10087
    regD tmpD;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10088
    convI2L_reg(tmpL, src);              // Sign-extension int to long.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10089
    regL_to_stkL(tmpS, tmpL);            // Store long to stack.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10090
    moveL2D_stack_reg(tmpD, tmpS);       // Load long into double register.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10091
    convL2FRaw_regF(dst, tmpD);          // Convert to float.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10092
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10093
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10094
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10095
// L2F to avoid runtime call.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10096
instruct convL2F_ireg_fcfids_Ex(regF dst, iRegLsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10097
  match(Set dst (ConvL2F src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10098
  predicate(VM_Version::has_fcfids());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10099
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10100
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10101
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10102
    stackSlotL tmpS;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10103
    regD tmpD;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10104
    regL_to_stkL(tmpS, src);             // Store long to stack.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10105
    moveL2D_stack_reg(tmpD, tmpS);       // Load long into double register.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10106
    convL2FRaw_regF(dst, tmpD);          // Convert to float.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10107
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10108
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10109
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10110
// Moved up as used in expand.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10111
//instruct convD2F_reg(regF dst, regD src) %{%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10112
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10113
// Convert to Double
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10114
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10115
// Integer to Double conversion.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10116
instruct convI2D_reg_Ex(regD dst, iRegIsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10117
  match(Set dst (ConvI2D src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10118
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10119
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10120
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10121
    iRegLdst tmpL;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10122
    stackSlotL tmpS;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10123
    regD tmpD;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10124
    convI2L_reg(tmpL, src);              // Sign-extension int to long.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10125
    regL_to_stkL(tmpS, tmpL);            // Store long to stack.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10126
    moveL2D_stack_reg(tmpD, tmpS);       // Load long into double register.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10127
    convL2DRaw_regD(dst, tmpD);          // Convert to double.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10128
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10129
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10130
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10131
// Long to Double conversion
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10132
instruct convL2D_reg_Ex(regD dst, stackSlotL src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10133
  match(Set dst (ConvL2D src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10134
  ins_cost(DEFAULT_COST + MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10135
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10136
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10137
    regD tmpD;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10138
    moveL2D_stack_reg(tmpD, src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10139
    convL2DRaw_regD(dst, tmpD);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10140
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10141
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10142
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10143
instruct convF2D_reg(regD dst, regF src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10144
  match(Set dst (ConvF2D src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10145
  format %{ "FMR     $dst, $src \t// float->double" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10146
  // variable size, 0 or 4
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10147
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10148
    // TODO: PPC port $archOpcode(ppc64Opcode_fmr);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10149
    __ fmr_if_needed($dst$$FloatRegister, $src$$FloatRegister);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10150
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10151
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10152
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10153
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10154
//----------Control Flow Instructions------------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10155
// Compare Instructions
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10156
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10157
// Compare Integers
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10158
instruct cmpI_reg_reg(flagsReg crx, iRegIsrc src1, iRegIsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10159
  match(Set crx (CmpI src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10160
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10161
  format %{ "CMPW    $crx, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10162
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10163
    // TODO: PPC port $archOpcode(ppc64Opcode_cmp);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10164
    __ cmpw($crx$$CondRegister, $src1$$Register, $src2$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10165
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10166
  ins_pipe(pipe_class_compare);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10167
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10168
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10169
instruct cmpI_reg_imm16(flagsReg crx, iRegIsrc src1, immI16 src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10170
  match(Set crx (CmpI src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10171
  format %{ "CMPWI   $crx, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10172
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10173
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10174
    // TODO: PPC port $archOpcode(ppc64Opcode_cmpi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10175
    __ cmpwi($crx$$CondRegister, $src1$$Register, $src2$$constant);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10176
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10177
  ins_pipe(pipe_class_compare);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10178
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10179
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10180
// (src1 & src2) == 0?
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10181
instruct testI_reg_imm(flagsRegCR0 cr0, iRegIsrc src1, uimmI16 src2, immI_0 zero) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10182
  match(Set cr0 (CmpI (AndI src1 src2) zero));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10183
  // r0 is killed
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10184
  format %{ "ANDI    R0, $src1, $src2 \t// BTST int" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10185
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10186
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10187
    // TODO: PPC port $archOpcode(ppc64Opcode_andi_);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10188
    // FIXME: avoid andi_ ?
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10189
    __ andi_(R0, $src1$$Register, $src2$$constant);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10190
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10191
  ins_pipe(pipe_class_compare);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10192
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10193
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10194
instruct cmpL_reg_reg(flagsReg crx, iRegLsrc src1, iRegLsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10195
  match(Set crx (CmpL src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10196
  format %{ "CMPD    $crx, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10197
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10198
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10199
    // TODO: PPC port $archOpcode(ppc64Opcode_cmp);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10200
    __ cmpd($crx$$CondRegister, $src1$$Register, $src2$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10201
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10202
  ins_pipe(pipe_class_compare);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10203
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10204
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10205
instruct cmpL_reg_imm16(flagsReg crx, iRegLsrc src1, immL16 src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10206
  match(Set crx (CmpL src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10207
  format %{ "CMPDI   $crx, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10208
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10209
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10210
    // TODO: PPC port $archOpcode(ppc64Opcode_cmpi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10211
    __ cmpdi($crx$$CondRegister, $src1$$Register, $src2$$constant);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10212
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10213
  ins_pipe(pipe_class_compare);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10214
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10215
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10216
instruct testL_reg_reg(flagsRegCR0 cr0, iRegLsrc src1, iRegLsrc src2, immL_0 zero) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10217
  match(Set cr0 (CmpL (AndL src1 src2) zero));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10218
  // r0 is killed
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10219
  format %{ "AND     R0, $src1, $src2 \t// BTST long" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10220
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10221
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10222
    // TODO: PPC port $archOpcode(ppc64Opcode_and_);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10223
    __ and_(R0, $src1$$Register, $src2$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10224
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10225
  ins_pipe(pipe_class_compare);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10226
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10227
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10228
instruct testL_reg_imm(flagsRegCR0 cr0, iRegLsrc src1, uimmL16 src2, immL_0 zero) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10229
  match(Set cr0 (CmpL (AndL src1 src2) zero));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10230
  // r0 is killed
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10231
  format %{ "ANDI    R0, $src1, $src2 \t// BTST long" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10232
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10233
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10234
    // TODO: PPC port $archOpcode(ppc64Opcode_andi_);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10235
    // FIXME: avoid andi_ ?
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10236
    __ andi_(R0, $src1$$Register, $src2$$constant);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10237
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10238
  ins_pipe(pipe_class_compare);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10239
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10240
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10241
instruct cmovI_conIvalueMinus1_conIvalue1(iRegIdst dst, flagsReg crx) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10242
  // no match-rule, false predicate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10243
  effect(DEF dst, USE crx);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10244
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10245
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10246
  ins_variable_size_depending_on_alignment(true);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10247
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10248
  format %{ "cmovI   $crx, $dst, -1, 0, +1" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10249
  // Worst case is branch + move + branch + move + stop, no stop without scheduler.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10250
  size(false /* TODO: PPC PORTInsertEndGroupPPC64 && Compile::current()->do_hb_scheduling())*/ ? 20 : 16);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10251
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10252
    // TODO: PPC port $archOpcode(ppc64Opcode_cmove);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10253
    Label done;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10254
    // li(Rdst, 0);              // equal -> 0
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10255
    __ beq($crx$$CondRegister, done);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10256
    __ li($dst$$Register, 1);    // greater -> +1
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10257
    __ bgt($crx$$CondRegister, done);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10258
    __ li($dst$$Register, -1);   // unordered or less -> -1
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10259
    // TODO: PPC port__ endgroup_if_needed(_size == 20);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10260
    __ bind(done);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10261
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10262
  ins_pipe(pipe_class_compare);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10263
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10264
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10265
instruct cmovI_conIvalueMinus1_conIvalue0_conIvalue1_Ex(iRegIdst dst, flagsReg crx) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10266
  // no match-rule, false predicate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10267
  effect(DEF dst, USE crx);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10268
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10269
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10270
  format %{ "CmovI    $crx, $dst, -1, 0, +1 \t// postalloc expanded" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10271
  postalloc_expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10272
    //
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10273
    // replaces
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10274
    //
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10275
    //   region  crx
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10276
    //    \       |
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10277
    //     dst=cmovI_conIvalueMinus1_conIvalue0_conIvalue1
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10278
    //
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10279
    // with
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10280
    //
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10281
    //   region
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10282
    //    \
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10283
    //     dst=loadConI16(0)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10284
    //      |
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10285
    //      ^  region  crx
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10286
    //      |   \       |
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10287
    //      dst=cmovI_conIvalueMinus1_conIvalue1
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10288
    //
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10289
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10290
    // Create new nodes.
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
 10291
    MachNode *m1 = new loadConI16Node();
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
 10292
    MachNode *m2 = new cmovI_conIvalueMinus1_conIvalue1Node();
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10293
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10294
    // inputs for new nodes
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10295
    m1->add_req(n_region);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10296
    m2->add_req(n_region, n_crx);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10297
    m2->add_prec(m1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10298
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10299
    // operands for new nodes
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10300
    m1->_opnds[0] = op_dst;
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
 10301
    m1->_opnds[1] = new immI16Oper(0);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10302
    m2->_opnds[0] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10303
    m2->_opnds[1] = op_crx;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10304
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10305
    // registers for new nodes
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10306
    ra_->set_pair(m1->_idx, ra_->get_reg_second(this), ra_->get_reg_first(this)); // dst
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10307
    ra_->set_pair(m2->_idx, ra_->get_reg_second(this), ra_->get_reg_first(this)); // dst
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10308
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10309
    // Insert new nodes.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10310
    nodes->push(m1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10311
    nodes->push(m2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10312
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10313
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10314
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10315
// Manifest a CmpL3 result in an integer register. Very painful.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10316
// This is the test to avoid.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10317
// (src1 < src2) ? -1 : ((src1 > src2) ? 1 : 0)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10318
instruct cmpL3_reg_reg_ExEx(iRegIdst dst, iRegLsrc src1, iRegLsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10319
  match(Set dst (CmpL3 src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10320
  ins_cost(DEFAULT_COST*5+BRANCH_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10321
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10322
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10323
    flagsReg tmp1;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10324
    cmpL_reg_reg(tmp1, src1, src2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10325
    cmovI_conIvalueMinus1_conIvalue0_conIvalue1_Ex(dst, tmp1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10326
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10327
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10328
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10329
// Implicit range checks.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10330
// A range check in the ideal world has one of the following shapes:
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10331
//  - (If le (CmpU length index)), (IfTrue  throw exception)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10332
//  - (If lt (CmpU index length)), (IfFalse throw exception)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10333
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10334
// Match range check 'If le (CmpU length index)'.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10335
instruct rangeCheck_iReg_uimm15(cmpOp cmp, iRegIsrc src_length, uimmI15 index, label labl) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10336
  match(If cmp (CmpU src_length index));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10337
  effect(USE labl);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10338
  predicate(TrapBasedRangeChecks &&
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10339
            _kids[0]->_leaf->as_Bool()->_test._test == BoolTest::le &&
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10340
            PROB_UNLIKELY(_leaf->as_If()->_prob) >= PROB_ALWAYS &&
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10341
            (Matcher::branches_to_uncommon_trap(_leaf)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10342
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10343
  ins_is_TrapBasedCheckNode(true);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10344
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10345
  format %{ "TWI     $index $cmp $src_length \t// RangeCheck => trap $labl" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10346
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10347
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10348
    // TODO: PPC port $archOpcode(ppc64Opcode_twi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10349
    if ($cmp$$cmpcode == 0x1 /* less_equal */) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10350
      __ trap_range_check_le($src_length$$Register, $index$$constant);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10351
    } else {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10352
      // Both successors are uncommon traps, probability is 0.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10353
      // Node got flipped during fixup flow.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10354
      assert($cmp$$cmpcode == 0x9, "must be greater");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10355
      __ trap_range_check_g($src_length$$Register, $index$$constant);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10356
    }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10357
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10358
  ins_pipe(pipe_class_trap);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10359
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10360
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10361
// Match range check 'If lt (CmpU index length)'.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10362
instruct rangeCheck_iReg_iReg(cmpOp cmp, iRegIsrc src_index, iRegIsrc src_length, label labl) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10363
  match(If cmp (CmpU src_index src_length));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10364
  effect(USE labl);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10365
  predicate(TrapBasedRangeChecks &&
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10366
            _kids[0]->_leaf->as_Bool()->_test._test == BoolTest::lt &&
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10367
            _leaf->as_If()->_prob >= PROB_ALWAYS &&
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10368
            (Matcher::branches_to_uncommon_trap(_leaf)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10369
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10370
  ins_is_TrapBasedCheckNode(true);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10371
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10372
  format %{ "TW      $src_index $cmp $src_length \t// RangeCheck => trap $labl" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10373
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10374
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10375
    // TODO: PPC port $archOpcode(ppc64Opcode_tw);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10376
    if ($cmp$$cmpcode == 0x0 /* greater_equal */) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10377
      __ trap_range_check_ge($src_index$$Register, $src_length$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10378
    } else {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10379
      // Both successors are uncommon traps, probability is 0.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10380
      // Node got flipped during fixup flow.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10381
      assert($cmp$$cmpcode == 0x8, "must be less");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10382
      __ trap_range_check_l($src_index$$Register, $src_length$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10383
    }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10384
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10385
  ins_pipe(pipe_class_trap);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10386
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10387
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10388
// Match range check 'If lt (CmpU index length)'.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10389
instruct rangeCheck_uimm15_iReg(cmpOp cmp, iRegIsrc src_index, uimmI15 length, label labl) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10390
  match(If cmp (CmpU src_index length));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10391
  effect(USE labl);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10392
  predicate(TrapBasedRangeChecks &&
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10393
            _kids[0]->_leaf->as_Bool()->_test._test == BoolTest::lt &&
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10394
            _leaf->as_If()->_prob >= PROB_ALWAYS &&
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10395
            (Matcher::branches_to_uncommon_trap(_leaf)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10396
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10397
  ins_is_TrapBasedCheckNode(true);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10398
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10399
  format %{ "TWI     $src_index $cmp $length \t// RangeCheck => trap $labl" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10400
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10401
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10402
    // TODO: PPC port $archOpcode(ppc64Opcode_twi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10403
    if ($cmp$$cmpcode == 0x0 /* greater_equal */) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10404
      __ trap_range_check_ge($src_index$$Register, $length$$constant);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10405
    } else {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10406
      // Both successors are uncommon traps, probability is 0.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10407
      // Node got flipped during fixup flow.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10408
      assert($cmp$$cmpcode == 0x8, "must be less");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10409
      __ trap_range_check_l($src_index$$Register, $length$$constant);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10410
    }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10411
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10412
  ins_pipe(pipe_class_trap);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10413
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10414
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10415
instruct compU_reg_reg(flagsReg crx, iRegIsrc src1, iRegIsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10416
  match(Set crx (CmpU src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10417
  format %{ "CMPLW   $crx, $src1, $src2 \t// unsigned" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10418
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10419
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10420
    // TODO: PPC port $archOpcode(ppc64Opcode_cmpl);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10421
    __ cmplw($crx$$CondRegister, $src1$$Register, $src2$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10422
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10423
  ins_pipe(pipe_class_compare);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10424
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10425
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10426
instruct compU_reg_uimm16(flagsReg crx, iRegIsrc src1, uimmI16 src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10427
  match(Set crx (CmpU src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10428
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10429
  format %{ "CMPLWI  $crx, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10430
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10431
    // TODO: PPC port $archOpcode(ppc64Opcode_cmpli);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10432
    __ cmplwi($crx$$CondRegister, $src1$$Register, $src2$$constant);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10433
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10434
  ins_pipe(pipe_class_compare);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10435
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10436
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10437
// Implicit zero checks (more implicit null checks).
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10438
// No constant pool entries required.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10439
instruct zeroCheckN_iReg_imm0(cmpOp cmp, iRegNsrc value, immN_0 zero, label labl) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10440
  match(If cmp (CmpN value zero));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10441
  effect(USE labl);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10442
  predicate(TrapBasedNullChecks &&
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10443
            _kids[0]->_leaf->as_Bool()->_test._test == BoolTest::ne &&
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10444
            _leaf->as_If()->_prob >= PROB_LIKELY_MAG(4) &&
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10445
            Matcher::branches_to_uncommon_trap(_leaf));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10446
  ins_cost(1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10447
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10448
  ins_is_TrapBasedCheckNode(true);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10449
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10450
  format %{ "TDI     $value $cmp $zero \t// ZeroCheckN => trap $labl" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10451
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10452
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10453
    // TODO: PPC port $archOpcode(ppc64Opcode_tdi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10454
    if ($cmp$$cmpcode == 0xA) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10455
      __ trap_null_check($value$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10456
    } else {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10457
      // Both successors are uncommon traps, probability is 0.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10458
      // Node got flipped during fixup flow.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10459
      assert($cmp$$cmpcode == 0x2 , "must be equal(0xA) or notEqual(0x2)");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10460
      __ trap_null_check($value$$Register, Assembler::traptoGreaterThanUnsigned);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10461
    }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10462
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10463
  ins_pipe(pipe_class_trap);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10464
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10465
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10466
// Compare narrow oops.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10467
instruct cmpN_reg_reg(flagsReg crx, iRegNsrc src1, iRegNsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10468
  match(Set crx (CmpN src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10469
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10470
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10471
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10472
  format %{ "CMPLW   $crx, $src1, $src2 \t// compressed ptr" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10473
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10474
    // TODO: PPC port $archOpcode(ppc64Opcode_cmpl);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10475
    __ cmplw($crx$$CondRegister, $src1$$Register, $src2$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10476
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10477
  ins_pipe(pipe_class_compare);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10478
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10479
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10480
instruct cmpN_reg_imm0(flagsReg crx, iRegNsrc src1, immN_0 src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10481
  match(Set crx (CmpN src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10482
  // Make this more expensive than zeroCheckN_iReg_imm0.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10483
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10484
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10485
  format %{ "CMPLWI  $crx, $src1, $src2 \t// compressed ptr" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10486
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10487
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10488
    // TODO: PPC port $archOpcode(ppc64Opcode_cmpli);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10489
    __ cmplwi($crx$$CondRegister, $src1$$Register, $src2$$constant);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10490
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10491
  ins_pipe(pipe_class_compare);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10492
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10493
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10494
// Implicit zero checks (more implicit null checks).
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10495
// No constant pool entries required.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10496
instruct zeroCheckP_reg_imm0(cmpOp cmp, iRegP_N2P value, immP_0 zero, label labl) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10497
  match(If cmp (CmpP value zero));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10498
  effect(USE labl);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10499
  predicate(TrapBasedNullChecks &&
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10500
            _kids[0]->_leaf->as_Bool()->_test._test == BoolTest::ne &&
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10501
            _leaf->as_If()->_prob >= PROB_LIKELY_MAG(4) &&
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10502
            Matcher::branches_to_uncommon_trap(_leaf));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10503
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10504
  ins_is_TrapBasedCheckNode(true);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10505
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10506
  format %{ "TDI     $value $cmp $zero \t// ZeroCheckP => trap $labl" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10507
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10508
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10509
    // TODO: PPC port $archOpcode(ppc64Opcode_tdi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10510
    if ($cmp$$cmpcode == 0xA) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10511
      __ trap_null_check($value$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10512
    } else {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10513
      // Both successors are uncommon traps, probability is 0.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10514
      // Node got flipped during fixup flow.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10515
      assert($cmp$$cmpcode == 0x2 , "must be equal(0xA) or notEqual(0x2)");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10516
      __ trap_null_check($value$$Register, Assembler::traptoGreaterThanUnsigned);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10517
    }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10518
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10519
  ins_pipe(pipe_class_trap);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10520
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10521
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10522
// Compare Pointers
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10523
instruct cmpP_reg_reg(flagsReg crx, iRegP_N2P src1, iRegP_N2P src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10524
  match(Set crx (CmpP src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10525
  format %{ "CMPLD   $crx, $src1, $src2 \t// ptr" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10526
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10527
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10528
    // TODO: PPC port $archOpcode(ppc64Opcode_cmpl);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10529
    __ cmpld($crx$$CondRegister, $src1$$Register, $src2$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10530
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10531
  ins_pipe(pipe_class_compare);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10532
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10533
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10534
// Used in postalloc expand.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10535
instruct cmpP_reg_imm16(flagsReg crx, iRegPsrc src1, immL16 src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10536
  // This match rule prevents reordering of node before a safepoint.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10537
  // This only makes sense if this instructions is used exclusively
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10538
  // for the expansion of EncodeP!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10539
  match(Set crx (CmpP src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10540
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10541
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10542
  format %{ "CMPDI   $crx, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10543
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10544
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10545
    // TODO: PPC port $archOpcode(ppc64Opcode_cmpi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10546
    __ cmpdi($crx$$CondRegister, $src1$$Register, $src2$$constant);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10547
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10548
  ins_pipe(pipe_class_compare);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10549
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10550
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10551
//----------Float Compares----------------------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10552
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10553
instruct cmpFUnordered_reg_reg(flagsReg crx, regF src1, regF src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10554
  // no match-rule, false predicate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10555
  effect(DEF crx, USE src1, USE src2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10556
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10557
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10558
  format %{ "cmpFUrd $crx, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10559
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10560
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10561
    // TODO: PPC port $archOpcode(ppc64Opcode_fcmpu);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10562
    __ fcmpu($crx$$CondRegister, $src1$$FloatRegister, $src2$$FloatRegister);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10563
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10564
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10565
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10566
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10567
instruct cmov_bns_less(flagsReg crx) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10568
  // no match-rule, false predicate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10569
  effect(DEF crx);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10570
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10571
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10572
  ins_variable_size_depending_on_alignment(true);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10573
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10574
  format %{ "cmov    $crx" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10575
  // Worst case is branch + move + stop, no stop without scheduler.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10576
  size(false /* TODO: PPC PORT(InsertEndGroupPPC64 && Compile::current()->do_hb_scheduling())*/ ? 16 : 12);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10577
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10578
    // TODO: PPC port $archOpcode(ppc64Opcode_cmovecr);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10579
    Label done;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10580
    __ bns($crx$$CondRegister, done);        // not unordered -> keep crx
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10581
    __ li(R0, 0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10582
    __ cmpwi($crx$$CondRegister, R0, 1);     // unordered -> set crx to 'less'
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10583
    // TODO PPC port __ endgroup_if_needed(_size == 16);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10584
    __ bind(done);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10585
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10586
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10587
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10588
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10589
// Compare floating, generate condition code.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10590
instruct cmpF_reg_reg_Ex(flagsReg crx, regF src1, regF src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10591
  // FIXME: should we match 'If cmp (CmpF src1 src2))' ??
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10592
  //
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10593
  // The following code sequence occurs a lot in mpegaudio:
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10594
  //
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10595
  // block BXX:
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10596
  // 0: instruct cmpFUnordered_reg_reg (cmpF_reg_reg-0):
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10597
  //    cmpFUrd CCR6, F11, F9
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10598
  // 4: instruct cmov_bns_less (cmpF_reg_reg-1):
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10599
  //    cmov CCR6
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10600
  // 8: instruct branchConSched:
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10601
  //    B_FARle CCR6, B56  P=0.500000 C=-1.000000
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10602
  match(Set crx (CmpF src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10603
  ins_cost(DEFAULT_COST+BRANCH_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10604
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10605
  format %{ "CmpF    $crx, $src1, $src2 \t// postalloc expanded" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10606
  postalloc_expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10607
    //
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10608
    // replaces
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10609
    //
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10610
    //   region  src1  src2
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10611
    //    \       |     |
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10612
    //     crx=cmpF_reg_reg
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10613
    //
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10614
    // with
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10615
    //
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10616
    //   region  src1  src2
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10617
    //    \       |     |
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10618
    //     crx=cmpFUnordered_reg_reg
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10619
    //      |
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10620
    //      ^  region
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10621
    //      |   \
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10622
    //      crx=cmov_bns_less
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10623
    //
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10624
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10625
    // Create new nodes.
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
 10626
    MachNode *m1 = new cmpFUnordered_reg_regNode();
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
 10627
    MachNode *m2 = new cmov_bns_lessNode();
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10628
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10629
    // inputs for new nodes
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10630
    m1->add_req(n_region, n_src1, n_src2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10631
    m2->add_req(n_region);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10632
    m2->add_prec(m1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10633
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10634
    // operands for new nodes
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10635
    m1->_opnds[0] = op_crx;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10636
    m1->_opnds[1] = op_src1;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10637
    m1->_opnds[2] = op_src2;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10638
    m2->_opnds[0] = op_crx;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10639
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10640
    // registers for new nodes
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10641
    ra_->set_pair(m1->_idx, ra_->get_reg_second(this), ra_->get_reg_first(this)); // crx
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10642
    ra_->set_pair(m2->_idx, ra_->get_reg_second(this), ra_->get_reg_first(this)); // crx
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10643
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10644
    // Insert new nodes.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10645
    nodes->push(m1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10646
    nodes->push(m2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10647
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10648
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10649
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10650
// Compare float, generate -1,0,1
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10651
instruct cmpF3_reg_reg_ExEx(iRegIdst dst, regF src1, regF src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10652
  match(Set dst (CmpF3 src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10653
  ins_cost(DEFAULT_COST*5+BRANCH_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10654
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10655
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10656
    flagsReg tmp1;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10657
    cmpFUnordered_reg_reg(tmp1, src1, src2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10658
    cmovI_conIvalueMinus1_conIvalue0_conIvalue1_Ex(dst, tmp1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10659
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10660
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10661
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10662
instruct cmpDUnordered_reg_reg(flagsReg crx, regD src1, regD src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10663
  // no match-rule, false predicate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10664
  effect(DEF crx, USE src1, USE src2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10665
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10666
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10667
  format %{ "cmpFUrd $crx, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10668
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10669
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10670
    // TODO: PPC port $archOpcode(ppc64Opcode_fcmpu);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10671
    __ fcmpu($crx$$CondRegister, $src1$$FloatRegister, $src2$$FloatRegister);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10672
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10673
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10674
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10675
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10676
instruct cmpD_reg_reg_Ex(flagsReg crx, regD src1, regD src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10677
  match(Set crx (CmpD src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10678
  ins_cost(DEFAULT_COST+BRANCH_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10679
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10680
  format %{ "CmpD    $crx, $src1, $src2 \t// postalloc expanded" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10681
  postalloc_expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10682
    //
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10683
    // replaces
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10684
    //
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10685
    //   region  src1  src2
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10686
    //    \       |     |
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10687
    //     crx=cmpD_reg_reg
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10688
    //
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10689
    // with
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10690
    //
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10691
    //   region  src1  src2
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10692
    //    \       |     |
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10693
    //     crx=cmpDUnordered_reg_reg
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10694
    //      |
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10695
    //      ^  region
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10696
    //      |   \
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10697
    //      crx=cmov_bns_less
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10698
    //
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10699
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10700
    // create new nodes
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
 10701
    MachNode *m1 = new cmpDUnordered_reg_regNode();
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
 10702
    MachNode *m2 = new cmov_bns_lessNode();
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10703
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10704
    // inputs for new nodes
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10705
    m1->add_req(n_region, n_src1, n_src2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10706
    m2->add_req(n_region);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10707
    m2->add_prec(m1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10708
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10709
    // operands for new nodes
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10710
    m1->_opnds[0] = op_crx;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10711
    m1->_opnds[1] = op_src1;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10712
    m1->_opnds[2] = op_src2;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10713
    m2->_opnds[0] = op_crx;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10714
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10715
    // registers for new nodes
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10716
    ra_->set_pair(m1->_idx, ra_->get_reg_second(this), ra_->get_reg_first(this)); // crx
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10717
    ra_->set_pair(m2->_idx, ra_->get_reg_second(this), ra_->get_reg_first(this)); // crx
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10718
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10719
    // Insert new nodes.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10720
    nodes->push(m1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10721
    nodes->push(m2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10722
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10723
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10724
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10725
// Compare double, generate -1,0,1
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10726
instruct cmpD3_reg_reg_ExEx(iRegIdst dst, regD src1, regD src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10727
  match(Set dst (CmpD3 src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10728
  ins_cost(DEFAULT_COST*5+BRANCH_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10729
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10730
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10731
    flagsReg tmp1;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10732
    cmpDUnordered_reg_reg(tmp1, src1, src2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10733
    cmovI_conIvalueMinus1_conIvalue0_conIvalue1_Ex(dst, tmp1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10734
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10735
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10736
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10737
//----------Branches---------------------------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10738
// Jump
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10739
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10740
// Direct Branch.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10741
instruct branch(label labl) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10742
  match(Goto);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10743
  effect(USE labl);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10744
  ins_cost(BRANCH_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10745
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10746
  format %{ "B       $labl" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10747
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10748
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10749
    // TODO: PPC port $archOpcode(ppc64Opcode_b);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10750
     Label d;    // dummy
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10751
     __ bind(d);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10752
     Label* p = $labl$$label;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10753
     // `p' is `NULL' when this encoding class is used only to
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10754
     // determine the size of the encoded instruction.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10755
     Label& l = (NULL == p)? d : *(p);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10756
     __ b(l);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10757
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10758
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10759
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10760
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10761
// Conditional Near Branch
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10762
instruct branchCon(cmpOp cmp, flagsReg crx, label lbl) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10763
  // Same match rule as `branchConFar'.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10764
  match(If cmp crx);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10765
  effect(USE lbl);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10766
  ins_cost(BRANCH_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10767
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10768
  // If set to 1 this indicates that the current instruction is a
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10769
  // short variant of a long branch. This avoids using this
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10770
  // instruction in first-pass matching. It will then only be used in
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10771
  // the `Shorten_branches' pass.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10772
  ins_short_branch(1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10773
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10774
  format %{ "B$cmp     $crx, $lbl" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10775
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10776
  ins_encode( enc_bc(crx, cmp, lbl) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10777
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10778
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10779
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10780
// This is for cases when the ppc64 `bc' instruction does not
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10781
// reach far enough. So we emit a far branch here, which is more
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10782
// expensive.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10783
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10784
// Conditional Far Branch
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10785
instruct branchConFar(cmpOp cmp, flagsReg crx, label lbl) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10786
  // Same match rule as `branchCon'.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10787
  match(If cmp crx);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10788
  effect(USE crx, USE lbl);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10789
  predicate(!false /* TODO: PPC port HB_Schedule*/);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10790
  // Higher cost than `branchCon'.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10791
  ins_cost(5*BRANCH_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10792
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10793
  // This is not a short variant of a branch, but the long variant.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10794
  ins_short_branch(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10795
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10796
  format %{ "B_FAR$cmp $crx, $lbl" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10797
  size(8);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10798
  ins_encode( enc_bc_far(crx, cmp, lbl) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10799
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10800
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10801
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10802
// Conditional Branch used with Power6 scheduler (can be far or short).
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10803
instruct branchConSched(cmpOp cmp, flagsReg crx, label lbl) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10804
  // Same match rule as `branchCon'.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10805
  match(If cmp crx);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10806
  effect(USE crx, USE lbl);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10807
  predicate(false /* TODO: PPC port HB_Schedule*/);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10808
  // Higher cost than `branchCon'.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10809
  ins_cost(5*BRANCH_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10810
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10811
  // Actually size doesn't depend on alignment but on shortening.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10812
  ins_variable_size_depending_on_alignment(true);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10813
  // long variant.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10814
  ins_short_branch(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10815
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10816
  format %{ "B_FAR$cmp $crx, $lbl" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10817
  size(8); // worst case
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10818
  ins_encode( enc_bc_short_far(crx, cmp, lbl) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10819
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10820
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10821
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10822
instruct branchLoopEnd(cmpOp cmp, flagsReg crx, label labl) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10823
  match(CountedLoopEnd cmp crx);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10824
  effect(USE labl);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10825
  ins_cost(BRANCH_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10826
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10827
  // short variant.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10828
  ins_short_branch(1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10829
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10830
  format %{ "B$cmp     $crx, $labl \t// counted loop end" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10831
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10832
  ins_encode( enc_bc(crx, cmp, labl) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10833
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10834
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10835
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10836
instruct branchLoopEndFar(cmpOp cmp, flagsReg crx, label labl) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10837
  match(CountedLoopEnd cmp crx);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10838
  effect(USE labl);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10839
  predicate(!false /* TODO: PPC port HB_Schedule */);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10840
  ins_cost(BRANCH_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10841
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10842
  // Long variant.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10843
  ins_short_branch(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10844
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10845
  format %{ "B_FAR$cmp $crx, $labl \t// counted loop end" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10846
  size(8);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10847
  ins_encode( enc_bc_far(crx, cmp, labl) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10848
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10849
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10850
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10851
// Conditional Branch used with Power6 scheduler (can be far or short).
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10852
instruct branchLoopEndSched(cmpOp cmp, flagsReg crx, label labl) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10853
  match(CountedLoopEnd cmp crx);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10854
  effect(USE labl);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10855
  predicate(false /* TODO: PPC port HB_Schedule */);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10856
  // Higher cost than `branchCon'.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10857
  ins_cost(5*BRANCH_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10858
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10859
  // Actually size doesn't depend on alignment but on shortening.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10860
  ins_variable_size_depending_on_alignment(true);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10861
  // Long variant.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10862
  ins_short_branch(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10863
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10864
  format %{ "B_FAR$cmp $crx, $labl \t// counted loop end" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10865
  size(8); // worst case
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10866
  ins_encode( enc_bc_short_far(crx, cmp, labl) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10867
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10868
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10869
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10870
// ============================================================================
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10871
// Java runtime operations, intrinsics and other complex operations.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10872
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10873
// The 2nd slow-half of a subtype check. Scan the subklass's 2ndary superklass
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10874
// array for an instance of the superklass. Set a hidden internal cache on a
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10875
// hit (cache is checked with exposed code in gen_subtype_check()). Return
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10876
// not zero for a miss or zero for a hit. The encoding ALSO sets flags.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10877
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10878
// GL TODO: Improve this.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10879
// - result should not be a TEMP
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10880
// - Add match rule as on sparc avoiding additional Cmp.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10881
instruct partialSubtypeCheck(iRegPdst result, iRegP_N2P subklass, iRegP_N2P superklass,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10882
                             iRegPdst tmp_klass, iRegPdst tmp_arrayptr) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10883
  match(Set result (PartialSubtypeCheck subklass superklass));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10884
  effect(TEMP result, TEMP tmp_klass, TEMP tmp_arrayptr);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10885
  ins_cost(DEFAULT_COST*10);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10886
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10887
  format %{ "PartialSubtypeCheck $result = ($subklass instanceOf $superklass) tmp: $tmp_klass, $tmp_arrayptr" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10888
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10889
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
24349
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
 10890
    __ check_klass_subtype_slow_path($subklass$$Register, $superklass$$Register, $tmp_arrayptr$$Register,
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10891
                                     $tmp_klass$$Register, NULL, $result$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10892
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10893
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10894
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10895
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10896
// inlined locking and unlocking
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10897
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10898
instruct cmpFastLock(flagsReg crx, iRegPdst oop, iRegPdst box, iRegPdst tmp1, iRegPdst tmp2, iRegPdst tmp3) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10899
  match(Set crx (FastLock oop box));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10900
  effect(TEMP tmp1, TEMP tmp2, TEMP tmp3);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10901
  // TODO PPC port predicate(!UseNewFastLockPPC64 || UseBiasedLocking);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10902
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10903
  format %{ "FASTLOCK  $oop, $box, $tmp1, $tmp2, $tmp3" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10904
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10905
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10906
    __ compiler_fast_lock_object($crx$$CondRegister, $oop$$Register, $box$$Register,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10907
                                 $tmp3$$Register, $tmp1$$Register, $tmp2$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10908
    // If locking was successfull, crx should indicate 'EQ'.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10909
    // The compiler generates a branch to the runtime call to
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10910
    // _complete_monitor_locking_Java for the case where crx is 'NE'.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10911
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10912
  ins_pipe(pipe_class_compare);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10913
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10914
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10915
instruct cmpFastUnlock(flagsReg crx, iRegPdst oop, iRegPdst box, iRegPdst tmp1, iRegPdst tmp2, iRegPdst tmp3) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10916
  match(Set crx (FastUnlock oop box));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10917
  effect(TEMP tmp1, TEMP tmp2, TEMP tmp3);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10918
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10919
  format %{ "FASTUNLOCK  $oop, $box, $tmp1, $tmp2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10920
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10921
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10922
    __ compiler_fast_unlock_object($crx$$CondRegister, $oop$$Register, $box$$Register,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10923
                                   $tmp3$$Register, $tmp1$$Register, $tmp2$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10924
    // If unlocking was successfull, crx should indicate 'EQ'.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10925
    // The compiler generates a branch to the runtime call to
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10926
    // _complete_monitor_unlocking_Java for the case where crx is 'NE'.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10927
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10928
  ins_pipe(pipe_class_compare);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10929
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10930
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10931
// Align address.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10932
instruct align_addr(iRegPdst dst, iRegPsrc src, immLnegpow2 mask) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10933
  match(Set dst (CastX2P (AndL (CastP2X src) mask)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10934
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10935
  format %{ "ANDDI   $dst, $src, $mask \t// next aligned address" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10936
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10937
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10938
    // TODO: PPC port $archOpcode(ppc64Opcode_rldicr);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10939
    __ clrrdi($dst$$Register, $src$$Register, log2_long((jlong)-$mask$$constant));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10940
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10941
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10942
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10943
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10944
// Array size computation.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10945
instruct array_size(iRegLdst dst, iRegPsrc end, iRegPsrc start) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10946
  match(Set dst (SubL (CastP2X end) (CastP2X start)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10947
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10948
  format %{ "SUB     $dst, $end, $start \t// array size in bytes" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10949
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10950
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10951
    // TODO: PPC port $archOpcode(ppc64Opcode_subf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10952
    __ subf($dst$$Register, $start$$Register, $end$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10953
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10954
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10955
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10956
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10957
// Clear-array with dynamic array-size.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10958
instruct inlineCallClearArray(rarg1RegL cnt, rarg2RegP base, Universe dummy, regCTR ctr) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10959
  match(Set dummy (ClearArray cnt base));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10960
  effect(USE_KILL cnt, USE_KILL base, KILL ctr);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10961
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10962
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10963
  ins_alignment(8); // 'compute_padding()' gets called, up to this number-1 nops will get inserted.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10964
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10965
  format %{ "ClearArray $cnt, $base" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10966
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10967
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10968
    __ clear_memory_doubleword($base$$Register, $cnt$$Register); // kills cnt, base, R0
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10969
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10970
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10971
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10972
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10973
// String_IndexOf for needle of length 1.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10974
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10975
// Match needle into immediate operands: no loadConP node needed. Saves one
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10976
// register and two instructions over string_indexOf_imm1Node.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10977
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10978
// Assumes register result differs from all input registers.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10979
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10980
// Preserves registers haystack, haycnt
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10981
// Kills     registers tmp1, tmp2
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10982
// Defines   registers result
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10983
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10984
// Use dst register classes if register gets killed, as it is the case for tmp registers!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10985
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10986
// Unfortunately this does not match too often. In many situations the AddP is used
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10987
// by several nodes, even several StrIndexOf nodes, breaking the match tree.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10988
instruct string_indexOf_imm1_char(iRegIdst result, iRegPsrc haystack, iRegIsrc haycnt,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10989
                                  immP needleImm, immL offsetImm, immI_1 needlecntImm,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10990
                                  iRegIdst tmp1, iRegIdst tmp2,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10991
                                  flagsRegCR0 cr0, flagsRegCR1 cr1) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10992
  predicate(SpecialStringIndexOf);  // type check implicit by parameter type, See Matcher::match_rule_supported
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10993
  match(Set result (StrIndexOf (Binary haystack haycnt) (Binary (AddP needleImm offsetImm) needlecntImm)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10994
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10995
  effect(TEMP result, TEMP tmp1, TEMP tmp2, KILL cr0, KILL cr1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10996
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10997
  ins_cost(150);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10998
  format %{ "String IndexOf CSCL1 $haystack[0..$haycnt], $needleImm+$offsetImm[0..$needlecntImm]"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10999
            "-> $result \t// KILL $haycnt, $tmp1, $tmp2, $cr0, $cr1" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11000
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11001
  ins_alignment(8); // 'compute_padding()' gets called, up to this number-1 nops will get inserted
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11002
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11003
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11004
    immPOper *needleOper = (immPOper *)$needleImm;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11005
    const TypeOopPtr *t = needleOper->type()->isa_oopptr();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11006
    ciTypeArray* needle_values = t->const_oop()->as_type_array();  // Pointer to live char *
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11007
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11008
    __ string_indexof_1($result$$Register,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11009
                        $haystack$$Register, $haycnt$$Register,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11010
                        R0, needle_values->char_at(0),
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11011
                        $tmp1$$Register, $tmp2$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11012
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11013
  ins_pipe(pipe_class_compare);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11014
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11015
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11016
// String_IndexOf for needle of length 1.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11017
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11018
// Special case requires less registers and emits less instructions.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11019
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11020
// Assumes register result differs from all input registers.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11021
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11022
// Preserves registers haystack, haycnt
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11023
// Kills     registers tmp1, tmp2, needle
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11024
// Defines   registers result
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11025
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11026
// Use dst register classes if register gets killed, as it is the case for tmp registers!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11027
instruct string_indexOf_imm1(iRegIdst result, iRegPsrc haystack, iRegIsrc haycnt,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11028
                             rscratch2RegP needle, immI_1 needlecntImm,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11029
                             iRegIdst tmp1, iRegIdst tmp2,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11030
                             flagsRegCR0 cr0, flagsRegCR1 cr1) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11031
  match(Set result (StrIndexOf (Binary haystack haycnt) (Binary needle needlecntImm)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11032
  effect(USE_KILL needle, /* TDEF needle, */ TEMP result,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11033
         TEMP tmp1, TEMP tmp2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11034
  // Required for EA: check if it is still a type_array.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11035
  predicate(SpecialStringIndexOf && n->in(3)->in(1)->bottom_type()->is_aryptr()->const_oop() &&
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11036
            n->in(3)->in(1)->bottom_type()->is_aryptr()->const_oop()->is_type_array());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11037
  ins_cost(180);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11038
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11039
  ins_alignment(8); // 'compute_padding()' gets called, up to this number-1 nops will get inserted.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11040
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11041
  format %{ "String IndexOf SCL1 $haystack[0..$haycnt], $needle[0..$needlecntImm]"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11042
            " -> $result \t// KILL $haycnt, $needle, $tmp1, $tmp2, $cr0, $cr1" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11043
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11044
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11045
    Node *ndl = in(operand_index($needle));  // The node that defines needle.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11046
    ciTypeArray* needle_values = ndl->bottom_type()->is_aryptr()->const_oop()->as_type_array();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11047
    guarantee(needle_values, "sanity");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11048
    if (needle_values != NULL) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11049
      __ string_indexof_1($result$$Register,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11050
                          $haystack$$Register, $haycnt$$Register,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11051
                          R0, needle_values->char_at(0),
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11052
                          $tmp1$$Register, $tmp2$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11053
    } else {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11054
      __ string_indexof_1($result$$Register,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11055
                          $haystack$$Register, $haycnt$$Register,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11056
                          $needle$$Register, 0,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11057
                          $tmp1$$Register, $tmp2$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11058
    }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11059
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11060
  ins_pipe(pipe_class_compare);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11061
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11062
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11063
// String_IndexOf.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11064
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11065
// Length of needle as immediate. This saves instruction loading constant needle
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11066
// length.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11067
// @@@ TODO Specify rules for length < 8 or so, and roll out comparison of needle
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11068
// completely or do it in vector instruction. This should save registers for
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11069
// needlecnt and needle.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11070
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11071
// Assumes register result differs from all input registers.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11072
// Overwrites haycnt, needlecnt.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11073
// Use dst register classes if register gets killed, as it is the case for tmp registers!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11074
instruct string_indexOf_imm(iRegIdst result, iRegPsrc haystack, rscratch1RegI haycnt,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11075
                            iRegPsrc needle, uimmI15 needlecntImm,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11076
                            iRegIdst tmp1, iRegIdst tmp2, iRegIdst tmp3, iRegIdst tmp4, iRegIdst tmp5,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11077
                            flagsRegCR0 cr0, flagsRegCR1 cr1, flagsRegCR6 cr6) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11078
  match(Set result (StrIndexOf (Binary haystack haycnt) (Binary needle needlecntImm)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11079
  effect(USE_KILL haycnt, /* better: TDEF haycnt, */ TEMP result,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11080
         TEMP tmp1, TEMP tmp2, TEMP tmp3, TEMP tmp4, TEMP tmp5, KILL cr0, KILL cr1, KILL cr6);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11081
  // Required for EA: check if it is still a type_array.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11082
  predicate(SpecialStringIndexOf && n->in(3)->in(1)->bottom_type()->is_aryptr()->const_oop() &&
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11083
            n->in(3)->in(1)->bottom_type()->is_aryptr()->const_oop()->is_type_array());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11084
  ins_cost(250);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11085
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11086
  ins_alignment(8); // 'compute_padding()' gets called, up to this number-1 nops will get inserted.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11087
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11088
  format %{ "String IndexOf SCL $haystack[0..$haycnt], $needle[0..$needlecntImm]"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11089
            " -> $result \t// KILL $haycnt, $tmp1, $tmp2, $tmp3, $tmp4, $tmp5, $cr0, $cr1" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11090
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11091
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11092
    Node *ndl = in(operand_index($needle));  // The node that defines needle.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11093
    ciTypeArray* needle_values = ndl->bottom_type()->is_aryptr()->const_oop()->as_type_array();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11094
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11095
    __ string_indexof($result$$Register,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11096
                      $haystack$$Register, $haycnt$$Register,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11097
                      $needle$$Register, needle_values, $tmp5$$Register, $needlecntImm$$constant,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11098
                      $tmp1$$Register, $tmp2$$Register, $tmp3$$Register, $tmp4$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11099
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11100
  ins_pipe(pipe_class_compare);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11101
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11102
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11103
// StrIndexOf node.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11104
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11105
// Assumes register result differs from all input registers.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11106
// Overwrites haycnt, needlecnt.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11107
// Use dst register classes if register gets killed, as it is the case for tmp registers!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11108
instruct string_indexOf(iRegIdst result, iRegPsrc haystack, rscratch1RegI haycnt, iRegPsrc needle, rscratch2RegI needlecnt,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11109
                        iRegLdst tmp1, iRegLdst tmp2, iRegLdst tmp3, iRegLdst tmp4,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11110
                        flagsRegCR0 cr0, flagsRegCR1 cr1, flagsRegCR6 cr6) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11111
  match(Set result (StrIndexOf (Binary haystack haycnt) (Binary needle needlecnt)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11112
  effect(USE_KILL haycnt, USE_KILL needlecnt, /*better: TDEF haycnt, TDEF needlecnt,*/
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11113
         TEMP result,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11114
         TEMP tmp1, TEMP tmp2, TEMP tmp3, TEMP tmp4, KILL cr0, KILL cr1, KILL cr6);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11115
  predicate(SpecialStringIndexOf);  // See Matcher::match_rule_supported.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11116
  ins_cost(300);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11117
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11118
  ins_alignment(8); // 'compute_padding()' gets called, up to this number-1 nops will get inserted.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11119
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11120
  format %{ "String IndexOf $haystack[0..$haycnt], $needle[0..$needlecnt]"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11121
             " -> $result \t// KILL $haycnt, $needlecnt, $tmp1, $tmp2, $tmp3, $tmp4, $cr0, $cr1" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11122
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11123
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11124
    __ string_indexof($result$$Register,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11125
                      $haystack$$Register, $haycnt$$Register,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11126
                      $needle$$Register, NULL, $needlecnt$$Register, 0,  // needlecnt not constant.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11127
                      $tmp1$$Register, $tmp2$$Register, $tmp3$$Register, $tmp4$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11128
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11129
  ins_pipe(pipe_class_compare);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11130
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11131
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11132
// String equals with immediate.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11133
instruct string_equals_imm(iRegPsrc str1, iRegPsrc str2, uimmI15 cntImm, iRegIdst result,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11134
                           iRegPdst tmp1, iRegPdst tmp2,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11135
                           flagsRegCR0 cr0, flagsRegCR6 cr6, regCTR ctr) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11136
  match(Set result (StrEquals (Binary str1 str2) cntImm));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11137
  effect(TEMP result, TEMP tmp1, TEMP tmp2,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11138
         KILL cr0, KILL cr6, KILL ctr);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11139
  predicate(SpecialStringEquals);  // See Matcher::match_rule_supported.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11140
  ins_cost(250);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11141
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11142
  ins_alignment(8); // 'compute_padding()' gets called, up to this number-1 nops will get inserted.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11143
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11144
  format %{ "String Equals SCL [0..$cntImm]($str1),[0..$cntImm]($str2)"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11145
            " -> $result \t// KILL $cr0, $cr6, $ctr, TEMP $result, $tmp1, $tmp2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11146
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11147
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11148
    __ char_arrays_equalsImm($str1$$Register, $str2$$Register, $cntImm$$constant,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11149
                             $result$$Register, $tmp1$$Register, $tmp2$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11150
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11151
  ins_pipe(pipe_class_compare);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11152
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11153
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11154
// String equals.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11155
// Use dst register classes if register gets killed, as it is the case for TEMP operands!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11156
instruct string_equals(iRegPsrc str1, iRegPsrc str2, iRegIsrc cnt, iRegIdst result,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11157
                       iRegPdst tmp1, iRegPdst tmp2, iRegPdst tmp3, iRegPdst tmp4, iRegPdst tmp5,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11158
                       flagsRegCR0 cr0, flagsRegCR1 cr1, flagsRegCR6 cr6, regCTR ctr) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11159
  match(Set result (StrEquals (Binary str1 str2) cnt));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11160
  effect(TEMP result, TEMP tmp1, TEMP tmp2, TEMP tmp3, TEMP tmp4, TEMP tmp5,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11161
         KILL cr0, KILL cr1, KILL cr6, KILL ctr);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11162
  predicate(SpecialStringEquals);  // See Matcher::match_rule_supported.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11163
  ins_cost(300);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11164
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11165
  ins_alignment(8); // 'compute_padding()' gets called, up to this number-1 nops will get inserted.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11166
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11167
  format %{ "String Equals [0..$cnt]($str1),[0..$cnt]($str2) -> $result"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11168
            " \t// KILL $cr0, $cr1, $cr6, $ctr, TEMP $result, $tmp1, $tmp2, $tmp3, $tmp4, $tmp5" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11169
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11170
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11171
    __ char_arrays_equals($str1$$Register, $str2$$Register, $cnt$$Register, $result$$Register,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11172
                          $tmp1$$Register, $tmp2$$Register, $tmp3$$Register, $tmp4$$Register, $tmp5$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11173
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11174
  ins_pipe(pipe_class_compare);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11175
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11176
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11177
// String compare.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11178
// Char[] pointers are passed in.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11179
// Use dst register classes if register gets killed, as it is the case for TEMP operands!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11180
instruct string_compare(rarg1RegP str1, rarg2RegP str2, rarg3RegI cnt1, rarg4RegI cnt2, iRegIdst result,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11181
                        iRegPdst tmp, flagsRegCR0 cr0, regCTR ctr) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11182
  match(Set result (StrComp (Binary str1 cnt1) (Binary str2 cnt2)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11183
  effect(USE_KILL cnt1, USE_KILL cnt2, USE_KILL str1, USE_KILL str2, TEMP result, TEMP tmp, KILL cr0, KILL ctr);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11184
  ins_cost(300);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11185
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11186
  ins_alignment(8); // 'compute_padding()' gets called, up to this number-1 nops will get inserted.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11187
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11188
  format %{ "String Compare $str1[0..$cnt1], $str2[0..$cnt2] -> $result"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11189
            " \t// TEMP $tmp, $result KILLs $str1, $cnt1, $str2, $cnt2, $cr0, $ctr" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11190
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11191
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11192
    __ string_compare($str1$$Register, $str2$$Register, $cnt1$$Register, $cnt2$$Register,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11193
                      $result$$Register, $tmp$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11194
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11195
  ins_pipe(pipe_class_compare);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11196
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11197
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11198
//---------- Min/Max Instructions ---------------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11199
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11200
instruct minI_reg_reg_Ex(iRegIdst dst, iRegIsrc src1, iRegIsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11201
  match(Set dst (MinI src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11202
  ins_cost(DEFAULT_COST*6);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11203
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11204
  expand %{
24349
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
 11205
    iRegLdst src1s;
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
 11206
    iRegLdst src2s;
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
 11207
    iRegLdst diff;
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
 11208
    iRegLdst sm;
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
 11209
    iRegLdst doz; // difference or zero
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
 11210
    convI2L_reg(src1s, src1); // Ensure proper sign extension.
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
 11211
    convI2L_reg(src2s, src2); // Ensure proper sign extension.
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
 11212
    subL_reg_reg(diff, src2s, src1s);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11213
    // Need to consider >=33 bit result, therefore we need signmaskL.
24349
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
 11214
    signmask64L_regL(sm, diff);
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
 11215
    andL_reg_reg(doz, diff, sm); // <=0
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
 11216
    addI_regL_regL(dst, doz, src1s);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11217
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11218
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11219
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11220
instruct maxI_reg_reg_Ex(iRegIdst dst, iRegIsrc src1, iRegIsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11221
  match(Set dst (MaxI src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11222
  ins_cost(DEFAULT_COST*6);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11223
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11224
  expand %{
24349
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
 11225
    iRegLdst src1s;
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
 11226
    iRegLdst src2s;
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
 11227
    iRegLdst diff;
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
 11228
    iRegLdst sm;
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
 11229
    iRegLdst doz; // difference or zero
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
 11230
    convI2L_reg(src1s, src1); // Ensure proper sign extension.
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
 11231
    convI2L_reg(src2s, src2); // Ensure proper sign extension.
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
 11232
    subL_reg_reg(diff, src2s, src1s);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11233
    // Need to consider >=33 bit result, therefore we need signmaskL.
24349
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
 11234
    signmask64L_regL(sm, diff);
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
 11235
    andcL_reg_reg(doz, diff, sm); // >=0
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
 11236
    addI_regL_regL(dst, doz, src1s);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11237
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11238
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11239
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11240
//---------- Population Count Instructions ------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11241
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11242
// Popcnt for Power7.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11243
instruct popCountI(iRegIdst dst, iRegIsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11244
  match(Set dst (PopCountI src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11245
  predicate(UsePopCountInstruction && VM_Version::has_popcntw());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11246
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11247
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11248
  format %{ "POPCNTW $dst, $src" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11249
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11250
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11251
    // TODO: PPC port $archOpcode(ppc64Opcode_popcntb);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11252
    __ popcntw($dst$$Register, $src$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11253
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11254
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11255
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11256
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11257
// Popcnt for Power7.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11258
instruct popCountL(iRegIdst dst, iRegLsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11259
  predicate(UsePopCountInstruction && VM_Version::has_popcntw());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11260
  match(Set dst (PopCountL src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11261
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11262
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11263
  format %{ "POPCNTD $dst, $src" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11264
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11265
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11266
    // TODO: PPC port $archOpcode(ppc64Opcode_popcntb);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11267
    __ popcntd($dst$$Register, $src$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11268
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11269
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11270
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11271
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11272
instruct countLeadingZerosI(iRegIdst dst, iRegIsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11273
  match(Set dst (CountLeadingZerosI src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11274
  predicate(UseCountLeadingZerosInstructionsPPC64);  // See Matcher::match_rule_supported.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11275
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11276
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11277
  format %{ "CNTLZW  $dst, $src" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11278
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11279
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11280
    // TODO: PPC port $archOpcode(ppc64Opcode_cntlzw);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11281
    __ cntlzw($dst$$Register, $src$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11282
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11283
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11284
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11285
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11286
instruct countLeadingZerosL(iRegIdst dst, iRegLsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11287
  match(Set dst (CountLeadingZerosL src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11288
  predicate(UseCountLeadingZerosInstructionsPPC64);  // See Matcher::match_rule_supported.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11289
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11290
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11291
  format %{ "CNTLZD  $dst, $src" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11292
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11293
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11294
    // TODO: PPC port $archOpcode(ppc64Opcode_cntlzd);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11295
    __ cntlzd($dst$$Register, $src$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11296
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11297
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11298
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11299
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11300
instruct countLeadingZerosP(iRegIdst dst, iRegPsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11301
  // no match-rule, false predicate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11302
  effect(DEF dst, USE src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11303
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11304
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11305
  format %{ "CNTLZD  $dst, $src" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11306
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11307
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11308
    // TODO: PPC port $archOpcode(ppc64Opcode_cntlzd);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11309
    __ cntlzd($dst$$Register, $src$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11310
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11311
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11312
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11313
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11314
instruct countTrailingZerosI_Ex(iRegIdst dst, iRegIsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11315
  match(Set dst (CountTrailingZerosI src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11316
  predicate(UseCountLeadingZerosInstructionsPPC64);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11317
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11318
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11319
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11320
    immI16 imm1 %{ (int)-1 %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11321
    immI16 imm2 %{ (int)32 %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11322
    immI_minus1 m1 %{ -1 %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11323
    iRegIdst tmpI1;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11324
    iRegIdst tmpI2;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11325
    iRegIdst tmpI3;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11326
    addI_reg_imm16(tmpI1, src, imm1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11327
    andcI_reg_reg(tmpI2, src, m1, tmpI1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11328
    countLeadingZerosI(tmpI3, tmpI2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11329
    subI_imm16_reg(dst, imm2, tmpI3);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11330
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11331
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11332
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11333
instruct countTrailingZerosL_Ex(iRegIdst dst, iRegLsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11334
  match(Set dst (CountTrailingZerosL src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11335
  predicate(UseCountLeadingZerosInstructionsPPC64);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11336
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11337
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11338
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11339
    immL16 imm1 %{ (long)-1 %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11340
    immI16 imm2 %{ (int)64 %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11341
    iRegLdst tmpL1;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11342
    iRegLdst tmpL2;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11343
    iRegIdst tmpL3;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11344
    addL_reg_imm16(tmpL1, src, imm1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11345
    andcL_reg_reg(tmpL2, tmpL1, src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11346
    countLeadingZerosL(tmpL3, tmpL2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11347
    subI_imm16_reg(dst, imm2, tmpL3);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11348
 %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11349
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11350
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11351
// Expand nodes for byte_reverse_int.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11352
instruct insrwi_a(iRegIdst dst, iRegIsrc src, immI16 pos, immI16 shift) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11353
  effect(DEF dst, USE src, USE pos, USE shift);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11354
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11355
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11356
  format %{ "INSRWI  $dst, $src, $pos, $shift" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11357
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11358
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11359
    // TODO: PPC port $archOpcode(ppc64Opcode_rlwimi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11360
    __ insrwi($dst$$Register, $src$$Register, $shift$$constant, $pos$$constant);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11361
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11362
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11363
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11364
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11365
// As insrwi_a, but with USE_DEF.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11366
instruct insrwi(iRegIdst dst, iRegIsrc src, immI16 pos, immI16 shift) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11367
  effect(USE_DEF dst, USE src, USE pos, USE shift);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11368
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11369
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11370
  format %{ "INSRWI  $dst, $src, $pos, $shift" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11371
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11372
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11373
    // TODO: PPC port $archOpcode(ppc64Opcode_rlwimi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11374
    __ insrwi($dst$$Register, $src$$Register, $shift$$constant, $pos$$constant);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11375
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11376
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11377
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11378
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11379
// Just slightly faster than java implementation.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11380
instruct bytes_reverse_int_Ex(iRegIdst dst, iRegIsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11381
  match(Set dst (ReverseBytesI src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11382
  predicate(UseCountLeadingZerosInstructionsPPC64);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11383
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11384
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11385
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11386
    immI16 imm24 %{ (int) 24 %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11387
    immI16 imm16 %{ (int) 16 %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11388
    immI16  imm8 %{ (int)  8 %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11389
    immI16  imm4 %{ (int)  4 %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11390
    immI16  imm0 %{ (int)  0 %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11391
    iRegLdst tmpI1;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11392
    iRegLdst tmpI2;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11393
    iRegLdst tmpI3;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11394
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11395
    urShiftI_reg_imm(tmpI1, src, imm24);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11396
    insrwi_a(dst, tmpI1, imm24, imm8);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11397
    urShiftI_reg_imm(tmpI2, src, imm16);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11398
    insrwi(dst, tmpI2, imm8, imm16);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11399
    urShiftI_reg_imm(tmpI3, src, imm8);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11400
    insrwi(dst, tmpI3, imm8, imm8);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11401
    insrwi(dst, src, imm0, imm8);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11402
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11403
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11404
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11405
//---------- Replicate Vector Instructions ------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11406
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11407
// Insrdi does replicate if src == dst.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11408
instruct repl32(iRegLdst dst) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11409
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11410
  effect(USE_DEF dst);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11411
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11412
  format %{ "INSRDI  $dst, #0, $dst, #32 \t// replicate" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11413
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11414
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11415
    // TODO: PPC port $archOpcode(ppc64Opcode_rldimi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11416
    __ insrdi($dst$$Register, $dst$$Register, 32, 0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11417
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11418
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11419
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11420
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11421
// Insrdi does replicate if src == dst.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11422
instruct repl48(iRegLdst dst) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11423
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11424
  effect(USE_DEF dst);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11425
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11426
  format %{ "INSRDI  $dst, #0, $dst, #48 \t// replicate" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11427
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11428
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11429
    // TODO: PPC port $archOpcode(ppc64Opcode_rldimi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11430
    __ insrdi($dst$$Register, $dst$$Register, 48, 0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11431
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11432
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11433
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11434
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11435
// Insrdi does replicate if src == dst.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11436
instruct repl56(iRegLdst dst) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11437
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11438
  effect(USE_DEF dst);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11439
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11440
  format %{ "INSRDI  $dst, #0, $dst, #56 \t// replicate" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11441
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11442
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11443
    // TODO: PPC port $archOpcode(ppc64Opcode_rldimi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11444
    __ insrdi($dst$$Register, $dst$$Register, 56, 0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11445
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11446
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11447
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11448
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11449
instruct repl8B_reg_Ex(iRegLdst dst, iRegIsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11450
  match(Set dst (ReplicateB src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11451
  predicate(n->as_Vector()->length() == 8);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11452
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11453
    moveReg(dst, src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11454
    repl56(dst);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11455
    repl48(dst);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11456
    repl32(dst);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11457
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11458
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11459
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11460
instruct repl8B_immI0(iRegLdst dst, immI_0 zero) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11461
  match(Set dst (ReplicateB zero));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11462
  predicate(n->as_Vector()->length() == 8);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11463
  format %{ "LI      $dst, #0 \t// replicate8B" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11464
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11465
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11466
    // TODO: PPC port $archOpcode(ppc64Opcode_addi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11467
    __ li($dst$$Register, (int)((short)($zero$$constant & 0xFFFF)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11468
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11469
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11470
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11471
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11472
instruct repl8B_immIminus1(iRegLdst dst, immI_minus1 src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11473
  match(Set dst (ReplicateB src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11474
  predicate(n->as_Vector()->length() == 8);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11475
  format %{ "LI      $dst, #-1 \t// replicate8B" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11476
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11477
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11478
    // TODO: PPC port $archOpcode(ppc64Opcode_addi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11479
    __ li($dst$$Register, (int)((short)($src$$constant & 0xFFFF)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11480
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11481
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11482
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11483
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11484
instruct repl4S_reg_Ex(iRegLdst dst, iRegIsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11485
  match(Set dst (ReplicateS src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11486
  predicate(n->as_Vector()->length() == 4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11487
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11488
    moveReg(dst, src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11489
    repl48(dst);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11490
    repl32(dst);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11491
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11492
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11493
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11494
instruct repl4S_immI0(iRegLdst dst, immI_0 zero) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11495
  match(Set dst (ReplicateS zero));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11496
  predicate(n->as_Vector()->length() == 4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11497
  format %{ "LI      $dst, #0 \t// replicate4C" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11498
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11499
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11500
    // TODO: PPC port $archOpcode(ppc64Opcode_addi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11501
    __ li($dst$$Register, (int)((short)($zero$$constant & 0xFFFF)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11502
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11503
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11504
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11505
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11506
instruct repl4S_immIminus1(iRegLdst dst, immI_minus1 src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11507
  match(Set dst (ReplicateS src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11508
  predicate(n->as_Vector()->length() == 4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11509
  format %{ "LI      $dst, -1 \t// replicate4C" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11510
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11511
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11512
    // TODO: PPC port $archOpcode(ppc64Opcode_addi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11513
    __ li($dst$$Register, (int)((short)($src$$constant & 0xFFFF)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11514
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11515
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11516
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11517
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11518
instruct repl2I_reg_Ex(iRegLdst dst, iRegIsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11519
  match(Set dst (ReplicateI src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11520
  predicate(n->as_Vector()->length() == 2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11521
  ins_cost(2 * DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11522
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11523
    moveReg(dst, src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11524
    repl32(dst);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11525
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11526
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11527
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11528
instruct repl2I_immI0(iRegLdst dst, immI_0 zero) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11529
  match(Set dst (ReplicateI zero));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11530
  predicate(n->as_Vector()->length() == 2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11531
  format %{ "LI      $dst, #0 \t// replicate4C" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11532
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11533
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11534
    // TODO: PPC port $archOpcode(ppc64Opcode_addi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11535
    __ li($dst$$Register, (int)((short)($zero$$constant & 0xFFFF)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11536
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11537
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11538
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11539
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11540
instruct repl2I_immIminus1(iRegLdst dst, immI_minus1 src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11541
  match(Set dst (ReplicateI src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11542
  predicate(n->as_Vector()->length() == 2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11543
  format %{ "LI      $dst, -1 \t// replicate4C" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11544
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11545
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11546
    // TODO: PPC port $archOpcode(ppc64Opcode_addi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11547
    __ li($dst$$Register, (int)((short)($src$$constant & 0xFFFF)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11548
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11549
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11550
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11551
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11552
// Move float to int register via stack, replicate.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11553
instruct repl2F_reg_Ex(iRegLdst dst, regF src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11554
  match(Set dst (ReplicateF src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11555
  predicate(n->as_Vector()->length() == 2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11556
  ins_cost(2 * MEMORY_REF_COST + DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11557
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11558
    stackSlotL tmpS;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11559
    iRegIdst tmpI;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11560
    moveF2I_reg_stack(tmpS, src);   // Move float to stack.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11561
    moveF2I_stack_reg(tmpI, tmpS);  // Move stack to int reg.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11562
    moveReg(dst, tmpI);             // Move int to long reg.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11563
    repl32(dst);                    // Replicate bitpattern.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11564
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11565
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11566
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11567
// Replicate scalar constant to packed float values in Double register
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11568
instruct repl2F_immF_Ex(iRegLdst dst, immF src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11569
  match(Set dst (ReplicateF src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11570
  predicate(n->as_Vector()->length() == 2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11571
  ins_cost(5 * DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11572
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11573
  format %{ "LD      $dst, offset, $constanttablebase\t// load replicated float $src $src from table, postalloc expanded" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11574
  postalloc_expand( postalloc_expand_load_replF_constant(dst, src, constanttablebase) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11575
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11576
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11577
// Replicate scalar zero constant to packed float values in Double register
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11578
instruct repl2F_immF0(iRegLdst dst, immF_0 zero) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11579
  match(Set dst (ReplicateF zero));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11580
  predicate(n->as_Vector()->length() == 2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11581
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11582
  format %{ "LI      $dst, #0 \t// replicate2F" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11583
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11584
    // TODO: PPC port $archOpcode(ppc64Opcode_addi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11585
    __ li($dst$$Register, 0x0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11586
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11587
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11588
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11589
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11590
// ============================================================================
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11591
// Safepoint Instruction
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11592
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11593
instruct safePoint_poll(iRegPdst poll) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11594
  match(SafePoint poll);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11595
  predicate(LoadPollAddressFromThread);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11596
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11597
  // It caused problems to add the effect that r0 is killed, but this
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11598
  // effect no longer needs to be mentioned, since r0 is not contained
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11599
  // in a reg_class.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11600
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11601
  format %{ "LD      R0, #0, $poll \t// Safepoint poll for GC" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11602
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11603
  ins_encode( enc_poll(0x0, poll) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11604
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11605
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11606
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11607
// Safepoint without per-thread support. Load address of page to poll
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11608
// as constant.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11609
// Rscratch2RegP is R12.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11610
// LoadConPollAddr node is added in pd_post_matching_hook(). It must be
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11611
// a seperate node so that the oop map is at the right location.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11612
instruct safePoint_poll_conPollAddr(rscratch2RegP poll) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11613
  match(SafePoint poll);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11614
  predicate(!LoadPollAddressFromThread);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11615
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11616
  // It caused problems to add the effect that r0 is killed, but this
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11617
  // effect no longer needs to be mentioned, since r0 is not contained
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11618
  // in a reg_class.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11619
23492
af5352f40e65 8037915: PPC64/AIX: Several smaller fixes
goetz
parents: 23211
diff changeset
 11620
  format %{ "LD      R0, #0, R12 \t// Safepoint poll for GC" %}
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11621
  ins_encode( enc_poll(0x0, poll) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11622
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11623
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11624
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11625
// ============================================================================
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11626
// Call Instructions
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11627
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11628
// Call Java Static Instruction
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11629
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11630
// Schedulable version of call static node.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11631
instruct CallStaticJavaDirect(method meth) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11632
  match(CallStaticJava);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11633
  effect(USE meth);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11634
  predicate(!((CallStaticJavaNode*)n)->is_method_handle_invoke());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11635
  ins_cost(CALL_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11636
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11637
  ins_num_consts(3 /* up to 3 patchable constants: inline cache, 2 call targets. */);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11638
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11639
  format %{ "CALL,static $meth \t// ==> " %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11640
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11641
  ins_encode( enc_java_static_call(meth) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11642
  ins_pipe(pipe_class_call);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11643
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11644
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11645
// Schedulable version of call static node.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11646
instruct CallStaticJavaDirectHandle(method meth) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11647
  match(CallStaticJava);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11648
  effect(USE meth);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11649
  predicate(((CallStaticJavaNode*)n)->is_method_handle_invoke());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11650
  ins_cost(CALL_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11651
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11652
  ins_num_consts(3 /* up to 3 patchable constants: inline cache, 2 call targets. */);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11653
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11654
  format %{ "CALL,static $meth \t// ==> " %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11655
  ins_encode( enc_java_handle_call(meth) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11656
  ins_pipe(pipe_class_call);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11657
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11658
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11659
// Call Java Dynamic Instruction
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11660
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11661
// Used by postalloc expand of CallDynamicJavaDirectSchedEx (actual call).
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11662
// Loading of IC was postalloc expanded. The nodes loading the IC are reachable
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11663
// via fields ins_field_load_ic_hi_node and ins_field_load_ic_node.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11664
// The call destination must still be placed in the constant pool.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11665
instruct CallDynamicJavaDirectSched(method meth) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11666
  match(CallDynamicJava); // To get all the data fields we need ...
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11667
  effect(USE meth);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11668
  predicate(false);       // ... but never match.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11669
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11670
  ins_field_load_ic_hi_node(loadConL_hiNode*);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11671
  ins_field_load_ic_node(loadConLNode*);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11672
  ins_num_consts(1 /* 1 patchable constant: call destination */);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11673
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11674
  format %{ "BL        \t// dynamic $meth ==> " %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11675
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11676
  ins_encode( enc_java_dynamic_call_sched(meth) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11677
  ins_pipe(pipe_class_call);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11678
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11679
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11680
// Schedulable (i.e. postalloc expanded) version of call dynamic java.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11681
// We use postalloc expanded calls if we use inline caches
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11682
// and do not update method data.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11683
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11684
// This instruction has two constants: inline cache (IC) and call destination.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11685
// Loading the inline cache will be postalloc expanded, thus leaving a call with
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11686
// one constant.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11687
instruct CallDynamicJavaDirectSched_Ex(method meth) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11688
  match(CallDynamicJava);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11689
  effect(USE meth);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11690
  predicate(UseInlineCaches);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11691
  ins_cost(CALL_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11692
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11693
  ins_num_consts(2 /* 2 patchable constants: inline cache, call destination. */);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11694
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11695
  format %{ "CALL,dynamic $meth \t// postalloc expanded" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11696
  postalloc_expand( postalloc_expand_java_dynamic_call_sched(meth, constanttablebase) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11697
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11698
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11699
// Compound version of call dynamic java
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11700
// We use postalloc expanded calls if we use inline caches
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11701
// and do not update method data.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11702
instruct CallDynamicJavaDirect(method meth) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11703
  match(CallDynamicJava);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11704
  effect(USE meth);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11705
  predicate(!UseInlineCaches);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11706
  ins_cost(CALL_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11707
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11708
  // Enc_java_to_runtime_call needs up to 4 constants (method data oop).
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11709
  ins_num_consts(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11710
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11711
  format %{ "CALL,dynamic $meth \t// ==> " %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11712
  ins_encode( enc_java_dynamic_call(meth, constanttablebase) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11713
  ins_pipe(pipe_class_call);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11714
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11715
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11716
// Call Runtime Instruction
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11717
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11718
instruct CallRuntimeDirect(method meth) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11719
  match(CallRuntime);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11720
  effect(USE meth);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11721
  ins_cost(CALL_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11722
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11723
  // Enc_java_to_runtime_call needs up to 3 constants: call target,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11724
  // env for callee, C-toc.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11725
  ins_num_consts(3);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11726
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11727
  format %{ "CALL,runtime" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11728
  ins_encode( enc_java_to_runtime_call(meth) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11729
  ins_pipe(pipe_class_call);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11730
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11731
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11732
// Call Leaf
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11733
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11734
// Used by postalloc expand of CallLeafDirect_Ex (mtctr).
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11735
instruct CallLeafDirect_mtctr(iRegLdst dst, iRegLsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11736
  effect(DEF dst, USE src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11737
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11738
  ins_num_consts(1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11739
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11740
  format %{ "MTCTR   $src" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11741
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11742
  ins_encode( enc_leaf_call_mtctr(src) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11743
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11744
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11745
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11746
// Used by postalloc expand of CallLeafDirect_Ex (actual call).
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11747
instruct CallLeafDirect(method meth) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11748
  match(CallLeaf);   // To get the data all the data fields we need ...
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11749
  effect(USE meth);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11750
  predicate(false);  // but never match.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11751
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11752
  format %{ "BCTRL     \t// leaf call $meth ==> " %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11753
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11754
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11755
    // TODO: PPC port $archOpcode(ppc64Opcode_bctrl);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11756
    __ bctrl();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11757
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11758
  ins_pipe(pipe_class_call);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11759
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11760
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11761
// postalloc expand of CallLeafDirect.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11762
// Load adress to call from TOC, then bl to it.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11763
instruct CallLeafDirect_Ex(method meth) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11764
  match(CallLeaf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11765
  effect(USE meth);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11766
  ins_cost(CALL_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11767
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11768
  // Postalloc_expand_java_to_runtime_call needs up to 3 constants: call target,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11769
  // env for callee, C-toc.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11770
  ins_num_consts(3);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11771
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11772
  format %{ "CALL,runtime leaf $meth \t// postalloc expanded" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11773
  postalloc_expand( postalloc_expand_java_to_runtime_call(meth, constanttablebase) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11774
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11775
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11776
// Call runtime without safepoint - same as CallLeaf.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11777
// postalloc expand of CallLeafNoFPDirect.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11778
// Load adress to call from TOC, then bl to it.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11779
instruct CallLeafNoFPDirect_Ex(method meth) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11780
  match(CallLeafNoFP);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11781
  effect(USE meth);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11782
  ins_cost(CALL_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11783
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11784
  // Enc_java_to_runtime_call needs up to 3 constants: call target,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11785
  // env for callee, C-toc.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11786
  ins_num_consts(3);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11787
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11788
  format %{ "CALL,runtime leaf nofp $meth \t// postalloc expanded" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11789
  postalloc_expand( postalloc_expand_java_to_runtime_call(meth, constanttablebase) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11790
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11791
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11792
// Tail Call; Jump from runtime stub to Java code.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11793
// Also known as an 'interprocedural jump'.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11794
// Target of jump will eventually return to caller.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11795
// TailJump below removes the return address.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11796
instruct TailCalljmpInd(iRegPdstNoScratch jump_target, inline_cache_regP method_oop) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11797
  match(TailCall jump_target method_oop);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11798
  ins_cost(CALL_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11799
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11800
  format %{ "MTCTR   $jump_target \t// $method_oop holds method oop\n\t"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11801
            "BCTR         \t// tail call" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11802
  size(8);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11803
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11804
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11805
    __ mtctr($jump_target$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11806
    __ bctr();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11807
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11808
  ins_pipe(pipe_class_call);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11809
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11810
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11811
// Return Instruction
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11812
instruct Ret() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11813
  match(Return);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11814
  format %{ "BLR      \t// branch to link register" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11815
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11816
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11817
    // TODO: PPC port $archOpcode(ppc64Opcode_blr);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11818
    // LR is restored in MachEpilogNode. Just do the RET here.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11819
    __ blr();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11820
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11821
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11822
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11823
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11824
// Tail Jump; remove the return address; jump to target.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11825
// TailCall above leaves the return address around.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11826
// TailJump is used in only one place, the rethrow_Java stub (fancy_jump=2).
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11827
// ex_oop (Exception Oop) is needed in %o0 at the jump. As there would be a
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11828
// "restore" before this instruction (in Epilogue), we need to materialize it
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11829
// in %i0.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11830
instruct tailjmpInd(iRegPdstNoScratch jump_target, rarg1RegP ex_oop) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11831
  match(TailJump jump_target ex_oop);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11832
  ins_cost(CALL_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11833
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11834
  format %{ "LD      R4_ARG2 = LR\n\t"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11835
            "MTCTR   $jump_target\n\t"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11836
            "BCTR     \t// TailJump, exception oop: $ex_oop" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11837
  size(12);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11838
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11839
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11840
    __ ld(R4_ARG2/* issuing pc */, _abi(lr), R1_SP);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11841
    __ mtctr($jump_target$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11842
    __ bctr();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11843
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11844
  ins_pipe(pipe_class_call);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11845
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11846
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11847
// Create exception oop: created by stack-crawling runtime code.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11848
// Created exception is now available to this handler, and is setup
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11849
// just prior to jumping to this handler. No code emitted.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11850
instruct CreateException(rarg1RegP ex_oop) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11851
  match(Set ex_oop (CreateEx));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11852
  ins_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11853
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11854
  format %{ " -- \t// exception oop; no code emitted" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11855
  size(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11856
  ins_encode( /*empty*/ );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11857
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11858
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11859
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11860
// Rethrow exception: The exception oop will come in the first
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11861
// argument position. Then JUMP (not call) to the rethrow stub code.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11862
instruct RethrowException() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11863
  match(Rethrow);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11864
  ins_cost(CALL_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11865
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11866
  format %{ "Jmp     rethrow_stub" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11867
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11868
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11869
    cbuf.set_insts_mark();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11870
    __ b64_patchable((address)OptoRuntime::rethrow_stub(), relocInfo::runtime_call_type);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11871
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11872
  ins_pipe(pipe_class_call);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11873
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11874
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11875
// Die now.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11876
instruct ShouldNotReachHere() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11877
  match(Halt);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11878
  ins_cost(CALL_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11879
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11880
  format %{ "ShouldNotReachHere" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11881
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11882
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11883
    // TODO: PPC port $archOpcode(ppc64Opcode_tdi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11884
    __ trap_should_not_reach_here();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11885
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11886
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11887
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11888
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11889
// This name is KNOWN by the ADLC and cannot be changed.  The ADLC
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11890
// forces a 'TypeRawPtr::BOTTOM' output type for this guy.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11891
// Get a DEF on threadRegP, no costs, no encoding, use
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11892
// 'ins_should_rematerialize(true)' to avoid spilling.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11893
instruct tlsLoadP(threadRegP dst) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11894
  match(Set dst (ThreadLocal));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11895
  ins_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11896
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11897
  ins_should_rematerialize(true);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11898
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11899
  format %{ " -- \t// $dst=Thread::current(), empty" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11900
  size(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11901
  ins_encode( /*empty*/ );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11902
  ins_pipe(pipe_class_empty);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11903
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11904
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11905
//---Some PPC specific nodes---------------------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11906
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11907
// Stop a group.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11908
instruct endGroup() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11909
  ins_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11910
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11911
  ins_is_nop(true);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11912
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11913
  format %{ "End Bundle (ori r1, r1, 0)" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11914
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11915
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11916
    // TODO: PPC port $archOpcode(ppc64Opcode_endgroup);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11917
    __ endgroup();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11918
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11919
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11920
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11921
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11922
// Nop instructions
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11923
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11924
instruct fxNop() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11925
  ins_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11926
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11927
  ins_is_nop(true);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11928
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11929
  format %{ "fxNop" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11930
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11931
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11932
    // TODO: PPC port $archOpcode(ppc64Opcode_fmr);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11933
    __ nop();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11934
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11935
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11936
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11937
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11938
instruct fpNop0() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11939
  ins_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11940
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11941
  ins_is_nop(true);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11942
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11943
  format %{ "fpNop0" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11944
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11945
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11946
    // TODO: PPC port $archOpcode(ppc64Opcode_fmr);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11947
    __ fpnop0();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11948
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11949
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11950
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11951
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11952
instruct fpNop1() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11953
  ins_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11954
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11955
  ins_is_nop(true);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11956
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11957
  format %{ "fpNop1" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11958
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11959
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11960
    // TODO: PPC port $archOpcode(ppc64Opcode_fmr);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11961
    __ fpnop1();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11962
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11963
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11964
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11965
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11966
instruct brNop0() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11967
  ins_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11968
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11969
  format %{ "brNop0" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11970
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11971
    // TODO: PPC port $archOpcode(ppc64Opcode_mcrf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11972
    __ brnop0();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11973
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11974
  ins_is_nop(true);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11975
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11976
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11977
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11978
instruct brNop1() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11979
  ins_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11980
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11981
  ins_is_nop(true);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11982
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11983
  format %{ "brNop1" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11984
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11985
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11986
    // TODO: PPC port $archOpcode(ppc64Opcode_mcrf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11987
    __ brnop1();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11988
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11989
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11990
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11991
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11992
instruct brNop2() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11993
  ins_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11994
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11995
  ins_is_nop(true);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11996
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11997
  format %{ "brNop2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11998
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11999
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12000
    // TODO: PPC port $archOpcode(ppc64Opcode_mcrf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12001
    __ brnop2();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12002
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12003
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12004
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12005
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12006
//----------PEEPHOLE RULES-----------------------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12007
// These must follow all instruction definitions as they use the names
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12008
// defined in the instructions definitions.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12009
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12010
// peepmatch ( root_instr_name [preceeding_instruction]* );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12011
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12012
// peepconstraint %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12013
// (instruction_number.operand_name relational_op instruction_number.operand_name
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12014
//  [, ...] );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12015
// // instruction numbers are zero-based using left to right order in peepmatch
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12016
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12017
// peepreplace ( instr_name ( [instruction_number.operand_name]* ) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12018
// // provide an instruction_number.operand_name for each operand that appears
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12019
// // in the replacement instruction's match rule
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12020
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12021
// ---------VM FLAGS---------------------------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12022
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12023
// All peephole optimizations can be turned off using -XX:-OptoPeephole
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12024
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12025
// Each peephole rule is given an identifying number starting with zero and
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12026
// increasing by one in the order seen by the parser. An individual peephole
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12027
// can be enabled, and all others disabled, by using -XX:OptoPeepholeAt=#
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12028
// on the command-line.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12029
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12030
// ---------CURRENT LIMITATIONS----------------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12031
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12032
// Only match adjacent instructions in same basic block
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12033
// Only equality constraints
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12034
// Only constraints between operands, not (0.dest_reg == EAX_enc)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12035
// Only one replacement instruction
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12036
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12037
// ---------EXAMPLE----------------------------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12038
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12039
// // pertinent parts of existing instructions in architecture description
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12040
// instruct movI(eRegI dst, eRegI src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12041
//   match(Set dst (CopyI src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12042
// %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12043
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12044
// instruct incI_eReg(eRegI dst, immI1 src, eFlagsReg cr) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12045
//   match(Set dst (AddI dst src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12046
//   effect(KILL cr);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12047
// %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12048
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12049
// // Change (inc mov) to lea
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12050
// peephole %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12051
//   // increment preceeded by register-register move
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12052
//   peepmatch ( incI_eReg movI );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12053
//   // require that the destination register of the increment
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12054
//   // match the destination register of the move
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12055
//   peepconstraint ( 0.dst == 1.dst );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12056
//   // construct a replacement instruction that sets
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12057
//   // the destination to ( move's source register + one )
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12058
//   peepreplace ( leaI_eReg_immI( 0.dst 1.src 0.src ) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12059
// %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12060
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12061
// Implementation no longer uses movX instructions since
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12062
// machine-independent system no longer uses CopyX nodes.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12063
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12064
// peephole %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12065
//   peepmatch ( incI_eReg movI );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12066
//   peepconstraint ( 0.dst == 1.dst );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12067
//   peepreplace ( leaI_eReg_immI( 0.dst 1.src 0.src ) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12068
// %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12069
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12070
// peephole %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12071
//   peepmatch ( decI_eReg movI );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12072
//   peepconstraint ( 0.dst == 1.dst );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12073
//   peepreplace ( leaI_eReg_immI( 0.dst 1.src 0.src ) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12074
// %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12075
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12076
// peephole %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12077
//   peepmatch ( addI_eReg_imm movI );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12078
//   peepconstraint ( 0.dst == 1.dst );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12079
//   peepreplace ( leaI_eReg_immI( 0.dst 1.src 0.src ) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12080
// %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12081
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12082
// peephole %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12083
//   peepmatch ( addP_eReg_imm movP );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12084
//   peepconstraint ( 0.dst == 1.dst );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12085
//   peepreplace ( leaP_eReg_immI( 0.dst 1.src 0.src ) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12086
// %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12087
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12088
// // Change load of spilled value to only a spill
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12089
// instruct storeI(memory mem, eRegI src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12090
//   match(Set mem (StoreI mem src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12091
// %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12092
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12093
// instruct loadI(eRegI dst, memory mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12094
//   match(Set dst (LoadI mem));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12095
// %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12096
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12097
peephole %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12098
  peepmatch ( loadI storeI );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12099
  peepconstraint ( 1.src == 0.dst, 1.mem == 0.mem );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12100
  peepreplace ( storeI( 1.mem 1.mem 1.src ) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12101
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12102
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12103
peephole %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12104
  peepmatch ( loadL storeL );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12105
  peepconstraint ( 1.src == 0.dst, 1.mem == 0.mem );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12106
  peepreplace ( storeL( 1.mem 1.mem 1.src ) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12107
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12108
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12109
peephole %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12110
  peepmatch ( loadP storeP );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12111
  peepconstraint ( 1.src == 0.dst, 1.dst == 0.mem );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12112
  peepreplace ( storeP( 1.dst 1.dst 1.src ) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12113
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12114
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12115
//----------SMARTSPILL RULES---------------------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12116
// These must follow all instruction definitions as they use the names
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12117
// defined in the instructions definitions.